@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":"validate.js","sources":["../../../../../src/components/PayTo/components/validate.ts"],"sourcesContent":["import { ValidatorRule, ValidatorRules } from '../../../utils/Validator/types';\nimport { isEmpty } from '../../../utils/validator-utils';\nimport { ERROR_FIELD_INVALID, ERROR_FIELD_REQUIRED } from '../../../core/Errors/constants';\n\nconst abnRegex = /^((\\d{9})|(\\d{11}))$/;\n\nconst orgidRegex = /`^[!-@[-~][ -@[-~]{0,254}[!-@[-~]$`/;\n\nconst emailRegex =\n /^(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)$/;\n\n// Full phone number regex with country code: ^+\\[0-9\\]{1,3}-\\[1-9\\]{1,1}\\[0-9\\]{1,29}$\nconst phoneNumberRegexWithoutCountryCode = /^[0-9]{1,29}$/;\n\nexport const validationFromRegex = (value: string, regex: RegExp, validationRule: ValidatorRule): boolean | null => {\n // null is returned here for legacy reasons\n // check comment on hasError() ValidatorRulesResult.ts:17\n if (isEmpty(value)) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return null;\n }\n validationRule.errorMessage = ERROR_FIELD_INVALID;\n return regex.test(value);\n};\n\nconst emailValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, emailRegex, emailValidatorRule),\n errorMessage: 'abn.invalid',\n modes: ['blur']\n};\n\nconst abnValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, abnRegex, abnValidatorRule),\n errorMessage: 'abn.invalid',\n modes: ['blur']\n};\n\nconst orgidValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, orgidRegex, orgidValidatorRule),\n errorMessage: 'orgid.invalid',\n modes: ['blur']\n};\n\nexport const payIdValidationRules: ValidatorRules = {\n default: {\n validate: value => {\n return value && value.length > 0;\n },\n errorMessage: ERROR_FIELD_REQUIRED,\n modes: ['blur']\n },\n email: emailValidatorRule,\n abn: abnValidatorRule,\n orgid: orgidValidatorRule,\n firstName: {\n validate: value => (isEmpty(value) ? null : true), // valid, if there are chars other than spaces,\n errorMessage: 'firstName.invalid',\n modes: ['blur']\n },\n lastName: {\n validate: value => (isEmpty(value) ? null : true),\n errorMessage: 'lastName.invalid',\n modes: ['blur']\n },\n phoneNumber: {\n modes: ['blur'],\n validate: value => {\n return isEmpty(value) ? null : phoneNumberRegexWithoutCountryCode.test(value);\n },\n errorMessage: 'mobileNumber.invalid'\n },\n phonePrefix: {\n modes: ['blur'],\n validate: phonePrefix => !!phonePrefix,\n errorMessage: 'mobileNumber.invalid'\n }\n};\n\n//original regex /^\\d{6}-[ -~]{1,28}$/\nconst bsbRegex = /^\\d{6}$/;\nconst bankAccountNumberRegex = /^[ -~]{1,28}$/;\n\nconst bsbValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, bsbRegex, bsbValidatorRule),\n errorMessage: 'bsb.invalid',\n modes: ['blur']\n};\n\nconst bankAccountNumberValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, bankAccountNumberRegex, bankAccountNumberValidatorRule),\n errorMessage: 'bankAccountNumber.invalid',\n modes: ['blur']\n};\n\nexport const bsbValidationRules: ValidatorRules = {\n bsb: bsbValidatorRule,\n bankAccountNumber: bankAccountNumberValidatorRule,\n firstName: {\n validate: value => (isEmpty(value) ? null : true), // valid, if there are chars other than spaces,\n errorMessage: 'firstName.invalid',\n modes: ['blur']\n },\n lastName: {\n validate: value => (isEmpty(value) ? null : true),\n errorMessage: 'lastName.invalid',\n modes: ['blur']\n }\n};\n"],"names":["abnRegex","orgidRegex","emailRegex","phoneNumberRegexWithoutCountryCode","validationFromRegex","value","regex","validationRule","isEmpty","errorMessage","ERROR_FIELD_REQUIRED","ERROR_FIELD_INVALID","test","emailValidatorRule","validate","modes","abnValidatorRule","orgidValidatorRule","payIdValidationRules","default","length","email","abn","orgid","firstName","lastName","phoneNumber","phonePrefix","bsbRegex","bankAccountNumberRegex","bsbValidatorRule","bankAccountNumberValidatorRule","bsbValidationRules","bsb","bankAccountNumber"],"mappings":"8JAIA,MAAMA,EAAW,uBAEXC,EAAa,sCAEbC,EACF,sKAGEC,EAAqC,gBAE9BC,EAAsB,CAACC,EAAeC,EAAeC,IAG1DC,EAAQH,IACRE,EAAeE,aAAeC,EACvB,OAEXH,EAAeE,aAAeE,EACvBL,EAAMM,KAAKP,IAGhBQ,EAAoC,CACtCC,SAAUT,GAASD,EAAoBC,EAAOH,EAAYW,GAC1DJ,aAAc,cACdM,MAAO,CAAC,SAGNC,EAAkC,CACpCF,SAAUT,GAASD,EAAoBC,EAAOL,EAAUgB,GACxDP,aAAc,cACdM,MAAO,CAAC,SAGNE,EAAoC,CACtCH,SAAUT,GAASD,EAAoBC,EAAOJ,EAAYgB,GAC1DR,aAAc,gBACdM,MAAO,CAAC,SAGCG,EAAuC,CAChDC,QAAS,CACLL,SAAUT,GACCA,GAASA,EAAMe,OAAS,EAEnCX,aAAcC,EACdK,MAAO,CAAC,SAEZM,MAAOR,EACPS,IAAKN,EACLO,MAAON,EACPO,UAAW,CACPV,SAAUT,IAAUG,EAAQH,IAAS,KACrCI,aAAc,oBACdM,MAAO,CAAC,SAEZU,SAAU,CACNX,SAAUT,IAAUG,EAAQH,IAAS,KACrCI,aAAc,mBACdM,MAAO,CAAC,SAEZW,YAAa,CACTX,MAAO,CAAC,QACRD,SAAUT,GACCG,EAAQH,GAAS,KAAOF,EAAmCS,KAAKP,GAE3EI,aAAc,wBAElBkB,YAAa,CACTZ,MAAO,CAAC,QACRD,SAAUa,KAAiBA,EAC3BlB,aAAc,yBAKhBmB,EAAW,UACXC,EAAyB,gBAEzBC,EAAkC,CACpChB,SAAUT,GAASD,EAAoBC,EAAOuB,EAAUE,GACxDrB,aAAc,cACdM,MAAO,CAAC,SAGNgB,EAAgD,CAClDjB,SAAUT,GAASD,EAAoBC,EAAOwB,EAAwBE,GACtEtB,aAAc,4BACdM,MAAO,CAAC,SAGCiB,EAAqC,CAC9CC,IAAKH,EACLI,kBAAmBH,EACnBP,UAAW,CACPV,SAAUT,IAAUG,EAAQH,IAAS,KACrCI,aAAc,oBACdM,MAAO,CAAC,SAEZU,SAAU,CACNX,SAAUT,IAAUG,EAAQH,IAAS,KACrCI,aAAc,mBACdM,MAAO,CAAC"}
1
+ {"version":3,"file":"validate.js","sources":["../../../../../src/components/PayTo/components/validate.ts"],"sourcesContent":["import { ValidatorRule, ValidatorRules } from '../../../utils/Validator/types';\nimport { isEmpty } from '../../../utils/validator-utils';\nimport { ERROR_FIELD_INVALID, ERROR_FIELD_REQUIRED } from '../../../core/Errors/constants';\n\nconst abnRegex = /^((\\d{9})|(\\d{11}))$/;\n\nconst orgidRegex = /`^[!-@[-~][ -@[-~]{0,254}[!-@[-~]$`/;\n\nconst emailRegex =\n /^(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)$/;\n\n// Full phone number regex with country code: ^+\\[0-9\\]{1,3}-\\[1-9\\]{1,1}\\[0-9\\]{1,29}$\nconst phoneNumberRegexWithoutCountryCode = /^[0-9]{1,29}$/;\n\nexport const validationFromRegex = (value: string, regex: RegExp, validationRule: ValidatorRule): boolean | null => {\n // null is returned here for legacy reasons\n // check comment on hasError() ValidatorRulesResult.ts:17\n if (isEmpty(value)) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return null;\n }\n validationRule.errorMessage = ERROR_FIELD_INVALID;\n return regex.test(value);\n};\n\nconst emailValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, emailRegex, emailValidatorRule),\n errorMessage: 'abn.invalid',\n modes: ['blur']\n};\n\nconst abnValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, abnRegex, abnValidatorRule),\n errorMessage: 'abn.invalid',\n modes: ['blur']\n};\n\nconst orgidValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, orgidRegex, orgidValidatorRule),\n errorMessage: 'orgid.invalid',\n modes: ['blur']\n};\n\nexport const payIdValidationRules: ValidatorRules = {\n default: {\n validate: value => {\n return value && value.length > 0;\n },\n errorMessage: ERROR_FIELD_REQUIRED,\n modes: ['blur']\n },\n email: emailValidatorRule,\n abn: abnValidatorRule,\n orgid: orgidValidatorRule,\n firstName: {\n validate: value => (isEmpty(value) ? null : true), // valid, if there are chars other than spaces,\n errorMessage: 'payto.errors.accountHolderFirstName.invalid',\n modes: ['blur']\n },\n lastName: {\n validate: value => (isEmpty(value) ? null : true),\n errorMessage: 'payto.errors.accountHolderLastName.invalid',\n modes: ['blur']\n },\n phoneNumber: {\n modes: ['blur'],\n validate: value => {\n return isEmpty(value) ? null : phoneNumberRegexWithoutCountryCode.test(value);\n },\n errorMessage: 'mobileNumber.invalid'\n },\n phonePrefix: {\n modes: ['blur'],\n validate: phonePrefix => !!phonePrefix,\n errorMessage: 'mobileNumber.invalid'\n }\n};\n\n//original regex /^\\d{6}-[ -~]{1,28}$/\nconst bsbRegex = /^\\d{6}$/;\nconst bankAccountNumberRegex = /^[ -~]{1,28}$/;\n\nconst bsbValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, bsbRegex, bsbValidatorRule),\n errorMessage: 'bsb.invalid',\n modes: ['blur']\n};\n\nconst bankAccountNumberValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, bankAccountNumberRegex, bankAccountNumberValidatorRule),\n errorMessage: 'bankAccountNumber.invalid',\n modes: ['blur']\n};\n\nexport const bsbValidationRules: ValidatorRules = {\n bsb: bsbValidatorRule,\n bankAccountNumber: bankAccountNumberValidatorRule,\n firstName: {\n validate: value => (isEmpty(value) ? null : true), // valid, if there are chars other than spaces,\n errorMessage: 'payto.errors.accountHolderFirstName.invalid',\n modes: ['blur']\n },\n lastName: {\n validate: value => (isEmpty(value) ? null : true),\n errorMessage: 'payto.errors.accountHolderLastName.invalid',\n modes: ['blur']\n }\n};\n"],"names":["abnRegex","orgidRegex","emailRegex","phoneNumberRegexWithoutCountryCode","validationFromRegex","value","regex","validationRule","isEmpty","errorMessage","ERROR_FIELD_REQUIRED","ERROR_FIELD_INVALID","test","emailValidatorRule","validate","modes","abnValidatorRule","orgidValidatorRule","payIdValidationRules","default","length","email","abn","orgid","firstName","lastName","phoneNumber","phonePrefix","bsbRegex","bankAccountNumberRegex","bsbValidatorRule","bankAccountNumberValidatorRule","bsbValidationRules","bsb","bankAccountNumber"],"mappings":"8JAIA,MAAMA,EAAW,uBAEXC,EAAa,sCAEbC,EACF,sKAGEC,EAAqC,gBAE9BC,EAAsB,CAACC,EAAeC,EAAeC,IAG1DC,EAAQH,IACRE,EAAeE,aAAeC,EACvB,OAEXH,EAAeE,aAAeE,EACvBL,EAAMM,KAAKP,IAGhBQ,EAAoC,CACtCC,SAAUT,GAASD,EAAoBC,EAAOH,EAAYW,GAC1DJ,aAAc,cACdM,MAAO,CAAC,SAGNC,EAAkC,CACpCF,SAAUT,GAASD,EAAoBC,EAAOL,EAAUgB,GACxDP,aAAc,cACdM,MAAO,CAAC,SAGNE,EAAoC,CACtCH,SAAUT,GAASD,EAAoBC,EAAOJ,EAAYgB,GAC1DR,aAAc,gBACdM,MAAO,CAAC,SAGCG,EAAuC,CAChDC,QAAS,CACLL,SAAUT,GACCA,GAASA,EAAMe,OAAS,EAEnCX,aAAcC,EACdK,MAAO,CAAC,SAEZM,MAAOR,EACPS,IAAKN,EACLO,MAAON,EACPO,UAAW,CACPV,SAAUT,IAAUG,EAAQH,IAAS,KACrCI,aAAc,8CACdM,MAAO,CAAC,SAEZU,SAAU,CACNX,SAAUT,IAAUG,EAAQH,IAAS,KACrCI,aAAc,6CACdM,MAAO,CAAC,SAEZW,YAAa,CACTX,MAAO,CAAC,QACRD,SAAUT,GACCG,EAAQH,GAAS,KAAOF,EAAmCS,KAAKP,GAE3EI,aAAc,wBAElBkB,YAAa,CACTZ,MAAO,CAAC,QACRD,SAAUa,KAAiBA,EAC3BlB,aAAc,yBAKhBmB,EAAW,UACXC,EAAyB,gBAEzBC,EAAkC,CACpChB,SAAUT,GAASD,EAAoBC,EAAOuB,EAAUE,GACxDrB,aAAc,cACdM,MAAO,CAAC,SAGNgB,EAAgD,CAClDjB,SAAUT,GAASD,EAAoBC,EAAOwB,EAAwBE,GACtEtB,aAAc,4BACdM,MAAO,CAAC,SAGCiB,EAAqC,CAC9CC,IAAKH,EACLI,kBAAmBH,EACnBP,UAAW,CACPV,SAAUT,IAAUG,EAAQH,IAAS,KACrCI,aAAc,8CACdM,MAAO,CAAC,SAEZU,SAAU,CACNX,SAAUT,IAAUG,EAAQH,IAAS,KACrCI,aAAc,6CACdM,MAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreeDS2Challenge.js","sources":["../../../../src/components/ThreeDS2/ThreeDS2Challenge.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PrepareChallenge from './components/Challenge';\nimport { DEFAULT_CHALLENGE_WINDOW_SIZE, THREEDS2_CHALLENGE, THREEDS2_CHALLENGE_ERROR } from './constants';\nimport { existy } from '../../utils/commonUtils';\nimport { hasOwnProperty } from '../../utils/hasOwnProperty';\nimport { TxVariants } from '../tx-variants';\nimport { ChallengeResolveData, LegacyChallengeResolveData, ThreeDS2ChallengeConfiguration } from './types';\nimport AdyenCheckoutError, { API_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { ActionHandledReturnObject } from '../../types/global-types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass ThreeDS2Challenge extends UIElement<ThreeDS2ChallengeConfiguration> {\n public static readonly type = TxVariants.threeDS2Challenge;\n\n public static readonly defaultProps = {\n dataKey: 'threeDSResult',\n size: DEFAULT_CHALLENGE_WINDOW_SIZE,\n type: THREEDS2_CHALLENGE\n };\n\n protected override beforeRender() {\n /* Do not send rendered events for ThreeDS2Challenge - it will have the same timestamp as the \"creq sent\" event */\n }\n\n protected onActionHandled = (rtnObj: ActionHandledReturnObject) => {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.challengeIframeLoaded,\n message: rtnObj.actionDescription\n });\n\n this.submitAnalytics(event);\n\n super.onActionHandled(rtnObj);\n };\n\n /**\n * Will make a call to onAdditionalDetails (as set in actionTypes.ts) for the regular, \"native\" flow.\n * However, if the action to create this component came from the 3DS2InMDFlow process it will instead equal a call to the onComplete callback\n * (as defined in the 3DS2InMDFlow and passed in as a config prop).\n */\n onComplete(state: LegacyChallengeResolveData | ChallengeResolveData) {\n if (this.props.isMDFlow) {\n this.props.on3DS2RedirectFlowComplete?.(state, this.elementRef);\n } else {\n super.onComplete(state);\n }\n\n this.unmount(); // re. fixing issue around back to back challenge calls\n }\n\n protected override componentToRender(): h.JSX.Element {\n // existy used because threeds2InMDFlow might send an empty string for paymentData and we should be allowed to proceed with this\n if (!existy(this.props.paymentData)) {\n /**\n * The presence of props.isMDFlow indicates the action to create this component came from the threeds2InMDFlow process which passes (an empty) paymentsData.\n * The regular, \"native\" flow uses the authorisationToken from the 3DS2 action, which actionTypes.ts assigns to a property called paymentData\n */\n const dataTypeForError = hasOwnProperty(this.props, 'isMDFlow') ? 'paymentData' : 'authorisationToken';\n\n this.props.onError(new AdyenCheckoutError(API_ERROR, `No ${dataTypeForError} received. 3DS2 Challenge cannot proceed`));\n\n const event = new AnalyticsErrorEvent({\n component: this.type,\n code: ErrorEventCode.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: Missing 'paymentData' property from threeDS2 action`\n });\n\n this.submitAnalytics(event);\n\n return null;\n }\n\n return (\n <PrepareChallenge\n {...this.props}\n onComplete={this.onComplete}\n onSubmitAnalytics={this.submitAnalytics}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n}\n\nexport default ThreeDS2Challenge;\n"],"names":["ThreeDS2Challenge","UIElement","beforeRender","onComplete","state","this","props","isMDFlow","on3DS2RedirectFlowComplete","elementRef","super","unmount","componentToRender","existy","paymentData","dataTypeForError","hasOwnProperty","onError","AdyenCheckoutError","API_ERROR","event","AnalyticsErrorEvent","component","type","code","ErrorEventCode","THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA","errorType","ErrorEventType","threeDS2","message","THREEDS2_CHALLENGE_ERROR","submitAnalytics","h","PrepareChallenge","onSubmitAnalytics","onActionHandled","args","_define_property","rtnObj","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","challengeIframeLoaded","actionDescription","TxVariants","threeDS2Challenge","defaultProps","dataKey","size","DEFAULT_CHALLENGE_WINDOW_SIZE","THREEDS2_CHALLENGE"],"mappings":"q5BAaA,MAAMA,UAA0BC,EASTC,YAAAA,GAEnB,CAoBAC,UAAAA,CAAWC,GACHC,KAAKC,MAAMC,SACXF,KAAKC,MAAME,6BAA6BJ,EAAOC,KAAKI,YAEpDC,MAAMP,WAAWC,GAGrBC,KAAKM,SACT,CAEmBC,iBAAAA,GAEf,IAAKC,EAAOR,KAAKC,MAAMQ,aAAc,CAKjC,MAAMC,EAAmBC,EAAeX,KAAKC,MAAO,YAAc,cAAgB,qBAElFD,KAAKC,MAAMW,QAAQ,IAAIC,EAAmBC,EAAW,MAAMJ,8CAE3D,MAAMK,EAAQ,IAAIC,EAAoB,CAClCC,UAAWjB,KAAKkB,KAChBC,KAAMC,EAAeC,wCACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,2DAKhB,OAFA1B,KAAK2B,gBAAgBZ,GAEd,IACX,CAEA,OACIa,EAACC,EAAAA,IACO7B,KAAKC,MACTH,WAAYE,KAAKF,WACjBgC,kBAAmB9B,KAAK2B,gBACxBI,gBAAiB/B,KAAK+B,iBAGlC,mBAxEJ1B,SAAA2B,GAaIC,EAAAjC,KAAU+B,kBAAmBG,IACzB,MAAMnB,EAAQ,IAAIoB,EAAkB,CAChClB,UAAWjB,KAAKkB,KAChBA,KAAMkB,EAAaZ,SACnBa,QAASC,EAAgBC,sBACzBd,QAASS,EAAOM,oBAGpBxC,KAAK2B,gBAAgBZ,GAErBV,MAAM0B,gBAAgBG,MAtB1BD,EADEtC,EACqBuB,OAAOuB,EAAWC,mBAEzCT,EAHEtC,EAGqBgD,eAAe,CAClCC,QAAS,gBACTC,KAAMC,EACN5B,KAAM6B"}
1
+ {"version":3,"file":"ThreeDS2Challenge.js","sources":["../../../../src/components/ThreeDS2/ThreeDS2Challenge.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PrepareChallenge from './components/Challenge';\nimport { DEFAULT_CHALLENGE_WINDOW_SIZE, THREEDS2_CHALLENGE, THREEDS2_CHALLENGE_ERROR } from './constants';\nimport { existy } from '../../utils/commonUtils';\nimport { hasOwnProperty } from '../../utils/hasOwnProperty';\nimport { TxVariants } from '../tx-variants';\nimport { ChallengeResolveData, ThreeDS2ChallengeConfiguration } from './types';\nimport AdyenCheckoutError, { API_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { ActionHandledReturnObject } from '../../types/global-types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass ThreeDS2Challenge extends UIElement<ThreeDS2ChallengeConfiguration> {\n public static readonly type = TxVariants.threeDS2Challenge;\n\n public static readonly defaultProps = {\n dataKey: 'threeDSResult',\n size: DEFAULT_CHALLENGE_WINDOW_SIZE,\n type: THREEDS2_CHALLENGE\n };\n\n protected override beforeRender() {\n /* Do not send rendered events for ThreeDS2Challenge - it will have the same timestamp as the \"creq sent\" event */\n }\n\n protected onActionHandled = (rtnObj: ActionHandledReturnObject) => {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.challengeIframeLoaded,\n message: rtnObj.actionDescription\n });\n\n this.submitAnalytics(event);\n\n super.onActionHandled(rtnObj);\n };\n\n /**\n * Will make a call to onAdditionalDetails (as set in actionTypes.ts) for the regular, \"native\" flow.\n * However, if the action to create this component came from the 3DS2InMDFlow process it will instead equal a call to the onComplete callback\n * (as defined in the 3DS2InMDFlow and passed in as a config prop).\n */\n onComplete(state: ChallengeResolveData) {\n if (this.props.isMDFlow) {\n this.props.on3DS2RedirectFlowComplete?.(state, this.elementRef);\n } else {\n super.onComplete(state);\n }\n\n this.unmount(); // re. fixing issue around back to back challenge calls\n }\n\n protected override componentToRender(): h.JSX.Element {\n // existy used because threeds2InMDFlow might send an empty string for paymentData and we should be allowed to proceed with this\n if (!existy(this.props.paymentData)) {\n /**\n * The presence of props.isMDFlow indicates the action to create this component came from the threeds2InMDFlow process which passes (an empty) paymentsData.\n * The regular, \"native\" flow uses the authorisationToken from the 3DS2 action, which actionTypes.ts assigns to a property called paymentData\n */\n const dataTypeForError = hasOwnProperty(this.props, 'isMDFlow') ? 'paymentData' : 'authorisationToken';\n\n this.props.onError(new AdyenCheckoutError(API_ERROR, `No ${dataTypeForError} received. 3DS2 Challenge cannot proceed`));\n\n const event = new AnalyticsErrorEvent({\n component: this.type,\n code: ErrorEventCode.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: Missing 'paymentData' property from threeDS2 action`\n });\n\n this.submitAnalytics(event);\n\n return null;\n }\n\n return (\n <PrepareChallenge\n {...this.props}\n onComplete={this.onComplete}\n onSubmitAnalytics={this.submitAnalytics}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n}\n\nexport default ThreeDS2Challenge;\n"],"names":["ThreeDS2Challenge","UIElement","beforeRender","onComplete","state","this","props","isMDFlow","on3DS2RedirectFlowComplete","elementRef","super","unmount","componentToRender","existy","paymentData","dataTypeForError","hasOwnProperty","onError","AdyenCheckoutError","API_ERROR","event","AnalyticsErrorEvent","component","type","code","ErrorEventCode","THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA","errorType","ErrorEventType","threeDS2","message","THREEDS2_CHALLENGE_ERROR","submitAnalytics","h","PrepareChallenge","onSubmitAnalytics","onActionHandled","args","_define_property","rtnObj","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","challengeIframeLoaded","actionDescription","TxVariants","threeDS2Challenge","defaultProps","dataKey","size","DEFAULT_CHALLENGE_WINDOW_SIZE","THREEDS2_CHALLENGE"],"mappings":"q5BAaA,MAAMA,UAA0BC,EASTC,YAAAA,GAEnB,CAoBAC,UAAAA,CAAWC,GACHC,KAAKC,MAAMC,SACXF,KAAKC,MAAME,6BAA6BJ,EAAOC,KAAKI,YAEpDC,MAAMP,WAAWC,GAGrBC,KAAKM,SACT,CAEmBC,iBAAAA,GAEf,IAAKC,EAAOR,KAAKC,MAAMQ,aAAc,CAKjC,MAAMC,EAAmBC,EAAeX,KAAKC,MAAO,YAAc,cAAgB,qBAElFD,KAAKC,MAAMW,QAAQ,IAAIC,EAAmBC,EAAW,MAAMJ,8CAE3D,MAAMK,EAAQ,IAAIC,EAAoB,CAClCC,UAAWjB,KAAKkB,KAChBC,KAAMC,EAAeC,wCACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,2DAKhB,OAFA1B,KAAK2B,gBAAgBZ,GAEd,IACX,CAEA,OACIa,EAACC,EAAAA,IACO7B,KAAKC,MACTH,WAAYE,KAAKF,WACjBgC,kBAAmB9B,KAAK2B,gBACxBI,gBAAiB/B,KAAK+B,iBAGlC,mBAxEJ1B,SAAA2B,GAaIC,EAAAjC,KAAU+B,kBAAmBG,IACzB,MAAMnB,EAAQ,IAAIoB,EAAkB,CAChClB,UAAWjB,KAAKkB,KAChBA,KAAMkB,EAAaZ,SACnBa,QAASC,EAAgBC,sBACzBd,QAASS,EAAOM,oBAGpBxC,KAAK2B,gBAAgBZ,GAErBV,MAAM0B,gBAAgBG,MAtB1BD,EADEtC,EACqBuB,OAAOuB,EAAWC,mBAEzCT,EAHEtC,EAGqBgD,eAAe,CAClCC,QAAS,gBACTC,KAAMC,EACN5B,KAAM6B"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThreeDS2DeviceFingerprint.js","sources":["../../../../src/components/ThreeDS2/ThreeDS2DeviceFingerprint.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PrepareFingerprint from './components/DeviceFingerprint';\nimport callSubmit3DS2Fingerprint from './callSubmit3DS2Fingerprint';\nimport { existy } from '../../utils/commonUtils';\nimport { TxVariants } from '../tx-variants';\nimport { FingerprintResolveData, LegacyFingerprintResolveData, ThreeDS2DeviceFingerprintConfiguration } from './types';\nimport AdyenCheckoutError, { API_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { THREEDS2_FINGERPRINT, THREEDS2_FINGERPRINT_ERROR } from './constants';\nimport { ActionHandledReturnObject } from '../../types/global-types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass ThreeDS2DeviceFingerprint extends UIElement<ThreeDS2DeviceFingerprintConfiguration> {\n public static readonly type = TxVariants.threeDS2Fingerprint;\n\n public static readonly defaultProps = {\n dataKey: 'fingerprintResult',\n type: THREEDS2_FINGERPRINT\n };\n\n private callSubmit3DS2Fingerprint = callSubmit3DS2Fingerprint.bind(this); // New 3DS2 flow\n\n protected override beforeRender() {\n /* Do not send rendered events for ThreeDS2DeviceFingerprint - it will have the same timestamp as the \"threeDSMethodData sent\" event */\n }\n\n protected onActionHandled = (rtnObj: ActionHandledReturnObject) => {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.fingerprintIframeLoaded,\n message: rtnObj.actionDescription\n });\n\n this.submitAnalytics(event);\n\n super.onActionHandled(rtnObj);\n };\n\n /**\n * Can be called directly from PrepareFingerprint (MDFlow) or after the call to /submitThreeDS2Fingerprint endpoint (native flow)\n */\n onComplete(state: LegacyFingerprintResolveData | FingerprintResolveData) {\n if (this.props.isMDFlow) {\n this.props.on3DS2RedirectFlowComplete?.(state, this.elementRef);\n } else {\n super.onComplete(state);\n }\n\n this.unmount(); // re. fixing issue around back to back fingerprinting calls\n }\n\n protected override componentToRender(): h.JSX.Element {\n /**\n * In the regular components (aka \"native\") flow we can't proceed because something has gone wrong with the payment if paymentData is missing from the threeDS2 action.\n * In the MDFlow the paymentData is always present (albeit an empty string, which is why we use 'existy' since we should be allowed to proceed with this)\n */\n if (!existy(this.props.paymentData)) {\n this.props.onError(new AdyenCheckoutError(API_ERROR, `No paymentData received. 3DS2 Fingerprint cannot proceed`));\n\n // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.type,\n code: ErrorEventCode.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_FINGERPRINT_ERROR}: Missing 'paymentData' property from threeDS2 action`\n });\n\n this.submitAnalytics(event);\n\n return null;\n }\n\n /**\n * this.props.isMDFlow indicates the action to create this component came from the 3DS2InMDFlow process and upon completion should call the\n * passed onComplete callback (as defined in the 3DS2InMDFlow) instead of the /submitThreeDS2Fingerprint endpoint for the regular, \"native\" flow\n */\n return (\n <PrepareFingerprint\n {...this.props}\n // For MDFlow will bypass the /submitThreeDS2Fingerprint endpoint\n onComplete={this.props.isMDFlow ? this.onComplete : this.callSubmit3DS2Fingerprint}\n onSubmitAnalytics={this.submitAnalytics}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n}\n\nexport default ThreeDS2DeviceFingerprint;\n"],"names":["ThreeDS2DeviceFingerprint","UIElement","beforeRender","onComplete","state","this","props","isMDFlow","on3DS2RedirectFlowComplete","elementRef","super","unmount","componentToRender","existy","paymentData","onError","AdyenCheckoutError","API_ERROR","event","AnalyticsErrorEvent","component","type","code","ErrorEventCode","THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA","errorType","ErrorEventType","threeDS2","message","THREEDS2_FINGERPRINT_ERROR","submitAnalytics","h","PrepareFingerprint","callSubmit3DS2Fingerprint","onSubmitAnalytics","onActionHandled","args","_define_property","bind","rtnObj","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","fingerprintIframeLoaded","actionDescription","TxVariants","threeDS2Fingerprint","defaultProps","dataKey","THREEDS2_FINGERPRINT"],"mappings":"+2BAaA,MAAMA,UAAkCC,EAUjBC,YAAAA,GAEnB,CAkBAC,UAAAA,CAAWC,GACHC,KAAKC,MAAMC,SACXF,KAAKC,MAAME,6BAA6BJ,EAAOC,KAAKI,YAEpDC,MAAMP,WAAWC,GAGrBC,KAAKM,SACT,CAEmBC,iBAAAA,GAKf,IAAKC,EAAOR,KAAKC,MAAMQ,aAAc,CACjCT,KAAKC,MAAMS,QAAQ,IAAIC,EAAmBC,EAAW,6DAGrD,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWf,KAAKgB,KAChBC,KAAMC,EAAeC,wCACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,2DAKhB,OAFAxB,KAAKyB,gBAAgBZ,GAEd,IACX,CAMA,OACIa,EAACC,EAAAA,IACO3B,KAAKC,MAETH,WAAYE,KAAKC,MAAMC,SAAWF,KAAKF,WAAaE,KAAK4B,0BACzDC,kBAAmB7B,KAAKyB,gBACxBK,gBAAiB9B,KAAK8B,iBAGlC,mBA1EJzB,SAAA0B,GAQIC,OAAQJ,4BAA4BA,EAA0BK,KAAKjC,OAMnEgC,EAAAhC,KAAU8B,kBAAmBI,IACzB,MAAMrB,EAAQ,IAAIsB,EAAkB,CAChCpB,UAAWf,KAAKgB,KAChBA,KAAMoB,EAAad,SACnBe,QAASC,EAAgBC,wBACzBhB,QAASW,EAAOM,oBAGpBxC,KAAKyB,gBAAgBZ,GAErBR,MAAMyB,gBAAgBI,MAvB1BF,EADErC,EACqBqB,OAAOyB,EAAWC,qBAEzCV,EAHErC,EAGqBgD,eAAe,CAClCC,QAAS,oBACT5B,KAAM6B"}
1
+ {"version":3,"file":"ThreeDS2DeviceFingerprint.js","sources":["../../../../src/components/ThreeDS2/ThreeDS2DeviceFingerprint.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PrepareFingerprint from './components/DeviceFingerprint';\nimport callSubmit3DS2Fingerprint from './callSubmit3DS2Fingerprint';\nimport { existy } from '../../utils/commonUtils';\nimport { TxVariants } from '../tx-variants';\nimport { FingerprintResolveData, ThreeDS2DeviceFingerprintConfiguration } from './types';\nimport AdyenCheckoutError, { API_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { THREEDS2_FINGERPRINT, THREEDS2_FINGERPRINT_ERROR } from './constants';\nimport { ActionHandledReturnObject } from '../../types/global-types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass ThreeDS2DeviceFingerprint extends UIElement<ThreeDS2DeviceFingerprintConfiguration> {\n public static readonly type = TxVariants.threeDS2Fingerprint;\n\n public static readonly defaultProps = {\n dataKey: 'fingerprintResult',\n type: THREEDS2_FINGERPRINT\n };\n\n private callSubmit3DS2Fingerprint = callSubmit3DS2Fingerprint.bind(this); // New 3DS2 flow\n\n protected override beforeRender() {\n /* Do not send rendered events for ThreeDS2DeviceFingerprint - it will have the same timestamp as the \"threeDSMethodData sent\" event */\n }\n\n protected onActionHandled = (rtnObj: ActionHandledReturnObject) => {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.fingerprintIframeLoaded,\n message: rtnObj.actionDescription\n });\n\n this.submitAnalytics(event);\n\n super.onActionHandled(rtnObj);\n };\n\n /**\n * Can be called directly from PrepareFingerprint (MDFlow) or after the call to /submitThreeDS2Fingerprint endpoint (native flow)\n */\n onComplete(state: FingerprintResolveData) {\n if (this.props.isMDFlow) {\n this.props.on3DS2RedirectFlowComplete?.(state, this.elementRef);\n } else {\n super.onComplete(state);\n }\n\n this.unmount(); // re. fixing issue around back to back fingerprinting calls\n }\n\n protected override componentToRender(): h.JSX.Element {\n /**\n * In the regular components (aka \"native\") flow we can't proceed because something has gone wrong with the payment if paymentData is missing from the threeDS2 action.\n * In the MDFlow the paymentData is always present (albeit an empty string, which is why we use 'existy' since we should be allowed to proceed with this)\n */\n if (!existy(this.props.paymentData)) {\n this.props.onError(new AdyenCheckoutError(API_ERROR, `No paymentData received. 3DS2 Fingerprint cannot proceed`));\n\n // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.type,\n code: ErrorEventCode.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_FINGERPRINT_ERROR}: Missing 'paymentData' property from threeDS2 action`\n });\n\n this.submitAnalytics(event);\n\n return null;\n }\n\n /**\n * this.props.isMDFlow indicates the action to create this component came from the 3DS2InMDFlow process and upon completion should call the\n * passed onComplete callback (as defined in the 3DS2InMDFlow) instead of the /submitThreeDS2Fingerprint endpoint for the regular, \"native\" flow\n */\n return (\n <PrepareFingerprint\n {...this.props}\n // For MDFlow will bypass the /submitThreeDS2Fingerprint endpoint\n onComplete={this.props.isMDFlow ? this.onComplete : this.callSubmit3DS2Fingerprint}\n onSubmitAnalytics={this.submitAnalytics}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n}\n\nexport default ThreeDS2DeviceFingerprint;\n"],"names":["ThreeDS2DeviceFingerprint","UIElement","beforeRender","onComplete","state","this","props","isMDFlow","on3DS2RedirectFlowComplete","elementRef","super","unmount","componentToRender","existy","paymentData","onError","AdyenCheckoutError","API_ERROR","event","AnalyticsErrorEvent","component","type","code","ErrorEventCode","THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA","errorType","ErrorEventType","threeDS2","message","THREEDS2_FINGERPRINT_ERROR","submitAnalytics","h","PrepareFingerprint","callSubmit3DS2Fingerprint","onSubmitAnalytics","onActionHandled","args","_define_property","bind","rtnObj","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","fingerprintIframeLoaded","actionDescription","TxVariants","threeDS2Fingerprint","defaultProps","dataKey","THREEDS2_FINGERPRINT"],"mappings":"+2BAaA,MAAMA,UAAkCC,EAUjBC,YAAAA,GAEnB,CAkBAC,UAAAA,CAAWC,GACHC,KAAKC,MAAMC,SACXF,KAAKC,MAAME,6BAA6BJ,EAAOC,KAAKI,YAEpDC,MAAMP,WAAWC,GAGrBC,KAAKM,SACT,CAEmBC,iBAAAA,GAKf,IAAKC,EAAOR,KAAKC,MAAMQ,aAAc,CACjCT,KAAKC,MAAMS,QAAQ,IAAIC,EAAmBC,EAAW,6DAGrD,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWf,KAAKgB,KAChBC,KAAMC,EAAeC,wCACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,2DAKhB,OAFAxB,KAAKyB,gBAAgBZ,GAEd,IACX,CAMA,OACIa,EAACC,EAAAA,IACO3B,KAAKC,MAETH,WAAYE,KAAKC,MAAMC,SAAWF,KAAKF,WAAaE,KAAK4B,0BACzDC,kBAAmB7B,KAAKyB,gBACxBK,gBAAiB9B,KAAK8B,iBAGlC,mBA1EJzB,SAAA0B,GAQIC,OAAQJ,4BAA4BA,EAA0BK,KAAKjC,OAMnEgC,EAAAhC,KAAU8B,kBAAmBI,IACzB,MAAMrB,EAAQ,IAAIsB,EAAkB,CAChCpB,UAAWf,KAAKgB,KAChBA,KAAMoB,EAAad,SACnBe,QAASC,EAAgBC,wBACzBhB,QAASW,EAAOM,oBAGpBxC,KAAKyB,gBAAgBZ,GAErBR,MAAMyB,gBAAgBI,MAvB1BF,EADErC,EACqBqB,OAAOyB,EAAWC,qBAEzCV,EAHErC,EAGqBgD,eAAe,CAClCC,QAAS,oBACT5B,KAAM6B"}
@@ -1,2 +1,2 @@
1
- import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"./components/UPIComponent/UPIComponent.js";import{Await as n}from"../internal/Await/Await.js";import{QRLoader as i}from"../internal/QRLoader/QRLoader.js";import"../../core/Context/CoreProvider.js";import"../../external/preact/hooks/dist/hooks.js";import"../../core/Errors/SRPanelContext.js";import"../internal/Button/Button.js";import"../internal/QRLoader/QRLoaderDetailsProvider.js";import{TxVariants as s}from"../tx-variants.js";import r from"../../utils/isMobile.js";import{UPI_MODE as a,UPI_COUNTDOWN_TIME as p}from"./constants.js";function m(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class d extends e{formatProps(t){return{showOtherInsteadOfNumber:!r(),...t}}get isValid(){return this.state.isValid}formatData(){const{app:t}=this.state.data||{};return{paymentMethod:{type:this.paymentType,...this.paymentType===s.upi_intent&&t?.id&&{appId:t.id}}}}get brands(){const{showPaymentMethodItemImages:t}=this.props;return t?this.appsList.map(t=>({icon:t.icon,name:t.name})):[]}get paymentType(){return this.mode===a.QR_CODE?s.upi_qr:s.upi_intent}componentToRender(){const{type:e,url:r,paymentMethodType:a}=this.props,p=!!this.props.mandate;switch(e){case"qrCode":return t(i,{...this.props,qrCodeData:this.props.qrCodeData?encodeURIComponent(this.props.qrCodeData):void 0,type:s.upi_qr,brandLogo:this.props.brandLogo||this.icon,onComplete:this.onComplete,introduction:this.props.i18n?.get("upi.qrCodeWaitingMessage")??"",countdownTime:this.props.countdownTime,onActionHandled:this.onActionHandled,showAmount:!p});case"await":return t(n,{url:r,type:a??"",showCountdownTimer:!0,shouldRedirectAutomatically:!0,showAmount:!p,countdownTime:this.props.countdownTime,clientKey:this.props.clientKey??"",paymentData:this.props.paymentData,onActionHandled:this.onActionHandled,onError:this.props.onError,messageText:this.props.i18n?.get("upi.vpaWaitingMessage")??"",awaitText:this.props.i18n?.get("await.waitForConfirmation")??"",onComplete:this.onComplete,brandLogo:this.icon});default:return t(o,{setComponentRef:this.setComponentRef,payButton:this.payButton,onChange:this.setState,appsList:this.appsList,mode:this.mode,showPayButton:this.props.showPayButton??!0,mandate:this.props.mandate,onSubmitAnalytics:this.submitAnalytics})}}constructor(t,e){super(t,e),m(this,"mode",void 0),m(this,"appsList",void 0);const{apps:o=[]}=this.props,n=o.length>0;this.mode=r()&&n?a.INTENT:a.QR_CODE,this.appsList=o.map(t=>{const e=`upi/${t.id.toLowerCase()}`,o=this.core.modules.resources?.getImage()(e)??"";return{id:t.id,name:t.name,icon:o}})}}m(d,"type",s.upi),m(d,"txVariants",[s.upi,s.upi_qr,s.upi_intent]),m(d,"defaultProps",{showPaymentMethodItemImages:!0,countdownTime:p});export{d as default};
1
+ import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"./components/UPIComponent/UPIComponent.js";import{Await as i}from"../internal/Await/Await.js";import{QRLoader as n}from"../internal/QRLoader/QRLoader.js";import"../../core/Context/CoreProvider.js";import"../../external/preact/hooks/dist/hooks.js";import"../../core/Errors/SRPanelContext.js";import"../internal/Button/Button.js";import"../internal/QRLoader/QRLoaderDetailsProvider.js";import{TxVariants as s}from"../tx-variants.js";import r from"../../utils/isMobile.js";import{UPI_MODE as a,UPI_COUNTDOWN_TIME as p}from"./constants.js";function m(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class d extends e{formatProps(t){return{showOtherInsteadOfNumber:!r(),...t}}get isValid(){return this.state.isValid}formatData(){const{app:t}=this.state.data||{};return{paymentMethod:{type:this.paymentType,...this.paymentType===s.upi_intent&&t?.id&&{appId:t.id}}}}get brands(){const{showPaymentMethodItemImages:t}=this.props;return t?this.appsList.map(t=>({icon:t.icon,name:t.name})):[]}get paymentType(){return this.mode===a.QR_CODE?s.upi_qr:s.upi_intent}componentToRender(){const{type:e,url:r,paymentMethodType:a}=this.props,p=!!this.props.mandate;switch(e){case"qrCode":return t(n,{...this.props,qrCodeData:this.props.qrCodeData?encodeURIComponent(this.props.qrCodeData):void 0,type:s.upi_qr,brandLogo:this.props.brandLogo||this.icon,brandName:this.displayName,onComplete:this.onComplete,introduction:this.props.i18n?.get("upi.qrCodeWaitingMessage")??"",countdownTime:this.props.countdownTime,onActionHandled:this.onActionHandled,showAmount:!p});case"await":return t(i,{url:r,type:a??"",showCountdownTimer:!0,shouldRedirectAutomatically:!0,showAmount:!p,countdownTime:this.props.countdownTime,clientKey:this.props.clientKey??"",paymentData:this.props.paymentData,onActionHandled:this.onActionHandled,onError:this.props.onError,messageText:this.props.i18n?.get("upi.vpaWaitingMessage")??"",awaitText:this.props.i18n?.get("await.waitForConfirmation")??"",onComplete:this.onComplete,brandLogo:this.icon,brandName:this.displayName});default:return t(o,{setComponentRef:this.setComponentRef,payButton:this.payButton,onChange:this.setState,appsList:this.appsList,mode:this.mode,showPayButton:this.props.showPayButton??!0,mandate:this.props.mandate,onSubmitAnalytics:this.submitAnalytics})}}constructor(t,e){super(t,e),m(this,"mode",void 0),m(this,"appsList",void 0);const{apps:o=[]}=this.props,i=o.length>0;this.mode=r()&&i?a.INTENT:a.QR_CODE,this.appsList=o.map(t=>{const e=`upi/${t.id.toLowerCase()}`,o=this.core.modules.resources?.getImage()(e)??"";return{id:t.id,name:t.name,icon:o}})}}m(d,"type",s.upi),m(d,"txVariants",[s.upi,s.upi_qr,s.upi_intent]),m(d,"defaultProps",{showPaymentMethodItemImages:!0,countdownTime:p});export{d as default};
2
2
  //# sourceMappingURL=UPI.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UPI.js","sources":["../../../../src/components/UPI/UPI.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport UPIComponent from './components/UPIComponent';\nimport { Await } from '../internal/Await';\nimport { QRLoader } from '../internal/QRLoader';\nimport { UPIAppList, UPIConfiguration, UpiMode, UpiPaymentData, UpiType } from './types';\nimport { TxVariants } from '../tx-variants';\nimport isMobile from '../../utils/isMobile';\nimport { UPI_COUNTDOWN_TIME, UPI_MODE } from './constants';\nimport { PaymentMethodBrand } from '../../types/global-types';\nimport { ICore } from '../../types';\n\n/**\n * For mobile:\n * We should show upi_intent depending on if `apps` are returned in /paymentMethods response.\n *\n * For non-mobile:\n * We should never show the upi_intent (ignore `apps` in /paymentMethods response)\n * Show upi_qr as default\n */\n\nclass UPI extends UIElement<UPIConfiguration> {\n public static readonly type = TxVariants.upi;\n public static readonly txVariants = [TxVariants.upi, TxVariants.upi_qr, TxVariants.upi_intent];\n private readonly mode: UpiMode;\n private readonly appsList: UPIAppList;\n\n protected static readonly defaultProps = {\n showPaymentMethodItemImages: true,\n countdownTime: UPI_COUNTDOWN_TIME\n };\n\n constructor(checkout: ICore, props: UPIConfiguration) {\n super(checkout, props);\n const { apps = [] } = this.props;\n const hasIntentApps = apps.length > 0;\n\n this.mode = isMobile() && hasIntentApps ? UPI_MODE.INTENT : UPI_MODE.QR_CODE;\n\n this.appsList = apps.map(app => {\n const imageName = `upi/${app.id.toLowerCase()}`;\n const brandIcon = this.core.modules.resources?.getImage()(imageName) ?? '';\n return { id: app.id, name: app.name, icon: brandIcon };\n });\n }\n\n protected formatProps(props: UPIConfiguration): UPIConfiguration {\n return {\n showOtherInsteadOfNumber: !isMobile(),\n ...props\n };\n }\n\n public get isValid(): boolean {\n return this.state.isValid;\n }\n\n public formatData(): UpiPaymentData {\n const { app } = this.state.data || {};\n\n return {\n paymentMethod: {\n type: this.paymentType,\n ...(this.paymentType === TxVariants.upi_intent && app?.id && { appId: app.id })\n }\n };\n }\n\n get brands(): PaymentMethodBrand[] {\n const { showPaymentMethodItemImages } = this.props;\n\n if (!showPaymentMethodItemImages) {\n return [];\n }\n\n return this.appsList.map(app => ({ icon: app.icon, name: app.name }));\n }\n\n get paymentType(): UpiType {\n if (this.mode === UPI_MODE.QR_CODE) {\n return TxVariants.upi_qr;\n }\n return TxVariants.upi_intent;\n }\n\n protected override componentToRender(): h.JSX.Element {\n const { type, url, paymentMethodType } = this.props;\n\n const isAutoPay = !!this.props.mandate;\n\n switch (type) {\n case 'qrCode':\n return (\n <QRLoader\n {...this.props}\n qrCodeData={this.props.qrCodeData ? encodeURIComponent(this.props.qrCodeData) : undefined}\n type={TxVariants.upi_qr}\n brandLogo={this.props.brandLogo || this.icon}\n onComplete={this.onComplete}\n introduction={this.props.i18n?.get('upi.qrCodeWaitingMessage') ?? ''}\n countdownTime={this.props.countdownTime}\n onActionHandled={this.onActionHandled}\n showAmount={!isAutoPay}\n />\n );\n case 'await':\n return (\n <Await\n url={url}\n type={paymentMethodType ?? ''}\n showCountdownTimer\n shouldRedirectAutomatically\n showAmount={!isAutoPay}\n countdownTime={this.props.countdownTime}\n clientKey={this.props.clientKey ?? ''}\n paymentData={this.props.paymentData}\n onActionHandled={this.onActionHandled}\n onError={this.props.onError}\n messageText={this.props.i18n?.get('upi.vpaWaitingMessage') ?? ''}\n awaitText={this.props.i18n?.get('await.waitForConfirmation') ?? ''}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n />\n );\n default:\n return (\n <UPIComponent\n setComponentRef={this.setComponentRef}\n payButton={this.payButton}\n onChange={this.setState}\n appsList={this.appsList}\n mode={this.mode}\n showPayButton={this.props.showPayButton ?? true}\n mandate={this.props.mandate}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n }\n}\n\nexport default UPI;\n"],"names":["UPI","UIElement","formatProps","props","showOtherInsteadOfNumber","isMobile","isValid","this","state","formatData","app","data","paymentMethod","type","paymentType","TxVariants","upi_intent","id","appId","brands","showPaymentMethodItemImages","appsList","map","icon","name","mode","UPI_MODE","QR_CODE","upi_qr","componentToRender","url","paymentMethodType","isAutoPay","mandate","h","QRLoader","qrCodeData","encodeURIComponent","undefined","brandLogo","onComplete","introduction","i18n","get","countdownTime","onActionHandled","showAmount","Await","showCountdownTimer","shouldRedirectAutomatically","clientKey","paymentData","onError","messageText","awaitText","UPIComponent","setComponentRef","payButton","onChange","setState","showPayButton","onSubmitAnalytics","submitAnalytics","constructor","checkout","super","_define_property","apps","hasIntentApps","length","INTENT","imageName","toLowerCase","brandIcon","core","modules","resources","getImage","upi","txVariants","defaultProps","UPI_COUNTDOWN_TIME"],"mappings":"kyBAqBA,MAAMA,UAAYC,EAyBJC,WAAAA,CAAYC,GAClB,MAAO,CACHC,0BAA2BC,OACxBF,EAEX,CAEA,WAAWG,GACP,OAAOC,KAAKC,MAAMF,OACtB,CAEOG,UAAAA,GACH,MAAMC,IAAEA,GAAQH,KAAKC,MAAMG,MAAQ,CAAA,EAEnC,MAAO,CACHC,cAAe,CACXC,KAAMN,KAAKO,eACPP,KAAKO,cAAgBC,EAAWC,YAAcN,GAAKO,IAAM,CAAEC,MAAOR,EAAIO,KAGtF,CAEA,UAAIE,GACA,MAAMC,4BAAEA,GAAgCb,KAAKJ,MAE7C,OAAKiB,EAIEb,KAAKc,SAASC,IAAIZ,KAAUa,KAAMb,EAAIa,KAAMC,KAAMd,EAAIc,QAHlD,EAIf,CAEA,eAAIV,GACA,OAAIP,KAAKkB,OAASC,EAASC,QAChBZ,EAAWa,OAEfb,EAAWC,UACtB,CAEmBa,iBAAAA,GACf,MAAMhB,KAAEA,EAAIiB,IAAEA,EAAGC,kBAAEA,GAAsBxB,KAAKJ,MAExC6B,IAAczB,KAAKJ,MAAM8B,QAE/B,OAAQpB,GACJ,IAAK,SACD,OACIqB,EAACC,EAAAA,IACO5B,KAAKJ,MACTiC,WAAY7B,KAAKJ,MAAMiC,WAAaC,mBAAmB9B,KAAKJ,MAAMiC,iBAAcE,EAChFzB,KAAME,EAAWa,OACjBW,UAAWhC,KAAKJ,MAAMoC,WAAahC,KAAKgB,KACxCiB,WAAYjC,KAAKiC,WACjBC,aAAclC,KAAKJ,MAAMuC,MAAMC,IAAI,6BAA+B,GAClEC,cAAerC,KAAKJ,MAAMyC,cAC1BC,gBAAiBtC,KAAKsC,gBACtBC,YAAad,IAGzB,IAAK,QACD,OACIE,EAACa,EAAAA,CACGjB,IAAKA,EACLjB,KAAMkB,GAAqB,GAC3BiB,oBAAAA,E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ElE,EAMwBgF,eAAe,CACrC5D,6BAA6B,EAC7BwB,cAAeqC"}
1
+ {"version":3,"file":"UPI.js","sources":["../../../../src/components/UPI/UPI.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport UPIComponent from './components/UPIComponent';\nimport { Await } from '../internal/Await';\nimport { QRLoader } from '../internal/QRLoader';\nimport { UPIAppList, UPIConfiguration, UpiMode, UpiPaymentData, UpiType } from './types';\nimport { TxVariants } from '../tx-variants';\nimport isMobile from '../../utils/isMobile';\nimport { UPI_COUNTDOWN_TIME, UPI_MODE } from './constants';\nimport { PaymentMethodBrand } from '../../types/global-types';\nimport { ICore } from '../../types';\n\n/**\n * For mobile:\n * We should show upi_intent depending on if `apps` are returned in /paymentMethods response.\n *\n * For non-mobile:\n * We should never show the upi_intent (ignore `apps` in /paymentMethods response)\n * Show upi_qr as default\n */\n\nclass UPI extends UIElement<UPIConfiguration> {\n public static readonly type = TxVariants.upi;\n public static readonly txVariants = [TxVariants.upi, TxVariants.upi_qr, TxVariants.upi_intent];\n private readonly mode: UpiMode;\n private readonly appsList: UPIAppList;\n\n protected static readonly defaultProps = {\n showPaymentMethodItemImages: true,\n countdownTime: UPI_COUNTDOWN_TIME\n };\n\n constructor(checkout: ICore, props: UPIConfiguration) {\n super(checkout, props);\n const { apps = [] } = this.props;\n const hasIntentApps = apps.length > 0;\n\n this.mode = isMobile() && hasIntentApps ? UPI_MODE.INTENT : UPI_MODE.QR_CODE;\n\n this.appsList = apps.map(app => {\n const imageName = `upi/${app.id.toLowerCase()}`;\n const brandIcon = this.core.modules.resources?.getImage()(imageName) ?? '';\n return { id: app.id, name: app.name, icon: brandIcon };\n });\n }\n\n protected formatProps(props: UPIConfiguration): UPIConfiguration {\n return {\n showOtherInsteadOfNumber: !isMobile(),\n ...props\n };\n }\n\n public get isValid(): boolean {\n return this.state.isValid;\n }\n\n public formatData(): UpiPaymentData {\n const { app } = this.state.data || {};\n\n return {\n paymentMethod: {\n type: this.paymentType,\n ...(this.paymentType === TxVariants.upi_intent && app?.id && { appId: app.id })\n }\n };\n }\n\n get brands(): PaymentMethodBrand[] {\n const { showPaymentMethodItemImages } = this.props;\n\n if (!showPaymentMethodItemImages) {\n return [];\n }\n\n return this.appsList.map(app => ({ icon: app.icon, name: app.name }));\n }\n\n get paymentType(): UpiType {\n if (this.mode === UPI_MODE.QR_CODE) {\n return TxVariants.upi_qr;\n }\n return TxVariants.upi_intent;\n }\n\n protected override componentToRender(): h.JSX.Element {\n const { type, url, paymentMethodType } = this.props;\n\n const isAutoPay = !!this.props.mandate;\n\n switch (type) {\n case 'qrCode':\n return (\n <QRLoader\n {...this.props}\n qrCodeData={this.props.qrCodeData ? encodeURIComponent(this.props.qrCodeData) : undefined}\n type={TxVariants.upi_qr}\n brandLogo={this.props.brandLogo || this.icon}\n brandName={this.displayName}\n onComplete={this.onComplete}\n introduction={this.props.i18n?.get('upi.qrCodeWaitingMessage') ?? ''}\n countdownTime={this.props.countdownTime}\n onActionHandled={this.onActionHandled}\n showAmount={!isAutoPay}\n />\n );\n case 'await':\n return (\n <Await\n url={url}\n type={paymentMethodType ?? ''}\n showCountdownTimer\n shouldRedirectAutomatically\n showAmount={!isAutoPay}\n countdownTime={this.props.countdownTime}\n clientKey={this.props.clientKey ?? ''}\n paymentData={this.props.paymentData}\n onActionHandled={this.onActionHandled}\n onError={this.props.onError}\n messageText={this.props.i18n?.get('upi.vpaWaitingMessage') ?? ''}\n awaitText={this.props.i18n?.get('await.waitForConfirmation') ?? ''}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n brandName={this.displayName}\n />\n );\n default:\n return (\n <UPIComponent\n setComponentRef={this.setComponentRef}\n payButton={this.payButton}\n onChange={this.setState}\n appsList={this.appsList}\n mode={this.mode}\n showPayButton={this.props.showPayButton ?? true}\n mandate={this.props.mandate}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n }\n}\n\nexport default UPI;\n"],"names":["UPI","UIElement","formatProps","props","showOtherInsteadOfNumber","isMobile","isValid","this","state","formatData","app","data","paymentMethod","type","paymentType","TxVariants","upi_intent","id","appId","brands","showPaymentMethodItemImages","appsList","map","icon","name","mode","UPI_MODE","QR_CODE","upi_qr","componentToRender","url","paymentMethodType","isAutoPay","mandate","h","QRLoader","qrCodeData","encodeURIComponent","undefined","brandLogo","brandName","displayName","onComplete","introduction","i18n","get","countdownTime","onActionHandled","showAmount","Await","showCountdownTimer","shouldRedirectAutomatically","clientKey","paymentData","onError","messageText","awaitText","UPIComponent","setComponentRef","payButton","onChange","setState","showPayButton","onSubmitAnalytics","submitAnalytics","constructor","checkout","super","_define_property","apps","hasIntentApps","length","INTENT","imageName","toLowerCase","brandIcon","core","modules","resources","getImage","upi","txVariants","defaultProps","UPI_COUNTDOWN_TIME"],"mappings":"kyBAqBA,MAAMA,UAAYC,EAyBJC,WAAAA,CAAYC,GAClB,MAAO,CACHC,0BAA2BC,OACxBF,EAEX,CAEA,WAAWG,GACP,OAAOC,KAAKC,MAAMF,OACtB,CAEOG,UAAAA,GACH,MAAMC,IAAEA,GAAQH,KAAKC,MAAMG,MAAQ,CAAA,EAEnC,MAAO,CACHC,cAAe,CACXC,KAAMN,KAAKO,eACPP,KAAKO,cAAgBC,EAAWC,YAAcN,GAAKO,IAAM,CAAEC,MAAOR,EAAIO,KAGtF,CAEA,UAAIE,GACA,MAAMC,4BAAEA,GAAgCb,KAAKJ,MAE7C,OAAKiB,EAIEb,KAAKc,SAASC,IAAIZ,KAAUa,KAAMb,EAAIa,KAAMC,KAAMd,EAAIc,QAHlD,EAIf,CAEA,eAAIV,GACA,OAAIP,KAAKkB,OAASC,EAASC,QAChBZ,EAAWa,OAEfb,EAAWC,UACtB,CAEmBa,iBAAAA,GACf,MAAMhB,KAAEA,EAAIiB,IAAEA,EAAGC,kBAAEA,GAAsBxB,KAAKJ,MAExC6B,IAAczB,KAAKJ,MAAM8B,QAE/B,OAAQpB,GACJ,IAAK,SACD,OACIqB,EAACC,EAA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,MACrBmE,EAAgBD,EAAKE,OAAS,EAEpChE,KAAKkB,KAAOpB,KAAciE,EAAgB5C,EAAS8C,OAAS9C,EAASC,QAErEpB,KAAKc,SAAWgD,EAAK/C,IAAIZ,IACrB,MAAM+D,EAAY,OAAO/D,EAAIO,GAAGyD,gBAC1BC,EAAYpE,KAAKqE,KAAKC,QAAQC,WAAWC,UAA7BxE,CAAwCkE,IAAc,GACxE,MAAO,CAAExD,GAAIP,EAAIO,GAAIO,KAAMd,EAAIc,KAAMD,KAAMoD,IAEnD,EAtBAP,EADEpE,EACqBa,OAAOE,EAAWiE,KACzCZ,EAFEpE,EAEqBiF,aAAa,CAAClE,EAAWiE,IAAKjE,EAAWa,OAAQb,EAAWC,aAInFoD,EANEpE,EAMwBkF,eAAe,CACrC9D,6BAA6B,EAC7B0B,cAAeqC"}
@@ -1,2 +1,2 @@
1
- import t from"../../../_virtual/index.js";import{createElement as e}from"../../../external/preact/dist/preact.js";import{useEffect as a}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";import{usePaymentStatusTimer as n}from"../../../hooks/usePaymentStatusTimer/usePaymentStatusTimer.js";import{DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS as r,DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS as i,DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS as s,DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN as c}from"../../../hooks/usePaymentStatusTimer/constants.js";import l from"../Spinner/Spinner.js";import m from"../Button/Button.js";import d from"../ContentSeparator/ContentSeparator.js";import u from"../Countdown/index.js";import{AwaitFinalState as _}from"./components/AwaitFinalState.js";import{redirectToApp as p}from"../../../utils/urls.js";import{useAmount as y}from"../../../core/Context/AmountProvider.js";import{useA11yReporter as h}from"../../../core/Errors/useA11yReporter.js";function w(r){const{i18n:i,loadingContext:s}=o();h(r.awaitText);const{state:c,actions:w}=n({loadingContext:s,paymentData:r.paymentData,clientKey:r.clientKey,delay:r.delay,throttleTime:r.throttleTime,throttleInterval:r.throttleInterval,type:r.type,onError:r.onError,onComplete:r.onComplete,pollStatus:r.pollStatus,onActionHandled:r.onActionHandled}),{completed:g,expired:k,loading:f,percentage:v}=c,{onTick:N,onTimeUp:T}=w,{amount:C}=y();if(a(()=>{r.shouldRedirectAutomatically&&r.url&&p(r.url)},[r.shouldRedirectAutomatically,r.url]),k)return e(_,{image:"error",message:i.get("error.subtitle.payment")});if(g)return e(_,{image:"success",message:i.get("creditCard.success")});if(f)return e("div",{className:"adyen-checkout__await"},r.brandLogo&&e("img",{src:r.brandLogo,alt:r.type,className:"adyen-checkout__await__brand-logo"}),e(l,{inline:!1,size:"large"}));const x=i.get("wechatpay.timetopay").split("%@");return e("div",{className:t("adyen-checkout__await",`adyen-checkout__await--${r.type}`,r.classNameModifiers.map(t=>`adyen-checkout__await--${t}`))},r.brandLogo&&e("img",{src:r.brandLogo,alt:r.type,className:"adyen-checkout__await__brand-logo"}),!(!r.showAmount||null===C?.value||!C?.currency)&&e("div",{className:"adyen-checkout__await__amount"},i.amount(C.value,C.currency)),null!=r.messageText&&e("div",{className:"adyen-checkout__await__subtitle"},r.messageText),e("div",{className:"adyen-checkout__await__indicator-holder"},e("div",{className:"adyen-checkout__await__indicator-spinner"},e(l,{inline:!1,size:"medium"})),e("div",{className:"adyen-checkout__await__indicator-text"},r.awaitText)),r.showCountdownTimer&&e("div",{className:"adyen-checkout__await__countdown-holder"},e("div",{className:"adyen-checkout__await__progress"},e("span",{className:"adyen-checkout__await__percentage",style:{width:`${v}%`}})),e("div",{className:"adyen-checkout__await__countdown"},x[0]," ",e(u,{minutesFromNow:r.countdownTime,onTick:N,onCompleted:T})," ",x[1])),r.url&&!r.shouldRedirectAutomatically&&e("div",{className:"adyen-checkout__await__app-link"},e(d,null),e(m,{classNameModifiers:["await"],onClick:()=>p(r.url),label:i.get("openApp")})),r.instructions&&e("div",{className:"adyen-checkout__await__instructions"},"string"==typeof r.instructions?i.get(r.instructions):r.instructions?.()),r.endSlot&&e("div",{className:"adyen-checkout__await__end-slot"},r.endSlot()))}w.defaultProps={countdownTime:c,delay:s,throttleTime:i,throttleInterval:r,onError:()=>{},onComplete:()=>{},showCountdownTimer:!0,classNameModifiers:[],url:null};export{w as Await};
1
+ import t from"../../../_virtual/index.js";import{createElement as e}from"../../../external/preact/dist/preact.js";import{useEffect as a}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";import{usePaymentStatusTimer as n}from"../../../hooks/usePaymentStatusTimer/usePaymentStatusTimer.js";import{DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS as r,DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS as i,DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS as s,DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN as c}from"../../../hooks/usePaymentStatusTimer/constants.js";import l from"../Spinner/Spinner.js";import m from"../Button/Button.js";import d from"../ContentSeparator/ContentSeparator.js";import u from"../Countdown/index.js";import{AwaitFinalState as _}from"./components/AwaitFinalState.js";import{redirectToApp as p}from"../../../utils/urls.js";import{useAmount as y}from"../../../core/Context/AmountProvider.js";import{useA11yReporter as h}from"../../../core/Errors/useA11yReporter.js";function w(r){const{i18n:i,loadingContext:s}=o();h(r.awaitText);const{state:c,actions:w}=n({loadingContext:s,paymentData:r.paymentData,clientKey:r.clientKey,delay:r.delay,throttleTime:r.throttleTime,throttleInterval:r.throttleInterval,type:r.type,onError:r.onError,onComplete:r.onComplete,pollStatus:r.pollStatus,onActionHandled:r.onActionHandled}),{completed:g,expired:k,loading:f,percentage:N}=c,{onTick:v,onTimeUp:T}=w,{amount:C}=y();if(a(()=>{r.shouldRedirectAutomatically&&r.url&&p(r.url)},[r.shouldRedirectAutomatically,r.url]),k)return e(_,{image:"error",message:i.get("error.subtitle.payment")});if(g)return e(_,{image:"success",message:i.get("creditCard.success")});if(f)return e("div",{className:"adyen-checkout__await"},r.brandLogo&&e("img",{src:r.brandLogo,alt:r.brandName??r.type,className:"adyen-checkout__await__brand-logo"}),e(l,{inline:!1,size:"large"}));const x=i.get("wechatpay.timetopay").split("%@");return e("div",{className:t("adyen-checkout__await",`adyen-checkout__await--${r.type}`,r.classNameModifiers.map(t=>`adyen-checkout__await--${t}`))},r.brandLogo&&e("img",{src:r.brandLogo,alt:r.brandName??r.type,className:"adyen-checkout__await__brand-logo"}),!(!r.showAmount||null===C?.value||!C?.currency)&&e("div",{className:"adyen-checkout__await__amount"},i.amount(C.value,C.currency)),null!=r.messageText&&e("div",{className:"adyen-checkout__await__subtitle"},r.messageText),e("div",{className:"adyen-checkout__await__indicator-holder"},e("div",{className:"adyen-checkout__await__indicator-spinner"},e(l,{inline:!1,size:"medium"})),e("div",{className:"adyen-checkout__await__indicator-text"},r.awaitText)),r.showCountdownTimer&&e("div",{className:"adyen-checkout__await__countdown-holder"},e("div",{className:"adyen-checkout__await__progress"},e("span",{className:"adyen-checkout__await__percentage",style:{width:`${N}%`}})),e("div",{className:"adyen-checkout__await__countdown"},x[0]," ",e(u,{minutesFromNow:r.countdownTime,onTick:v,onCompleted:T})," ",x[1])),r.url&&!r.shouldRedirectAutomatically&&e("div",{className:"adyen-checkout__await__app-link"},e(d,null),e(m,{classNameModifiers:["await"],onClick:()=>p(r.url),label:i.get("openApp")})),r.instructions&&e("div",{className:"adyen-checkout__await__instructions"},"string"==typeof r.instructions?i.get(r.instructions):r.instructions?.()),r.endSlot&&e("div",{className:"adyen-checkout__await__end-slot"},r.endSlot()))}w.defaultProps={countdownTime:c,delay:s,throttleTime:i,throttleInterval:r,onError:()=>{},onComplete:()=>{},showCountdownTimer:!0,classNameModifiers:[],url:null};export{w as Await};
2
2
  //# sourceMappingURL=Await.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Await.js","sources":["../../../../../src/components/internal/Await/Await.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { h } from 'preact';\nimport { useEffect } from 'preact/hooks';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport {\n usePaymentStatusTimer,\n DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS\n} from '../../../hooks/usePaymentStatusTimer';\nimport Spinner from '../../internal/Spinner';\nimport Button from '../Button';\nimport ContentSeparator from '../ContentSeparator';\nimport Countdown from '../Countdown';\nimport { AwaitFinalState } from './components/AwaitFinalState';\nimport { AwaitComponentProps } from './types';\nimport { redirectToApp } from '../../../utils/urls';\nimport './Await.scss';\nimport { useAmount } from '../../../core/Context/AmountProvider';\nimport { useA11yReporter } from '../../../core/Errors/useA11yReporter';\n\nexport function Await(props: Readonly<AwaitComponentProps>) {\n const { i18n, loadingContext } = useCoreContext();\n useA11yReporter(props.awaitText);\n\n const { state: timerState, actions: timerActions } = usePaymentStatusTimer({\n loadingContext,\n paymentData: props.paymentData,\n clientKey: props.clientKey,\n delay: props.delay,\n throttleTime: props.throttleTime,\n throttleInterval: props.throttleInterval,\n type: props.type,\n onError: props.onError,\n onComplete: props.onComplete,\n pollStatus: props.pollStatus,\n onActionHandled: props.onActionHandled\n });\n\n const { completed, expired, loading, percentage } = timerState;\n const { onTick, onTimeUp } = timerActions;\n const { amount } = useAmount();\n\n useEffect(() => {\n if (props.shouldRedirectAutomatically && props.url) {\n redirectToApp(props.url);\n }\n }, [props.shouldRedirectAutomatically, props.url]);\n\n if (expired) {\n return <AwaitFinalState image=\"error\" message={i18n.get('error.subtitle.payment')} />;\n }\n\n if (completed) {\n return <AwaitFinalState image=\"success\" message={i18n.get('creditCard.success')} />;\n }\n\n if (loading) {\n return (\n <div className=\"adyen-checkout__await\">\n {props.brandLogo && <img src={props.brandLogo} alt={props.type} className=\"adyen-checkout__await__brand-logo\" />}\n <Spinner inline={false} size=\"large\" />\n </div>\n );\n }\n\n const timeToPayString = i18n.get('wechatpay.timetopay').split('%@');\n\n return (\n <div\n className={classnames(\n 'adyen-checkout__await',\n `adyen-checkout__await--${props.type}`,\n props.classNameModifiers.map(m => `adyen-checkout__await--${m}`)\n )}\n >\n {props.brandLogo && <img src={props.brandLogo} alt={props.type} className=\"adyen-checkout__await__brand-logo\" />}\n\n {/* Everything is wrapped in !! so we evaluate the result as boolean,\n otherwise we might just print the value or object as mistake */}\n {!!(props.showAmount && amount?.value !== null && amount?.currency) && (\n <div className=\"adyen-checkout__await__amount\">{i18n.amount(amount.value, amount.currency)}</div>\n )}\n\n {props.messageText != null && <div className=\"adyen-checkout__await__subtitle\">{props.messageText}</div>}\n\n <div className=\"adyen-checkout__await__indicator-holder\">\n <div className=\"adyen-checkout__await__indicator-spinner\">\n <Spinner inline={false} size=\"medium\" />\n </div>\n <div className=\"adyen-checkout__await__indicator-text\">{props.awaitText}</div>\n </div>\n\n {props.showCountdownTimer && (\n <div className=\"adyen-checkout__await__countdown-holder\">\n <div className=\"adyen-checkout__await__progress\">\n <span className=\"adyen-checkout__await__percentage\" style={{ width: `${percentage}%` }} />\n </div>\n\n <div className=\"adyen-checkout__await__countdown\">\n {timeToPayString[0]}&nbsp;\n <Countdown minutesFromNow={props.countdownTime} onTick={onTick} onCompleted={onTimeUp} />\n &nbsp;{timeToPayString[1]}\n </div>\n </div>\n )}\n\n {props.url && !props.shouldRedirectAutomatically && (\n <div className=\"adyen-checkout__await__app-link\">\n <ContentSeparator />\n <Button classNameModifiers={['await']} onClick={() => redirectToApp(props.url)} label={i18n.get('openApp')} />\n </div>\n )}\n\n {props.instructions && (\n <div className=\"adyen-checkout__await__instructions\">\n {typeof props.instructions === 'string' ? i18n.get(props.instructions) : props.instructions?.()}\n </div>\n )}\n\n {props.endSlot && <div className=\"adyen-checkout__await__end-slot\">{props.endSlot()}</div>}\n </div>\n );\n}\n\nAwait.defaultProps = {\n countdownTime: DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n delay: DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n throttleTime: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS,\n throttleInterval: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n onError: () => {},\n onComplete: () => {},\n showCountdownTimer: true,\n classNameModifiers: [],\n url: null\n};\n"],"names":["Await","props","i18n","loadingContext","useCoreContext","useA11yReporter","awaitText","state","timerState","actions","timerActions","usePaymentStatusTimer","paymentData","clientKey","delay","throttleTime","throttleInterval","type","onError","onComplete","pollStatus","onActionHandled","completed","expired","loading","percentage","onTick","onTimeUp","amount","useAmount","useEffect","shouldRedirectAutomatically","url","redirectToApp","h","AwaitFinalState","image","message","get","div","className","brandLogo","img","src","alt","Spinner","inline","size","timeToPayString","split","classnames","classNameModifiers","map","m","showAmount","value","currency","messageText","showCountdownTimer","span","style","width","Countdown","minutesFromNow","countdownTime","onCompleted","ContentSeparator","Button","onClick","label","instructions","endSlot","defaultProps","DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN","DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS"],"mappings":"4hCAsBO,SAASA,EAAMC,GAClB,MAAMC,KAAEA,EAAIC,eAAEA,GAAmBC,IACjCC,EAAgBJ,EAAMK,WAEtB,MAAQC,MAAOC,EAAYC,QAASC,GAAiBC,EAAsB,CACvER,iBACAS,YAAaX,EAAMW,YACnBC,UAAWZ,EAAMY,UACjBC,MAAOb,EAAMa,MACbC,aAAcd,EAAMc,aACpBC,iBAAkBf,EAAMe,iBACxBC,KAAMhB,EAAMgB,KACZC,QAASjB,EAAMiB,QACfC,WAAYlB,EAAMkB,WAClB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U,4CACXN,EAACW,EAAAA,CAAQC,QAAQ,EAAOC,KAAK,YAEjCb,EAACK,MAAAA,CAAIC,UAAU,yCAAyCvC,EAAMK,YAGjEL,EAAMyD,oBACHxB,EAACK,MAAAA,CAAIC,UAAU,2CACXN,EAACK,MAAAA,CAAIC,UAAU,mCACXN,EAACyB,OAAAA,CAAKnB,UAAU,oCAAoCoB,MAAO,CAAEC,MAAO,GAAGpC,SAG3ES,EAACK,MAAAA,CAAIC,UAAU,oCACVQ,EAAgB,GAAG,IACpBd,EAAC4B,EAAAA,CAAUC,eAAgB9D,EAAM+D,cAAetC,OAAQA,EAAQuC,YAAatC,IAAY,IAClFqB,EAAgB,KAKlC/C,EAAM+B,MAAQ/B,EAAM8B,6BACjBG,EAACK,MAAAA,CAAIC,UAAU,mCACXN,EAACgC,QACDhC,EAACiC,EAAAA,CAAOhB,mBAAoB,CAAC,SAAUiB,QAAS,IAAMnC,EAAchC,EAAM+B,KAAMqC,MAAOnE,EAAKoC,IAAI,cAIvGrC,EAAMqE,cACHpC,EAACK,MAAAA,CAAIC,UAAU,uCACoB,iBAAvBvC,EAAMqE,aAA4BpE,EAAKoC,IAAIrC,EAAMqE,cAAgBrE,EAAMqE,kBAItFrE,EAAMsE,SAAWrC,EAACK,MAAAA,CAAIC,UAAU,mCAAmCvC,EAAMsE,WAGtF,CAEAvE,EAAMwE,aAAe,CACjBR,cAAeS,EACf3D,MAAO4D,EACP3D,aAAc4D,EACd3D,iBAAkB4D,EAClB1D,QAAS,OACTC,WAAY,OACZuC,oBAAoB,EACpBP,mBAAoB,GACpBnB,IAAK"}
1
+ {"version":3,"file":"Await.js","sources":["../../../../../src/components/internal/Await/Await.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { h } from 'preact';\nimport { useEffect } from 'preact/hooks';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport {\n usePaymentStatusTimer,\n DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS\n} from '../../../hooks/usePaymentStatusTimer';\nimport Spinner from '../../internal/Spinner';\nimport Button from '../Button';\nimport ContentSeparator from '../ContentSeparator';\nimport Countdown from '../Countdown';\nimport { AwaitFinalState } from './components/AwaitFinalState';\nimport { AwaitComponentProps } from './types';\nimport { redirectToApp } from '../../../utils/urls';\nimport './Await.scss';\nimport { useAmount } from '../../../core/Context/AmountProvider';\nimport { useA11yReporter } from '../../../core/Errors/useA11yReporter';\n\nexport function Await(props: Readonly<AwaitComponentProps>) {\n const { i18n, loadingContext } = useCoreContext();\n useA11yReporter(props.awaitText);\n\n const { state: timerState, actions: timerActions } = usePaymentStatusTimer({\n loadingContext,\n paymentData: props.paymentData,\n clientKey: props.clientKey,\n delay: props.delay,\n throttleTime: props.throttleTime,\n throttleInterval: props.throttleInterval,\n type: props.type,\n onError: props.onError,\n onComplete: props.onComplete,\n pollStatus: props.pollStatus,\n onActionHandled: props.onActionHandled\n });\n\n const { completed, expired, loading, percentage } = timerState;\n const { onTick, onTimeUp } = timerActions;\n const { amount } = useAmount();\n\n useEffect(() => {\n if (props.shouldRedirectAutomatically && props.url) {\n redirectToApp(props.url);\n }\n }, [props.shouldRedirectAutomatically, props.url]);\n\n if (expired) {\n return <AwaitFinalState image=\"error\" message={i18n.get('error.subtitle.payment')} />;\n }\n\n if (completed) {\n return <AwaitFinalState image=\"success\" message={i18n.get('creditCard.success')} />;\n }\n\n if (loading) {\n return (\n <div className=\"adyen-checkout__await\">\n {props.brandLogo && <img src={props.brandLogo} alt={props.brandName ?? props.type} className=\"adyen-checkout__await__brand-logo\" />}\n <Spinner inline={false} size=\"large\" />\n </div>\n );\n }\n\n const timeToPayString = i18n.get('wechatpay.timetopay').split('%@');\n\n return (\n <div\n className={classnames(\n 'adyen-checkout__await',\n `adyen-checkout__await--${props.type}`,\n props.classNameModifiers.map(m => `adyen-checkout__await--${m}`)\n )}\n >\n {props.brandLogo && <img src={props.brandLogo} alt={props.brandName ?? props.type} className=\"adyen-checkout__await__brand-logo\" />}\n\n {/* Everything is wrapped in !! so we evaluate the result as boolean,\n otherwise we might just print the value or object as mistake */}\n {!!(props.showAmount && amount?.value !== null && amount?.currency) && (\n <div className=\"adyen-checkout__await__amount\">{i18n.amount(amount.value, amount.currency)}</div>\n )}\n\n {props.messageText != null && <div className=\"adyen-checkout__await__subtitle\">{props.messageText}</div>}\n\n <div className=\"adyen-checkout__await__indicator-holder\">\n <div className=\"adyen-checkout__await__indicator-spinner\">\n <Spinner inline={false} size=\"medium\" />\n </div>\n <div className=\"adyen-checkout__await__indicator-text\">{props.awaitText}</div>\n </div>\n\n {props.showCountdownTimer && (\n <div className=\"adyen-checkout__await__countdown-holder\">\n <div className=\"adyen-checkout__await__progress\">\n <span className=\"adyen-checkout__await__percentage\" style={{ width: `${percentage}%` }} />\n </div>\n\n <div className=\"adyen-checkout__await__countdown\">\n {timeToPayString[0]}&nbsp;\n <Countdown minutesFromNow={props.countdownTime} onTick={onTick} onCompleted={onTimeUp} />\n &nbsp;{timeToPayString[1]}\n </div>\n </div>\n )}\n\n {props.url && !props.shouldRedirectAutomatically && (\n <div className=\"adyen-checkout__await__app-link\">\n <ContentSeparator />\n <Button classNameModifiers={['await']} onClick={() => redirectToApp(props.url)} label={i18n.get('openApp')} />\n </div>\n )}\n\n {props.instructions && (\n <div className=\"adyen-checkout__await__instructions\">\n {typeof props.instructions === 'string' ? i18n.get(props.instructions) : props.instructions?.()}\n </div>\n )}\n\n {props.endSlot && <div className=\"adyen-checkout__await__end-slot\">{props.endSlot()}</div>}\n </div>\n );\n}\n\nAwait.defaultProps = {\n countdownTime: DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN,\n delay: DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS,\n throttleTime: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS,\n throttleInterval: DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS,\n onError: () => {},\n onComplete: () => {},\n showCountdownTimer: true,\n classNameModifiers: [],\n url: null\n};\n"],"names":["Await","props","i18n","loadingContext","useCoreContext","useA11yReporter","awaitText","state","timerState","actions","timerActions","usePaymentStatusTimer","paymentData","clientKey","delay","throttleTime","throttleInterval","type","onError","onComplete","pollStatus","onActionHandled","completed","expired","loading","percentage","onTick","onTimeUp","amount","useAmount","useEffect","shouldRedirectAutomatically","url","redirectToApp","h","AwaitFinalState","image","message","get","div","className","brandLogo","img","src","alt","brandName","Spinner","inline","size","timeToPayString","split","classnames","classNameModifiers","map","m","showAmount","value","currency","messageText","showCountdownTimer","span","style","width","Countdown","minutesFromNow","countdownTime","onCompleted","ContentSeparator","Button","onClick","label","instructions","endSlot","defaultProps","DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN","DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS","DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS"],"mappings":"4hCAsBO,SAASA,EAAMC,GAClB,MAAMC,KAAEA,EAAIC,eAAEA,GAAmBC,IACjCC,EAAgBJ,EAAMK,WAEtB,MAAQC,MAAOC,EAAYC,QAASC,GAAiBC,EAAsB,CACvER,iBACAS,YAAaX,EAAMW,YACnBC,UAAWZ,EAAMY,UACjBC,MAAOb,EAAMa,MACbC,aAAcd,EAAMc,aACpBC,iBAAkBf,EAAMe,iBACxBC,KAAMhB,EAAMgB,KACZC,QAASjB,EAAMiB,QACfC,WAAYlB,EAAMkB,WAClBC,WAAYnB,EAAMmB,WAClBC,gBAAiBpB,EAAMoB,mBAGrBC,UAAEA,EAASC,QAAEA,EAAOC,QAAEA,EAAOC,WAAEA,GAAejB,GAC9CkB,OAAEA,EAAMC,SAAEA,GAAaj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EAAM0D,oBACHzB,EAACK,MAAAA,CAAIC,UAAU,2CACXN,EAACK,MAAAA,CAAIC,UAAU,mCACXN,EAAC0B,OAAAA,CAAKpB,UAAU,oCAAoCqB,MAAO,CAAEC,MAAO,GAAGrC,SAG3ES,EAACK,MAAAA,CAAIC,UAAU,oCACVS,EAAgB,GAAG,IACpBf,EAAC6B,EAAAA,CAAUC,eAAgB/D,EAAMgE,cAAevC,OAAQA,EAAQwC,YAAavC,IAAY,IAClFsB,EAAgB,KAKlChD,EAAM+B,MAAQ/B,EAAM8B,6BACjBG,EAACK,MAAAA,CAAIC,UAAU,mCACXN,EAACiC,QACDjC,EAACkC,EAAAA,CAAOhB,mBAAoB,CAAC,SAAUiB,QAAS,IAAMpC,EAAchC,EAAM+B,KAAMsC,MAAOpE,EAAKoC,IAAI,cAIvGrC,EAAMsE,cACHrC,EAACK,MAAAA,CAAIC,UAAU,uCACoB,iBAAvBvC,EAAMsE,aAA4BrE,EAAKoC,IAAIrC,EAAMsE,cAAgBtE,EAAMsE,kBAItFtE,EAAMuE,SAAWtC,EAACK,MAAAA,CAAIC,UAAU,mCAAmCvC,EAAMuE,WAGtF,CAEAxE,EAAMyE,aAAe,CACjBR,cAAeS,EACf5D,MAAO6D,EACP5D,aAAc6D,EACd5D,iBAAkB6D,EAClB3D,QAAS,OACTC,WAAY,OACZwC,oBAAoB,EACpBP,mBAAoB,GACpBpB,IAAK"}
@@ -1,2 +1,2 @@
1
- import{createElement as e}from"../../../../external/preact/dist/preact.js";import t from"../../../../_virtual/index.js";import{useCoreContext as s}from"../../../../core/Context/CoreProvider.js";import{getUniqueId as i}from"../../../../utils/idGenerator.js";import{useMemo as a}from"../../../../external/preact/hooks/dist/hooks.js";function d({children:d,classNameModifiers:o=[],classNamesFields:r=[],label:l,readonly:c=!1,description:n,id:_,renderLabelAsSectionHeading:m=!1}){const{i18n:f}=s(),p=a(()=>i("fieldset-description"),[]);return e("fieldset",{id:_,className:t(["adyen-checkout__fieldset",...o.map(e=>`adyen-checkout__fieldset--${e}`),{"adyen-checkout__fieldset--readonly":c}]),"aria-describedby":n?p:null},l&&e("legend",{className:"adyen-checkout__fieldset__title"},m?e("h2",{className:"adyen-checkout__fieldset__title-heading"},f.get(l)):f.get(l)),n&&e("p",{id:p,className:"adyen-checkout__fieldset__description"},f.get(n)),e("div",{className:t("adyen-checkout__fieldset__fields",r)},d))}export{d as default};
1
+ import{createElement as e}from"../../../../external/preact/dist/preact.js";import t from"../../../../_virtual/index.js";import{useCoreContext as s}from"../../../../core/Context/CoreProvider.js";import{getUniqueId as i}from"../../../../utils/idGenerator.js";import{useMemo as d}from"../../../../external/preact/hooks/dist/hooks.js";function a({children:a,classNameModifiers:o=[],classNamesFields:r=[],label:c,readonly:l=!1,description:n,id:_,renderLabelAsSectionHeading:m=!1,descriptionId:f}){const{i18n:p}=s(),u=d(()=>i("fieldset-description"),[]),h=f??u;return e("fieldset",{id:_,className:t(["adyen-checkout__fieldset",...o.map(e=>`adyen-checkout__fieldset--${e}`),{"adyen-checkout__fieldset--readonly":l}])},c&&e("legend",{className:"adyen-checkout__fieldset__title"},m?e("h2",{className:"adyen-checkout__fieldset__title-heading"},p.get(c)):p.get(c)),n&&e("p",{id:h,className:"adyen-checkout__fieldset__description"},p.get(n)),e("div",{className:t("adyen-checkout__fieldset__fields",r)},a))}export{a as default};
2
2
  //# sourceMappingURL=Fieldset.js.map
@@ -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,GAAyBG,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 o}from"../../../external/preact/hooks/dist/hooks.js";import r from"../../../_virtual/index.js";import{ARIA_ERROR_SUFFIX as a,ARIA_CONTEXT_SUFFIX as n}from"../../../core/Errors/constants.js";function t({setRef:t,...s}){const{autoCorrect:l,classNameModifiers:i,isInvalid:u,isValid:c,readonly:d=null,spellcheck:p,type:y,uniqueId:m,disabled:h}=s,f=s.className;Object.prototype.hasOwnProperty.call(s,"onChange")&&console.error("Error: Form fields that rely on InputBase may not have an onChange property");const _=o(e=>{s.onInput(e)},[s.onInput]),k=o(e=>{s?.onKeyPress&&s.onKeyPress(e)},[s?.onKeyPress]),v=o(e=>{s?.onKeyUp&&s.onKeyUp(e)},[s?.onKeyUp]),I=o(e=>{s?.onBlurHandler?.(e),s.trimOnBlur&&(e.target.value=e.target.value.trim()),s?.onBlur?.(e)},[s.onBlur,s.onBlurHandler]),K=o(e=>{s?.onFocusHandler?.(e)},[s.onFocusHandler]),B=r("adyen-checkout__input",[`adyen-checkout__input--${y}`],f,{"adyen-checkout__input--invalid":u,"adyen-checkout__input--valid":c},i.map(e=>`adyen-checkout__input--${e}`)),{classNameModifiers:b,uniqueId:x,isInvalid:C,isValid:P,addContextualElement:j,autocomplete:N,...g}=s;return e("input",{id:m,...g,autocomplete:N,"aria-required":g.required,type:y,className:B,readOnly:d,spellcheck:p,autoCorrect:l,"aria-describedby":`${m}${u?a:n}`,"aria-invalid":u,onInput:_,onBlur:I,onFocus:K,onKeyUp:v,onKeyPress:k,disabled:h,ref:t})}t.defaultProps={type:"text",classNameModifiers:[]};export{t as default};
1
+ import{createElement as e}from"../../../external/preact/dist/preact.js";import{useCallback as o}from"../../../external/preact/hooks/dist/hooks.js";import n from"../../../_virtual/index.js";import{ARIA_ERROR_SUFFIX as r,ARIA_CONTEXT_SUFFIX as a}from"../../../core/Errors/constants.js";function t({setRef:t,...l}){const{autoCorrect:s,classNameModifiers:i,isInvalid:u,isValid:d,readonly:c=null,spellcheck:p,type:y,uniqueId:m,disabled:f}=l,h=l.className;Object.prototype.hasOwnProperty.call(l,"onChange")&&console.error("Error: Form fields that rely on InputBase may not have an onChange property");const _=o(e=>{l.onInput(e)},[l.onInput]),k=o(e=>{l?.onKeyPress&&l.onKeyPress(e)},[l?.onKeyPress]),v=o(e=>{l?.onKeyUp&&l.onKeyUp(e)},[l?.onKeyUp]),b=o(e=>{l?.onBlurHandler?.(e),l.trimOnBlur&&(e.target.value=e.target.value.trim()),l?.onBlur?.(e)},[l.onBlur,l.onBlurHandler]),B=o(e=>{l?.onFocusHandler?.(e)},[l.onFocusHandler]),I=n("adyen-checkout__input",[`adyen-checkout__input--${y}`],h,{"adyen-checkout__input--invalid":u,"adyen-checkout__input--valid":d},i.map(e=>`adyen-checkout__input--${e}`)),{classNameModifiers:K,uniqueId:j,isInvalid:x,isValid:C,addContextualElement:P,"aria-describedby":g,autocomplete:N,...q}=l,E=["string"==typeof g&&g?g:null,m?`${m}${u?r:a}`:null].filter(Boolean).join(" ")||null;return e("input",{id:m,...q,autocomplete:N,"aria-required":q.required,type:y,className:I,readOnly:c,spellcheck:p,autoCorrect:s,"aria-describedby":E,"aria-invalid":u,onInput:_,onBlur:b,onFocus:B,onKeyUp:v,onKeyPress:k,disabled:f,ref:t})}t.defaultProps={type:"text",classNameModifiers:[]};export{t 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","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_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,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,GAGjB,CAEAD,EAAU4D,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","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":"4RA8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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,GAGjB,CAEAD,EAAUiE,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 s}from"../../../../external/preact/hooks/dist/hooks.js";import l 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())},se=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 s(()=>{V?G(null):O(null)},[V]),s(()=>{V&&h&&_.current&&_.current.focus(),B?.(V)},[V]),s(()=>{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]),s(()=>{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:l(["adyen-checkout__dropdown",g,...v.map(e=>`adyen-checkout__dropdown--${e}`)]),ref:M},e(o,{inputText:z,id: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?se(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(),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: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,EAAqBpC,EAAMqC,KAAKC,GAAKA,EAAEC,KAAOhC,IAAmB,CAAA,GAEhEiC,EAAWC,GAAgBb,KAE3Bc,EAAcC,GAAmBf,EAAqBQ,GAEvDQ,EAAiBR,EAEjBS,EAAgB/B,EAAoBd,EAAQA,EAAM8C,OAAOC,IAASrB,GAAcqB,EAAKvC,KAAKwC,cAAcC,SAASvB,EAAWsB,gBAG5HE,EAAkBtC,EAAW,GAAGA,IADvBH,EAAY0C,EAAoBC,IACa,KAoBtDC,EAAgBN,IAClB,IAAKA,EAAM,OACX,MAAMO,EAAcC,SAASC,eAAe,YAAYT,EAAKR,MAC7DkB,EAAoBH,IAMlBI,GAAY,KAEV1C,GACAK,EAAesC,QAAQC,OAE3B9B,GAAY,IAGV+B,GAAW,KACb/B,GAAY,IAGVgC,GAAwBC,IAC1B,MAAMC,EAAQD,EAAGE,cAAmCC,aAAa,cACjE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EAAauB,GACbrC,EAAcqC,GAGTnC,GACDgC,KAGAvD,GACAA,EAAQ0D,IA6FJrD,YAAaA,EACbP,SAAUA,EACV6B,aAAcA,EACdJ,SAAUA,EACVL,gBAAiBA,EACjByF,WA1FQlD,IAChBA,EAAEO,iBACGzC,GAIDY,EAAaG,EAAepC,MAC5BkD,OAJAjB,EAAa,MACboB,OAuFIhD,SAAUA,EACVqC,gBAAiBA,EACjBhC,SAAUA,IAEdmF,EAACa,EAAAA,CACG9E,OAAQM,EACRG,cAAeA,EACfsE,QAjLSpD,IACjBA,EAAEO,iBACF,MAAMvB,EAAOe,GAAqBC,GAClCpB,EAAgBI,IA+KRqE,SAAUhD,GACVwC,SAAUhE,EACVX,aAAcA,EACdR,cAAeA,EACfI,SAAUA,IAEdwE,EAACC,MAAAA,CACG3B,IAAKnC,EACL6E,KAAK,SACLC,YAAU,SAKVC,gBAAc,iBACdtH,UAAU,oCAET8B,GAIjB,CAEAhC,EAAOyH,aAAe,CAClBvH,UAAW,GACXC,mBAAoB,GACpBC,YAAY,EACZH,MAAO,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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,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 a from"../../../../../_virtual/index.js";import o from"../../../Img/Img.js";import{useMemo as n}from"../../../../../external/preact/hooks/dist/hooks.js";function d({filterable:t,toggleButtonRef:a,showList:o,selectListId:n,...d}){if(t){const{id:t,...o}=d;return e("div",{...o,ref:a})}return e("button",{role:"combobox",type:"button",id:d.id,className:d.className,"aria-haspopup":"listbox","aria-expanded":o,"aria-controls":n,"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:a},d.children)}function i(i){const{active:r,selected:l,inputText:c,readonly:s,showList:u,required:_}=i,p=n(()=>{const e=l.selectedOptionName||l.name;return!0!==("string"==typeof e&&""!==e.trim())},[l,i.placeholder]),b=l.selectedOptionName||l.name||i.placeholder||"",y=u?c??"":b,m=s?null:i.filterable?e=>{e.preventDefault(),document.activeElement===i.filterInputRef.current?i.showList||i.toggleList(e):i.filterInputRef.current&&i.filterInputRef.current.focus()}:i.toggleList,f=r.id?`listItem-${r.id}`:"";return e(d,{className:a({"adyen-checkout__dropdown__button":!0,"adyen-checkout__dropdown__button--readonly":s,"adyen-checkout__dropdown__button--active":u,"adyen-checkout__dropdown__button--invalid":i.isInvalid,"adyen-checkout__dropdown__button--valid":i.isValid,"adyen-checkout__dropdown__button--disabled":l.disabled}),disabled:i.disabled,filterable:i.filterable,onClick:m,onKeyDown:s?null:i.onButtonKeyDown,toggleButtonRef:i.toggleButtonRef,id:i.id,showList:u,selectListId:i.selectListId,"aria-activedescendant":!i.filterable&&u&&f||void 0},i.filterable?e(t,null,!u&&l.icon&&e(o,{className:"adyen-checkout__dropdown__button__icon",src:l.icon,alt:l.name}),e("input",{value:y,"aria-autocomplete":"list","aria-controls":i.selectListId,"aria-expanded":u,"aria-owns":i.selectListId,autoComplete:"off",className:a("adyen-checkout__filter-input",{"adyen-checkout__filter-input--placeholder":!u&&p}),onInput:i.onInput,ref:i.filterInputRef,role:"combobox","aria-activedescendant":f,type:"text",readOnly:i.readonly,"aria-disabled":i.readonly,id:i.id,"aria-describedby":i.ariaDescribedBy,required:_}),!u&&l.secondaryText&&e("span",{className:"adyen-checkout__dropdown__button__secondary-text"},l.secondaryText)):e(t,null,l.icon&&e(o,{className:"adyen-checkout__dropdown__button__icon",src:l.icon,alt:l.name}),e("span",{id:i.id?`${i.id}-value`:void 0,className:a("adyen-checkout__dropdown__button__text",{"adyen-checkout__dropdown__button__text-placeholder":p})},b),l.secondaryText&&e("span",{className:"adyen-checkout__dropdown__button__secondary-text"},l.secondaryText)))}export{i as default};
1
+ import{createElement as e,Fragment as t}from"../../../../../external/preact/dist/preact.js";import a from"../../../../../_virtual/index.js";import o from"../../../Img/Img.js";import{useMemo as n}from"../../../../../external/preact/hooks/dist/hooks.js";function d({filterable:t,toggleButtonRef:a,showList:o,selectListId:n,...d}){if(t){const{id:t,...o}=d;return e("div",{...o,ref:a})}return e("button",{role:"combobox",type:"button",id:d.id,className:d.className,"aria-haspopup":"listbox","aria-expanded":o,"aria-controls":n,"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:a},d.children)}function i(i){const{active:r,selected:l,inputText:c,readonly:s,showList:u,required:_}=i,p=n(()=>{const e=l.selectedOptionName||l.name;return!0!==("string"==typeof e&&""!==e.trim())},[l,i.placeholder]),b=l.selectedOptionName||l.name||i.placeholder||"",y=u?c??"":b,m=s?null:i.filterable?e=>{e.preventDefault(),document.activeElement===i.filterInputRef.current?i.showList||i.toggleList(e):i.filterInputRef.current&&i.filterInputRef.current.focus()}:i.toggleList,f=r.id?`listItem-${r.id}`:"";return e(d,{className:a({"adyen-checkout__dropdown__button":!0,"adyen-checkout__dropdown__button--readonly":s,"adyen-checkout__dropdown__button--active":u,"adyen-checkout__dropdown__button--invalid":i.isInvalid,"adyen-checkout__dropdown__button--valid":i.isValid,"adyen-checkout__dropdown__button--disabled":l.disabled}),disabled:i.disabled,filterable:i.filterable,onClick:m,onKeyDown:s?null:i.onButtonKeyDown,toggleButtonRef:i.toggleButtonRef,id:i.id,showList:u,selectListId:i.selectListId,"aria-activedescendant":!i.filterable&&u&&f||void 0,"aria-describedby":i.ariaDescribedBy},i.filterable?e(t,null,!u&&l.icon&&e(o,{className:"adyen-checkout__dropdown__button__icon",src:l.icon,alt:l.name}),e("input",{value:y,"aria-autocomplete":"list","aria-controls":i.selectListId,"aria-expanded":u,"aria-owns":i.selectListId,autoComplete:"off",className:a("adyen-checkout__filter-input",{"adyen-checkout__filter-input--placeholder":!u&&p}),onInput:i.onInput,ref:i.filterInputRef,role:"combobox","aria-activedescendant":f,type:"text",readOnly:i.readonly,"aria-disabled":i.readonly,id:i.id,"aria-describedby":i.ariaDescribedBy,required:_}),!u&&l.secondaryText&&e("span",{className:"adyen-checkout__dropdown__button__secondary-text"},l.secondaryText)):e(t,null,l.icon&&e(o,{className:"adyen-checkout__dropdown__button__icon",src:l.icon,alt:l.name}),e("span",{id:i.id?`${i.id}-value`:void 0,className:a("adyen-checkout__dropdown__button__text",{"adyen-checkout__dropdown__button__text-placeholder":p})},b),l.secondaryText&&e("span",{className:"adyen-checkout__dropdown__button__secondary-text"},l.secondaryText)))}export{i 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","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":"4PAOA,SAASA,GAAoBC,WAAEA,EAAUC,gBAAEA,EAAeC,SAAEA,EAAQC,aAAEA,KAAiBC,IACnF,GAAIJ,EAAY,CAEZ,MAAMK,GAAEA,KAAOC,GAAkBF,EACjC,OAAOG,EAACC,MAAAA,IAAQF,EAAeG,IAAKR,GACxC,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,EAAMmB,gBACxBC,kBAAiBpB,EAAMC,GAAK,GAAGD,EAAMC,YAAYD,EAAMC,gBAAaa,EACpEO,QAASrB,EAAMqB,QACfC,UAAWtB,EAAMsB,UACjBjB,IAAKR,GAEJG,EAAMuB,SAGnB,CAEA,SAASC,EAAaxB,GAClB,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AAeZ,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","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":"4PAOA,SAASA,GAAoBC,WAAEA,EAAUC,gBAAEA,EAAeC,SAAEA,EAAQC,aAAEA,KAAiBC,IACnF,GAAIJ,EAAY,CAEZ,MAAMK,GAAEA,KAAOC,GAAkBF,EACjC,OAAOG,EAACC,MAAAA,IAAQF,EAAeG,IAAKR,GACxC,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,OAAEA,EAAMC,SAAEA,EAAQC,UAAEA,EAAST,SAAEA,EAAQnB,SAAEA,EAAQ6B,SAAEA,GAAa3B,EAEhE4B,EAAuBC,EAAQ,KACjC,MAAMC,EAAcL,EAASM,oBAAsBN,EAASO,KAE5D,OAAwB,KADoB,iBAAhBF,GAAmD,KAAvBA,EAAYG,SAErE,CAACR,EAAUzB,EAAMkC,cAGdJ,EAAcL,EAASM,oBAAsBN,EAASO,MAAQhC,EAAMkC,aAAe,GAMnFC,EAAmBrC,EADA4B,GAAa,GACiBI,EAcjDM,EAAiB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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("esm","BUNDLE_TYPE is not defined"),r=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","donation","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onEnterKeyPressed","onError","onBalanceCheck","onOrderCancel","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],i=6e4;var d=function(e){return e.WEB="web",e}({});const a="web";var s=function(e){return e.NATIVE="nativeComponent",e.GENERIC="genericComponent",e}({});export{d as CHANNEL,i as DEFAULT_HTTP_TIMEOUT,n as FALLBACK_CONTEXT,r as GENERIC_OPTIONS,t as LIBRARY_BUNDLE_TYPE,o as LIBRARY_VERSION,s as PAYMENT_METHOD_BEHAVIOR,a as PLATFORM};
1
+ function e(e,n){if(null==e)throw new Error(n);return e}const n="https://checkoutshopper-live.adyen.com/checkoutshopper/",o=e("6.40.2","LIBRARY_VERSION is not defined"),t=e("esm","BUNDLE_TYPE is not defined"),r=["amount","secondaryAmount","countryCode","environment","_environmentUrls","loadingContext","i18n","modules","order","session","clientKey","showPayButton","redirectFromTopWhenInIframe","donation","onPaymentCompleted","onPaymentFailed","beforeRedirect","beforeSubmit","onSubmit","onActionHandled","onAdditionalDetails","onChange","onEnterKeyPressed","onError","onBalanceCheck","onOrderCancel","onOrderRequest","onOrderUpdated","onPaymentMethodsRequest"],i=6e4;var d=function(e){return e.WEB="web",e}({});const a="web";var s=function(e){return e.NATIVE="nativeComponent",e.GENERIC="genericComponent",e}({});export{d as CHANNEL,i as DEFAULT_HTTP_TIMEOUT,n as FALLBACK_CONTEXT,r as GENERIC_OPTIONS,t as LIBRARY_BUNDLE_TYPE,o as LIBRARY_VERSION,s as PAYMENT_METHOD_BEHAVIOR,a as PLATFORM};
2
2
  //# sourceMappingURL=config.js.map