@adyen/adyen-web 6.41.1 → 6.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/cjs/index.cjs +1 -1
  2. package/dist/cjs/index.cjs.map +1 -1
  3. package/dist/cjs/index.d.cts +15 -2
  4. package/dist/es/components/Dropin/components/DropinComponent.js +1 -1
  5. package/dist/es/components/Dropin/components/DropinComponent.js.map +1 -1
  6. package/dist/es/components/Dropin/utils/paymentMethodsAnalytics.js +2 -0
  7. package/dist/es/components/Dropin/utils/paymentMethodsAnalytics.js.map +1 -0
  8. package/dist/es/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
  9. package/dist/es/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
  10. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  11. package/dist/es/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  12. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  13. package/dist/es/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  14. package/dist/es/components/ThreeDS2/constants.js +1 -1
  15. package/dist/es/components/ThreeDS2/constants.js.map +1 -1
  16. package/dist/es/components/internal/Address/Address.js +1 -1
  17. package/dist/es/components/internal/Address/Address.js.map +1 -1
  18. package/dist/es/components/internal/Address/validate.formats.js.map +1 -1
  19. package/dist/es/components/internal/Address/validate.js +1 -1
  20. package/dist/es/components/internal/Address/validate.js.map +1 -1
  21. package/dist/es/components/internal/IFrame/Iframe.js +1 -1
  22. package/dist/es/components/internal/IFrame/Iframe.js.map +1 -1
  23. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  24. package/dist/es/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  25. package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
  26. package/dist/es/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  27. package/dist/es/core/config.js +1 -1
  28. package/dist/es/index.d.ts +15 -2
  29. package/dist/es-legacy/components/Dropin/components/DropinComponent.js +1 -1
  30. package/dist/es-legacy/components/Dropin/components/DropinComponent.js.map +1 -1
  31. package/dist/es-legacy/components/Dropin/utils/paymentMethodsAnalytics.js +2 -0
  32. package/dist/es-legacy/components/Dropin/utils/paymentMethodsAnalytics.js.map +1 -0
  33. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js +1 -1
  34. package/dist/es-legacy/components/ThreeDS2/callSubmit3DS2Fingerprint.js.map +1 -1
  35. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js +1 -1
  36. package/dist/es-legacy/components/ThreeDS2/components/Challenge/DoChallenge3DS2.js.map +1 -1
  37. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js +1 -1
  38. package/dist/es-legacy/components/ThreeDS2/components/Challenge/PrepareChallenge3DS2.js.map +1 -1
  39. package/dist/es-legacy/components/ThreeDS2/constants.js +1 -1
  40. package/dist/es-legacy/components/ThreeDS2/constants.js.map +1 -1
  41. package/dist/es-legacy/components/internal/Address/Address.js +1 -1
  42. package/dist/es-legacy/components/internal/Address/Address.js.map +1 -1
  43. package/dist/es-legacy/components/internal/Address/validate.formats.js.map +1 -1
  44. package/dist/es-legacy/components/internal/Address/validate.js +1 -1
  45. package/dist/es-legacy/components/internal/Address/validate.js.map +1 -1
  46. package/dist/es-legacy/components/internal/IFrame/Iframe.js +1 -1
  47. package/dist/es-legacy/components/internal/IFrame/Iframe.js.map +1 -1
  48. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js +1 -1
  49. package/dist/es-legacy/core/Analytics/events/AnalyticsInfoEvent.js.map +1 -1
  50. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js +1 -1
  51. package/dist/es-legacy/core/ProcessResponse/PaymentAction/actionTypes.js.map +1 -1
  52. package/dist/es-legacy/core/config.js +1 -1
  53. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"validate.formats.js","sources":["../../../../../src/components/internal/Address/validate.formats.ts"],"sourcesContent":["import { CountryFormatRules, FormatRules } from '../../../utils/Validator/types';\nimport { Formatter } from '../../../utils/useForm/types';\nimport { getFormattingRegEx, SPECIAL_CHARS } from '../../../utils/validator-utils';\n\nconst asCountryFormatRules = <T extends CountryFormatRules>(rules: T): T & CountryFormatRules => rules;\n\nconst createFormatByDigits = (digits: number): Formatter => {\n const format = new Array(digits).fill('9').join('');\n return {\n // Formatter - excludes non digits and limits to maxlength\n formatterFn: val => val.replace(getFormattingRegEx('^\\\\d', 'g'), '').substring(0, digits),\n format,\n maxlength: digits\n };\n};\n\nconst specialCharsRegEx = getFormattingRegEx(SPECIAL_CHARS);\nconst formattingFn = (val: string) => val.replace(specialCharsRegEx, '');\n\nexport const addressFormatters: FormatRules = {\n postalCode: {\n formatterFn: (val, context) => {\n const country = context.state.data.country;\n\n // Country specific formatting rule\n const specificRule = countrySpecificFormatters[country]?.postalCode.formatterFn;\n if (specificRule) {\n return specificRule(val);\n }\n\n // Default formatting rule: allow anything\n return val;\n }\n },\n street: {\n formatterFn: formattingFn\n },\n houseNumberOrName: {\n formatterFn: formattingFn\n },\n city: {\n formatterFn: formattingFn\n }\n};\n\n// TODO make proper formatter fns for those entries that don't just have a straightforward, x number of digits, no spaces, format\n// check against our internal documentation on address postal code\n// which, for example, says BR isn't just 8 digits (it can be spilt by a hyphen) & CZ can also be 5 digits, no spaces\nexport const countrySpecificFormatters = asCountryFormatRules({\n AT: {\n postalCode: createFormatByDigits(4)\n },\n AU: {\n postalCode: createFormatByDigits(4)\n },\n BE: {\n postalCode: createFormatByDigits(4)\n },\n BG: {\n postalCode: createFormatByDigits(4)\n },\n BR: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 9 : 8;\n return nuVal.substring(0, maxlength);\n },\n format: '12345678 or 12345-678',\n maxlength: 9\n }\n },\n CA: {\n postalCode: {\n format: 'A9A 9A9 or A9A9A9',\n maxlength: 7\n }\n },\n CH: {\n postalCode: createFormatByDigits(4)\n },\n CY: {\n postalCode: createFormatByDigits(4)\n },\n CZ: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n DE: {\n postalCode: createFormatByDigits(5)\n },\n DK: {\n postalCode: {\n format: '9999',\n maxlength: 7\n }\n },\n EE: {\n postalCode: createFormatByDigits(5)\n },\n ES: {\n postalCode: createFormatByDigits(5)\n },\n FI: {\n postalCode: createFormatByDigits(5)\n },\n FR: {\n postalCode: createFormatByDigits(5)\n },\n GB: {\n postalCode: {\n // Disallow special chars & set to maxlength\n formatterFn: val => val.replace(getFormattingRegEx(SPECIAL_CHARS), '').substring(0, 8),\n format: 'AA99 9AA or A99 9AA or A9 9AA',\n maxlength: 8\n }\n },\n GR: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n HR: {\n postalCode: {\n format: '[1-5]9999',\n maxlength: 5\n }\n },\n HU: {\n postalCode: createFormatByDigits(4)\n },\n IE: {\n postalCode: {\n format: 'A99 A999',\n maxlength: 8\n }\n },\n IS: {\n postalCode: createFormatByDigits(3)\n },\n IT: {\n postalCode: createFormatByDigits(5)\n },\n LI: {\n postalCode: createFormatByDigits(4)\n },\n LT: {\n postalCode: {\n format: '9999 or 99999 or LT-99999',\n maxlength: 8\n }\n },\n LU: {\n postalCode: createFormatByDigits(4)\n },\n LV: {\n postalCode: {\n format: '9999 or LV-9999',\n maxlength: 7\n }\n },\n MC: {\n postalCode: {\n format: '980NN',\n maxlength: 5\n }\n },\n MT: {\n postalCode: {\n format: 'AA99 or AAA99 or AA9999 or AAA9999',\n maxlength: 8\n }\n },\n MY: {\n postalCode: createFormatByDigits(5)\n },\n NL: {\n postalCode: {\n format: '9999AA',\n maxlength: 7\n }\n },\n NZ: {\n postalCode: createFormatByDigits(4)\n },\n NO: {\n postalCode: createFormatByDigits(4)\n },\n PL: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 6 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99-999',\n maxlength: 6\n }\n },\n PT: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n return nuVal.substring(0, 8);\n },\n format: '9999-999',\n maxlength: 8\n }\n },\n RO: {\n postalCode: createFormatByDigits(6)\n },\n SI: {\n postalCode: {\n format: '9999 or SI-9999',\n maxlength: 7\n }\n },\n SE: {\n postalCode: createFormatByDigits(5)\n },\n SG: {\n postalCode: createFormatByDigits(6)\n },\n SK: {\n postalCode: {\n format: '99999 or SK-99999',\n maxlength: 8\n }\n },\n JP: {\n postalCode: {\n format: '999-9999',\n maxlength: 8\n }\n },\n US: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 10 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99999-9999'\n }\n }\n});\n"],"names":["createFormatByDigits","digits","formatterFn","val","replace","getFormattingRegEx","substring","format","Array","fill","join","maxlength","specialCharsRegEx","SPECIAL_CHARS","formattingFn","addressFormatters","postalCode","context","countrySpecificFormatters","country","state","data","specificRule","street","houseNumberOrName","city","AT","AU","BE","BG","BR","nuVal","includes","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NZ","NO","PL","PT","RO","SI","SE","SG","SK","JP","US"],"mappings":"0FAIA,MAEMA,EAAwBC,IAEnB,CAEHC,Y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CC,UAAU,EAAG,GAE9BC,OAAQ,WACRI,UAAW,IAGnBmD,GAAI,CACA9C,WAAYhB,EAAqB,IAErC+D,GAAI,CACA/C,WAAY,CACRT,OAAQ,kBACRI,UAAW,IAGnBqD,GAAI,CACAhD,WAAYhB,EAAqB,IAErCiE,GAAI,CACAjD,WAAYhB,EAAqB,IAErCkE,GAAI,CACAlD,WAAY,CACRT,OAAQ,oBACRI,UAAW,IAGnBwD,GAAI,CACAnD,WAAY,CACRT,OAAQ,WACRI,UAAW,IAGnByD,GAAI,CACApD,WAAY,CACRd,YAAaC,IACT,MAAM4B,EAAQ5B,EAAIC,QAAQC,EAAmB,QAAS,KAAM,IACtDM,EAAYoB,EAAMC,SAAS,KAAO,GAAK,EAC7C,OAAOD,EAAMzB,UAAU,EAAGK,IAE9BJ,OAAQ"}
1
+ {"version":3,"file":"validate.formats.js","sources":["../../../../../src/components/internal/Address/validate.formats.ts"],"sourcesContent":["import { FormatterContext } from '../../../utils/Formatters/types';\nimport { CountryFormatRules, FormatRules } from '../../../utils/Validator/types';\nimport { Formatter } from '../../../utils/useForm/types';\nimport { getFormattingRegEx, SPECIAL_CHARS } from '../../../utils/validator-utils';\n\nconst asCountryFormatRules = <T extends CountryFormatRules>(rules: T): T & CountryFormatRules => rules;\n\nconst createFormatByDigits = (digits: number): Formatter => {\n const format = new Array(digits).fill('9').join('');\n return {\n // Formatter - excludes non digits and limits to maxlength\n formatterFn: val => val.replace(getFormattingRegEx('^\\\\d', 'g'), '').substring(0, digits),\n format,\n maxlength: digits\n };\n};\n\nconst specialCharsRegEx = getFormattingRegEx(SPECIAL_CHARS);\nconst formattingFn = (val: string) => val.replace(specialCharsRegEx, '');\n\nexport const addressFormatters: FormatRules = {\n postalCode: {\n formatterFn: (val: string, context: FormatterContext) => {\n const country = context.state.data.country;\n\n // Country specific formatting rule\n const specificRule = countrySpecificFormatters[country]?.postalCode.formatterFn;\n if (specificRule) {\n return specificRule(val);\n }\n\n // Default formatting rule: allow anything\n return val;\n }\n },\n street: {\n formatterFn: formattingFn\n },\n houseNumberOrName: {\n formatterFn: formattingFn\n },\n city: {\n formatterFn: formattingFn\n }\n};\n\n// TODO make proper formatter fns for those entries that don't just have a straightforward, x number of digits, no spaces, format\n// check against our internal documentation on address postal code\n// which, for example, says BR isn't just 8 digits (it can be spilt by a hyphen) & CZ can also be 5 digits, no spaces\nexport const countrySpecificFormatters = asCountryFormatRules({\n AT: {\n postalCode: createFormatByDigits(4)\n },\n AU: {\n postalCode: createFormatByDigits(4)\n },\n BE: {\n postalCode: createFormatByDigits(4)\n },\n BG: {\n postalCode: createFormatByDigits(4)\n },\n BR: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 9 : 8;\n return nuVal.substring(0, maxlength);\n },\n format: '12345678 or 12345-678',\n maxlength: 9\n }\n },\n CA: {\n postalCode: {\n format: 'A9A 9A9 or A9A9A9',\n maxlength: 7\n }\n },\n CH: {\n postalCode: createFormatByDigits(4)\n },\n CY: {\n postalCode: createFormatByDigits(4)\n },\n CZ: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n DE: {\n postalCode: createFormatByDigits(5)\n },\n DK: {\n postalCode: {\n format: '9999',\n maxlength: 7\n }\n },\n EE: {\n postalCode: createFormatByDigits(5)\n },\n ES: {\n postalCode: createFormatByDigits(5)\n },\n FI: {\n postalCode: createFormatByDigits(5)\n },\n FR: {\n postalCode: createFormatByDigits(5)\n },\n GB: {\n postalCode: {\n // Disallow special chars & set to maxlength\n formatterFn: val => val.replace(getFormattingRegEx(SPECIAL_CHARS), '').substring(0, 8),\n format: 'AA99 9AA or A99 9AA or A9 9AA',\n maxlength: 8\n }\n },\n GR: {\n postalCode: {\n format: '999 99',\n maxlength: 6\n }\n },\n HR: {\n postalCode: {\n format: '[1-5]9999',\n maxlength: 5\n }\n },\n HU: {\n postalCode: createFormatByDigits(4)\n },\n IE: {\n postalCode: {\n format: 'A99 A999',\n maxlength: 8\n }\n },\n IS: {\n postalCode: createFormatByDigits(3)\n },\n IT: {\n postalCode: createFormatByDigits(5)\n },\n LI: {\n postalCode: createFormatByDigits(4)\n },\n LT: {\n postalCode: {\n format: '9999 or 99999 or LT-99999',\n maxlength: 8\n }\n },\n LU: {\n postalCode: createFormatByDigits(4)\n },\n LV: {\n postalCode: {\n format: '9999 or LV-9999',\n maxlength: 7\n }\n },\n MC: {\n postalCode: {\n format: '980NN',\n maxlength: 5\n }\n },\n MT: {\n postalCode: {\n format: 'AA99 or AAA99 or AA9999 or AAA9999',\n maxlength: 8\n }\n },\n MY: {\n postalCode: createFormatByDigits(5)\n },\n NL: {\n postalCode: {\n format: '9999AA',\n maxlength: 7\n }\n },\n NZ: {\n postalCode: createFormatByDigits(4)\n },\n NO: {\n postalCode: createFormatByDigits(4)\n },\n PL: {\n postalCode: {\n // Formatter - excludes non digits, but allows hyphens, and limits to a maxlength that varies depending on whether a hyphen is present or not\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 6 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99-999',\n maxlength: 6\n }\n },\n PT: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n return nuVal.substring(0, 8);\n },\n format: '9999-999',\n maxlength: 8\n }\n },\n RO: {\n postalCode: createFormatByDigits(6)\n },\n SI: {\n postalCode: {\n format: '9999 or SI-9999',\n maxlength: 7\n }\n },\n SE: {\n postalCode: createFormatByDigits(5)\n },\n SG: {\n postalCode: createFormatByDigits(6)\n },\n SK: {\n postalCode: {\n format: '99999 or SK-99999',\n maxlength: 8\n }\n },\n JP: {\n postalCode: {\n format: '999-9999',\n maxlength: 8\n }\n },\n US: {\n postalCode: {\n formatterFn: val => {\n const nuVal = val.replace(getFormattingRegEx('^\\\\d-', 'g'), '');\n const maxlength = nuVal.includes('-') ? 10 : 5;\n return nuVal.substring(0, maxlength);\n },\n format: '99999 or 99999-9999'\n }\n }\n});\n"],"names":["createFormatByDigits","digits","formatterFn","val","replace","getFormattingRegEx","substring","format","Array","fill","join","maxlength","specialCharsRegEx","SPECIAL_CHARS","formattingFn","addressFormatters","postalCode","context","countrySpecificFormatters","country","state","data","specificRule","street","houseNumberOrName","city","AT","AU","BE","BG","BR","nuVal","includes","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NZ","NO","PL","PT","RO","SI","SE","SG","SK","JP","US"],"mappings":"0FAKA,MAEMA,EAAwBC,IAEnB,CAEHC,YAAaC,GAAOA,EAAIC,QAAQC,EAAmB,OAAQ,KAAM,IAAIC,UAAU,EAAGL,GAClFM,OAJW,IAAIC,MAAMP,GAAQQ,KAAK,KAAKC,KAAK,IAK5CC,UAAWV,IAIbW,EAAoBP,EAAmBQ,GACvCC,EAAgBX,GAAgBA,EAAIC,QAAQQ,EAAmB,IAExDG,EAAiC,CAC1CC,WAAY,CACRd,YAAa,CAACC,EAAac,KAIFC,IAAAA,EAHrB,MAAMC,EAAUF,EAAQG,MAAMC,KAAKF,QAG7BG,UAAeJ,EAAAA,EAA0BC,UAA1BD,IAAAA,OAAAA,EAAAA,EAAoCF,WAAWd,YACpE,OAAIoB,EACOA,EAAanB,GAIjBA,IAGfoB,OAAQ,CACJrB,YAAaY,GAEjBU,kBAAmB,CACftB,YAAaY,GAEjBW,KAAM,CACFvB,YAAaY,IAORI,EAAiD,CAC1DQ,GAAI,CACAV,WAAYhB,EAAqB,IAErC2B,GAAI,CACAX,WAAYhB,EAAqB,IAErC4B,GAAI,CACAZ,WAAYhB,EAAqB,IAErC6B,GAAI,CACAb,WAAYhB,EAAqB,IAErC8B,GAAI,CACAd,WAAY,CAERd,YAAaC,IACT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AI,CACAvC,WAAY,CACRT,OAAQ,qCACRI,UAAW,IAGnB6C,GAAI,CACAxC,WAAYhB,EAAqB,IAErCyD,GAAI,CACAzC,WAAY,CACRT,OAAQ,SACRI,UAAW,IAGnB+C,GAAI,CACA1C,WAAYhB,EAAqB,IAErC2D,GAAI,CACA3C,WAAYhB,EAAqB,IAErC4D,GAAI,CACA5C,WAAY,CAERd,YAAaC,IACT,MAAM4B,EAAQ5B,EAAIC,QAAQC,EAAmB,QAAS,KAAM,IACtDM,EAAYoB,EAAMC,SAAS,KAAO,EAAI,EAC5C,OAAOD,EAAMzB,UAAU,EAAGK,IAE9BJ,OAAQ,kBACRI,UAAW,IAGnBkD,GAAI,CACA7C,WAAY,CACRd,YAAaC,GACKA,EAAIC,QAAQC,EAAmB,QAAS,KAAM,IAC/CC,UAAU,EAAG,GAE9BC,OAAQ,WACRI,UAAW,IAGnBmD,GAAI,CACA9C,WAAYhB,EAAqB,IAErC+D,GAAI,CACA/C,WAAY,CACRT,OAAQ,kBACRI,UAAW,IAGnBqD,GAAI,CACAhD,WAAYhB,EAAqB,IAErCiE,GAAI,CACAjD,WAAYhB,EAAqB,IAErCkE,GAAI,CACAlD,WAAY,CACRT,OAAQ,oBACRI,UAAW,IAGnBwD,GAAI,CACAnD,WAAY,CACRT,OAAQ,WACRI,UAAW,IAGnByD,GAAI,CACApD,WAAY,CACRd,YAAaC,IACT,MAAM4B,EAAQ5B,EAAIC,QAAQC,EAAmB,QAAS,KAAM,IACtDM,EAAYoB,EAAMC,SAAS,KAAO,GAAK,EAC7C,OAAOD,EAAMzB,UAAU,EAAGK,IAE9BJ,OAAQ"}
@@ -1,2 +1,2 @@
1
- import{countrySpecificFormatters as t}from"./validate.formats.js";import{ERROR_FIELD_REQUIRED as r,ERROR_INVALID_FORMAT_EXPECTS as e}from"../../../core/Errors/constants.js";import{isEmpty as a}from"../../../utils/validator-utils.js";const n=t=>({pattern:new RegExp(`\\d{${t}}`)}),o=(r,n,o)=>{if(n){var s,l;if(a(r))return null;o.postalCode.errorMessage={translationKey:e,translationObject:{values:{format:(null===(s=t[n])||void 0===s?void 0:s.postalCode.format)||null}}};const u=null===(l=d[n])||void 0===l?void 0:l.pattern;return u?u.test(r):!!r}return!a(r)||null},d={AT:n(4),AU:n(4),BE:{pattern:/(?:(?:[1-9])(?:\d{3}))/},BG:n(4),BR:{pattern:/^\d{5}-?\d{3}$/},CA:{pattern:/(?:[ABCEGHJ-NPRSTVXY]\d[A-Z][ -]?\d[A-Z]\d)/},CH:{pattern:/[1-9]\d{3}/},CY:n(4),CZ:{pattern:/\d{3}\s?\d{2}/},DE:n(5),DK:n(4),EE:n(5),ES:{pattern:/(?:0[1-9]|[1-4]\d|5[0-2])\d{3}/},FI:n(5),FR:n(5),GB:{pattern:/^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/},GE:n(4),GR:{pattern:/^\d{3}\s{0,1}\d{2}$/},HR:{pattern:/^([1-5])[0-9]{4}$/},HU:n(4),IE:{pattern:/(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/},IS:n(3),IT:n(5),LI:n(4),LT:{pattern:/^(LT-\d{5}|\d{4,5})$/},LU:n(4),LV:{pattern:/^(LV-)[0-9]{4}$/},MC:{pattern:/^980\d{2}$/},MT:{pattern:/^[A-Za-z]{3}\d{4}$/},MY:n(5),NL:{pattern:/(?:NL-)?(?:[1-9]\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/},NO:n(4),PL:{pattern:/^\d{2}[-]{0,1}\d{3}$/},PT:{pattern:/^([1-9]\d{3})([- ]?(\d{3})? *)$/},RO:n(6),SI:n(4),SE:n(5),SG:n(6),SK:n(5),US:n(5)},s=t=>{const e={postalCode:{modes:["blur"],validate:r=>o(r,t,e),errorMessage:r}};return e},l=t=>{const e={postalCode:{modes:["blur"],validate:(t,r)=>{const a=r.state.data.country;return o(t,a,e)},errorMessage:r},houseNumberOrName:{validate:(r,e)=>{var n,o;const d=null===(o=e.state)||void 0===o||null===(n=o.data)||void 0===n?void 0:n.country;return d&&t.countryHasOptionalField(d,"houseNumberOrName")||!a(r)||null},modes:["blur"],errorMessage:r},default:{validate:t=>!a(t)||null,modes:["blur"],errorMessage:r}};return e};export{l as getAddressValidationRules,s as getPartialAddressValidationRules,o as validatePostalCode};
1
+ import{countrySpecificFormatters as t}from"./validate.formats.js";import{ERROR_FIELD_REQUIRED as r,ERROR_INVALID_FORMAT_EXPECTS as e}from"../../../core/Errors/constants.js";import{isEmpty as a}from"../../../utils/validator-utils.js";const n=t=>({pattern:new RegExp(`\\d{${t}}`)}),o=(r,n,o)=>{if(n){var s,l;if(a(r))return null;o.postalCode.errorMessage={translationKey:e,translationObject:{values:{format:(null===(s=t[n])||void 0===s?void 0:s.postalCode.format)||null}}};const u=null===(l=d[n])||void 0===l?void 0:l.pattern;return u?u.test(r):!!r}return!a(r)||null},d={AT:n(4),AU:n(4),BE:{pattern:/(?:(?:[1-9])(?:\d{3}))/},BG:n(4),BR:{pattern:/^\d{5}-?\d{3}$/},CA:{pattern:/(?:[ABCEGHJ-NPRSTVXY]\d[A-Z][ -]?\d[A-Z]\d)/},CH:{pattern:/[1-9]\d{3}/},CY:n(4),CZ:{pattern:/\d{3}\s?\d{2}/},DE:n(5),DK:n(4),EE:n(5),ES:{pattern:/(?:0[1-9]|[1-4]\d|5[0-2])\d{3}/},FI:n(5),FR:n(5),GB:{pattern:/^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/},GE:n(4),GR:{pattern:/^\d{3}\s{0,1}\d{2}$/},HR:{pattern:/^([1-5])[0-9]{4}$/},HU:n(4),IE:{pattern:/(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/},IS:n(3),IT:n(5),LI:n(4),LT:{pattern:/^(LT-\d{5}|\d{4,5})$/},LU:n(4),LV:{pattern:/^(LV-)[0-9]{4}$/},MC:{pattern:/^980\d{2}$/},MT:{pattern:/^[A-Za-z]{3}\d{4}$/},MY:n(5),NL:{pattern:/(?:NL-)?(?:[1-9]\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/},NO:n(4),PL:{pattern:/^\d{2}[-]{0,1}\d{3}$/},PT:{pattern:/^([1-9]\d{3})([- ]?(\d{3})? *)$/},RO:n(6),SI:n(4),SE:n(5),SG:n(6),SK:n(5),US:{pattern:/^\d{5}(?:-\d{4})?$/}},s=t=>{const e={postalCode:{modes:["blur"],validate:r=>o(r,t,e),errorMessage:r}};return e},l=t=>{const e={postalCode:{modes:["blur"],validate:(t,r)=>{const a=r.state.data.country;return o(t,a,e)},errorMessage:r},houseNumberOrName:{validate:(r,e)=>{var n,o;const d=null===(o=e.state)||void 0===o||null===(n=o.data)||void 0===n?void 0:n.country;return d&&t.countryHasOptionalField(d,"houseNumberOrName")||!a(r)||null},modes:["blur"],errorMessage:r},default:{validate:t=>!a(t)||null,modes:["blur"],errorMessage:r}};return e};export{l as getAddressValidationRules,s as getPartialAddressValidationRules,o as validatePostalCode};
2
2
  //# sourceMappingURL=validate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.js","sources":["../../../../../src/components/internal/Address/validate.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule } from '../../../utils/Validator/types';\nimport { countrySpecificFormatters } from './validate.formats';\nimport { ERROR_FIELD_REQUIRED, ERROR_INVALID_FORMAT_EXPECTS } from '../../../core/Errors/constants';\nimport { isEmpty } from '../../../utils/validator-utils';\n\nconst createPatternByDigits = (digits: number) => {\n return {\n pattern: new RegExp(`\\\\d{${digits}}`)\n };\n};\n\nexport const validatePostalCode = (val: string, countryCode: string, validatorRules: ValidatorRules) => {\n if (countryCode) {\n // If there is no value, we display the 'required' error message\n if (isEmpty(val)) return null;\n\n // Dynamically create errorMessage\n (validatorRules.postalCode as ValidatorRule).errorMessage = {\n translationKey: ERROR_INVALID_FORMAT_EXPECTS,\n translationObject: {\n values: {\n format: countrySpecificFormatters[countryCode]?.postalCode.format || null\n }\n }\n };\n\n const pattern = postalCodePatterns[countryCode]?.pattern;\n return pattern ? pattern.test(val) : !!val; // No pattern? Accept any, filled, value.\n }\n // Default rule\n return isEmpty(val) ? null : true;\n};\n\nconst postalCodePatterns = {\n AT: createPatternByDigits(4),\n AU: createPatternByDigits(4),\n BE: { pattern: /(?:(?:[1-9])(?:\\d{3}))/ },\n BG: createPatternByDigits(4),\n BR: { pattern: /^\\d{5}-?\\d{3}$/ },\n CA: { pattern: /(?:[ABCEGHJ-NPRSTVXY]\\d[A-Z][ -]?\\d[A-Z]\\d)/ },\n CH: { pattern: /[1-9]\\d{3}/ },\n CY: createPatternByDigits(4),\n CZ: { pattern: /\\d{3}\\s?\\d{2}/ },\n DE: createPatternByDigits(5),\n DK: createPatternByDigits(4),\n EE: createPatternByDigits(5),\n ES: { pattern: /(?:0[1-9]|[1-4]\\d|5[0-2])\\d{3}/ },\n FI: createPatternByDigits(5),\n FR: createPatternByDigits(5),\n GB: { pattern: /^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/ },\n GE: createPatternByDigits(4),\n GR: { pattern: /^\\d{3}\\s{0,1}\\d{2}$/ },\n HR: { pattern: /^([1-5])[0-9]{4}$/ },\n HU: createPatternByDigits(4),\n IE: { pattern: /(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/ },\n IS: createPatternByDigits(3),\n IT: createPatternByDigits(5),\n LI: createPatternByDigits(4),\n LT: { pattern: /^(LT-\\d{5}|\\d{4,5})$/ },\n LU: createPatternByDigits(4),\n LV: { pattern: /^(LV-)[0-9]{4}$/ },\n MC: { pattern: /^980\\d{2}$/ },\n MT: { pattern: /^[A-Za-z]{3}\\d{4}$/ },\n MY: createPatternByDigits(5),\n NL: { pattern: /(?:NL-)?(?:[1-9]\\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/ },\n NO: createPatternByDigits(4),\n PL: { pattern: /^\\d{2}[-]{0,1}\\d{3}$/ },\n PT: { pattern: /^([1-9]\\d{3})([- ]?(\\d{3})? *)$/ },\n RO: createPatternByDigits(6),\n SI: createPatternByDigits(4),\n SE: createPatternByDigits(5),\n SG: createPatternByDigits(6),\n SK: createPatternByDigits(5),\n US: createPatternByDigits(5)\n};\n\n/**\n * Validates only postalCode property. As the partial address form does not have the country selector, the country value\n * must be informed beforehand and can't be picked up from the form context\n *\n * @param country - Country that will be used to validate postal code\n */\nexport const getPartialAddressValidationRules = (country: string): ValidatorRules => {\n const validationRules: ValidatorRules = {\n postalCode: {\n modes: ['blur'],\n validate: val => {\n return validatePostalCode(val, country, validationRules);\n },\n errorMessage: ERROR_FIELD_REQUIRED\n }\n };\n return validationRules;\n};\n\nexport const getAddressValidationRules = (specifications): ValidatorRules => {\n const addressValidationRules: ValidatorRules = {\n postalCode: {\n modes: ['blur'],\n validate: (val, context) => {\n const country = context.state.data.country;\n return validatePostalCode(val, country, addressValidationRules);\n },\n errorMessage: ERROR_FIELD_REQUIRED\n },\n houseNumberOrName: {\n validate: (value, context) => {\n const selectedCountry = context.state?.data?.country;\n const isOptional = selectedCountry && specifications.countryHasOptionalField(selectedCountry, 'houseNumberOrName');\n return isOptional || (isEmpty(value) ? null : true);\n },\n modes: ['blur'],\n errorMessage: ERROR_FIELD_REQUIRED\n },\n default: {\n validate: value => (isEmpty(value) ? null : true), // true, if there are chars other than spaces\n modes: ['blur'],\n errorMessage: ERROR_FIELD_REQUIRED\n }\n };\n return addressValidationRules;\n};\n"],"names":["createPatternByDigits","digits","pattern","RegExp","validatePostalCode","val","countryCode","validatorRules","countrySpecificFormatters","postalCodePatterns","isEmpty","postalCode","errorMessage","translationKey","ERROR_INVALID_FORMAT_EXPECTS","translationObject","values","format","test","AT","AU","BE","BG","BR","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GE","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NO","PL","PT","RO","SI","SE","SG","SK","US","getPartialAddressValidationRules","country","validationRules","modes","validate","ERROR_FIELD_REQUIRED","getAddressValidationRules","specifications","addressValidationRules","context","state","data","houseNumberOrName","value","selectedCountry","countryHasOptionalField","default"],"mappings":"yOAKA,MAAMA,EAAyBC,IACpB,CACHC,QAAS,IAAIC,OAAO,OAAOF,QAItBG,EAAqB,CAACC,EAAaC,EAAqBC,KACjE,GAAID,EAAa,KASOE,EAKJC,EAZhB,GAAIC,EAAQL,GAAM,OAAO,KAGxBE,EAAeI,WAA6BC,aAAe,CACxDC,eAAgBC,EAChBC,kBAAmB,CACfC,OAAQ,CACJC,QAA8C,QAAtCT,EAAAA,EAA0BF,UAA1BE,IAAAA,OAAAA,EAAAA,EAAwCG,WAAWM,SAAU,QAKjF,MAAMf,EAAyC,QAA/BO,EAAAA,EAAmBH,UAAnBG,IAAAA,OAAAA,EAAAA,EAAiCP,QACjD,OAAOA,EAAUA,EAAQgB,KAAKb,KAASA,CAC3C,CAEA,OAAOK,EAAQL,IAAO,MAGpBI,EAAqB,CACvBU,GAAInB,EAAsB,GAC1BoB,GAAIpB,EAAsB,GAC1BqB,GAAI,CAAEnB,QAAS,0BACfoB,GAAItB,EAAsB,GAC1BuB,GAAI,CAAErB,QAAS,kBACfsB,GAAI,CAAEtB,QAAS,+CACfuB,GAAI,CAAEvB,QAAS,cACfwB,GAAI1B,EAAsB,GAC1B2B,GAAI,CAAEzB,QAAS,iBACf0B,GAAI5B,EAAsB,GAC1B6B,GAAI7B,EAA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AnBA,EAAAA,EAAeE,gBAAfF,OAAAA,EAAAA,EAAqBR,QAE7C,OADmBa,GAAmBP,EAAeQ,wBAAwBD,EAAiB,uBACxE/D,EAAQ8D,IAAS,MAE3CV,MAAO,CAAC,QACRlD,aAAcoD,GAElBW,QAAS,CACLZ,SAAUS,IAAU9D,EAAQ8D,IAAS,KACrCV,MAAO,CAAC,QACRlD,aAAcoD,IAGtB,OAAOG"}
1
+ {"version":3,"file":"validate.js","sources":["../../../../../src/components/internal/Address/validate.ts"],"sourcesContent":["import { ValidatorRules, ValidatorRule } from '../../../utils/Validator/types';\nimport { countrySpecificFormatters } from './validate.formats';\nimport { ERROR_FIELD_REQUIRED, ERROR_INVALID_FORMAT_EXPECTS } from '../../../core/Errors/constants';\nimport { isEmpty } from '../../../utils/validator-utils';\n\nconst createPatternByDigits = (digits: number) => {\n return {\n pattern: new RegExp(`\\\\d{${digits}}`)\n };\n};\n\nexport const validatePostalCode = (val: string, countryCode: string, validatorRules: ValidatorRules) => {\n if (countryCode) {\n // If there is no value, we display the 'required' error message\n if (isEmpty(val)) return null;\n\n // Dynamically create errorMessage\n (validatorRules.postalCode as ValidatorRule).errorMessage = {\n translationKey: ERROR_INVALID_FORMAT_EXPECTS,\n translationObject: {\n values: {\n format: countrySpecificFormatters[countryCode]?.postalCode.format || null\n }\n }\n };\n\n const pattern = postalCodePatterns[countryCode]?.pattern;\n return pattern ? pattern.test(val) : !!val; // No pattern? Accept any, filled, value.\n }\n // Default rule\n return isEmpty(val) ? null : true;\n};\n\nconst postalCodePatterns = {\n AT: createPatternByDigits(4),\n AU: createPatternByDigits(4),\n BE: { pattern: /(?:(?:[1-9])(?:\\d{3}))/ },\n BG: createPatternByDigits(4),\n BR: { pattern: /^\\d{5}-?\\d{3}$/ },\n CA: { pattern: /(?:[ABCEGHJ-NPRSTVXY]\\d[A-Z][ -]?\\d[A-Z]\\d)/ },\n CH: { pattern: /[1-9]\\d{3}/ },\n CY: createPatternByDigits(4),\n CZ: { pattern: /\\d{3}\\s?\\d{2}/ },\n DE: createPatternByDigits(5),\n DK: createPatternByDigits(4),\n EE: createPatternByDigits(5),\n ES: { pattern: /(?:0[1-9]|[1-4]\\d|5[0-2])\\d{3}/ },\n FI: createPatternByDigits(5),\n FR: createPatternByDigits(5),\n GB: { pattern: /^([A-Za-z][A-Ha-hK-Yk-y]?[0-9][A-Za-z0-9]? ?[0-9][A-Za-z]{2}|[Gg][Ii][Rr] ?0[Aa]{2})$/ },\n GE: createPatternByDigits(4),\n GR: { pattern: /^\\d{3}\\s{0,1}\\d{2}$/ },\n HR: { pattern: /^([1-5])[0-9]{4}$/ },\n HU: createPatternByDigits(4),\n IE: { pattern: /(?:^[AC-FHKNPRTV-Y][0-9]{2}|D6W)[ -]?[0-9AC-FHKNPRTV-Y]{4}/ },\n IS: createPatternByDigits(3),\n IT: createPatternByDigits(5),\n LI: createPatternByDigits(4),\n LT: { pattern: /^(LT-\\d{5}|\\d{4,5})$/ },\n LU: createPatternByDigits(4),\n LV: { pattern: /^(LV-)[0-9]{4}$/ },\n MC: { pattern: /^980\\d{2}$/ },\n MT: { pattern: /^[A-Za-z]{3}\\d{4}$/ },\n MY: createPatternByDigits(5),\n NL: { pattern: /(?:NL-)?(?:[1-9]\\d{3} ?(?:[A-EGHJ-NPRTVWXZ][A-EGHJ-NPRSTVWXZ]|S[BCEGHJ-NPRTVWXZ]))/ },\n NO: createPatternByDigits(4),\n PL: { pattern: /^\\d{2}[-]{0,1}\\d{3}$/ },\n PT: { pattern: /^([1-9]\\d{3})([- ]?(\\d{3})? *)$/ },\n RO: createPatternByDigits(6),\n SI: createPatternByDigits(4),\n SE: createPatternByDigits(5),\n SG: createPatternByDigits(6),\n SK: createPatternByDigits(5),\n US: { pattern: /^\\d{5}(?:-\\d{4})?$/ }\n};\n\n/**\n * Validates only postalCode property. As the partial address form does not have the country selector, the country value\n * must be informed beforehand and can't be picked up from the form context\n *\n * @param country - Country that will be used to validate postal code\n */\nexport const getPartialAddressValidationRules = (country: string): ValidatorRules => {\n const validationRules: ValidatorRules = {\n postalCode: {\n modes: ['blur'],\n validate: val => {\n return validatePostalCode(val, country, validationRules);\n },\n errorMessage: ERROR_FIELD_REQUIRED\n }\n };\n return validationRules;\n};\n\nexport const getAddressValidationRules = (specifications): ValidatorRules => {\n const addressValidationRules: ValidatorRules = {\n postalCode: {\n modes: ['blur'],\n validate: (val, context) => {\n const country = context.state.data.country;\n return validatePostalCode(val, country, addressValidationRules);\n },\n errorMessage: ERROR_FIELD_REQUIRED\n },\n houseNumberOrName: {\n validate: (value, context) => {\n const selectedCountry = context.state?.data?.country;\n const isOptional = selectedCountry && specifications.countryHasOptionalField(selectedCountry, 'houseNumberOrName');\n return isOptional || (isEmpty(value) ? null : true);\n },\n modes: ['blur'],\n errorMessage: ERROR_FIELD_REQUIRED\n },\n default: {\n validate: value => (isEmpty(value) ? null : true), // true, if there are chars other than spaces\n modes: ['blur'],\n errorMessage: ERROR_FIELD_REQUIRED\n }\n };\n return addressValidationRules;\n};\n"],"names":["createPatternByDigits","digits","pattern","RegExp","validatePostalCode","val","countryCode","validatorRules","countrySpecificFormatters","postalCodePatterns","isEmpty","postalCode","errorMessage","translationKey","ERROR_INVALID_FORMAT_EXPECTS","translationObject","values","format","test","AT","AU","BE","BG","BR","CA","CH","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GE","GR","HR","HU","IE","IS","IT","LI","LT","LU","LV","MC","MT","MY","NL","NO","PL","PT","RO","SI","SE","SG","SK","US","getPartialAddressValidationRules","country","validationRules","modes","validate","ERROR_FIELD_REQUIRED","getAddressValidationRules","specifications","addressValidationRules","context","state","data","houseNumberOrName","value","selectedCountry","countryHasOptionalField","default"],"mappings":"yOAKA,MAAMA,EAAyBC,IACpB,CACHC,QAAS,IAAIC,OAAO,OAAOF,QAItBG,EAAqB,CAACC,EAAaC,EAAqBC,KACjE,GAAID,EAAa,KASOE,EAKJC,EAZhB,GAAIC,EAAQL,GAAM,OAAO,KAGxBE,EAAeI,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CACfmD,GAAIrD,EAAsB,GAC1BsD,GAAItD,EAAsB,GAC1BuD,GAAIvD,EAAsB,GAC1BwD,GAAIxD,EAAsB,GAC1ByD,GAAIzD,EAAsB,GAC1B0D,GAAI,CAAExD,QAAS,uBASNyD,EAAoCC,IAC7C,MAAMC,EAAkC,CACpClD,WAAY,CACRmD,MAAO,CAAC,QACRC,SAAU1D,GACCD,EAAmBC,EAAKuD,EAASC,GAE5CjD,aAAcoD,IAGtB,OAAOH,GAGEI,EAA6BC,IACtC,MAAMC,EAAyC,CAC3CxD,WAAY,CACRmD,MAAO,CAAC,QACRC,SAAU,CAAC1D,EAAK+D,KACZ,MAAMR,EAAUQ,EAAQC,MAAMC,KAAKV,QACnC,OAAOxD,EAAmBC,EAAKuD,EAASO,IAE5CvD,aAAcoD,GAElBO,kBAAmB,CACfR,SAAU,CAACS,EAAOJ,SACUA,EAAAA,EAAxB,MAAMK,EAA+B,QAAbL,EAAAA,EAAQC,iBAARD,GAAmB,QAAnBA,EAAAA,EAAeE,gBAAfF,OAAAA,EAAAA,EAAqBR,QAE7C,OADmBa,GAAmBP,EAAeQ,wBAAwBD,EAAiB,uBACxE/D,EAAQ8D,IAAS,MAE3CV,MAAO,CAAC,QACRlD,aAAcoD,GAElBW,QAAS,CACLZ,SAAUS,IAAU9D,EAAQ8D,IAAS,KACrCV,MAAO,CAAC,QACRlD,aAAcoD,IAGtB,OAAOG"}
@@ -1,2 +1,2 @@
1
- import{Component as e,createElement as i}from"../../../external/preact/dist/preact.js";import t from"../../../_virtual/index.js";function a(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}class n extends e{iframeOnLoad(){this.props.callback&&"function"==typeof this.props.callback&&this.props.callback(this.iframeEl.contentWindow)}componentDidMount(){this.iframeEl.addEventListener?this.iframeEl.addEventListener("load",this.iframeOnLoad.bind(this),!1):this.iframeEl.attachEvent?this.iframeEl.attachEvent("onload",this.iframeOnLoad.bind(this)):this.iframeEl.onload=this.iframeOnLoad.bind(this)}componentWillUnmount(){this.iframeEl.removeEventListener?this.iframeEl.removeEventListener("load",this.iframeOnLoad.bind(this),!1):this.iframeEl.detachEvent?this.iframeEl.detachEvent("onload",this.iframeOnLoad.bind(this)):this.iframeEl.onload=null}render({name:e,src:a,width:n,height:r,minWidth:o,minHeight:l,allow:s,title:h,classNameModifiers:m}){const d=m.filter(e=>!!e);return i("iframe",{ref:e=>{this.iframeEl=e},allow:s,className:t("adyen-checkout__iframe",`adyen-checkout__iframe--${e}`,d.length&&m.map(i=>`adyen-checkout__iframe--${e}-${i}`)),name:e,src:a,width:n,height:r,frameBorder:"0",title:h,referrerpolicy:"origin","min-width":o,"min-height":l})}constructor(...e){super(...e),a(this,"iframeEl",void 0)}}a(n,"defaultProps",{width:"0",height:"0",minWidth:"0",minHeight:"0",src:null,allow:null,title:"components iframe",classNameModifiers:[]});export{n as default};
1
+ import{Component as e,createElement as i}from"../../../external/preact/dist/preact.js";import t from"../../../_virtual/index.js";function a(e,i,t){return i in e?Object.defineProperty(e,i,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[i]=t,e}class n extends e{iframeOnLoad(){this.props.callback&&"function"==typeof this.props.callback&&this.props.callback(this.iframeEl.contentWindow)}componentDidMount(){this.iframeEl.addEventListener?this.iframeEl.addEventListener("load",this.iframeOnLoad.bind(this),!1):this.iframeEl.attachEvent?this.iframeEl.attachEvent("onload",this.iframeOnLoad.bind(this)):this.iframeEl.onload=this.iframeOnLoad.bind(this)}componentWillUnmount(){this.iframeEl.removeEventListener?this.iframeEl.removeEventListener("load",this.iframeOnLoad.bind(this),!1):this.iframeEl.detachEvent?this.iframeEl.detachEvent("onload",this.iframeOnLoad.bind(this)):this.iframeEl.onload=null}render({name:e,src:a,width:n,height:r,minWidth:o,minHeight:s,allow:l,title:h,sandbox:m,classNameModifiers:d}){const f=d.filter(e=>!!e);return i("iframe",{ref:e=>{this.iframeEl=e},allow:l,className:t("adyen-checkout__iframe",`adyen-checkout__iframe--${e}`,f.length&&d.map(i=>`adyen-checkout__iframe--${e}-${i}`)),name:e,src:a,width:n,height:r,frameBorder:"0",title:h,referrerpolicy:"origin","min-width":o,"min-height":s,sandbox:m})}constructor(...e){super(...e),a(this,"iframeEl",void 0)}}a(n,"defaultProps",{width:"0",height:"0",minWidth:"0",minHeight:"0",src:null,allow:null,title:"components iframe",classNameModifiers:[]});export{n as default};
2
2
  //# sourceMappingURL=Iframe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Iframe.js","sources":["../../../../../src/components/internal/IFrame/Iframe.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport './Iframe.scss';\n\ninterface IframeProps {\n width?: string;\n height?: string;\n minWidth?: string;\n minHeight?: string;\n border?: string;\n src?: string;\n allow?: string;\n name?: string;\n title?: string;\n classNameModifiers?: string[];\n callback?: (contentWindow) => void;\n}\n\nclass Iframe extends Component<Readonly<IframeProps>> {\n public static readonly defaultProps = {\n width: '0',\n height: '0',\n minWidth: '0',\n minHeight: '0',\n src: null,\n allow: null,\n title: 'components iframe',\n classNameModifiers: []\n };\n\n private iframeEl;\n\n iframeOnLoad() {\n if (this.props.callback && typeof this.props.callback === 'function') {\n this.props.callback(this.iframeEl.contentWindow);\n }\n }\n\n componentDidMount() {\n if (this.iframeEl.addEventListener) {\n this.iframeEl.addEventListener('load', this.iframeOnLoad.bind(this), false);\n } else if (this.iframeEl.attachEvent) {\n // IE fallback\n this.iframeEl.attachEvent('onload', this.iframeOnLoad.bind(this));\n } else {\n this.iframeEl.onload = this.iframeOnLoad.bind(this);\n }\n }\n\n componentWillUnmount() {\n if (this.iframeEl.removeEventListener) {\n this.iframeEl.removeEventListener('load', this.iframeOnLoad.bind(this), false);\n } else if (this.iframeEl.detachEvent) {\n // IE fallback\n this.iframeEl.detachEvent('onload', this.iframeOnLoad.bind(this));\n } else {\n this.iframeEl.onload = null;\n }\n }\n\n render({ name, src, width, height, minWidth, minHeight, allow, title, classNameModifiers }: IframeProps) {\n const validClassNameModifiers = classNameModifiers.filter(m => !!m);\n\n return (\n <iframe\n ref={ref => {\n this.iframeEl = ref;\n }}\n allow={allow}\n className={classNames(\n 'adyen-checkout__iframe',\n `adyen-checkout__iframe--${name}`,\n validClassNameModifiers.length && classNameModifiers.map(m => `adyen-checkout__iframe--${name}-${m}`)\n )}\n name={name}\n src={src}\n width={width}\n height={height}\n frameBorder=\"0\"\n title={title}\n /* eslint-disable react/no-unknown-property */\n referrerpolicy=\"origin\"\n min-width={minWidth}\n min-height={minHeight}\n /* eslint-enable react/no-unknown-property */\n />\n );\n }\n}\n\nexport default Iframe;\n"],"names":["Iframe","Component","iframeOnLoad","this","props","callback","iframeEl","contentWindow","componentDidMount","addEventListener","bind","attachEvent","onload","componentWillUnmount","removeEventListener","detachEvent","render","name","src","width","height","minWidth","minHeight","allow","title","classNameModifiers","validClassNameModifiers","filter","m","h","iframe","ref","className","classNames","length","map","frameBorder","referrerpolicy","min-width","min-height","super","args","_define_property","defaultProps"],"mappings":"yPAkBA,MAAMA,UAAeC,EAcjBC,YAAAA,GACQC,KAAKC,MAAMC,UAA2C,mBAAxBF,KAAKC,MAAMC,UACzCF,KAAKC,MAAMC,SAASF,KAAKG,SAASC,cAE1C,CAEAC,iBAAAA,GACQL,KAAKG,SAASG,iBACdN,KAAKG,SAASG,iBAAiB,OAAQN,KAAKD,aAAaQ,KAAKP,OAAO,GAC9DA,KAAKG,SAASK,YAErBR,KAAKG,SAASK,YAAY,SAAUR,KAAKD,aAAaQ,KAAKP,OAE3DA,KAAKG,SAASM,OAAST,KAAKD,aAAaQ,KAAKP,KAEtD,CAEAU,oBAAAA,GACQV,KAAKG,SAASQ,oBACdX,KAAKG,SAASQ,oBAAoB,OAAQX,KAAKD,aAAaQ,KAAKP,OAAO,GACjEA,KAAKG,SAASS,YAErBZ,KAAKG,SAASS,YAAY,SAAUZ,KAAKD,aAAaQ,KAAKP,OAE3DA,KAAKG,SAASM,OAAS,IAE/B,CAEAI,MAAAA,EAAOC,KAAEA,EAAIC,IAAEA,EAAGC,MAAEA,EAAKC,OAAEA,EAAMC,SAAEA,EAAQC,UAAEA,EAASC,MAAEA,EAAKC,MAAEA,EAAKC,mBAAEA,IAClE,MAAMC,EAA0BD,EAAmBE,OAAOC,KAAOA,GAEjE,OACIC,EAACC,SAAAA,CACGC,IAAKA,IACD5B,KAAKG,SAAWyB,GAEpBR,MAAOA,EACPS,UAAWC,EACP,yBACA,2BAA2BhB,IAC3BS,EAAwBQ,QAAUT,EAAmBU,IAAIP,GAAK,2BAA2BX,KAAQW,MAErGX,KAAMA,EACNC,IAAKA,EACLC,MAAOA,EACPC,OAAQA,EACRgB,YAAY,IACZZ,MAAOA,EAEPa,eAAe,SACfC,YAAWjB,EACXkB,aAAYjB,GAIxB,mBArEJkB,SAAAC,GAYIC,EAAAvC,KAAQG,oBAXRoC,EADE1C,EACqB2C,eAAe,CAClCxB,MAAO,IACPC,OAAQ,IACRC,SAAU,IACVC,UAAW,IACXJ,IAAK,KACLK,MAAO,KACPC,MAAO,oBACPC,mBAAoB"}
1
+ {"version":3,"file":"Iframe.js","sources":["../../../../../src/components/internal/IFrame/Iframe.tsx"],"sourcesContent":["import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport './Iframe.scss';\n\ninterface IframeProps {\n width?: string;\n height?: string;\n minWidth?: string;\n minHeight?: string;\n border?: string;\n src?: string;\n allow?: string;\n name?: string;\n title?: string;\n sandbox?: string;\n classNameModifiers?: string[];\n callback?: (contentWindow) => void;\n}\n\nclass Iframe extends Component<Readonly<IframeProps>> {\n public static readonly defaultProps = {\n width: '0',\n height: '0',\n minWidth: '0',\n minHeight: '0',\n src: null,\n allow: null,\n title: 'components iframe',\n classNameModifiers: []\n };\n\n private iframeEl;\n\n iframeOnLoad() {\n if (this.props.callback && typeof this.props.callback === 'function') {\n this.props.callback(this.iframeEl.contentWindow);\n }\n }\n\n componentDidMount() {\n if (this.iframeEl.addEventListener) {\n this.iframeEl.addEventListener('load', this.iframeOnLoad.bind(this), false);\n } else if (this.iframeEl.attachEvent) {\n // IE fallback\n this.iframeEl.attachEvent('onload', this.iframeOnLoad.bind(this));\n } else {\n this.iframeEl.onload = this.iframeOnLoad.bind(this);\n }\n }\n\n componentWillUnmount() {\n if (this.iframeEl.removeEventListener) {\n this.iframeEl.removeEventListener('load', this.iframeOnLoad.bind(this), false);\n } else if (this.iframeEl.detachEvent) {\n // IE fallback\n this.iframeEl.detachEvent('onload', this.iframeOnLoad.bind(this));\n } else {\n this.iframeEl.onload = null;\n }\n }\n\n render({ name, src, width, height, minWidth, minHeight, allow, title, sandbox, classNameModifiers }: IframeProps) {\n const validClassNameModifiers = classNameModifiers.filter(m => !!m);\n\n return (\n <iframe\n ref={ref => {\n this.iframeEl = ref;\n }}\n allow={allow}\n className={classNames(\n 'adyen-checkout__iframe',\n `adyen-checkout__iframe--${name}`,\n validClassNameModifiers.length && classNameModifiers.map(m => `adyen-checkout__iframe--${name}-${m}`)\n )}\n name={name}\n src={src}\n width={width}\n height={height}\n frameBorder=\"0\"\n title={title}\n /* eslint-disable react/no-unknown-property */\n referrerpolicy=\"origin\"\n min-width={minWidth}\n min-height={minHeight}\n sandbox={sandbox}\n /* eslint-enable react/no-unknown-property */\n />\n );\n }\n}\n\nexport default Iframe;\n"],"names":["Iframe","Component","iframeOnLoad","this","props","callback","iframeEl","contentWindow","componentDidMount","addEventListener","bind","attachEvent","onload","componentWillUnmount","removeEventListener","detachEvent","render","name","src","width","height","minWidth","minHeight","allow","title","sandbox","classNameModifiers","validClassNameModifiers","filter","m","h","iframe","ref","className","classNames","length","map","frameBorder","referrerpolicy","min-width","min-height","super","args","_define_property","defaultProps"],"mappings":"yPAmBA,MAAMA,UAAeC,EAcjBC,YAAAA,GACQC,KAAKC,MAAMC,UAA2C,mBAAxBF,KAAKC,MAAMC,UACzCF,KAAKC,MAAMC,SAASF,KAAKG,SAASC,cAE1C,CAEAC,iBAAAA,GACQL,KAAKG,SAASG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from"../utils.js";function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var r=function(e){return e.instantPaymentButton="instant_payment_button",e.dualBrandButton="dual_brand_button",e.fastlaneSignupConsentToggle="fastlane_signup_consent_toggle",e.otherPaymentMethodButton="otherpaymentmethod_button",e.featuredIssuer="featured_issuer",e.list="list",e.listSearch="list_search",e.qrDownloadButton="qr_download_button",e.segmentedControl="segmented_control",e.cardNumber="card_number",e.expiryDate="expiry_date",e.expiryMonth="expiry_month",e.expiryYear="expiry_year",e.securityCode="security_code",e.donationAmountButton="donation_amount_button",e}({}),d=function(e){return e.clicked="clicked",e.rendered="rendered",e.selected="selected",e.validationError="validationError",e.focus="focus",e.unfocus="unfocus",e.configured="configured",e.displayed="displayed",e.input="input",e.download="download",e.sdkDownloadInitiated="sdkDownloadInitiated",e.sdkDownloadFailed="sdkDownloadFailed",e.sdkDownloadAborted="sdkDownloadAborted",e.sdkDownloadCompleted="sdkDownloadCompleted",e.Initialized="initialized",e.LookupStarted="lookupStarted",e.LookupUserNotFound="lookupUserNotFound",e.OtpStarted="otpStarted",e.OtpSucceeded="otpSucceeded",e.OtpCanceled="otpCanceled",e.OtpFailed="otpFailed",e.AddressSelectorClicked="addressSelectorClicked",e.AddressSelectorClosed="addressSelectorClosed",e.AddressChanged="addressChanged",e}({});class s extends e{get configDataExcludedFields(){return["paymentMethodsConfiguration","elementRef","isDropin","oneClick","storedPaymentMethodId","paymentMethodId","isInstantPayment","type","data","holderName","shopperEmail","email","telephoneNumber","clickToPayConfiguration","modules","i18n"]}createAnalyticsConfigData(e){if(!e)return{};const t={};try{for(const[o,i]of Object.entries(e))this.configDataExcludedFields.includes(o)||("function"==typeof i?t[o]="function":Array.isArray(i)?t[o]=i.join(", ").substring(0,128):t[o]="object"==typeof i&&null!==i?JSON.stringify(i).substring(0,128):i);return t}catch(e){return t}}getEventCategory(){return t.info}constructor(e){super(e.component),i(this,"type",void 0),i(this,"configData",void 0),i(this,"target",void 0),i(this,"issuer",void 0),i(this,"isExpress",void 0),i(this,"expressPage",void 0),i(this,"isStoredPaymentMethod",void 0),i(this,"brand",void 0),i(this,"selectedValue",void 0),i(this,"validationErrorCode",void 0),i(this,"validationErrorMessage",void 0),i(this,"presentedValues",void 0),i(this,"cdnUrl",void 0),this.type=e.type,e.target&&(this.target=e.target),e.issuer&&(this.issuer=e.issuer),void 0!==e.isStoredPaymentMethod&&(this.isStoredPaymentMethod=e.isStoredPaymentMethod),void 0!==e.isExpress&&(this.isExpress=e.isExpress),e.expressPage&&(this.expressPage=e.expressPage),e.brand&&(this.brand=e.brand),e.cdnUrl&&(this.cdnUrl=e.cdnUrl),e.selectedValue&&(this.selectedValue=e.selectedValue),e.validationErrorCode&&(this.validationErrorCode=e.validationErrorCode),e.validationErrorMessage&&(this.validationErrorMessage=e.validationErrorMessage),e.presentedValues&&(this.presentedValues=e.presentedValues),"rendered"===this.type&&(this.configData=this.createAnalyticsConfigData(null==e?void 0:e.configData)),"validationError"===this.type&&(this.validationErrorCode=o(this.validationErrorCode,this.target))}}export{s as AnalyticsInfoEvent,d as InfoEventType,r as UiTarget};
1
+ import{AbstractAnalyticsEvent as e,AnalyticsEventCategory as t}from"./AbstractAnalyticsEvent.js";import{mapErrorCodesForAnalytics as o}from"../utils.js";function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var a=function(e){return e.instantPaymentButton="instant_payment_button",e.dualBrandButton="dual_brand_button",e.fastlaneSignupConsentToggle="fastlane_signup_consent_toggle",e.otherPaymentMethodButton="otherpaymentmethod_button",e.featuredIssuer="featured_issuer",e.list="list",e.listSearch="list_search",e.qrDownloadButton="qr_download_button",e.segmentedControl="segmented_control",e.cardNumber="card_number",e.expiryDate="expiry_date",e.expiryMonth="expiry_month",e.expiryYear="expiry_year",e.securityCode="security_code",e.donationAmountButton="donation_amount_button",e}({}),d=function(e){return e.clicked="clicked",e.rendered="rendered",e.selected="selected",e.validationError="validationError",e.focus="focus",e.unfocus="unfocus",e.configured="configured",e.displayed="displayed",e.input="input",e.download="download",e.sdkDownloadInitiated="sdkDownloadInitiated",e.sdkDownloadFailed="sdkDownloadFailed",e.sdkDownloadAborted="sdkDownloadAborted",e.sdkDownloadCompleted="sdkDownloadCompleted",e.Initialized="initialized",e.LookupStarted="lookupStarted",e.LookupUserNotFound="lookupUserNotFound",e.OtpStarted="otpStarted",e.OtpSucceeded="otpSucceeded",e.OtpCanceled="otpCanceled",e.OtpFailed="otpFailed",e.AddressSelectorClicked="addressSelectorClicked",e.AddressSelectorClosed="addressSelectorClosed",e.AddressChanged="addressChanged",e.PaymentListDisplayed="paymentListDisplayed",e}({});class s extends e{get configDataExcludedFields(){return["paymentMethodsConfiguration","elementRef","isDropin","oneClick","storedPaymentMethodId","paymentMethodId","isInstantPayment","type","data","holderName","shopperEmail","email","telephoneNumber","clickToPayConfiguration","modules","i18n"]}createAnalyticsConfigData(e){if(!e)return{};const t={};try{for(const[o,i]of Object.entries(e))this.configDataExcludedFields.includes(o)||("function"==typeof i?t[o]="function":Array.isArray(i)?t[o]=i.join(", ").substring(0,128):t[o]="object"==typeof i&&null!==i?JSON.stringify(i).substring(0,128):i);return t}catch(e){return t}}getEventCategory(){return t.info}constructor(e){super(e.component),i(this,"type",void 0),i(this,"configData",void 0),i(this,"target",void 0),i(this,"issuer",void 0),i(this,"isExpress",void 0),i(this,"expressPage",void 0),i(this,"isStoredPaymentMethod",void 0),i(this,"brand",void 0),i(this,"selectedValue",void 0),i(this,"validationErrorCode",void 0),i(this,"validationErrorMessage",void 0),i(this,"presentedValues",void 0),i(this,"availablePaymentMethods",void 0),i(this,"unavailablePaymentMethods",void 0),i(this,"cdnUrl",void 0),this.type=e.type,e.target&&(this.target=e.target),e.issuer&&(this.issuer=e.issuer),void 0!==e.isStoredPaymentMethod&&(this.isStoredPaymentMethod=e.isStoredPaymentMethod),void 0!==e.isExpress&&(this.isExpress=e.isExpress),e.expressPage&&(this.expressPage=e.expressPage),e.brand&&(this.brand=e.brand),e.cdnUrl&&(this.cdnUrl=e.cdnUrl),e.selectedValue&&(this.selectedValue=e.selectedValue),e.validationErrorCode&&(this.validationErrorCode=e.validationErrorCode),e.validationErrorMessage&&(this.validationErrorMessage=e.validationErrorMessage),e.presentedValues&&(this.presentedValues=e.presentedValues),e.availablePaymentMethods&&(this.availablePaymentMethods=e.availablePaymentMethods),e.unavailablePaymentMethods&&(this.unavailablePaymentMethods=e.unavailablePaymentMethods),"rendered"===this.type&&(this.configData=this.createAnalyticsConfigData(null==e?void 0:e.configData)),"validationError"===this.type&&(this.validationErrorCode=o(this.validationErrorCode,this.target))}}export{s as AnalyticsInfoEvent,d as InfoEventType,a as UiTarget};
2
2
  //# sourceMappingURL=AnalyticsInfoEvent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsInfoEvent.js","sources":["../../../../../src/core/Analytics/events/AnalyticsInfoEvent.ts"],"sourcesContent":["import { AbstractAnalyticsEvent, AnalyticsEventCategory } from './AbstractAnalyticsEvent';\nimport { mapErrorCodesForAnalytics } from '../utils';\n\ntype AnalyticsInfoEventProps = {\n type: InfoEventType;\n component: string;\n target?: UiTarget;\n issuer?: string;\n isExpress?: boolean;\n expressPage?: string;\n isStoredPaymentMethod?: boolean;\n brand?: string;\n validationErrorCode?: string;\n validationErrorMessage?: string;\n configData?: Record<string, any>;\n cdnUrl?: string;\n selectedValue?: string;\n presentedValues?: Array<string>;\n};\n\nexport enum UiTarget {\n instantPaymentButton = 'instant_payment_button',\n dualBrandButton = 'dual_brand_button',\n fastlaneSignupConsentToggle = 'fastlane_signup_consent_toggle',\n otherPaymentMethodButton = 'otherpaymentmethod_button',\n featuredIssuer = 'featured_issuer',\n list = 'list',\n listSearch = 'list_search',\n qrDownloadButton = 'qr_download_button',\n segmentedControl = 'segmented_control',\n cardNumber = 'card_number',\n expiryDate = 'expiry_date',\n expiryMonth = 'expiry_month',\n expiryYear = 'expiry_year',\n securityCode = 'security_code',\n donationAmountButton = 'donation_amount_button'\n}\n\nexport enum InfoEventType {\n /** When a UI element is clicked */\n clicked = 'clicked',\n /** When a component is rendered in the browser (e.g. render() method is called) */\n rendered = 'rendered',\n /** When a list item is selected (e.g. issuer list) */\n selected = 'selected',\n /** When there is a validation issue with the input */\n validationError = 'validationError',\n /** When input gets focus */\n focus = 'focus',\n /** When input gets unfocus */\n unfocus = 'unfocus',\n /** When iframe fields are configured */\n configured = 'configured',\n /** When a dropdown list is displayed */\n displayed = 'displayed',\n /** When shopper utilizes an input field to search for values (e.g. issuer list) */\n input = 'input',\n /** When shopper clicks to download the image (e.g. QR code image) */\n download = 'download',\n sdkDownloadInitiated = 'sdkDownloadInitiated',\n sdkDownloadFailed = 'sdkDownloadFailed',\n sdkDownloadAborted = 'sdkDownloadAborted',\n sdkDownloadCompleted = 'sdkDownloadCompleted',\n Initialized = 'initialized',\n LookupStarted = 'lookupStarted',\n LookupUserNotFound = 'lookupUserNotFound',\n OtpStarted = 'otpStarted',\n OtpSucceeded = 'otpSucceeded',\n OtpCanceled = 'otpCanceled',\n OtpFailed = 'otpFailed',\n AddressSelectorClicked = 'addressSelectorClicked',\n AddressSelectorClosed = 'addressSelectorClosed',\n AddressChanged = 'addressChanged'\n}\n\nexport class AnalyticsInfoEvent extends AbstractAnalyticsEvent {\n /**\n * Analytics event type\n */\n private readonly type: InfoEventType;\n\n /**\n * Component config data set by the merchant. Sent only in 'rendered' events\n * @private\n */\n private readonly configData?: Record<string, string | boolean>;\n private readonly target?: UiTarget;\n private readonly issuer?: string;\n private readonly isExpress?: boolean;\n private readonly expressPage?: string;\n private readonly isStoredPaymentMethod?: boolean;\n private readonly brand?: string;\n private readonly selectedValue?: string;\n private readonly validationErrorCode?: string;\n private readonly validationErrorMessage?: string;\n private readonly presentedValues?: string[];\n\n /**\n * Third party script URL's (e.g. Apple Pay)\n */\n public cdnUrl?: string;\n\n constructor(props: AnalyticsInfoEventProps) {\n super(props.component);\n\n this.type = props.type;\n\n if (props.target) this.target = props.target;\n if (props.issuer) this.issuer = props.issuer;\n if (props.isStoredPaymentMethod !== undefined) this.isStoredPaymentMethod = props.isStoredPaymentMethod;\n if (props.isExpress !== undefined) this.isExpress = props.isExpress;\n if (props.expressPage) this.expressPage = props.expressPage;\n if (props.brand) this.brand = props.brand;\n if (props.cdnUrl) this.cdnUrl = props.cdnUrl;\n if (props.selectedValue) this.selectedValue = props.selectedValue;\n if (props.validationErrorCode) this.validationErrorCode = props.validationErrorCode;\n if (props.validationErrorMessage) this.validationErrorMessage = props.validationErrorMessage;\n if (props.presentedValues) this.presentedValues = props.presentedValues;\n if (this.type === InfoEventType.rendered) {\n this.configData = this.createAnalyticsConfigData(props?.configData);\n }\n\n // Some of the more generic validation error codes required combination with target to retrieve a specific code\n if (this.type === InfoEventType.validationError) {\n this.validationErrorCode = mapErrorCodesForAnalytics(this.validationErrorCode, this.target);\n }\n }\n\n /**\n * Set of properties that must not be included when creating the configData for Analytics\n * @private\n */\n private get configDataExcludedFields() {\n const DROPIN_FIELDS = ['paymentMethodsConfiguration'];\n const FIELDS_INJECTED_BY_DROPIN = [\n 'elementRef',\n 'isDropin',\n 'oneClick',\n 'storedPaymentMethodId',\n 'paymentMethodId',\n 'isInstantPayment',\n 'type'\n ];\n const PII_FIELDS = ['data', 'holderName', 'shopperEmail', 'email', 'telephoneNumber', 'clickToPayConfiguration'];\n\n /**\n * TODO: Many unit tests are passing 'modules' as props, which leads to circular structure issue\n * The components must use the 'modules' from the core and not from the props\n */\n const UNIT_TEST_FIELDS = ['modules', 'i18n'];\n\n return [...DROPIN_FIELDS, ...FIELDS_INJECTED_BY_DROPIN, ...PII_FIELDS, ...UNIT_TEST_FIELDS];\n }\n\n /**\n * Creates a serializable analytics payload from the given config object.\n * Functions are replaced with 'function', and objects/arrays are stringified.\n */\n private createAnalyticsConfigData(config: Record<string, any>) {\n if (!config) return {};\n\n const MAX_STRING_LENGTH = 128;\n const result: Record<string, string> = {};\n\n try {\n for (const [key, value] of Object.entries(config)) {\n if (!this.configDataExcludedFields.includes(key)) {\n if (typeof value === 'function') {\n result[key] = 'function';\n } else if (Array.isArray(value)) {\n result[key] = value.join(', ').substring(0, MAX_STRING_LENGTH);\n } else if (typeof value === 'object' && value !== null) {\n result[key] = JSON.stringify(value).substring(0, MAX_STRING_LENGTH);\n } else {\n result[key] = value;\n }\n }\n }\n\n return result;\n } catch (error: unknown) {\n if (process.env.NODE_ENV === 'development') console.warn('AnalyticsInfoEvent: Error when creating configData\\n', error);\n return result;\n }\n }\n\n public getEventCategory(): AnalyticsEventCategory {\n return AnalyticsEventCategory.info;\n }\n}\n"],"names":["UiTarget","InfoEventType","AnalyticsInfoEvent","AbstractAnalyticsEvent","configDataExcludedFields","createAnalyticsConfigData","config","result","key","value","Object","entries","this","includes","Array","isArray","join","substring","JSON","stringify","error","getEventCategory","AnalyticsEventCategory","info","constructor","props","super","component","_define_property","type","configData","target","issuer","isExpress","expressPage","isStoredPaymentMethod","brand","selectedValue","validationErrorCode","validationErrorMessage","presentedValues","cdnUrl","undefined","mapErrorCodesForAnalytics"],"mappings":"iRAoBO,IAAAA,EAAKA,SAAAA,GAAAA,2iBAAAA,CAgBZ,CAhBYA,CAgBZ,CAAA,GAEOC,EAAKA,SAAAA,GAAAA,OACyBA,EAAA,QAAA,UAEgDA,EAAA,SAAA,WAE7BA,EAAA,SAAA,WAEAA,EAAA,gBAAA,kBAE1BA,EAAA,MAAA,QAEEA,EAAA,QAAA,UAEUA,EAAA,WAAA,aAEAA,EAAA,UAAA,YAE2CA,EAAA,MAAA,QAEdA,EAAA,SAAA,+gBAnB3DA,CAmCZ,CAnCYA,CAmCZ,CAAA,GAEO,MAAMC,UAA2BC,EAyDpC,4BAAYC,GAmBR,MAAO,CAlBgB,8BAEnB,aACA,WACA,WACA,wBACA,kBACA,mBACA,OAEgB,OAAQ,aAAc,eAAgB,QAAS,kBAAmB,0BAM5D,UAAW,OAGzC,CAMQC,yBAAAA,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EAAMgB,QAClChB,EAAMY,gBAAezB,KAAKyB,cAAgBZ,EAAMY,eAChDZ,EAAMa,sBAAqB1B,KAAK0B,oBAAsBb,EAAMa,qBAC5Db,EAAMc,yBAAwB3B,KAAK2B,uBAAyBd,EAAMc,wBAClEd,EAAMe,kBAAiB5B,KAAK4B,gBAAkBf,EAAMe,iBAC3C,aAAT5B,KAAKiB,OACLjB,KAAKkB,WAAalB,KAAKP,0BAA0BoB,eAAAA,EAAOK,aAI/C,oBAATlB,KAAKiB,OACLjB,KAAK0B,oBAAsBK,EAA0B/B,KAAK0B,oBAAqB1B,KAAKmB,QAE5F"}
1
+ {"version":3,"file":"AnalyticsInfoEvent.js","sources":["../../../../../src/core/Analytics/events/AnalyticsInfoEvent.ts"],"sourcesContent":["import { AbstractAnalyticsEvent, AnalyticsEventCategory } from './AbstractAnalyticsEvent';\nimport { mapErrorCodesForAnalytics } from '../utils';\n\nexport type AnalyticsPaymentMethod<DisplayMode extends string = string> = {\n paymentMethodType: string;\n brands?: string[];\n fundingSource?: 'debit' | 'credit' | 'prepaid';\n displayMode: DisplayMode;\n};\n\ntype AnalyticsInfoEventProps = {\n type: InfoEventType;\n component: string;\n target?: UiTarget;\n issuer?: string;\n isExpress?: boolean;\n expressPage?: string;\n isStoredPaymentMethod?: boolean;\n brand?: string;\n validationErrorCode?: string;\n validationErrorMessage?: string;\n configData?: Record<string, any>;\n cdnUrl?: string;\n selectedValue?: string;\n presentedValues?: Array<string>;\n availablePaymentMethods?: AnalyticsPaymentMethod[];\n unavailablePaymentMethods?: AnalyticsPaymentMethod[];\n};\n\nexport enum UiTarget {\n instantPaymentButton = 'instant_payment_button',\n dualBrandButton = 'dual_brand_button',\n fastlaneSignupConsentToggle = 'fastlane_signup_consent_toggle',\n otherPaymentMethodButton = 'otherpaymentmethod_button',\n featuredIssuer = 'featured_issuer',\n list = 'list',\n listSearch = 'list_search',\n qrDownloadButton = 'qr_download_button',\n segmentedControl = 'segmented_control',\n cardNumber = 'card_number',\n expiryDate = 'expiry_date',\n expiryMonth = 'expiry_month',\n expiryYear = 'expiry_year',\n securityCode = 'security_code',\n donationAmountButton = 'donation_amount_button'\n}\n\nexport enum InfoEventType {\n /** When a UI element is clicked */\n clicked = 'clicked',\n /** When a component is rendered in the browser (e.g. render() method is called) */\n rendered = 'rendered',\n /** When a list item is selected (e.g. issuer list) */\n selected = 'selected',\n /** When there is a validation issue with the input */\n validationError = 'validationError',\n /** When input gets focus */\n focus = 'focus',\n /** When input gets unfocus */\n unfocus = 'unfocus',\n /** When iframe fields are configured */\n configured = 'configured',\n /** When a dropdown list is displayed */\n displayed = 'displayed',\n /** When shopper utilizes an input field to search for values (e.g. issuer list) */\n input = 'input',\n /** When shopper clicks to download the image (e.g. QR code image) */\n download = 'download',\n sdkDownloadInitiated = 'sdkDownloadInitiated',\n sdkDownloadFailed = 'sdkDownloadFailed',\n sdkDownloadAborted = 'sdkDownloadAborted',\n sdkDownloadCompleted = 'sdkDownloadCompleted',\n Initialized = 'initialized',\n LookupStarted = 'lookupStarted',\n LookupUserNotFound = 'lookupUserNotFound',\n OtpStarted = 'otpStarted',\n OtpSucceeded = 'otpSucceeded',\n OtpCanceled = 'otpCanceled',\n OtpFailed = 'otpFailed',\n AddressSelectorClicked = 'addressSelectorClicked',\n AddressSelectorClosed = 'addressSelectorClosed',\n AddressChanged = 'addressChanged',\n PaymentListDisplayed = 'paymentListDisplayed'\n}\n\nexport class AnalyticsInfoEvent extends AbstractAnalyticsEvent {\n /**\n * Analytics event type\n */\n private readonly type: InfoEventType;\n\n /**\n * Component config data set by the merchant. Sent only in 'rendered' events\n * @private\n */\n private readonly configData?: Record<string, string | boolean>;\n private readonly target?: UiTarget;\n private readonly issuer?: string;\n private readonly isExpress?: boolean;\n private readonly expressPage?: string;\n private readonly isStoredPaymentMethod?: boolean;\n private readonly brand?: string;\n private readonly selectedValue?: string;\n private readonly validationErrorCode?: string;\n private readonly validationErrorMessage?: string;\n private readonly presentedValues?: string[];\n private readonly availablePaymentMethods?: AnalyticsPaymentMethod[];\n private readonly unavailablePaymentMethods?: AnalyticsPaymentMethod[];\n\n /**\n * Third party script URL's (e.g. Apple Pay)\n */\n public cdnUrl?: string;\n\n constructor(props: AnalyticsInfoEventProps) {\n super(props.component);\n\n this.type = props.type;\n\n if (props.target) this.target = props.target;\n if (props.issuer) this.issuer = props.issuer;\n if (props.isStoredPaymentMethod !== undefined) this.isStoredPaymentMethod = props.isStoredPaymentMethod;\n if (props.isExpress !== undefined) this.isExpress = props.isExpress;\n if (props.expressPage) this.expressPage = props.expressPage;\n if (props.brand) this.brand = props.brand;\n if (props.cdnUrl) this.cdnUrl = props.cdnUrl;\n if (props.selectedValue) this.selectedValue = props.selectedValue;\n if (props.validationErrorCode) this.validationErrorCode = props.validationErrorCode;\n if (props.validationErrorMessage) this.validationErrorMessage = props.validationErrorMessage;\n if (props.presentedValues) this.presentedValues = props.presentedValues;\n if (props.availablePaymentMethods) this.availablePaymentMethods = props.availablePaymentMethods;\n if (props.unavailablePaymentMethods) this.unavailablePaymentMethods = props.unavailablePaymentMethods;\n if (this.type === InfoEventType.rendered) {\n this.configData = this.createAnalyticsConfigData(props?.configData);\n }\n\n // Some of the more generic validation error codes required combination with target to retrieve a specific code\n if (this.type === InfoEventType.validationError) {\n this.validationErrorCode = mapErrorCodesForAnalytics(this.validationErrorCode, this.target);\n }\n }\n\n /**\n * Set of properties that must not be included when creating the configData for Analytics\n * @private\n */\n private get configDataExcludedFields() {\n const DROPIN_FIELDS = ['paymentMethodsConfiguration'];\n const FIELDS_INJECTED_BY_DROPIN = [\n 'elementRef',\n 'isDropin',\n 'oneClick',\n 'storedPaymentMethodId',\n 'paymentMethodId',\n 'isInstantPayment',\n 'type'\n ];\n const PII_FIELDS = ['data', 'holderName', 'shopperEmail', 'email', 'telephoneNumber', 'clickToPayConfiguration'];\n\n /**\n * TODO: Many unit tests are passing 'modules' as props, which leads to circular structure issue\n * The components must use the 'modules' from the core and not from the props\n */\n const UNIT_TEST_FIELDS = ['modules', 'i18n'];\n\n return [...DROPIN_FIELDS, ...FIELDS_INJECTED_BY_DROPIN, ...PII_FIELDS, ...UNIT_TEST_FIELDS];\n }\n\n /**\n * Creates a serializable analytics payload from the given config object.\n * Functions are replaced with 'function', and objects/arrays are stringified.\n */\n private createAnalyticsConfigData(config: Record<string, any>) {\n if (!config) return {};\n\n const MAX_STRING_LENGTH = 128;\n const result: Record<string, string> = {};\n\n try {\n for (const [key, value] of Object.entries(config)) {\n if (!this.configDataExcludedFields.includes(key)) {\n if (typeof value === 'function') {\n result[key] = 'function';\n } else if (Array.isArray(value)) {\n result[key] = value.join(', ').substring(0, MAX_STRING_LENGTH);\n } else if (typeof value === 'object' && value !== null) {\n result[key] = JSON.stringify(value).substring(0, MAX_STRING_LENGTH);\n } else {\n result[key] = value;\n }\n }\n }\n\n return result;\n } catch (error: unknown) {\n if (process.env.NODE_ENV === 'development') console.warn('AnalyticsInfoEvent: Error when creating configData\\n', error);\n return result;\n }\n }\n\n public getEventCategory(): AnalyticsEventCategory {\n return AnalyticsEventCategory.info;\n }\n}\n"],"names":["UiTarget","InfoEventType","AnalyticsInfoEvent","AbstractAnalyticsEvent","configDataExcludedFields","createAnalyticsConfigData","config","result","key","value","Object","entries","this","includes","Array","isArray","join","substring","JSON","stringify","error","getEventCategory","AnalyticsEventCategory","info","constructor","props","super","component","_define_property","type","configData","target","issuer","isExpress","expressPage","isStoredPaymentMethod","brand","selectedValue","validationErrorCode","validationErrorMessage","presentedValues","availablePaymentMethods","unavailablePaymentMethods","cdnUrl","undefined","mapErrorCodesForAnalytics"],"mappings":"iRA6BO,IAAAA,EAAKA,SAAAA,GAAAA,2iBAAAA,CAgBZ,CAhBYA,CAgBZ,CAAA,GAEOC,EAAKA,SAAAA,GAAAA,OACyBA,EAAA,QAAA,UAEgDA,EAAA,SAAA,WAE7BA,EAAA,SAAA,WAEAA,EAAA,gBAAA,kBAE1BA,EAAA,MAAA,QAEEA,EAAA,QAAA,UAEUA,EA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AKH/B,KAAKiB,KAAOJ,EAAMI,KAEdJ,EAAMM,SAAQnB,KAAKmB,OAASN,EAAMM,QAClCN,EAAMO,SAAQpB,KAAKoB,OAASP,EAAMO,aACFY,IAAhCnB,EAAMU,wBAAqCvB,KAAKuB,sBAAwBV,EAAMU,4BAC1DS,IAApBnB,EAAMQ,YAAyBrB,KAAKqB,UAAYR,EAAMQ,WACtDR,EAAMS,cAAatB,KAAKsB,YAAcT,EAAMS,aAC5CT,EAAMW,QAAOxB,KAAKwB,MAAQX,EAAMW,OAChCX,EAAMkB,SAAQ/B,KAAK+B,OAASlB,EAAMkB,QAClClB,EAAMY,gBAAezB,KAAKyB,cAAgBZ,EAAMY,eAChDZ,EAAMa,sBAAqB1B,KAAK0B,oBAAsBb,EAAMa,qBAC5Db,EAAMc,yBAAwB3B,KAAK2B,uBAAyBd,EAAMc,wBAClEd,EAAMe,kBAAiB5B,KAAK4B,gBAAkBf,EAAMe,iBACpDf,EAAMgB,0BAAyB7B,KAAK6B,wBAA0BhB,EAAMgB,yBACpEhB,EAAMiB,4BAA2B9B,KAAK8B,0BAA4BjB,EAAMiB,2BAC/D,aAAT9B,KAAKiB,OACLjB,KAAKkB,WAAalB,KAAKP,0BAA0BoB,eAAAA,EAAOK,aAI/C,oBAATlB,KAAKiB,OACLjB,KAAK0B,oBAAsBO,EAA0BjC,KAAK0B,oBAAqB1B,KAAKmB,QAE5F"}
@@ -1,2 +1,2 @@
1
- import{get3DS2FlowProps as e}from"../../../components/ThreeDS2/components/utils.js";import t from"../../../utils/uuid.js";function o(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){o(e,t,r[t])})}return e}function n(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t.push.apply(t,o)}return t}(Object(t)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(t,o))}),e}const i=(e,o,i,c)=>{const s=o.getComponent(i);if(!s)throw Error(`Action Element of type ${i} not found in the registry`);return new s(e,n(r({},c),{id:`${i}-${t()}`}))},c=e=>(t,o,c,s)=>{const l=n(r({},s,c),{onError:s.onError,statusType:e,originalAction:c});return i(t,o,c.paymentMethodType,l)},s={redirect:(e,t,o,c)=>{const s=n(r({},c,o),{statusType:"redirect",originalAction:o});return i(e,t,"redirect",s)},threeDS2:(t,o,n,c)=>{var s,l;const a="fingerprint"===n.subtype?"threeDS2DeviceFingerprint":"threeDS2Challenge",u="fingerprint"===n.subtype||c.isMDFlow?n.paymentData:n.authorisationToken,p=r({core:t,token:n.token,paymentData:u,onActionHandled:c.onActionHandled,on3DS2RedirectFlowComplete:c.on3DS2RedirectFlowComplete,onAdditionalDetails:c.onAdditionalDetails,onError:c.onError,isDropin:!!c.isDropin,loadingContext:c.loadingContext,clientKey:c.clientKey,paymentMethodType:c.paymentMethodType,challengeWindowSize:c.challengeWindowSize,isMDFlow:c.isMDFlow,modules:{analytics:null===(s=c.modules)||void 0===s?void 0:s.analytics,resources:null===(l=c.modules)||void 0===l?void 0:l.resources}},e(n.subtype,c));return i(t,o,a,p)},voucher:c("custom"),qrCode:c("custom"),await:c("custom"),bankTransfer:c("custom"),sdk:c("custom")};export{s as default};
1
+ import{get3DS2FlowProps as e}from"../../../components/ThreeDS2/components/utils.js";import t from"../../../utils/uuid.js";function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))),n.forEach(function(t){r(e,t,o[t])})}return e}function n(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t}(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}const i=(e,r,i,s)=>{const c=r.getComponent(i);if(!c)throw Error(`Action Element of type ${i} not found in the registry`);return new c(e,n(o({},s),{id:`${i}-${t()}`}))},s=e=>(t,r,s,c)=>{const a=n(o({},c,s),{onError:c.onError,statusType:e,originalAction:s});return i(t,r,s.paymentMethodType,a)},c={redirect:(e,t,r,s)=>{const c=n(o({},s,r),{statusType:"redirect",originalAction:r});return i(e,t,"redirect",c)},threeDS2:(t,r,n,s)=>{var c,a;const l="fingerprint"===n.subtype?"threeDS2DeviceFingerprint":"threeDS2Challenge",u="fingerprint"===n.subtype||s.isMDFlow?n.paymentData:n.authorisationToken,p=o({core:t,token:n.token,paymentData:u,onActionHandled:s.onActionHandled,on3DS2RedirectFlowComplete:s.on3DS2RedirectFlowComplete,onAdditionalDetails:s.onAdditionalDetails,onError:s.onError,isDropin:!!s.isDropin,loadingContext:s.loadingContext,clientKey:s.clientKey,paymentMethodType:s.paymentMethodType,challengeWindowSize:s.challengeWindowSize,usePasskeyIFrameAttributes:s.usePasskeyIFrameAttributes,isMDFlow:s.isMDFlow,modules:{analytics:null===(c=s.modules)||void 0===c?void 0:c.analytics,resources:null===(a=s.modules)||void 0===a?void 0:a.resources}},e(n.subtype,s));return i(t,r,l,p)},voucher:s("custom"),qrCode:s("custom"),await:s("custom"),bankTransfer:s("custom"),sdk:s("custom")};export{c as default};
2
2
  //# sourceMappingURL=actionTypes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"actionTypes.js","sources":["../../../../../src/core/ProcessResponse/PaymentAction/actionTypes.ts"],"sourcesContent":["import { get3DS2FlowProps } from '../../../components/ThreeDS2/components/utils';\nimport uuid from '../../../utils/uuid';\nimport type { StatusFromAction, ThreeDS2ActionProps, UIElement, UIElementProps } from '../../../types';\nimport type { PaymentAction } from '../../../types/global-types';\nimport type { IRegistry } from '../../core.registry';\nimport type { ICore } from '../../types';\nimport type { ThreeDS2ConfigProps } from '../../../types';\nimport type { ActionHandlerConfig } from './types';\n\nconst createComponent = (core: ICore, registry: IRegistry, componentType: string, props: ActionHandlerConfig | ThreeDS2ConfigProps): UIElement => {\n const Element = registry.getComponent(componentType);\n\n if (!Element) {\n throw Error(`Action Element of type ${componentType} not found in the registry`);\n }\n\n const element = new Element(core, { ...props, id: `${componentType}-${uuid()}` });\n return element;\n};\n\nconst getActionHandler = (statusType: StatusFromAction) => {\n return (core: ICore, registry: IRegistry, action: PaymentAction, props: UIElementProps): UIElement => {\n const config: ActionHandlerConfig = {\n ...props,\n ...action,\n onError: props.onError,\n statusType,\n originalAction: action\n };\n\n return createComponent(core, registry, action.paymentMethodType, config);\n };\n};\n\nconst actionTypes = {\n redirect: (core: ICore, registry, action: PaymentAction, props: UIElementProps): UIElement => {\n const config: ActionHandlerConfig = {\n ...props,\n ...action,\n statusType: 'redirect',\n originalAction: action\n };\n\n return createComponent(core, registry, 'redirect', config);\n },\n\n threeDS2: (core: ICore, registry, action: PaymentAction, props: ThreeDS2ActionProps): UIElement => {\n const componentType = action.subtype === 'fingerprint' ? 'threeDS2DeviceFingerprint' : 'threeDS2Challenge';\n\n /**\n * NOTE: the isMDFlow prop comes from the options object, added within the MDFlow when it calls createFromAction(action, options) to initiate a 3DS2 component\n * It replaces the useOriginalFlow config prop that the MDFlow used to pass when directly initiating the threeDS2Fingerprint or threeDS2Challenge components\n */\n const paymentData = action.subtype === 'fingerprint' || props.isMDFlow ? action.paymentData : action.authorisationToken;\n\n const config: ThreeDS2ConfigProps = {\n // Props common to both flows\n core,\n token: action.token,\n paymentData,\n onActionHandled: props.onActionHandled,\n on3DS2RedirectFlowComplete: props.on3DS2RedirectFlowComplete, // NOTE: We only ever expect props.on3DS2RedirectFlowComplete to be defined for the MDFlow\n onAdditionalDetails: props.onAdditionalDetails, // Needed to prevent regression in v6.24.0 re. supporting onAdditionalDetails being directly set on Card component (in v7 we will *not* allow this, & this line can be removed)\n onError: props.onError,\n isDropin: !!props.isDropin,\n loadingContext: props.loadingContext,\n clientKey: props.clientKey,\n paymentMethodType: props.paymentMethodType,\n challengeWindowSize: props.challengeWindowSize, // always pass challengeWindowSize in case it's been set directly in the handleAction config object\n isMDFlow: props.isMDFlow,\n modules: {\n analytics: props.modules?.analytics,\n resources: props.modules?.resources\n },\n\n // Props unique to a particular flow\n ...get3DS2FlowProps(action.subtype, props)\n };\n\n return createComponent(core, registry, componentType, config);\n },\n\n voucher: getActionHandler('custom'),\n qrCode: getActionHandler('custom'),\n await: getActionHandler('custom'),\n bankTransfer: getActionHandler('custom'),\n sdk: getActionHandler('custom')\n} as const;\n\nexport default actionTypes;\n"],"names":["createComponent","core","registry","componentType","props","Element","getComponent","Error","_object_spread_props","_object_spread","id","uuid","getActionHandler","statusType","action","config","onError","originalAction","paymentMethodType","actionTypes","redirect","threeDS2","subtype","paymentData","isMDFlow","authorisationToken","token","onActionHandled","on3DS2RedirectFlowComplete","onAdditionalDetails","isDropin","loadingContext","clientKey","challengeWindowSize","modules","analytics","resources","get3DS2FlowProps","voucher","qrCode","await","bankTransfer","sdk"],"mappings":"m6BASA,MAAMA,EAAkB,CAACC,EAAaC,EAAqBC,EAAuBC,KAC9E,MAAMC,EAAUH,EAASI,aAAaH,GAEtC,IAAKE,EACD,MAAME,MAAM,0BAA0BJ,+BAI1C,OADgB,IAAIE,EAAQJ,EAAMO,EAAAC,EAAA,CAAA,EAAKL,GAAAA,CAAOM,GAAI,GAAGP,KAAiBQ,UAIpEC,EAAoB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1
+ {"version":3,"file":"actionTypes.js","sources":["../../../../../src/core/ProcessResponse/PaymentAction/actionTypes.ts"],"sourcesContent":["import { get3DS2FlowProps } from '../../../components/ThreeDS2/components/utils';\nimport uuid from '../../../utils/uuid';\nimport type { StatusFromAction, ThreeDS2ActionProps, UIElement, UIElementProps } from '../../../types';\nimport type { PaymentAction } from '../../../types/global-types';\nimport type { IRegistry } from '../../core.registry';\nimport type { ICore } from '../../types';\nimport type { ThreeDS2ConfigProps } from '../../../types';\nimport type { ActionHandlerConfig } from './types';\n\nconst createComponent = (core: ICore, registry: IRegistry, componentType: string, props: ActionHandlerConfig | ThreeDS2ConfigProps): UIElement => {\n const Element = registry.getComponent(componentType);\n\n if (!Element) {\n throw Error(`Action Element of type ${componentType} not found in the registry`);\n }\n\n const element = new Element(core, { ...props, id: `${componentType}-${uuid()}` });\n return element;\n};\n\nconst getActionHandler = (statusType: StatusFromAction) => {\n return (core: ICore, registry: IRegistry, action: PaymentAction, props: UIElementProps): UIElement => {\n const config: ActionHandlerConfig = {\n ...props,\n ...action,\n onError: props.onError,\n statusType,\n originalAction: action\n };\n\n return createComponent(core, registry, action.paymentMethodType, config);\n };\n};\n\nconst actionTypes = {\n redirect: (core: ICore, registry, action: PaymentAction, props: UIElementProps): UIElement => {\n const config: ActionHandlerConfig = {\n ...props,\n ...action,\n statusType: 'redirect',\n originalAction: action\n };\n\n return createComponent(core, registry, 'redirect', config);\n },\n\n threeDS2: (core: ICore, registry, action: PaymentAction, props: ThreeDS2ActionProps): UIElement => {\n const componentType = action.subtype === 'fingerprint' ? 'threeDS2DeviceFingerprint' : 'threeDS2Challenge';\n\n /**\n * NOTE: the isMDFlow prop comes from the options object, added within the MDFlow when it calls createFromAction(action, options) to initiate a 3DS2 component\n * It replaces the useOriginalFlow config prop that the MDFlow used to pass when directly initiating the threeDS2Fingerprint or threeDS2Challenge components\n */\n const paymentData = action.subtype === 'fingerprint' || props.isMDFlow ? action.paymentData : action.authorisationToken;\n\n const config: ThreeDS2ConfigProps = {\n // Props common to both flows\n core,\n token: action.token,\n paymentData,\n onActionHandled: props.onActionHandled,\n on3DS2RedirectFlowComplete: props.on3DS2RedirectFlowComplete, // NOTE: We only ever expect props.on3DS2RedirectFlowComplete to be defined for the MDFlow\n onAdditionalDetails: props.onAdditionalDetails, // Needed to prevent regression in v6.24.0 re. supporting onAdditionalDetails being directly set on Card component (in v7 we will *not* allow this, & this line can be removed)\n onError: props.onError,\n isDropin: !!props.isDropin,\n loadingContext: props.loadingContext,\n clientKey: props.clientKey,\n paymentMethodType: props.paymentMethodType,\n challengeWindowSize: props.challengeWindowSize, // always pass challengeWindowSize in case it's been set directly in the handleAction config object\n usePasskeyIFrameAttributes: props.usePasskeyIFrameAttributes,\n isMDFlow: props.isMDFlow,\n modules: {\n analytics: props.modules?.analytics,\n resources: props.modules?.resources\n },\n\n // Props unique to a particular flow\n ...get3DS2FlowProps(action.subtype, props)\n };\n\n return createComponent(core, registry, componentType, config);\n },\n\n voucher: getActionHandler('custom'),\n qrCode: getActionHandler('custom'),\n await: getActionHandler('custom'),\n bankTransfer: getActionHandler('custom'),\n sdk: getActionHandler('custom')\n} as const;\n\nexport default actionTypes;\n"],"names":["createComponent","core","registry","componentType","props","Element","getComponent","Error","_object_spread_props","_object_spread","id","uuid","getActionHandler","statusType","action","config","onError","originalAction","paymentMethodType","actionTypes","redirect","threeDS2","subtype","paymentData","isMDFlow","authorisationToken","token","onActionHandled","on3DS2RedirectFlowComplete","onAdditionalDetails","isDropin","loadingContext","clientKey","challengeWindowSize","usePasskeyIFrameAttributes","modules","analytics","resources","get3DS2FlowProps","voucher","qrCode","await","bankTransfer","sdk"],"mappings":"m6BASA,MAAMA,EAAkB,CAACC,EAAaC,EAAqBC,EAAuBC,KAC9E,MAAMC,EAAUH,EAASI,aAAaH,GAEtC,IAAKE,EACD,MAAME,MAAM,0BAA0BJ,+BAI1C,OADgB,IAAIE,EAAQJ,EAAMO,EAAAC,EAAA,CAAA,EAAKL,GAAAA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zB6B,MAAO7B,EAAiB,UACxB8B,aAAc9B,EAAiB,UAC/B+B,IAAK/B,EAAiB"}
@@ -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.41.1","LIBRARY_VERSION is not defined"),t=e("eslegacy","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 c=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,c 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.42.0","LIBRARY_VERSION is not defined"),t=e("eslegacy","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 c=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,c as PAYMENT_METHOD_BEHAVIOR,a as PLATFORM};
2
2
  //# sourceMappingURL=config.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adyen/adyen-web",
3
- "version": "6.41.1",
3
+ "version": "6.42.0",
4
4
  "license": "MIT",
5
5
  "homepage": "https://docs.adyen.com/checkout",
6
6
  "type": "module",
@@ -117,7 +117,7 @@
117
117
  "jest-mock-extended": "4.0.1",
118
118
  "msw": "2.14.6",
119
119
  "msw-storybook-addon": "2.0.7",
120
- "postcss": "8.5.16",
120
+ "postcss": "8.5.18",
121
121
  "rollup": "4.62.2",
122
122
  "rollup-plugin-dts": "6.4.1",
123
123
  "rollup-plugin-postcss": "4.0.2",