@adyen/adyen-web 6.40.1 → 6.40.2

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 (81) 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 +6 -21
  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/Blik/Blik.js +1 -1
  7. package/dist/es/components/Blik/Blik.js.map +1 -1
  8. package/dist/es/components/Iris/Iris.js +1 -1
  9. package/dist/es/components/Iris/Iris.js.map +1 -1
  10. package/dist/es/components/MBWay/MBWay.js +1 -1
  11. package/dist/es/components/MBWay/MBWay.js.map +1 -1
  12. package/dist/es/components/PayTo/PayTo.js +1 -1
  13. package/dist/es/components/PayTo/PayTo.js.map +1 -1
  14. package/dist/es/components/PayTo/components/BSBInput.js +1 -1
  15. package/dist/es/components/PayTo/components/BSBInput.js.map +1 -1
  16. package/dist/es/components/PayTo/components/IdentifierSelector.js +1 -1
  17. package/dist/es/components/PayTo/components/IdentifierSelector.js.map +1 -1
  18. package/dist/es/components/PayTo/components/PayIDInput.js +1 -1
  19. package/dist/es/components/PayTo/components/PayIDInput.js.map +1 -1
  20. package/dist/es/components/PayTo/components/validate.js +1 -1
  21. package/dist/es/components/PayTo/components/validate.js.map +1 -1
  22. package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  23. package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  24. package/dist/es/components/UPI/UPI.js +1 -1
  25. package/dist/es/components/UPI/UPI.js.map +1 -1
  26. package/dist/es/components/internal/Await/Await.js +1 -1
  27. package/dist/es/components/internal/Await/Await.js.map +1 -1
  28. package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
  29. package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
  30. package/dist/es/components/internal/FormFields/InputBase.js +1 -1
  31. package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
  32. package/dist/es/components/internal/FormFields/Select/Select.js +1 -1
  33. package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
  34. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  35. package/dist/es/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  36. package/dist/es/core/config.js +1 -1
  37. package/dist/es/index.d.ts +6 -21
  38. package/dist/es/language/utils.js +1 -1
  39. package/dist/es/language/utils.js.map +1 -1
  40. package/dist/es/packages/server/translations/en-US.json.js +1 -1
  41. package/dist/es/utils/get-process-message-handler.js +1 -1
  42. package/dist/es/utils/get-process-message-handler.js.map +1 -1
  43. package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
  44. package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
  45. package/dist/es-legacy/components/Blik/Blik.js +1 -1
  46. package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
  47. package/dist/es-legacy/components/Iris/Iris.js +1 -1
  48. package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
  49. package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
  50. package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
  51. package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
  52. package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
  53. package/dist/es-legacy/components/PayTo/components/BSBInput.js +1 -1
  54. package/dist/es-legacy/components/PayTo/components/BSBInput.js.map +1 -1
  55. package/dist/es-legacy/components/PayTo/components/IdentifierSelector.js +1 -1
  56. package/dist/es-legacy/components/PayTo/components/IdentifierSelector.js.map +1 -1
  57. package/dist/es-legacy/components/PayTo/components/PayIDInput.js +1 -1
  58. package/dist/es-legacy/components/PayTo/components/PayIDInput.js.map +1 -1
  59. package/dist/es-legacy/components/PayTo/components/validate.js +1 -1
  60. package/dist/es-legacy/components/PayTo/components/validate.js.map +1 -1
  61. package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
  62. package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
  63. package/dist/es-legacy/components/UPI/UPI.js +1 -1
  64. package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
  65. package/dist/es-legacy/components/internal/Await/Await.js +1 -1
  66. package/dist/es-legacy/components/internal/Await/Await.js.map +1 -1
  67. package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
  68. package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
  69. package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
  70. package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
  71. package/dist/es-legacy/components/internal/FormFields/Select/Select.js +1 -1
  72. package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
  73. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
  74. package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
  75. package/dist/es-legacy/core/config.js +1 -1
  76. package/dist/es-legacy/language/utils.js +1 -1
  77. package/dist/es-legacy/language/utils.js.map +1 -1
  78. package/dist/es-legacy/packages/server/translations/en-US.json.js +1 -1
  79. package/dist/es-legacy/utils/get-process-message-handler.js +1 -1
  80. package/dist/es-legacy/utils/get-process-message-handler.js.map +1 -1
  81. package/package.json +19 -19
@@ -1 +1 @@
1
- {"version":3,"file":"Fieldset.js","sources":["../../../../../../src/components/internal/FormFields/Fieldset/Fieldset.tsx"],"sourcesContent":["import { h, ComponentChildren } from 'preact';\nimport cx from 'classnames';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport './Fieldset.scss';\nimport { getUniqueId } from '../../../../utils/idGenerator';\nimport { useMemo } from 'preact/hooks';\n\ninterface FieldsetProps {\n children: ComponentChildren;\n classNameModifiers?: string[];\n classNamesFields?: string[];\n label?: string;\n description?: string;\n readonly?: boolean;\n id?: string;\n renderLabelAsSectionHeading?: boolean;\n}\n\nexport default function Fieldset({\n children,\n classNameModifiers: classNameFieldsetModifiers = [],\n classNamesFields = [],\n label,\n readonly = false,\n description,\n id,\n renderLabelAsSectionHeading = false\n}: Readonly<FieldsetProps>) {\n const { i18n } = useCoreContext();\n\n const describedById = useMemo(() => getUniqueId('fieldset-description'), []);\n\n return (\n <fieldset\n id={id}\n className={cx([\n 'adyen-checkout__fieldset',\n ...classNameFieldsetModifiers.map(m => `adyen-checkout__fieldset--${m}`),\n { 'adyen-checkout__fieldset--readonly': readonly }\n ])}\n aria-describedby={description ? describedById : null}\n >\n {label && (\n <legend className=\"adyen-checkout__fieldset__title\">\n {renderLabelAsSectionHeading ? <h2 className=\"adyen-checkout__fieldset__title-heading\">{i18n.get(label)}</h2> : i18n.get(label)}\n </legend>\n )}\n {description && (\n <p id={describedById} className=\"adyen-checkout__fieldset__description\">\n {i18n.get(description)}\n </p>\n )}\n <div className={cx('adyen-checkout__fieldset__fields', classNamesFields)}>{children}</div>\n </fieldset>\n );\n}\n"],"names":["Fieldset","children","classNameModifiers","classNameFieldsetModifiers","classNamesFields","label","readonly","description","id","renderLabelAsSectionHeading","i18n","useCoreContext","describedById","useMemo","getUniqueId","h","fieldset","className","cx","map","m","aria-describedby","legend","h2","get","p","div"],"mappings":"2UAkBe,SAASA,GAASC,SAC7BA,EACAC,mBAAoBC,EAA6B,GAAEC,iBACnDA,EAAmB,GAAEC,MACrBA,EAAKC,SACLA,GAAW,EAAKC,YAChBA,EAAWC,GACXA,EAAEC,4BACFA,GAA8B,IAE9B,MAAMC,KAAEA,GAASC,IAEXC,EAAgBC,EAAQ,IAAMC,EAAY,wBAAyB,IAEzE,OACIC,EAACC,WAAAA,CACGR,GAAIA,EACJS,UAAWC,EAAG,CACV,8BACGf,EAA2BgB,IAAIC,GAAK,6BAA6BA,KACpE,CAAE,qCAAsCd,KAE5Ce,mBAAkBd,EAAcK,EAAgB,MAE/CP,GACGU,EAACO,SAAAA,CAAOL,UAAU,mCACbR,EAA8BM,EAACQ,KAAAA,CAAGN,UAAU,2CAA2CP,EAAKc,IAAInB,IAAeK,EAAKc,IAAInB,IAGhIE,GACGQ,EAACU,IAAAA,CAAEjB,GAAII,EAAeK,UAAU,yCAC3BP,EAAKc,IAAIjB,IAGlBQ,EAACW,MAAAA,CAAIT,UAAWC,EAAG,mCAAoCd,IAAoBH,GAGvF"}
1
+ {"version":3,"file":"Fieldset.js","sources":["../../../../../../src/components/internal/FormFields/Fieldset/Fieldset.tsx"],"sourcesContent":["import { h, ComponentChildren } from 'preact';\nimport cx from 'classnames';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\nimport './Fieldset.scss';\nimport { getUniqueId } from '../../../../utils/idGenerator';\nimport { useMemo } from 'preact/hooks';\n\ninterface FieldsetProps {\n children: ComponentChildren;\n classNameModifiers?: string[];\n classNamesFields?: string[];\n label?: string;\n description?: string;\n readonly?: boolean;\n id?: string;\n renderLabelAsSectionHeading?: boolean;\n descriptionId?: string;\n}\n\nexport default function Fieldset({\n children,\n classNameModifiers: classNameFieldsetModifiers = [],\n classNamesFields = [],\n label,\n readonly = false,\n description,\n id,\n renderLabelAsSectionHeading = false,\n descriptionId: externalDescriptionId\n}: Readonly<FieldsetProps>) {\n const { i18n } = useCoreContext();\n\n const generatedDescriptionId = useMemo(() => getUniqueId('fieldset-description'), []);\n const describedById = externalDescriptionId ?? generatedDescriptionId;\n\n return (\n <fieldset\n id={id}\n className={cx([\n 'adyen-checkout__fieldset',\n ...classNameFieldsetModifiers.map(m => `adyen-checkout__fieldset--${m}`),\n { 'adyen-checkout__fieldset--readonly': readonly }\n ])}\n >\n {label && (\n <legend className=\"adyen-checkout__fieldset__title\">\n {renderLabelAsSectionHeading ? <h2 className=\"adyen-checkout__fieldset__title-heading\">{i18n.get(label)}</h2> : i18n.get(label)}\n </legend>\n )}\n {description && (\n <p id={describedById} className=\"adyen-checkout__fieldset__description\">\n {i18n.get(description)}\n </p>\n )}\n <div className={cx('adyen-checkout__fieldset__fields', classNamesFields)}>{children}</div>\n </fieldset>\n );\n}\n"],"names":["Fieldset","children","classNameModifiers","classNameFieldsetModifiers","classNamesFields","label","readonly","description","id","renderLabelAsSectionHeading","descriptionId","externalDescriptionId","i18n","useCoreContext","generatedDescriptionId","useMemo","getUniqueId","describedById","h","fieldset","className","cx","map","m","legend","h2","get","p","div"],"mappings":"2UAmBe,SAASA,GAASC,SAC7BA,EACAC,mBAAoBC,EAA6B,GAAEC,iBACnDA,EAAmB,GAAEC,MACrBA,EAAKC,SACLA,GAAW,EAAKC,YAChBA,EAAWC,GACXA,EAAEC,4BACFA,GAA8B,EAC9BC,cAAeC,IAEf,MAAMC,KAAEA,GAASC,IAEXC,EAAyBC,EAAQ,IAAMC,EAAY,wBAAyB,IAC5EC,EAAgBN,QAAAA,EAAyBG,EAE/C,OACII,EAACC,WAAAA,CACGX,GAAIA,EACJY,UAAWC,EAAG,CACV,8BACGlB,EAA2BmB,IAAIC,GAAK,6BAA6BA,KACpE,CAAE,qCAAsCjB,MAG3CD,GACGa,EAACM,SAAAA,CAAOJ,UAAU,mCACbX,EAA8BS,EAACO,KAAAA,CAAGL,UAAU,2CAA2CR,EAAKc,IAAIrB,IAAeO,EAAKc,IAAIrB,IAGhIE,GACGW,EAACS,IAAAA,CAAEnB,GAAIS,EAAeG,UAAU,yCAC3BR,EAAKc,IAAInB,IAGlBW,EAACU,MAAAA,CAAIR,UAAWC,EAAG,mCAAoCjB,IAAoBH,GAGvF"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCallback as t}from"../../../external/preact/hooks/dist/hooks.js";import r from"../../../_virtual/index.js";import{ARIA_ERROR_SUFFIX as n,ARIA_CONTEXT_SUFFIX as o}from"../../../core/Errors/constants.js";function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(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}function i(e,t){if(null==e)return{};var r,n,o,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(Object(e)),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var r,n,o={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}function c(c){let{setRef:u}=c,s=i(c,["setRef"]);const{autoCorrect:p,classNameModifiers:d,isInvalid:y,isValid:f,readonly:b=null,spellcheck:O,type:m,uniqueId:j,disabled:v}=s,h=s.className;Object.prototype.hasOwnProperty.call(s,"onChange")&&console.error("Error: Form fields that rely on InputBase may not have an onChange property");const g=t(e=>{s.onInput(e)},[s.onInput]),P=t(e=>{(null==s?void 0:s.onKeyPress)&&s.onKeyPress(e)},[null==s?void 0:s.onKeyPress]),w=t(e=>{(null==s?void 0:s.onKeyUp)&&s.onKeyUp(e)},[null==s?void 0:s.onKeyUp]),I=t(e=>{var t,r;null==s||null===(t=s.onBlurHandler)||void 0===t||t.call(s,e),s.trimOnBlur&&(e.target.value=e.target.value.trim()),null==s||null===(r=s.onBlur)||void 0===r||r.call(s,e)},[s.onBlur,s.onBlurHandler]),k=t(e=>{var t;null==s||null===(t=s.onFocusHandler)||void 0===t||t.call(s,e)},[s.onFocusHandler]),_=r("adyen-checkout__input",[`adyen-checkout__input--${m}`],h,{"adyen-checkout__input--invalid":y,"adyen-checkout__input--valid":f},d.map(e=>`adyen-checkout__input--${e}`)),{classNameModifiers:x,uniqueId:E,isInvalid:K,isValid:B,addContextualElement:C,autocomplete:N}=s,S=i(s,["classNameModifiers","uniqueId","isInvalid","isValid","addContextualElement","autocomplete"]);return e("input",a(function(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){l(e,t,r[t])})}return e}({id:j},S),{autocomplete:N,"aria-required":S.required,type:m,className:_,readOnly:b,spellcheck:O,autoCorrect:p,"aria-describedby":`${j}${y?n:o}`,"aria-invalid":y,onInput:g,onBlur:I,onFocus:k,onKeyUp:w,onKeyPress:P,disabled:v,ref:u}))}c.defaultProps={type:"text",classNameModifiers:[]};export{c as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCallback as t}from"../../../external/preact/hooks/dist/hooks.js";import r from"../../../_virtual/index.js";import{ARIA_ERROR_SUFFIX as n,ARIA_CONTEXT_SUFFIX as o}from"../../../core/Errors/constants.js";function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(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}function i(e,t){if(null==e)return{};var r,n,o,l={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(r=Reflect.ownKeys(Object(e)),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}if(l=function(e,t){if(null==e)return{};var r,n,o={},l=Object.getOwnPropertyNames(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r]);return o}(e,t),Object.getOwnPropertySymbols)for(r=Object.getOwnPropertySymbols(e),o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n]);return l}function u(u){let{setRef:c}=u,s=i(u,["setRef"]);const{autoCorrect:p,classNameModifiers:d,isInvalid:y,isValid:f,readonly:b=null,spellcheck:O,type:m,uniqueId:j,disabled:v}=s,g=s.className;Object.prototype.hasOwnProperty.call(s,"onChange")&&console.error("Error: Form fields that rely on InputBase may not have an onChange property");const h=t(e=>{s.onInput(e)},[s.onInput]),P=t(e=>{(null==s?void 0:s.onKeyPress)&&s.onKeyPress(e)},[null==s?void 0:s.onKeyPress]),w=t(e=>{(null==s?void 0:s.onKeyUp)&&s.onKeyUp(e)},[null==s?void 0:s.onKeyUp]),I=t(e=>{var t,r;null==s||null===(t=s.onBlurHandler)||void 0===t||t.call(s,e),s.trimOnBlur&&(e.target.value=e.target.value.trim()),null==s||null===(r=s.onBlur)||void 0===r||r.call(s,e)},[s.onBlur,s.onBlurHandler]),k=t(e=>{var t;null==s||null===(t=s.onFocusHandler)||void 0===t||t.call(s,e)},[s.onFocusHandler]),_=r("adyen-checkout__input",[`adyen-checkout__input--${m}`],g,{"adyen-checkout__input--invalid":y,"adyen-checkout__input--valid":f},d.map(e=>`adyen-checkout__input--${e}`)),{classNameModifiers:x,uniqueId:E,isInvalid:K,isValid:B,addContextualElement:C,"aria-describedby":N,autocomplete:S}=s,q=i(s,["classNameModifiers","uniqueId","isInvalid","isValid","addContextualElement","aria-describedby","autocomplete"]),R=["string"==typeof N&&N?N:null,j?`${j}${y?n:o}`:null].filter(Boolean).join(" ")||null;return e("input",a(function(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){l(e,t,r[t])})}return e}({id:j},q),{autocomplete:S,"aria-required":q.required,type:m,className:_,readOnly:b,spellcheck:O,autoCorrect:p,"aria-describedby":R,"aria-invalid":y,onInput:h,onBlur:I,onFocus:k,onKeyUp:w,onKeyPress:P,disabled:v,ref:c}))}u.defaultProps={type:"text",classNameModifiers:[]};export{u as default};
2
2
  //# sourceMappingURL=InputBase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InputBase.js","sources":["../../../../../src/components/internal/FormFields/InputBase.tsx"],"sourcesContent":["import {\n h,\n RefCallback,\n InputHTMLAttributes,\n GenericEventHandler,\n TargetedInputEvent,\n TargetedKeyboardEvent,\n TargetedFocusEvent,\n TargetedEvent\n} from 'preact';\nimport { useCallback } from 'preact/hooks';\nimport classNames from 'classnames';\nimport { ARIA_CONTEXT_SUFFIX, ARIA_ERROR_SUFFIX } from '../../../core/Errors/constants';\nimport Language from '../../../language';\nimport { AutocompleteValue } from './types';\nimport './FormFields.scss';\n\nexport interface InputBaseProps extends InputHTMLAttributes {\n classNameModifiers?: string[];\n isInvalid?: boolean;\n isValid?: boolean;\n readonly?: boolean;\n uniqueId?: string;\n disabled?: boolean;\n className?: string;\n placeholder?: string;\n value?: string;\n name?: string;\n checked?: boolean;\n setRef?: RefCallback<HTMLInputElement>;\n trimOnBlur?: boolean;\n i18n?: Language;\n label?: string;\n onBlurHandler?: GenericEventHandler<HTMLInputElement>;\n onFocusHandler?: GenericEventHandler<HTMLInputElement>;\n maxlength?: number | null;\n addContextualElement?: boolean;\n type?: string;\n /**\n * WCAG 2.2 autocomplete token for browser autofill.\n * Pass undefined to omit the attribute entirely.\n * @see https://www.w3.org/TR/WCAG22/#input-purposes\n */\n autocomplete: AutocompleteValue;\n}\n\nexport default function InputBase({ setRef, ...props }: Readonly<InputBaseProps>) {\n const { autoCorrect, classNameModifiers, isInvalid, isValid, readonly = null, spellcheck, type, uniqueId, disabled } = props;\n const className = props.className;\n\n /**\n * To avoid confusion with misplaced/misdirected onChange handlers - InputBase only accepts onInput, onBlur & onFocus handlers.\n * The first 2 being the means by which we expect useForm--handleChangeFor validation functionality to be applied.\n */\n if (Object.prototype.hasOwnProperty.call(props, 'onChange')) {\n console.error('Error: Form fields that rely on InputBase may not have an onChange property');\n }\n\n const handleInput = useCallback(\n (event: TargetedInputEvent<HTMLInputElement>) => {\n props.onInput(event);\n },\n [props.onInput]\n );\n\n /**\n * Event is fired when a key that produces a character value is pressed down.\n * ENTER keypress also triggers this event.\n *\n * TODO: 'keypress' event is deprecated\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/keypress_event\n */\n const handleKeyPress = useCallback(\n (event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (props?.onKeyPress) props.onKeyPress(event);\n },\n [props?.onKeyPress]\n );\n\n /**\n * Event is fired when certain keys are pressed (keys that do not output characters):\n * Backspace, Arrow keys, Shift, Ctrl, Command, Option, Esc\n *\n * Exception: ENTER keypress triggers 'onKeyPress' AND 'onKeyUp'\n */\n const handleKeyUp = useCallback(\n (event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (props?.onKeyUp) props.onKeyUp(event);\n },\n [props?.onKeyUp]\n );\n\n const handleBlur = useCallback(\n (event: TargetedFocusEvent<HTMLInputElement>) => {\n props?.onBlurHandler?.(event); // From Field component\n\n if (props.trimOnBlur) {\n (event.target as HTMLInputElement).value = (event.target as HTMLInputElement).value.trim(); // needed to trim trailing spaces in field (leading spaces can be done via formatting)\n }\n\n props?.onBlur?.(event);\n },\n [props.onBlur, props.onBlurHandler]\n );\n\n const handleFocus = useCallback(\n (event: TargetedEvent<HTMLInputElement>) => {\n props?.onFocusHandler?.(event); // From Field component\n },\n [props.onFocusHandler]\n );\n\n const inputClassNames = classNames(\n 'adyen-checkout__input',\n [`adyen-checkout__input--${type}`],\n className,\n {\n 'adyen-checkout__input--invalid': isInvalid,\n 'adyen-checkout__input--valid': isValid\n },\n classNameModifiers.map(m => `adyen-checkout__input--${m}`)\n );\n\n // Don't spread classNameModifiers etc to input element (it ends up as an attribute on the element itself)\n const { classNameModifiers: cnm, uniqueId: uid, isInvalid: iiv, isValid: iv, addContextualElement: ace, autocomplete, ...restProps } = props;\n\n return (\n <input\n id={uniqueId}\n {...restProps}\n // eslint-disable-next-line react/no-unknown-property -- Preact uses lowercase 'autocomplete'\n autocomplete={autocomplete}\n aria-required={restProps.required}\n type={type}\n className={inputClassNames}\n readOnly={readonly}\n // eslint-disable-next-line react/no-unknown-property -- Preact uses lowercase 'spellcheck'\n spellcheck={spellcheck}\n autoCorrect={autoCorrect}\n aria-describedby={`${uniqueId}${isInvalid ? ARIA_ERROR_SUFFIX : ARIA_CONTEXT_SUFFIX}`}\n aria-invalid={isInvalid}\n onInput={handleInput}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n onKeyPress={handleKeyPress}\n disabled={disabled}\n ref={setRef}\n />\n );\n}\n\nInputBase.defaultProps = {\n type: 'text',\n classNameModifiers: []\n};\n"],"names":["InputBase","_0","setRef","props","autoCorrect","classNameModifiers","isInvalid","isValid","readonly","spellcheck","type","uniqueId","disabled","className","Object","prototype","hasOwnProperty","call","console","error","handleInput","useCallback","event","onInput","handleKeyPress","onKeyPress","handleKeyUp","onKeyUp","handleBlur","onBlurHandler","trimOnBlur","target","value","trim","onBlur","handleFocus","onFocusHandler","inputClassNames","classNames","map","m","cnm","uid","iiv","iv","addContextualElement","ace","autocomplete","restProps","h","input","id","aria-required","required","readOnly","aria-describedby","ARIA_ERROR_SUFFIX","ARIA_CONTEXT_SUFFIX","aria-invalid","onFocus","ref","defaultProps"],"mappings":"03CA8Ce,SAASA,EAAUC,OAAAC,OAAEA,GAA4CD,EAAjCE,EAAAA,EAAA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6C,EAAAA,EAAc7C,EAAAA,+FAEvI,OACI8C,EAACC,QAAAA,oUAAAA,CAAAA,CACGC,GAAIxC,GACAqC,GAAAA,CAEJD,aAAcA,EACdK,gBAAeJ,EAAUK,SACzB3C,KAAMA,EACNG,UAAWwB,EACXiB,SAAU9C,EAEVC,WAAYA,EACZL,YAAaA,EACbmD,mBAAkB,GAAG5C,IAAWL,EAAYkD,EAAoBC,IAChEC,eAAcpD,EACdiB,QAASH,EACTc,OAAQN,EACR+B,QAASxB,EACTR,QAASD,EACTD,WAAYD,EACZZ,SAAUA,EACVgD,IAAK1D,IAGjB,CAEAF,EAAU6D,aAAe,CACrBnD,KAAM,OACNL,mBAAoB"}
1
+ {"version":3,"file":"InputBase.js","sources":["../../../../../src/components/internal/FormFields/InputBase.tsx"],"sourcesContent":["import {\n h,\n RefCallback,\n InputHTMLAttributes,\n GenericEventHandler,\n TargetedInputEvent,\n TargetedKeyboardEvent,\n TargetedFocusEvent,\n TargetedEvent\n} from 'preact';\nimport { useCallback } from 'preact/hooks';\nimport classNames from 'classnames';\nimport { ARIA_CONTEXT_SUFFIX, ARIA_ERROR_SUFFIX } from '../../../core/Errors/constants';\nimport Language from '../../../language';\nimport { AutocompleteValue } from './types';\nimport './FormFields.scss';\n\nexport interface InputBaseProps extends InputHTMLAttributes {\n classNameModifiers?: string[];\n isInvalid?: boolean;\n isValid?: boolean;\n readonly?: boolean;\n uniqueId?: string;\n disabled?: boolean;\n className?: string;\n placeholder?: string;\n value?: string;\n name?: string;\n checked?: boolean;\n setRef?: RefCallback<HTMLInputElement>;\n trimOnBlur?: boolean;\n i18n?: Language;\n label?: string;\n onBlurHandler?: GenericEventHandler<HTMLInputElement>;\n onFocusHandler?: GenericEventHandler<HTMLInputElement>;\n maxlength?: number | null;\n addContextualElement?: boolean;\n type?: string;\n /**\n * WCAG 2.2 autocomplete token for browser autofill.\n * Pass undefined to omit the attribute entirely.\n * @see https://www.w3.org/TR/WCAG22/#input-purposes\n */\n autocomplete: AutocompleteValue;\n}\n\nexport default function InputBase({ setRef, ...props }: Readonly<InputBaseProps>) {\n const { autoCorrect, classNameModifiers, isInvalid, isValid, readonly = null, spellcheck, type, uniqueId, disabled } = props;\n const className = props.className;\n\n /**\n * To avoid confusion with misplaced/misdirected onChange handlers - InputBase only accepts onInput, onBlur & onFocus handlers.\n * The first 2 being the means by which we expect useForm--handleChangeFor validation functionality to be applied.\n */\n if (Object.prototype.hasOwnProperty.call(props, 'onChange')) {\n console.error('Error: Form fields that rely on InputBase may not have an onChange property');\n }\n\n const handleInput = useCallback(\n (event: TargetedInputEvent<HTMLInputElement>) => {\n props.onInput(event);\n },\n [props.onInput]\n );\n\n /**\n * Event is fired when a key that produces a character value is pressed down.\n * ENTER keypress also triggers this event.\n *\n * TODO: 'keypress' event is deprecated\n * https://developer.mozilla.org/en-US/docs/Web/API/Element/keypress_event\n */\n const handleKeyPress = useCallback(\n (event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (props?.onKeyPress) props.onKeyPress(event);\n },\n [props?.onKeyPress]\n );\n\n /**\n * Event is fired when certain keys are pressed (keys that do not output characters):\n * Backspace, Arrow keys, Shift, Ctrl, Command, Option, Esc\n *\n * Exception: ENTER keypress triggers 'onKeyPress' AND 'onKeyUp'\n */\n const handleKeyUp = useCallback(\n (event: TargetedKeyboardEvent<HTMLInputElement>) => {\n if (props?.onKeyUp) props.onKeyUp(event);\n },\n [props?.onKeyUp]\n );\n\n const handleBlur = useCallback(\n (event: TargetedFocusEvent<HTMLInputElement>) => {\n props?.onBlurHandler?.(event); // From Field component\n\n if (props.trimOnBlur) {\n (event.target as HTMLInputElement).value = (event.target as HTMLInputElement).value.trim(); // needed to trim trailing spaces in field (leading spaces can be done via formatting)\n }\n\n props?.onBlur?.(event);\n },\n [props.onBlur, props.onBlurHandler]\n );\n\n const handleFocus = useCallback(\n (event: TargetedEvent<HTMLInputElement>) => {\n props?.onFocusHandler?.(event); // From Field component\n },\n [props.onFocusHandler]\n );\n\n const inputClassNames = classNames(\n 'adyen-checkout__input',\n [`adyen-checkout__input--${type}`],\n className,\n {\n 'adyen-checkout__input--invalid': isInvalid,\n 'adyen-checkout__input--valid': isValid\n },\n classNameModifiers.map(m => `adyen-checkout__input--${m}`)\n );\n\n // Don't spread classNameModifiers etc to input element (it ends up as an attribute on the element itself)\n const {\n classNameModifiers: cnm,\n uniqueId: uid,\n isInvalid: iiv,\n isValid: iv,\n addContextualElement: ace,\n 'aria-describedby': ariaDescribedByProp,\n autocomplete,\n ...restProps\n } = props;\n\n const internalDescribedBy = uniqueId ? `${uniqueId}${isInvalid ? ARIA_ERROR_SUFFIX : ARIA_CONTEXT_SUFFIX}` : null;\n const extraDescribedBy = typeof ariaDescribedByProp === 'string' && ariaDescribedByProp ? ariaDescribedByProp : null;\n const mergedAriaDescribedBy = [extraDescribedBy, internalDescribedBy].filter(Boolean).join(' ') || null;\n\n return (\n <input\n id={uniqueId}\n {...restProps}\n // eslint-disable-next-line react/no-unknown-property -- Preact uses lowercase 'autocomplete'\n autocomplete={autocomplete}\n aria-required={restProps.required}\n type={type}\n className={inputClassNames}\n readOnly={readonly}\n // eslint-disable-next-line react/no-unknown-property -- Preact uses lowercase 'spellcheck'\n spellcheck={spellcheck}\n autoCorrect={autoCorrect}\n aria-describedby={mergedAriaDescribedBy}\n aria-invalid={isInvalid}\n onInput={handleInput}\n onBlur={handleBlur}\n onFocus={handleFocus}\n onKeyUp={handleKeyUp}\n onKeyPress={handleKeyPress}\n disabled={disabled}\n ref={setRef}\n />\n );\n}\n\nInputBase.defaultProps = {\n type: 'text',\n classNameModifiers: []\n};\n"],"names":["InputBase","_0","setRef","props","autoCorrect","classNameModifiers","isInvalid","isValid","readonly","spellcheck","type","uniqueId","disabled","className","Object","prototype","hasOwnProperty","call","console","error","handleInput","useCallback","event","onInput","handleKeyPress","onKeyPress","handleKeyUp","onKeyUp","handleBlur","onBlurHandler","trimOnBlur","target","value","trim","onBlur","handleFocus","onFocusHandler","inputClassNames","classNames","map","m","cnm","uid","iiv","iv","addContextualElement","ace","ariaDescribedByProp","autocomplete","restProps","mergedAriaDescribedBy","ARIA_ERROR_SUFFIX","ARIA_CONTEXT_SUFFIX","filter","Boolean","join","h","input","id","aria-required","required","readOnly","aria-describedby","aria-invalid","onFocus","ref","defaultProps"],"mappings":"03CA8Ce,SAASA,EAAUC,OAAAC,OAAEA,GAA4CD,EAAjCE,EAAAA,EAAAA,EAAAA,YAC3C,MAAMC,YAAEA,EAAWC,mBAAEA,EAAkBC,UAAEA,EAASC,QAAEA,EAAOC,SAAEA,EAAW,KAAIC,WAAEA,EAAUC,KAAEA,EAAIC,SAAEA,EAAQC,SAAEA,GAAaT,EACjHU,EAAYV,EAAMU,UAMpBC,OAAOC,UAAUC,eAAeC,KAAKd,EAAO,aAC5Ce,QAAQC,MAAM,+EAGlB,MAAMC,EAAcC,EACfC,IACGnB,EAAMoB,QAAQD,IAElB,CAACnB,EAAMoB,UAULC,EAAiBH,EAClBC,KACOnB,aAAAA,EAAAA,EAAOsB,aAAYtB,EAAMsB,WAAWH,IAE5C,CAACnB,aAAAA,EAAAA,EAAOsB,aASNC,EAAcL,EACfC,KACOnB,aAAAA,EAAAA,EAAOwB,UAASxB,EAAMwB,QAAQL,IAEtC,CAACnB,aAAAA,EAAAA,EAAOwB,UAGNC,EAAaP,EACdC,QACGnB,EAMAA,EANAA,iBAAAA,EAAAA,EAAO0B,qBAAP1B,IAAAA,GAAAA,EAAAA,KAAAA,EAAuBmB,GAEnBnB,EAAM2B,aACLR,EAAMS,OAA4BC,MAAQV,EAAOS,OAA4BC,MAAMC,QAGxF9B,SAAa,QAAbA,EAAAA,EAAO+B,cAAP/B,IAAAA,GAAAA,OAAAA,EAAgBmB,IAEpB,CAACnB,EAAM+B,OAAQ/B,EAAM0B,gBAGnBM,EAAcd,EACfC,IACGnB,IAAAA,EAAAA,iBAAAA,EAAAA,EAAOiC,sBAAPjC,IAAAA,GAAAA,EAAAA,KAAAA,EAAwBmB,IAE5B,CAACnB,EAAMiC,iBAGLC,EAAkBC,EACpB,wBACA,CAAC,0BAA0B5B,KAC3BG,EACA,CACI,iCAAkCP,EAClC,+BAAgCC,GAEpCF,EAAmBkC,IAAIC,GAAK,0BAA0BA,OAKtDnC,mBAAoBoC,EACpB9B,SAAU+B,EACVpC,UAAWqC,EACXpC,QAASqC,EACTC,qBAAsBC,EACtB,mBAAoBC,EAAmBC,aACvCA,GAEA7C,EADG8C,EAAAA,EACH9C,EAAAA,8EAHA,oCAOE+C,EAAwB,CAD0B,iBAAxBH,GAAoCA,EAAsBA,EAAsB,KADpFpC,EAAW,GAAGA,IAAWL,EAAY6C,EAAoBC,IAAwB,MAEvCC,OAAOC,SAASC,KAAK,MAAQ,KAEnG,OACIC,EAACC,QAAAA,oUAAAA,CAAAA,CACGC,GAAI/C,GACAsC,GAAAA,CAEJD,aAAcA,EACdW,gBAAeV,EAAUW,SACzBlD,KAAMA,EACNG,UAAWwB,EACXwB,SAAUrD,EAEVC,WAAYA,EACZL,YAAaA,EACb0D,mBAAkBZ,EAClBa,eAAczD,EACdiB,QAASH,EACTc,OAAQN,EACRoC,QAAS7B,EACTR,QAASD,EACTD,WAAYD,EACZZ,SAAUA,EACVqD,IAAK/D,IAGjB,CAEAF,EAAUkE,aAAe,CACrBxD,KAAM,OACNL,mBAAoB"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useRef as t,useState as n,useMemo as r,useEffect as l}from"../../../../external/preact/hooks/dist/hooks.js";import s from"../../../../_virtual/index.js";import o from"./components/SelectButton.js";import a from"./components/SelectList.js";import i from"../../../../utils/uuid.js";import{keys as c}from"./constants.js";import{ARIA_ERROR_SUFFIX as u,ARIA_CONTEXT_SUFFIX as d}from"../../../../core/Errors/constants.js";import{simulateFocusScroll as m}from"../utils.js";import{useCoreContext as f}from"../../../../core/Context/CoreProvider.js";function p({items:p=[],className:g="",classNameModifiers:v=[],filterable:h=!0,readonly:y=!1,onChange:k=()=>{},onInput:b,selectedValue:w,name:I,isInvalid:L,isValid:j,placeholder:x,uniqueId:D,disabled:T,disableTextFilter:C,clearOnSelect:E,blurOnClose:N,onListToggle:B,required:S}){const{i18n:$}=f(),_=t(null),M=t(null),P=t(null),R=t(null),[q,O]=n(null),[V,A]=n(!1),[F,H]=n(null),K=r(()=>`select-${i()}`,[]),U=p.find(e=>e.id===w)||{},[z,G]=n(),[J,Q]=n(U),W=U,X=C?p:p.filter(e=>!q||e.name.toLowerCase().includes(q.toLowerCase())),Y=D?`${D}${L?u:d}`:null,Z=e=>{if(!e)return;const t=document.getElementById(`listItem-${e.id}`);m(t)},ee=()=>{N&&_.current.blur(),A(!1)},te=()=>{A(!0)},ne=e=>{const t=e.currentTarget.getAttribute("data-value");return X.find(e=>e.id==t)},re=e=>{let t;e.preventDefault(),t=e.currentTarget instanceof HTMLElement&&"option"===e.currentTarget.getAttribute("role")?ne(e):J.id&&X.some(e=>e.id===J.id)?J:q?X[0]:{id:w},t&&!t.disabled&&(k({target:{value:t.id,name:I}}),E&&G(null),ee())},le=e=>{switch(e.key){case c.space:case c.enter:re(e);break;case c.arrowDown:e.preventDefault(),(()=>{if(!X||X.length<1)return;const e=X.findIndex(e=>e.id===J.id)+1,t=e<X.length?e:0,n=X[t];Z(n),Q(n)})();break;case c.arrowUp:e.preventDefault(),(()=>{if(!X||X.length<1)return;const e=X.findIndex(e=>e.id===J.id)-1,t=e<0?X.length-1:e,n=X[t];Z(n),Q(n)})()}};return l(()=>{V?G(null):O(null)},[V]),l(()=>{V&&h&&_.current&&_.current.focus(),null==B||B(V)},[V]),l(()=>{function e(e){(e.composedPath?!e.composedPath().includes(M.current):!M.current.contains(e.target))&&ee()}return document.addEventListener("click",e,!1),()=>{document.removeEventListener("click",e,!1)}},[M]),l(()=>{const e=setTimeout(()=>{0===X.length?H($.get("select.noOptionsFound")):H($.get("select.results",{values:{count:X.length}}))},500);return()=>clearTimeout(e)},[V,X.length,$]),e("div",{className:s(["adyen-checkout__dropdown",g,...v.map(e=>`adyen-checkout__dropdown--${e}`)]),ref:M},e(o,{inputText:z,id:null!=D?D:null,active:J,selected:W,filterInputRef:_,filterable:h,isInvalid:L,isValid:j,onButtonKeyDown:e=>{e.key===c.enter&&h&&V&&q?re(e):e.key===c.escape?ee():![c.arrowUp,c.arrowDown,c.enter].includes(e.key)&&(e.key!==c.space||h&&V)?(e.shiftKey&&e.key===c.tab||e.key===c.tab)&&ee():(e.preventDefault(),V?le(e):te())},onInput:e=>{const t=e.target.value;G(t),O(t),V||te(),b&&b(t)},placeholder:x,readonly:y,selectListId:K,showList:V,toggleButtonRef:P,toggleList:e=>{e.preventDefault(),V?(G(W.name),ee()):(G(null),te())},disabled:T,ariaDescribedBy:Y,required:S}),e(a,{active:J,filteredItems:X,onHover:e=>{e.preventDefault();const t=ne(e);Q(t)},onSelect:re,selected:W,selectListId:K,selectListRef:R,showList:V}),e("div",{key:z,role:"status","aria-live":"polite","aria-relevant":"additions text",className:"adyen-checkout-sr-panel--sr-only"},F))}p.defaultProps={className:"",classNameModifiers:[],filterable:!0,items:[],readonly:!1,onChange:()=>{}};export{p as default};
1
+ import{createElement as e}from"../../../../external/preact/dist/preact.js";import{useRef as t,useState as n,useMemo as r,useEffect as l}from"../../../../external/preact/hooks/dist/hooks.js";import s from"../../../../_virtual/index.js";import o from"./components/SelectButton.js";import a from"./components/SelectList.js";import i from"../../../../utils/uuid.js";import{keys as c}from"./constants.js";import{ARIA_ERROR_SUFFIX as u,ARIA_CONTEXT_SUFFIX as d}from"../../../../core/Errors/constants.js";import{simulateFocusScroll as m}from"../utils.js";import{useCoreContext as f}from"../../../../core/Context/CoreProvider.js";function p({items:p=[],className:g="",classNameModifiers:v=[],filterable:h=!0,readonly:y=!1,onChange:b=()=>{},onInput:k,selectedValue:w,name:I,isInvalid:L,isValid:j,placeholder:D,uniqueId:x,disabled:T,disableTextFilter:B,clearOnSelect:C,blurOnClose:E,onListToggle:N,required:S,additionalDescribedBy:$}){const{i18n:_}=f(),M=t(null),P=t(null),R=t(null),q=t(null),[O,V]=n(null),[A,F]=n(!1),[H,K]=n(null),U=r(()=>`select-${i()}`,[]),z=p.find(e=>e.id===w)||{},[G,J]=n(),[Q,W]=n(z),X=z,Y=B?p:p.filter(e=>!O||e.name.toLowerCase().includes(O.toLowerCase())),Z=[x?`${x}${L?u:d}`:null,$].filter(Boolean).join(" ")||null,ee=e=>{if(!e)return;const t=document.getElementById(`listItem-${e.id}`);m(t)},te=()=>{E&&M.current.blur(),F(!1)},ne=()=>{F(!0)},re=e=>{const t=e.currentTarget.getAttribute("data-value");return Y.find(e=>e.id==t)},le=e=>{let t;e.preventDefault(),t=e.currentTarget instanceof HTMLElement&&"option"===e.currentTarget.getAttribute("role")?re(e):Q.id&&Y.some(e=>e.id===Q.id)?Q:O?Y[0]:{id:w},t&&!t.disabled&&(b({target:{value:t.id,name:I}}),C&&J(null),te())},se=e=>{switch(e.key){case c.space:case c.enter:le(e);break;case c.arrowDown:e.preventDefault(),(()=>{if(!Y||Y.length<1)return;const e=Y.findIndex(e=>e.id===Q.id)+1,t=e<Y.length?e:0,n=Y[t];ee(n),W(n)})();break;case c.arrowUp:e.preventDefault(),(()=>{if(!Y||Y.length<1)return;const e=Y.findIndex(e=>e.id===Q.id)-1,t=e<0?Y.length-1:e,n=Y[t];ee(n),W(n)})()}};return l(()=>{A?J(null):V(null)},[A]),l(()=>{A&&h&&M.current&&M.current.focus(),null==N||N(A)},[A]),l(()=>{function e(e){(e.composedPath?!e.composedPath().includes(P.current):!P.current.contains(e.target))&&te()}return document.addEventListener("click",e,!1),()=>{document.removeEventListener("click",e,!1)}},[P]),l(()=>{const e=setTimeout(()=>{0===Y.length?K(_.get("select.noOptionsFound")):K(_.get("select.results",{values:{count:Y.length}}))},500);return()=>clearTimeout(e)},[A,Y.length,_]),e("div",{className:s(["adyen-checkout__dropdown",g,...v.map(e=>`adyen-checkout__dropdown--${e}`)]),ref:P},e(o,{inputText:G,id:null!=x?x:null,active:Q,selected:X,filterInputRef:M,filterable:h,isInvalid:L,isValid:j,onButtonKeyDown:e=>{e.key===c.enter&&h&&A&&O?le(e):e.key===c.escape?te():![c.arrowUp,c.arrowDown,c.enter].includes(e.key)&&(e.key!==c.space||h&&A)?(e.shiftKey&&e.key===c.tab||e.key===c.tab)&&te():(e.preventDefault(),A?se(e):ne())},onInput:e=>{const t=e.target.value;J(t),V(t),A||ne(),k&&k(t)},placeholder:D,readonly:y,selectListId:U,showList:A,toggleButtonRef:R,toggleList:e=>{e.preventDefault(),A?(J(X.name),te()):(J(null),ne())},disabled:T,ariaDescribedBy:Z,required:S}),e(a,{active:Q,filteredItems:Y,onHover:e=>{e.preventDefault();const t=re(e);W(t)},onSelect:le,selected:X,selectListId:U,selectListRef:q,showList:A}),e("div",{key:G,role:"status","aria-live":"polite","aria-relevant":"additions text",className:"adyen-checkout-sr-panel--sr-only"},H))}p.defaultProps={className:"",classNameModifiers:[],filterable:!0,items:[],readonly:!1,onChange:()=>{}};export{p as default};
2
2
  //# sourceMappingURL=Select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Select.js","sources":["../../../../../../src/components/internal/FormFields/Select/Select.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useMemo, useRef, useState } from 'preact/hooks';\nimport cx from 'classnames';\nimport SelectButton from './components/SelectButton';\nimport SelectList from './components/SelectList';\nimport uuid from '../../../../utils/uuid';\nimport { keys } from './constants';\nimport { SelectItem, SelectProps } from './types';\nimport './Select.scss';\nimport { ARIA_CONTEXT_SUFFIX, ARIA_ERROR_SUFFIX } from '../../../../core/Errors/constants';\nimport { simulateFocusScroll } from '../utils';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\n\nfunction Select({\n items = [],\n className = '',\n classNameModifiers = [],\n filterable = true,\n readonly = false,\n onChange = () => {},\n onInput,\n selectedValue,\n name,\n isInvalid,\n isValid,\n placeholder,\n uniqueId,\n disabled,\n disableTextFilter,\n clearOnSelect,\n blurOnClose,\n onListToggle,\n required\n}: Readonly<SelectProps>) {\n const { i18n } = useCoreContext();\n const filterInputRef = useRef(null);\n const selectContainerRef = useRef(null);\n const toggleButtonRef = useRef(null);\n const selectListRef = useRef(null);\n const [textFilter, setTextFilter] = useState<string>(null);\n const [showList, setShowList] = useState<boolean>(false);\n const [statusMessage, setStatusMessage] = useState<string | null>(null);\n const selectListId: string = useMemo(() => `select-${uuid()}`, []);\n\n const active: SelectItem = items.find(i => i.id === selectedValue) || ({} as SelectItem);\n\n const [inputText, setInputText] = useState<string>();\n\n const [activeOption, setActiveOption] = useState<SelectItem>(active);\n\n const selectedOption = active;\n\n const filteredItems = disableTextFilter ? items : items.filter(item => !textFilter || item.name.toLowerCase().includes(textFilter.toLowerCase()));\n\n const suffix = isInvalid ? ARIA_ERROR_SUFFIX : ARIA_CONTEXT_SUFFIX;\n const ariaDescribedBy = uniqueId ? `${uniqueId}${suffix}` : null;\n\n const setNextActive = () => {\n if (!filteredItems || filteredItems.length < 1) return;\n const possibleNextIndex = filteredItems.findIndex(listItem => listItem.id === activeOption.id) + 1;\n const nextIndex = possibleNextIndex < filteredItems.length ? possibleNextIndex : 0;\n const nextItem = filteredItems[nextIndex];\n scrollToItem(nextItem);\n setActiveOption(nextItem);\n };\n\n const setPreviousActive = () => {\n if (!filteredItems || filteredItems.length < 1) return;\n const possibleNextIndex = filteredItems.findIndex(listItem => listItem.id === activeOption.id) - 1;\n const nextIndex = possibleNextIndex < 0 ? filteredItems.length - 1 : possibleNextIndex;\n const nextItem = filteredItems[nextIndex];\n scrollToItem(nextItem);\n setActiveOption(nextItem);\n };\n\n const scrollToItem = (item: SelectItem) => {\n if (!item) return;\n const nextElement = document.getElementById(`listItem-${item.id}`);\n simulateFocusScroll(nextElement);\n };\n\n /**\n * Closes the selectList, empties the text filter and focuses the button element\n */\n const closeList = () => {\n //blurs the field when the list is closed, makes for a better UX for most users, needs more testing\n if (blurOnClose) {\n filterInputRef.current.blur();\n }\n setShowList(false);\n };\n\n const openList = () => {\n setShowList(true);\n };\n\n const extractItemFromEvent = (e: Event): SelectItem => {\n const value = (e.currentTarget as HTMLInputElement).getAttribute('data-value');\n return filteredItems.find(listItem => listItem.id == value);\n };\n\n /**\n * Closes the select list and fires an onChange\n * @param e - Event\n */\n const handleSelect = (e: Event) => {\n e.preventDefault();\n\n // We use a local variable here since writing and if statement is cleaner then a long ternary\n let valueToEmit;\n\n if (e.currentTarget instanceof HTMLElement && e.currentTarget.getAttribute('role') === 'option') {\n // This is the main scenario when clicking and item in the list\n // Item comes from the event\n valueToEmit = extractItemFromEvent(e);\n } else if (activeOption.id && filteredItems.some(item => item.id === activeOption.id)) {\n // This is the scenario where a user is using the keyboard to navigate\n // In the case item comes from the visually select item\n valueToEmit = activeOption;\n } else {\n // This is the scenario the user didn't select anything\n if (textFilter) {\n // if we filtering for something then select the first option\n valueToEmit = filteredItems[0];\n } else {\n // This will happen when we want to keep an already chosen option\n // If no active option we should just emit again with the value that was already selected\n valueToEmit = { id: selectedValue };\n }\n }\n\n if (valueToEmit && !valueToEmit.disabled) {\n onChange({ target: { value: valueToEmit.id, name: name } });\n\n if (clearOnSelect) setInputText(null);\n\n closeList();\n }\n };\n\n /**\n * Handles hovering and directions\n * @param e - Event\n */\n const handleHover = (e: Event) => {\n e.preventDefault();\n const item = extractItemFromEvent(e);\n setActiveOption(item);\n };\n\n /**\n * Handle keyDown events on the selectList button\n * Responsible for opening and closing the list\n * @param e - KeyboardEvent\n */\n const handleButtonKeyDown = (e: KeyboardEvent) => {\n if (e.key === keys.enter && filterable && showList && textFilter) {\n handleSelect(e);\n } else if (e.key === keys.escape) {\n // When user has focused Select button but not yet moved into Select list - close list and keep focus on the Select Button re. a11y guidelines\n // https://w3c.github.io/aria-practices/examples/disclosure/disclosure-navigation.html\n closeList();\n } else if ([keys.arrowUp, keys.arrowDown, keys.enter].includes(e.key) || (e.key === keys.space && (!filterable || !showList))) {\n e.preventDefault();\n if (!showList) {\n openList();\n } else {\n handleNavigationKeys(e);\n }\n } else if (e.shiftKey && e.key === keys.tab) {\n // Shift-Tab out of Select - close list re. a11y guidelines (above)\n closeList();\n } else if (e.key === keys.tab) {\n closeList();\n }\n };\n\n /**\n * Handles movement with navigation keys and enter\n * Navigates through the list, or select an element, or focus the filter input, or close the menu.\n * @param e - KeyDownEvent\n */\n const handleNavigationKeys = (e: KeyboardEvent) => {\n switch (e.key) {\n case keys.space:\n case keys.enter:\n handleSelect(e);\n break;\n case keys.arrowDown:\n e.preventDefault();\n setNextActive();\n break;\n case keys.arrowUp:\n e.preventDefault();\n setPreviousActive();\n break;\n default:\n }\n };\n\n /**\n * Updates the state with the current text filter value and opens the dropdown\n * @param e - KeyboardEvent\n */\n const handleTextFilter = (e: KeyboardEvent) => {\n const value: string = (e.target as HTMLInputElement).value;\n setInputText(value);\n setTextFilter(value);\n\n // Open the dropdown when user starts typing\n if (!showList) {\n openList();\n }\n\n if (onInput) {\n onInput(value);\n }\n };\n\n /**\n * Toggles the selectList and focuses in either the filter input or in the selectList button\n * @param e - Event\n */\n const toggleList = (e: Event) => {\n e.preventDefault();\n if (!showList) {\n setInputText(null);\n openList();\n } else {\n setInputText(selectedOption.name);\n closeList();\n }\n };\n\n useEffect(() => {\n if (showList) {\n setInputText(null);\n } else {\n setTextFilter(null);\n }\n }, [showList]);\n\n /**\n * Focus on the input if filterable\n */\n useEffect(() => {\n if (showList && filterable && filterInputRef.current) {\n filterInputRef.current.focus();\n }\n onListToggle?.(showList);\n }, [showList]);\n\n useEffect(() => {\n /**\n * Close the select list when clicking outside the list\n * @param e - MouseEvent\n */\n function handleClickOutside(e: MouseEvent) {\n // use composedPath so it can also check when inside a web component\n // if composedPath is not available fallback to e.target\n const clickIsOutside = e.composedPath\n ? !e.composedPath().includes(selectContainerRef.current)\n : !selectContainerRef.current.contains(e.target);\n if (clickIsOutside) {\n closeList();\n }\n }\n\n document.addEventListener('click', handleClickOutside, false);\n\n return () => {\n document.removeEventListener('click', handleClickOutside, false);\n };\n }, [selectContainerRef]);\n\n /**\n * Update status message for screen readers when no options are found\n */\n useEffect(() => {\n // Debounce to avoid announcing on every keystroke\n const SR_ANNOUNCEMENT_DELAY_MS = 500;\n const timer = setTimeout(() => {\n if (filteredItems.length === 0) {\n setStatusMessage(i18n.get('select.noOptionsFound'));\n } else {\n setStatusMessage(i18n.get('select.results', { values: { count: filteredItems.length } }));\n }\n }, SR_ANNOUNCEMENT_DELAY_MS);\n\n return () => clearTimeout(timer);\n }, [showList, filteredItems.length, i18n]);\n\n return (\n <div\n className={cx(['adyen-checkout__dropdown', className, ...classNameModifiers.map(m => `adyen-checkout__dropdown--${m}`)])}\n ref={selectContainerRef}\n >\n <SelectButton\n inputText={inputText}\n id={uniqueId ?? null}\n active={activeOption}\n selected={selectedOption}\n filterInputRef={filterInputRef}\n filterable={filterable}\n isInvalid={isInvalid}\n isValid={isValid}\n onButtonKeyDown={handleButtonKeyDown}\n onInput={handleTextFilter}\n placeholder={placeholder}\n readonly={readonly}\n selectListId={selectListId}\n showList={showList}\n toggleButtonRef={toggleButtonRef}\n toggleList={toggleList}\n disabled={disabled}\n ariaDescribedBy={ariaDescribedBy}\n required={required}\n />\n <SelectList\n active={activeOption}\n filteredItems={filteredItems}\n onHover={handleHover}\n onSelect={handleSelect}\n selected={selectedOption}\n selectListId={selectListId}\n selectListRef={selectListRef}\n showList={showList}\n />\n <div\n key={inputText}\n role=\"status\"\n aria-live=\"polite\"\n // aria-relevant seems to be needed here make make sure a second time we get\n // \"No options found\" we still announce the status message.\n // What happens otherwise is that just the first status message is announced\n // tested on VoiceOver on Chrome\n aria-relevant=\"additions text\"\n className=\"adyen-checkout-sr-panel--sr-only\"\n >\n {statusMessage}\n </div>\n </div>\n );\n}\n\nSelect.defaultProps = {\n className: '',\n classNameModifiers: [],\n filterable: true,\n items: [],\n readonly: false,\n onChange: () => {}\n};\n\nexport default Select;\n"],"names":["Select","items","className","classNameModifiers","filterable","readonly","onChange","onInput","selectedValue","name","isInvalid","isValid","placeholder","uniqueId","disabled","disableTextFilter","clearOnSelect","blurOnClose","onListToggle","required","i18n","useCoreContext","filterInputRef","useRef","selectContainerRef","toggleButtonRef","selectListRef","textFilter","setTextFilter","useState","showList","setShowList","statusMessage","setStatusMessage","selectListId","useMemo","uuid","active","find","i","id","inputText","setInputText","activeOption","setActiveOption","selectedOption","filteredItems","filter","item","toLowerCase","includes","ariaDescribedBy","ARIA_ERROR_SUFFIX","ARIA_CONTEXT_SUFFIX","scrollToItem","nextElement","document","getElementById","simulateFocusScroll","closeList","current","blur","openList","extractItemFromEvent","e","value","currentTarget","getAttribute","listItem","handleSelect","valueToEmit","preventDefault","HTMLElement","some","target","handleNavigationKeys","key","keys","space","enter","arrowDown","length","possibleNextIndex","findIndex","nextIndex","nextItem","setNextActive","arrowUp","setPreviousActive","useEffect","focus","handleClickOutside","composedPath","contains","addEventListener","removeEventListener","timer","setTimeout","get","values","count","clearTimeout","h","div","cx","map","m","ref","SelectButton","selected","onButtonKeyDown","escape","shiftKey","tab","toggleList","SelectList","onHover","onSelect","role","aria-live","aria-relevant","defaultProps"],"mappings":"8mBAaA,SAASA,GAAOC,MACZA,EAAQ,GAAEC,UACVA,EAAY,GAAEC,mBACdA,EAAqB,GAAEC,WACvBA,GAAa,EAAIC,SACjBA,GAAW,EAAKC,SAChBA,EAAW,OAAQC,QACnBA,EAAOC,cACPA,EAAaC,KACbA,EAAIC,UACJA,EAASC,QACTA,EAAOC,YACPA,EAAWC,SACXA,EAAQC,SACRA,EAAQC,kBACRA,EAAiBC,cACjBA,EAAaC,YACbA,EAAWC,aACXA,EAAYC,SACZA,IAEA,MAAMC,KAAEA,GAASC,IACXC,EAAiBC,EAAO,MACxBC,EAAqBD,EAAO,MAC5BE,EAAkBF,EAAO,MACzBG,EAAgBH,EAAO,OACtBI,EAAYC,GAAiBC,EAAiB,OAC9CC,EAAUC,GAAeF,GAAkB,IAC3CG,EAAeC,GAAoBJ,EAAwB,MAC5DK,EAAuBC,EAAQ,IAAM,UAAUC,MAAU,IAEzDC,E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O,GACPI,UAAU,EACVC,SAAU"}
1
+ {"version":3,"file":"Select.js","sources":["../../../../../../src/components/internal/FormFields/Select/Select.tsx"],"sourcesContent":["import { h } from 'preact';\nimport { useEffect, useMemo, useRef, useState } from 'preact/hooks';\nimport cx from 'classnames';\nimport SelectButton from './components/SelectButton';\nimport SelectList from './components/SelectList';\nimport uuid from '../../../../utils/uuid';\nimport { keys } from './constants';\nimport { SelectItem, SelectProps } from './types';\nimport './Select.scss';\nimport { ARIA_CONTEXT_SUFFIX, ARIA_ERROR_SUFFIX } from '../../../../core/Errors/constants';\nimport { simulateFocusScroll } from '../utils';\nimport { useCoreContext } from '../../../../core/Context/CoreProvider';\n\nfunction Select({\n items = [],\n className = '',\n classNameModifiers = [],\n filterable = true,\n readonly = false,\n onChange = () => {},\n onInput,\n selectedValue,\n name,\n isInvalid,\n isValid,\n placeholder,\n uniqueId,\n disabled,\n disableTextFilter,\n clearOnSelect,\n blurOnClose,\n onListToggle,\n required,\n additionalDescribedBy\n}: Readonly<SelectProps>) {\n const { i18n } = useCoreContext();\n const filterInputRef = useRef(null);\n const selectContainerRef = useRef(null);\n const toggleButtonRef = useRef(null);\n const selectListRef = useRef(null);\n const [textFilter, setTextFilter] = useState<string>(null);\n const [showList, setShowList] = useState<boolean>(false);\n const [statusMessage, setStatusMessage] = useState<string | null>(null);\n const selectListId: string = useMemo(() => `select-${uuid()}`, []);\n\n const active: SelectItem = items.find(i => i.id === selectedValue) || ({} as SelectItem);\n\n const [inputText, setInputText] = useState<string>();\n\n const [activeOption, setActiveOption] = useState<SelectItem>(active);\n\n const selectedOption = active;\n\n const filteredItems = disableTextFilter ? items : items.filter(item => !textFilter || item.name.toLowerCase().includes(textFilter.toLowerCase()));\n\n const suffix = isInvalid ? ARIA_ERROR_SUFFIX : ARIA_CONTEXT_SUFFIX;\n const baseDescribedBy = uniqueId ? `${uniqueId}${suffix}` : null;\n const ariaDescribedBy = [baseDescribedBy, additionalDescribedBy].filter(Boolean).join(' ') || null;\n\n const setNextActive = () => {\n if (!filteredItems || filteredItems.length < 1) return;\n const possibleNextIndex = filteredItems.findIndex(listItem => listItem.id === activeOption.id) + 1;\n const nextIndex = possibleNextIndex < filteredItems.length ? possibleNextIndex : 0;\n const nextItem = filteredItems[nextIndex];\n scrollToItem(nextItem);\n setActiveOption(nextItem);\n };\n\n const setPreviousActive = () => {\n if (!filteredItems || filteredItems.length < 1) return;\n const possibleNextIndex = filteredItems.findIndex(listItem => listItem.id === activeOption.id) - 1;\n const nextIndex = possibleNextIndex < 0 ? filteredItems.length - 1 : possibleNextIndex;\n const nextItem = filteredItems[nextIndex];\n scrollToItem(nextItem);\n setActiveOption(nextItem);\n };\n\n const scrollToItem = (item: SelectItem) => {\n if (!item) return;\n const nextElement = document.getElementById(`listItem-${item.id}`);\n simulateFocusScroll(nextElement);\n };\n\n /**\n * Closes the selectList, empties the text filter and focuses the button element\n */\n const closeList = () => {\n //blurs the field when the list is closed, makes for a better UX for most users, needs more testing\n if (blurOnClose) {\n filterInputRef.current.blur();\n }\n setShowList(false);\n };\n\n const openList = () => {\n setShowList(true);\n };\n\n const extractItemFromEvent = (e: Event): SelectItem => {\n const value = (e.currentTarget as HTMLInputElement).getAttribute('data-value');\n return filteredItems.find(listItem => listItem.id == value);\n };\n\n /**\n * Closes the select list and fires an onChange\n * @param e - Event\n */\n const handleSelect = (e: Event) => {\n e.preventDefault();\n\n // We use a local variable here since writing and if statement is cleaner then a long ternary\n let valueToEmit;\n\n if (e.currentTarget instanceof HTMLElement && e.currentTarget.getAttribute('role') === 'option') {\n // This is the main scenario when clicking and item in the list\n // Item comes from the event\n valueToEmit = extractItemFromEvent(e);\n } else if (activeOption.id && filteredItems.some(item => item.id === activeOption.id)) {\n // This is the scenario where a user is using the keyboard to navigate\n // In the case item comes from the visually select item\n valueToEmit = activeOption;\n } else {\n // This is the scenario the user didn't select anything\n if (textFilter) {\n // if we filtering for something then select the first option\n valueToEmit = filteredItems[0];\n } else {\n // This will happen when we want to keep an already chosen option\n // If no active option we should just emit again with the value that was already selected\n valueToEmit = { id: selectedValue };\n }\n }\n\n if (valueToEmit && !valueToEmit.disabled) {\n onChange({ target: { value: valueToEmit.id, name: name } });\n\n if (clearOnSelect) setInputText(null);\n\n closeList();\n }\n };\n\n /**\n * Handles hovering and directions\n * @param e - Event\n */\n const handleHover = (e: Event) => {\n e.preventDefault();\n const item = extractItemFromEvent(e);\n setActiveOption(item);\n };\n\n /**\n * Handle keyDown events on the selectList button\n * Responsible for opening and closing the list\n * @param e - KeyboardEvent\n */\n const handleButtonKeyDown = (e: KeyboardEvent) => {\n if (e.key === keys.enter && filterable && showList && textFilter) {\n handleSelect(e);\n } else if (e.key === keys.escape) {\n // When user has focused Select button but not yet moved into Select list - close list and keep focus on the Select Button re. a11y guidelines\n // https://w3c.github.io/aria-practices/examples/disclosure/disclosure-navigation.html\n closeList();\n } else if ([keys.arrowUp, keys.arrowDown, keys.enter].includes(e.key) || (e.key === keys.space && (!filterable || !showList))) {\n e.preventDefault();\n if (!showList) {\n openList();\n } else {\n handleNavigationKeys(e);\n }\n } else if (e.shiftKey && e.key === keys.tab) {\n // Shift-Tab out of Select - close list re. a11y guidelines (above)\n closeList();\n } else if (e.key === keys.tab) {\n closeList();\n }\n };\n\n /**\n * Handles movement with navigation keys and enter\n * Navigates through the list, or select an element, or focus the filter input, or close the menu.\n * @param e - KeyDownEvent\n */\n const handleNavigationKeys = (e: KeyboardEvent) => {\n switch (e.key) {\n case keys.space:\n case keys.enter:\n handleSelect(e);\n break;\n case keys.arrowDown:\n e.preventDefault();\n setNextActive();\n break;\n case keys.arrowUp:\n e.preventDefault();\n setPreviousActive();\n break;\n default:\n }\n };\n\n /**\n * Updates the state with the current text filter value and opens the dropdown\n * @param e - KeyboardEvent\n */\n const handleTextFilter = (e: KeyboardEvent) => {\n const value: string = (e.target as HTMLInputElement).value;\n setInputText(value);\n setTextFilter(value);\n\n // Open the dropdown when user starts typing\n if (!showList) {\n openList();\n }\n\n if (onInput) {\n onInput(value);\n }\n };\n\n /**\n * Toggles the selectList and focuses in either the filter input or in the selectList button\n * @param e - Event\n */\n const toggleList = (e: Event) => {\n e.preventDefault();\n if (!showList) {\n setInputText(null);\n openList();\n } else {\n setInputText(selectedOption.name);\n closeList();\n }\n };\n\n useEffect(() => {\n if (showList) {\n setInputText(null);\n } else {\n setTextFilter(null);\n }\n }, [showList]);\n\n /**\n * Focus on the input if filterable\n */\n useEffect(() => {\n if (showList && filterable && filterInputRef.current) {\n filterInputRef.current.focus();\n }\n onListToggle?.(showList);\n }, [showList]);\n\n useEffect(() => {\n /**\n * Close the select list when clicking outside the list\n * @param e - MouseEvent\n */\n function handleClickOutside(e: MouseEvent) {\n // use composedPath so it can also check when inside a web component\n // if composedPath is not available fallback to e.target\n const clickIsOutside = e.composedPath\n ? !e.composedPath().includes(selectContainerRef.current)\n : !selectContainerRef.current.contains(e.target);\n if (clickIsOutside) {\n closeList();\n }\n }\n\n document.addEventListener('click', handleClickOutside, false);\n\n return () => {\n document.removeEventListener('click', handleClickOutside, false);\n };\n }, [selectContainerRef]);\n\n /**\n * Update status message for screen readers when no options are found\n */\n useEffect(() => {\n // Debounce to avoid announcing on every keystroke\n const SR_ANNOUNCEMENT_DELAY_MS = 500;\n const timer = setTimeout(() => {\n if (filteredItems.length === 0) {\n setStatusMessage(i18n.get('select.noOptionsFound'));\n } else {\n setStatusMessage(i18n.get('select.results', { values: { count: filteredItems.length } }));\n }\n }, SR_ANNOUNCEMENT_DELAY_MS);\n\n return () => clearTimeout(timer);\n }, [showList, filteredItems.length, i18n]);\n\n return (\n <div\n className={cx(['adyen-checkout__dropdown', className, ...classNameModifiers.map(m => `adyen-checkout__dropdown--${m}`)])}\n ref={selectContainerRef}\n >\n <SelectButton\n inputText={inputText}\n id={uniqueId ?? null}\n active={activeOption}\n selected={selectedOption}\n filterInputRef={filterInputRef}\n filterable={filterable}\n isInvalid={isInvalid}\n isValid={isValid}\n onButtonKeyDown={handleButtonKeyDown}\n onInput={handleTextFilter}\n placeholder={placeholder}\n readonly={readonly}\n selectListId={selectListId}\n showList={showList}\n toggleButtonRef={toggleButtonRef}\n toggleList={toggleList}\n disabled={disabled}\n ariaDescribedBy={ariaDescribedBy}\n required={required}\n />\n <SelectList\n active={activeOption}\n filteredItems={filteredItems}\n onHover={handleHover}\n onSelect={handleSelect}\n selected={selectedOption}\n selectListId={selectListId}\n selectListRef={selectListRef}\n showList={showList}\n />\n <div\n key={inputText}\n role=\"status\"\n aria-live=\"polite\"\n // aria-relevant seems to be needed here make make sure a second time we get\n // \"No options found\" we still announce the status message.\n // What happens otherwise is that just the first status message is announced\n // tested on VoiceOver on Chrome\n aria-relevant=\"additions text\"\n className=\"adyen-checkout-sr-panel--sr-only\"\n >\n {statusMessage}\n </div>\n </div>\n );\n}\n\nSelect.defaultProps = {\n className: '',\n classNameModifiers: [],\n filterable: true,\n items: [],\n readonly: false,\n onChange: () => {}\n};\n\nexport default Select;\n"],"names":["Select","items","className","classNameModifiers","filterable","readonly","onChange","onInput","selectedValue","name","isInvalid","isValid","placeholder","uniqueId","disabled","disableTextFilter","clearOnSelect","blurOnClose","onListToggle","required","additionalDescribedBy","i18n","useCoreContext","filterInputRef","useRef","selectContainerRef","toggleButtonRef","selectListRef","textFilter","setTextFilter","useState","showList","setShowList","statusMessage","setStatusMessage","selectListId","useMemo","uuid","active","find","i","id","inputText","setInputText","activeOption","setActiveOption","selectedOption","filteredItems","filter","item","toLowerCase","includes","ariaDescribedBy","ARIA_ERROR_SUFFIX","ARIA_CONTEXT_SUFFIX","Boolean","join","scrollToItem","nextElement","document","getElementById","simulateFocusScroll","closeList","current","blur","openList","extractItemFromEvent","e","value","currentTarget","getAttribute","listItem","handleSelect","valueToEmit","preventDefault","HTMLElement","some","target","handleNavigationKeys","key","keys","space","enter","arrowDown","length","possibleNextIndex","findIndex","nextIndex","nextItem","setNextActive","arrowUp","setPreviousActive","useEffect","focus","handleClickOutside","composedPath","contains","addEventListener","removeEventListener","timer","setTimeout","get","values","count","clearTimeout","h","div","cx","map","m","ref","SelectButton","selected","onButtonKeyDown","escape","shiftKey","tab","toggleList","SelectList","onHover","onSelect","role","aria-live","aria-relevant","defaultProps"],"mappings":"8mBAaA,SAASA,GAAOC,MACZA,EAAQ,GAAEC,UACVA,EAAY,GAAEC,mBACdA,EAAqB,GAAEC,WACvBA,GAAa,EAAIC,SACjBA,GAAW,EAAKC,SAChBA,EAAW,OAAQC,QACnBA,EAAOC,cACPA,EAAaC,KACbA,EAAIC,UACJA,EAASC,QACTA,EAAOC,YACPA,EAAWC,SACXA,EAAQC,SACRA,EAAQC,kBACRA,EAAiBC,cACjBA,EAAaC,YACbA,EAAWC,aACXA,EAAYC,SACZA,EAAQC,sBACRA,IAEA,MAAMC,KAAEA,GAASC,IACXC,EAAiBC,EAAO,MACxBC,EAAqBD,EAAO,MAC5BE,EAAkBF,EAAO,MACzBG,EAAgBH,EAAO,OACtBI,EAAYC,GAAiBC,EAAiB,OAC9CC,EAAUC,GAAeF,GAAkB,IAC3CG,EAAeC,GAAoBJ,EAAwB,MAC5DK,EAAuBC,EAAQ,IAAM,UAAUC,MAAU,IAEzDC,EAAqBrC,EAAMsC,KAAKC,GAAKA,EAAEC,KAAOjC,IAAmB,CAAA,GAEhEkC,EAAWC,GAAgBb,KAE3Bc,EAAcC,GAAmBf,EAAqBQ,GAEvDQ,EAAiBR,EAEjBS,EAAgBhC,EAAoBd,EAAQA,EAAM+C,OAAOC,IAASrB,GAAcqB,EAAKxC,KAAKyC,cAAcC,SAASvB,EAAWsB,gBAI5HE,EAAkB,CADAvC,EAAW,GAAGA,IADvBH,EAAY2C,EAAoBC,IACa,KAClBlC,GAAuB4B,OAAOO,SAASC,KAAK,MAAQ,KAoBxFC,GAAgBR,IAClB,IAAKA,EAAM,OACX,MAAMS,EAAcC,SAASC,eAAe,YAAYX,EAAKR,MAC7DoB,EAAoBH,IAMlBI,GAAY,KAEV7C,GACAM,EAAewC,QAAQC,OAE3BhC,GAAY,IAGViC,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BACG3C,EAGD+C,GAAqBX,GAFrBF,OA8IA1D,QAvGc4D,IACtB,MAAMC,EAAiBD,EAAEU,OAA4BT,MACrDzB,EAAayB,GACbvC,EAAcuC,GAGTrC,GACDkC,KAGA1D,GACAA,EAAQ6D,IA6FJxD,YAAaA,EACbP,SAAUA,EACV8B,aAAcA,EACdJ,SAAUA,EACVL,gBAAiBA,EACjB2F,WA1FQlD,IAChBA,EAAEO,iBACG3C,GAIDY,EAAaG,EAAerC,MAC5BqD,OAJAnB,EAAa,MACbsB,OAuFInD,SAAUA,EACVsC,gBAAiBA,EACjBjC,SAAUA,IAEdsF,EAACa,EAAAA,CACGhF,OAAQM,EACRG,cAAeA,EACfwE,QAjLSpD,IACjBA,EAAEO,iBACF,MAAMzB,EAAOiB,GAAqBC,GAClCtB,EAAgBI,IA+KRuE,SAAUhD,GACVwC,SAAUlE,EACVX,aAAcA,EACdR,cAAeA,EACfI,SAAUA,IAEd0E,EAACC,MAAAA,CACG3B,IAAKrC,EACL+E,KAAK,SACLC,YAAU,SAKVC,gBAAc,iBACdzH,UAAU,oCAET+B,GAIjB,CAEAjC,EAAO4H,aAAe,CAClB1H,UAAW,GACXC,mBAAoB,GACpBC,YAAY,EACZH,MAAO,GACPI,UAAU,EACVC,SAAU"}
@@ -1,2 +1,2 @@
1
- import{createElement as e,Fragment as t}from"../../../../../external/preact/dist/preact.js";import n from"../../../../../_virtual/index.js";import o from"../../../Img/Img.js";import{useMemo as r}from"../../../../../external/preact/hooks/dist/hooks.js";function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(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 n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function c(e,t){if(null==e)return{};var n,o,r,a={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(Object(e)),r=0;r<n.length;r++)o=n[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o]);return a}if(a=function(e,t){if(null==e)return{};var n,o,r={},a=Object.getOwnPropertyNames(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),r=0;r<n.length;r++)o=n[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o]);return a}function l(t){let{filterable:n,toggleButtonRef:o,showList:r,selectListId:l}=t,d=c(t,["filterable","toggleButtonRef","showList","selectListId"]);if(n){const{id:t}=d,n=c(d,["id"]);return e("div",i(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){a(e,t,n[t])})}return e}({},n),{ref:o}))}return e("button",{role:"combobox",type:"button",id:d.id,className:d.className,"aria-haspopup":"listbox","aria-expanded":r,"aria-controls":l,"aria-activedescendant":d["aria-activedescendant"]||void 0,disabled:d.disabled,"aria-disabled":d.readonly,"aria-describedby":d.ariaDescribedBy,"aria-labelledby":d.id?`${d.id}-label ${d.id}-value`:void 0,onClick:d.onClick,onKeyDown:d.onKeyDown,ref:o},d.children)}function d(a){const{active:i,selected:c,inputText:d,readonly:s,showList:u,required:p}=a,b=r(()=>{const e=c.selectedOptionName||c.name;return!0!==("string"==typeof e&&""!==e.trim())},[c,a.placeholder]),f=c.selectedOptionName||c.name||a.placeholder||"",y=u?null!=d?d:"":f,_=s?null:a.filterable?e=>{e.preventDefault(),document.activeElement===a.filterInputRef.current?a.showList||a.toggleList(e):a.filterInputRef.current&&a.filterInputRef.current.focus()}:a.toggleList,m=i.id?`listItem-${i.id}`:"";return e(l,{className:n({"adyen-checkout__dropdown__button":!0,"adyen-checkout__dropdown__button--readonly":s,"adyen-checkout__dropdown__button--active":u,"adyen-checkout__dropdown__button--invalid":a.isInvalid,"adyen-checkout__dropdown__button--valid":a.isValid,"adyen-checkout__dropdown__button--disabled":c.disabled}),disabled:a.disabled,filterable:a.filterable,onClick:_,onKeyDown:s?null:a.onButtonKeyDown,toggleButtonRef:a.toggleButtonRef,id:a.id,showList:u,selectListId:a.selectListId,"aria-activedescendant":!a.filterable&&u&&m||void 0},a.filterable?e(t,null,!u&&c.icon&&e(o,{className:"adyen-checkout__dropdown__button__icon",src:c.icon,alt:c.name}),e("input",{value:y,"aria-autocomplete":"list","aria-controls":a.selectListId,"aria-expanded":u,"aria-owns":a.selectListId,autoComplete:"off",className:n("adyen-checkout__filter-input",{"adyen-checkout__filter-input--placeholder":!u&&b}),onInput:a.onInput,ref:a.filterInputRef,role:"combobox","aria-activedescendant":m,type:"text",readOnly:a.readonly,"aria-disabled":a.readonly,id:a.id,"aria-describedby":a.ariaDescribedBy,required:p}),!u&&c.secondaryText&&e("span",{className:"adyen-checkout__dropdown__button__secondary-text"},c.secondaryText)):e(t,null,c.icon&&e(o,{className:"adyen-checkout__dropdown__button__icon",src:c.icon,alt:c.name}),e("span",{id:a.id?`${a.id}-value`:void 0,className:n("adyen-checkout__dropdown__button__text",{"adyen-checkout__dropdown__button__text-placeholder":b})},f),c.secondaryText&&e("span",{className:"adyen-checkout__dropdown__button__secondary-text"},c.secondaryText)))}export{d as default};
1
+ import{createElement as e,Fragment as t}from"../../../../../external/preact/dist/preact.js";import n from"../../../../../_virtual/index.js";import o from"../../../Img/Img.js";import{useMemo as r}from"../../../../../external/preact/hooks/dist/hooks.js";function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(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 n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t}(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function c(e,t){if(null==e)return{};var n,o,r,a={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(n=Reflect.ownKeys(Object(e)),r=0;r<n.length;r++)o=n[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o]);return a}if(a=function(e,t){if(null==e)return{};var n,o,r={},a=Object.getOwnPropertyNames(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n]);return r}(e,t),Object.getOwnPropertySymbols)for(n=Object.getOwnPropertySymbols(e),r=0;r<n.length;r++)o=n[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(a[o]=e[o]);return a}function l(t){let{filterable:n,toggleButtonRef:o,showList:r,selectListId:l}=t,d=c(t,["filterable","toggleButtonRef","showList","selectListId"]);if(n){const{id:t}=d,n=c(d,["id"]);return e("div",i(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){a(e,t,n[t])})}return e}({},n),{ref:o}))}return e("button",{role:"combobox",type:"button",id:d.id,className:d.className,"aria-haspopup":"listbox","aria-expanded":r,"aria-controls":l,"aria-activedescendant":d["aria-activedescendant"]||void 0,disabled:d.disabled,"aria-disabled":d.readonly,"aria-describedby":d["aria-describedby"],"aria-labelledby":d.id?`${d.id}-label ${d.id}-value`:void 0,onClick:d.onClick,onKeyDown:d.onKeyDown,ref:o},d.children)}function d(a){const{active:i,selected:c,inputText:d,readonly:s,showList:u,required:p}=a,b=r(()=>{const e=c.selectedOptionName||c.name;return!0!==("string"==typeof e&&""!==e.trim())},[c,a.placeholder]),f=c.selectedOptionName||c.name||a.placeholder||"",y=u?null!=d?d:"":f,_=s?null:a.filterable?e=>{e.preventDefault(),document.activeElement===a.filterInputRef.current?a.showList||a.toggleList(e):a.filterInputRef.current&&a.filterInputRef.current.focus()}:a.toggleList,m=i.id?`listItem-${i.id}`:"";return e(l,{className:n({"adyen-checkout__dropdown__button":!0,"adyen-checkout__dropdown__button--readonly":s,"adyen-checkout__dropdown__button--active":u,"adyen-checkout__dropdown__button--invalid":a.isInvalid,"adyen-checkout__dropdown__button--valid":a.isValid,"adyen-checkout__dropdown__button--disabled":c.disabled}),disabled:a.disabled,filterable:a.filterable,onClick:_,onKeyDown:s?null:a.onButtonKeyDown,toggleButtonRef:a.toggleButtonRef,id:a.id,showList:u,selectListId:a.selectListId,"aria-activedescendant":!a.filterable&&u&&m||void 0,"aria-describedby":a.ariaDescribedBy},a.filterable?e(t,null,!u&&c.icon&&e(o,{className:"adyen-checkout__dropdown__button__icon",src:c.icon,alt:c.name}),e("input",{value:y,"aria-autocomplete":"list","aria-controls":a.selectListId,"aria-expanded":u,"aria-owns":a.selectListId,autoComplete:"off",className:n("adyen-checkout__filter-input",{"adyen-checkout__filter-input--placeholder":!u&&b}),onInput:a.onInput,ref:a.filterInputRef,role:"combobox","aria-activedescendant":m,type:"text",readOnly:a.readonly,"aria-disabled":a.readonly,id:a.id,"aria-describedby":a.ariaDescribedBy,required:p}),!u&&c.secondaryText&&e("span",{className:"adyen-checkout__dropdown__button__secondary-text"},c.secondaryText)):e(t,null,c.icon&&e(o,{className:"adyen-checkout__dropdown__button__icon",src:c.icon,alt:c.name}),e("span",{id:a.id?`${a.id}-value`:void 0,className:n("adyen-checkout__dropdown__button__text",{"adyen-checkout__dropdown__button__text-placeholder":b})},f),c.secondaryText&&e("span",{className:"adyen-checkout__dropdown__button__secondary-text"},c.secondaryText)))}export{d as default};
2
2
  //# sourceMappingURL=SelectButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectButton.js","sources":["../../../../../../../src/components/internal/FormFields/Select/components/SelectButton.tsx"],"sourcesContent":["import { h, Fragment } from 'preact';\nimport cx from 'classnames';\nimport { SelectButtonProps } from '../types';\nimport Img from '../../../Img';\nimport { useMemo } from 'preact/hooks';\nimport classnames from 'classnames';\n\nfunction SelectButtonElement({ filterable, toggleButtonRef, showList, selectListId, ...props }) {\n if (filterable) {\n // Even if passed, we can't add an id to this div since it is not allowed to associate a div with a label element\n const { id, ...strippedProps } = props;\n return <div {...strippedProps} ref={toggleButtonRef} />;\n }\n\n return (\n <button\n role=\"combobox\"\n type=\"button\"\n id={props.id}\n className={props.className}\n aria-haspopup=\"listbox\"\n aria-expanded={showList}\n aria-controls={selectListId}\n aria-activedescendant={props['aria-activedescendant'] || undefined}\n disabled={props.disabled}\n aria-disabled={props.readonly}\n aria-describedby={props.ariaDescribedBy}\n aria-labelledby={props.id ? `${props.id}-label ${props.id}-value` : undefined}\n onClick={props.onClick}\n onKeyDown={props.onKeyDown}\n ref={toggleButtonRef}\n >\n {props.children}\n </button>\n );\n}\n\nfunction SelectButton(props: Readonly<SelectButtonProps>) {\n const { active, selected, inputText, readonly, showList, required } = props;\n\n const isShowingPlaceholder = useMemo(() => {\n const displayText = selected.selectedOptionName || selected.name;\n const isValidValue = typeof displayText === 'string' && displayText.trim() !== '';\n return isValidValue !== true;\n }, [selected, props.placeholder]);\n\n // display fallback order\n const displayText = selected.selectedOptionName || selected.name || props.placeholder || '';\n // displayInputText only used for the text input for the filter\n // display the \"typed\" filter text when showing the dropdown,\n // hide it and show the \"selected\" value when collapsed\n // When list is open, show user's typed input (or empty); otherwise show selected value\n const textWhenListOpen = inputText ?? '';\n const displayInputText = showList ? textWhenListOpen : displayText;\n\n const setFocus = (e: Event) => {\n e.preventDefault();\n if (document.activeElement === props.filterInputRef.current) {\n if (!props.showList) {\n props.toggleList(e);\n }\n } else if (props.filterInputRef.current) props.filterInputRef.current.focus();\n };\n\n // 1. If readonly we ignore the click action\n // 2. If filterable we want to show the list and focus on the input\n // 3. Otherwise we just toggle the list\n const onClickHandler = readonly ? null : props.filterable ? setFocus : props.toggleList;\n\n // check COWEB-1301 [Investigate] Drop-in Accessibility - ADA Compliance questions\n const currentSelectedItemId = active.id ? `listItem-${active.id}` : '';\n\n return (\n <SelectButtonElement\n className={cx({\n 'adyen-checkout__dropdown__button': true,\n 'adyen-checkout__dropdown__button--readonly': readonly,\n 'adyen-checkout__dropdown__button--active': showList,\n 'adyen-checkout__dropdown__button--invalid': props.isInvalid,\n 'adyen-checkout__dropdown__button--valid': props.isValid,\n 'adyen-checkout__dropdown__button--disabled': selected.disabled\n })}\n disabled={props.disabled}\n filterable={props.filterable}\n onClick={onClickHandler}\n onKeyDown={!readonly ? props.onButtonKeyDown : null}\n toggleButtonRef={props.toggleButtonRef}\n id={props.id}\n showList={showList}\n selectListId={props.selectListId}\n aria-activedescendant={!props.filterable && showList ? currentSelectedItemId || undefined : undefined}\n >\n {!props.filterable ? (\n <Fragment>\n {selected.icon && <Img className=\"adyen-checkout__dropdown__button__icon\" src={selected.icon} alt={selected.name} />}\n <span\n id={props.id ? `${props.id}-value` : undefined}\n className={classnames('adyen-checkout__dropdown__button__text', {\n 'adyen-checkout__dropdown__button__text-placeholder': isShowingPlaceholder\n })}\n >\n {displayText}\n </span>\n {selected.secondaryText && <span className=\"adyen-checkout__dropdown__button__secondary-text\">{selected.secondaryText}</span>}\n </Fragment>\n ) : (\n <Fragment>\n {!showList && selected.icon && <Img className=\"adyen-checkout__dropdown__button__icon\" src={selected.icon} alt={selected.name} />}\n <input\n value={displayInputText}\n aria-autocomplete=\"list\"\n aria-controls={props.selectListId}\n aria-expanded={showList}\n aria-owns={props.selectListId}\n autoComplete=\"off\"\n className={classnames('adyen-checkout__filter-input', {\n 'adyen-checkout__filter-input--placeholder': !showList && isShowingPlaceholder\n })}\n onInput={props.onInput}\n ref={props.filterInputRef}\n role=\"combobox\"\n aria-activedescendant={currentSelectedItemId}\n type=\"text\"\n readOnly={props.readonly}\n aria-disabled={props.readonly}\n id={props.id}\n aria-describedby={props.ariaDescribedBy}\n required={required}\n />\n {!showList && selected.secondaryText && (\n <span className=\"adyen-checkout__dropdown__button__secondary-text\">{selected.secondaryText}</span>\n )}\n </Fragment>\n )}\n </SelectButtonElement>\n );\n}\n\nexport default SelectButton;\n"],"names":["SelectButtonElement","_0","filterable","toggleButtonRef","showList","selectListId","props","id","strippedProps","h","div","ref","button","role","type","className","aria-haspopup","aria-expanded","aria-controls","aria-activedescendant","undefined","disabled","aria-disabled","readonly","aria-describedby","ariaDescribedBy","aria-labelledby","onClick","onKeyDown","children","SelectButton","active","selected","inputText","required","isShowingPlaceholder","useMemo","displayText","selectedOptionName","name","trim","placeholder","displayInputText","onClickHandler","e","preventDefault","document","activeElement","filterInputRef","current","toggleList","focus","currentSelectedItemId","cx","isInvalid","isValid","onButtonKeyDown","Fragment","icon","Img","src","alt","input","value","aria-autocomplete","aria-owns","autoComplete","classnames","onInput","readOnly","secondaryText","span"],"mappings":"01CAOA,SAASA,EAAoBC,OAAAC,WAAEA,EAAUC,gBAAEA,EAAeC,SAAEA,EAAQC,aAAEA,GAAwBJ,EAAPK,EAAAA,EAAAA,EAAAA,4DACnF,GAAIJ,EAAY,CAEZ,MAAMK,GAAEA,GAAyBD,EAAlBE,EAAAA,EAAkBF,EAAAA,QACjC,OAAOG,EAACC,MAAAA,oUAAAA,CAAAA,CAAAA,EAAQF,GAAAA,CAAeG,IAAKR,IACxC,CAEA,OACIM,EAACG,SAAAA,CACGC,KAAK,WACLC,KAAK,SACLP,GAAID,EAAMC,GACVQ,UAAWT,EAAMS,UACjBC,gBAAc,UACdC,gBAAeb,EACfc,gBAAeb,EACfc,wBAAuBb,EAAM,+BAA4Bc,EACzDC,S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wBb,EAAMJ,YAAcE,GAAWgD,QAAqChC,GAE1Fd,EAAMJ,WAcJO,EAACgD,EAAAA,MACKrD,GAAY4B,EAAS0B,MAAQjD,EAACkD,EAAAA,CAAI5C,UAAU,yCAAyC6C,IAAK5B,EAAS0B,KAAMG,IAAK7B,EAASO,OACzH9B,EAACqD,QAAAA,CACGC,MAAOrB,EACPsB,oBAAkB,OAClB9C,gBAAeZ,EAAMD,aACrBY,gBAAeb,EACf6D,YAAW3D,EAAMD,aACjB6D,aAAa,MACbnD,UAAWoD,EAAW,+BAAgC,CAClD,6CAA8C/D,GAAY+B,IAE9DiC,QAAS9D,EAAM8D,QACfzD,IAAKL,EAAM0C,eACXnC,KAAK,WACLM,wBAAuBiC,EACvBtC,KAAK,OACLuD,SAAU/D,EAAMiB,SAChBD,gBAAehB,EAAMiB,SACrBhB,GAAID,EAAMC,GACViB,mBAAkBlB,EAAMmB,gBACxBS,SAAUA,KAEZ9B,GAAY4B,EAASsC,eACnB7D,EAAC8D,OAAAA,CAAKxD,UAAU,oDAAoDiB,EAASsC,gBArCrF7D,EAACgD,OACIzB,EAAS0B,MAAQjD,EAACkD,EAAAA,CAAI5C,UAAU,yCAAyC6C,IAAK5B,EAAS0B,KAAMG,IAAK7B,EAASO,OAC5G9B,EAAC8D,OAAAA,CACGhE,GAAID,EAAMC,GAAK,GAAGD,EAAMC,gBAAaa,EACrCL,UAAWoD,EAAW,yCAA0C,CAC5D,qDAAsDhC,KAGzDE,GAEJL,EAASsC,eAAiB7D,EAAC8D,OAAAA,CAAKxD,UAAU,oDAAoDiB,EAASsC,gBAiC5H"}
1
+ {"version":3,"file":"SelectButton.js","sources":["../../../../../../../src/components/internal/FormFields/Select/components/SelectButton.tsx"],"sourcesContent":["import { h, Fragment, Ref } from 'preact';\nimport cx from 'classnames';\nimport { SelectButtonElementProps, SelectButtonProps } from '../types';\nimport Img from '../../../Img';\nimport { useMemo } from 'preact/hooks';\nimport classnames from 'classnames';\n\nfunction SelectButtonElement({ filterable, toggleButtonRef, showList, selectListId, ...props }: Readonly<SelectButtonElementProps>) {\n if (filterable) {\n // Even if passed, we can't add an id to this div since it is not allowed to associate a div with a label element\n const { id, ...strippedProps } = props;\n return <div {...strippedProps} ref={toggleButtonRef as Ref<HTMLDivElement>} />;\n }\n\n return (\n <button\n role=\"combobox\"\n type=\"button\"\n id={props.id}\n className={props.className}\n aria-haspopup=\"listbox\"\n aria-expanded={showList}\n aria-controls={selectListId}\n aria-activedescendant={props['aria-activedescendant'] || undefined}\n disabled={props.disabled}\n aria-disabled={props.readonly}\n aria-describedby={props['aria-describedby']}\n aria-labelledby={props.id ? `${props.id as string}-label ${props.id as string}-value` : undefined}\n onClick={props.onClick}\n onKeyDown={props.onKeyDown}\n ref={toggleButtonRef as Ref<HTMLButtonElement>}\n >\n {props.children}\n </button>\n );\n}\n\nfunction SelectButton(props: Readonly<SelectButtonProps>) {\n const { active, selected, inputText, readonly, showList, required } = props;\n\n const isShowingPlaceholder = useMemo(() => {\n const displayText = selected.selectedOptionName || selected.name;\n const isValidValue = typeof displayText === 'string' && displayText.trim() !== '';\n return isValidValue !== true;\n }, [selected, props.placeholder]);\n\n // display fallback order\n const displayText = selected.selectedOptionName || selected.name || props.placeholder || '';\n // displayInputText only used for the text input for the filter\n // display the \"typed\" filter text when showing the dropdown,\n // hide it and show the \"selected\" value when collapsed\n // When list is open, show user's typed input (or empty); otherwise show selected value\n const textWhenListOpen = inputText ?? '';\n const displayInputText = showList ? textWhenListOpen : displayText;\n\n const setFocus = (e: Event) => {\n e.preventDefault();\n if (document.activeElement === props.filterInputRef.current) {\n if (!props.showList) {\n props.toggleList(e);\n }\n } else if (props.filterInputRef.current) props.filterInputRef.current.focus();\n };\n\n // 1. If readonly we ignore the click action\n // 2. If filterable we want to show the list and focus on the input\n // 3. Otherwise we just toggle the list\n const onClickHandler = readonly ? null : props.filterable ? setFocus : props.toggleList;\n\n // check COWEB-1301 [Investigate] Drop-in Accessibility - ADA Compliance questions\n const currentSelectedItemId = active.id ? `listItem-${active.id}` : '';\n\n return (\n <SelectButtonElement\n className={cx({\n 'adyen-checkout__dropdown__button': true,\n 'adyen-checkout__dropdown__button--readonly': readonly,\n 'adyen-checkout__dropdown__button--active': showList,\n 'adyen-checkout__dropdown__button--invalid': props.isInvalid,\n 'adyen-checkout__dropdown__button--valid': props.isValid,\n 'adyen-checkout__dropdown__button--disabled': selected.disabled\n })}\n disabled={props.disabled}\n filterable={props.filterable}\n onClick={onClickHandler}\n onKeyDown={!readonly ? props.onButtonKeyDown : null}\n toggleButtonRef={props.toggleButtonRef}\n id={props.id}\n showList={showList}\n selectListId={props.selectListId}\n aria-activedescendant={!props.filterable && showList ? currentSelectedItemId || undefined : undefined}\n aria-describedby={props.ariaDescribedBy}\n >\n {!props.filterable ? (\n <Fragment>\n {selected.icon && <Img className=\"adyen-checkout__dropdown__button__icon\" src={selected.icon} alt={selected.name} />}\n <span\n id={props.id ? `${props.id}-value` : undefined}\n className={classnames('adyen-checkout__dropdown__button__text', {\n 'adyen-checkout__dropdown__button__text-placeholder': isShowingPlaceholder\n })}\n >\n {displayText}\n </span>\n {selected.secondaryText && <span className=\"adyen-checkout__dropdown__button__secondary-text\">{selected.secondaryText}</span>}\n </Fragment>\n ) : (\n <Fragment>\n {!showList && selected.icon && <Img className=\"adyen-checkout__dropdown__button__icon\" src={selected.icon} alt={selected.name} />}\n <input\n value={displayInputText}\n aria-autocomplete=\"list\"\n aria-controls={props.selectListId}\n aria-expanded={showList}\n aria-owns={props.selectListId}\n autoComplete=\"off\"\n className={classnames('adyen-checkout__filter-input', {\n 'adyen-checkout__filter-input--placeholder': !showList && isShowingPlaceholder\n })}\n onInput={props.onInput}\n ref={props.filterInputRef}\n role=\"combobox\"\n aria-activedescendant={currentSelectedItemId}\n type=\"text\"\n readOnly={props.readonly}\n aria-disabled={props.readonly}\n id={props.id}\n aria-describedby={props.ariaDescribedBy}\n required={required}\n />\n {!showList && selected.secondaryText && (\n <span className=\"adyen-checkout__dropdown__button__secondary-text\">{selected.secondaryText}</span>\n )}\n </Fragment>\n )}\n </SelectButtonElement>\n );\n}\n\nexport default SelectButton;\n"],"names":["SelectButtonElement","_0","filterable","toggleButtonRef","showList","selectListId","props","id","strippedProps","h","div","ref","button","role","type","className","aria-haspopup","aria-expanded","aria-controls","aria-activedescendant","undefined","disabled","aria-disabled","readonly","aria-describedby","aria-labelledby","onClick","onKeyDown","children","SelectButton","active","selected","inputText","required","isShowingPlaceholder","useMemo","displayText","selectedOptionName","name","trim","placeholder","displayInputText","onClickHandler","e","preventDefault","document","activeElement","filterInputRef","current","toggleList","focus","currentSelectedItemId","cx","isInvalid","isValid","onButtonKeyDown","ariaDescribedBy","Fragment","icon","Img","src","alt","input","value","aria-autocomplete","aria-owns","autoComplete","classnames","onInput","readOnly","secondaryText","span"],"mappings":"01CAOA,SAASA,EAAoBC,OAAAC,WAAEA,EAAUC,gBAAEA,EAAeC,SAAEA,EAAQC,aAAEA,GAA4DJ,EAA3CK,EAAAA,EAAAA,EAAAA,4DACnF,GAAIJ,EAAY,CAEZ,MAAMK,GAAEA,GAAyBD,EAAlBE,EAAAA,EAAkBF,EAAAA,QACjC,OAAOG,EAACC,MAAAA,oUAAAA,CAAAA,CAAAA,EAAQF,GAAAA,CAAeG,IAAKR,IACxC,CAEA,OACIM,EAACG,SAAAA,CACGC,KAAK,WACLC,KAAK,SACLP,GAAID,EAAMC,GACVQ,UAAWT,EAAMS,UACjBC,gBAAc,UACdC,gBAAeb,EACfc,gBAAeb,EACfc,wBAAuBb,EAAM,+BAA4Bc,EACzDC,SAAUf,EAAMe,SAChBC,gBAAehB,EAAMiB,SACrBC,mBAAkBlB,EAAM,oBACxBmB,kBAAiBnB,EAAMC,GAAK,GAAGD,EAAMC,YAAsBD,EAAMC,gBAAuBa,EACxFM,QAASpB,EAAMoB,QACfC,UAAWrB,EAAMqB,UACjBhB,IAAKR,GAEJG,EAAMsB,SAGnB,CAEA,SAASC,EAAavB,GAClB,MAAMwB,OAA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,EACPuB,oBAAkB,OAClB9C,gBAAeZ,EAAMD,aACrBY,gBAAeb,EACf6D,YAAW3D,EAAMD,aACjB6D,aAAa,MACbnD,UAAWoD,EAAW,+BAAgC,CAClD,6CAA8C/D,GAAY8B,IAE9DkC,QAAS9D,EAAM8D,QACfzD,IAAKL,EAAMyC,eACXlC,KAAK,WACLM,wBAAuBgC,EACvBrC,KAAK,OACLuD,SAAU/D,EAAMiB,SAChBD,gBAAehB,EAAMiB,SACrBhB,GAAID,EAAMC,GACViB,mBAAkBlB,EAAMkD,gBACxBvB,SAAUA,KAEZ7B,GAAY2B,EAASuC,eACnB7D,EAAC8D,OAAAA,CAAKxD,UAAU,oDAAoDgB,EAASuC,gBArCrF7D,EAACgD,OACI1B,EAAS2B,MAAQjD,EAACkD,EAAAA,CAAI5C,UAAU,yCAAyC6C,IAAK7B,EAAS2B,KAAMG,IAAK9B,EAASO,OAC5G7B,EAAC8D,OAAAA,CACGhE,GAAID,EAAMC,GAAK,GAAGD,EAAMC,gBAAaa,EACrCL,UAAWoD,EAAW,yCAA0C,CAC5D,qDAAsDjC,KAGzDE,GAEJL,EAASuC,eAAiB7D,EAAC8D,OAAAA,CAAKxD,UAAU,oDAAoDgB,EAASuC,gBAiC5H"}
@@ -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.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.40.2","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
@@ -1,2 +1,2 @@
1
- import{DEFAULT_LOCALE as t,LOCALE_NAME_MIN_LENGTH as n,LOCALE_NAME_MAX_LENGTH as e}from"./constants.js";const r=t=>t.toLowerCase().substring(0,2),o=t=>Boolean(t)&&t.length>=n&&t.length<=e;function l(t,n){return t&&"string"==typeof t&&n.find(n=>r(n)===r(t))||null}function s(t){const n=t.replace("_","-");if(/^([a-z]{2})(-)([A-Z]{2})$/.test(n))return n;const[e,r]=n.split("-");if(!e||!r)return null;const o=[e.toLowerCase(),r.toUpperCase()].join("-");return 5===o.length?o:null}function u(n,e){if(!o(n))return t;const r=s(n);return r&&e.includes(r)?r:l(r||n,e)||t}function c(t={}){return Object.keys(t).reduce((n,e)=>{if(!o(e))return n;return n[s(e)||r(e)]=t[e],n},{})}const a=(t,n)=>t.replace(/%{(\w+)}/g,(t,e)=>n[e]||""),i=(t,n,e={})=>{const{values:r={},count:o=0}=e,l=`${n}__plural`,s=t=>`${n}__${t}`;return Object.prototype.hasOwnProperty.call(t,s(o))?a(t[s(o)],r):Object.prototype.hasOwnProperty.call(t,l)&&o>1?a(t[l],r):Object.prototype.hasOwnProperty.call(t,n)?a(t[n],r):null},p=(t,n)=>{const e=t.split(/%#(.*?)%#/gm);if(n.length!==Math.floor(e.length/2))throw Error("The number of functions provided does not match the number of elements in the translation string.");return e.map((t,e)=>{const r=Math.floor(e/2);return e%2==0?t:n[r](t)})};export{c as formatCustomTranslations,s as formatLocaleToLanguageCountryLocale,i as getTranslation,p as interpolateElement,l as matchLocale,u as parseLocale};
1
+ import{DEFAULT_LOCALE as t,LOCALE_NAME_MIN_LENGTH as n,LOCALE_NAME_MAX_LENGTH as e}from"./constants.js";const r=t=>t.toLowerCase().substring(0,2),o=t=>Boolean(t)&&t.length>=n&&t.length<=e;function s(t,n){if(!t||"string"!=typeof t)return null;const e=t.toLowerCase(),o=n.find(t=>t.toLowerCase()===e);if(o)return o;const s=r(t);return n.find(t=>r(t)===s)||null}function l(t){const n=t.replace("_","-");if(/^([a-z]{2})(-)([A-Z]{2})$/.test(n))return n;const[e,r]=n.split("-");if(!e||!r)return null;const o=[e.toLowerCase(),r.toUpperCase()].join("-");return 5===o.length?o:null}function u(n,e){if(!o(n))return t;const r=l(n);return r&&e.includes(r)?r:s(r||n,e)||t}function c(t={}){return Object.keys(t).reduce((n,e)=>{if(!o(e))return n;return n[l(e)||r(e)]=t[e],n},{})}const i=(t,n)=>t.replace(/%{(\w+)}/g,(t,e)=>n[e]||""),a=(t,n,e={})=>{const{values:r={},count:o=0}=e,s=`${n}__plural`,l=t=>`${n}__${t}`;return Object.prototype.hasOwnProperty.call(t,l(o))?i(t[l(o)],r):Object.prototype.hasOwnProperty.call(t,s)&&o>1?i(t[s],r):Object.prototype.hasOwnProperty.call(t,n)?i(t[n],r):null},p=(t,n)=>{const e=t.split(/%#(.*?)%#/gm);if(n.length!==Math.floor(e.length/2))throw Error("The number of functions provided does not match the number of elements in the translation string.");return e.map((t,e)=>{const r=Math.floor(e/2);return e%2==0?t:n[r](t)})};export{c as formatCustomTranslations,l as formatLocaleToLanguageCountryLocale,a as getTranslation,p as interpolateElement,s as matchLocale,u as parseLocale};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/language/utils.ts"],"sourcesContent":["import { h } from 'preact';\nimport { CustomTranslations } from './types';\nimport { DEFAULT_LOCALE, LOCALE_NAME_MAX_LENGTH, LOCALE_NAME_MIN_LENGTH } from './constants';\n\n/**\n * @description Convert to ISO 639-1\n */\nconst toTwoLetterCode = (locale: string): string => locale.toLowerCase().substring(0, 2);\n\n/**\n * @description Checks if the locale length is valid\n * @param locale - The locale to check\n * @returns true if the locale length is valid, false otherwise\n */\nconst isLocaleLenghtValid = (locale: string): boolean =>\n Boolean(locale) && locale.length >= LOCALE_NAME_MIN_LENGTH && locale.length <= LOCALE_NAME_MAX_LENGTH;\n\n/**\n * Matches a string with one of the locales\n *\n * @param locale - The locale to match\n * @param supportedLocales - Array of possible locales\n *\n * @example\n * matchLocale('en-GB', ['en-US', 'es-ES']);\n * // returns 'en-US'\n */\nexport function matchLocale(locale: string, supportedLocales: readonly string[]): string | null {\n if (!locale || typeof locale !== 'string') return null;\n return supportedLocales.find(supLoc => toTwoLetterCode(supLoc) === toTwoLetterCode(locale)) || null;\n}\n\n/**\n * Returns a locale with the proper format.\n *\n * @param localeParam - Locale example: 'En_us' or 'en-US'\n *\n * @example\n * formatLocaleToLanguageCountryLocale('En_us');\n * // returns 'en-US'\n */\nexport function formatLocaleToLanguageCountryLocale(localeParam: string): string | null {\n const locale = localeParam.replace('_', '-');\n const format = /^([a-z]{2})(-)([A-Z]{2})$/;\n\n // If it's already formatted, return the locale\n if (format.test(locale)) return locale;\n\n // Split the string in two\n const [languageCode, countryCode] = locale.split('-');\n\n // If the locale or the country codes are missing, return null\n if (!languageCode || !countryCode) return null;\n\n // Ensure correct format and join the strings back together\n const fullLocale = [languageCode.toLowerCase(), countryCode.toUpperCase()].join('-');\n\n return fullLocale.length === 5 ? fullLocale : null;\n}\n\nexport function parseLocale(locale: string, supportedLocales: readonly string[]): string {\n if (!isLocaleLenghtValid(locale)) return DEFAULT_LOCALE;\n\n const formattedLocale = formatLocaleToLanguageCountryLocale(locale);\n const hasMatch = formattedLocale && supportedLocales.includes(formattedLocale);\n\n if (hasMatch) return formattedLocale;\n\n return matchLocale(formattedLocale || locale, supportedLocales) || DEFAULT_LOCALE;\n}\n\n/**\n * @description Makes sure that if custom translation is defined using not properly formatted locale keys, then it gets formatted correctly\n *\n * @example { en_US: { ... }} will be adjusted to { 'en-US': { ... }} . { ar: { ... }} is kept as is.\n */\nexport function formatCustomTranslations(customTranslations: CustomTranslations = {}): CustomTranslations {\n return Object.keys(customTranslations).reduce<CustomTranslations>((memo, localeKey) => {\n if (!isLocaleLenghtValid(localeKey)) return memo;\n\n const locale = formatLocaleToLanguageCountryLocale(localeKey) || toTwoLetterCode(localeKey);\n memo[locale] = customTranslations[localeKey];\n return memo;\n }, {});\n}\n\nconst replaceTranslationValues = (translation: string, values: Record<string, string>) => {\n return translation.replace(/%{(\\w+)}/g, (_, k) => values[k] || '');\n};\n\n/**\n * Returns a translation string by key\n * @param translations -\n * @param key -\n * @param options -\n *\n * @internal\n */\nexport const getTranslation = (\n translations: Record<string, string>,\n key: string,\n options: { values?: Record<string, string>; count?: number } = {}\n): string | null => {\n const { values = {}, count = 0 } = options;\n const keyPlural = `${key}__plural`;\n const keyForCount = (count: number) => `${key}__${count}`;\n\n if (Object.prototype.hasOwnProperty.call(translations, keyForCount(count))) {\n // Find key__count translation key\n return replaceTranslationValues(translations[keyForCount(count)], values);\n } else if (Object.prototype.hasOwnProperty.call(translations, keyPlural) && count > 1) {\n // Find key__plural translation key, if count greater than 1 (e.g. myTranslation__plural)\n return replaceTranslationValues(translations[keyPlural], values);\n } else if (Object.prototype.hasOwnProperty.call(translations, key)) {\n // Find key translation key (e.g. myTranslation)\n return replaceTranslationValues(translations[key], values);\n }\n\n return null;\n};\n\n/**\n * Injects JSX elements in a middle of a translation and returns a JSX array\n * The input string should use %# as the token to know where to insert the component\n * @param translation - Translation string\n * @param renderFunctions - An array function that renders JSX elements\n */\nexport const interpolateElement = (translation: string, renderFunctions: Array<(translation: string) => h.JSX.Element | string>) => {\n // splits by regex group, it guarantees that it only splits with 2 tokens (%#)\n const matches = translation.split(/%#(.*?)%#/gm);\n\n if (renderFunctions.length !== Math.floor(matches.length / 2)) {\n throw Error('The number of functions provided does not match the number of elements in the translation string.');\n }\n\n // the map will create an array of JSX / string elements, this syntax in accepted in JSX/react to render elements\n return matches.map((term, index) => {\n // math to get the index of the renderFunction that should be used\n // since we split on tokens, that means the index of the render function is half of the index of the string\n const indexInFunctionArray = Math.floor(index / 2);\n return index % 2 === 0 ? term : renderFunctions[indexInFunctionArray](term);\n });\n};\n"],"names":["toTwoLetterCode","locale","toLowerCase","substring","isLocaleLenghtValid","Boolean","length","LOCALE_NAME_MIN_LENGTH","LOCALE_NAME_MAX_LENGTH","matchLocale","supportedLocales","find","supLoc","formatLocaleToLanguageCountryLocale","localeParam","replace","test","languageCode","countryCode","split","fullLocale","toUpperCase","join","parseLocale","DEFAULT_LOCALE","formattedLocale","includes","formatCustomTranslations","customTranslations","Object","keys","reduce","memo","localeKey","replaceTranslationValues","translation","values","_","k","getTranslation","translations","key","options","count","keyPlural","keyForCount","prototype","hasOwnProperty","call","interpolateElement","renderFunctions","matches","Math","floor","Error","map","term","index","indexInFunctionArray"],"mappings":"wGAOA,MAAMA,EAAmBC,GAA2BA,EAAOC,cAAcC,UAAU,EAAG,GAOhFC,EAAuBH,GACzBI,QAAQJ,IAAW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AOiB,UAAUC,eAAeC,KAAKR,EAAcI,IAAcD,EAAQ,EAEzET,EAAyBM,EAAaI,GAAYR,GAClDP,OAAOiB,UAAUC,eAAeC,KAAKR,EAAcC,GAEnDP,EAAyBM,EAAaC,GAAML,GAGhD,MASEa,EAAqB,CAACd,EAAqBe,KAEpD,MAAMC,EAAUhB,EAAYhB,MAAM,eAElC,GAAI+B,EAAgB5C,SAAW8C,KAAKC,MAAMF,EAAQ7C,OAAS,GACvD,MAAMgD,MAAM,qGAIhB,OAAOH,EAAQI,IAAI,CAACC,EAAMC,KAGtB,MAAMC,EAAuBN,KAAKC,MAAMI,EAAQ,GAChD,OAAOA,EAAQ,GAAM,EAAID,EAAON,EAAgBQ,GAAsBF"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/language/utils.ts"],"sourcesContent":["import { h } from 'preact';\nimport { CustomTranslations } from './types';\nimport { DEFAULT_LOCALE, LOCALE_NAME_MAX_LENGTH, LOCALE_NAME_MIN_LENGTH } from './constants';\n\n/**\n * @description Convert to ISO 639-1\n */\nconst toTwoLetterCode = (locale: string): string => locale.toLowerCase().substring(0, 2);\n\n/**\n * @description Checks if the locale length is valid\n * @param locale - The locale to check\n * @returns true if the locale length is valid, false otherwise\n */\nconst isLocaleLenghtValid = (locale: string): boolean =>\n Boolean(locale) && locale.length >= LOCALE_NAME_MIN_LENGTH && locale.length <= LOCALE_NAME_MAX_LENGTH;\n\n/**\n * Matches a string with one of the locales\n *\n * @param locale - The locale to match\n * @param supportedLocales - Array of possible locales\n *\n * @example\n * matchLocale('en-GB', ['en-US', 'es-ES']);\n * // returns 'en-US'\n */\nexport function matchLocale(locale: string, supportedLocales: readonly string[]): string | null {\n if (!locale || typeof locale !== 'string') return null;\n\n const lowerLocale = locale.toLowerCase();\n const exactMatch = supportedLocales.find(supLoc => supLoc.toLowerCase() === lowerLocale);\n\n if (exactMatch) return exactMatch;\n\n const localeTwoLetter = toTwoLetterCode(locale);\n return supportedLocales.find(supLoc => toTwoLetterCode(supLoc) === localeTwoLetter) || null;\n}\n\n/**\n * Returns a locale with the proper format.\n *\n * @param localeParam - Locale example: 'En_us' or 'en-US'\n *\n * @example\n * formatLocaleToLanguageCountryLocale('En_us');\n * // returns 'en-US'\n */\nexport function formatLocaleToLanguageCountryLocale(localeParam: string): string | null {\n const locale = localeParam.replace('_', '-');\n const format = /^([a-z]{2})(-)([A-Z]{2})$/;\n\n // If it's already formatted, return the locale\n if (format.test(locale)) return locale;\n\n // Split the string in two\n const [languageCode, countryCode] = locale.split('-');\n\n // If the locale or the country codes are missing, return null\n if (!languageCode || !countryCode) return null;\n\n // Ensure correct format and join the strings back together\n const fullLocale = [languageCode.toLowerCase(), countryCode.toUpperCase()].join('-');\n\n return fullLocale.length === 5 ? fullLocale : null;\n}\n\nexport function parseLocale(locale: string, supportedLocales: readonly string[]): string {\n if (!isLocaleLenghtValid(locale)) return DEFAULT_LOCALE;\n\n const formattedLocale = formatLocaleToLanguageCountryLocale(locale);\n const hasMatch = formattedLocale && supportedLocales.includes(formattedLocale);\n\n if (hasMatch) return formattedLocale;\n\n return matchLocale(formattedLocale || locale, supportedLocales) || DEFAULT_LOCALE;\n}\n\n/**\n * @description Makes sure that if custom translation is defined using not properly formatted locale keys, then it gets formatted correctly\n *\n * @example { en_US: { ... }} will be adjusted to { 'en-US': { ... }} . { ar: { ... }} is kept as is.\n */\nexport function formatCustomTranslations(customTranslations: CustomTranslations = {}): CustomTranslations {\n return Object.keys(customTranslations).reduce<CustomTranslations>((memo, localeKey) => {\n if (!isLocaleLenghtValid(localeKey)) return memo;\n\n const locale = formatLocaleToLanguageCountryLocale(localeKey) || toTwoLetterCode(localeKey);\n memo[locale] = customTranslations[localeKey];\n return memo;\n }, {});\n}\n\nconst replaceTranslationValues = (translation: string, values: Record<string, string>) => {\n return translation.replace(/%{(\\w+)}/g, (_, k) => values[k] || '');\n};\n\n/**\n * Returns a translation string by key\n * @param translations -\n * @param key -\n * @param options -\n *\n * @internal\n */\nexport const getTranslation = (\n translations: Record<string, string>,\n key: string,\n options: { values?: Record<string, string>; count?: number } = {}\n): string | null => {\n const { values = {}, count = 0 } = options;\n const keyPlural = `${key}__plural`;\n const keyForCount = (count: number) => `${key}__${count}`;\n\n if (Object.prototype.hasOwnProperty.call(translations, keyForCount(count))) {\n // Find key__count translation key\n return replaceTranslationValues(translations[keyForCount(count)], values);\n } else if (Object.prototype.hasOwnProperty.call(translations, keyPlural) && count > 1) {\n // Find key__plural translation key, if count greater than 1 (e.g. myTranslation__plural)\n return replaceTranslationValues(translations[keyPlural], values);\n } else if (Object.prototype.hasOwnProperty.call(translations, key)) {\n // Find key translation key (e.g. myTranslation)\n return replaceTranslationValues(translations[key], values);\n }\n\n return null;\n};\n\n/**\n * Injects JSX elements in a middle of a translation and returns a JSX array\n * The input string should use %# as the token to know where to insert the component\n * @param translation - Translation string\n * @param renderFunctions - An array function that renders JSX elements\n */\nexport const interpolateElement = (translation: string, renderFunctions: Array<(translation: string) => h.JSX.Element | string>) => {\n // splits by regex group, it guarantees that it only splits with 2 tokens (%#)\n const matches = translation.split(/%#(.*?)%#/gm);\n\n if (renderFunctions.length !== Math.floor(matches.length / 2)) {\n throw Error('The number of functions provided does not match the number of elements in the translation string.');\n }\n\n // the map will create an array of JSX / string elements, this syntax in accepted in JSX/react to render elements\n return matches.map((term, index) => {\n // math to get the index of the renderFunction that should be used\n // since we split on tokens, that means the index of the render function is half of the index of the string\n const indexInFunctionArray = Math.floor(index / 2);\n return index % 2 === 0 ? term : renderFunctions[indexInFunctionArray](term);\n });\n};\n"],"names":["toTwoLetterCode","locale","toLowerCase","substring","isLocaleLenghtValid","Boolean","length","LOCALE_NAME_MIN_LENGTH","LOCALE_NAME_MAX_LENGTH","matchLocale","supportedLocales","lowerLocale","exactMatch","find","supLoc","localeTwoLetter","formatLocaleToLanguageCountryLocale","localeParam","replace","test","languageCode","countryCode","split","fullLocale","toUpperCase","join","parseLocale","DEFAULT_LOCALE","formattedLocale","includes","formatCustomTranslations","customTranslations","Object","keys","reduce","memo","localeKey","replaceTranslationValues","translation","values","_","k","getTranslation","translations","key","options","count","keyPlural","keyForCount","prototype","hasOwnProperty","call","interpolateElement","renderFunctions","matches","Math","floor","Error","map","term","index","indexInFunctionArray"],"mappings":"wGAOA,MAAMA,EAAmBC,GAA2BA,EAAOC,cAAcC,UAAU,EAAG,GAOhFC,EAAuBH,GACzBI,QAAQJ,IAAWA,EAAOK,QAAUC,GAA0BN,EAAOK,QAAUE,EAY5E,SAASC,EAAYR,EAAgBS,GACxC,IAAKT,GAA4B,iBAAXA,EAAqB,OAAO,KAElD,MAAMU,EAAcV,EAAOC,cACrBU,EAAaF,EAAiBG,KAAKC,GAAUA,EAAOZ,gBAAkBS,GAE5E,GAAIC,EAAY,OAAOA,EAEvB,MAAMG,EAAkBf,EAAgBC,GACxC,OAAOS,EAAiBG,KAAKC,GAAUd,EAAgBc,KAAYC,IAAoB,IAC3F,CAWO,SAASC,EAAoCC,GAChD,MAAMhB,EAASgB,EAAYC,QAAQ,IAAK,KAIxC,GAHe,4BAGJC,KAAKlB,GAAS,OAAOA,EAGhC,MAAOmB,EAAcC,GAAepB,EAAOqB,MAAM,KAGjD,IAAKF,IAAiBC,EAAa,OAAO,KAG1C,MAAME,EAAa,CAACH,EAAalB,cAAemB,EAAYG,eAAeC,KAAK,KAEhF,OAA6B,IAAtBF,EAAWjB,OAAeiB,EAAa,IAClD,CAEO,SAASG,EAAYzB,EAAgBS,GACxC,IAAKN,EAAoBH,GAAS,OAAO0B,EAEzC,MAAMC,EAAkBZ,EAAoCf,GAG5D,OAFiB2B,GAAmBlB,EAAiBmB,SAASD,GAEzCA,EAEdnB,EAAYmB,GAAmB3B,EAAQS,IAAqBiB,CACvE,CAOO,SAASG,EAAyBC,EAAyC,IAC9E,OAAOC,OAAOC,KAAKF,GAAoBG,OAA2B,CAACC,EAAMC,KACrE,IAAKhC,EAAoBgC,GAAY,OAAOD,EAI5C,OADAA,EADenB,EAAoCoB,IAAcpC,EAAgBoC,IAClEL,EAAmBK,GAC3BD,GACR,CAAA,EACP,CAEA,MAAME,EAA2B,CAACC,EAAqBC,IAC5CD,EAAYpB,QAAQ,YAAa,CAACsB,EAAGC,IAAMF,EAAOE,IAAM,IAWtDC,EAAiB,CAC1BC,EACAC,EACAC,EAA+D,CAAA,KAE/D,MAAMN,OAAEA,EAAS,CAAA,EAAEO,MAAEA,EAAQ,GAAMD,EAC7BE,EAAY,GAAGH,YACfI,EAAeF,GAAkB,GAAGF,MAAQE,IAElD,OAAId,OAAOiB,UAAUC,eAAeC,KAAKR,EAAcK,EAAYF,IAExDT,EAAyBM,EAAaK,EAAYF,IAASP,GAC3DP,OAAOiB,UAAUC,eAAeC,KAAKR,EAAcI,IAAcD,EAAQ,EAEzET,EAAyBM,EAAaI,GAAYR,GAClDP,OAAOiB,UAAUC,eAAeC,KAAKR,EAAcC,GAEnDP,EAAyBM,EAAaC,GAAML,GAGhD,MASEa,EAAqB,CAACd,EAAqBe,KAEpD,MAAMC,EAAUhB,EAAYhB,MAAM,eAElC,GAAI+B,EAAgB/C,SAAWiD,KAAKC,MAAMF,EAAQhD,OAAS,GACvD,MAAMmD,MAAM,qGAIhB,OAAOH,EAAQI,IAAI,CAACC,EAAMC,KAGtB,MAAMC,EAAuBN,KAAKC,MAAMI,EAAQ,GAChD,OAAOA,EAAQ,GAAM,EAAID,EAAON,EAAgBQ,GAAsBF"}
@@ -1,2 +1,2 @@
1
- var e={payButton:"Pay","payButton.redirecting":"Redirecting...","payButton.with":"Pay %{value} with %{maskedData}","payButton.saveDetails":"Save details",close:"Close",storeDetails:"Save for my next payment",readMore:"Read more","creditCard.holderName":"Name on card","creditCard.holderName.invalid":"Enter name as shown on card","creditCard.expiryDateField.month":"Month","creditCard.expiryDateField.year":"Year","creditCard.storeDetailsButton":"Remember for next time","creditCard.dualBrand.title":"Card Brand","creditCard.dualBrand.description":"You can select the card brand you prefer to pay with. This is optional.",installments:"Number of installments",installmentOption:"%{times}x %{partialValue}",installmentOptionMonths:"%{times} months","installments.oneTime":"One time payment","installments.installments":"Installments payment","installments.revolving":"Revolving payment","installments.bonus":"Bonus payment","sepaDirectDebit.ibanField.invalid":"Invalid account number","sepa.ownerName":"Holder Name","sepa.ibanNumber":"Account Number (IBAN)","error.title":"Error","error.subtitle.redirect":"Redirect failed","error.subtitle.payment":"Payment failed","error.subtitle.refused":"Payment refused","error.message.unknown":"An unknown error occurred","errorPanel.title":"Existing errors","idealIssuer.selectField.title":"Bank","creditCard.success":"Payment Successful",loading:"Loading…",continue:"Continue",continueTo:"Continue to","wechatpay.timetopay":"You have %@ to pay","sr.wechatpay.timetopay":"You have %#minutes%# %#seconds%# to pay","wechatpay.scanqrcode":"Scan QR code",personalDetails:"Personal details",companyDetails:"Company details","companyDetails.name":"Company name","companyDetails.registrationNumber":"Registration number",socialSecurityNumber:"Social security number",firstName:"First name","firstName.invalid":"Enter your first name",infix:"Prefix",lastName:"Last name","lastName.invalid":"Enter your last name",mobileNumber:"Mobile number","mobileNumber.invalid":"Invalid mobile number",city:"City",postalCode:"Postal code","postalCode.optional":"Postal code (optional)",countryCode:"Country Code",telephoneNumber:"Telephone number",telephonePrefix:"Prefix",dateOfBirth:"Date of birth",shopperEmail:"Email address",gender:"Gender","gender.notselected":"Select your gender",male:"Male",female:"Female",billingAddress:"Billing address",street:"Street",stateOrProvince:"State or province",country:"Country/Region",houseNumberOrName:"House number",separateDeliveryAddress:"Specify a separate delivery address",deliveryAddress:"Delivery Address","deliveryAddress.firstName":"Recipient first name","deliveryAddress.lastName":"Recipient last name",zipCode:"Zip code",apartmentSuite:"Apartment / Suite",provinceOrTerritory:"Province or Territory",cityTown:"City / Town",address:"Address","address.search.contextualText":"Type to start searching your address","address.errors.incomplete":"Enter an address to continue","address.enterManually":"Enter address manually",state:"State",payAmountFormat:"Pay %@","field.title.optional":"(optional)","issuerList.selectField.contextualText":"Select your bank to continue","issuerList.selectField.label":"Bank selection",privacyPolicy:"Privacy policy","afterPay.agreement":"I agree with the %@ of Riverty","riverty.termsAndConditions":"I agree with the general %#Terms & Conditions%# for the Riverty Payment Method. The privacy policy of Riverty can be found %#here%#.",paymentConditions:"payment conditions",openApp:"Open the app","voucher.readInstructions":"Read instructions","voucher.introduction":"Thank you for your purchase, please use the following coupon to complete your payment.","voucher.expirationDate":"Expiration Date","voucher.alternativeReference":"Alternative Reference","voucher.paymentReferenceLabel":"Payment Reference","voucher.surcharge":"Incl. %@ surcharge","voucher.introduction.doku":"Thank you for your purchase, please use the following information to complete your payment.","voucher.shopperName":"Shopper Name","voucher.merchantName":"Merchant","voucher.introduction.econtext":"Thank you for your purchase, please use the following information to complete your payment.","voucher.telephoneNumber":"Phone Number","voucher.shopperReference":"Shopper Reference","voucher.collectionInstitutionNumber":"Collection Institution Number","voucher.econtext.telephoneNumber.invalid":"Telephone number must be 10 or 11 digits long","boletobancario.btnLabel":"Generate Boleto","boleto.sendCopyToEmail":"Send a copy to my email","button.copy":"Copy","button.copied":"Copied!","button.download":"Download","boleto.socialSecurityNumber":"CPF/CNPJ","boleto.socialSecurityNumber.invalid":"Enter a valid CPF/CNPJ number","creditCard.storedCard.description.ariaLabel":"Stored card ends in %@","voucher.entity":"Entity",donateButton:"Donate",donationTermsCondition:"By donating you agree to the %#terms and conditions%#",donationRoundUpDescription:"%{donationAmount} is a round up from your original payment (%{originalPaymentAmount})",notNowButton:"Not now",thanksForYourSupport:"Thanks for your support!","resultMessages.preauthorized":"Details saved",preauthorizeWith:"Preauthorize with",confirmPreauthorization:"Confirm preauthorization",confirmPurchase:"Confirm purchase",applyGiftcard:"Redeem",giftcardBalance:"Gift card balance",deductedBalance:"Deducted balance","creditCard.taxNumber":"Cardholder birthdate or Corporate registration number","creditCard.taxNumber.label":"Cardholder birthdate (YYMMDD) or Corporate registration number (10 digits)","creditCard.taxNumber.labelAlt":"Corporate registration number (10 digits)","creditCard.taxNumber.invalid":"Invalid Cardholder birthdate or Corporate registration number","storedPaymentMethod.disable.button":"Remove","storedPaymentMethod.disable.confirmation":"Remove stored payment method","storedPaymentMethod.disable.confirmButton":"Yes, remove","storedPaymentMethod.disable.cancelButton":"Cancel","ach.bankAccount":"Bank account","ach.bankAccount.title":"Bank account details","ach.bankAccount.label":"Account type","ach.bankAccount.placeholder":"Choose an account type","ach.bankAccount.nothing-selected-error":"Choose an account type","ach.bankAccount.option.personal-checking":"Personal Checking Account","ach.bankAccount.option.personal-savings":"Personal Savings Account","ach.bankAccount.option.business-checking":"Business Checking Account","ach.bankAccount.option.business-savings":"Business Savings Account","ach.bankAccountNumberVerification.label":"Verify account number","ach.bankAccountNumberVerification.error.not-match":"Account number does not match","ach.bankAccountNumberVerification.error.empty":"Enter the provided account number to verify the account number","ach.routingNumber.label":"Routing number","ach.accountHolderNameField.title":"Account holder name","ach.accountHolderNameField.contextualText":"Located on the front of your card","ach.accountHolderNameField.invalid":"Invalid account holder name","ach.accountNumberField.invalid":"Invalid account number","ach.accountLocationField.invalid":"Invalid ABA routing number","ach.savedBankAccount":"Saved bank account","ach.savings":"Savings account","ach.checking":"Checking account","select.state":"Select state","select.stateOrProvince":"Select state or province","select.provinceOrTerritory":"Select province or territory","select.country":"Select country/region","select.noOptionsFound":"No options found","select.results":"%{count} results available","telephoneNumber.invalid":"Invalid telephone number",qrCodeOrApp:"or","paypal.processingPayment":"Processing payment...",generateQRCode:"Generate QR code","await.waitForConfirmation":"Waiting for confirmation","mbway.confirmPayment":"Confirm your payment on the MB WAY app","shopperEmail.invalid":"Invalid email address","dateOfBirth.format":"DD/MM/YYYY","dateOfBirth.invalid":"Enter a valid date of birth that indicates you are at least 18 years old","blik.confirmPayment":"Open your banking app to confirm the payment.","blik.invalid":"Enter 6 numbers","blik.code":"6-digit code","blik.help":"Get the code from your banking app.","swish.pendingMessage":"After you scan, the status can be pending for up to 10 minutes. Attempting to pay again within this time may result in multiple charges.","field.valid":"Field valid","field.invalid":"Field not valid","field.error.required":"Enter the %{label}","field.error.invalid":"Enter a valid %{label}","error.giftcard.no-balance":"This gift card has zero balance","error.giftcard.card-error":"In our records we have no gift card with this number","error.giftcard.currency-error":"Gift cards are only valid in the currency they were issued in","err.gen.9100":"Incomplete field","err.gen.9101":"Field not valid","err.gen.9102":"Data parsing error","3ds.chal.805":"Challenge resolved without a %{result} object","cc.num.902":"Enter a valid card number","cc.num.900":"Enter the card number","cc.num.903":"Enter a supported card brand","cc.num.901":"Enter the complete card number","cc.dat.912":"Enter a valid expiry date","cc.dat.913":"Enter a valid expiry date","cc.dat.914":"Credit card about to expire","cc.dat.910":"Enter the expiry date","cc.dat.911":"Enter the complete expiry date","cc.mth.915":"Enter the expiry month","cc.yr.917":"Enter the expiry year","cc.yr.918":"Enter the complete expiry year","cc.cvc.920":"Enter the security code","cc.cvc.921":"Enter the complete security code","ach.num.945":"Enter the bank account number","ach.num.946":"Enter the complete bank account number","ach.loc.947":"Enter the bank routing number","ach.loc.948":"Enter the complete bank routing number","kcp.pwd.940":"Enter the password","kcp.pwd.941":"Enter the complete password","amazonpay.signout":"Sign out from Amazon","amazonpay.changePaymentDetails":"Change payment details","partialPayment.warning":"Select another payment method to pay the remaining","partialPayment.remainingBalance":"Remaining balance will be %{amount}","order.paymentMethod.description":"%{name} ending in %{lastFour}","bankTransfer.beneficiary":"Beneficiary name","bankTransfer.iban":"IBAN","bankTransfer.bic":"BIC","bankTransfer.reference":"Reference","bankTransfer.accountNumber":"Account number","bankTransfer.sortCode":"Sort code","bankTransfer.routingNumber":"Routing number","bankTransfer.branchCode":"Branch code","bankTransfer.bankCode":"Bank code","bankTransfer.introduction":"Press ‘Continue’ to create a new bank transfer payment. You can use the details in the following screen to finalize this payment.","bankTransfer.instructions":"Thank you for your purchase, please use the following information to complete your payment.","bankTransfer.shopperEmail.contextualText":"A copy of the payment details will be sent to your email so you can complete the payment later.","bankTransfer.details.title":"Payment details","bankTransfer.instruction.title":"Payment process","bankTransfer.instruction.step1":"Open your banking app","bankTransfer.instruction.step2":"Start a new transfer","bankTransfer.instruction.step3":"Enter the account details provided below","bankTransfer.instruction.step4":"Review and confirm the payment","bacs.accountHolderName":"Bank account holder name","bacs.accountHolderName.invalid":"Invalid bank account holder name","bacs.accountNumber":"Bank account number","bacs.accountNumber.invalid":"Invalid bank account number","bacs.bankLocationId":"Sort code","bacs.bankLocationId.invalid":"Invalid sort code","bacs.consent.amount":"I agree that the above amount will be deducted from my bank account.","bacs.consent.account":"I confirm the account is in my name and I am the only signatory required to authorise the Direct Debit on this account.",edit:"Edit","bacs.confirm":"Confirm and pay","bacs.result.introduction":"Download your Direct Debit Instruction (DDI / Mandate)","download.pdf":"Download PDF","creditCard.encryptedCardNumber.aria.iframeTitle":"Card number","creditCard.encryptedExpiryDate.aria.iframeTitle":"Expiry date","creditCard.encryptedExpiryMonth.aria.iframeTitle":"Expiry month","creditCard.encryptedExpiryYear.aria.iframeTitle":"Expiry year","creditCard.encryptedSecurityCode.aria.iframeTitle":"Security code","creditCard.encryptedPassword.aria.iframeTitle":"Password","giftcard.encryptedCardNumber.aria.iframeTitle":"Card number","giftcard.encryptedSecurityCode.aria.iframeTitle":"Pin",giftcardTransactionLimit:"Max. %{amount} allowed per transaction on this gift card","pix.instructions":"Use your banking app to scan the QR code or copy the PIX code below to complete your payment.","pix.code.label":"PIX code","pix.code.copy.label":"Copy PIX code","pix.code.copied.label":"PIX code copied","twint.saved":"saved",orPayWith:"or pay with","invalid.format.expects":"%{label} Invalid format. Expected format: %{format}","upi.qrCodeWaitingMessage":"Scan the QR code using your preferred UPI app to complete the payment","upi.vpaWaitingMessage":"Open your UPI app to confirm the payment","upi.modeSelection":"How would you like to use UPI?","upi.completePayment":"Complete your payment","upi.mode.enterUpiId":"UPI ID","upi.mode.qrCode":"QR code","upi.mode.payByAnyUpi":"UPI apps","upi.collect.dropdown.label":"Enter UPI ID","upi.collect.instruction":"Enter your UPI ID","upi.collect.field.label":"UPI ID","upi.collect.field.contextualText":"Enter the UPI ID connected to your account and press continue","upi.collect.field.invalid-id-error":"Enter a valid UPI","upi.error.noAppSelected":"Select your preferred UPI app to continue","upi.intent.instruction":"Select your preferred UPI app","upi.qrCode.instruction":"After generating the QR code you can use your preferred UPI app to complete the payment.","onlineBanking.termsAndConditions":"By continuing you agree with the %#terms and conditions%#","onlineBankingPL.termsAndConditions":"By continuing you agree with the %#regulations%# and %#information obligation%# of Przelewy24","ctp.loading.poweredByCtp":"Powered by Click to Pay","ctp.loading.intro":"We are checking to see if you have any saved cards with Click to Pay...","ctp.login.title":"Continue to Click to Pay","ctp.login.subtitle":"Enter the email address that is connected to Click to Pay to continue.","ctp.login.inputLabel":"Email","ctp.logout.notYou":"Not you?","ctp.logout.notYourCards":"Not your cards?","ctp.logout.notYourCard":"Not your card?","ctp.logout.notYourProfile":"Not your profile?","ctp.otp.fieldLabel":"One time code","ctp.otp.resendCode":"Resend code","ctp.otp.codeResent":"Code resent","ctp.otp.title":"Access your Click to Pay cards","ctp.otp.subtitle":"Enter the code %@ sent to %@ to verify it‘s you.","ctp.otp.saveCookiesCheckbox.label":"Skip verification next time","ctp.otp.saveCookiesCheckbox.information":"Select to be remembered on your device and browser at participating stores for faster checkout. Not recommended for shared devices.","ctp.otp.saveCookiesCheckbox.shorterInfo":"Select to be remembered on your device and browser","ctp.emptyProfile.message":"No cards registered in this Click to Pay profile","ctp.separatorText":"or use","ctp.cards.title":"Complete payment with Click to Pay","ctp.cards.subtitle":"Select a card to use.","ctp.cards.expiredCard":"Expired","ctp.manualCardEntry":"Manual card entry","ctp.aria.infoModalButton":"What is Click to Pay","ctp.infoPopup.title":"Click to Pay brings the ease of contactless, online","ctp.infoPopup.subtitle":"A fast, secure payment method supported by Mastercard, Visa and other payment cards.","ctp.infoPopup.benefit1":"Click to Pay uses encryption to keep your information safe and secure","ctp.infoPopup.benefit2":"Use it with merchants worldwide","ctp.infoPopup.benefit3":"Set up once for hassle-free payments in the future","ctp.errors.AUTH_INVALID":"Authentication Invalid","ctp.errors.NOT_FOUND":"No account found, enter a valid email or continue using manual card entry","ctp.errors.ID_FORMAT_UNSUPPORTED":"Format not supported","ctp.errors.FRAUD":"The user account was locked or disabled","ctp.errors.CONSUMER_ID_MISSING":"Consumer identity is missing in the request","ctp.errors.ACCT_INACCESSIBLE":"This account is currently not available, e.g it is locked","ctp.errors.CODE_INVALID":"Incorrect verification code","ctp.errors.CODE_EXPIRED":"This code has expired","ctp.errors.RETRIES_EXCEEDED":"The limit for the number of retries for OTP generation was exceeded","ctp.errors.OTP_SEND_FAILED":"The OTP could not be sent to the recipient","ctp.errors.REQUEST_TIMEOUT":"Something went wrong, try again or use the manual card entry","ctp.errors.UNKNOWN_ERROR":"Something went wrong, try again or use the manual card entry","ctp.errors.SERVICE_ERROR":"Something went wrong, try again or use the manual card entry","ctp.errors.SERVER_ERROR":"Something went wrong, try again or use the manual card entry","ctp.errors.INVALID_PARAMETER":"Something went wrong, try again or use the manual card entry","ctp.errors.INVALID_EMAIL":"Enter a valid email address (e.g. name@example.com)","ctp.errors.AUTH_ERROR":"Something went wrong, try again or use the manual card entry","paymentMethodsList.aria.label":"Choose a payment method","paymentMethodsList.storedPayments.label":"Saved payment methods","paymentMethodsList.otherPayments.label":"More payment options","paymentMethodsList.otherPayments.buttonLabel":"Show %{count} more","paymentMethodsList.promotedPayments.label":"Other","companyDetails.name.invalid":"Enter the company name","companyDetails.registrationNumber.invalid":"Enter the registration number","consent.checkbox.invalid":"You must agree with the terms & conditions","form.instruction":"All fields are required unless marked otherwise.","trustly.descriptor":"Instant Bank Payment","trustly.description1":"Pay directly from any of your bank accounts, backed by bank-level security","trustly.description2":"No cards, no app download, no registration","ancv.input.label":"Your ANCV identification","ancv.confirmPayment":"Use your ANCV application to confirm the payment.","ancv.form.instruction":"The Cheque-Vacances application is necessary to validate this payment.","ancv.beneficiaryId.invalid":"Enter a valid email address or ANCV ID","creditCard.cardNumber.label":"Card number","creditCard.expiryDate.label":"Expiry date","creditCard.expiryDate.contextualText":"Front of card in MM/YY format","creditCard.securityCode.label":"Security code","creditCard.securityCode.label.optional":"Security code (optional)","creditCard.securityCode.contextualText.3digits":"3 digits on back of card","creditCard.securityCode.contextualText.4digits":"4 digits on front of card","creditCard.expiryMonth.label":"Expiry month","creditCard.expiryYear.label":"Expiry year","creditCard.pin.label":"Pin","creditCard.password.label":"First 2 digits of card password","giftcard.cardNumber.label":"Card Number","giftcard.expiryDate.label":"Expiry date","giftcard.securityCode.label":"Pin","ach.bankAccountNumber.label":"Account number","ach.bankLocationId.label":"ABA routing number","dragonpayVoucher.selectField.contextualText.nonBank":"Select your provider","dragonpayVoucher.selectField.contextualText.bank":"Select your bank","payme.openPayMeApp":"Complete your payment in the PayMe app by authorizing the payment in the app and wait for the confirmation.","payme.redirectButtonLabel":"Open PayMe app","payme.scanQrCode":"Complete your payment by QR code","payme.timeToPay":"This QR code is valid for %@","payme.instructions.steps":"Open the PayMe app.%@Scan the QR code to authorize the payment.%@Complete the payment in the app and wait for confirmation.","payme.instructions.footnote":"Please do not close this page before the payment is completed","payByBankAISDD.disclaimer.header":"Use Pay by Bank to pay instantly from any bank account.","payByBankAISDD.disclaimer.body":"By connecting your bank account you are authorizing debits to your account for any amount owed for use of our services and/or purchase of our products, until this authorization is revoked.","paymentMethodBrand.other":"other","paynow.scanQrCode":"Scan the QR code using the PayNow app to complete the payment","paynow.mobileViewInstruction.step1":"Take a screenshot of the QR code.","paynow.mobileViewInstruction.step2":"Open the PayNow bank or payment app.","paynow.mobileViewInstruction.step3":"Select the option to scan a QR code.","paynow.mobileViewInstruction.step4":"Choose the option to upload a QR and select the screenshot.","paynow.mobileViewInstruction.step5":"Complete the transaction.","payto.payid.description":"Enter the PayID and account details that are connected to your PayTo account.","payto.payid.label.identifier":"Identifier","payto.payid.label.orgid":"Organization ID","payto.payid.option.phone":"Mobile","payto.payid.option.email":"Email","payto.payid.option.orgid":"Organization ID","payto.bsb.description":"Enter the bank account number and the Bank State Branch that is connected to your account to continue","payto.bsb.label.bankAccountNumber":"Bank account number","payto.instructions.steps":"Log into your PayTo banking app@Authorize the PayTo agreement@Approve the payment terms@Complete the transaction","payto.confirmPayment":"Thank you for your purchase, complete your payment by following the instructions below.","payto.mandate.amount.label":"Amount","payto.mandate.frequency.label":"Frequency","payto.mandate.remarks.label":"Description","payto.mandate.startsAt.label":"First payment date","payto.mandate.endsAt.label":"End date","payto.mandate.payee.label":"Payee","payto.mandate.amount.max":"Up to %{amount} per transaction","payto.mandate.frequency.adhoc-no-count":"Ad Hoc","payto.mandate.frequency.adhoc":"%{count} time(s)","payto.mandate.frequency.daily":"%{count} payment(s) Daily","payto.mandate.frequency.weekly":"%{count} payment(s) Weekly","payto.mandate.frequency.biWeekly":"%{count} payment(s) Fortnightly","payto.mandate.frequency.monthly":"%{count} payment(s) Monthly","payto.mandate.frequency.quarterly":"%{count} payment(s) Quarterly","payto.mandate.frequency.halfYearly":"%{count} payment(s) Bi-Annual","payto.mandate.frequency.yearly":"%{count} payment(s) Yearly","payto.label.firstName":"Account holder first name","payto.label.lastName":"Account holder last name","payto.await.waitForConfirmation":"Awaiting your approval","payto.bsb.option.label":"BSB and account number","card.fastlane.a11y.logo":"Fastlane by Paypal logo","card.fastlane.a11y.openDialog":"Read more about Fastlane","card.fastlane.a11y.closeDialog":"Close dialog","card.fastlane.mobileInputLabel":"Mobile number","card.fastlane.consentToggle":"Save your info with Fastlane for faster checkouts and more","card.fastlane.consentText":"By saving your info, you agree to get codes by text to use Fastlane everywhere it's available. Fastlane will text the number provided. You also agree to this %#terms%# and %#privacy statement%#.","card.fastlane.modal.benefit1.header":"Autofill your checkouts","card.fastlane.modal.benefit1.text":"Get one-time codes to use card and addresses you’ve saved.","card.fastlane.modal.benefit2.header":"Protect your info","card.fastlane.modal.benefit2.text":"Your payment info is encrypted when it’s stored and sent to places you shop.","card.fastlane.modal.benefit3.header":"Use across stores","card.fastlane.modal.benefit3.text":"Speed through checkout everywhere Fastlane is available.","paybybankpix.redirectBtn.label":"Continue to PIX through OpenBanking","paybybankpix.issuerList.disclaimer":"By continuing, you agree to the %#Consent Notice%# and will be redirected to your bank.","paybybankpix.issuerList.selectField.label":"Bank","paybybankpix.issuerList.introduction.logo.content":"Connect your favorite PIX keys to pay through Open Finance","paybybankpix.await.waitForConfirmation":"Waiting for your confirmation...","paybybankpix.await.timeToPay":"This process will take approximately %{numberOfMin} minute(s)","paybybankpix.await.withOpenFinance":"With the ease of Open Finance","paybybankpix.await.logoAlt.openFinance":"Open Finance","paybybankpix.storedPayment.payButton.label":"Continue payment","paybybankpix.storedPayment.additionalLabel":"%{receiver} account through PIX","paybybankpix.await.fetchDetails":"Fetching details...","eftpad-canada.input.accountHolderName.label":"Account holder name","eftpad-canada.input.accountHolderName.error":"Enter an account holder name","eftpad-canada.input.accountNumber.label":"Account number","eftpad-canada.input.accountNumber.contextualText":"Between 7 and 12 digits","eftpad-canada.input.accountNumber.error":"Enter an account number that is between 7 and 12 digits","eftpad-canada.input.institutionNumber.label":"Institution number","eftpad-canada.input.institutionNumber.contextualText":"3 digits","eftpad-canada.input.institutionNumber.error":"Enter an institution number that consists of 3 digits","eftpad-canada.input.transitNumber.label":"Transit number","eftpad-canada.input.transitNumber.contextualText":"5 digits","eftpad-canada.input.transitNumber.error":"Enter a transit number that consists of 5 digits","eftpad-canada.settlement-info":"The funds will be withdrawn from your bank account within 1–3 business days.","upi.mandate.intro":"You’re setting up a UPI Autopay recurring payment","upi.mandate.max.extraText":"You’ll approve a higher limit to allow future plan changes","upi.mandate.upTo":"up to %{amount}","upi.mandate.frequency.monthly":"/month","upi.mandate.frequency.weekly":"/week","upi.mandate.frequency.adhoc":" as presented",bankList:"Bank list",qrCode:"QR code","iris.instructions.generateQrCode":"After generating the QR code you can use your preferred banking app to complete the payment.","iris.instructions.payment.step1":"Open your preferred banking app.","iris.instructions.payment.step2":"Scan the QR code with your banking app.","iris.instructions.payment.step3":"Complete the payment in the app and wait for the confirmation here.","econtext.customerNumber":"Customer number","econtext.confirmationNumber":"Confirmation number","econtext.useBefore":"Use before","econtext.paymentInformation":"Payment information","issuerList.separatorText":"or choose from list","upi.intent.apps.title":"Options","upi.intent.apps.dropdown.label":"UPI apps","upi.intent.apps.dropdown.placeholder":"Choose preferred app"};export{e as default};
1
+ var e={payButton:"Pay","payButton.redirecting":"Redirecting...","payButton.with":"Pay %{value} with %{maskedData}","payButton.saveDetails":"Save details",close:"Close",storeDetails:"Save for my next payment",readMore:"Read more","creditCard.holderName":"Name on card","creditCard.holderName.invalid":"Enter name as shown on card","creditCard.expiryDateField.month":"Month","creditCard.expiryDateField.year":"Year","creditCard.storeDetailsButton":"Remember for next time","creditCard.dualBrand.title":"Card Brand","creditCard.dualBrand.description":"You can select the card brand you prefer to pay with. This is optional.",installments:"Number of installments",installmentOption:"%{times}x %{partialValue}",installmentOptionMonths:"%{times} months","installments.oneTime":"One time payment","installments.installments":"Installments payment","installments.revolving":"Revolving payment","installments.bonus":"Bonus payment","sepaDirectDebit.ibanField.invalid":"Invalid account number","sepa.ownerName":"Holder Name","sepa.ibanNumber":"Account Number (IBAN)","error.title":"Error","error.subtitle.redirect":"Redirect failed","error.subtitle.payment":"Payment failed","error.subtitle.refused":"Payment refused","error.message.unknown":"An unknown error occurred","errorPanel.title":"Existing errors","idealIssuer.selectField.title":"Bank","creditCard.success":"Payment Successful",loading:"Loading…",continue:"Continue",continueTo:"Continue to","wechatpay.timetopay":"You have %@ to pay","sr.wechatpay.timetopay":"You have %#minutes%# %#seconds%# to pay","wechatpay.scanqrcode":"Scan QR code",personalDetails:"Personal details",companyDetails:"Company details","companyDetails.name":"Company name","companyDetails.registrationNumber":"Registration number",socialSecurityNumber:"Social security number",firstName:"First name","firstName.invalid":"Enter your first name",infix:"Prefix",lastName:"Last name","lastName.invalid":"Enter your last name",mobileNumber:"Mobile number","mobileNumber.invalid":"Invalid mobile number",city:"City",postalCode:"Postal code","postalCode.optional":"Postal code (optional)",countryCode:"Country Code",telephoneNumber:"Telephone number",telephonePrefix:"Prefix",dateOfBirth:"Date of birth",shopperEmail:"Email address",gender:"Gender","gender.notselected":"Select your gender",male:"Male",female:"Female",billingAddress:"Billing address",street:"Street",stateOrProvince:"State or province",country:"Country/Region",houseNumberOrName:"House number",separateDeliveryAddress:"Specify a separate delivery address",deliveryAddress:"Delivery Address","deliveryAddress.firstName":"Recipient first name","deliveryAddress.lastName":"Recipient last name",zipCode:"Zip code",apartmentSuite:"Apartment / Suite",provinceOrTerritory:"Province or Territory",cityTown:"City / Town",address:"Address","address.search.contextualText":"Type to start searching your address","address.errors.incomplete":"Enter an address to continue","address.enterManually":"Enter address manually",state:"State",payAmountFormat:"Pay %@","field.title.optional":"(optional)","issuerList.selectField.contextualText":"Select your bank to continue","issuerList.selectField.label":"Bank selection",privacyPolicy:"Privacy policy","afterPay.agreement":"I agree with the %@ of Riverty","riverty.termsAndConditions":"I agree with the general %#Terms & Conditions%# for the Riverty Payment Method. The privacy policy of Riverty can be found %#here%#.",paymentConditions:"payment conditions",openApp:"Open the app","voucher.readInstructions":"Read instructions","voucher.introduction":"Thank you for your purchase, please use the following coupon to complete your payment.","voucher.expirationDate":"Expiration Date","voucher.alternativeReference":"Alternative Reference","voucher.paymentReferenceLabel":"Payment Reference","voucher.surcharge":"Incl. %@ surcharge","voucher.introduction.doku":"Thank you for your purchase, please use the following information to complete your payment.","voucher.shopperName":"Shopper Name","voucher.merchantName":"Merchant","voucher.introduction.econtext":"Thank you for your purchase, please use the following information to complete your payment.","voucher.telephoneNumber":"Phone Number","voucher.shopperReference":"Shopper Reference","voucher.collectionInstitutionNumber":"Collection Institution Number","voucher.econtext.telephoneNumber.invalid":"Telephone number must be 10 or 11 digits long","boletobancario.btnLabel":"Generate Boleto","boleto.sendCopyToEmail":"Send a copy to my email","button.copy":"Copy","button.copied":"Copied!","button.download":"Download","boleto.socialSecurityNumber":"CPF/CNPJ","boleto.socialSecurityNumber.invalid":"Enter a valid CPF/CNPJ number","creditCard.storedCard.description.ariaLabel":"Stored card ends in %@","voucher.entity":"Entity",donateButton:"Donate",donationTermsCondition:"By donating you agree to the %#terms and conditions%#",donationRoundUpDescription:"%{donationAmount} is a round up from your original payment (%{originalPaymentAmount})",notNowButton:"Not now",thanksForYourSupport:"Thanks for your support!","resultMessages.preauthorized":"Details saved",preauthorizeWith:"Preauthorize with",confirmPreauthorization:"Confirm preauthorization",confirmPurchase:"Confirm purchase",applyGiftcard:"Redeem",giftcardBalance:"Gift card balance",deductedBalance:"Deducted balance","creditCard.taxNumber":"Cardholder birthdate or Corporate registration number","creditCard.taxNumber.label":"Cardholder birthdate (YYMMDD) or Corporate registration number (10 digits)","creditCard.taxNumber.labelAlt":"Corporate registration number (10 digits)","creditCard.taxNumber.invalid":"Invalid Cardholder birthdate or Corporate registration number","storedPaymentMethod.disable.button":"Remove","storedPaymentMethod.disable.confirmation":"Remove stored payment method","storedPaymentMethod.disable.confirmButton":"Yes, remove","storedPaymentMethod.disable.cancelButton":"Cancel","ach.bankAccount":"Bank account","ach.bankAccount.title":"Bank account details","ach.bankAccount.label":"Account type","ach.bankAccount.placeholder":"Choose an account type","ach.bankAccount.nothing-selected-error":"Choose an account type","ach.bankAccount.option.personal-checking":"Personal Checking Account","ach.bankAccount.option.personal-savings":"Personal Savings Account","ach.bankAccount.option.business-checking":"Business Checking Account","ach.bankAccount.option.business-savings":"Business Savings Account","ach.bankAccountNumberVerification.label":"Verify account number","ach.bankAccountNumberVerification.error.not-match":"Account number does not match","ach.bankAccountNumberVerification.error.empty":"Enter the provided account number to verify the account number","ach.routingNumber.label":"Routing number","ach.accountHolderNameField.title":"Account holder name","ach.accountHolderNameField.contextualText":"Located on the front of your card","ach.accountHolderNameField.invalid":"Invalid account holder name","ach.accountNumberField.invalid":"Invalid account number","ach.accountLocationField.invalid":"Invalid ABA routing number","ach.savedBankAccount":"Saved bank account","ach.savings":"Savings account","ach.checking":"Checking account","select.state":"Select state","select.stateOrProvince":"Select state or province","select.provinceOrTerritory":"Select province or territory","select.country":"Select country/region","select.noOptionsFound":"No options found","select.results":"%{count} results available","telephoneNumber.invalid":"Invalid telephone number",qrCodeOrApp:"or","paypal.processingPayment":"Processing payment...",generateQRCode:"Generate QR code","await.waitForConfirmation":"Waiting for confirmation","mbway.confirmPayment":"Confirm your payment on the MB WAY app","shopperEmail.invalid":"Invalid email address","dateOfBirth.format":"DD/MM/YYYY","dateOfBirth.invalid":"Enter a valid date of birth that indicates you are at least 18 years old","blik.confirmPayment":"Open your banking app to confirm the payment.","blik.invalid":"Enter 6 numbers","blik.code":"6-digit code","blik.help":"Get the code from your banking app.","swish.pendingMessage":"After you scan, the status can be pending for up to 10 minutes. Attempting to pay again within this time may result in multiple charges.","field.valid":"Field valid","field.invalid":"Field not valid","field.error.required":"Enter the %{label}","field.error.invalid":"Enter a valid %{label}","error.giftcard.no-balance":"This gift card has zero balance","error.giftcard.card-error":"In our records we have no gift card with this number","error.giftcard.currency-error":"Gift cards are only valid in the currency they were issued in","err.gen.9100":"Incomplete field","err.gen.9101":"Field not valid","err.gen.9102":"Data parsing error","3ds.chal.805":"Challenge resolved without a %{result} object","cc.num.902":"Enter a valid card number","cc.num.900":"Enter the card number","cc.num.903":"Enter a supported card brand","cc.num.901":"Enter the complete card number","cc.dat.912":"Enter a valid expiry date","cc.dat.913":"Enter a valid expiry date","cc.dat.914":"Credit card about to expire","cc.dat.910":"Enter the expiry date","cc.dat.911":"Enter the complete expiry date","cc.mth.915":"Enter the expiry month","cc.yr.917":"Enter the expiry year","cc.yr.918":"Enter the complete expiry year","cc.cvc.920":"Enter the security code","cc.cvc.921":"Enter the complete security code","ach.num.945":"Enter the bank account number","ach.num.946":"Enter the complete bank account number","ach.loc.947":"Enter the bank routing number","ach.loc.948":"Enter the complete bank routing number","kcp.pwd.940":"Enter the password","kcp.pwd.941":"Enter the complete password","amazonpay.signout":"Sign out from Amazon","amazonpay.changePaymentDetails":"Change payment details","partialPayment.warning":"Select another payment method to pay the remaining","partialPayment.remainingBalance":"Remaining balance will be %{amount}","order.paymentMethod.description":"%{name} ending in %{lastFour}","bankTransfer.beneficiary":"Beneficiary name","bankTransfer.iban":"IBAN","bankTransfer.bic":"BIC","bankTransfer.reference":"Reference","bankTransfer.accountNumber":"Account number","bankTransfer.sortCode":"Sort code","bankTransfer.routingNumber":"Routing number","bankTransfer.branchCode":"Branch code","bankTransfer.bankCode":"Bank code","bankTransfer.introduction":"Press ‘Continue’ to create a new bank transfer payment. You can use the details in the following screen to finalize this payment.","bankTransfer.instructions":"Thank you for your purchase, please use the following information to complete your payment.","bankTransfer.shopperEmail.contextualText":"A copy of the payment details will be sent to your email so you can complete the payment later.","bankTransfer.details.title":"Payment details","bankTransfer.instruction.title":"Payment process","bankTransfer.instruction.step1":"Open your banking app","bankTransfer.instruction.step2":"Start a new transfer","bankTransfer.instruction.step3":"Enter the account details provided below","bankTransfer.instruction.step4":"Review and confirm the payment","bacs.accountHolderName":"Bank account holder name","bacs.accountHolderName.invalid":"Invalid bank account holder name","bacs.accountNumber":"Bank account number","bacs.accountNumber.invalid":"Invalid bank account number","bacs.bankLocationId":"Sort code","bacs.bankLocationId.invalid":"Invalid sort code","bacs.consent.amount":"I agree that the above amount will be deducted from my bank account.","bacs.consent.account":"I confirm the account is in my name and I am the only signatory required to authorise the Direct Debit on this account.",edit:"Edit","bacs.confirm":"Confirm and pay","bacs.result.introduction":"Download your Direct Debit Instruction (DDI / Mandate)","download.pdf":"Download PDF","creditCard.encryptedCardNumber.aria.iframeTitle":"Card number","creditCard.encryptedExpiryDate.aria.iframeTitle":"Expiry date","creditCard.encryptedExpiryMonth.aria.iframeTitle":"Expiry month","creditCard.encryptedExpiryYear.aria.iframeTitle":"Expiry year","creditCard.encryptedSecurityCode.aria.iframeTitle":"Security code","creditCard.encryptedPassword.aria.iframeTitle":"Password","giftcard.encryptedCardNumber.aria.iframeTitle":"Card number","giftcard.encryptedSecurityCode.aria.iframeTitle":"Pin",giftcardTransactionLimit:"Max. %{amount} allowed per transaction on this gift card","pix.instructions":"Use your banking app to scan the QR code or copy the PIX code below to complete your payment.","pix.code.label":"PIX code","pix.code.copy.label":"Copy PIX code","pix.code.copied.label":"PIX code copied","twint.saved":"saved",orPayWith:"or pay with","invalid.format.expects":"%{label} Invalid format. Expected format: %{format}","upi.qrCodeWaitingMessage":"Scan the QR code using your preferred UPI app to complete the payment","upi.vpaWaitingMessage":"Open your UPI app to confirm the payment","upi.modeSelection":"How would you like to use UPI?","upi.completePayment":"Complete your payment","upi.mode.enterUpiId":"UPI ID","upi.mode.qrCode":"QR code","upi.mode.payByAnyUpi":"UPI apps","upi.collect.dropdown.label":"Enter UPI ID","upi.collect.instruction":"Enter your UPI ID","upi.collect.field.label":"UPI ID","upi.collect.field.contextualText":"Enter the UPI ID connected to your account and press continue","upi.collect.field.invalid-id-error":"Enter a valid UPI","upi.error.noAppSelected":"Select your preferred UPI app to continue","upi.intent.instruction":"Select your preferred UPI app","upi.qrCode.instruction":"After generating the QR code you can use your preferred UPI app to complete the payment.","onlineBanking.termsAndConditions":"By continuing you agree with the %#terms and conditions%#","onlineBankingPL.termsAndConditions":"By continuing you agree with the %#regulations%# and %#information obligation%# of Przelewy24","ctp.loading.poweredByCtp":"Powered by Click to Pay","ctp.loading.intro":"We are checking to see if you have any saved cards with Click to Pay...","ctp.login.title":"Continue to Click to Pay","ctp.login.subtitle":"Enter the email address that is connected to Click to Pay to continue.","ctp.login.inputLabel":"Email","ctp.logout.notYou":"Not you?","ctp.logout.notYourCards":"Not your cards?","ctp.logout.notYourCard":"Not your card?","ctp.logout.notYourProfile":"Not your profile?","ctp.otp.fieldLabel":"One time code","ctp.otp.resendCode":"Resend code","ctp.otp.codeResent":"Code resent","ctp.otp.title":"Access your Click to Pay cards","ctp.otp.subtitle":"Enter the code %@ sent to %@ to verify it‘s you.","ctp.otp.saveCookiesCheckbox.label":"Skip verification next time","ctp.otp.saveCookiesCheckbox.information":"Select to be remembered on your device and browser at participating stores for faster checkout. Not recommended for shared devices.","ctp.otp.saveCookiesCheckbox.shorterInfo":"Select to be remembered on your device and browser","ctp.emptyProfile.message":"No cards registered in this Click to Pay profile","ctp.separatorText":"or use","ctp.cards.title":"Complete payment with Click to Pay","ctp.cards.subtitle":"Select a card to use.","ctp.cards.expiredCard":"Expired","ctp.manualCardEntry":"Manual card entry","ctp.aria.infoModalButton":"What is Click to Pay","ctp.infoPopup.title":"Click to Pay brings the ease of contactless, online","ctp.infoPopup.subtitle":"A fast, secure payment method supported by Mastercard, Visa and other payment cards.","ctp.infoPopup.benefit1":"Click to Pay uses encryption to keep your information safe and secure","ctp.infoPopup.benefit2":"Use it with merchants worldwide","ctp.infoPopup.benefit3":"Set up once for hassle-free payments in the future","ctp.errors.AUTH_INVALID":"Authentication Invalid","ctp.errors.NOT_FOUND":"No account found, enter a valid email or continue using manual card entry","ctp.errors.ID_FORMAT_UNSUPPORTED":"Format not supported","ctp.errors.FRAUD":"The user account was locked or disabled","ctp.errors.CONSUMER_ID_MISSING":"Consumer identity is missing in the request","ctp.errors.ACCT_INACCESSIBLE":"This account is currently not available, e.g it is locked","ctp.errors.CODE_INVALID":"Incorrect verification code","ctp.errors.CODE_EXPIRED":"This code has expired","ctp.errors.RETRIES_EXCEEDED":"The limit for the number of retries for OTP generation was exceeded","ctp.errors.OTP_SEND_FAILED":"The OTP could not be sent to the recipient","ctp.errors.REQUEST_TIMEOUT":"Something went wrong, try again or use the manual card entry","ctp.errors.UNKNOWN_ERROR":"Something went wrong, try again or use the manual card entry","ctp.errors.SERVICE_ERROR":"Something went wrong, try again or use the manual card entry","ctp.errors.SERVER_ERROR":"Something went wrong, try again or use the manual card entry","ctp.errors.INVALID_PARAMETER":"Something went wrong, try again or use the manual card entry","ctp.errors.INVALID_EMAIL":"Enter a valid email address (e.g. name@example.com)","ctp.errors.AUTH_ERROR":"Something went wrong, try again or use the manual card entry","paymentMethodsList.aria.label":"Choose a payment method","paymentMethodsList.storedPayments.label":"Saved payment methods","paymentMethodsList.otherPayments.label":"More payment options","paymentMethodsList.otherPayments.buttonLabel":"Show %{count} more","paymentMethodsList.promotedPayments.label":"Other","companyDetails.name.invalid":"Enter the company name","companyDetails.registrationNumber.invalid":"Enter the registration number","consent.checkbox.invalid":"You must agree with the terms & conditions","form.instruction":"All fields are required unless marked otherwise.","trustly.descriptor":"Instant Bank Payment","trustly.description1":"Pay directly from any of your bank accounts, backed by bank-level security","trustly.description2":"No cards, no app download, no registration","ancv.input.label":"Your ANCV identification","ancv.confirmPayment":"Use your ANCV application to confirm the payment.","ancv.form.instruction":"The Cheque-Vacances application is necessary to validate this payment.","ancv.beneficiaryId.invalid":"Enter a valid email address or ANCV ID","creditCard.cardNumber.label":"Card number","creditCard.expiryDate.label":"Expiry date","creditCard.expiryDate.contextualText":"Front of card in MM/YY format","creditCard.securityCode.label":"Security code","creditCard.securityCode.label.optional":"Security code (optional)","creditCard.securityCode.contextualText.3digits":"3 digits on back of card","creditCard.securityCode.contextualText.4digits":"4 digits on front of card","creditCard.expiryMonth.label":"Expiry month","creditCard.expiryYear.label":"Expiry year","creditCard.pin.label":"Pin","creditCard.password.label":"First 2 digits of card password","giftcard.cardNumber.label":"Card Number","giftcard.expiryDate.label":"Expiry date","giftcard.securityCode.label":"Pin","ach.bankAccountNumber.label":"Account number","ach.bankLocationId.label":"ABA routing number","dragonpayVoucher.selectField.contextualText.nonBank":"Select your provider","dragonpayVoucher.selectField.contextualText.bank":"Select your bank","payme.openPayMeApp":"Complete your payment in the PayMe app by authorizing the payment in the app and wait for the confirmation.","payme.redirectButtonLabel":"Open PayMe app","payme.scanQrCode":"Complete your payment by QR code","payme.timeToPay":"This QR code is valid for %@","payme.instructions.steps":"Open the PayMe app.%@Scan the QR code to authorize the payment.%@Complete the payment in the app and wait for confirmation.","payme.instructions.footnote":"Please do not close this page before the payment is completed","payByBankAISDD.disclaimer.header":"Use Pay by Bank to pay instantly from any bank account.","payByBankAISDD.disclaimer.body":"By connecting your bank account you are authorizing debits to your account for any amount owed for use of our services and/or purchase of our products, until this authorization is revoked.","paymentMethodBrand.other":"other","paynow.scanQrCode":"Scan the QR code using the PayNow app to complete the payment","paynow.mobileViewInstruction.step1":"Take a screenshot of the QR code.","paynow.mobileViewInstruction.step2":"Open the PayNow bank or payment app.","paynow.mobileViewInstruction.step3":"Select the option to scan a QR code.","paynow.mobileViewInstruction.step4":"Choose the option to upload a QR and select the screenshot.","paynow.mobileViewInstruction.step5":"Complete the transaction.","payto.payid.description":"Enter the PayID and account details that are connected to your PayTo account.","payto.payid.label.identifier":"Identifier","payto.payid.label.orgid":"Organization ID","payto.payid.option.phone":"Mobile","payto.payid.option.email":"Email","payto.payid.option.orgid":"Organization ID","payto.bsb.description":"Enter the bank account number and the Bank State Branch that is connected to your account to continue","payto.bsb.label.bankAccountNumber":"Bank account number","payto.instructions.steps":"Log into your PayTo banking app@Authorize the PayTo agreement@Approve the payment terms@Complete the transaction","payto.confirmPayment":"Thank you for your purchase, complete your payment by following the instructions below.","payto.mandate.amount.label":"Amount","payto.mandate.frequency.label":"Frequency","payto.mandate.remarks.label":"Description","payto.mandate.startsAt.label":"First payment date","payto.mandate.endsAt.label":"End date","payto.mandate.payee.label":"Payee","payto.mandate.amount.max":"Up to %{amount} per transaction","payto.mandate.frequency.adhoc-no-count":"Ad Hoc","payto.mandate.frequency.adhoc":"%{count} time(s)","payto.mandate.frequency.daily":"%{count} payment(s) Daily","payto.mandate.frequency.weekly":"%{count} payment(s) Weekly","payto.mandate.frequency.biWeekly":"%{count} payment(s) Fortnightly","payto.mandate.frequency.monthly":"%{count} payment(s) Monthly","payto.mandate.frequency.quarterly":"%{count} payment(s) Quarterly","payto.mandate.frequency.halfYearly":"%{count} payment(s) Bi-Annual","payto.mandate.frequency.yearly":"%{count} payment(s) Yearly","payto.label.firstName":"Account holder first name","payto.label.lastName":"Account holder last name","payto.errors.accountHolderFirstName.invalid":"Enter your account holder first name","payto.errors.accountHolderLastName.invalid":"Enter your account holder last name","payto.await.waitForConfirmation":"Awaiting your approval","payto.bsb.option.label":"BSB and account number","card.fastlane.a11y.logo":"Fastlane by Paypal logo","card.fastlane.a11y.openDialog":"Read more about Fastlane","card.fastlane.a11y.closeDialog":"Close dialog","card.fastlane.mobileInputLabel":"Mobile number","card.fastlane.consentToggle":"Save your info with Fastlane for faster checkouts and more","card.fastlane.consentText":"By saving your info, you agree to get codes by text to use Fastlane everywhere it's available. Fastlane will text the number provided. You also agree to this %#terms%# and %#privacy statement%#.","card.fastlane.modal.benefit1.header":"Autofill your checkouts","card.fastlane.modal.benefit1.text":"Get one-time codes to use card and addresses you’ve saved.","card.fastlane.modal.benefit2.header":"Protect your info","card.fastlane.modal.benefit2.text":"Your payment info is encrypted when it’s stored and sent to places you shop.","card.fastlane.modal.benefit3.header":"Use across stores","card.fastlane.modal.benefit3.text":"Speed through checkout everywhere Fastlane is available.","paybybankpix.redirectBtn.label":"Continue to PIX through OpenBanking","paybybankpix.issuerList.disclaimer":"By continuing, you agree to the %#Consent Notice%# and will be redirected to your bank.","paybybankpix.issuerList.selectField.label":"Bank","paybybankpix.issuerList.introduction.logo.content":"Connect your favorite PIX keys to pay through Open Finance","paybybankpix.await.waitForConfirmation":"Waiting for your confirmation...","paybybankpix.await.timeToPay":"This process will take approximately %{numberOfMin} minute(s)","paybybankpix.await.withOpenFinance":"With the ease of Open Finance","paybybankpix.await.logoAlt.openFinance":"Open Finance","paybybankpix.storedPayment.payButton.label":"Continue payment","paybybankpix.storedPayment.additionalLabel":"%{receiver} account through PIX","paybybankpix.await.fetchDetails":"Fetching details...","eftpad-canada.input.accountHolderName.label":"Account holder name","eftpad-canada.input.accountHolderName.error":"Enter an account holder name","eftpad-canada.input.accountNumber.label":"Account number","eftpad-canada.input.accountNumber.contextualText":"Between 7 and 12 digits","eftpad-canada.input.accountNumber.error":"Enter an account number that is between 7 and 12 digits","eftpad-canada.input.institutionNumber.label":"Institution number","eftpad-canada.input.institutionNumber.contextualText":"3 digits","eftpad-canada.input.institutionNumber.error":"Enter an institution number that consists of 3 digits","eftpad-canada.input.transitNumber.label":"Transit number","eftpad-canada.input.transitNumber.contextualText":"5 digits","eftpad-canada.input.transitNumber.error":"Enter a transit number that consists of 5 digits","eftpad-canada.settlement-info":"The funds will be withdrawn from your bank account within 1–3 business days.","upi.mandate.intro":"You’re setting up a UPI Autopay recurring payment","upi.mandate.max.extraText":"You’ll approve a higher limit to allow future plan changes","upi.mandate.upTo":"up to %{amount}","upi.mandate.frequency.monthly":"/month","upi.mandate.frequency.weekly":"/week","upi.mandate.frequency.adhoc":" as presented",bankList:"Bank list",qrCode:"QR code","iris.instructions.generateQrCode":"After generating the QR code you can use your preferred banking app to complete the payment.","iris.instructions.payment.step1":"Open your preferred banking app.","iris.instructions.payment.step2":"Scan the QR code with your banking app.","iris.instructions.payment.step3":"Complete the payment in the app and wait for the confirmation here.","econtext.customerNumber":"Customer number","econtext.confirmationNumber":"Confirmation number","econtext.useBefore":"Use before","econtext.paymentInformation":"Payment information","issuerList.separatorText":"or choose from list","upi.intent.apps.title":"Options","upi.intent.apps.dropdown.label":"UPI apps","upi.intent.apps.dropdown.placeholder":"Choose preferred app"};export{e as default};
2
2
  //# sourceMappingURL=en-US.json.js.map
@@ -1,2 +1,2 @@
1
- import{hasOwnProperty as e}from"./hasOwnProperty.js";const t=(t,a,r,n)=>r=>{var o;const s={};if((r.origin||(null===(o=r.originalEvent)||void 0===o?void 0:o.origin))!==t)return"Message was not sent from the expected domain";if("string"!=typeof r.data)return"Event data was not of type string";if(!r.data.length)return"Invalid event data string";try{const t=JSON.parse(r.data);if(!e(t,"type")||t.type!==n)return"Event data was not of expected type";a(t)}catch(e){return s.type=`${n}-JSON-parse-error`,s.comment="failed to JSON parse event.data",s.extraInfo=`event.data = ${r.data}`,s.eventDataRaw=r.data,console.debug("get-process-message-handler::CATCH::Un-parseable JSON:: parseErrorObj=",s),!1}return!0};export{t as default};
1
+ import{hasOwnProperty as e}from"./hasOwnProperty.js";const t=(t,a,r,n)=>r=>{const o={};if(r.origin!==t)return"Message was not sent from the expected domain";if("string"!=typeof r.data)return"Event data from expected domain but not in expected form";if(!r.data.length)return"Event data from expected domain, in expected form, but empty";try{const t=JSON.parse(r.data);return t&&"object"==typeof t&&e(t,"type")?t.type===n?(a(t),!0):'Event data has "type" but the object is not in the expected form':"Event data had no type"}catch(e){return o.type=`${n}-JSON-parse-error`,o.comment="failed to JSON parse event.data",o.extraInfo=`event.data = ${r.data}`,o.eventDataRaw=r.data,console.debug("get-process-message-handler::CATCH::Un-parseable JSON:: parseErrorObj=",o),!1}};export{t as default};
2
2
  //# sourceMappingURL=get-process-message-handler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-process-message-handler.js","sources":["../../../src/utils/get-process-message-handler.ts"],"sourcesContent":["/**\n * Centralised window.postMessage processing function used in 3DS2 components and also by the deviceFingerprinting process\n * NOTE: this latter use case means that while the deviceFingerprinting is still completing this component is also listening to\n * securedFields related postMessaging\n *\n * @param domain - expected domain for the postMesssage to have originated from\n * @param resolve - the resolve function from the Promise that called this function\n * @param reject - the reject function from the Promise that called this function\n * @param parseErrorObj - an error object to log in the case of unparseable data (albeit from a valid origin)\n * @param expectedType - string to check that the passed data has the expected type\n */\nimport { hasOwnProperty } from './hasOwnProperty';\nimport { PostMsgParseErrorObject } from '../components/ThreeDS2/types';\n\nconst getProcessMessageHandler =\n (domain: string, resolve: Function, reject: Function, expectedType: string): Function =>\n event => {\n const parseErrorObj: PostMsgParseErrorObject = {};\n const origin = event.origin || event.originalEvent?.origin;\n\n if (origin !== domain) {\n return 'Message was not sent from the expected domain';\n }\n\n if (typeof event.data !== 'string') {\n return 'Event data was not of type string';\n }\n\n if (!event.data.length) {\n return 'Invalid event data string';\n }\n\n // Try to parse the data\n try {\n const feedbackObj = JSON.parse(event.data);\n if (hasOwnProperty(feedbackObj, 'type') && feedbackObj.type === expectedType) {\n resolve(feedbackObj);\n } else {\n // Silent fail - applies when RiskModule device fingerprinting is ongoing and this handler is picking up securedFields traffic\n return 'Event data was not of expected type';\n }\n } catch (e) {\n parseErrorObj.type = `${expectedType}-JSON-parse-error`;\n parseErrorObj.comment = 'failed to JSON parse event.data';\n parseErrorObj.extraInfo = `event.data = ${event.data}`;\n parseErrorObj.eventDataRaw = event.data;\n\n // TODO - decide whether to console.log/debug/error &/or call the merchant defined onError callback\n console.debug('get-process-message-handler::CATCH::Un-parseable JSON:: parseErrorObj=', parseErrorObj);\n\n return false;\n }\n\n return true;\n };\n\nexport default getProcessMessageHandler;\n"],"names":["getProcessMessageHandler","domain","resolve","reject","expectedType","event","parseErrorObj","origin","originalEvent","data","length","feedbackObj","JSON","parse","hasOwnProperty","type","e","comment","extraInfo","eventDataRaw","console","debug"],"mappings":"qDAcA,MAAMA,EACF,CAACC,EAAgBC,EAAmBC,EAAkBC,IACtDC,IAEmCA,IAAAA,EAD/B,MAAMC,EAAyC,CAAA,EAG/C,IAFeD,EAAME,SAA6B,QAAnBF,EAAAA,EAAMG,qBAANH,IAAAA,OAAAA,EAAAA,EAAqBE,WAErCN,EACX,MAAO,gDAGX,GAA0B,iBAAfI,EAAMI,KACb,MAAO,oCAGX,IAAKJ,EAAMI,KAAKC,OACZ,MAAO,4BAIX,IACI,MAAMC,EAAcC,KAAKC,MAAMR,EAAMI,MACrC,IAAIK,EAAeH,EAAa,SAAWA,EAAYI,OAASX,EAI5D,MAAO,sCAHPF,EAAQS,EAKhB,CAAE,MAAOK,GASL,OARAV,EAAcS,KAAO,GAAGX,qBACxBE,EAAcW,QAAU,kCACxBX,EAAcY,UAAY,gBAAgBb,EAAMI,OAChDH,EAAca,aAAed,EAAMI,KAGnCW,QAAQC,MAAM,yEAA0Ef,IAEjF,CACX,CAEA,OAAO"}
1
+ {"version":3,"file":"get-process-message-handler.js","sources":["../../../src/utils/get-process-message-handler.ts"],"sourcesContent":["/**\n * Centralised window.postMessage processing function used in 3DS2 components and *also* by the RiskModule's device fingerprinting process\n * NOTE: this latter use case means that while the deviceFingerprinting is still completing this component is also listening to\n * securedFields related postMessaging\n *\n * @param domain - expected domain for the postMesssage to have originated from\n * @param resolve - the resolve function from the Promise that called this function\n * @param reject - the reject function from the Promise that called this function\n * @param parseErrorObj - an error object to log in the case of unparseable data (albeit from a valid origin)\n * @param expectedType - string to check that the message event's data has the expected type\n */\nimport { hasOwnProperty } from './hasOwnProperty';\nimport { PostMsgParseErrorObject } from '../components/ThreeDS2/types';\n\nconst getProcessMessageHandler =\n (\n domain: string,\n resolve: (value: unknown) => void,\n reject: (reason?: unknown) => void,\n expectedType: string\n ): ((event: Pick<MessageEvent, 'origin' | 'data'>) => string | boolean) =>\n (event: Pick<MessageEvent, 'origin' | 'data'>): string | boolean => {\n const parseErrorObj: PostMsgParseErrorObject = {};\n const origin = event.origin;\n\n if (origin !== domain) {\n // FAIL SILENTLY: if it's not from the expected domain then it's not our traffic\n return 'Message was not sent from the expected domain';\n }\n\n /**\n * At this point we know the message is from the expected domain\n * - so is presumably \"our\" traffic and not random messages from the merchant's site, the build process, or from the browser (or extensions)\n * // TODO - Do more here in terms of logging to help debug issues with 3DS2\n */\n\n if (typeof event.data !== 'string') {\n // If it's from our domain but not a string - log this somewhere?\n return 'Event data from expected domain but not in expected form';\n }\n\n if (!event.data.length) {\n // If it's from our domain, is a string, but is empty - log this somewhere?\n return 'Event data from expected domain, in expected form, but empty';\n }\n\n // Try to parse the data\n try {\n const feedbackObj = JSON.parse(event.data) as Record<string, unknown>;\n if (feedbackObj && typeof feedbackObj === 'object' && hasOwnProperty(feedbackObj, 'type')) {\n if (feedbackObj.type === expectedType) {\n // Happy flow\n resolve(feedbackObj);\n return true;\n } else {\n // feedbackObj.type != expectedType - log this somewhere?\n return 'Event data has \"type\" but the object is not in the expected form';\n }\n } else {\n // FAIL SILENTLY: event.data had no 'type' property\n // example: applies when RiskModule device fingerprinting is ongoing and this handler is picking up securedFields traffic\n // - But, *if* we know we're in 3DS2 scenario - log this somewhere?\n return 'Event data had no type';\n }\n } catch (e) {\n parseErrorObj.type = `${expectedType}-JSON-parse-error`;\n parseErrorObj.comment = 'failed to JSON parse event.data';\n parseErrorObj.extraInfo = `event.data = ${event.data}`;\n parseErrorObj.eventDataRaw = event.data;\n\n // TODO - decide whether to console.log/debug/error &/or call the merchant defined onError callback\n console.debug('get-process-message-handler::CATCH::Un-parseable JSON:: parseErrorObj=', parseErrorObj);\n\n return false;\n }\n };\n\nexport default getProcessMessageHandler;\n"],"names":["getProcessMessageHandler","domain","resolve","reject","expectedType","event","parseErrorObj","origin","data","length","feedbackObj","JSON","parse","hasOwnProperty","type","e","comment","extraInfo","eventDataRaw","console","debug"],"mappings":"qDAcA,MAAMA,EACF,CACIC,EACAC,EACAC,EACAC,IAEHC,IACG,MAAMC,EAAyC,CAAA,EAG/C,GAFeD,EAAME,SAENN,EAEX,MAAO,gDASX,GAA0B,iBAAfI,EAAMG,KAEb,MAAO,2DAGX,IAAKH,EAAMG,KAAKC,OAEZ,MAAO,+DAIX,IACI,MAAMC,EAAcC,KAAKC,MAAMP,EAAMG,MACrC,OAAIE,GAAsC,iBAAhBA,GAA4BG,EAAeH,EAAa,QAC1EA,EAAYI,OAASV,GAErBF,EAAQQ,IACD,GAGA,mEAMJ,wBAEf,CAAE,MAAOK,GASL,OARAT,EAAcQ,KAAO,GAAGV,qBACxBE,EAAcU,QAAU,kCACxBV,EAAcW,UAAY,gBAAgBZ,EAAMG,OAChDF,EAAcY,aAAeb,EAAMG,KAGnCW,QAAQC,MAAM,yEAA0Ed,IAEjF,CACX"}