@adyen/adyen-web 6.40.2 → 6.41.1

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 (99) hide show
  1. package/dist/cjs/index.cjs +2 -2
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.d.cts +35 -25
  4. package/dist/es/components/ANCV/ANCV.js +1 -1
  5. package/dist/es/components/ANCV/ANCV.js.map +1 -1
  6. package/dist/es/components/ANCV/components/ANCVInput.js +1 -1
  7. package/dist/es/components/ANCV/components/ANCVInput.js.map +1 -1
  8. package/dist/es/components/Card/Card.js +1 -1
  9. package/dist/es/components/Card/Card.js.map +1 -1
  10. package/dist/es/components/CustomCard/CustomCard.js +1 -1
  11. package/dist/es/components/CustomCard/CustomCard.js.map +1 -1
  12. package/dist/es/components/Dropin/Dropin.js +1 -1
  13. package/dist/es/components/Dropin/Dropin.js.map +1 -1
  14. package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
  15. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  16. package/dist/es/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  17. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  18. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  19. package/dist/es/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  20. package/dist/es/components/Giftcard/Giftcard.js.map +1 -1
  21. package/dist/es/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  22. package/dist/es/components/Giftcard/components/GiftcardPinField.js +1 -1
  23. package/dist/es/components/Giftcard/components/GiftcardPinField.js.map +1 -1
  24. package/dist/es/components/MealVoucherFR/components/MealVoucherExpiryField.js +1 -1
  25. package/dist/es/components/MealVoucherFR/components/MealVoucherExpiryField.js.map +1 -1
  26. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  27. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  28. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  29. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  30. package/dist/es/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
  31. package/dist/es/components/internal/Address/validate.formats.js +1 -1
  32. package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
  33. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
  34. package/dist/es/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  35. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  36. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  37. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  38. package/dist/es/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  39. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  40. package/dist/es/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  41. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
  42. package/dist/es/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  43. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
  44. package/dist/es/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  45. package/dist/es/core/config.js +1 -1
  46. package/dist/es/index.d.ts +35 -25
  47. package/dist/es/utils/commonUtils.js +1 -1
  48. package/dist/es/utils/commonUtils.js.map +1 -1
  49. package/dist/es/utils/promiseTimeout.js.map +1 -1
  50. package/dist/es/utils/validator-utils.js +1 -1
  51. package/dist/es/utils/validator-utils.js.map +1 -1
  52. package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
  53. package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
  54. package/dist/es-legacy/components/ANCV/components/ANCVInput.js +1 -1
  55. package/dist/es-legacy/components/ANCV/components/ANCVInput.js.map +1 -1
  56. package/dist/es-legacy/components/Card/Card.js +1 -1
  57. package/dist/es-legacy/components/Card/Card.js.map +1 -1
  58. package/dist/es-legacy/components/CustomCard/CustomCard.js +1 -1
  59. package/dist/es-legacy/components/CustomCard/CustomCard.js.map +1 -1
  60. package/dist/es-legacy/components/Dropin/Dropin.js +1 -1
  61. package/dist/es-legacy/components/Dropin/Dropin.js.map +1 -1
  62. package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
  63. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  64. package/dist/es-legacy/components/Dropin/components/PaymentMethod/OrderPaymentMethods.js.map +1 -1
  65. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodList.js.map +1 -1
  66. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js +1 -1
  67. package/dist/es-legacy/components/Dropin/components/PaymentMethod/PaymentMethodsContainer.js.map +1 -1
  68. package/dist/es-legacy/components/Giftcard/Giftcard.js.map +1 -1
  69. package/dist/es-legacy/components/Giftcard/components/GiftcardComponent.js.map +1 -1
  70. package/dist/es-legacy/components/Giftcard/components/GiftcardPinField.js +1 -1
  71. package/dist/es-legacy/components/Giftcard/components/GiftcardPinField.js.map +1 -1
  72. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherExpiryField.js +1 -1
  73. package/dist/es-legacy/components/MealVoucherFR/components/MealVoucherExpiryField.js.map +1 -1
  74. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  75. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  76. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  77. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  78. package/dist/es-legacy/components/ThreeDS2/components/DeviceFingerprint/DoFingerprint3DS2.js.map +1 -1
  79. package/dist/es-legacy/components/internal/Address/validate.formats.js +1 -1
  80. package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
  81. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js +1 -1
  82. package/dist/es-legacy/components/internal/ClickToPay/context/ClickToPayProvider.js.map +1 -1
  83. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  84. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  85. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js +1 -1
  86. package/dist/es-legacy/components/internal/OpenInvoice/OpenInvoice.js.map +1 -1
  87. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js +1 -1
  88. package/dist/es-legacy/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.js.map +1 -1
  89. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js +1 -1
  90. package/dist/es-legacy/components/internal/SecuredFields/binLookup/triggerBinLookUp.js.map +1 -1
  91. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js +1 -1
  92. package/dist/es-legacy/core/Analytics/events/AnalyticsErrorEvent.js.map +1 -1
  93. package/dist/es-legacy/core/config.js +1 -1
  94. package/dist/es-legacy/utils/commonUtils.js +1 -1
  95. package/dist/es-legacy/utils/commonUtils.js.map +1 -1
  96. package/dist/es-legacy/utils/promiseTimeout.js.map +1 -1
  97. package/dist/es-legacy/utils/validator-utils.js +1 -1
  98. package/dist/es-legacy/utils/validator-utils.js.map +1 -1
  99. package/package.json +19 -19
@@ -1 +1 @@
1
- {"version":3,"file":"useSRPanelForOpenInvoiceErrors.js","sources":["../../../../../src/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.ts"],"sourcesContent":["import { useEffect, useState, useMemo, MutableRef } from 'preact/hooks';\nimport { enhanceErrorObjectKeys } from '../../../core/Errors/utils';\nimport { COMPANY_DETAILS_SCHEMA } from '../CompanyDetails/CompanyDetails';\nimport { PERSONAL_DETAILS_SCHEMA } from '../PersonalDetails/PersonalDetails';\nimport { SetSRMessagesReturnObject } from '../../../core/Errors/types';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../core/Errors/constants';\nimport useSRPanelContext from '../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../core/Errors/SRPanelProvider';\nimport Specifications from '../Address/Specifications';\nimport { setFocusOnField } from '../../../utils/setFocus';\nimport { usePrevious } from '../../../utils/hookUtils';\nimport { getArrayDifferences } from '../../../utils/arrayUtils';\nimport { mapFieldKey } from './utils';\nimport { OpenInvoiceProps, OpenInvoiceStateData, OpenInvoiceStateError } from './types';\n\ninterface UseSRPanelForErrorsProps {\n errors: OpenInvoiceStateError;\n data: OpenInvoiceStateData;\n props: OpenInvoiceProps;\n isValidating: MutableRef<boolean>;\n}\n\nconst useSRPanelForOpenInvoiceErrors = ({ errors, data, props, isValidating }: UseSRPanelForErrorsProps) => {\n // Relates to onBlur errors\n const [sortedErrorList, setSortedErrorList] = useState(null);\n // Get the previous value (Relates to onBlur errors)\n const previousSortedErrors = usePrevious(sortedErrorList);\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n\n const billingAddressSpecifications = useMemo(() => new Specifications(), []);\n const deliveryAddressSpecifications = useMemo(() => new Specifications(props.deliveryAddressSpecification), []);\n\n useEffect(() => {\n try {\n const DELIVERY_ADDRESS_PREFIX = 'deliveryAddress:';\n const BILLING_ADDRESS_PREFIX = 'billingAddress:';\n\n /** Create messages for SRPanel */\n // Extract nested errors from the various child components...\n const {\n companyDetails: extractedCompanyDetailsErrors,\n personalDetails: extractedPersonalDetailsErrors,\n bankAccount: extractedBankAccountErrors,\n billingAddress: extractedBillingAddressErrors,\n deliveryAddress: extractedDeliveryAddressErrors,\n ...remainingErrors\n } = errors;\n\n // Differentiate between billingAddress and deliveryAddress errors by adding a prefix.\n // This also allows overlapping errors e.g. now that addresses can contain first & last name fields\n const enhancedBillingAddressErrors = enhanceErrorObjectKeys(extractedBillingAddressErrors, BILLING_ADDRESS_PREFIX);\n const enhancedDeliveryAddressErrors = enhanceErrorObjectKeys(extractedDeliveryAddressErrors, DELIVERY_ADDRESS_PREFIX);\n\n // ...and then collate the errors into a new object so that they all sit at top level\n const errorsForPanel = {\n ...(typeof extractedCompanyDetailsErrors === 'object' && extractedCompanyDetailsErrors),\n ...(typeof extractedPersonalDetailsErrors === 'object' && extractedPersonalDetailsErrors),\n ...(typeof extractedBankAccountErrors === 'object' && extractedBankAccountErrors),\n ...(typeof enhancedBillingAddressErrors === 'object' && enhancedBillingAddressErrors),\n ...(typeof enhancedDeliveryAddressErrors === 'object' && enhancedDeliveryAddressErrors),\n ...remainingErrors\n };\n\n // Create layout\n const companyDetailsLayout: string[] = COMPANY_DETAILS_SCHEMA;\n\n const personalDetailsReqFields: string[] = props.personalDetailsRequiredFields ?? PERSONAL_DETAILS_SCHEMA;\n const personalDetailLayout: string[] = PERSONAL_DETAILS_SCHEMA.filter(x => personalDetailsReqFields?.includes(x));\n\n const bankAccountLayout = ['holder', 'iban'];\n\n const billingAddressLayout = billingAddressSpecifications.getAddressSchemaForCountryFlat(data.billingAddress?.country);\n // In order to sort the address errors the layout entries need to have the same (prefixed) identifier as the errors themselves\n const billingAddressLayoutEnhanced = billingAddressLayout.map(item => `${BILLING_ADDRESS_PREFIX}${item}`);\n\n const deliveryAddressLayout = deliveryAddressSpecifications.getAddressSchemaForCountryFlat(data.deliveryAddress?.country);\n const deliveryAddressLayoutEnhanced = deliveryAddressLayout.map(item => `${DELIVERY_ADDRESS_PREFIX}${item}`);\n\n const fullLayout = companyDetailsLayout.concat(\n personalDetailLayout,\n bankAccountLayout,\n billingAddressLayoutEnhanced,\n deliveryAddressLayoutEnhanced,\n ['consentCheckbox']\n );\n\n // Country specific address labels\n const countrySpecificLabels_billing = billingAddressSpecifications.getAddressLabelsForCountry(data.billingAddress?.country);\n const countrySpecificLabels_delivery = deliveryAddressSpecifications.getAddressLabelsForCountry(data.deliveryAddress?.country);\n\n // Set messages: Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: fullLayout,\n countrySpecificLabels: { ...countrySpecificLabels_billing, ...countrySpecificLabels_delivery }\n });\n\n // Relates to onBlur errors\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n setSortedErrorList(currentErrorsSortedByLayout); // Relates to onBlur errors\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD: {\n /**\n * For prefixed fields (ones that can occur twice but in different contexts i.e. billingAddress & deliveryAddress) - consider the prefix...\n */\n // ...Firstly strip it to gain a \"clean\" reference to the field...\n const fieldToFocus = srPanelResp.fieldToFocus.includes(':') ? srPanelResp.fieldToFocus.split(':')[1] : srPanelResp.fieldToFocus; // country, street etc\n\n // ...Secondly use the prefix to add context for when we try to select it\n let focusContextSelector = '';\n const focusContext = srPanelResp.fieldToFocus.includes(':') ? srPanelResp.fieldToFocus.split(':')[0] : ''; // 'billingAddress' | 'deliveryAddress'\n if (focusContext.length) {\n focusContextSelector = `.adyen-checkout__fieldset--${focusContext} `;\n }\n\n // Focus first field in error, if required\n if (shouldMoveFocusSR) setFocusOnField('.adyen-checkout__open-invoice', fieldToFocus, focusContextSelector);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n }\n\n /**\n * Relates to errors triggered by a field blurring (some pm forms have this, some don't) - check if there is an error to either set or to clear\n */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Is error actually a blur based one - depends on the specific fields in a component as to whether they validate on blur\n const isBlurBasedError = latestErrorMsg.field === 'shopperEmail' && latestErrorMsg.errorCode === 'field.error.invalid';\n\n // Only add blur based errors to the error panel - doing this step prevents the non-blur based errors from being read out twice\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n clearSRPanel();\n }\n\n break;\n }\n default:\n break;\n }\n } catch (_) {\n // We don't handle the error related to the sr panel, let it fail silently.\n }\n }, [errors, data]);\n};\n\nexport default useSRPanelForOpenInvoiceErrors;\n"],"names":["useSRPanelForOpenInvoiceErrors","errors","data","props","isValidating","sortedErrorList","setSortedErrorList","useState","previousSortedErrors","usePrevious","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","billingAddressSpecifications","useMemo","Specifications","deliveryAddressSpecifications","deliveryAddressSpecification","useEffect","DELIVERY_ADDRESS_PREFIX","BILLING_ADDRESS_PREFIX","companyDetails","extractedCompanyDetailsErrors","personalDetails","extractedPersonalDetailsErrors","bankAccount","extractedBankAccountErrors","billingAddress","extractedBillingAddressErrors","deliveryAddress","extractedDeliveryAddressErrors","remainingErrors","enhancedBillingAddressErrors","enhanceErrorObjectKeys","enhancedDeliveryAddressErrors","errorsForPanel","companyDetailsLayout","COMPANY_DETAILS_SCHEMA","personalDetailsReqFields","personalDetailsRequiredFields","PERSONAL_DETAILS_SCHEMA","personalDetailLayout","filter","x","includes","bankAccountLayout","billingAddressLayoutEnhanced","getAddressSchemaForCountryFlat","country","map","item","deliveryAddressLayoutEnhanced","fullLayout","concat","countrySpecificLabels_billing","getAddressLabelsForCountry","countrySpecificLabels_delivery","srPanelResp","current","layout","countrySpecificLabels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","fieldToFocus","split","focusContextSelector","focusContext","length","setFocusOnField","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","field","errorCode","errorMessage","_"],"mappings":"6vBAsBA,MAAMA,EAAiC,EAAGC,SAAQC,OAAMC,QAAOC,mBAE3D,MAAOC,EAAiBC,GAAsBC,EAAS,MAEjDC,EAAuBC,EAAYJ,IACnCK,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA,EAAYC,kBAAEA,GAAsBC,IAE1FC,EAAuCL,IAA2B,CACpEM,mBAAoBC,IAGlBC,EAA+BC,EAAQ,IAAM,IAAIC,EAAkB,IACnEC,EAAgCF,EAAQ,IAAM,IAAIC,EAAejB,EAAMmB,8BAA+B,IAE5GC,EAAU,KACN,IACI,MAAMC,EAA0B,mBAC1BC,EAAyB,mBAK3BC,eAAgBC,EAChBC,gBAAiBC,EACjBC,YAAaC,EACbC,eAAgBC,EAChBC,gBAAiBC,KACdC,GACHnC,EAIEoC,EAA+BC,EAAuBL,EAA+BR,GACrFc,EAAgCD,EAAuBH,EAAgCX,GAGvFgB,EAAiB,IAC0B,iBAAlCb,GAA8CA,KACX,iBAAnCE,GAA+CA,KAChB,iBAA/BE,GAA2CA,KACV,iBAAjCM,GAA6CA,KACX,iBAAlCE,GAA8CA,KACtDH,GAIDK,EAAiCC,EAEjCC,EAAqCxC,EAAMyC,+BAAiCC,EAC5EC,EAAiCD,EAAwBE,OAAOC,GAAKL,GAA0BM,SAASD,IAExGE,EAAoB,CAAC,SAAU,QAI/BC,EAFuBjC,EAA6BkC,+BAA+BlD,EAAK8B,gBAAgBqB,SAEpDC,IAAIC,GAAQ,GAAG9B,IAAyB8B,KAG5FC,EADwBnC,EAA8B+B,+BAA+BlD,EAAKgC,iBAAiBmB,SACrDC,IAAIC,GAAQ,GAAG/B,IAA0B+B,KAE/FE,EAAahB,EAAqBiB,OACpCZ,EACAI,EACAC,EACAK,EACA,CAAC,oBAICG,EAAgCzC,EAA6B0C,2BAA2B1D,EAAK8B,gBAAgBqB,SAC7GQ,EAAiCxC,EAA8BuC,2BAA2B1D,EAAKgC,iBAAiBmB,SAGhHS,EAAyC/C,IAAgB,CAC3Dd,OAAQuC,EACRpC,aAAcA,EAAa2D,QAC3BC,OAAQP,EACRQ,sBAAuB,IAAKN,KAAkCE,KAI5DK,EAA8BJ,GAAaI,4BAQjD,OALA5D,EAAmB4D,GAKXJ,GAAaK,QAEjB,KAAKC,EAA0B,CAK3B,MAAMC,EAAeP,EAAYO,aAAapB,SAAS,KAAOa,EAAYO,aAAaC,MAAM,KAAK,GAAKR,EAAYO,aAGnH,IAAIE,EAAuB,GAC3B,MAAMC,EAAeV,EAAYO,aAAapB,SAAS,KAAOa,EAAYO,aAAaC,MAAM,KAAK,GAAK,GACnGE,EAAaC,SACbF,EAAuB,8BAA8BC,MAIrD3D,GAAmB6D,EAAgB,gCAAiCL,EAAcE,GAEtFI,WAAW,KACPvE,EAAa2D,SAAU,GACxB,KACH,KACJ,CAKA,KAAKa,EAA4B,CAC7B,MAAMC,EAAaC,EAAoBZ,EAA6B1D,EAAsB,SAEpFuE,EAAiBF,IAAa,GAEpC,GAAIE,EAAgB,CAEhB,MAGMC,EAH4C,iBAAzBD,EAAeE,OAAyD,wBAA7BF,EAAeG,UAG1CH,EAAeI,aAAe,KACvExE,EAAyBqE,EAC7B,MAEIpE,IAGJ,KACJ,EAIR,CAAE,MAAOwE,GAET,GACD,CAACnF,EAAQC"}
1
+ {"version":3,"file":"useSRPanelForOpenInvoiceErrors.js","sources":["../../../../../src/components/internal/OpenInvoice/useSRPanelForOpenInvoiceErrors.ts"],"sourcesContent":["import { useEffect, useState, useMemo, MutableRef } from 'preact/hooks';\nimport { enhanceErrorObjectKeys } from '../../../core/Errors/utils';\nimport { COMPANY_DETAILS_SCHEMA } from '../CompanyDetails/CompanyDetails';\nimport { PERSONAL_DETAILS_SCHEMA } from '../PersonalDetails/PersonalDetails';\nimport { SetSRMessagesReturnObject } from '../../../core/Errors/types';\nimport { ERROR_ACTION_BLUR_SCENARIO, ERROR_ACTION_FOCUS_FIELD } from '../../../core/Errors/constants';\nimport useSRPanelContext from '../../../core/Errors/useSRPanelContext';\nimport { SetSRMessagesReturnFn } from '../../../core/Errors/SRPanelProvider';\nimport Specifications from '../Address/Specifications';\nimport { setFocusOnField } from '../../../utils/setFocus';\nimport { usePrevious } from '../../../utils/hookUtils';\nimport { getArrayDifferences } from '../../../utils/arrayUtils';\nimport { mapFieldKey } from './utils';\nimport { OpenInvoiceProps, OpenInvoiceStateData, OpenInvoiceStateError } from './types';\n\ninterface UseSRPanelForErrorsProps {\n errors: OpenInvoiceStateError;\n data: OpenInvoiceStateData;\n props: OpenInvoiceProps;\n isValidating: MutableRef<boolean>;\n containerRef: MutableRef<HTMLDivElement | null>;\n}\n\nconst useSRPanelForOpenInvoiceErrors = ({ errors, data, props, isValidating, containerRef }: UseSRPanelForErrorsProps) => {\n // Relates to onBlur errors\n const [sortedErrorList, setSortedErrorList] = useState(null);\n // Get the previous value (Relates to onBlur errors)\n const previousSortedErrors = usePrevious(sortedErrorList);\n const { setSRMessagesFromObjects, setSRMessagesFromStrings, clearSRPanel, shouldMoveFocusSR } = useSRPanelContext();\n // Generate a setSRMessages function - implemented as a partial, since the initial set of arguments don't change.\n const setSRMessages: SetSRMessagesReturnFn = setSRMessagesFromObjects?.({\n fieldTypeMappingFn: mapFieldKey\n });\n\n const billingAddressSpecifications = useMemo(() => new Specifications(), []);\n const deliveryAddressSpecifications = useMemo(() => new Specifications(props.deliveryAddressSpecification), []);\n\n useEffect(() => {\n try {\n const DELIVERY_ADDRESS_PREFIX = 'deliveryAddress:';\n const BILLING_ADDRESS_PREFIX = 'billingAddress:';\n\n /** Create messages for SRPanel */\n // Extract nested errors from the various child components...\n const {\n companyDetails: extractedCompanyDetailsErrors,\n personalDetails: extractedPersonalDetailsErrors,\n bankAccount: extractedBankAccountErrors,\n billingAddress: extractedBillingAddressErrors,\n deliveryAddress: extractedDeliveryAddressErrors,\n ...remainingErrors\n } = errors;\n\n // Differentiate between billingAddress and deliveryAddress errors by adding a prefix.\n // This also allows overlapping errors e.g. now that addresses can contain first & last name fields\n const enhancedBillingAddressErrors = enhanceErrorObjectKeys(extractedBillingAddressErrors, BILLING_ADDRESS_PREFIX);\n const enhancedDeliveryAddressErrors = enhanceErrorObjectKeys(extractedDeliveryAddressErrors, DELIVERY_ADDRESS_PREFIX);\n\n // ...and then collate the errors into a new object so that they all sit at top level\n const errorsForPanel = {\n ...(typeof extractedCompanyDetailsErrors === 'object' && extractedCompanyDetailsErrors),\n ...(typeof extractedPersonalDetailsErrors === 'object' && extractedPersonalDetailsErrors),\n ...(typeof extractedBankAccountErrors === 'object' && extractedBankAccountErrors),\n ...(typeof enhancedBillingAddressErrors === 'object' && enhancedBillingAddressErrors),\n ...(typeof enhancedDeliveryAddressErrors === 'object' && enhancedDeliveryAddressErrors),\n ...remainingErrors\n };\n\n // Create layout\n const companyDetailsLayout: string[] = COMPANY_DETAILS_SCHEMA;\n\n const personalDetailsReqFields: string[] = props.personalDetailsRequiredFields ?? PERSONAL_DETAILS_SCHEMA;\n const personalDetailLayout: string[] = PERSONAL_DETAILS_SCHEMA.filter(x => personalDetailsReqFields?.includes(x));\n\n const bankAccountLayout = ['holder', 'iban'];\n\n const billingAddressLayout = billingAddressSpecifications.getAddressSchemaForCountryFlat(data.billingAddress?.country);\n // In order to sort the address errors the layout entries need to have the same (prefixed) identifier as the errors themselves\n const billingAddressLayoutEnhanced = billingAddressLayout.map(item => `${BILLING_ADDRESS_PREFIX}${item}`);\n\n const deliveryAddressLayout = deliveryAddressSpecifications.getAddressSchemaForCountryFlat(data.deliveryAddress?.country);\n const deliveryAddressLayoutEnhanced = deliveryAddressLayout.map(item => `${DELIVERY_ADDRESS_PREFIX}${item}`);\n\n const fullLayout = companyDetailsLayout.concat(\n personalDetailLayout,\n bankAccountLayout,\n billingAddressLayoutEnhanced,\n deliveryAddressLayoutEnhanced,\n ['consentCheckbox']\n );\n\n // Country specific address labels\n const countrySpecificLabels_billing = billingAddressSpecifications.getAddressLabelsForCountry(data.billingAddress?.country);\n const countrySpecificLabels_delivery = deliveryAddressSpecifications.getAddressLabelsForCountry(data.deliveryAddress?.country);\n\n // Set messages: Pass dynamic props (errors, layout etc) to SRPanel via partial\n const srPanelResp: SetSRMessagesReturnObject = setSRMessages?.({\n errors: errorsForPanel,\n isValidating: isValidating.current,\n layout: fullLayout,\n countrySpecificLabels: { ...countrySpecificLabels_billing, ...countrySpecificLabels_delivery }\n });\n\n // Relates to onBlur errors\n const currentErrorsSortedByLayout = srPanelResp?.currentErrorsSortedByLayout;\n\n // Store the array of sorted error objects separately so that we can use it to make comparisons between the old and new arrays\n setSortedErrorList(currentErrorsSortedByLayout); // Relates to onBlur errors\n\n /**\n * Need extra actions after setting SRPanel messages in order to focus field (if required) and because we have some errors that are fired onBlur\n */\n switch (srPanelResp?.action) {\n // A call to focus the first field in error will always follow the call to validate the whole form\n case ERROR_ACTION_FOCUS_FIELD: {\n /**\n * For prefixed fields (ones that can occur twice but in different contexts i.e. billingAddress & deliveryAddress) - consider the prefix...\n */\n // ...Firstly strip it to gain a \"clean\" reference to the field...\n const fieldToFocus = srPanelResp.fieldToFocus.includes(':') ? srPanelResp.fieldToFocus.split(':')[1] : srPanelResp.fieldToFocus; // country, street etc\n\n // ...Secondly use the prefix to add context for when we try to select it\n let focusContextSelector = '';\n const focusContext = srPanelResp.fieldToFocus.includes(':') ? srPanelResp.fieldToFocus.split(':')[0] : ''; // 'billingAddress' | 'deliveryAddress'\n if (focusContext.length) {\n focusContextSelector = `.adyen-checkout__fieldset--${focusContext} `;\n }\n\n // Focus first field in error, if required\n // Use the component's own container ref (rather than a global class selector) so that, when multiple\n // OpenInvoice-based components are rendered on the same page, focus moves within the correct instance\n if (shouldMoveFocusSR && containerRef.current) setFocusOnField(containerRef.current, fieldToFocus, focusContextSelector);\n // Remove 'showValidation' mode - allowing time for collation of all the fields in error whilst it is 'showValidation' mode (some errors come in a second render pass)\n setTimeout(() => {\n isValidating.current = false;\n }, 300);\n break;\n }\n\n /**\n * Relates to errors triggered by a field blurring (some pm forms have this, some don't) - check if there is an error to either set or to clear\n */\n case ERROR_ACTION_BLUR_SCENARIO: {\n const difference = getArrayDifferences(currentErrorsSortedByLayout, previousSortedErrors, 'field');\n\n const latestErrorMsg = difference?.[0];\n\n if (latestErrorMsg) {\n // Is error actually a blur based one - depends on the specific fields in a component as to whether they validate on blur\n const isBlurBasedError = latestErrorMsg.field === 'shopperEmail' && latestErrorMsg.errorCode === 'field.error.invalid';\n\n // Only add blur based errors to the error panel - doing this step prevents the non-blur based errors from being read out twice\n const latestSRError = isBlurBasedError ? latestErrorMsg.errorMessage : null;\n setSRMessagesFromStrings(latestSRError);\n } else {\n // called when previousSortedErrors.length >= currentErrorsSortedByLayout.length\n clearSRPanel();\n }\n\n break;\n }\n default:\n break;\n }\n } catch (_) {\n // We don't handle the error related to the sr panel, let it fail silently.\n }\n }, [errors, data]);\n};\n\nexport default useSRPanelForOpenInvoiceErrors;\n"],"names":["useSRPanelForOpenInvoiceErrors","errors","data","props","isValidating","containerRef","sortedErrorList","setSortedErrorList","useState","previousSortedErrors","usePrevious","setSRMessagesFromObjects","setSRMessagesFromStrings","clearSRPanel","shouldMoveFocusSR","useSRPanelContext","setSRMessages","fieldTypeMappingFn","mapFieldKey","billingAddressSpecifications","useMemo","Specifications","deliveryAddressSpecifications","deliveryAddressSpecification","useEffect","DELIVERY_ADDRESS_PREFIX","BILLING_ADDRESS_PREFIX","companyDetails","extractedCompanyDetailsErrors","personalDetails","extractedPersonalDetailsErrors","bankAccount","extractedBankAccountErrors","billingAddress","extractedBillingAddressErrors","deliveryAddress","extractedDeliveryAddressErrors","remainingErrors","enhancedBillingAddressErrors","enhanceErrorObjectKeys","enhancedDeliveryAddressErrors","errorsForPanel","companyDetailsLayout","COMPANY_DETAILS_SCHEMA","personalDetailsReqFields","personalDetailsRequiredFields","PERSONAL_DETAILS_SCHEMA","personalDetailLayout","filter","x","includes","bankAccountLayout","billingAddressLayoutEnhanced","getAddressSchemaForCountryFlat","country","map","item","deliveryAddressLayoutEnhanced","fullLayout","concat","countrySpecificLabels_billing","getAddressLabelsForCountry","countrySpecificLabels_delivery","srPanelResp","current","layout","countrySpecificLabels","currentErrorsSortedByLayout","action","ERROR_ACTION_FOCUS_FIELD","fieldToFocus","split","focusContextSelector","focusContext","length","setFocusOnField","setTimeout","ERROR_ACTION_BLUR_SCENARIO","difference","getArrayDifferences","latestErrorMsg","latestSRError","field","errorCode","errorMessage","_"],"mappings":"6vBAuBA,MAAMA,EAAiC,EAAGC,SAAQC,OAAMC,QAAOC,eAAcC,mBAEzE,MAAOC,EAAiBC,GAAsBC,EAAS,MAEjDC,EAAuBC,EAAYJ,IACnCK,yBAAEA,EAAwBC,yBAAEA,EAAwBC,aAAEA,EAAYC,kBAAEA,GAAsBC,IAE1FC,EAAuCL,IAA2B,CACpEM,mBAAoBC,IAGlBC,EAA+BC,EAAQ,IAAM,IAAIC,EAAkB,IACnEC,EAAgCF,EAAQ,IAAM,IAAIC,EAAelB,EAAMoB,8BAA+B,IAE5GC,EAAU,KACN,IACI,MAAMC,EAA0B,mBAC1BC,EAAyB,mBAK3BC,eAAgBC,EAChBC,gBAAiBC,EACjBC,YAAaC,EACbC,eAAgBC,EAChBC,gBAAiBC,KACdC,GACHpC,EAIEqC,EAA+BC,EAAuBL,EAA+BR,GACrFc,EAAgCD,EAAuBH,EAAgCX,GAGvFgB,EAAiB,IAC0B,iBAAlCb,GAA8CA,KACX,iBAAnCE,GAA+CA,KAChB,iBAA/BE,GAA2CA,KACV,iBAAjCM,GAA6CA,KACX,iBAAlCE,GAA8CA,KACtDH,GAIDK,EAAiCC,EAEjCC,EAAqCzC,EAAM0C,+BAAiCC,EAC5EC,EAAiCD,EAAwBE,OAAOC,GAAKL,GAA0BM,SAASD,IAExGE,EAAoB,CAAC,SAAU,QAI/BC,EAFuBjC,EAA6BkC,+BAA+BnD,EAAK+B,gBAAgBqB,SAEpDC,IAAIC,GAAQ,GAAG9B,IAAyB8B,KAG5FC,EADwBnC,EAA8B+B,+BAA+BnD,EAAKiC,iBAAiBmB,SACrDC,IAAIC,GAAQ,GAAG/B,IAA0B+B,KAE/FE,EAAahB,EAAqBiB,OACpCZ,EACAI,EACAC,EACAK,EACA,CAAC,oBAICG,EAAgCzC,EAA6B0C,2BAA2B3D,EAAK+B,gBAAgBqB,SAC7GQ,EAAiCxC,EAA8BuC,2BAA2B3D,EAAKiC,iBAAiBmB,SAGhHS,EAAyC/C,IAAgB,CAC3Df,OAAQwC,EACRrC,aAAcA,EAAa4D,QAC3BC,OAAQP,EACRQ,sBAAuB,IAAKN,KAAkCE,KAI5DK,EAA8BJ,GAAaI,4BAQjD,OALA5D,EAAmB4D,GAKXJ,GAAaK,QAEjB,KAAKC,EAA0B,CAK3B,MAAMC,EAAeP,EAAYO,aAAapB,SAAS,KAAOa,EAAYO,aAAaC,MAAM,KAAK,GAAKR,EAAYO,aAGnH,IAAIE,EAAuB,GAC3B,MAAMC,EAAeV,EAAYO,aAAapB,SAAS,KAAOa,EAAYO,aAAaC,MAAM,KAAK,GAAK,GACnGE,EAAaC,SACbF,EAAuB,8BAA8BC,MAMrD3D,GAAqBT,EAAa2D,SAASW,EAAgBtE,EAAa2D,QAASM,EAAcE,GAEnGI,WAAW,KACPxE,EAAa4D,SAAU,GACxB,KACH,KACJ,CAKA,KAAKa,EAA4B,CAC7B,MAAMC,EAAaC,EAAoBZ,EAA6B1D,EAAsB,SAEpFuE,EAAiBF,IAAa,GAEpC,GAAIE,EAAgB,CAEhB,MAGMC,EAH4C,iBAAzBD,EAAeE,OAAyD,wBAA7BF,EAAeG,UAG1CH,EAAeI,aAAe,KACvExE,EAAyBqE,EAC7B,MAEIpE,IAGJ,KACJ,EAIR,CAAE,MAAOwE,GAET,GACD,CAACpF,EAAQC"}
@@ -1,2 +1,2 @@
1
- import{httpPost as e}from"../../../../core/Services/http.js";import{DEFAULT_CARD_GROUP_TYPES as r}from"../lib/constants.js";import{SF_ErrorCodes as n}from"../../../../core/Errors/constants.js";var s=s=>{let o=null;return t=>{if(!1!==s.props.doBinLookup){if(t.encryptedBin&&s.props.clientKey)o=t.uuid,e({loadingContext:s.props.loadingContext,path:`v3/bin/binLookup?token=${s.props.clientKey}`},{type:s.props.brand,supportedBrands:s.props.brands||r,encryptedBin:t.encryptedBin,requestId:t.uuid}).then(e=>{if(e?.requestId===o)if(e.brands?.length){const o=e.brands.reduce((e,r)=>(e.detectedBrands.push(r.brand),e.paymentMethodVariants.push(r.paymentMethodVariant),!0===r.supported?(e.supportedBrands.push(r),e):e),{supportedBrands:[],detectedBrands:[],paymentMethodVariants:[]});if(o.supportedBrands.length)return s.processBinLookupResponse({issuingCountryCode:e.issuingCountryCode,supportedBrands:o.supportedBrands,...e.showSocialSecurityNumber?{showSocialSecurityNumber:e.showSocialSecurityNumber}:{}}),void s.onBinLookup({type:t.type,detectedBrands:o.detectedBrands,supportedBrands:o.supportedBrands.map(e=>e.brand),paymentMethodVariants:o.paymentMethodVariants,supportedBrandsRaw:o.supportedBrands,brands:s.props.brands||r,issuingCountryCode:e.issuingCountryCode});if(o.detectedBrands.length){const e={type:"card",fieldType:"encryptedCardNumber",error:n.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,detectedBrands:o.detectedBrands};return s.handleUnsupportedCard(e),void s.onBinLookup({type:t.type,detectedBrands:o.detectedBrands,supportedBrands:null,paymentMethodVariants:o.paymentMethodVariants,brands:s.props.brands||r})}}else s.onBinLookup({type:t.type,detectedBrands:null,supportedBrands:null,brands:s.props.brands||r}),s.processBinLookupResponse({},!0);else e?.requestId||s.props.onError(e||{errorType:"binLookup",message:"unknownError"})});else if(o){s.processBinLookupResponse(null,!0),o=null;const e={type:"card",fieldType:"encryptedCardNumber",error:""};s.handleUnsupportedCard(e),s.onBinLookup({isReset:!0})}s.props.onBinValue&&s.props.onBinValue(t)}else s.props.onBinValue&&s.props.onBinValue(t)}};export{s as default};
1
+ import{httpPost as e}from"../../../../core/Services/http.js";import{DEFAULT_CARD_GROUP_TYPES as r}from"../lib/constants.js";import{SF_ErrorCodes as n}from"../../../../core/Errors/constants.js";import{TxVariants as t}from"../../../tx-variants.js";const s=s=>{let o=null;return p=>{if(!1!==s.props.doBinLookup){if(p.encryptedBin&&"clientKey"in s.props&&s.props.clientKey)o=p.uuid??null,e({loadingContext:s.props.loadingContext,path:`v3/bin/binLookup?token=${s.props.clientKey}`},{type:"brand"in s.props?s.props.brand:t.card,supportedBrands:s.props.brands||r,encryptedBin:p.encryptedBin,requestId:p.uuid}).then(e=>{if(e?.requestId===o)if(e.brands?.length){const t=e.brands.reduce((e,r)=>(e.detectedBrands.push(r.brand),e.paymentMethodVariants.push(r.paymentMethodVariant),void 0!==r.healthcare&&e.healthcare.push({[r.brand]:r.healthcare}),!0===r.supported?(e.supportedBrands.push(r),e):e),{supportedBrands:[],detectedBrands:[],paymentMethodVariants:[],healthcare:[]}),o=t.healthcare.length>0;if(t.supportedBrands.length)return s.processBinLookupResponse({issuingCountryCode:e.issuingCountryCode??"",supportedBrands:t.supportedBrands,...e.showSocialSecurityNumber?{showSocialSecurityNumber:e.showSocialSecurityNumber}:{}}),void s.onBinLookup({type:p.type,detectedBrands:t.detectedBrands,supportedBrands:t.supportedBrands.map(e=>e.brand),paymentMethodVariants:t.paymentMethodVariants,supportedBrandsRaw:t.supportedBrands,brands:s.props.brands||r,issuingCountryCode:e.issuingCountryCode,...o&&{healthcare:t.healthcare}});if(t.detectedBrands.length){const e={type:"card",fieldType:"encryptedCardNumber",error:n.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,detectedBrands:t.detectedBrands};return s.handleUnsupportedCard(e),void s.onBinLookup({type:p.type,detectedBrands:t.detectedBrands,supportedBrands:null,paymentMethodVariants:t.paymentMethodVariants,...o&&{healthcare:t.healthcare},brands:s.props.brands||r})}}else s.onBinLookup({type:p.type,detectedBrands:null,supportedBrands:null,brands:s.props.brands||r}),s.processBinLookupResponse({},!0);else e?.requestId||s.props.onError?.(e||{errorType:"binLookup",message:"unknownError"})});else if(o){s.processBinLookupResponse(null,!0),o=null;const e={type:"card",fieldType:"encryptedCardNumber",error:""};s.handleUnsupportedCard(e),s.onBinLookup({isReset:!0})}s.props.onBinValue&&s.props.onBinValue(p)}else s.props.onBinValue&&s.props.onBinValue(p)}};export{s as triggerBinLookUp};
2
2
  //# sourceMappingURL=triggerBinLookUp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"triggerBinLookUp.js","sources":["../../../../../../src/components/internal/SecuredFields/binLookup/triggerBinLookUp.ts"],"sourcesContent":["import { httpPost } from '../../../../core/Services/http';\nimport { CardBinValueData, CardErrorData } from '../lib/types';\nimport { DEFAULT_CARD_GROUP_TYPES } from '../lib/constants';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { BinLookupResponseRaw } from '../../../Card/types';\n\nif (process.env.NODE_ENV === 'development') {\n window.mockBinCount = 0; // Set to 0 to turn off mocking, 1 to turn it on\n}\n\nexport default parent => {\n let currentRequestId = null;\n\n return (callbackObj: CardBinValueData) => {\n // Allow way for merchant to disallow binLookup by specifically setting the prop to false\n if (parent.props.doBinLookup === false) {\n if (parent.props.onBinValue) parent.props.onBinValue(callbackObj);\n return;\n }\n\n // Do binLookup when encryptedBin property is present (and only if the merchant is using a clientKey)\n if (callbackObj.encryptedBin && parent.props.clientKey) {\n // Store id of request we're about to make\n currentRequestId = callbackObj.uuid;\n\n void httpPost(\n {\n loadingContext: parent.props.loadingContext,\n path: `v3/bin/binLookup?token=${parent.props.clientKey}`\n },\n {\n type: parent.props.brand,\n supportedBrands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES,\n encryptedBin: callbackObj.encryptedBin,\n requestId: callbackObj.uuid // Pass id of request\n }\n ).then((data: BinLookupResponseRaw) => {\n // If response is the one we were waiting for...\n if (data?.requestId === currentRequestId) {\n if (process.env.NODE_ENV === 'development') {\n // TODO mocking\n if (window.mockBinCount >= 1) {\n switch (window.mockBinCount) {\n case 1:\n console.log('\\n### triggerBinLookUp::mock first response:: ');\n data.brands = [\n {\n brand: 'mc',\n cvcPolicy: 'optional',\n enableLuhnCheck: true,\n // showExpiryDate: true, // deprecated in /binLookup v3\n expiryDatePolicy: 'optional',\n // panLength: 16,\n supported: true\n }\n ];\n // data.issuingCountryCode = 'KR'; // needed to mock korean_local_card\n // increment to alter second response\n window.mockBinCount++;\n\n break;\n case 2:\n console.log('\\n### triggerBinLookUp::mock second response:: ');\n // data.brands = null;\n data.brands = [\n {\n brand: 'maestro',\n cvcPolicy: 'required',\n enableLuhnCheck: true,\n showExpiryDate: true,\n supported: true,\n showSocialSecurityNumber: false\n // panLength: 16\n }\n ];\n break;\n default:\n }\n }\n // TODO end\n }\n\n if (data.brands?.length) {\n const mappedResponse = data.brands.reduce(\n (acc, item) => {\n // All brand strings end up in the detectedBrands array\n acc.detectedBrands.push(item.brand);\n // Also add the paymentMethodVariants (more granular description of the txvariant)\n acc.paymentMethodVariants.push(item.paymentMethodVariant);\n\n // Add supported brand objects to the supportedBrands array\n if (item.supported === true) {\n acc.supportedBrands.push(item);\n return acc;\n }\n\n return acc;\n },\n { supportedBrands: [], detectedBrands: [], paymentMethodVariants: [] }\n );\n\n /**\n * supportedBrands = merchant supports this brand(s); we have detected the card number to be of this brand(s); carry on!\n */\n if (mappedResponse.supportedBrands.length) {\n // ...call processBinLookupResponse with, a simplified, response object if it contains at least one supported brand\n parent.processBinLookupResponse({\n issuingCountryCode: data.issuingCountryCode,\n supportedBrands: mappedResponse.supportedBrands,\n ...(data.showSocialSecurityNumber ? { showSocialSecurityNumber: data.showSocialSecurityNumber } : {})\n });\n\n // Inform merchant of the result\n parent.onBinLookup({\n type: callbackObj.type,\n detectedBrands: mappedResponse.detectedBrands,\n // supportedBrands contains the subset of this.props.brands that matches the card number that the shopper has typed\n supportedBrands: mappedResponse.supportedBrands.map(item => item.brand),\n paymentMethodVariants: mappedResponse.paymentMethodVariants,\n supportedBrandsRaw: mappedResponse.supportedBrands, // full supportedBrands data (for customCard comp)\n brands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES,\n issuingCountryCode: data.issuingCountryCode\n });\n\n return;\n }\n\n /**\n * detectedBrands = no brands the merchant supports were found; what we did detect the shopper to be entering was this brand;\n * error!\n */\n if (mappedResponse.detectedBrands.length) {\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n detectedBrands: mappedResponse.detectedBrands\n };\n parent.handleUnsupportedCard(errObj);\n\n // Inform merchant of the result\n parent.onBinLookup({\n type: callbackObj.type,\n detectedBrands: mappedResponse.detectedBrands,\n supportedBrands: null,\n paymentMethodVariants: mappedResponse.paymentMethodVariants,\n brands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES\n });\n\n return;\n }\n } else {\n /**\n * BIN not in DB (a failed lookup will just contain a requestId)\n */\n parent.onBinLookup({\n type: callbackObj.type,\n detectedBrands: null,\n supportedBrands: null,\n brands: parent.props.brands || DEFAULT_CARD_GROUP_TYPES\n });\n\n // Reset the UI and let the native, regex branding happen (for the generic card)\n // For a single-branded card we need to pass a boolean to prompt resetting the brand logo to the 'base' type\n parent.processBinLookupResponse({}, true);\n }\n } else {\n if (!data?.requestId) {\n // Some other kind of error on the backend\n parent.props.onError(data || { errorType: 'binLookup', message: 'unknownError' });\n }\n // Else - response with wrong requestId\n }\n });\n } else if (currentRequestId) {\n /**\n * If onBinValue callback is called AND we have been doing binLookup BUT passed object doesn't have an encryptedBin property\n * - then THE NUMBER OF DIGITS IN NUMBER FIELD HAS DROPPED BELOW THRESHOLD for BIN lookup - so reset the UI\n */\n parent.processBinLookupResponse(null, true);\n\n currentRequestId = null; // Ignore any pending responses\n\n // Reset any errors\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: ''\n };\n parent.handleUnsupportedCard(errObj);\n\n // CustomCard needs this to reset the UI\n parent.onBinLookup({\n isReset: true\n });\n }\n\n if (parent.props.onBinValue) parent.props.onBinValue(callbackObj);\n };\n};\n"],"names":["triggerBinLookUp","parent","currentRequestId","callbackObj","props","doBinLookup","encryptedBin","clientKey","uuid","httpPost","loadingContext","path","type","brand","supportedBrands","brands","DEFAULT_CARD_GROUP_TYPES","requestId","then","data","length","mappedResponse","reduce","acc","item","detectedBrands","push","paymentMethodVariants","paymentMethodVariant","supported","processBinLookupResponse","issuingCountryCode","showSocialSecurityNumber","onBinLookup","map","supportedBrandsRaw","errObj","fieldType","error","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","handleUnsupportedCard","onError","errorType","message","isReset","onBinValue"],"mappings":"iMAUA,IAAAA,EAAeC,IACX,IAAIC,EAAmB,KAEvB,OAAQC,IAEJ,IAAiC,IAA7BF,EAAOG,MAAMC,YAAjB,CAMA,GAAIF,EAAYG,cAAgBL,EAAOG,MAAMG,UAEzCL,EAAmBC,EAAYK,KAE1BC,EACD,CACIC,eAAgBT,EAAOG,MAAMM,eAC7BC,KAAM,0BAA0BV,EAAOG,MAAMG,aAEjD,CACIK,KAAMX,EAAOG,MAAMS,MACnBC,gBAAiBb,EAAOG,MAAMW,QAAUC,EACxCV,aAAcH,EAAYG,aAC1BW,UAAWd,EAAYK,OAE7BU,KAAMC,IAEJ,GAAIA,GAAMF,YAAcf,EA4CpB,GAAIiB,EAAKJ,QAAQK,OAAQ,CACrB,MAAMC,EAAiBF,EAAKJ,OAAOO,OAC/B,CAACC,EAAKC,KAEFD,EAAIE,eAAeC,KAAKF,EAAKX,OAE7BU,EAAII,sBAAsBD,KAAKF,EAAKI,uBAGb,IAAnBJ,EAAKK,WACLN,EAAIT,gBAAgBY,KAAKF,GAClBD,GAGJA,GAEX,CAAET,gBAAiB,GAAIW,eAAgB,GAAIE,sBAAuB,KAMtE,GAAIN,EAAeP,gBAAgBM,OAoB/B,OAlBAnB,EAAO6B,yBAAyB,CAC5BC,mBAAoBZ,EAAKY,mBACzBjB,gBAAiBO,EAAeP,mBAC5BK,EAAKa,yBAA2B,CAAEA,yBAA0Bb,EAAKa,0BAA6B,CAAA,SAItG/B,EAAOgC,YAAY,CACfrB,KAAMT,EAAYS,KAClBa,eAAgBJ,EAAeI,eAE/BX,gBAAiBO,EAAeP,gBAAgBoB,IAAIV,GAAQA,EAAKX,OACjEc,sBAAuBN,EAAeM,sBACtCQ,mBAAoBd,EAAeP,gBACnCC,OAAQd,EAAOG,MAAMW,QAAUC,EAC/Be,mBAAoBZ,EAAKY,qBAUjC,GAAIV,EAAeI,eAAeL,OAAQ,CACtC,MAAMgB,EAAwB,CAC1BxB,KAAM,OACNyB,UAAW,sBACXC,MAAOC,EAAcC,mCACrBf,eAAgBJ,EAAeI,gBAanC,OAXAxB,EAAOwC,sBAAsBL,QAG7BnC,EAAOgC,YAAY,CACfrB,KAAMT,EAAYS,KAClBa,eAAgBJ,EAAeI,eAC/BX,gBAAiB,KACjBa,sBAAuBN,EAAeM,sBACtCZ,OAAQd,EAAOG,MAAMW,QAAUC,GAIvC,CACJ,MAIIf,EAAOgC,YAAY,CACfrB,KAAMT,EAAYS,KAClBa,eAAgB,KAChBX,gBAAiB,KACjBC,OAAQd,EAAOG,MAAMW,QAAUC,IAKnCf,EAAO6B,yBAAyB,CAAA,GAAI,QAGnCX,GAAMF,WAEPhB,EAAOG,MAAMsC,QAAQvB,GAAQ,CAAEwB,UAAW,YAAaC,QAAS,wBAKzE,GAAI1C,EAAkB,CAKzBD,EAAO6B,yBAAyB,MAAM,GAEtC5B,EAAmB,KAGnB,MAAMkC,EAAwB,CAC1BxB,KAAM,OACNyB,UAAW,sBACXC,MAAO,IAEXrC,EAAOwC,sBAAsBL,GAG7BnC,EAAOgC,YAAY,CACfY,SAAS,GAEjB,CAEI5C,EAAOG,MAAM0C,YAAY7C,EAAOG,MAAM0C,WAAW3C,EAnLrD,MAFQF,EAAOG,MAAM0C,YAAY7C,EAAOG,MAAM0C,WAAW3C,GAuLjE"}
1
+ {"version":3,"file":"triggerBinLookUp.js","sources":["../../../../../../src/components/internal/SecuredFields/binLookup/triggerBinLookUp.ts"],"sourcesContent":["import { httpPost } from '../../../../core/Services/http';\nimport { CardBinValueData, CardErrorData } from '../lib/types';\nimport { DEFAULT_CARD_GROUP_TYPES } from '../lib/constants';\nimport { SF_ErrorCodes } from '../../../../core/Errors/constants';\nimport { BinLookupResponse, BinLookupResponseRaw, BrandObject } from '../../../Card/types';\nimport type CardElement from '../../../Card';\nimport type CustomCardElement from '../../../CustomCard';\nimport { TxVariants } from '../../../tx-variants';\n\nif (process.env.NODE_ENV === 'development') {\n window.mockBinCount = 0; // Set to 0 to turn off mocking, 1 to turn it on\n}\n\nexport const triggerBinLookUp = (element: CardElement | CustomCardElement) => {\n let currentRequestId: string | null = null;\n\n return (callbackObj: CardBinValueData) => {\n // Allow way for merchant to disallow binLookup by specifically setting the prop to false\n if (element.props.doBinLookup === false) {\n if (element.props.onBinValue) element.props.onBinValue(callbackObj);\n return;\n }\n\n // Do binLookup when encryptedBin property is present (and only if the merchant is using a clientKey)\n if (callbackObj.encryptedBin && 'clientKey' in element.props && element.props.clientKey) {\n // Store id of request we're about to make\n currentRequestId = callbackObj.uuid ?? null;\n\n void httpPost(\n {\n loadingContext: element.props.loadingContext,\n path: `v3/bin/binLookup?token=${element.props.clientKey}`\n },\n {\n type: 'brand' in element.props ? element.props.brand : TxVariants.card,\n supportedBrands: element.props.brands || DEFAULT_CARD_GROUP_TYPES,\n encryptedBin: callbackObj.encryptedBin,\n requestId: callbackObj.uuid // Pass id of request\n }\n ).then((data: BinLookupResponseRaw) => {\n // If response is the one we were waiting for...\n if (data?.requestId === currentRequestId) {\n if (process.env.NODE_ENV === 'development') {\n // TODO mocking\n if (window.mockBinCount >= 1) {\n switch (window.mockBinCount) {\n case 1:\n console.log('\\n### triggerBinLookUp::mock first response:: ');\n data.brands = [\n {\n brand: 'mc',\n cvcPolicy: 'optional',\n enableLuhnCheck: true,\n // showExpiryDate: true, // deprecated in /binLookup v3\n expiryDatePolicy: 'optional',\n // panLength: 16,\n supported: true,\n healthcare: true\n }\n ];\n // data.issuingCountryCode = 'KR'; // needed to mock korean_local_card\n // increment to alter second response\n window.mockBinCount++;\n\n break;\n case 2:\n console.log('\\n### triggerBinLookUp::mock second response:: ');\n // data.brands = null;\n data.brands = [\n {\n brand: 'maestro',\n cvcPolicy: 'required',\n enableLuhnCheck: true,\n showExpiryDate: true,\n supported: true,\n showSocialSecurityNumber: false,\n healthcare: false\n // panLength: 16\n }\n ];\n break;\n default:\n }\n }\n // TODO end\n }\n\n if (data.brands?.length) {\n const mappedResponse = data.brands.reduce(\n (acc, item) => {\n // All brand strings end up in the detectedBrands array\n acc.detectedBrands.push(item.brand);\n // Also add the paymentMethodVariants (more granular description of the txvariant)\n acc.paymentMethodVariants.push(item.paymentMethodVariant);\n // Add healthcare to the healthcare array, keyed by brand (only when the field is present)\n if (item.healthcare !== undefined) {\n acc.healthcare.push({ [item.brand]: item.healthcare });\n }\n\n // Add supported brand objects to the supportedBrands array\n if (item.supported === true) {\n acc.supportedBrands.push(item);\n return acc;\n }\n\n return acc;\n },\n {\n supportedBrands: [] as BrandObject[],\n detectedBrands: [] as string[],\n paymentMethodVariants: [] as (string | undefined)[],\n healthcare: [] as Record<string, boolean>[]\n }\n );\n\n const hasHealthcareData = mappedResponse.healthcare.length > 0;\n\n /**\n * supportedBrands = merchant supports this brand(s); we have detected the card number to be of this brand(s); carry on!\n */\n if (mappedResponse.supportedBrands.length) {\n // ...call processBinLookupResponse with, a simplified, response object if it contains at least one supported brand\n element.processBinLookupResponse({\n issuingCountryCode: data.issuingCountryCode ?? '',\n supportedBrands: mappedResponse.supportedBrands,\n ...(data.showSocialSecurityNumber ? { showSocialSecurityNumber: data.showSocialSecurityNumber } : {})\n });\n\n // Inform merchant of the result\n element.onBinLookup({\n type: callbackObj.type,\n detectedBrands: mappedResponse.detectedBrands,\n // supportedBrands contains the subset of this.props.brands that matches the card number that the shopper has typed\n supportedBrands: mappedResponse.supportedBrands.map(item => item.brand),\n paymentMethodVariants: mappedResponse.paymentMethodVariants,\n supportedBrandsRaw: mappedResponse.supportedBrands, // full supportedBrands data (for customCard comp)\n brands: element.props.brands || DEFAULT_CARD_GROUP_TYPES,\n issuingCountryCode: data.issuingCountryCode,\n ...(hasHealthcareData && { healthcare: mappedResponse.healthcare })\n });\n\n return;\n }\n\n /**\n * detectedBrands = no brands the merchant supports were found; what we did detect the shopper to be entering was this brand;\n * error!\n */\n if (mappedResponse.detectedBrands.length) {\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: SF_ErrorCodes.ERROR_MSG_UNSUPPORTED_CARD_ENTERED,\n detectedBrands: mappedResponse.detectedBrands\n };\n element.handleUnsupportedCard(errObj);\n\n // Inform merchant of the result\n element.onBinLookup({\n type: callbackObj.type,\n detectedBrands: mappedResponse.detectedBrands,\n supportedBrands: null,\n paymentMethodVariants: mappedResponse.paymentMethodVariants,\n ...(hasHealthcareData && { healthcare: mappedResponse.healthcare }),\n brands: element.props.brands || DEFAULT_CARD_GROUP_TYPES\n });\n\n return;\n }\n } else {\n /**\n * BIN not in DB (a failed lookup will just contain a requestId)\n */\n element.onBinLookup({\n type: callbackObj.type,\n detectedBrands: null,\n supportedBrands: null,\n brands: element.props.brands || DEFAULT_CARD_GROUP_TYPES\n });\n\n // Reset the UI and let the native, regex branding happen (for the generic card)\n // For a single-branded card we need to pass a boolean to prompt resetting the brand logo to the 'base' type\n element.processBinLookupResponse({} as BinLookupResponse, true);\n }\n } else if (!data?.requestId) {\n // Some other kind of error on the backend\n // @ts-ignore: update this parameter type to match Adyen's error type\n element.props.onError?.(data || { errorType: 'binLookup', message: 'unknownError' });\n }\n // Else - response with wrong requestId\n });\n } else if (currentRequestId) {\n /**\n * If onBinValue callback is called AND we have been doing binLookup BUT passed object doesn't have an encryptedBin property\n * - then THE NUMBER OF DIGITS IN NUMBER FIELD HAS DROPPED BELOW THRESHOLD for BIN lookup - so reset the UI\n */\n element.processBinLookupResponse(null, true);\n\n currentRequestId = null; // Ignore any pending responses\n\n // Reset any errors\n const errObj: CardErrorData = {\n type: 'card',\n fieldType: 'encryptedCardNumber',\n error: ''\n };\n element.handleUnsupportedCard(errObj);\n\n // CustomCard needs this to reset the UI\n element.onBinLookup({\n isReset: true\n });\n }\n\n if (element.props.onBinValue) element.props.onBinValue(callbackObj);\n };\n};\n"],"names":["triggerBinLookUp","element","currentRequestId","callbackObj","props","doBinLookup","encryptedBin","clientKey","uuid","httpPost","loadingContext","path","type","brand","TxVariants","card","supportedBrands","brands","DEFAULT_CARD_GROUP_TYPES","requestId","then","data","length","mappedResponse","reduce","acc","item","detectedBrands","push","paymentMethodVariants","paymentMethodVariant","undefined","healthcare","supported","hasHealthcareData","processBinLookupResponse","issuingCountryCode","showSocialSecurityNumber","onBinLookup","map","supportedBrandsRaw","errObj","fieldType","error","SF_ErrorCodes","ERROR_MSG_UNSUPPORTED_CARD_ENTERED","handleUnsupportedCard","onError","errorType","message","isReset","onBinValue"],"mappings":"sPAaO,MAAMA,EAAoBC,IAC7B,IAAIC,EAAkC,KAEtC,OAAQC,IAEJ,IAAkC,IAA9BF,EAAQG,MAAMC,YAAlB,CAMA,GAAIF,EAAYG,cAAgB,cAAeL,EAAQG,OAASH,EAAQG,MAAMG,UAE1EL,EAAmBC,EAAYK,MAAQ,KAElCC,EACD,CACIC,eAAgBT,EAAQG,MAAMM,eAC9BC,KAAM,0BAA0BV,EAAQG,MAAMG,aAElD,CACIK,KAAM,UAAWX,EAAQG,MAAQH,EAAQG,MAAMS,MAAQC,EAAWC,KAClEC,gBAAiBf,EAAQG,MAAMa,QAAUC,EACzCZ,aAAcH,EAAYG,aAC1Ba,UAAWhB,EAAYK,OAE7BY,KAAMC,IAEJ,GAAIA,GAAMF,YAAcjB,EA8CpB,GAAImB,EAAKJ,QAAQK,OAAQ,CACrB,MAAMC,EAAiBF,EAAKJ,OAAOO,OAC/B,CAACC,EAAKC,KAEFD,EAAIE,eAAeC,KAAKF,EAAKb,OAE7BY,EAAII,sBAAsBD,KAAKF,EAAKI,2BAEZC,IAApBL,EAAKM,YACLP,EAAIO,WAAWJ,KAAK,CAAE,CAACF,EAAKb,OAAQa,EAAKM,cAItB,IAAnBN,EAAKO,WACLR,EAAIT,gBAAgBY,KAAKF,GAClBD,GAGJA,GAEX,CACIT,gBAAiB,GACjBW,eAAgB,GAChBE,sBAAuB,GACvBG,WAAY,KAIdE,EAAoBX,EAAeS,WAAWV,OAAS,EAK7D,GAAIC,EAAeP,gBAAgBM,OAqB/B,OAnBArB,EAAQkC,yBAAyB,CAC7BC,mBAAoBf,EAAKe,oBAAsB,GAC/CpB,gBAAiBO,EAAeP,mBAC5BK,EAAKgB,yBAA2B,CAAEA,yBAA0BhB,EAAKgB,0BAA6B,CAAA,SAItGpC,EAAQqC,YAAY,CAChB1B,KAAMT,EAAYS,KAClBe,eAAgBJ,EAAeI,eAE/BX,gBAAiBO,EAAeP,gBAAgBuB,IAAIb,GAAQA,EAAKb,OACjEgB,sBAAuBN,EAAeM,sBACtCW,mBAAoBjB,EAAeP,gBACnCC,OAAQhB,EAAQG,MAAMa,QAAUC,EAChCkB,mBAAoBf,EAAKe,sBACrBF,GAAqB,CAAEF,WAAYT,EAAeS,cAU9D,GAAIT,EAAeI,eAAeL,OAAQ,CACtC,MAAMmB,EAAwB,CAC1B7B,KAAM,OACN8B,UAAW,sBACXC,MAAOC,EAAcC,mCACrBlB,eAAgBJ,EAAeI,gBAcnC,OAZA1B,EAAQ6C,sBAAsBL,QAG9BxC,EAAQqC,YAAY,CAChB1B,KAAMT,EAAYS,KAClBe,eAAgBJ,EAAeI,eAC/BX,gBAAiB,KACjBa,sBAAuBN,EAAeM,yBAClCK,GAAqB,CAAEF,WAAYT,EAAeS,YACtDf,OAAQhB,EAAQG,MAAMa,QAAUC,GAIxC,CACJ,MAIIjB,EAAQqC,YAAY,CAChB1B,KAAMT,EAAYS,KAClBe,eAAgB,KAChBX,gBAAiB,KACjBC,OAAQhB,EAAQG,MAAMa,QAAUC,IAKpCjB,EAAQkC,yBAAyB,CAAA,GAAyB,QAEtDd,GAAMF,WAGdlB,EAAQG,MAAM2C,UAAU1B,GAAQ,CAAE2B,UAAW,YAAaC,QAAS,wBAIxE,GAAI/C,EAAkB,CAKzBD,EAAQkC,yBAAyB,MAAM,GAEvCjC,EAAmB,KAGnB,MAAMuC,EAAwB,CAC1B7B,KAAM,OACN8B,UAAW,sBACXC,MAAO,IAEX1C,EAAQ6C,sBAAsBL,GAG9BxC,EAAQqC,YAAY,CAChBY,SAAS,GAEjB,CAEIjD,EAAQG,MAAM+C,YAAYlD,EAAQG,MAAM+C,WAAWhD,EAjMvD,MAFQF,EAAQG,MAAM+C,YAAYlD,EAAQG,MAAM+C,WAAWhD"}
@@ -1,2 +1,2 @@
1
- import{AbstractAnalyticsEvent as E,AnalyticsEventCategory as _}from"./AbstractAnalyticsEvent.js";function e(E,_,e){return _ in E?Object.defineProperty(E,_,{value:e,enumerable:!0,configurable:!0,writable:!0}):E[_]=e,E}var r=function(E){return E.network="Network",E.implementation="Implementation",E.internal="Internal",E.apiError="ApiError",E.sdkError="SdkError",E.thirdParty="ThirdParty",E.generic="Generic",E.redirect="Redirect",E.threeDS2="ThreeDS2",E}({}),S=function(E){return E.SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND="500",E.REDIRECT="600",E.SECURED_FIELDS_KEY_NOT_FOUND="608",E.SECURED_FIELDS_ENCRYPTION_KEY_GEN_FAILED="609",E.SECURED_FIELDS_ENCRYPTION_ERROR="610",E.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA="700",E.THREEDS2_ACTION_IS_MISSING_TOKEN="701",E.THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL="702",E.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS="703",E.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED="704",E.THREEDS2_TIMEOUT="710",E.THREEDS2_TOKEN_IS_MISSING_ACSURL="800",E.THREEDS2_NO_TRANSSTATUS="801",E.THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED="802",E.THREEDS2_NO_COMPONENT_FOR_ACTION="803",E.THREEDS2_NO_ACTION_FOR_CHALLENGE="804",E.THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP="805",E}({});class T extends E{getEventCategory(){return _.error}constructor(E){super(E.component),e(this,"errorType",void 0),e(this,"code",void 0),e(this,"message",void 0),this.errorType=E.errorType,this.code=E.code,E.message&&(this.message=E.message)}}export{T as AnalyticsErrorEvent,S as ErrorEventCode,r as ErrorEventType};
1
+ import{AbstractAnalyticsEvent as E,AnalyticsEventCategory as _}from"./AbstractAnalyticsEvent.js";function e(E,_,e){return _ in E?Object.defineProperty(E,_,{value:e,enumerable:!0,configurable:!0,writable:!0}):E[_]=e,E}var r=function(E){return E.network="Network",E.implementation="Implementation",E.internal="Internal",E.apiError="ApiError",E.sdkError="SdkError",E.thirdParty="ThirdParty",E.generic="Generic",E.redirect="Redirect",E.threeDS2="ThreeDS2",E}({}),S=function(E){return E.SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND="500",E.REDIRECT="600",E.SECURED_FIELDS_KEY_NOT_FOUND="608",E.SECURED_FIELDS_ENCRYPTION_KEY_GEN_FAILED="609",E.SECURED_FIELDS_ENCRYPTION_ERROR="610",E.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA="700",E.THREEDS2_ACTION_IS_MISSING_TOKEN="701",E.THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL="702",E.THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS="703",E.THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED="704",E.THREEDS2_TIMEOUT="710",E.THREEDS2_TOKEN_IS_MISSING_ACSURL="800",E.THREEDS2_NO_TRANSSTATUS="801",E.THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED="802",E.THREEDS2_NO_COMPONENT_FOR_ACTION="803",E.THREEDS2_NO_ACTION_FOR_CHALLENGE="804",E.THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP="805",E.THREEDS2_CHALLENGE_TOKEN_IS_MISSING_THREEDSNOTIFICATIONURL="806",E}({});class T extends E{getEventCategory(){return _.error}constructor(E){super(E.component),e(this,"errorType",void 0),e(this,"code",void 0),e(this,"message",void 0),this.errorType=E.errorType,this.code=E.code,E.message&&(this.message=E.message)}}export{T as AnalyticsErrorEvent,S as ErrorEventCode,r as ErrorEventType};
2
2
  //# sourceMappingURL=AnalyticsErrorEvent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsErrorEvent.js","sources":["../../../../../src/core/Analytics/events/AnalyticsErrorEvent.ts"],"sourcesContent":["import { AbstractAnalyticsEvent, AnalyticsEventCategory } from './AbstractAnalyticsEvent';\n\ntype AnalyticsErrorEventProps = {\n component: string;\n errorType: ErrorEventType;\n code: string;\n message?: string;\n};\n\nexport enum ErrorEventType {\n network = 'Network',\n implementation = 'Implementation',\n internal = 'Internal',\n apiError = 'ApiError',\n sdkError = 'SdkError',\n thirdParty = 'ThirdParty',\n generic = 'Generic',\n redirect = 'Redirect',\n threeDS2 = 'ThreeDS2'\n}\n\nexport enum ErrorEventCode {\n /** Trying to initialise a securedField iframe, but the iframe.contentWindow is undefined (meaning the containing element is not in the DOM */\n SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND = '500',\n /** */\n REDIRECT = '600',\n /**\n * Key not present in served securedFields asset\n */\n SECURED_FIELDS_KEY_NOT_FOUND = '608',\n /**\n * Encryption key generation failed in securedField\n */\n SECURED_FIELDS_ENCRYPTION_KEY_GEN_FAILED = '609',\n /**\n * Encryption failed in securedField\n */\n SECURED_FIELDS_ENCRYPTION_ERROR = '610',\n\n /** See also API_ERROR_CODE object in /src/core/Services/sessions/constants.ts which uses codes in the range 620-628 */\n\n /** Missing 'paymentData' property from threeDS2 action */\n THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA = '700',\n\n /** Missing 'token' property from threeDS2 action */\n THREEDS2_ACTION_IS_MISSING_TOKEN = '701',\n\n /** Decoded token is missing a valid threeDSMethodURL property */\n THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL = '702',\n /**\n * Decoded token is missing one or more of the following properties:\n * fingerprint: (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)\n * challenge: (acsTransID | messageVersion | threeDSServerTransID)\n */\n THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS = '703',\n\n /** Token decoding or parsing has failed. ('not base64', 'malformed URI sequence' or 'Could not JSON parse token') */\n THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED = '704',\n\n /** 3DS2 process has timed out */\n THREEDS2_TIMEOUT = '710',\n\n /** Decoded token is missing a valid acsURL property */\n THREEDS2_TOKEN_IS_MISSING_ACSURL = '800',\n\n /** Challenge has resulted in an error (no transStatus could be retrieved by the backend) */\n THREEDS2_NO_TRANSSTATUS = '801',\n\n /** callSubmit3DS2Fingerprint has received a response indicating either a \"frictionless\" flow, or a \"refused\" response, but without a details object */\n THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED = '802',\n\n /** callSubmit3DS2Fingerprint cannot find a component to handle the action response */\n THREEDS2_NO_COMPONENT_FOR_ACTION = '803',\n\n /** callSubmit3DS2Fingerprint has received a response indicating a \"challenge\" but without an action object */\n THREEDS2_NO_ACTION_FOR_CHALLENGE = '804',\n\n /** The challenge process has happened, an object has been returned, parsed & accepted as legit, but the result prop on that object is either missing or doesn't have a transStatus prop */\n THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP = '805'\n}\n\nexport class AnalyticsErrorEvent extends AbstractAnalyticsEvent {\n private readonly errorType: ErrorEventType;\n private readonly code: string;\n\n private readonly message?: string;\n\n constructor(props: AnalyticsErrorEventProps) {\n super(props.component);\n\n this.errorType = props.errorType;\n this.code = props.code;\n\n if (props.message) this.message = props.message;\n }\n\n public getEventCategory(): AnalyticsEventCategory {\n return AnalyticsEventCategory.error;\n }\n}\n"],"names":["ErrorEventType","ErrorEventCode","AnalyticsErrorEvent","AbstractAnalyticsEvent","getEventCategory","AnalyticsEventCategory","error","constructor","props","super","component","_define_property","errorType","this","code","message"],"mappings":"yNASO,IAAAA,EAAKA,SAAAA,GAAAA,yNAAAA,CAUX,CAVWA,CAUX,CAAA,GAEMC,EAAKA,SAAAA,GAAAA,OACoIA,EAAA,+CAAA,MAExIA,EAAA,SAAA,MAIHA,EAAA,6BAAA,MAIAA,EAAA,yCAAA,MAIAA,EAAA,gCAAA,MAKwDA,EAAA,wCAAA,MAGPA,EAAA,iCAAA,MAGaA,EAAA,2CAAA,MAM9DA,EAAA,sCAAA,MAGkHA,EAAA,wCAAA,MAGpFA,EAAA,iBAAA,MAGsBA,EAAA,iCAAA,MAGqCA,EAAA,wBAAA,MAG2DA,EAAA,gDAAA,MAGjEA,EAAA,iCAAA,MAGwBA,EAAA,iCAAA,MAG6EA,EAAA,gDAAA,MAxDjLA,CA0DX,CA1DWA,CA0DX,CAAA,GAEM,MAAMC,UAA4BC,EAe9BC,gBAAAA,GACH,OAAOC,EAAuBC,KAClC,CAXA,WAAAC,CAAYC,GACRC,MAAMD,EAAME,WANhBC,OAAiBC,oBACjBD,EAAAE,KAAiBC,eAEjBH,EAAAE,KAAiBE,kBAKbF,KAAKD,UAAYJ,EAAMI,UACvBC,KAAKC,KAAON,EAAMM,KAEdN,EAAMO,UAASF,KAAKE,QAAUP,EAAMO,QAC5C"}
1
+ {"version":3,"file":"AnalyticsErrorEvent.js","sources":["../../../../../src/core/Analytics/events/AnalyticsErrorEvent.ts"],"sourcesContent":["import { AbstractAnalyticsEvent, AnalyticsEventCategory } from './AbstractAnalyticsEvent';\n\ntype AnalyticsErrorEventProps = {\n component: string;\n errorType: ErrorEventType;\n code: string;\n message?: string;\n};\n\nexport enum ErrorEventType {\n network = 'Network',\n implementation = 'Implementation',\n internal = 'Internal',\n apiError = 'ApiError',\n sdkError = 'SdkError',\n thirdParty = 'ThirdParty',\n generic = 'Generic',\n redirect = 'Redirect',\n threeDS2 = 'ThreeDS2'\n}\n\nexport enum ErrorEventCode {\n /** Trying to initialise a securedField iframe, but the iframe.contentWindow is undefined (meaning the containing element is not in the DOM */\n SECURED_FIELDS_IFRAME_CONTENT_WINDOW_NOT_FOUND = '500',\n /** */\n REDIRECT = '600',\n /**\n * Key not present in served securedFields asset\n */\n SECURED_FIELDS_KEY_NOT_FOUND = '608',\n /**\n * Encryption key generation failed in securedField\n */\n SECURED_FIELDS_ENCRYPTION_KEY_GEN_FAILED = '609',\n /**\n * Encryption failed in securedField\n */\n SECURED_FIELDS_ENCRYPTION_ERROR = '610',\n\n /** See also API_ERROR_CODE object in /src/core/Services/sessions/constants.ts which uses codes in the range 620-628 */\n\n /** Missing 'paymentData' property from threeDS2 action */\n THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA = '700',\n\n /** Missing 'token' property from threeDS2 action */\n THREEDS2_ACTION_IS_MISSING_TOKEN = '701',\n\n /** Decoded token is missing a valid threeDSMethodURL property */\n THREEDS2_TOKEN_IS_MISSING_THREEDSMETHODURL = '702',\n /**\n * Decoded token is missing one or more of the following properties:\n * fingerprint: (threeDSMethodNotificationURL | postMessageDomain | threeDSServerTransID)\n * challenge: (acsTransID | messageVersion | threeDSServerTransID)\n */\n THREEDS2_TOKEN_IS_MISSING_OTHER_PROPS = '703',\n\n /** Token decoding or parsing has failed. ('not base64', 'malformed URI sequence' or 'Could not JSON parse token') */\n THREEDS2_TOKEN_DECODE_OR_PARSING_FAILED = '704',\n\n /** 3DS2 process has timed out */\n THREEDS2_TIMEOUT = '710',\n\n /** Decoded token is missing a valid acsURL property */\n THREEDS2_TOKEN_IS_MISSING_ACSURL = '800',\n\n /** Challenge has resulted in an error (no transStatus could be retrieved by the backend) */\n THREEDS2_NO_TRANSSTATUS = '801',\n\n /** callSubmit3DS2Fingerprint has received a response indicating either a \"frictionless\" flow, or a \"refused\" response, but without a details object */\n THREEDS2_NO_DETAILS_FOR_FRICTIONLESS_OR_REFUSED = '802',\n\n /** callSubmit3DS2Fingerprint cannot find a component to handle the action response */\n THREEDS2_NO_COMPONENT_FOR_ACTION = '803',\n\n /** callSubmit3DS2Fingerprint has received a response indicating a \"challenge\" but without an action object */\n THREEDS2_NO_ACTION_FOR_CHALLENGE = '804',\n\n /** The challenge process has happened, an object has been returned, parsed & accepted as legit, but the result prop on that object is either missing or doesn't have a transStatus prop */\n THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP = '805',\n\n /** Decoded challenge token is missing a valid threeDSNotificationURL property. This means any challenge iframe that is presented will not be able to postMessage back to finalise the process, and trigger an onAdditionalDetails call. */\n THREEDS2_CHALLENGE_TOKEN_IS_MISSING_THREEDSNOTIFICATIONURL = '806'\n}\n\nexport class AnalyticsErrorEvent extends AbstractAnalyticsEvent {\n private readonly errorType: ErrorEventType;\n private readonly code: string;\n\n private readonly message?: string;\n\n constructor(props: AnalyticsErrorEventProps) {\n super(props.component);\n\n this.errorType = props.errorType;\n this.code = props.code;\n\n if (props.message) this.message = props.message;\n }\n\n public getEventCategory(): AnalyticsEventCategory {\n return AnalyticsEventCategory.error;\n }\n}\n"],"names":["ErrorEventType","ErrorEventCode","AnalyticsErrorEvent","AbstractAnalyticsEvent","getEventCategory","AnalyticsEventCategory","error","constructor","props","super","component","_define_property","errorType","this","code","message"],"mappings":"yNASO,IAAAA,EAAKA,SAAAA,GAAAA,yNAAAA,CAUX,CAVWA,CAUX,CAAA,GAEMC,EAAKA,SAAAA,GAAAA,OACoIA,EAAA,+CAAA,MAExIA,EAAA,SAAA,MAIHA,EAAA,6BAAA,MAIAA,EAAA,yCAAA,MAIAA,EAAA,gCAAA,MAKwDA,EAAA,wCAAA,MAGPA,EAAA,iCAAA,MAGaA,EAAA,2CAAA,MAM9DA,EAAA,sCAAA,MAGkHA,EAAA,wCAAA,MAGpFA,EAAA,iBAAA,MAGsBA,EAAA,iCAAA,MAGqCA,EAAA,wBAAA,MAG2DA,EAAA,gDAAA,MAGjEA,EAAA,iCAAA,MAGwBA,EAAA,iCAAA,MAG6EA,EAAA,gDAAA,MAGgDA,EAAA,2DAAA,MA3DjOA,CA6DX,CA7DWA,CA6DX,CAAA,GAEM,MAAMC,UAA4BC,EAe9BC,gBAAAA,GACH,OAAOC,EAAuBC,KAClC,CAXA,WAAAC,CAAYC,GACRC,MAAMD,EAAME,WANhBC,OAAiBC,oBACjBD,EAAAE,KAAiBC,eAEjBH,EAAAE,KAAiBE,kBAKbF,KAAKD,UAAYJ,EAAMI,UACvBC,KAAKC,KAAON,EAAMM,KAEdN,EAAMO,UAASF,KAAKE,QAAUP,EAAMO,QAC5C"}
@@ -1,2 +1,2 @@
1
- function e(e,n){if(null==e)throw new Error(n);return e}const n="https://checkoutshopper-live.adyen.com/checkoutshopper/",o=e("6.40.2","LIBRARY_VERSION is not defined"),t=e("esm","BUNDLE_TYPE is not defined"),r=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","donation","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onEnterKeyPressed","onError","onBalanceCheck","onOrderCancel","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],i=6e4;var d=function(e){return e.WEB="web",e}({});const a="web";var s=function(e){return e.NATIVE="nativeComponent",e.GENERIC="genericComponent",e}({});export{d as CHANNEL,i as DEFAULT_HTTP_TIMEOUT,n as FALLBACK_CONTEXT,r as GENERIC_OPTIONS,t as LIBRARY_BUNDLE_TYPE,o as LIBRARY_VERSION,s as PAYMENT_METHOD_BEHAVIOR,a as PLATFORM};
1
+ function e(e,n){if(null==e)throw new Error(n);return e}const n="https://checkoutshopper-live.adyen.com/checkoutshopper/",o=e("6.41.1","LIBRARY_VERSION is not defined"),t=e("esm","BUNDLE_TYPE is not defined"),r=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","donation","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onEnterKeyPressed","onError","onBalanceCheck","onOrderCancel","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],i=6e4;var d=function(e){return e.WEB="web",e}({});const a="web";var s=function(e){return e.NATIVE="nativeComponent",e.GENERIC="genericComponent",e}({});export{d as CHANNEL,i as DEFAULT_HTTP_TIMEOUT,n as FALLBACK_CONTEXT,r as GENERIC_OPTIONS,t as LIBRARY_BUNDLE_TYPE,o as LIBRARY_VERSION,s as PAYMENT_METHOD_BEHAVIOR,a as PLATFORM};
2
2
  //# sourceMappingURL=config.js.map
@@ -813,10 +813,10 @@ interface Restrictions {
813
813
  }
814
814
 
815
815
  interface ANCVConfiguration extends UIElementProps {
816
- paymentData?: any;
816
+ paymentData?: string;
817
817
  data: ANCVDataState;
818
- onOrderRequest?: any;
819
- onOrderUpdated?: any;
818
+ onOrderRequest?: onOrderRequestCallbackType;
819
+ onOrderUpdated?: onOrderUpdatedCallbackType;
820
820
  }
821
821
  interface ANCVDataState {
822
822
  beneficiaryId: string;
@@ -1686,14 +1686,16 @@ interface CardAutoCompleteData {
1686
1686
  }
1687
1687
  interface CardBinLookupData {
1688
1688
  type?: string;
1689
- detectedBrands?: string[];
1690
- supportedBrands?: string[];
1689
+ detectedBrands?: string[] | null;
1690
+ supportedBrands?: string[] | null;
1691
1691
  brands?: string[];
1692
1692
  issuingCountryCode?: string;
1693
+ healthcare?: Record<string, boolean>[];
1693
1694
  supportedBrandsRaw?: BrandObject[];
1694
1695
  rootNode?: HTMLElement;
1695
1696
  isReset?: boolean;
1696
1697
  dualBrandingType?: string;
1698
+ paymentMethodVariants?: (string | undefined)[];
1697
1699
  }
1698
1700
  interface CardBinValueData {
1699
1701
  type: string;
@@ -1752,6 +1754,13 @@ interface CardLoadData {
1752
1754
  }
1753
1755
  type CVCPolicyType = typeof REQUIRED | typeof OPTIONAL | typeof HIDDEN;
1754
1756
  type DatePolicyType = typeof REQUIRED | typeof OPTIONAL | typeof HIDDEN;
1757
+ interface BrandConfiguration {
1758
+ name?: string;
1759
+ icon?: string;
1760
+ }
1761
+ interface CardBrandsConfiguration {
1762
+ [key: string]: BrandConfiguration;
1763
+ }
1755
1764
 
1756
1765
  declare enum ErrorEventCode {
1757
1766
  /** Trying to initialise a securedField iframe, but the iframe.contentWindow is undefined (meaning the containing element is not in the DOM */
@@ -1798,7 +1807,9 @@ declare enum ErrorEventCode {
1798
1807
  /** callSubmit3DS2Fingerprint has received a response indicating a "challenge" but without an action object */
1799
1808
  THREEDS2_NO_ACTION_FOR_CHALLENGE = "804",
1800
1809
  /** The challenge process has happened, an object has been returned, parsed & accepted as legit, but the result prop on that object is either missing or doesn't have a transStatus prop */
1801
- THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP = "805"
1810
+ THREEDS2_CHALLENGE_RESOLVED_WITHOUT_RESULT_PROP = "805",
1811
+ /** Decoded challenge token is missing a valid threeDSNotificationURL property. This means any challenge iframe that is presented will not be able to postMessage back to finalise the process, and trigger an onAdditionalDetails call. */
1812
+ THREEDS2_CHALLENGE_TOKEN_IS_MISSING_THREEDSNOTIFICATIONURL = "806"
1802
1813
  }
1803
1814
 
1804
1815
  /**
@@ -4265,14 +4276,17 @@ type balanceCheckResponseType = {
4265
4276
  transactionLimit?: PaymentAmount;
4266
4277
  };
4267
4278
  type onBalanceCheckCallbackType = (resolve: (res: balanceCheckResponseType) => void, reject: (error: Error) => void, data: GiftCardElementData) => Promise<void>;
4279
+ type onOrderUpdatedCallbackType = (data: {
4280
+ order: Order;
4281
+ }) => void;
4268
4282
  type onRequiringConfirmationCallbackType = (resolve: () => void, reject: (error: Error) => void) => Promise<void>;
4269
4283
  type onOrderRequestCallbackType = (resolve: (order: Order) => void, reject: (error: Error) => void, data: PaymentData) => Promise<void>;
4270
4284
  interface GiftCardConfiguration extends UIElementProps {
4271
4285
  pinRequired?: boolean;
4272
4286
  expiryDateRequired?: boolean;
4273
- brandsConfiguration?: any;
4287
+ brandsConfiguration?: CardBrandsConfiguration;
4274
4288
  brand?: string;
4275
- onOrderUpdated?: (data: any) => void;
4289
+ onOrderUpdated?: onOrderUpdatedCallbackType;
4276
4290
  onBalanceCheck?: onBalanceCheckCallbackType;
4277
4291
  onOrderRequest?: onOrderRequestCallbackType;
4278
4292
  onRequiringConfirmation?: onRequiringConfirmationCallbackType;
@@ -4372,8 +4386,8 @@ declare class GiftcardElement extends UIElement<GiftCardConfiguration> {
4372
4386
  formatProps(props: any): any;
4373
4387
  formatData(): GiftCardElementData;
4374
4388
  get isValid(): boolean;
4375
- get icon(): any;
4376
- get displayName(): any;
4389
+ get icon(): string;
4390
+ get displayName(): string;
4377
4391
  private setBalanceCheckError;
4378
4392
  private handleBalanceCheck;
4379
4393
  private onOrderRequest;
@@ -6459,9 +6473,10 @@ type onOrderCancelType = (data: onOrderCancelData, actions: {
6459
6473
  }) => void;
6460
6474
  reject: (error: string) => void;
6461
6475
  }) => void;
6476
+ type onOrderCancelInternalCallback = ((data: onOrderCancelData) => void) | null;
6462
6477
  interface DropinComponentProps extends DropinConfiguration {
6463
6478
  core: ICore;
6464
- onCreateElements(): any;
6479
+ onCreateElements(): [Promise<UIElement[]>, Promise<UIElement[]>, Promise<UIElement[]>, Promise<UIElement[]> | []];
6465
6480
  onElementsCreated(elements: UIElement[]): void;
6466
6481
  onOrderCancel?: onOrderCancelType;
6467
6482
  }
@@ -8031,13 +8046,7 @@ interface CardBackendConfiguration {
8031
8046
  icon?: string;
8032
8047
  brandsConfiguration?: CardBrandsConfiguration;
8033
8048
  }
8034
- interface BrandConfiguration {
8035
- name?: string;
8036
- icon?: string;
8037
- }
8038
- interface CardBrandsConfiguration {
8039
- [key: string]: BrandConfiguration;
8040
- }
8049
+
8041
8050
  interface CardPaymentMethodData {
8042
8051
  type: string;
8043
8052
  brand?: string;
@@ -8071,6 +8080,7 @@ interface BrandObject {
8071
8080
  brandImageUrl?: string;
8072
8081
  panLength?: number;
8073
8082
  paymentMethodVariant?: string;
8083
+ healthcare?: boolean;
8074
8084
  }
8075
8085
  interface BinLookupResponseRaw {
8076
8086
  requestId: string;
@@ -8113,7 +8123,7 @@ declare class CardElement extends UIElement<CardConfiguration> {
8113
8123
  constructor(checkout: ICore, props?: CardConfiguration);
8114
8124
  protected static readonly defaultProps: any;
8115
8125
  setStatus(status: UIElementStatus, props?: any): this;
8116
- private setClickToPayRef;
8126
+ private readonly setClickToPayRef;
8117
8127
  protected getPaymentMethodConfigFromResponse(componentProps: CardConfiguration): RawPaymentMethod;
8118
8128
  formatProps(props: CardConfiguration): CardConfiguration;
8119
8129
  /**
@@ -8124,13 +8134,13 @@ declare class CardElement extends UIElement<CardConfiguration> {
8124
8134
  updateStyles(stylesObj: any): this;
8125
8135
  setFocusOn(fieldName: any): this;
8126
8136
  onBrand: (event: any) => void;
8127
- processBinLookupResponse(binLookupResponse: BinLookupResponse, isReset?: boolean): this;
8137
+ processBinLookupResponse(binLookupResponse: BinLookupResponse | null, isReset?: boolean): this;
8128
8138
  handleUnsupportedCard(errObj: any): this;
8129
- private handleClickToPaySubmit;
8139
+ private readonly handleClickToPaySubmit;
8130
8140
  onBinLookup(obj: CardBinLookupData): void;
8131
- private onConfigSuccess;
8132
- private onFocus;
8133
- private onBlur;
8141
+ private readonly onConfigSuccess;
8142
+ private readonly onFocus;
8143
+ private readonly onBlur;
8134
8144
  onBinValue: (callbackObj: CardBinValueData) => void;
8135
8145
  get storePaymentMethodPayload(): {
8136
8146
  storePaymentMethod?: undefined;
@@ -8713,4 +8723,4 @@ declare namespace AdyenCheckout {
8713
8723
  }
8714
8724
 
8715
8725
  export { ANCVElement as ANCV, AchElement as Ach, AddressElement as Address, AdyenCheckout, AdyenCheckoutError, Affirm, AfterPay, AfterPayB2B, AmazonPayElement as AmazonPay, ApplePayElement as ApplePay, Atome, BacsElement as BacsDirectDebit, BancontactElement as Bancontact, BankTransferElement as BankTransfer, BCMCMobileElement as BcmcMobile, BillDeskOnlineElement as BillDeskOnline, BillDeskWalletElement as BillDeskWallet, BlikElement as Blik, BoletoElement as Boleto, CardElement as Card, CashAppPay, ClickToPayElement as ClickToPay, Core, CustomCard, DokuElement as Doku, DonationElement as Donation, DotpayElement as Dotpay, DragonpayElement as Dragonpay, DropinElement as Dropin, DuitNowElement as DuitNow, EPSElement as EPS, EcontextElement as Econtext, FacilyPay10x as FacilPay10x, FacilyPay12x as FacilPay12x, FacilyPay3x as FacilPay3x, FacilyPay4x as FacilPay4x, FacilyPay6x as FacilPay6x, Fastlane, FastlaneSDK, GiftcardElement as Giftcard, GiropayElement as Giropay, GooglePay, Iris, IrisMode, KlarnaPayments as Klarna, MBWayElement as MBWay, MealVoucherFRElement as MealVoucherFR, MolPayEBankingMYElement as MolPayEBankingMY, MolPayEBankingTHElement as MolPayEBankingTH, MolPayEbankingVNElement as MolPayEBankingVN, MultibancoElement as Multibanco, OnlineBankingCZElement as OnlineBankingCZ, OnlineBankingFI, OnlineBankingINElement as OnlineBankingIN, OnlineBankingPL, OnlineBankingSKElement as OnlineBankingSK, OxxoElement as Oxxo, PayByBank, PayByBankPixElement as PayByBankPix, PayByBankUS, PayMeElement as PayMe, PayNowElement as PayNow, PaypalElement as PayPal, PayToElement as PayTo, PayuNetCashcardElement as PayuCashcard, PayuNetBankingElement as PayuNetBanking, PersonalDetailsElement as PersonalDetails, PixElement as Pix, PreAuthorizedDebitCanada, PromptPayElement as PromptPay, RatePay, RatePayDirectDebit, RedirectElement as Redirect, Riverty, SepaElement as SepaDirectDebit, SwishElement as Swish, ThreeDS2Challenge, ThreeDS2DeviceFingerprint, TrustlyElement as Trustly, TwintElement as Twint, UIElement, UPI, VippsElement as Vipps, WalletINElement as WalletIN, WeChatPayElement as WeChat, index_d as components, initializeFastlane };
8716
- export type { ANCVConfiguration, ANCVDataState, AchConfiguration, AchPlaceholders, ActionDescriptionType, ActionHandledReturnObject, AdditionalDetailsActions, AdditionalDetailsData, AddressData, AddressField, AmazonPayBackendConfiguration, AmazonPayButtonProps, AmazonPayButtonSettings, AmazonPayComponentProps, AmazonPayConfiguration, AmazonPayElementData, AmazonWindowObject, App, ApplePayButtonStyle, ApplePayButtonType, ApplePayConfiguration, ApplePayElementData, ApplePayPaymentAuthorizationResult, ApplePayPaymentOrderDetails, ApplePaySessionRequest, ApplePayWebConfiguration, AwaitComponentProps, AwaitConfiguration, BankDetailsSchema, BankTransferConfiguration, BankTransferSchema, BankTransferState, BeforeSubmitActions, BinLookupResponse, BinLookupResponseRaw, BoletoConfiguration, BoletoElementProps, BoletoInputDataState, BoletoInputErrorState, BoletoInputValidState, BrandConfiguration, BrandObject, BrowserInfo, CReqData, CardAllValidData, CardAutoCompleteData, CardBackendConfiguration, CardBinLookupData, CardBinValueData, CardBrandData, CardBrandsConfiguration, CardConfigSuccessData, CardConfiguration, CardElementData, CardErrorData, CardFieldValidData, CardFocusData, CardLoadData, CardPlaceholders, CashAppPayConfiguration, CashAppPayElementData, CashAppPayEventData, ChallengeData, ChallengeResolveData, ChallengeWindowSize, ChangeActionOptions, ChangePaymentDetailsButtonProps, ChargeAmount, CheckoutAdvancedFlowResponse, CheckoutDetailsRequest, CheckoutSession, CheckoutSessionConfig, ClickToPayConfiguration, ClickToPayPaymentData, ClickToPayProps, ClickToPayScheme, CommonVoucherProps, ComponentFocusObject, ComponentMethodsRef, CoreConfiguration, CoreModules, Currency, CustomCardConfiguration, CustomTranslations, DecodeObject, DeliverySpecifications, DokuVoucherResultProps, DonationCampaign, DonationCampaignOptions, DonationConfiguration, DonationOptions, DonationProps, DragonpayConfiguraton, DragonpayInputData, DragonpayInputIssuerItem, DragonpayInputProps, DragonpayVoucherResultProps, DropinComponentProps, DropinComponentState, DropinConfiguration, DropinStatus, DropinStatusProps, DualBrandButtons, DualBrandSelectElement, DualBrandingChangeHandler, EcontextConfiguration, EcontextInputSchema, EcontextVoucherResultProps, ErrorCodeObject, ExtendedMerchantInfo, FastlaneAddress, FastlaneAuthenticatedCustomerResult, FastlaneConfiguration, FastlaneConsentRenderState, FastlaneData, FastlaneOptions, FastlanePaymentMethodConfiguration, FastlaneProfile, FastlaneSDKConfiguration, FastlaneShipping, FastlaneShippingAddressSelectorResult, FastlaneSignupConfiguration, FastlaneWindowInstance, FieldsetVisibility, FingerPrintData, FingerprintResolveData, FundingSource, FundingSourceKeys, GiftCardBalanceCheckErrorType, GiftCardConfiguration, GiftCardElementData, GiftCardValidationError, GooglePayConfiguration, GooglePaymentDataRequest, ICore, IDropin, InstantPaymentTypes, Intent, IrisConfiguration, IrisData, IrisState, IssuerListConfiguration, IssuerListData, KlarnaAction, KlarnaAdditionalDetailsData, KlarnaComponentRef, KlarnaConfiguration, KlarnaSdkData, KlarnaWidgetAuthorizeResponse, KlarnaWidgetProps, LedgerCurrencies, MandateFrequencyType, MandateType, OnChangeData, OpenInvoiceActiveFieldsets, OpenInvoiceConfiguration, OpenInvoiceFieldsetsRefs, OpenInvoiceProps, OpenInvoiceStateData, OpenInvoiceStateError, OpenInvoiceStateValid, OpenInvoiceVisibility, Order, OrderButtonProps, OrderStatus, PayPalConfiguration, PayToConfiguration, PayToData, PayToPlaceholdersType, PayloadJSON, PaymentAction, PaymentActionsType, PaymentAmount, PaymentCompletedData, PaymentData, PaymentFailedData, PaymentMethodBrand, PaymentMethodData, PaymentMethodGroup, PaymentMethodOptions, PaymentMethods, PaymentMethodsConfiguration, PaymentMethodsRequestData, PaymentMethodsResponse, PaymentResponseData, PersonalDetailsSchema, PixConfiguration, PixElementData, PostMsgParseErrorObject, PreAuthorizedDebitCanadaConfiguration, PreAuthorizedDebitCanadaPlaceholders, ProcessedPaymentStatusResponse, QRLoaderConfiguration, RawPaymentMethod, RawPaymentResponse, RawPaymentStatusResponse, RawStoredPaymentMethod, RecurringMetadata, RedirectConfiguration, Region, ResultCode, ResultObject, ResultValue, SepaConfiguration, SepaElementData, SessionsResponse, SignOutButtonProps, SocialSecurityMode, StatusFromAction, SubmitActions, SubmitData, SupportedLocale, SupportedPayPalFundingSources, ThreeDS2ActionProps, ThreeDS2ChallengeConfiguration, ThreeDS2ConfigProps, ThreeDS2DeviceFingerprintConfiguration, ThreeDS2FingerprintResponse, ThreeDS2FlowObject, ThreeDS2FlowProps, ThreeDS2Token, UIElementProps, UIElementStatus, UPIAppList, UPIConfiguration, UpdateAmazonCheckoutSessionRequest, UpiMode, UpiPaymentData, UpiType, ValidationError, VoucherConfiguration, VoucherDetail, VoucherProps, balanceCheckResponseType, onBalanceCheckCallbackType, onOrderCancelData, onOrderCancelType, onOrderRequestCallbackType, onRequiringConfirmationCallbackType };
8726
+ export type { ANCVConfiguration, ANCVDataState, AchConfiguration, AchPlaceholders, ActionDescriptionType, ActionHandledReturnObject, AdditionalDetailsActions, AdditionalDetailsData, AddressData, AddressField, AmazonPayBackendConfiguration, AmazonPayButtonProps, AmazonPayButtonSettings, AmazonPayComponentProps, AmazonPayConfiguration, AmazonPayElementData, AmazonWindowObject, App, ApplePayButtonStyle, ApplePayButtonType, ApplePayConfiguration, ApplePayElementData, ApplePayPaymentAuthorizationResult, ApplePayPaymentOrderDetails, ApplePaySessionRequest, ApplePayWebConfiguration, AwaitComponentProps, AwaitConfiguration, BankDetailsSchema, BankTransferConfiguration, BankTransferSchema, BankTransferState, BeforeSubmitActions, BinLookupResponse, BinLookupResponseRaw, BoletoConfiguration, BoletoElementProps, BoletoInputDataState, BoletoInputErrorState, BoletoInputValidState, BrandConfiguration, BrandObject, BrowserInfo, CReqData, CardAllValidData, CardAutoCompleteData, CardBackendConfiguration, CardBinLookupData, CardBinValueData, CardBrandData, CardBrandsConfiguration, CardConfigSuccessData, CardConfiguration, CardElementData, CardErrorData, CardFieldValidData, CardFocusData, CardLoadData, CardPlaceholders, CashAppPayConfiguration, CashAppPayElementData, CashAppPayEventData, ChallengeData, ChallengeResolveData, ChallengeWindowSize, ChangeActionOptions, ChangePaymentDetailsButtonProps, ChargeAmount, CheckoutAdvancedFlowResponse, CheckoutDetailsRequest, CheckoutSession, CheckoutSessionConfig, ClickToPayConfiguration, ClickToPayPaymentData, ClickToPayProps, ClickToPayScheme, CommonVoucherProps, ComponentFocusObject, ComponentMethodsRef, CoreConfiguration, CoreModules, Currency, CustomCardConfiguration, CustomTranslations, DecodeObject, DeliverySpecifications, DokuVoucherResultProps, DonationCampaign, DonationCampaignOptions, DonationConfiguration, DonationOptions, DonationProps, DragonpayConfiguraton, DragonpayInputData, DragonpayInputIssuerItem, DragonpayInputProps, DragonpayVoucherResultProps, DropinComponentProps, DropinComponentState, DropinConfiguration, DropinStatus, DropinStatusProps, DualBrandButtons, DualBrandSelectElement, DualBrandingChangeHandler, EcontextConfiguration, EcontextInputSchema, EcontextVoucherResultProps, ErrorCodeObject, ExtendedMerchantInfo, FastlaneAddress, FastlaneAuthenticatedCustomerResult, FastlaneConfiguration, FastlaneConsentRenderState, FastlaneData, FastlaneOptions, FastlanePaymentMethodConfiguration, FastlaneProfile, FastlaneSDKConfiguration, FastlaneShipping, FastlaneShippingAddressSelectorResult, FastlaneSignupConfiguration, FastlaneWindowInstance, FieldsetVisibility, FingerPrintData, FingerprintResolveData, FundingSource, FundingSourceKeys, GiftCardBalanceCheckErrorType, GiftCardConfiguration, GiftCardElementData, GiftCardValidationError, GooglePayConfiguration, GooglePaymentDataRequest, ICore, IDropin, InstantPaymentTypes, Intent, IrisConfiguration, IrisData, IrisState, IssuerListConfiguration, IssuerListData, KlarnaAction, KlarnaAdditionalDetailsData, KlarnaComponentRef, KlarnaConfiguration, KlarnaSdkData, KlarnaWidgetAuthorizeResponse, KlarnaWidgetProps, LedgerCurrencies, MandateFrequencyType, MandateType, OnChangeData, OpenInvoiceActiveFieldsets, OpenInvoiceConfiguration, OpenInvoiceFieldsetsRefs, OpenInvoiceProps, OpenInvoiceStateData, OpenInvoiceStateError, OpenInvoiceStateValid, OpenInvoiceVisibility, Order, OrderButtonProps, OrderStatus, PayPalConfiguration, PayToConfiguration, PayToData, PayToPlaceholdersType, PayloadJSON, PaymentAction, PaymentActionsType, PaymentAmount, PaymentCompletedData, PaymentData, PaymentFailedData, PaymentMethodBrand, PaymentMethodData, PaymentMethodGroup, PaymentMethodOptions, PaymentMethods, PaymentMethodsConfiguration, PaymentMethodsRequestData, PaymentMethodsResponse, PaymentResponseData, PersonalDetailsSchema, PixConfiguration, PixElementData, PostMsgParseErrorObject, PreAuthorizedDebitCanadaConfiguration, PreAuthorizedDebitCanadaPlaceholders, ProcessedPaymentStatusResponse, QRLoaderConfiguration, RawPaymentMethod, RawPaymentResponse, RawPaymentStatusResponse, RawStoredPaymentMethod, RecurringMetadata, RedirectConfiguration, Region, ResultCode, ResultObject, ResultValue, SepaConfiguration, SepaElementData, SessionsResponse, SignOutButtonProps, SocialSecurityMode, StatusFromAction, SubmitActions, SubmitData, SupportedLocale, SupportedPayPalFundingSources, ThreeDS2ActionProps, ThreeDS2ChallengeConfiguration, ThreeDS2ConfigProps, ThreeDS2DeviceFingerprintConfiguration, ThreeDS2FingerprintResponse, ThreeDS2FlowObject, ThreeDS2FlowProps, ThreeDS2Token, UIElementProps, UIElementStatus, UPIAppList, UPIConfiguration, UpdateAmazonCheckoutSessionRequest, UpiMode, UpiPaymentData, UpiType, ValidationError, VoucherConfiguration, VoucherDetail, VoucherProps, balanceCheckResponseType, onBalanceCheckCallbackType, onOrderCancelData, onOrderCancelInternalCallback, onOrderCancelType, onOrderRequestCallbackType, onOrderUpdatedCallbackType, onRequiringConfirmationCallbackType };
@@ -1,2 +1,2 @@
1
- const t=Object.prototype.toString;function n(t){return"object"==typeof t&&null!==t&&"[object Array]"===Object.prototype.toString.call(t)}function e(t){return null!=t}function r(t){return!1!==t&&e(t)}function o(t){return!!t&&"object"==typeof t}function c(e){return!r(e)||(!(!("number"==typeof(c=e)||o(c)&&"[object Number]"===t.call(c))||0!==e&&!Number.isNaN(e))||(!(!n(e)&&!function(n){return"string"==typeof n||o(n)&&"[object String]"===t.call(n)}(e)||0!==e.length)||!(!o(e)||0!==Object.keys(e).length)));var c}function u(...t){const e=n(t[0])?t[0]:t;return{from:t=>e.map(n=>n in t?{[n]:t[n]}:{}).reduce((t,n)=>({...t,...n}),{})}}function f(...t){const e=n(t[0])?t[0]:t;return{from:t=>u(...Object.keys(t).filter(t=>!e.includes(t))).from(t)}}export{e as existy,c as falsy,n as isArray,u as pick,f as reject,r as truthy};
1
+ const t=Object.prototype.toString;function n(t){return"object"==typeof t&&null!==t&&"[object Array]"===Object.prototype.toString.call(t)}function e(t){return null!=t}function r(t){return!1!==t&&e(t)}function o(t){return!!t&&"object"==typeof t}function c(e){return!r(e)||(!(!("number"==typeof(c=e)||o(c)&&"[object Number]"===t.call(c))||0!==e&&!Number.isNaN(e))||(!(!n(e)&&!function(n){return"string"==typeof n||o(n)&&"[object String]"===t.call(n)}(e)||0!==e.length)||!(!o(e)||0!==Object.keys(e).length)));var c}function u(t){return!c(t)}function f(...t){const e=n(t[0])?t[0]:t;return{from:t=>e.map(n=>n in t?{[n]:t[n]}:{}).reduce((t,n)=>({...t,...n}),{})}}function i(...t){const e=n(t[0])?t[0]:t;return{from:t=>f(...Object.keys(t).filter(t=>!e.includes(t))).from(t)}}export{e as existy,c as falsy,n as isArray,u as notFalsy,f as pick,i as reject,r as truthy};
2
2
  //# sourceMappingURL=commonUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commonUtils.js","sources":["../../../src/utils/commonUtils.ts"],"sourcesContent":["/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n * @internal\n */\nconst objToString = Object.prototype.toString;\n\n/**\n * Checks if `prop` is classified as an `Array` primitive or object.\n * @internal\n * @param prop - The value to check.\n * @returns Returns `true` if `prop` is correctly classified, else `false`.\n * @example\n * ```\n * isArray([1, 2, 3]);\n * // => true\n *\n * isArray(1);\n * // => false\n * ```\n */\nexport function isArray(prop) {\n return typeof prop === 'object' && prop !== null && Object.prototype.toString.call(prop) === '[object Array]';\n}\n\n/**\n * The function existy is meant to define the existence of something.\n * Using the loose inequality operator (!=), it is possible to distinguish between null, undefined, and everything else.\n * @internal\n * @param x -\n * @returns\n */\nexport function existy(x) {\n return x != null;\n}\n\n/**\n * Used to determine if something should be considered a synonym for true\n * NOTE: The number zero is considered “truthy” by design as is '' & `{}`.\n * If you wish to retain the behavior where 0 is a synonym for false, then do not use truthy where you might expect 0\n * So - returns true if something is not false, undefined or null\n * @internal\n * @param x -\n * @returns\n */\nexport function truthy(x) {\n return x !== false && existy(x);\n}\n\n/**\n * Checks if `value` is object-like.\n * (FROM lodash.3.10.1)\n * @internal\n * @param value - The value to check.\n * @returns Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value === 'object';\n}\n\n/**\n * @internal\n * Checks if `value` is classified as a `Number` primitive or object.\n * NOTE: `Infinity`, `-Infinity`, and `NaN` are classified as numbers\n * (FROM lodash.3.10.1)\n * @param value - The value to check.\n * @returns Returns `true` if `value` is correctly classified, else `false`.\n * @example\n * ```\n * isNumber(8.4);\n * // => true\n *\n * isNumber(NaN);\n * // => true\n *\n * isNumber('8.4');\n * // => false\n * ```\n */\nfunction isNumber(value) {\n const numberTag = '[object Number]';\n return typeof value === 'number' || (isObjectLike(value) && objToString.call(value) === numberTag);\n}\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n * (FROM lodash.3.10.1)\n * @internal\n * @param value - The value to check.\n * @returns Returns `true` if `value` is correctly classified, else `false`.\n * @example\n * ```\n * isString('abc');\n * // => true\n *\n * isString(1);\n * // => false\n * ```\n */\nfunction isString(value) {\n const stringTag = '[object String]';\n return typeof value === 'string' || (isObjectLike(value) && objToString.call(value) === stringTag);\n}\n\n/**\n * Returns true if x is:\n * null, undefined, false, 0, NaN, empty object or array, empty string\n * @param x -\n * @example\n * ```\n * falsy(0) // => true\n * falsy('') // => true\n * falsy({}) // => true\n * falsy([]) // => true\n * falsy(false) // => true\n * falsy(NaN) // => true\n * falsy(null) // => true\n * falsy(undefined) // => true\n *\n * falsy(1) // => false\n * falsy('d') // => false\n * falsy({type:\"kin\"}) // => false\n * falsy([6]) // => false\n * falsy(true) // => false\n * ```\n */\nexport function falsy(x) {\n // Is null, undefined or false\n if (!truthy(x)) {\n return true;\n }\n\n // = 0 || NaN\n if (isNumber(x)) {\n if (x === 0 || Number.isNaN(x)) {\n return true;\n }\n }\n\n // empty array or string\n if ((isArray(x) || isString(x)) && x.length === 0) {\n return true;\n }\n\n // empty object\n if (isObjectLike(x) && Object.keys(x).length === 0) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Inverse of falsy - returns true if x is NOT null, undefined, false, 0, NaN, empty object or array, empty string\n * @param x -\n */\nexport function notFalsy(x) {\n return !falsy(x);\n}\n\n/**\n * 'Destructures' properties from object - returns a new object only containing those properties that were asked for (including if those properties\n * have values that are falsy: null, undefined, false, '').\n *\n * @param args - property names to select: can be either 'regular' arguments (comma separated list) or an array\n * @returns - an object with a function 'from' that accepts a single argument - the object from which to choose properties.\n * This function returns a new object - a copy of the original but only including the desired properties\n *\n * @example const strippedObj = pick('cardType', 'securityCode').from(cardObject);\n * @example const strippedObj = pick(['cardType', 'securityCode']).from(cardObject);\n */\nexport function pick(...args) {\n const myArgs = isArray(args[0]) ? args[0] : args;\n return {\n from: obj => {\n return myArgs.map(k => (k in obj ? { [k]: obj[k] } : {})).reduce((res, o) => ({ ...res, ...o }), {});\n }\n };\n}\n\n/**\n *'Destructures' properties from object, returning a new object containing all the original objects properties except those that were specifically rejected\n *\n * @param args - property names to reject: can be either 'regular' arguments (comma separated list) or an array\n * @returns - an object with a function 'from' that accepts a single argument - the object from which to reject properties.\n * This function returns a new object - a copy of the original but excluding the selected properties\n *\n * @example const strippedObj = reject('permittedLengths', 'pattern', 'startingRules').from(cardObject);\n * @example const strippedObj = reject(['permittedLengths', 'pattern', 'startingRules']).from(cardObject);\n */\nexport function reject(...args) {\n const myArgs = isArray(args[0]) ? args[0] : args;\n return {\n from: obj => {\n const vkeys = Object.keys(obj).filter(k => !myArgs.includes(k));\n return pick(...vkeys).from(obj);\n }\n };\n}\n"],"names":["objToString","Object","prototype","toString","isArray","prop","call","existy","x","truthy","isObjectLike","value","falsy","Number","isNaN","isString","length","keys","pick","args","myArgs","from","obj","map","k","reduce","res","o","reject","filter","includes"],"mappings":"AAKA,MAAMA,EAAcC,OAAOC,UAAUC,SAgB9B,SAASC,EAAQC,GACpB,MAAuB,iBAATA,GAA8B,OAATA,GAA0D,mBAAzCJ,OAAOC,UAAUC,SAASG,KAAKD,EACvF,CASO,SAASE,EAAOC,GACnB,OAAY,MAALA,CACX,CAWO,SAASC,EAAOD,GACnB,OAAa,IAANA,GAAeD,EAAOC,EACjC,CASA,SAASE,EAAaC,GAClB,QAASA,GAA0B,iBAAVA,CAC7B,CAoEO,SAASC,EAAMJ,GAElB,OAAKC,EAAOD,SA/CY,iBAFVG,EAsDDH,IApDwBE,EAAaC,IADhC,oBAC0CX,EAAYM,KAAKK,KAqD/D,IAANH,IAAWK,OAAOC,MAAMN,SAM3BJ,EAAQI,KAzCjB,SAAkBG,GAEd,MAAwB,iBAAVA,GAAuBD,EAAaC,IADhC,oBAC0CX,EAAYM,KAAKK,EACjF,CAsCuBI,CAASP,IAAoB,IAAbA,EAAEQ,YAKjCN,EAAaF,IAAgC,IAA1BP,OAAOgB,KAAKT,GAAGQ,UAlE1C,IAAkBL,CAuElB,CAqBO,SAASO,KAAQC,GACpB,MAAMC,EAAShB,EAAQe,EAAK,IAAMA,EAAK,GAAKA,EAC5C,MAAO,CACHE,KAAMC,GACKF,EAAOG,IAAIC,GAAMA,KAAKF,EAAM,CAAEE,CAACA,GAAIF,EAAIE,IAAO,CAAA,GAAKC,OAAO,CAACC,EAAKC,SAAYD,KAAQC,IAAM,CAAA,GAG7G,CAYO,SAASC,KAAUT,GACtB,MAAMC,EAAShB,EAAQe,EAAK,IAAMA,EAAK,GAAKA,EAC5C,MAAO,CACHE,KAAMC,GAEKJ,KADOjB,OAAOgB,KAAKK,GAAKO,OAAOL,IAAMJ,EAAOU,SAASN,KACtCH,KAAKC,GAGvC"}
1
+ {"version":3,"file":"commonUtils.js","sources":["../../../src/utils/commonUtils.ts"],"sourcesContent":["/**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n * @internal\n */\nconst objToString = Object.prototype.toString;\n\n/**\n * Checks if `prop` is classified as an `Array` primitive or object.\n * @internal\n * @param prop - The value to check.\n * @returns Returns `true` if `prop` is correctly classified, else `false`.\n * @example\n * ```\n * isArray([1, 2, 3]);\n * // => true\n *\n * isArray(1);\n * // => false\n * ```\n */\nexport function isArray(prop) {\n return typeof prop === 'object' && prop !== null && Object.prototype.toString.call(prop) === '[object Array]';\n}\n\n/**\n * The function existy is meant to define the existence of something.\n * Using the loose inequality operator (!=), it is possible to distinguish between null, undefined, and everything else.\n * @internal\n * @param x -\n * @returns\n */\nexport function existy(x) {\n return x != null;\n}\n\n/**\n * Used to determine if something should be considered a synonym for true\n * NOTE: The number zero is considered “truthy” by design as is '' & `{}`.\n * If you wish to retain the behavior where 0 is a synonym for false, then do not use truthy where you might expect 0\n * So - returns true if something is not false, undefined or null\n * @internal\n * @param x -\n * @returns\n */\nexport function truthy(x) {\n return x !== false && existy(x);\n}\n\n/**\n * Checks if `value` is object-like.\n * (FROM lodash.3.10.1)\n * @internal\n * @param value - The value to check.\n * @returns Returns `true` if `value` is object-like, else `false`.\n */\nfunction isObjectLike(value) {\n return !!value && typeof value === 'object';\n}\n\n/**\n * @internal\n * Checks if `value` is classified as a `Number` primitive or object.\n * NOTE: `Infinity`, `-Infinity`, and `NaN` are classified as numbers\n * (FROM lodash.3.10.1)\n * @param value - The value to check.\n * @returns Returns `true` if `value` is correctly classified, else `false`.\n * @example\n * ```\n * isNumber(8.4);\n * // => true\n *\n * isNumber(NaN);\n * // => true\n *\n * isNumber('8.4');\n * // => false\n * ```\n */\nfunction isNumber(value) {\n const numberTag = '[object Number]';\n return typeof value === 'number' || (isObjectLike(value) && objToString.call(value) === numberTag);\n}\n\n/**\n * Checks if `value` is classified as a `String` primitive or object.\n * (FROM lodash.3.10.1)\n * @internal\n * @param value - The value to check.\n * @returns Returns `true` if `value` is correctly classified, else `false`.\n * @example\n * ```\n * isString('abc');\n * // => true\n *\n * isString(1);\n * // => false\n * ```\n */\nfunction isString(value) {\n const stringTag = '[object String]';\n return typeof value === 'string' || (isObjectLike(value) && objToString.call(value) === stringTag);\n}\n\n/**\n * Returns true if x is:\n * null, undefined, false, 0, NaN, empty object or array, empty string\n * @param x -\n * @example\n * ```\n * falsy(0) // => true\n * falsy('') // => true\n * falsy({}) // => true\n * falsy([]) // => true\n * falsy(false) // => true\n * falsy(NaN) // => true\n * falsy(null) // => true\n * falsy(undefined) // => true\n *\n * falsy(1) // => false\n * falsy('d') // => false\n * falsy({type:\"kin\"}) // => false\n * falsy([6]) // => false\n * falsy(true) // => false\n * ```\n */\nexport function falsy(x) {\n // Is null, undefined or false\n if (!truthy(x)) {\n return true;\n }\n\n // = 0 || NaN\n if (isNumber(x)) {\n if (x === 0 || Number.isNaN(x)) {\n return true;\n }\n }\n\n // empty array or string\n if ((isArray(x) || isString(x)) && x.length === 0) {\n return true;\n }\n\n // empty object\n if (isObjectLike(x) && Object.keys(x).length === 0) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Inverse of falsy - returns true if x is NOT null, undefined, false, 0, NaN, empty object or array, empty string\n * @param x -\n */\nexport function notFalsy(x) {\n return !falsy(x);\n}\n\n/**\n * 'Destructures' properties from object - returns a new object only containing those properties that were asked for (including if those properties\n * have values that are falsy: null, undefined, false, '').\n *\n * @param args - property names to select: can be either 'regular' arguments (comma separated list) or an array\n * @returns - an object with a function 'from' that accepts a single argument - the object from which to choose properties.\n * This function returns a new object - a copy of the original but only including the desired properties\n *\n * @example const strippedObj = pick('cardType', 'securityCode').from(cardObject);\n * @example const strippedObj = pick(['cardType', 'securityCode']).from(cardObject);\n */\nexport function pick(...args) {\n const myArgs = isArray(args[0]) ? args[0] : args;\n return {\n from: obj => {\n return myArgs.map(k => (k in obj ? { [k]: obj[k] } : {})).reduce((res, o) => ({ ...res, ...o }), {});\n }\n };\n}\n\n/**\n *'Destructures' properties from object, returning a new object containing all the original objects properties except those that were specifically rejected\n *\n * @param args - property names to reject: can be either 'regular' arguments (comma separated list) or an array\n * @returns - an object with a function 'from' that accepts a single argument - the object from which to reject properties.\n * This function returns a new object - a copy of the original but excluding the selected properties\n *\n * @example const strippedObj = reject('permittedLengths', 'pattern', 'startingRules').from(cardObject);\n * @example const strippedObj = reject(['permittedLengths', 'pattern', 'startingRules']).from(cardObject);\n */\nexport function reject(...args) {\n const myArgs = isArray(args[0]) ? args[0] : args;\n return {\n from: obj => {\n const vkeys = Object.keys(obj).filter(k => !myArgs.includes(k));\n return pick(...vkeys).from(obj);\n }\n };\n}\n"],"names":["objToString","Object","prototype","toString","isArray","prop","call","existy","x","truthy","isObjectLike","value","falsy","Number","isNaN","isString","length","keys","notFalsy","pick","args","myArgs","from","obj","map","k","reduce","res","o","reject","filter","includes"],"mappings":"AAKA,MAAMA,EAAcC,OAAOC,UAAUC,SAgB9B,SAASC,EAAQC,GACpB,MAAuB,iBAATA,GAA8B,OAATA,GAA0D,mBAAzCJ,OAAOC,UAAUC,SAASG,KAAKD,EACvF,CASO,SAASE,EAAOC,GACnB,OAAY,MAALA,CACX,CAWO,SAASC,EAAOD,GACnB,OAAa,IAANA,GAAeD,EAAOC,EACjC,CASA,SAASE,EAAaC,GAClB,QAASA,GAA0B,iBAAVA,CAC7B,CAoEO,SAASC,EAAMJ,GAElB,OAAKC,EAAOD,SA/CY,iBAFVG,EAsDDH,IApDwBE,EAAaC,IADhC,oBAC0CX,EAAYM,KAAKK,KAqD/D,IAANH,IAAWK,OAAOC,MAAMN,SAM3BJ,EAAQI,KAzCjB,SAAkBG,GAEd,MAAwB,iBAAVA,GAAuBD,EAAaC,IADhC,oBAC0CX,EAAYM,KAAKK,EACjF,CAsCuBI,CAASP,IAAoB,IAAbA,EAAEQ,YAKjCN,EAAaF,IAAgC,IAA1BP,OAAOgB,KAAKT,GAAGQ,UAlE1C,IAAkBL,CAuElB,CAMO,SAASO,EAASV,GACrB,OAAQI,EAAMJ,EAClB,CAaO,SAASW,KAAQC,GACpB,MAAMC,EAASjB,EAAQgB,EAAK,IAAMA,EAAK,GAAKA,EAC5C,MAAO,CACHE,KAAMC,GACKF,EAAOG,IAAIC,GAAMA,KAAKF,EAAM,CAAEE,CAACA,GAAIF,EAAIE,IAAO,CAAA,GAAKC,OAAO,CAACC,EAAKC,SAAYD,KAAQC,IAAM,CAAA,GAG7G,CAYO,SAASC,KAAUT,GACtB,MAAMC,EAASjB,EAAQgB,EAAK,IAAMA,EAAK,GAAKA,EAC5C,MAAO,CACHE,KAAMC,GAEKJ,KADOlB,OAAOgB,KAAKM,GAAKO,OAAOL,IAAMJ,EAAOU,SAASN,KACtCH,KAAKC,GAGvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"promiseTimeout.js","sources":["../../../src/utils/promiseTimeout.ts"],"sourcesContent":["/**\n * Tests if a passed promise settles before a certain amount of time has elapsed\n *\n * @param ms - number of milliseconds the passed promise has to settle\n * @param promise - the passed promise\n * @param timeOutObject - the object that the promiseTimeout will reject with if the passed promise doesn't settle in time\n */\nconst promiseTimeout = <T>(ms: number, promise: Promise<T>, timeOutObject: object) => {\n let timer: NodeJS.Timeout | null;\n\n const promiseTimer: Promise<T> = new Promise((resolve, reject): void => {\n // Create a timeout to reject promise if not resolved\n timer = setTimeout((): void => {\n reject(timeOutObject);\n }, ms);\n\n promise\n .then((res): void => {\n clearTimeout(timer);\n resolve(res);\n })\n .catch((err): void => {\n clearTimeout(timer);\n reject(err);\n });\n });\n\n const cancelTimer = (): void => {\n clearTimeout(timer);\n };\n\n return {\n promise: promiseTimer,\n cancel: cancelTimer\n };\n};\n\nexport default promiseTimeout;\n"],"names":["promiseTimeout","ms","promise","timeOutObject","timer","Promise","resolve","reject","setTimeout","then","res","clearTimeout","catch","err","cancel"],"mappings":"AAOA,MAAMA,EAAiB,CAAIC,EAAYC,EAAqBC,KACxD,IAAIC,EAuBJ,MAAO,CACHF,QAtB6B,IAAIG,QAAQ,CAACC,EAASC,KAEnDH,EAAQI,WAAW,KACfD,EAAOJ,IACRF,GAEHC,EACKO,KAAMC,IACHC,aAAaP,GACbE,EAAQI,KAEXE,MAAOC,IACJF,aAAaP,GACbG,EAAOM,OAUfC,OANgB,KAChBH,aAAaP"}
1
+ {"version":3,"file":"promiseTimeout.js","sources":["../../../src/utils/promiseTimeout.ts"],"sourcesContent":["/**\n * Tests if a passed promise settles before a certain amount of time has elapsed\n *\n * @param ms - number of milliseconds the passed promise has to settle\n * @param promise - the passed promise\n * @param timeOutObject - the object that the promiseTimeout will reject with if the passed promise doesn't settle in time\n */\nconst promiseTimeout = <T>(ms: number, promise: Promise<T>, timeOutObject: object): { promise: Promise<T>; cancel: () => void } => {\n let timer: NodeJS.Timeout | null;\n\n const promiseTimer: Promise<T> = new Promise((resolve, reject): void => {\n // Create a timeout to reject promise if not resolved\n timer = setTimeout((): void => {\n reject(timeOutObject);\n }, ms);\n\n promise\n .then((res): void => {\n clearTimeout(timer);\n resolve(res);\n })\n .catch((err): void => {\n clearTimeout(timer);\n reject(err);\n });\n });\n\n const cancelTimer = (): void => {\n clearTimeout(timer);\n };\n\n return {\n promise: promiseTimer,\n cancel: cancelTimer\n };\n};\n\nexport default promiseTimeout;\n"],"names":["promiseTimeout","ms","promise","timeOutObject","timer","Promise","resolve","reject","setTimeout","then","res","clearTimeout","catch","err","cancel"],"mappings":"AAOA,MAAMA,EAAiB,CAAIC,EAAYC,EAAqBC,KACxD,IAAIC,EAuBJ,MAAO,CACHF,QAtB6B,IAAIG,QAAQ,CAACC,EAASC,KAEnDH,EAAQI,WAAW,KACfD,EAAOJ,IACRF,GAEHC,EACKO,KAAMC,IACHC,aAAaP,GACbE,EAAQI,KAEXE,MAAOC,IACJF,aAAaP,GACbG,EAAOM,OAUfC,OANgB,KAChBH,aAAaP"}
@@ -1,2 +1,2 @@
1
- const t=(t,e,r,n)=>{if(t[r]?.[e]?.formatterFn)return null;const l=t[r]?.[e]?.maxlength;return l||30},e=t=>!(null!=t&&!/^[\s]*$/.test(t)),r="?\\+_=!@#$%^&*(){}~<>\\[\\]\\\\",n=(t,e="g")=>new RegExp(`[${t}]`,e),l=t=>t.trimStart().replace(/\s+/g," ");export{r as SPECIAL_CHARS,n as getFormattingRegEx,t as getMaxLengthByFieldAndCountry,e as isEmpty,l as trimValWithOneSpace};
1
+ const t=(t,e,n,r)=>{if(t[n]?.[e]?.formatterFn)return null;const l=t[n]?.[e]?.maxlength;return l||30},e=t=>!(null!=t&&!/^[\s]*$/.test(t)),n="?\\+_=!@#$%^&*(){}~<>\\[\\]\\\\",r=(t,e="g")=>new RegExp(`[${t}]`,e),l=t=>t.trim().replace(/\s+/g," ");export{n as SPECIAL_CHARS,r as getFormattingRegEx,t as getMaxLengthByFieldAndCountry,e as isEmpty,l as trimValWithOneSpace};
2
2
  //# sourceMappingURL=validator-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validator-utils.js","sources":["../../../src/utils/validator-utils.ts"],"sourcesContent":["import { CountryFormatRules } from './Validator/types';\n\nconst MAX_LENGTH = 30;\n\nexport const getMaxLengthByFieldAndCountry = (\n formattingRules: CountryFormatRules,\n field: string,\n country: string,\n ignoreIfFormatterExists: boolean\n): number | null => {\n // In ignoreIfFormatterExists is true we expect the formatter function to also act to limit length\n if (ignoreIfFormatterExists && formattingRules[country]?.[field]?.formatterFn) {\n return null;\n }\n const maxLength = formattingRules[country]?.[field]?.maxlength;\n return maxLength ? maxLength : MAX_LENGTH;\n};\n\n// Not null or undefined or only spaces\nexport const isEmpty = (input: string) => !!(input == null || /^[\\s]*$/.test(input));\n\nexport const isString = (input: unknown) => typeof input === 'string' || input instanceof String;\nexport const hasText = (input: string) => isString(input) && !isEmpty(input);\n\nexport const SPECIAL_CHARS = '?\\\\+_=!@#$%^&*(){}~<>\\\\[\\\\]\\\\\\\\'; // N.B. difficulty escaping \\ (takes 3 backslashes!)\n\n// Generates a regEx ideal for use in a String.replace call for use in a formatter\n// e.g. getFormattingRegEx('^\\\\d', 'g') will generate: /[^\\d]/g which is a regEx to match anything that is not a digit\nexport const getFormattingRegEx = (specChars: string, flags = 'g') => new RegExp(`[${specChars}]`, flags);\n\n// Creates a regEx ideal for use in a RegExp.test call for use in a validator\nexport const getValidatingRegEx = (specChars: string, exclude: boolean) => new RegExp(`^[${exclude ? '^' : ''}${specChars}]+$`);\n\nexport const CHARACTER_PATTERNS: { [key: string]: RegExp } = {\n digitsHyphen: /^[\\d-]+$/,\n noHtml: /^[^<>&]+$/,\n alphaNum: /^\\d[a-zA-Z0-9]{6,11}$/,\n noSpecialChars: getValidatingRegEx(SPECIAL_CHARS, true)\n};\n\nexport const exactLength = (input: string, length: number) => {\n if (isEmpty(input)) {\n return true;\n }\n return input.length === length;\n};\n\nexport const validateForSpecialChars = (name: string) => {\n const hasNoLength = !name.length;\n // RegEx .test, if run against empty string, will return false\n return CHARACTER_PATTERNS.noSpecialChars.test(name) || hasNoLength;\n};\n\n// Trim start and never allow more than 1 space on the end\nexport const trimValWithOneSpace = (val: string) => val.trimStart().replace(/\\s+/g, ' ');\n"],"names":["getMaxLengthByFieldAndCountry","formattingRules","field","country","ignoreIfFormatterExists","formatterFn","maxLength","maxlength","isEmpty","input","test","SPECIAL_CHARS","getFormattingRegEx","specChars","flags","RegExp","trimValWithOneSpace","val","trimStart","replace"],"mappings":"AAEA,MAEaA,EAAgC,CACzCC,EACAC,EACAC,EACAC,KAGA,GAA+BH,EAAgBE,KAAWD,IAAQG,YAC9D,OAAO,KAEX,MAAMC,EAAYL,EAAgBE,KAAWD,IAAQK,UACrD,OAAOD,GAbQ,IAiBNE,EAAWC,KAA8B,MAATA,IAAiB,UAAUC,KAAKD,IAKhEE,EAAgB,kCAIhBC,EAAqB,CAACC,EAAmBC,EAAQ,MAAQ,IAAIC,OAAO,IAAIF,KAAcC,GA0BtFE,EAAuBC,GAAgBA,EAAIC,YAAYC,QAAQ,OAAQ"}
1
+ {"version":3,"file":"validator-utils.js","sources":["../../../src/utils/validator-utils.ts"],"sourcesContent":["import { CountryFormatRules } from './Validator/types';\n\nconst MAX_LENGTH = 30;\n\nexport const getMaxLengthByFieldAndCountry = (\n formattingRules: CountryFormatRules,\n field: string,\n country: string,\n ignoreIfFormatterExists: boolean\n): number | null => {\n // In ignoreIfFormatterExists is true we expect the formatter function to also act to limit length\n if (ignoreIfFormatterExists && formattingRules[country]?.[field]?.formatterFn) {\n return null;\n }\n const maxLength = formattingRules[country]?.[field]?.maxlength;\n return maxLength ? maxLength : MAX_LENGTH;\n};\n\n// Not null or undefined or only spaces\nexport const isEmpty = (input: string) => !!(input == null || /^[\\s]*$/.test(input));\n\nexport const isString = (input: unknown) => typeof input === 'string' || input instanceof String;\nexport const hasText = (input: string) => isString(input) && !isEmpty(input);\n\nexport const SPECIAL_CHARS = '?\\\\+_=!@#$%^&*(){}~<>\\\\[\\\\]\\\\\\\\'; // N.B. difficulty escaping \\ (takes 3 backslashes!)\n\n// Generates a regEx ideal for use in a String.replace call for use in a formatter\n// e.g. getFormattingRegEx('^\\\\d', 'g') will generate: /[^\\d]/g which is a regEx to match anything that is not a digit\nexport const getFormattingRegEx = (specChars: string, flags = 'g') => new RegExp(`[${specChars}]`, flags);\n\n// Creates a regEx ideal for use in a RegExp.test call for use in a validator\nexport const getValidatingRegEx = (specChars: string, exclude: boolean) => new RegExp(`^[${exclude ? '^' : ''}${specChars}]+$`);\n\nexport const CHARACTER_PATTERNS: { [key: string]: RegExp } = {\n digitsHyphen: /^[\\d-]+$/,\n noHtml: /^[^<>&]+$/,\n alphaNum: /^\\d[a-zA-Z0-9]{6,11}$/,\n noSpecialChars: getValidatingRegEx(SPECIAL_CHARS, true)\n};\n\nexport const exactLength = (input: string, length: number) => {\n if (isEmpty(input)) {\n return true;\n }\n return input.length === length;\n};\n\nexport const validateForSpecialChars = (name: string) => {\n const hasNoLength = !name.length;\n // RegEx .test, if run against empty string, will return false\n return CHARACTER_PATTERNS.noSpecialChars.test(name) || hasNoLength;\n};\n\n// Trim both ends and never allow more than 1 space in between\nexport const trimValWithOneSpace = (val: string) => val.trim().replace(/\\s+/g, ' ');\n"],"names":["getMaxLengthByFieldAndCountry","formattingRules","field","country","ignoreIfFormatterExists","formatterFn","maxLength","maxlength","isEmpty","input","test","SPECIAL_CHARS","getFormattingRegEx","specChars","flags","RegExp","trimValWithOneSpace","val","trim","replace"],"mappings":"AAEA,MAEaA,EAAgC,CACzCC,EACAC,EACAC,EACAC,KAGA,GAA+BH,EAAgBE,KAAWD,IAAQG,YAC9D,OAAO,KAEX,MAAMC,EAAYL,EAAgBE,KAAWD,IAAQK,UACrD,OAAOD,GAbQ,IAiBNE,EAAWC,KAA8B,MAATA,IAAiB,UAAUC,KAAKD,IAKhEE,EAAgB,kCAIhBC,EAAqB,CAACC,EAAmBC,EAAQ,MAAQ,IAAIC,OAAO,IAAIF,KAAcC,GA0BtFE,EAAuBC,GAAgBA,EAAIC,OAAOC,QAAQ,OAAQ"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"./components/ANCVInput.js";import o from"./components/ANCVAwait/config.js";import{Await as n}from"../internal/Await/Await.js";import s from"../../core/Errors/AdyenCheckoutError.js";import i from"../internal/PayButton/PayButton.js";import{sanitizeResponse as a,verifyPaymentDidNotFail as p}from"../internal/UIElement/utils.js";function c(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function h(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}class l extends e{formatData(){var t;return{paymentMethod:{type:l.type,beneficiaryId:null===(t=this.state.data)||void 0===t?void 0:t.beneficiaryId}}}submit(){if(!this.isValid)return this.showValidation(),!1;this.createOrder().then(this.makePaymentsCall).then(a).then(p).then(this.handleResponse).catch(this.handleFailedResult)}get isValid(){return!!this.state.isValid}get displayName(){return this.props.name}componentToRender(){return this.props.paymentData?t(n,{clientKey:this.props.clientKey,paymentData:this.props.paymentData,onError:this.props.onError,onComplete:this.onComplete,brandLogo:this.icon,brandName:this.displayName,type:this.constructor.type,messageText:this.props.i18n.get("ancv.confirmPayment"),awaitText:this.props.i18n.get("await.waitForConfirmation"),showCountdownTimer:o.showCountdownTimer,throttleTime:o.THROTTLE_TIME,throttleInterval:o.THROTTLE_INTERVAL,onActionHandled:this.onActionHandled}):t(r,h(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),o.forEach(function(e){c(t,e,r[e])})}return t}({ref:t=>{this.componentRef=t}},this.props),{onSubmit:this.submit,onChange:this.setState,payButton:this.payButton,showPayButton:this.props.showPayButton}))}constructor(...e){super(...e),c(this,"onOrderRequest",t=>this.props.onOrderRequest?new Promise((e,r)=>{this.props.onOrderRequest(e,r,t)}):this.props.session?this.props.session.createOrder():void 0),c(this,"createOrder",()=>(this.setStatus("loading"),this.props.order?Promise.resolve():this.onOrderRequest(this.data).then(t=>{const e={order:{orderData:t.orderData,pspReference:t.pspReference}};return this.setState(e),Promise.resolve()}).catch(t=>{t instanceof s?this.handleError(t):this.handleError(new s("ERROR",t))}))),c(this,"payButton",e=>t(i,e))}}c(l,"type","ancv");export{l as ANCVElement,l as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import r from"./components/ANCVInput.js";import o from"./components/ANCVAwait/config.js";import{Await as n}from"../internal/Await/Await.js";import s from"../../core/Errors/AdyenCheckoutError.js";import i from"../internal/PayButton/PayButton.js";import{sanitizeResponse as a,verifyPaymentDidNotFail as p}from"../internal/UIElement/utils.js";function c(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function h(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e.push.apply(e,r)}return e}(Object(e)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}class m extends e{formatData(){var t;return{paymentMethod:{type:m.type,beneficiaryId:null===(t=this.state.data)||void 0===t?void 0:t.beneficiaryId}}}submit(){if(!this.isValid)return this.showValidation(),!1;this.createOrder().then(this.makePaymentsCall).then(a).then(p).then(this.handleResponse).catch(this.handleFailedResult)}get isValid(){return!!this.state.isValid}get displayName(){return this.props.name}componentToRender(){return this.props.paymentData?t(n,{clientKey:this.props.clientKey,paymentData:this.props.paymentData,onError:this.props.onError,onComplete:this.onComplete,brandLogo:this.icon,brandName:this.displayName,type:this.constructor.type,messageText:this.props.i18n.get("ancv.confirmPayment"),awaitText:this.props.i18n.get("await.waitForConfirmation"),showCountdownTimer:o.showCountdownTimer,throttleTime:o.THROTTLE_TIME,throttleInterval:o.THROTTLE_INTERVAL,onActionHandled:this.onActionHandled}):t(r,h(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),o.forEach(function(e){c(t,e,r[e])})}return t}({},this.props),{setComponentRef:this.setComponentRef,onSubmit:this.submit,onChange:this.setState,payButton:this.payButton,showPayButton:this.props.showPayButton}))}constructor(...e){super(...e),c(this,"onOrderRequest",t=>this.props.onOrderRequest?new Promise((e,r)=>{this.props.onOrderRequest(e,r,t)}):this.props.session?this.props.session.createOrder():void 0),c(this,"createOrder",()=>(this.setStatus("loading"),this.props.order?Promise.resolve():this.onOrderRequest(this.data).then(t=>{const e={order:{orderData:t.orderData,pspReference:t.pspReference}};return this.setState(e),Promise.resolve()}).catch(t=>{t instanceof s?this.handleError(t):this.handleError(new s("ERROR",t))}))),c(this,"payButton",e=>t(i,e))}}c(m,"type","ancv");export{m as ANCVElement,m as default};
2
2
  //# sourceMappingURL=ANCV.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ANCV.js","sources":["../../../../src/components/ANCV/ANCV.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport ANCVInput from './components/ANCVInput';\nimport config from './components/ANCVAwait/config';\nimport { Await } from '../../components/internal/Await';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport PayButton from '../internal/PayButton';\nimport { ANCVConfiguration } from './types';\nimport { sanitizeResponse, verifyPaymentDidNotFail } from '../internal/UIElement/utils';\nimport { PayButtonProps } from '../internal/PayButton/PayButton';\n\nexport class ANCVElement extends UIElement<ANCVConfiguration> {\n public static readonly type = 'ancv';\n\n /**\n * Formats the component data output\n */\n formatData() {\n return {\n paymentMethod: {\n type: ANCVElement.type,\n beneficiaryId: this.state.data?.beneficiaryId\n }\n };\n }\n\n private onOrderRequest = data => {\n if (this.props.onOrderRequest)\n return new Promise((resolve, reject) => {\n this.props.onOrderRequest(resolve, reject, data);\n });\n\n if (this.props.session) {\n return this.props.session.createOrder();\n }\n };\n\n /**\n * Check if order exists, if it does Resolve.\n * Otherwise createOrder and then Resolve.\n */\n public createOrder = (): Promise<void> => {\n this.setStatus('loading');\n\n // allow for multiple ANCV payments, follow giftcard logic and just use order if it exists\n if (this.props.order) {\n return Promise.resolve();\n }\n\n return this.onOrderRequest(this.data)\n .then((order: { orderData: string; pspReference: string }) => {\n const stateOrder = { order: { orderData: order.orderData, pspReference: order.pspReference } };\n this.setState(stateOrder);\n return Promise.resolve();\n })\n .catch(error => {\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', error));\n }\n });\n };\n\n public submit() {\n if (!this.isValid) {\n this.showValidation();\n return false;\n }\n\n this.createOrder()\n .then(this.makePaymentsCall)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n // Reimplement payButton similar to GiftCard to allow to set onClick\n protected override payButton = (props: PayButtonProps): h.JSX.Element => {\n return <PayButton {...props} />;\n };\n\n get isValid(): boolean {\n return !!this.state.isValid;\n }\n\n get displayName(): string {\n return this.props.name;\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.paymentData) {\n return (\n <Await\n clientKey={this.props.clientKey}\n paymentData={this.props.paymentData}\n onError={this.props.onError}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n brandName={this.displayName}\n type={this.constructor['type']}\n messageText={this.props.i18n.get('ancv.confirmPayment')}\n awaitText={this.props.i18n.get('await.waitForConfirmation')}\n showCountdownTimer={config.showCountdownTimer}\n throttleTime={config.THROTTLE_TIME}\n throttleInterval={config.THROTTLE_INTERVAL}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n\n return (\n <ANCVInput\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n onSubmit={this.submit}\n onChange={this.setState}\n payButton={this.payButton}\n showPayButton={this.props.showPayButton}\n />\n );\n }\n}\n\nexport default ANCVElement;\n"],"names":["ANCVElement","UIElement","formatData","_this_state_data","paymentMethod","type","beneficiaryId","this","state","data","submit","isValid","showValidation","createOrder","then","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","handleFailedResult","displayName","props","name","componentToRender","paymentData","h","Await","clientKey","onError","onComplete","brandLogo","icon","brandName","constructor","messageText","i18n","get","awaitText","showCountdownTimer","config","throttleTime","THROTTLE_TIME","throttleInterval","THROTTLE_INTERVAL","onActionHandled","ANCVInput","ref","componentRef","onSubmit","onChange","setState","payButton","showPayButton","super","args","_define_property","onOrderRequest","Promise","resolve","reject","session","setStatus","order","stateOrder","orderData","pspReference","error","AdyenCheckoutError","handleError","PayButton"],"mappings":"67BAWO,MAAMA,UAAoBC,EAM7BC,UAAAA,GAI2B,IAAAC,EAHvB,MAAO,CACHC,cAAe,CACXC,KAAML,EAAYK,KAClBC,cAA8B,QAAfH,EAAAI,KAAKC,MAAMC,YAAX,IAAAN,OAAA,EAAAA,EAAiBG,eAG5C,CAwCOI,MAAAA,GACH,IAAKH,KAAKI,QAEN,OADAJ,KAAKK,kBACE,EAGXL,KAAKM,cACAC,KAAKP,KAAKQ,kBACVD,KAAKE,GACLF,KAAKG,GACLH,KAAKP,KAAKW,gBACVC,MAAMZ,KAAKa,mBACpB,CAOA,WAAIT,GACA,QAASJ,KAAKC,MAAMG,OACxB,CAEA,eAAIU,GACA,OAAOd,KAAKe,MAAMC,IACtB,CAEmBC,iBAAAA,GACf,OAAIjB,KAAKe,MAAMG,YAEPC,EAACC,EAAAA,CACGC,UAAWrB,KAAKe,MAAMM,UACtBH,YAAalB,KAAKe,MAAMG,YACxBI,QAAStB,KAAKe,MAAMO,QACpBC,WAAYvB,KAAKuB,WACjBC,UAAWxB,KAAKyB,KAChBC,UAAW1B,KAAKc,YAChBhB,KAAME,KAAK2B,YAAY,KACvBC,YAAa5B,KAAKe,MAAMc,KAAKC,IAAI,uBACjCC,UAAW/B,KAAKe,MAAMc,KAAKC,IAAI,6BAC/BE,mBAAoBC,EAAOD,mBAC3BE,aAAcD,EAAOE,cACrBC,iBAAkBH,EAAOI,kBACzBC,gBAAiBtC,KAAKsC,kBAM9BnB,EAACoB,EAAAA,oUAAAA,CAAAA,CACGC,IAAKA,IACDxC,KAAKyC,aAAeD,IAEpBxC,KAAKe,OAAK,CACd2B,SAAU1C,KAAKG,OACfwC,SAAU3C,KAAK4C,SACfC,UAAW7C,KAAK6C,UAChBC,cAAe9C,KAAKe,MAAM+B,gBAGtC,mBAjHGC,SAAAC,GAeHC,EAAAjD,KAAQkD,iBAAiBhD,GACjBF,KAAKe,MAAMmC,eACJ,IAAIC,QAAQ,CAACC,EAASC,KACzBrD,KAAKe,MAAMmC,eAAeE,EAASC,EAAQnD,KAG/CF,KAAKe,MAAMuC,QACJtD,KAAKe,MAAMuC,QAAQhD,mBAD9B,GASJ2C,OAAO3C,cAAc,KACjBN,KAAKuD,UAAU,WAGXvD,KAAKe,MAAMyC,MACJL,QAAQC,UAGZpD,KAAKkD,eAAelD,KAAKE,MAC3BK,KAAMiD,IACH,MAAMC,EAAa,CAAED,MAAO,CAAEE,UAAWF,EAAME,UAAWC,aAAcH,EAAMG,eAE9E,OADA3D,KAAK4C,SAASa,GACPN,QAAQC,YAElBxC,MAAMgD,IACCA,aAAiBC,EACjB7D,KAAK8D,YAAYF,GAEjB5D,KAAK8D,YAAY,IAAID,EAAmB,QAASD,QAoBjEX,EAAAjD,KAAmB6C,YAAa9B,GACrBI,EAAC4C,EAAchD,KApE1BkC,EADSxD,EACcK,OAAO"}
1
+ {"version":3,"file":"ANCV.js","sources":["../../../../src/components/ANCV/ANCV.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport ANCVInput from './components/ANCVInput';\nimport config from './components/ANCVAwait/config';\nimport { Await } from '../../components/internal/Await';\nimport AdyenCheckoutError from '../../core/Errors/AdyenCheckoutError';\nimport PayButton from '../internal/PayButton';\nimport { ANCVConfiguration } from './types';\nimport { sanitizeResponse, verifyPaymentDidNotFail } from '../internal/UIElement/utils';\nimport { PayButtonProps } from '../internal/PayButton/PayButton';\n\nexport class ANCVElement extends UIElement<ANCVConfiguration> {\n public static readonly type = 'ancv';\n\n /**\n * Formats the component data output\n */\n formatData() {\n return {\n paymentMethod: {\n type: ANCVElement.type,\n beneficiaryId: this.state.data?.beneficiaryId\n }\n };\n }\n\n private onOrderRequest = data => {\n if (this.props.onOrderRequest)\n return new Promise((resolve, reject) => {\n void this.props.onOrderRequest(resolve, reject, data);\n });\n\n if (this.props.session) {\n return this.props.session.createOrder();\n }\n };\n\n /**\n * Check if order exists, if it does Resolve.\n * Otherwise createOrder and then Resolve.\n */\n public createOrder = (): Promise<void> => {\n this.setStatus('loading');\n\n // allow for multiple ANCV payments, follow giftcard logic and just use order if it exists\n if (this.props.order) {\n return Promise.resolve();\n }\n\n return this.onOrderRequest(this.data)\n .then((order: { orderData: string; pspReference: string }) => {\n const stateOrder = { order: { orderData: order.orderData, pspReference: order.pspReference } };\n this.setState(stateOrder);\n return Promise.resolve();\n })\n .catch(error => {\n if (error instanceof AdyenCheckoutError) {\n this.handleError(error);\n } else {\n this.handleError(new AdyenCheckoutError('ERROR', error));\n }\n });\n };\n\n public submit() {\n if (!this.isValid) {\n this.showValidation();\n return false;\n }\n\n this.createOrder()\n .then(this.makePaymentsCall)\n .then(sanitizeResponse)\n .then(verifyPaymentDidNotFail)\n .then(this.handleResponse)\n .catch(this.handleFailedResult);\n }\n\n // Reimplement payButton similar to GiftCard to allow to set onClick\n protected override payButton = (props: PayButtonProps): h.JSX.Element => {\n return <PayButton {...props} />;\n };\n\n get isValid(): boolean {\n return !!this.state.isValid;\n }\n\n get displayName(): string {\n return this.props.name;\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.paymentData) {\n return (\n <Await\n clientKey={this.props.clientKey}\n paymentData={this.props.paymentData}\n onError={this.props.onError}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n brandName={this.displayName}\n type={this.constructor['type']}\n messageText={this.props.i18n.get('ancv.confirmPayment')}\n awaitText={this.props.i18n.get('await.waitForConfirmation')}\n showCountdownTimer={config.showCountdownTimer}\n throttleTime={config.THROTTLE_TIME}\n throttleInterval={config.THROTTLE_INTERVAL}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n\n return (\n <ANCVInput\n {...this.props}\n setComponentRef={this.setComponentRef}\n onSubmit={this.submit}\n onChange={this.setState}\n payButton={this.payButton}\n showPayButton={this.props.showPayButton}\n />\n );\n }\n}\n\nexport default ANCVElement;\n"],"names":["ANCVElement","UIElement","formatData","_this_state_data","paymentMethod","type","beneficiaryId","this","state","data","submit","isValid","showValidation","createOrder","then","makePaymentsCall","sanitizeResponse","verifyPaymentDidNotFail","handleResponse","catch","handleFailedResult","displayName","props","name","componentToRender","paymentData","h","Await","clientKey","onError","onComplete","brandLogo","icon","brandName","constructor","messageText","i18n","get","awaitText","showCountdownTimer","config","throttleTime","THROTTLE_TIME","throttleInterval","THROTTLE_INTERVAL","onActionHandled","ANCVInput","setComponentRef","onSubmit","onChange","setState","payButton","showPayButton","super","args","_define_property","onOrderRequest","Promise","resolve","reject","session","setStatus","order","stateOrder","orderData","pspReference","error","AdyenCheckoutError","handleError","PayButton"],"mappings":"67BAWO,MAAMA,UAAoBC,EAM7BC,UAAAA,GAI2B,IAAAC,EAHvB,MAAO,CACHC,cAAe,CACXC,KAAML,EAAYK,KAClBC,cAA8B,QAAfH,EAAAI,KAAKC,MAAMC,YAAX,IAAAN,OAAA,EAAAA,EAAiBG,eAG5C,CAwCOI,MAAAA,GACH,IAAKH,KAAKI,QAEN,OADAJ,KAAKK,kBACE,EAGXL,KAAKM,cACAC,KAAKP,KAAKQ,kBACVD,KAAKE,GACLF,KAAKG,GACLH,KAAKP,KAAKW,gBACVC,MAAMZ,KAAKa,mBACpB,CAOA,WAAIT,GACA,QAASJ,KAAKC,MAAMG,OACxB,CAEA,eAAIU,GACA,OAAOd,KAAKe,MAAMC,IACtB,CAEmBC,iBAAAA,GACf,OAAIjB,KAAKe,MAAMG,YAEPC,EAACC,EAAAA,CACGC,UAAWrB,KAAKe,MAAMM,UACtBH,YAAalB,KAAKe,MAAMG,YACxBI,QAAStB,KAAKe,MAAMO,QACpBC,WAAYvB,KAAKuB,WACjBC,UAAWxB,KAAKyB,KAChBC,UAAW1B,KAAKc,YAChBhB,KAAME,KAAK2B,YAAY,KACvBC,YAAa5B,KAAKe,MAAMc,KAAKC,IAAI,uBACjCC,UAAW/B,KAAKe,MAAMc,KAAKC,IAAI,6BAC/BE,mBAAoBC,EAAOD,mBAC3BE,aAAcD,EAAOE,cACrBC,iBAAkBH,EAAOI,kBACzBC,gBAAiBtC,KAAKsC,kBAM9BnB,EAACoB,EAAAA,oUAAAA,CAAAA,GACOvC,KAAKe,OAAK,CACdyB,gBAAiBxC,KAAKwC,gBACtBC,SAAUzC,KAAKG,OACfuC,SAAU1C,KAAK2C,SACfC,UAAW5C,KAAK4C,UAChBC,cAAe7C,KAAKe,MAAM8B,gBAGtC,mBA/GGC,SAAAC,GAeHC,EAAAhD,KAAQiD,iBAAiB/C,GACjBF,KAAKe,MAAMkC,eACJ,IAAIC,QAAQ,CAACC,EAASC,KACpBpD,KAAKe,MAAMkC,eAAeE,EAASC,EAAQlD,KAGpDF,KAAKe,MAAMsC,QACJrD,KAAKe,MAAMsC,QAAQ/C,mBAD9B,GASJ0C,OAAO1C,cAAc,KACjBN,KAAKsD,UAAU,WAGXtD,KAAKe,MAAMwC,MACJL,QAAQC,UAGZnD,KAAKiD,eAAejD,KAAKE,MAC3BK,KAAMgD,IACH,MAAMC,EAAa,CAAED,MAAO,CAAEE,UAAWF,EAAME,UAAWC,aAAcH,EAAMG,eAE9E,OADA1D,KAAK2C,SAASa,GACPN,QAAQC,YAElBvC,MAAM+C,IACCA,aAAiBC,EACjB5D,KAAK6D,YAAYF,GAEjB3D,KAAK6D,YAAY,IAAID,EAAmB,QAASD,QAoBjEX,EAAAhD,KAAmB4C,YAAa7B,GACrBI,EAAC2C,EAAc/C,KApE1BiC,EADSvD,EACcK,OAAO"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useEffect as r,useState as i}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as a}from"../../../core/Context/CoreProvider.js";import t from"../../internal/LoadingWrapper/LoadingWrapper.js";import o from"../../internal/FormFields/InputText.js";import n from"../../internal/FormFields/Field/Field.js";import s from"../../../utils/useForm/useForm.js";import"../../internal/SecuredFields/lib/CSF/utils/userAgent.js";import{ancvValidationRules as l}from"../validate.js";function d({showPayButton:d,payButton:c,onChange:u,onSubmit:m}){const{i18n:p}=a(),{handleChangeFor:f,triggerValidation:b,data:h,valid:y,errors:g,isValid:F}=s({schema:["beneficiaryId"],rules:l});r(()=>{u({data:h,errors:g,valid:y,isValid:F},this)},[h,y,g,F]);const[I,v]=i("ready");return this.setStatus=v,this.showValidation=b,e(t,null,e("div",{className:"adyen-checkout__ancv"},e("p",{className:"adyen-checkout-form-instruction"},p.get("ancv.form.instruction")),e(n,{errorMessage:!!g.beneficiaryId&&p.get(g.beneficiaryId.errorMessage),label:p.get("ancv.input.label"),isValid:y.beneficiaryId,name:"beneficiaryId"},e(o,{value:h.beneficiaryId,name:"beneficiaryId",spellcheck:!0,required:!0,onInput:f("beneficiaryId","input"),onBlur:f("beneficiaryId","blur"),autocomplete:void 0})),d&&c({status:I,label:p.get("confirmPurchase"),onClick:m})))}d.defaultProps={};export{d as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useEffect as r,useState as a,useRef as t}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as i}from"../../../core/Context/CoreProvider.js";import o from"../../internal/LoadingWrapper/LoadingWrapper.js";import n from"../../internal/FormFields/InputText.js";import s from"../../internal/FormFields/Field/Field.js";import l from"../../../utils/useForm/useForm.js";import"../../internal/SecuredFields/lib/CSF/utils/userAgent.js";import{ancvValidationRules as c}from"../validate.js";function d({showPayButton:d,payButton:u,onChange:m,onSubmit:f,setComponentRef:p}){const{i18n:b}=i(),{handleChangeFor:y,triggerValidation:g,data:h,valid:F,errors:I,isValid:v}=l({schema:["beneficiaryId"],rules:c});r(()=>{m({data:h,errors:I,valid:F,isValid:v})},[m,h,F,I,v]);const[j,C]=a("ready"),k=t({setStatus:C,showValidation:g});return r(()=>{p(k.current)},[p,k.current]),e(o,null,e("div",{className:"adyen-checkout__ancv"},e("p",{className:"adyen-checkout-form-instruction"},b.get("ancv.form.instruction")),e(s,{errorMessage:!!I.beneficiaryId&&b.get(I.beneficiaryId.errorMessage),label:b.get("ancv.input.label"),isValid:F.beneficiaryId,name:"beneficiaryId"},e(n,{value:h.beneficiaryId,name:"beneficiaryId",spellcheck:!0,required:!0,onInput:y("beneficiaryId","input"),onBlur:y("beneficiaryId","blur"),autocomplete:void 0})),d&&u({status:j,label:b.get("confirmPurchase"),onClick:f})))}d.defaultProps={};export{d as default};
2
2
  //# sourceMappingURL=ANCVInput.js.map