\n);\n\nexport default Spinner;\n","export const FALLBACK_CONTEXT = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';\nexport const resolveEnvironment = (env = '', environmentUrl?: string): string => {\n if (environmentUrl) {\n return environmentUrl;\n }\n\n const environments = {\n test: 'https://checkoutshopper-test.adyen.com/checkoutshopper/',\n live: 'https://checkoutshopper-live.adyen.com/checkoutshopper/',\n 'live-us': 'https://checkoutshopper-live-us.adyen.com/checkoutshopper/',\n 'live-au': 'https://checkoutshopper-live-au.adyen.com/checkoutshopper/',\n 'live-apse': 'https://checkoutshopper-live-apse.adyen.com/checkoutshopper/',\n 'live-in': 'https://checkoutshopper-live-in.adyen.com/checkoutshopper/'\n };\n\n return environments[env.toLowerCase()] || FALLBACK_CONTEXT;\n};\n\nexport const FALLBACK_CDN_CONTEXT = 'https://checkoutshopper-live.adyen.com/checkoutshopper/';\nexport const resolveCDNEnvironment = (env = '', environmentUrl?: string) => {\n if (environmentUrl) {\n return environmentUrl;\n }\n\n const environments = {\n beta: 'https://cdf6519016.cdn.adyen.com/checkoutshopper/',\n test: 'https://checkoutshopper-test.adyen.com/checkoutshopper/',\n live: 'https://checkoutshopper-live.adyen.com/checkoutshopper/',\n 'live-us': 'https://checkoutshopper-live-us.adyen.com/checkoutshopper/',\n 'live-au': 'https://checkoutshopper-live-au.adyen.com/checkoutshopper/',\n 'live-apse': 'https://checkoutshopper-live-apse.adyen.com/checkoutshopper/',\n 'live-in': 'https://checkoutshopper-live-in.adyen.com/checkoutshopper/'\n };\n\n return environments[env.toLowerCase()] || FALLBACK_CDN_CONTEXT;\n};\n\nexport const FALLBACK_ANALYTICS_CONTEXT = 'https://checkoutanalytics-live.adyen.com/checkoutanalytics/';\n\nexport const resolveAnalyticsEnvironment = (env: string = FALLBACK_ANALYTICS_CONTEXT) => {\n const environments = {\n test: 'https://checkoutanalytics-test.adyen.com/checkoutanalytics/',\n live: 'https://checkoutanalytics-live.adyen.com/checkoutanalytics/',\n 'live-us': 'https://checkoutanalytics-live-us.adyen.com/checkoutanalytics/',\n 'live-au': 'https://checkoutanalytics-live-au.adyen.com/checkoutanalytics/',\n 'live-apse': 'https://checkoutanalytics-live-apse.adyen.com/checkoutanalytics/',\n 'live-in': 'https://checkoutanalytics-live-in.adyen.com/checkoutanalytics/'\n };\n\n return environments[env] || environments[env.toLowerCase()] || env;\n};\n","import { FALLBACK_CDN_CONTEXT } from '../Environment/Environment';\n\nexport interface ImageOptions {\n extension?: string;\n imageFolder?: string;\n resourceContext?: string;\n name?: string;\n parentFolder?: string;\n size?: string;\n subFolder?: string;\n svgOptions?: string;\n type?: string;\n}\n\nexport type GetImageFnType = (name) => string;\n\nexport class Resources {\n private readonly resourceContext: string;\n\n constructor(cdnContext: string = FALLBACK_CDN_CONTEXT) {\n this.resourceContext = cdnContext;\n }\n\n private returnImage = ({\n name,\n resourceContext,\n imageFolder = '',\n parentFolder = '',\n extension,\n size = '',\n subFolder = ''\n }: ImageOptions): string => `${resourceContext}images/${imageFolder}${subFolder}${parentFolder}${name}${size}.${extension}`;\n\n private getImageUrl =\n ({ resourceContext = FALLBACK_CDN_CONTEXT, extension = 'svg', ...options }: ImageOptions): GetImageFnType =>\n (name: string): string => {\n const imageOptions: ImageOptions = {\n extension,\n resourceContext,\n imageFolder: 'logos/',\n parentFolder: '',\n name,\n ...options\n };\n\n return this.returnImage(imageOptions);\n };\n\n public getImage(props = {} as ImageOptions) {\n return this.getImageUrl({ ...props, resourceContext: this.resourceContext });\n }\n}\n","import { createContext } from 'preact';\nimport { CommonPropsTypes } from './CoreProvider';\nimport Language from '../../language/Language';\nimport { Resources } from './Resources';\n\nexport const CoreContext = createContext({\n i18n: new Language(),\n loadingContext: '',\n commonProps: {} as CommonPropsTypes,\n resources: new Resources()\n});\n","import { useContext } from 'preact/hooks';\nimport { CoreContext } from './CoreContext';\n\nfunction useCoreContext() {\n return useContext(CoreContext);\n}\n\nexport default useCoreContext;\n","import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport Spinner from '../Spinner';\nimport useCoreContext from '../../../core/Context/useCoreContext';\nimport './Button.scss';\nimport { ButtonProps, ButtonState } from './types';\n\nclass Button extends Component {\n public static defaultProps = {\n status: 'default',\n variant: 'primary',\n disabled: false,\n label: '',\n inline: false,\n target: '_self',\n onClick: () => {}\n };\n\n public onClick = e => {\n e.preventDefault();\n\n if (!this.props.disabled) {\n this.props.onClick(e, { complete: this.complete });\n }\n };\n\n public complete = (delay = 1000) => {\n this.setState({ completed: true });\n setTimeout(() => {\n this.setState({ completed: false });\n }, delay);\n };\n\n render({ classNameModifiers = [], disabled, href, icon, inline, label, status, variant }, { completed }) {\n const { i18n } = useCoreContext();\n\n const buttonIcon = icon ? : '';\n\n const modifiers = [\n ...classNameModifiers,\n ...(variant !== 'primary' ? [variant] : []),\n ...(inline ? ['inline'] : []),\n ...(completed ? ['completed'] : []),\n ...(status === 'loading' || status === 'redirect' ? ['loading'] : [])\n ];\n\n const buttonClasses = classNames(['adyen-checkout__button', ...modifiers.map(m => `adyen-checkout__button--${m}`)]);\n\n const buttonStates = {\n loading: ,\n redirect: (\n \n \n {i18n.get('payButton.redirecting')}\n \n ),\n default: (\n \n {buttonIcon}\n {label}\n \n )\n };\n\n const buttonText = buttonStates[status] || buttonStates.default;\n\n if (href) {\n return (\n \n {buttonText}\n \n );\n }\n\n return (\n \n );\n }\n}\n\nexport default Button;\n","import Language from '../../../language';\nimport { PaymentAmountExtended } from '../../../types';\n\nexport const PAY_BTN_DIVIDER = '/ ';\n\nconst amountLabel = (i18n, amount: PaymentAmountExtended) =>\n !!amount?.value && !!amount?.currency ? i18n.amount(amount.value, amount.currency, { currencyDisplay: amount.currencyDisplay || 'symbol' }) : '';\n\nconst payAmountLabel = (i18n: Language, amount: PaymentAmountExtended) => `${i18n.get('payButton')} ${amountLabel(i18n, amount)}`;\n\nconst secondaryAmountLabel = (i18n: Language, secondaryAmount: PaymentAmountExtended) => {\n const convertedSecondaryAmount =\n secondaryAmount && !!secondaryAmount?.value && !!secondaryAmount?.currency\n ? i18n.amount(secondaryAmount.value, secondaryAmount.currency, { currencyDisplay: secondaryAmount.currencyDisplay || 'symbol' })\n : '';\n\n const divider = convertedSecondaryAmount.length ? PAY_BTN_DIVIDER : '';\n\n return `${divider}${convertedSecondaryAmount}`;\n};\n\nexport { payAmountLabel, amountLabel, secondaryAmountLabel };\n","import { h } from 'preact';\nimport './SecondaryButtonLabel.scss';\n\nconst SecondaryButtonLabel = ({ label }) => {\n return {label};\n};\n\nexport default SecondaryButtonLabel;\n","import { h } from 'preact';\nimport Button from '../Button';\nimport useCoreContext from '../../../core/Context/useCoreContext';\nimport { ButtonProps } from '../Button/types';\nimport { payAmountLabel, secondaryAmountLabel } from './utils';\nimport { PaymentAmountExtended } from '../../../types';\nimport SecondaryButtonLabel from './components/SecondaryButtonLabel';\n\nexport interface PayButtonProps extends ButtonProps {\n /**\n * Class name modifiers will be used as: `adyen-checkout__image--${modifier}`\n */\n classNameModifiers?: string[];\n label?: string;\n amount: PaymentAmountExtended;\n secondaryAmount?: PaymentAmountExtended;\n status?: string;\n disabled?: boolean;\n icon?: string;\n onClick?(): void;\n}\n\nconst PayButton = ({ amount, secondaryAmount, classNameModifiers = [], label, ...props }: PayButtonProps) => {\n const { i18n } = useCoreContext();\n const isZeroAuth = amount && {}.hasOwnProperty.call(amount, 'value') && amount.value === 0;\n const defaultLabel = isZeroAuth ? i18n.get('confirmPreauthorization') : payAmountLabel(i18n, amount);\n\n /**\n * Show the secondaryLabel if:\n * - it's not zero auth, and\n * - we don't have a predefined label (i.e. redirect, qrcode, await based comps...), and\n * - we do have an amount object (merchant might not be passing this in order to not show the amount on the button), and\n * - we have a secondaryAmount object with some properties\n */\n const secondaryLabel =\n !isZeroAuth && !label && amount && secondaryAmount && Object.keys(secondaryAmount).length\n ? secondaryAmountLabel(i18n, secondaryAmount)\n : null;\n\n return (\n \n );\n};\n\nexport default PayButton;\nexport { payAmountLabel };\n","import { PaymentResponse, RawPaymentResponse, UIElementStatus } from './types';\n\nconst ALLOWED_PROPERTIES = ['action', 'resultCode', 'sessionData', 'order', 'sessionResult'];\n\nexport function getSanitizedResponse(response: RawPaymentResponse): PaymentResponse {\n const removedProperties = [];\n\n const sanitizedObject = Object.keys(response).reduce((acc, cur) => {\n if (!ALLOWED_PROPERTIES.includes(cur)) {\n removedProperties.push(cur);\n } else {\n acc[cur] = response[cur];\n }\n return acc;\n }, {});\n\n if (removedProperties.length) console.warn(`The following properties should not be passed to the client: ${removedProperties.join(', ')}`);\n\n return sanitizedObject as PaymentResponse;\n}\n\nexport function resolveFinalResult(result: PaymentResponse): [status: UIElementStatus, statusProps?: any] {\n switch (result.resultCode) {\n case 'Authorised':\n case 'Received':\n return ['success'];\n case 'Pending':\n return ['success'];\n case 'Cancelled':\n case 'Error':\n case 'Refused':\n return ['error'];\n default:\n }\n}\n\nexport function getRegulatoryDefaults(countryCode: string): Record {\n switch (countryCode) {\n // Finnish regulations state that no payment method can be open by default\n case 'FI':\n return {\n openFirstPaymentMethod: false,\n openFirstStoredPaymentMethod: false\n };\n default:\n return {};\n }\n}\n","'use strict';\nvar $ = require('../internals/export');\nvar global = require('../internals/global');\nvar InternalMetadataModule = require('../internals/internal-metadata');\nvar fails = require('../internals/fails');\nvar createNonEnumerableProperty = require('../internals/create-non-enumerable-property');\nvar iterate = require('../internals/iterate');\nvar anInstance = require('../internals/an-instance');\nvar isCallable = require('../internals/is-callable');\nvar isObject = require('../internals/is-object');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\nvar setToStringTag = require('../internals/set-to-string-tag');\nvar defineProperty = require('../internals/object-define-property').f;\nvar forEach = require('../internals/array-iteration').forEach;\nvar DESCRIPTORS = require('../internals/descriptors');\nvar InternalStateModule = require('../internals/internal-state');\n\nvar setInternalState = InternalStateModule.set;\nvar internalStateGetterFor = InternalStateModule.getterFor;\n\nmodule.exports = function (CONSTRUCTOR_NAME, wrapper, common) {\n var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1;\n var IS_WEAK = CONSTRUCTOR_NAME.indexOf('Weak') !== -1;\n var ADDER = IS_MAP ? 'set' : 'add';\n var NativeConstructor = global[CONSTRUCTOR_NAME];\n var NativePrototype = NativeConstructor && NativeConstructor.prototype;\n var exported = {};\n var Constructor;\n\n if (!DESCRIPTORS || !isCallable(NativeConstructor)\n || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))\n ) {\n // create collection constructor\n Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER);\n InternalMetadataModule.enable();\n } else {\n Constructor = wrapper(function (target, iterable) {\n setInternalState(anInstance(target, Prototype), {\n type: CONSTRUCTOR_NAME,\n collection: new NativeConstructor()\n });\n if (!isNullOrUndefined(iterable)) iterate(iterable, target[ADDER], { that: target, AS_ENTRIES: IS_MAP });\n });\n\n var Prototype = Constructor.prototype;\n\n var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);\n\n forEach(['add', 'clear', 'delete', 'forEach', 'get', 'has', 'set', 'keys', 'values', 'entries'], function (KEY) {\n var IS_ADDER = KEY === 'add' || KEY === 'set';\n if (KEY in NativePrototype && !(IS_WEAK && KEY === 'clear')) {\n createNonEnumerableProperty(Prototype, KEY, function (a, b) {\n var collection = getInternalState(this).collection;\n if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY === 'get' ? undefined : false;\n var result = collection[KEY](a === 0 ? 0 : a, b);\n return IS_ADDER ? this : result;\n });\n }\n });\n\n IS_WEAK || defineProperty(Prototype, 'size', {\n configurable: true,\n get: function () {\n return getInternalState(this).collection.size;\n }\n });\n }\n\n setToStringTag(Constructor, CONSTRUCTOR_NAME, false, true);\n\n exported[CONSTRUCTOR_NAME] = Constructor;\n $({ global: true, forced: true }, exported);\n\n if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP);\n\n return Constructor;\n};\n","'use strict';\nvar defineBuiltIn = require('../internals/define-built-in');\n\nmodule.exports = function (target, src, options) {\n for (var key in src) {\n if (options && options.unsafe && target[key]) target[key] = src[key];\n else defineBuiltIn(target, key, src[key], options);\n } return target;\n};\n","'use strict';\nvar create = require('../internals/object-create');\nvar defineBuiltInAccessor = require('../internals/define-built-in-accessor');\nvar defineBuiltIns = require('../internals/define-built-ins');\nvar bind = require('../internals/function-bind-context');\nvar anInstance = require('../internals/an-instance');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\nvar iterate = require('../internals/iterate');\nvar defineIterator = require('../internals/iterator-define');\nvar createIterResultObject = require('../internals/create-iter-result-object');\nvar setSpecies = require('../internals/set-species');\nvar DESCRIPTORS = require('../internals/descriptors');\nvar fastKey = require('../internals/internal-metadata').fastKey;\nvar InternalStateModule = require('../internals/internal-state');\n\nvar setInternalState = InternalStateModule.set;\nvar internalStateGetterFor = InternalStateModule.getterFor;\n\nmodule.exports = {\n getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) {\n var Constructor = wrapper(function (that, iterable) {\n anInstance(that, Prototype);\n setInternalState(that, {\n type: CONSTRUCTOR_NAME,\n index: create(null),\n first: undefined,\n last: undefined,\n size: 0\n });\n if (!DESCRIPTORS) that.size = 0;\n if (!isNullOrUndefined(iterable)) iterate(iterable, that[ADDER], { that: that, AS_ENTRIES: IS_MAP });\n });\n\n var Prototype = Constructor.prototype;\n\n var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME);\n\n var define = function (that, key, value) {\n var state = getInternalState(that);\n var entry = getEntry(that, key);\n var previous, index;\n // change existing entry\n if (entry) {\n entry.value = value;\n // create new entry\n } else {\n state.last = entry = {\n index: index = fastKey(key, true),\n key: key,\n value: value,\n previous: previous = state.last,\n next: undefined,\n removed: false\n };\n if (!state.first) state.first = entry;\n if (previous) previous.next = entry;\n if (DESCRIPTORS) state.size++;\n else that.size++;\n // add to index\n if (index !== 'F') state.index[index] = entry;\n } return that;\n };\n\n var getEntry = function (that, key) {\n var state = getInternalState(that);\n // fast case\n var index = fastKey(key);\n var entry;\n if (index !== 'F') return state.index[index];\n // frozen object case\n for (entry = state.first; entry; entry = entry.next) {\n if (entry.key === key) return entry;\n }\n };\n\n defineBuiltIns(Prototype, {\n // `{ Map, Set }.prototype.clear()` methods\n // https://tc39.es/ecma262/#sec-map.prototype.clear\n // https://tc39.es/ecma262/#sec-set.prototype.clear\n clear: function clear() {\n var that = this;\n var state = getInternalState(that);\n var data = state.index;\n var entry = state.first;\n while (entry) {\n entry.removed = true;\n if (entry.previous) entry.previous = entry.previous.next = undefined;\n delete data[entry.index];\n entry = entry.next;\n }\n state.first = state.last = undefined;\n if (DESCRIPTORS) state.size = 0;\n else that.size = 0;\n },\n // `{ Map, Set }.prototype.delete(key)` methods\n // https://tc39.es/ecma262/#sec-map.prototype.delete\n // https://tc39.es/ecma262/#sec-set.prototype.delete\n 'delete': function (key) {\n var that = this;\n var state = getInternalState(that);\n var entry = getEntry(that, key);\n if (entry) {\n var next = entry.next;\n var prev = entry.previous;\n delete state.index[entry.index];\n entry.removed = true;\n if (prev) prev.next = next;\n if (next) next.previous = prev;\n if (state.first === entry) state.first = next;\n if (state.last === entry) state.last = prev;\n if (DESCRIPTORS) state.size--;\n else that.size--;\n } return !!entry;\n },\n // `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods\n // https://tc39.es/ecma262/#sec-map.prototype.foreach\n // https://tc39.es/ecma262/#sec-set.prototype.foreach\n forEach: function forEach(callbackfn /* , that = undefined */) {\n var state = getInternalState(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var entry;\n while (entry = entry ? entry.next : state.first) {\n boundFunction(entry.value, entry.key, this);\n // revert to the last existing entry\n while (entry && entry.removed) entry = entry.previous;\n }\n },\n // `{ Map, Set}.prototype.has(key)` methods\n // https://tc39.es/ecma262/#sec-map.prototype.has\n // https://tc39.es/ecma262/#sec-set.prototype.has\n has: function has(key) {\n return !!getEntry(this, key);\n }\n });\n\n defineBuiltIns(Prototype, IS_MAP ? {\n // `Map.prototype.get(key)` method\n // https://tc39.es/ecma262/#sec-map.prototype.get\n get: function get(key) {\n var entry = getEntry(this, key);\n return entry && entry.value;\n },\n // `Map.prototype.set(key, value)` method\n // https://tc39.es/ecma262/#sec-map.prototype.set\n set: function set(key, value) {\n return define(this, key === 0 ? 0 : key, value);\n }\n } : {\n // `Set.prototype.add(value)` method\n // https://tc39.es/ecma262/#sec-set.prototype.add\n add: function add(value) {\n return define(this, value = value === 0 ? 0 : value, value);\n }\n });\n if (DESCRIPTORS) defineBuiltInAccessor(Prototype, 'size', {\n configurable: true,\n get: function () {\n return getInternalState(this).size;\n }\n });\n return Constructor;\n },\n setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) {\n var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';\n var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);\n var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);\n // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods\n // https://tc39.es/ecma262/#sec-map.prototype.entries\n // https://tc39.es/ecma262/#sec-map.prototype.keys\n // https://tc39.es/ecma262/#sec-map.prototype.values\n // https://tc39.es/ecma262/#sec-map.prototype-@@iterator\n // https://tc39.es/ecma262/#sec-set.prototype.entries\n // https://tc39.es/ecma262/#sec-set.prototype.keys\n // https://tc39.es/ecma262/#sec-set.prototype.values\n // https://tc39.es/ecma262/#sec-set.prototype-@@iterator\n defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) {\n setInternalState(this, {\n type: ITERATOR_NAME,\n target: iterated,\n state: getInternalCollectionState(iterated),\n kind: kind,\n last: undefined\n });\n }, function () {\n var state = getInternalIteratorState(this);\n var kind = state.kind;\n var entry = state.last;\n // revert to the last existing entry\n while (entry && entry.removed) entry = entry.previous;\n // get next entry\n if (!state.target || !(state.last = entry = entry ? entry.next : state.state.first)) {\n // or finish the iteration\n state.target = undefined;\n return createIterResultObject(undefined, true);\n }\n // return step by kind\n if (kind === 'keys') return createIterResultObject(entry.key, false);\n if (kind === 'values') return createIterResultObject(entry.value, false);\n return createIterResultObject([entry.key, entry.value], false);\n }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);\n\n // `{ Map, Set }.prototype[@@species]` accessors\n // https://tc39.es/ecma262/#sec-get-map-@@species\n // https://tc39.es/ecma262/#sec-get-set-@@species\n setSpecies(CONSTRUCTOR_NAME);\n }\n};\n","'use strict';\nvar collection = require('../internals/collection');\nvar collectionStrong = require('../internals/collection-strong');\n\n// `Map` constructor\n// https://tc39.es/ecma262/#sec-map-objects\ncollection('Map', function (init) {\n return function Map() { return init(this, arguments.length ? arguments[0] : undefined); };\n}, collectionStrong);\n","'use strict';\nrequire('../../modules/es.array.iterator');\nrequire('../../modules/es.map');\nrequire('../../modules/es.object.to-string');\nrequire('../../modules/es.string.iterator');\nvar path = require('../../internals/path');\n\nmodule.exports = path.Map;\n","'use strict';\nvar parent = require('../../es/map');\nrequire('../../modules/web.dom-collections.iterator');\n\nmodule.exports = parent;\n","'use strict';\nvar getBuiltIn = require('../internals/get-built-in');\nvar caller = require('../internals/caller');\n\nvar Map = getBuiltIn('Map');\n\nmodule.exports = {\n Map: Map,\n set: caller('set', 2),\n get: caller('get', 1),\n has: caller('has', 1),\n remove: caller('delete', 1),\n proto: Map.prototype\n};\n","'use strict';\nmodule.exports = function (methodName, numArgs) {\n return numArgs === 1 ? function (object, arg) {\n return object[methodName](arg);\n } : function (object, arg1, arg2) {\n return object[methodName](arg1, arg2);\n };\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar aCallable = require('../internals/a-callable');\nvar requireObjectCoercible = require('../internals/require-object-coercible');\nvar iterate = require('../internals/iterate');\nvar MapHelpers = require('../internals/map-helpers');\nvar IS_PURE = require('../internals/is-pure');\n\nvar Map = MapHelpers.Map;\nvar has = MapHelpers.has;\nvar get = MapHelpers.get;\nvar set = MapHelpers.set;\nvar push = uncurryThis([].push);\n\n// `Map.groupBy` method\n// https://github.com/tc39/proposal-array-grouping\n$({ target: 'Map', stat: true, forced: IS_PURE }, {\n groupBy: function groupBy(items, callbackfn) {\n requireObjectCoercible(items);\n aCallable(callbackfn);\n var map = new Map();\n var k = 0;\n iterate(items, function (value) {\n var key = callbackfn(value, k++);\n if (!has(map, key)) set(map, key, [value]);\n else push(get(map, key), value);\n });\n return map;\n }\n});\n","'use strict';\nvar parent = require('../../stable/map');\nrequire('../../modules/esnext.map.group-by');\n\nmodule.exports = parent;\n","'use strict';\n// https://tc39.github.io/proposal-setmap-offrom/\nvar bind = require('../internals/function-bind-context');\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar aConstructor = require('../internals/a-constructor');\nvar isNullOrUndefined = require('../internals/is-null-or-undefined');\nvar iterate = require('../internals/iterate');\n\nvar push = [].push;\n\nmodule.exports = function from(source /* , mapFn, thisArg */) {\n var length = arguments.length;\n var mapFn = length > 1 ? arguments[1] : undefined;\n var mapping, array, n, boundFunction;\n aConstructor(this);\n mapping = mapFn !== undefined;\n if (mapping) aCallable(mapFn);\n if (isNullOrUndefined(source)) return new this();\n array = [];\n if (mapping) {\n n = 0;\n boundFunction = bind(mapFn, length > 2 ? arguments[2] : undefined);\n iterate(source, function (nextItem) {\n call(push, array, boundFunction(nextItem, n++));\n });\n } else {\n iterate(source, push, { that: array });\n }\n return new this(array);\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar from = require('../internals/collection-from');\n\n// `Map.from` method\n// https://tc39.github.io/proposal-setmap-offrom/#sec-map.from\n$({ target: 'Map', stat: true, forced: true }, {\n from: from\n});\n","'use strict';\nvar arraySlice = require('../internals/array-slice');\n\n// https://tc39.github.io/proposal-setmap-offrom/\nmodule.exports = function of() {\n return new this(arraySlice(arguments));\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar of = require('../internals/collection-of');\n\n// `Map.of` method\n// https://tc39.github.io/proposal-setmap-offrom/#sec-map.of\n$({ target: 'Map', stat: true, forced: true }, {\n of: of\n});\n","'use strict';\nvar tryToString = require('../internals/try-to-string');\n\nvar $TypeError = TypeError;\n\n// Perform ? RequireInternalSlot(M, [[MapData]])\nmodule.exports = function (it) {\n if (typeof it == 'object' && 'size' in it && 'has' in it && 'get' in it && 'set' in it && 'delete' in it && 'entries' in it) return it;\n throw new $TypeError(tryToString(it) + ' is not a map');\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar aMap = require('../internals/a-map');\nvar remove = require('../internals/map-helpers').remove;\n\n// `Map.prototype.deleteAll` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n deleteAll: function deleteAll(/* ...elements */) {\n var collection = aMap(this);\n var allDeleted = true;\n var wasDeleted;\n for (var k = 0, len = arguments.length; k < len; k++) {\n wasDeleted = remove(collection, arguments[k]);\n allDeleted = allDeleted && wasDeleted;\n } return !!allDeleted;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar aMap = require('../internals/a-map');\nvar MapHelpers = require('../internals/map-helpers');\n\nvar get = MapHelpers.get;\nvar has = MapHelpers.has;\nvar set = MapHelpers.set;\n\n// `Map.prototype.emplace` method\n// https://github.com/tc39/proposal-upsert\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n emplace: function emplace(key, handler) {\n var map = aMap(this);\n var value, inserted;\n if (has(map, key)) {\n value = get(map, key);\n if ('update' in handler) {\n value = handler.update(value, key, map);\n set(map, key, value);\n } return value;\n }\n inserted = handler.insert(key, map);\n set(map, key, inserted);\n return inserted;\n }\n});\n","'use strict';\nvar call = require('../internals/function-call');\n\nmodule.exports = function (record, fn, ITERATOR_INSTEAD_OF_RECORD) {\n var iterator = ITERATOR_INSTEAD_OF_RECORD ? record : record.iterator;\n var next = record.next;\n var step, result;\n while (!(step = call(next, iterator)).done) {\n result = fn(step.value);\n if (result !== undefined) return result;\n }\n};\n","'use strict';\nvar iterateSimple = require('../internals/iterate-simple');\n\nmodule.exports = function (map, fn, interruptible) {\n return interruptible ? iterateSimple(map.entries(), function (entry) {\n return fn(entry[1], entry[0]);\n }, true) : map.forEach(fn);\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind-context');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/map-iterate');\n\n// `Map.prototype.every` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n every: function every(callbackfn /* , thisArg */) {\n var map = aMap(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n return iterate(map, function (value, key) {\n if (!boundFunction(value, key, map)) return false;\n }, true) !== false;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind-context');\nvar aMap = require('../internals/a-map');\nvar MapHelpers = require('../internals/map-helpers');\nvar iterate = require('../internals/map-iterate');\n\nvar Map = MapHelpers.Map;\nvar set = MapHelpers.set;\n\n// `Map.prototype.filter` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n filter: function filter(callbackfn /* , thisArg */) {\n var map = aMap(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var newMap = new Map();\n iterate(map, function (value, key) {\n if (boundFunction(value, key, map)) set(newMap, key, value);\n });\n return newMap;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind-context');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/map-iterate');\n\n// `Map.prototype.find` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n find: function find(callbackfn /* , thisArg */) {\n var map = aMap(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var result = iterate(map, function (value, key) {\n if (boundFunction(value, key, map)) return { value: value };\n }, true);\n return result && result.value;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind-context');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/map-iterate');\n\n// `Map.prototype.findKey` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n findKey: function findKey(callbackfn /* , thisArg */) {\n var map = aMap(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var result = iterate(map, function (value, key) {\n if (boundFunction(value, key, map)) return { key: key };\n }, true);\n return result && result.key;\n }\n});\n","'use strict';\n// `SameValueZero` abstract operation\n// https://tc39.es/ecma262/#sec-samevaluezero\nmodule.exports = function (x, y) {\n // eslint-disable-next-line no-self-compare -- NaN check\n return x === y || x !== x && y !== y;\n};\n","'use strict';\nvar $ = require('../internals/export');\nvar sameValueZero = require('../internals/same-value-zero');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/map-iterate');\n\n// `Map.prototype.includes` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n includes: function includes(searchElement) {\n return iterate(aMap(this), function (value) {\n if (sameValueZero(value, searchElement)) return true;\n }, true) === true;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar call = require('../internals/function-call');\nvar iterate = require('../internals/iterate');\nvar isCallable = require('../internals/is-callable');\nvar aCallable = require('../internals/a-callable');\nvar Map = require('../internals/map-helpers').Map;\n\n// `Map.keyBy` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', stat: true, forced: true }, {\n keyBy: function keyBy(iterable, keyDerivative) {\n var C = isCallable(this) ? this : Map;\n var newMap = new C();\n aCallable(keyDerivative);\n var setter = aCallable(newMap.set);\n iterate(iterable, function (element) {\n call(setter, newMap, keyDerivative(element), element);\n });\n return newMap;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/map-iterate');\n\n// `Map.prototype.keyOf` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n keyOf: function keyOf(searchElement) {\n var result = iterate(aMap(this), function (value, key) {\n if (value === searchElement) return { key: key };\n }, true);\n return result && result.key;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind-context');\nvar aMap = require('../internals/a-map');\nvar MapHelpers = require('../internals/map-helpers');\nvar iterate = require('../internals/map-iterate');\n\nvar Map = MapHelpers.Map;\nvar set = MapHelpers.set;\n\n// `Map.prototype.mapKeys` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n mapKeys: function mapKeys(callbackfn /* , thisArg */) {\n var map = aMap(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var newMap = new Map();\n iterate(map, function (value, key) {\n set(newMap, boundFunction(value, key, map), value);\n });\n return newMap;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind-context');\nvar aMap = require('../internals/a-map');\nvar MapHelpers = require('../internals/map-helpers');\nvar iterate = require('../internals/map-iterate');\n\nvar Map = MapHelpers.Map;\nvar set = MapHelpers.set;\n\n// `Map.prototype.mapValues` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n mapValues: function mapValues(callbackfn /* , thisArg */) {\n var map = aMap(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n var newMap = new Map();\n iterate(map, function (value, key) {\n set(newMap, key, boundFunction(value, key, map));\n });\n return newMap;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/iterate');\nvar set = require('../internals/map-helpers').set;\n\n// `Map.prototype.merge` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, arity: 1, forced: true }, {\n // eslint-disable-next-line no-unused-vars -- required for `.length`\n merge: function merge(iterable /* ...iterables */) {\n var map = aMap(this);\n var argumentsLength = arguments.length;\n var i = 0;\n while (i < argumentsLength) {\n iterate(arguments[i++], function (key, value) {\n set(map, key, value);\n }, { AS_ENTRIES: true });\n }\n return map;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar aCallable = require('../internals/a-callable');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/map-iterate');\n\nvar $TypeError = TypeError;\n\n// `Map.prototype.reduce` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n reduce: function reduce(callbackfn /* , initialValue */) {\n var map = aMap(this);\n var noInitial = arguments.length < 2;\n var accumulator = noInitial ? undefined : arguments[1];\n aCallable(callbackfn);\n iterate(map, function (value, key) {\n if (noInitial) {\n noInitial = false;\n accumulator = value;\n } else {\n accumulator = callbackfn(accumulator, value, key, map);\n }\n });\n if (noInitial) throw new $TypeError('Reduce of empty map with no initial value');\n return accumulator;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar bind = require('../internals/function-bind-context');\nvar aMap = require('../internals/a-map');\nvar iterate = require('../internals/map-iterate');\n\n// `Map.prototype.some` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n some: function some(callbackfn /* , thisArg */) {\n var map = aMap(this);\n var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined);\n return iterate(map, function (value, key) {\n if (boundFunction(value, key, map)) return true;\n }, true) === true;\n }\n});\n","'use strict';\nvar $ = require('../internals/export');\nvar aCallable = require('../internals/a-callable');\nvar aMap = require('../internals/a-map');\nvar MapHelpers = require('../internals/map-helpers');\n\nvar $TypeError = TypeError;\nvar get = MapHelpers.get;\nvar has = MapHelpers.has;\nvar set = MapHelpers.set;\n\n// `Map.prototype.update` method\n// https://github.com/tc39/proposal-collection-methods\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n update: function update(key, callback /* , thunk */) {\n var map = aMap(this);\n var length = arguments.length;\n aCallable(callback);\n var isPresentInMap = has(map, key);\n if (!isPresentInMap && length < 3) {\n throw new $TypeError('Updating absent value');\n }\n var value = isPresentInMap ? get(map, key) : aCallable(length > 2 ? arguments[2] : undefined)(key, map);\n set(map, key, callback(value, key, map));\n return map;\n }\n});\n","'use strict';\nvar call = require('../internals/function-call');\nvar aCallable = require('../internals/a-callable');\nvar isCallable = require('../internals/is-callable');\nvar anObject = require('../internals/an-object');\n\nvar $TypeError = TypeError;\n\n// `Map.prototype.upsert` method\n// https://github.com/tc39/proposal-upsert\nmodule.exports = function upsert(key, updateFn /* , insertFn */) {\n var map = anObject(this);\n var get = aCallable(map.get);\n var has = aCallable(map.has);\n var set = aCallable(map.set);\n var insertFn = arguments.length > 2 ? arguments[2] : undefined;\n var value;\n if (!isCallable(updateFn) && !isCallable(insertFn)) {\n throw new $TypeError('At least one callback required');\n }\n if (call(has, map, key)) {\n value = call(get, map, key);\n if (isCallable(updateFn)) {\n value = updateFn(value);\n call(set, map, key, value);\n }\n } else if (isCallable(insertFn)) {\n value = insertFn();\n call(set, map, key, value);\n } return value;\n};\n","'use strict';\n// TODO: remove from `core-js@4`\nvar $ = require('../internals/export');\nvar upsert = require('../internals/map-upsert');\n\n// `Map.prototype.upsert` method (replaced by `Map.prototype.emplace`)\n// https://github.com/thumbsupep/proposal-upsert\n$({ target: 'Map', proto: true, real: true, forced: true }, {\n upsert: upsert\n});\n","'use strict';\n// TODO: remove from `core-js@4`\nvar $ = require('../internals/export');\nvar upsert = require('../internals/map-upsert');\n\n// `Map.prototype.updateOrInsert` method (replaced by `Map.prototype.emplace`)\n// https://github.com/thumbsupep/proposal-upsert\n$({ target: 'Map', proto: true, real: true, name: 'upsert', forced: true }, {\n updateOrInsert: upsert\n});\n","'use strict';\nvar parent = require('../../actual/map');\nrequire('../../modules/esnext.map.from');\nrequire('../../modules/esnext.map.of');\nrequire('../../modules/esnext.map.delete-all');\nrequire('../../modules/esnext.map.emplace');\nrequire('../../modules/esnext.map.every');\nrequire('../../modules/esnext.map.filter');\nrequire('../../modules/esnext.map.find');\nrequire('../../modules/esnext.map.find-key');\nrequire('../../modules/esnext.map.includes');\nrequire('../../modules/esnext.map.key-by');\nrequire('../../modules/esnext.map.key-of');\nrequire('../../modules/esnext.map.map-keys');\nrequire('../../modules/esnext.map.map-values');\nrequire('../../modules/esnext.map.merge');\nrequire('../../modules/esnext.map.reduce');\nrequire('../../modules/esnext.map.some');\nrequire('../../modules/esnext.map.update');\n// TODO: remove from `core-js@4`\nrequire('../../modules/esnext.map.upsert');\n// TODO: remove from `core-js@4`\nrequire('../../modules/esnext.map.update-or-insert');\n\nmodule.exports = parent;\n","'use strict';\nvar parent = require('../../stable/reflect/construct');\n\nmodule.exports = parent;\n","import _bindInstanceProperty from \"core-js-pure/features/instance/bind.js\";\nimport _Reflect$construct from \"core-js-pure/features/reflect/construct.js\";\nimport _pushInstanceProperty from \"core-js-pure/features/instance/push.js\";\nimport setPrototypeOf from \"./setPrototypeOf.js\";\nimport isNativeReflectConstruct from \"./isNativeReflectConstruct.js\";\nexport default function _construct(Parent, args, Class) {\n if (isNativeReflectConstruct()) {\n var _context;\n _construct = _bindInstanceProperty(_context = _Reflect$construct).call(_context);\n } else {\n _construct = function _construct(Parent, args, Class) {\n var a = [null];\n _pushInstanceProperty(a).apply(a, args);\n var Constructor = _bindInstanceProperty(Function).apply(Parent, a);\n var instance = new Constructor();\n if (Class) setPrototypeOf(instance, Class.prototype);\n return instance;\n };\n }\n return _construct.apply(null, arguments);\n}","import _Reflect$construct from \"core-js-pure/features/reflect/construct.js\";\nexport default function _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !_Reflect$construct) return false;\n if (_Reflect$construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n try {\n Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}","import _Map from \"core-js-pure/features/map/index.js\";\nimport _Object$create from \"core-js-pure/features/object/create.js\";\nimport getPrototypeOf from \"./getPrototypeOf.js\";\nimport setPrototypeOf from \"./setPrototypeOf.js\";\nimport isNativeFunction from \"./isNativeFunction.js\";\nimport construct from \"./construct.js\";\nexport default function _wrapNativeSuper(Class) {\n var _cache = typeof _Map === \"function\" ? new _Map() : undefined;\n _wrapNativeSuper = function _wrapNativeSuper(Class) {\n if (Class === null || !isNativeFunction(Class)) return Class;\n if (typeof Class !== \"function\") {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n if (typeof _cache !== \"undefined\") {\n if (_cache.has(Class)) return _cache.get(Class);\n _cache.set(Class, Wrapper);\n }\n function Wrapper() {\n return construct(Class, arguments, getPrototypeOf(this).constructor);\n }\n Wrapper.prototype = _Object$create(Class.prototype, {\n constructor: {\n value: Wrapper,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n return setPrototypeOf(Wrapper, Class);\n };\n return _wrapNativeSuper(Class);\n}","import _indexOfInstanceProperty from \"core-js-pure/features/instance/index-of.js\";\nexport default function _isNativeFunction(fn) {\n try {\n var _context;\n return _indexOfInstanceProperty(_context = Function.toString.call(fn)).call(_context, \"[native code]\") !== -1;\n } catch (e) {\n return typeof fn === \"function\";\n }\n}","interface CheckoutErrorOptions {\n cause: any;\n}\n\nclass AdyenCheckoutError extends Error {\n protected static errorTypes = {\n /** Network error. */\n NETWORK_ERROR: 'NETWORK_ERROR',\n\n /** Shopper canceled the current transaction. */\n CANCEL: 'CANCEL',\n\n /** Implementation error. The method or parameter are incorrect or are not supported. */\n IMPLEMENTATION_ERROR: 'IMPLEMENTATION_ERROR',\n\n /** Generic error. */\n ERROR: 'ERROR'\n };\n\n public cause: unknown;\n\n constructor(type: keyof typeof AdyenCheckoutError.errorTypes, message?: string, options?: CheckoutErrorOptions) {\n super(message);\n\n this.name = AdyenCheckoutError.errorTypes[type];\n\n this.cause = options?.cause;\n }\n}\n\nexport default AdyenCheckoutError;\n","export function hasOwnProperty(obj = {}, prop) {\n return Object.prototype.hasOwnProperty.call(obj, prop);\n}\n","import { h } from 'preact';\nimport BaseElement from './BaseElement';\nimport { PaymentAction } from '../types';\nimport { PaymentResponse } from './types';\nimport PayButton from './internal/PayButton';\nimport { IUIElement, PayButtonFunctionProps, RawPaymentResponse, UIElementProps } from './types';\nimport { getSanitizedResponse, resolveFinalResult } from './utils';\nimport AdyenCheckoutError from '../core/Errors/AdyenCheckoutError';\nimport { UIElementStatus } from './types';\nimport { hasOwnProperty } from '../utils/hasOwnProperty';\nimport DropinElement from './Dropin';\nimport { CoreOptions } from '../core/types';\nimport Core from '../core';\nimport { ANALYTICS_SUBMIT_STR } from '../core/Analytics/constants';\nimport { AnalyticsInitialEvent, SendAnalyticsObject } from '../core/Analytics/types';\n\nexport class UIElement
extends BaseElement
implements IUIElement {\n protected componentRef: any;\n public elementRef: UIElement;\n\n constructor(props: P) {\n super(props);\n this.submit = this.submit.bind(this);\n this.setState = this.setState.bind(this);\n this.onValid = this.onValid.bind(this);\n this.onComplete = this.onComplete.bind(this);\n this.onSubmit = this.onSubmit.bind(this);\n this.handleAction = this.handleAction.bind(this);\n this.handleOrder = this.handleOrder.bind(this);\n this.handleResponse = this.handleResponse.bind(this);\n this.setElementStatus = this.setElementStatus.bind(this);\n this.submitAnalytics = this.submitAnalytics.bind(this);\n\n this.elementRef = (props && props.elementRef) || this;\n }\n\n public setState(newState: object): void {\n this.state = { ...this.state, ...newState };\n this.onChange();\n }\n\n protected onChange(): object {\n const isValid = this.isValid;\n const state = { data: this.data, errors: this.state.errors, valid: this.state.valid, isValid };\n if (this.props.onChange) this.props.onChange(state, this.elementRef);\n if (isValid) this.onValid();\n\n return state;\n }\n\n // Only called once, for UIElements (including Dropin), as they are being mounted\n protected setUpAnalytics(setUpAnalyticsObj: AnalyticsInitialEvent) {\n const sessionId = this.props.session?.id;\n\n return this.props.modules.analytics.setUp({\n ...setUpAnalyticsObj,\n ...(sessionId && { sessionId })\n });\n }\n\n /**\n * A function for all UIElements, or BaseElement, to use to create an analytics action for when it's been:\n * - mounted,\n * - a PM has been selected\n * - onSubmit has been called (as a result of the pay button being pressed)\n *\n * In some other cases e.g. 3DS2 components, this function is overridden to allow more specific analytics actions to be created\n */\n /* eslint-disable-next-line */\n protected submitAnalytics(analyticsObj: SendAnalyticsObject, uiElementProps?) {\n /** Work out what the component's \"type\" is:\n * - first check for a dedicated \"analyticsType\" (currently only applies to custom-cards)\n * - otherwise, distinguish cards from non-cards: cards will use their static type property, everything else will use props.type\n */\n let component = this.constructor['analyticsType'];\n if (!component) {\n component = this.constructor['type'] === 'scheme' || this.constructor['type'] === 'bcmc' ? this.constructor['type'] : this.props.type;\n }\n\n this.props.modules?.analytics.sendAnalytics(component, analyticsObj, uiElementProps);\n }\n\n private onSubmit(): void {\n //TODO: refactor this, instant payment methods are part of Dropin logic not UIElement\n if (this.props.isInstantPayment) {\n const dropinElementRef = this.elementRef as DropinElement;\n dropinElementRef.closeActivePaymentMethod();\n }\n\n if (this.props.setStatusAutomatically) {\n this.setElementStatus('loading');\n }\n\n if (this.props.onSubmit) {\n /** Classic flow */\n // Call analytics endpoint\n this.submitAnalytics({ type: ANALYTICS_SUBMIT_STR });\n\n // Call onSubmit handler\n this.props.onSubmit({ data: this.data, isValid: this.isValid }, this.elementRef);\n } else if (this._parentInstance.session) {\n /** Session flow */\n // wrap beforeSubmit callback in a promise\n const beforeSubmitEvent = this.props.beforeSubmit\n ? new Promise((resolve, reject) =>\n this.props.beforeSubmit(this.data, this.elementRef, {\n resolve,\n reject\n })\n )\n : Promise.resolve(this.data);\n\n beforeSubmitEvent\n .then(data => {\n // Call analytics endpoint\n this.submitAnalytics({ type: ANALYTICS_SUBMIT_STR });\n // Submit payment\n return this.submitPayment(data);\n })\n .catch(() => {\n // set state as ready to submit if the merchant cancels the action\n this.elementRef.setStatus('ready');\n });\n } else {\n this.handleError(new AdyenCheckoutError('IMPLEMENTATION_ERROR', 'Could not submit the payment'));\n }\n }\n\n private onValid() {\n const state = { data: this.data };\n if (this.props.onValid) this.props.onValid(state, this.elementRef);\n return state;\n }\n\n onComplete(state): void {\n if (this.props.onComplete) this.props.onComplete(state, this.elementRef);\n }\n\n /**\n * Submit payment method data. If the form is not valid, it will trigger validation.\n */\n public submit(): void {\n if (!this.isValid) {\n this.showValidation();\n return;\n }\n\n this.onSubmit();\n }\n\n public showValidation(): this {\n if (this.componentRef && this.componentRef.showValidation) this.componentRef.showValidation();\n return this;\n }\n\n public setElementStatus(status: UIElementStatus, props?: any): this {\n this.elementRef?.setStatus(status, props);\n return this;\n }\n\n public setStatus(status: UIElementStatus, props?): this {\n if (this.componentRef?.setStatus) {\n this.componentRef.setStatus(status, props);\n }\n return this;\n }\n\n private submitPayment(data): Promise {\n return this._parentInstance.session\n .submitPayment(data)\n .then(this.handleResponse)\n .catch(error => this.handleError(error));\n }\n\n private submitAdditionalDetails(data): Promise {\n return this._parentInstance.session.submitDetails(data).then(this.handleResponse).catch(this.handleError);\n }\n\n protected handleError = (error: AdyenCheckoutError): void => {\n /**\n * Set status using elementRef, which:\n * - If Drop-in, will set status for Dropin component, and then it will propagate the new status for the active payment method component\n * - If Component, it will set its own status\n */\n this.setElementStatus('ready');\n\n if (this.props.onError) {\n this.props.onError(error, this.elementRef);\n }\n };\n\n protected handleAdditionalDetails = state => {\n if (this.props.onAdditionalDetails) {\n this.props.onAdditionalDetails(state, this.elementRef);\n } else if (this.props.session) {\n this.submitAdditionalDetails(state.data);\n }\n\n return state;\n };\n\n public handleAction(action: PaymentAction, props = {}): UIElement | null {\n if (!action || !action.type) {\n if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) {\n throw new Error(\n 'handleAction::Invalid Action - the passed action object itself has an \"action\" property and ' +\n 'a \"resultCode\": have you passed in the whole response object by mistake?'\n );\n }\n throw new Error('handleAction::Invalid Action - the passed action object does not have a \"type\" property');\n }\n\n const paymentAction = this._parentInstance.createFromAction(action, {\n ...this.elementRef.props,\n ...props,\n onAdditionalDetails: this.handleAdditionalDetails\n });\n\n if (paymentAction) {\n this.unmount();\n return paymentAction.mount(this._node);\n }\n\n return null;\n }\n\n protected handleOrder = (response: PaymentResponse): void => {\n this.updateParent({ order: response.order });\n // in case we receive an order in any other component then a GiftCard trigger handleFinalResult\n if (this.props.onPaymentCompleted) this.props.onPaymentCompleted(response, this.elementRef);\n };\n\n protected handleFinalResult = (result: PaymentResponse) => {\n if (this.props.setStatusAutomatically) {\n const [status, statusProps] = resolveFinalResult(result);\n if (status) this.setElementStatus(status, statusProps);\n }\n\n if (this.props.onPaymentCompleted) this.props.onPaymentCompleted(result, this.elementRef);\n return result;\n };\n\n /**\n * Handles a session /payments or /payments/details response.\n * The component will handle automatically actions, orders, and final results.\n * @param rawResponse -\n */\n protected handleResponse(rawResponse: RawPaymentResponse): void {\n const response = getSanitizedResponse(rawResponse);\n\n if (response.action) {\n this.elementRef.handleAction(response.action);\n } else if (response.order?.remainingAmount?.value > 0) {\n // we don't want to call elementRef here, use the component handler\n // we do this way so the logic on handlingOrder is associated with payment method\n this.handleOrder(response);\n } else {\n this.elementRef.handleFinalResult(response);\n }\n }\n\n /**\n * Call update on parent instance\n * This function exist to make safe access to the protect _parentInstance\n * @param options - CoreOptions\n */\n public updateParent(options: CoreOptions = {}): Promise {\n return this.elementRef._parentInstance.update(options);\n }\n\n public setComponentRef = ref => {\n this.componentRef = ref;\n };\n\n /**\n * Get the current validation status of the element\n */\n get isValid(): boolean {\n return false;\n }\n\n /**\n * Get the element icon URL for the current environment\n */\n get icon(): string {\n const type = this.props.paymentMethodType || this.type;\n return this.props.icon ?? this.resources.getImage()(type);\n }\n\n /**\n * Get the element's displayable name\n */\n get displayName(): string {\n return this.props.name || this.constructor['type'];\n }\n\n /**\n * Used to display the second line of a payment method item\n */\n get additionalInfo(): string {\n return null;\n }\n\n /**\n * Get the element accessible name, used in the aria-label of the button that controls selected payment method\n */\n get accessibleName(): string {\n return this.displayName;\n }\n\n /**\n * Return the type of an element\n */\n get type(): string {\n return this.props.type || this.constructor['type'];\n }\n\n /**\n * Get the payButton component for the current element\n */\n protected payButton = (props: PayButtonFunctionProps) => {\n return ;\n };\n}\n\nexport default UIElement;\n","import { Component, h } from 'preact';\nimport classNames from 'classnames';\nimport './Iframe.scss';\n\ninterface IframeProps {\n width?: string;\n height?: string;\n minWidth?: string;\n minHeight?: string;\n border?: string;\n src?: string;\n allow?: string;\n name?: string;\n title?: string;\n classNameModifiers?: string[];\n callback?: (contentWindow) => void;\n}\n\nclass Iframe extends Component {\n public static defaultProps = {\n width: '0',\n height: '0',\n minWidth: '0',\n minHeight: '0',\n src: null,\n allow: null,\n title: 'components iframe',\n classNameModifiers: []\n };\n\n private iframeEl;\n\n iframeOnLoad() {\n if (this.props.callback && typeof this.props.callback === 'function') {\n this.props.callback(this.iframeEl.contentWindow);\n }\n }\n\n componentDidMount() {\n if (this.iframeEl.addEventListener) {\n this.iframeEl.addEventListener('load', this.iframeOnLoad.bind(this), false);\n } else if (this.iframeEl.attachEvent) {\n // IE fallback\n this.iframeEl.attachEvent('onload', this.iframeOnLoad.bind(this));\n } else {\n this.iframeEl.onload = this.iframeOnLoad.bind(this);\n }\n }\n\n componentWillUnmount() {\n if (this.iframeEl.removeEventListener) {\n this.iframeEl.removeEventListener('load', this.iframeOnLoad.bind(this), false);\n } else if (this.iframeEl.detachEvent) {\n // IE fallback\n this.iframeEl.detachEvent('onload', this.iframeOnLoad.bind(this));\n } else {\n this.iframeEl.onload = null;\n }\n }\n\n render({ name, src, width, height, minWidth, minHeight, allow, title, classNameModifiers }: IframeProps) {\n const validClassNameModifiers = classNameModifiers.filter(m => !!m);\n\n return (\n