airwallex-payment-elements 0.2.40 → 0.2.49

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 (51) hide show
  1. package/lib/bin/airwallex.cjs.js +2 -3
  2. package/lib/bin/airwallex.cjs.js.map +1 -1
  3. package/lib/bin/airwallex.es.js +2 -3
  4. package/lib/bin/airwallex.es.js.map +1 -1
  5. package/lib/bin/airwallex.iife.js +2 -3
  6. package/lib/bin/airwallex.iife.js.map +1 -1
  7. package/lib/bin/index.d.ts +28 -4
  8. package/lib/bin/{npmPackage/index.test.d.ts → index.test.d.ts} +0 -0
  9. package/package.json +1 -1
  10. package/types/airwallex.d.ts +3 -2
  11. package/types/element.d.ts +14 -5
  12. package/types/fraud.d.ts +3 -0
  13. package/types/index.d.ts +2 -0
  14. package/types/redirectElement.d.ts +6 -4
  15. package/lib/bin/airwallex.d.ts +0 -39
  16. package/lib/bin/airwallex.test.d.ts +0 -1
  17. package/lib/bin/card.d.ts +0 -31
  18. package/lib/bin/card.test.d.ts +0 -1
  19. package/lib/bin/cardNumber.d.ts +0 -38
  20. package/lib/bin/cardNumber.test.d.ts +0 -1
  21. package/lib/bin/cvc.d.ts +0 -18
  22. package/lib/bin/cvc.test.d.ts +0 -1
  23. package/lib/bin/dropIn.d.ts +0 -9
  24. package/lib/bin/dropIn.test.d.ts +0 -1
  25. package/lib/bin/element.d.ts +0 -20
  26. package/lib/bin/element.test.d.ts +0 -1
  27. package/lib/bin/expiry.d.ts +0 -5
  28. package/lib/bin/expiry.test.d.ts +0 -1
  29. package/lib/bin/fraud.d.ts +0 -8
  30. package/lib/bin/fraud.test.d.ts +0 -1
  31. package/lib/bin/fullFeaturedCard.d.ts +0 -10
  32. package/lib/bin/fullFeaturedCard.test.d.ts +0 -1
  33. package/lib/bin/handle3dsFlow.d.ts +0 -31
  34. package/lib/bin/handle3dsFlow.test.d.ts +0 -1
  35. package/lib/bin/npmPackage/index.d.ts +0 -24
  36. package/lib/bin/paymentRequestButton.d.ts +0 -9
  37. package/lib/bin/paymentRequestButton.test.d.ts +0 -1
  38. package/lib/bin/processParams.d.ts +0 -4
  39. package/lib/bin/processParams.test.d.ts +0 -1
  40. package/lib/bin/qrcode.d.ts +0 -9
  41. package/lib/bin/qrcode.test.d.ts +0 -1
  42. package/lib/bin/redirect.d.ts +0 -7
  43. package/lib/bin/redirect.test.d.ts +0 -1
  44. package/lib/bin/threeDsChallenge.d.ts +0 -12
  45. package/lib/bin/threeDsChallenge.test.d.ts +0 -1
  46. package/lib/bin/threeDsFrictionless.d.ts +0 -10
  47. package/lib/bin/threeDsFrictionless.test.d.ts +0 -1
  48. package/lib/bin/util.d.ts +0 -22
  49. package/lib/bin/util.test.d.ts +0 -1
  50. package/lib/bin/wechat.d.ts +0 -9
  51. package/lib/bin/wechat.test.d.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"airwallex.iife.js","sources":["../../src/util.ts","../../src/element.ts","../../src/airwallex.ts","../../src/threeDsFrictionless.ts","../../src/threeDsChallenge.ts","../../src/handle3dsFlow.ts","../../src/fraud.ts","../../src/npmPackage/index.ts"],"sourcesContent":["export const simulateFormSubmit = (data: { [k: string]: string }, action: string): void => {\n const formEle = document.createElement('form');\n formEle.setAttribute('method', 'post');\n formEle.setAttribute('style', 'height: 0; overflow: hidden;');\n formEle.action = action;\n Object.keys(data || {}).forEach((key: string) => {\n const inputEle = document.createElement('input');\n inputEle.type = 'hidden';\n inputEle.name = key;\n inputEle.value = data[key];\n formEle.appendChild(inputEle);\n });\n const submitBtn = document.createElement('input');\n submitBtn.type = 'submit';\n formEle.appendChild(submitBtn);\n document.body.appendChild(formEle);\n submitBtn.click();\n};\n\ntype eventHandlerType = (event: MessageEvent) => void;\n\nexport const useMessageListener = (eventHandler: eventHandlerType): void => {\n window.addEventListener('message', (event: MessageEvent) => {\n if (window.ReactNativeWebView) {\n window.ReactNativeWebView.postMessage(JSON.stringify(event.data));\n }\n\n eventHandler(event);\n });\n};\n\nexport const ENV_HOST = {\n prod: 'checkout.airwallex.com',\n demo: 'checkout-demo.airwallex.com',\n staging: 'checkout-staging.airwallex.com',\n /**\n * Below env only for the npm package development\n * Should not using them when integrate with Airwallex\n */\n qa: 'checkoutui.qa.awx.im',\n preview: 'checkoutui.preview.awx.im',\n dev: 'localhost:3000',\n};\n\nexport const ENV_CHECKOUT_SERVER_HOST = {\n prod: 'https://pci-api.airwallex.com',\n demo: 'https://pci-api-demo.airwallex.com',\n staging: 'https://pci-api-staging.airwallex.com',\n /**\n * Below env only for the npm package development\n * Should not using them when integrate with Airwallex\n */\n qa: 'https://pci-api-qa.airwallex.com',\n preview: 'https://pci-api-preview.airwallex.com',\n dev: 'http://localhost:8080',\n};\n","import { Element, ElementError } from '../types/element';\nimport { useMessageListener } from './util';\nimport { Intent } from '../types/cardNumber';\n\nexport class ElementBase implements Element {\n gatewayUrl: string;\n options?: Element['options'];\n iframe: HTMLIFrameElement | null;\n domElement: null | HTMLElement;\n\n constructor(gatewayUrl: string, options?: Element['options']) {\n this.domElement = null;\n this.gatewayUrl = gatewayUrl;\n this.options = options;\n this.iframe = window.document.createElement('iframe');\n this.iframe.setAttribute('frameborder', '0');\n this.iframe.setAttribute('allowtransparency', 'true');\n this.iframe.setAttribute('importance', 'high');\n this.iframe.setAttribute('scrolling', 'no');\n this.iframe.setAttribute('allowpaymentrequest', 'true');\n this.iframe?.setAttribute(\n 'style',\n `\n height: 0;\n width: 100%;\n display: block;\n `,\n );\n useMessageListener((event: MessageEvent) => {\n // exist for the old user, already handle onReady event in individual Element\n if (event.origin === this.gatewayUrl && event.isTrusted && event.data?.code === 'onReady') {\n const customEvent = new CustomEvent(event.data?.code, {\n detail: {\n type: event.data?.type,\n },\n bubbles: true,\n composed: true,\n });\n window.document.dispatchEvent(customEvent);\n }\n });\n }\n\n addResizeListener(type: string): void {\n window.addEventListener('message', (event: MessageEvent) => {\n if (event.origin === this.gatewayUrl && event.isTrusted) {\n if (event.data?.code === 'onResize' && type === event.data?.type) {\n const styleAttribute = this.iframe?.style;\n if (styleAttribute) {\n styleAttribute.height = `${event.data?.height}px`;\n }\n }\n }\n });\n }\n\n mount(domElement: string | HTMLElement): null | HTMLElement {\n if (typeof domElement !== 'string') {\n if (domElement?.hasChildNodes()) {\n domElement.innerHTML = '';\n }\n this.iframe && domElement.appendChild(this.iframe);\n this.domElement = domElement;\n return domElement;\n } else {\n const getDomElement = window.document.getElementById(domElement);\n if (getDomElement?.hasChildNodes()) {\n getDomElement.innerHTML = '';\n }\n this.iframe && getDomElement?.appendChild(this.iframe);\n if (getDomElement) {\n this.domElement = getDomElement;\n }\n return getDomElement;\n }\n }\n\n blur(): void {\n this.iframe?.contentWindow?.postMessage({ code: 'blur' }, this.gatewayUrl);\n }\n\n clear(): void {\n this.iframe?.contentWindow?.postMessage({ code: 'clear' }, this.gatewayUrl);\n }\n\n destroy(): void {\n this.clear();\n this.iframe?.remove();\n this.iframe = null;\n }\n\n focus(): void {\n this.iframe?.contentWindow?.postMessage({ code: 'focus' }, this.gatewayUrl);\n }\n\n unmount(): void {\n this.clear();\n this.iframe && this.domElement?.removeChild(this.iframe);\n }\n\n update(options?: Element['options']): void {\n this.options = { ...this.options, ...options };\n this.iframe?.contentWindow?.postMessage({ code: 'update', options }, this.gatewayUrl);\n }\n async confirm(): Promise<Intent | null> {\n throw new Error('Confirm is not supported in ElementBase');\n }\n success(value: Intent): void {\n throw new Error(`Call success with ${value.id} is not supported in ElementBase`);\n }\n fail(error: ElementError): void {\n throw new Error(`Call fail with ${error.code}: ${error.message} is not supported in ElementBase`);\n }\n}\n","import { ElementBase } from './element';\nimport { ElementType } from '../types/element';\nimport { CardNumberElement } from './cardNumber';\nimport { ExpiryElement } from './expiry';\nimport { CvcElement } from './cvc';\nimport { PaymentRequestButtonElement } from './paymentRequestButton';\nimport { DropInElement } from './dropIn';\nimport { FullFeaturedCardElement } from './fullFeaturedCard';\nimport { CardElement } from './card';\nimport { WechatElement } from './wechat';\nimport { QrcodeElement } from './qrcode';\nimport { RedirectElement } from './redirect';\nimport { processQueryParams } from './processParams';\nimport { getGatewayUrl } from './npmPackage';\n\nimport {\n InitOptions,\n HostPaymentPage,\n init as initFn,\n redirectToCheckout as redirectToCheckoutFn,\n createElement as createElementFn,\n confirmPaymentIntent as confirmPaymentIntentFn,\n confirmPaymentIntentWithSavedCard as confirmPaymentIntentWithSavedCardFn,\n createPaymentMethod as createPaymentMethodFn,\n getPaymentIntent as getPaymentIntentFn,\n createPaymentConsent as createPaymentConsentFn,\n} from '../types/airwallex';\n\nimport { FullFeaturedCardElementOptions } from '../types/element';\nimport { RedirectElementOptions } from '../types/redirectElement';\nimport { DropInElementOptions } from '../types/dropInElement';\n\nexport const ElementList = [\n 'cardNumber',\n 'expiry',\n 'cvc',\n 'paymentRequestButton',\n 'card',\n 'wechat',\n 'qrcode',\n 'redirect',\n 'dropIn',\n 'fullFeaturedCard',\n];\n\nexport const ThreeDsElementList = <const>['threeDsFrictionless', 'threeDsChallenge'];\nexport type ExtendElementType = ElementType | typeof ThreeDsElementList[number];\nexport const ExtentElementList = [...ElementList, ...ThreeDsElementList];\n\nexport interface Config {\n gatewayUrl: string;\n options?: InitOptions;\n}\n\nexport interface Elements {\n cardNumber: ElementBase | null;\n expiry: ElementBase | null;\n cvc: ElementBase | null;\n threeDsFrictionless: ElementBase | null;\n threeDsChallenge: ElementBase | null;\n paymentRequestButton: ElementBase | null;\n card: ElementBase | null;\n wechat: ElementBase | null;\n qrcode: ElementBase | null;\n redirect: ElementBase | null;\n dropIn: ElementBase | null;\n fullFeaturedCard: ElementBase | null;\n}\n\nexport const CONFIG: Config = {\n gatewayUrl: '',\n options: {} as InitOptions,\n};\n\nexport const ELEMENTS: Elements = {\n cardNumber: null,\n expiry: null,\n cvc: null,\n threeDsFrictionless: null,\n threeDsChallenge: null,\n paymentRequestButton: null,\n card: null,\n wechat: null,\n qrcode: null,\n redirect: null,\n dropIn: null,\n fullFeaturedCard: null,\n};\n\nexport const init: typeof initFn = (options) => {\n if (options?.env || !CONFIG.gatewayUrl) {\n CONFIG.gatewayUrl = getGatewayUrl(options?.env || 'prod');\n }\n CONFIG.options = options;\n};\n\nexport type Key = Exclude<keyof HostPaymentPage, 'id' | 'intent_id' | 'host'>;\n\nexport const redirectToCheckout: typeof redirectToCheckoutFn = (props) => {\n const { env, ...restProps } = props;\n const parameters = processQueryParams(restProps);\n const { id, ...rest } = parameters || {};\n const queryParamsKeys = Object.keys(rest) as Key[];\n const paramsArray: string[] = [];\n queryParamsKeys.forEach((key: Key) => {\n paramsArray.push(`${key}=${rest[key]}`);\n });\n const redirectUrl =\n props.mode === 'recurring'\n ? `${getGatewayUrl(env || 'prod')}/#/standalone/recurring?${paramsArray.join('&')}`\n : `${getGatewayUrl(env || 'prod')}/#/standalone/checkout/${id || rest?.intent_id}?${paramsArray.join('&')}`;\n window.location.href = redirectUrl;\n};\n\nexport const createElement: typeof createElementFn = (type, options) => {\n const newOptions = options ?? { origin: '' };\n if (!newOptions.origin) {\n newOptions.origin = CONFIG.options?.origin;\n }\n if (!ElementList.includes(type)) {\n console.warn(`createElement with type: ${type} not support!`);\n return null;\n }\n if (type === 'cardNumber') {\n ELEMENTS[type] = new CardNumberElement(CONFIG.gatewayUrl, newOptions);\n return ELEMENTS[type];\n } else if (type === 'card') {\n ELEMENTS[type] = new CardElement(CONFIG.gatewayUrl, newOptions);\n return ELEMENTS[type];\n } else if (type === 'fullFeaturedCard') {\n ELEMENTS[type] = new FullFeaturedCardElement(CONFIG.gatewayUrl, newOptions as FullFeaturedCardElementOptions);\n return ELEMENTS[type];\n } else if (type === 'wechat') {\n ELEMENTS[type] = new WechatElement(CONFIG.gatewayUrl, newOptions);\n return ELEMENTS[type];\n } else if (type === 'qrcode') {\n ELEMENTS[type] = new QrcodeElement(CONFIG.gatewayUrl, newOptions);\n return ELEMENTS[type];\n } else if (type === 'redirect') {\n ELEMENTS[type] = new RedirectElement(CONFIG.gatewayUrl, newOptions as RedirectElementOptions);\n return ELEMENTS[type];\n } else if (type === 'paymentRequestButton') {\n ELEMENTS[type] = new PaymentRequestButtonElement(CONFIG.gatewayUrl, newOptions);\n return ELEMENTS[type];\n } else if (type === 'dropIn') {\n ELEMENTS[type] = new DropInElement(CONFIG.gatewayUrl, (newOptions as unknown) as DropInElementOptions);\n return ELEMENTS[type];\n } else if (type === 'expiry' || type === 'cvc') {\n ELEMENTS[type] =\n type === 'expiry'\n ? new ExpiryElement(CONFIG.gatewayUrl, newOptions)\n : new CvcElement(CONFIG.gatewayUrl, newOptions);\n\n window.addEventListener('message', (event: MessageEvent) => {\n // Communicate cvc and expiry to cardNumber element\n if (\n event.origin === CONFIG.gatewayUrl &&\n event.isTrusted &&\n type === event.data?.type &&\n event.data?.code === 'onChange'\n ) {\n ELEMENTS.cardNumber?.iframe?.contentWindow?.postMessage(\n { code: `update_${event.data?.type}`, data: event.data },\n CONFIG.gatewayUrl,\n );\n }\n });\n return ELEMENTS[type];\n }\n\n return null;\n};\n\nexport const destroyElement = (type: ExtendElementType): boolean => {\n if (ExtentElementList.includes(type)) {\n ELEMENTS[type]?.destroy();\n ELEMENTS[type] = null;\n return true;\n } else {\n console.warn(`destroyElement with type: ${type} not support!`);\n return false;\n }\n};\n\nexport const getElement = (type: ExtendElementType): ElementBase | null => {\n if (ExtentElementList.includes(type)) {\n return ELEMENTS[type];\n } else {\n console.warn(`getElement with type: ${type} not support!`);\n return null;\n }\n};\n\nexport const setElement = (type: ExtendElementType, element: ElementBase): boolean => {\n if (ExtentElementList.includes(type)) {\n ELEMENTS[type] = element;\n return true;\n } else {\n console.warn(`destroyElement with type: ${type} not support!`);\n return false;\n }\n};\n\nexport const confirmPaymentIntent: typeof confirmPaymentIntentFn = async (data) => {\n console.info(`Confirm intent ${data?.intent_id || data?.id} with client secret: ${data?.client_secret}`);\n if (data?.element) {\n return (data?.element as CardNumberElement).confirm(data);\n } else {\n console.warn('Card number element must be provided for card payment confirm!');\n return false;\n }\n};\n\nexport const confirmPaymentIntentWithSavedCard: typeof confirmPaymentIntentWithSavedCardFn = async (data) => {\n console.info(`Confirm intent ${data?.intent_id || data?.id} with client secret: ${data?.client_secret}`);\n if (data?.element && data?.methodId) {\n return (data?.element as CvcElement).confirm(data);\n } else {\n console.warn('Payment method id must be provided for cvc payment confirm!');\n return false;\n }\n};\n\nexport const createPaymentMethod: typeof createPaymentMethodFn = async (client_secret, data) => {\n console.info(`Create payment method with client secret: ${client_secret}`);\n if (data?.element) {\n return (data?.element as CardNumberElement).createPaymentMethod({\n ...data,\n client_secret,\n });\n } else {\n console.warn('Either payment method id or element must be provided for payment method create!');\n return false;\n }\n};\n\nexport const createPaymentConsent: typeof createPaymentConsentFn = async (data) => {\n console.info(`Create payment consent with client secret: ${data.client_secret}`);\n if (data?.element) {\n return (data?.element as CardElement).createPaymentConsent(data);\n } else {\n console.warn('Either payment method id or element must be provided for create payment consent!');\n return false;\n }\n};\n\nexport const getPaymentIntent: typeof getPaymentIntentFn = async (id, client_secret) => {\n return (ELEMENTS.cardNumber as CardNumberElement)?.getPaymentIntent(id, client_secret) || false;\n};\n","import { ElementBase } from './element';\nimport { ElementOptions, ExtendEventDetail } from '../types/element';\nimport { Intent } from '../types/cardNumber';\nimport { CONFIG } from './airwallex';\n\nexport class ThreeDsFrictionlessElement extends ElementBase {\n confirmResponse: ExtendEventDetail;\n\n constructor(gatewayUrl: string, confirmResponse: ExtendEventDetail, options?: ElementOptions & { intent: Intent }) {\n super(gatewayUrl, options);\n this.confirmResponse = confirmResponse;\n this.iframe?.setAttribute(\n 'src',\n `${gatewayUrl}/#/elements/3ds-frictionless?options=${encodeURIComponent(JSON.stringify(this.options))}&lang=${\n CONFIG.options?.locale\n }`,\n );\n this.iframe?.setAttribute('name', 'Airwallex 3DS frictionless iframe');\n this.iframe?.setAttribute('title', 'Airwallex 3DS frictionless iframe');\n window.addEventListener('message', (event: MessageEvent) => {\n if (\n event.origin === this.gatewayUrl &&\n event.isTrusted &&\n event.data?.code === 'onReady' &&\n event.data?.type === 'threeDsFrictionless'\n ) {\n this.iframe?.contentWindow?.postMessage({ code: 'update', data: this.confirmResponse }, this.gatewayUrl);\n }\n });\n }\n async confirm(): Promise<Intent | null> {\n this.iframe?.contentWindow?.postMessage(\n {\n code: 'confirm',\n data: this.confirmResponse,\n },\n this.gatewayUrl,\n );\n return null;\n }\n}\n","import { ElementBase } from './element';\nimport { ElementOptions, ExtendEventDetail } from '../types/element';\nimport { Intent } from '../types/cardNumber';\nimport { CHALLENGE_WINDOW_SIZE_MAP } from './fraud';\n\nexport class ThreeDsChallengeElement extends ElementBase {\n confirmResponse: ExtendEventDetail;\n\n constructor(\n gatewayUrl: string,\n confirmResponse: ExtendEventDetail,\n options?: ElementOptions & { useDefaultStyle: boolean; customizeChallengeWindowSize?: string; intent: Intent },\n ) {\n super(gatewayUrl, options);\n this.confirmResponse = confirmResponse;\n // If provided predefined challenge window size, then use it, otherwise use '05' which is ['100%', '100%']\n const challengeWindowSize =\n options?.customizeChallengeWindowSize && CHALLENGE_WINDOW_SIZE_MAP[options?.customizeChallengeWindowSize]\n ? CHALLENGE_WINDOW_SIZE_MAP[options?.customizeChallengeWindowSize]\n : CHALLENGE_WINDOW_SIZE_MAP['05'];\n // if merchant provided the popupWidth when build element, then use it, otherwise use the width of challengeWindowSize\n const authPopupWidth = options?.style?.popupWidth ? `${options?.style?.popupWidth}px` : challengeWindowSize[0];\n // if merchant provided the popupHeight when build element, then use it, otherwise use the height of challengeWindowSize\n const authPopupHeight = options?.style?.popupHeight ? `${options?.style?.popupHeight}px` : challengeWindowSize[1];\n this.iframe?.setAttribute(\n 'src',\n `${gatewayUrl}/#/elements/3ds-challenge?options=${encodeURIComponent(JSON.stringify(this.options))}`,\n );\n this.iframe?.setAttribute('name', 'Airwallex 3DS challenge iframe');\n this.iframe?.setAttribute('title', 'Airwallex 3DS challenge iframe');\n this.iframe?.setAttribute('scrolling', 'yes');\n this.iframe?.setAttribute(\n 'style',\n `\n background: #fff;\n width: ${authPopupWidth};\n height: ${authPopupHeight};\n position: ${options?.useDefaultStyle ? 'absolute' : 'relative'};\n top: ${options?.useDefaultStyle ? '50%' : '0'};\n left: ${options?.useDefaultStyle ? '50%' : '0'};\n transform: ${options?.useDefaultStyle ? 'translate(-50%, -50%)' : 'none'};\n border-radius: ${options?.useDefaultStyle ? '4px' : '0'};\n `,\n );\n window.addEventListener('message', (event: MessageEvent) => {\n if (\n event.origin === this.gatewayUrl &&\n event.isTrusted &&\n event.data?.code === 'onReady' &&\n event.data?.type === 'threeDsChallenge'\n ) {\n this.iframe?.contentWindow?.postMessage({ code: 'update', data: this.confirmResponse }, this.gatewayUrl);\n }\n });\n }\n async confirm(): Promise<Intent | null> {\n this.iframe?.contentWindow?.postMessage(\n {\n code: 'confirm',\n data: this.confirmResponse,\n },\n this.gatewayUrl,\n );\n return null;\n }\n}\n","import { ThreeDsFrictionlessElement } from './threeDsFrictionless';\nimport { ThreeDsChallengeElement } from './threeDsChallenge';\nimport { destroyElement, setElement, getElement } from './airwallex';\nimport { ElementType, EventCode, ElementError, ExtendEventDetail } from '../types/element';\nimport { NextAction } from '../types/fraud';\nimport { Intent } from '../types/cardNumber';\n\ntype Resolver = (value: ExtendEventDetail | PromiseLike<ExtendEventDetail>) => void;\ntype Reject = (error?: ElementError) => void;\n\ntype ThreeDsPromiseType = {\n resolver: Resolver | null;\n reject: Reject | null;\n awaiting: boolean;\n};\n\nconst threeDsFrictionlessType = 'threeDsFrictionless';\nconst threeDsChallengeType = 'threeDsChallenge';\n/**\n * These variables are used in element iframe, frictionless iframe and challenge iframe\n * Different iframe communicate with events, so use the global variable instead of inject the events.\n */\n// The div container that contains the iframe if merchant not provided\nlet challengeDiv: HTMLElement;\n// The error handler for 3ds result\nlet customizeAuthFormContainer: HTMLElement | null;\n// The container that contains the iframe which is provided by merchant\nlet type: ExtendElementType | 'hpp' | 'api';\n// The customize popup width provided by merchant when mount element\nlet customizePopupWidth: number | undefined;\n// The customize popup height provided by merchant when mount element\nlet customizePopupHeight: number | undefined;\n// The customize challenge window size by merchant when handle 3ds\nlet customizeChallengeWindowSize: string | undefined;\n// The gateway url of the gateway url for build iframe\nlet customizeGatewayUrl: string;\n// The intent that you would like to confirm\nlet intentData: Intent;\n// The resolver for 3ds flow result\nconst threeDsPromise: ThreeDsPromiseType = {\n resolver: null,\n reject: null,\n awaiting: false,\n};\n\nconst ThreeDsElementList = ['threeDsFrictionless', 'threeDsChallenge'] as const;\nexport type ExtendElementType = ElementType | typeof ThreeDsElementList[number];\nconst ExtendEventList = [\n 'onResize',\n 'onRedirect',\n 'onComplete',\n 'onChallenge',\n 'onChallengeSuccess',\n 'onChallengeError',\n 'onIntentRetrieved',\n 'onIntentRetrievedError',\n 'onPaymentMethodCreated',\n 'onPaymentMethodCreatedError',\n] as const;\nexport type ExtendEventCode = EventCode | typeof ExtendEventList[number];\n\n// Clear the 3DS iframe\nexport const clear3Ds = (type: typeof threeDsFrictionlessType | typeof threeDsChallengeType): void => {\n document.querySelector(`#${type}`)?.remove();\n if (type === threeDsFrictionlessType) {\n destroyElement(threeDsFrictionlessType);\n } else {\n destroyElement(threeDsChallengeType);\n }\n};\n\n// Clear 3ds Promis\nexport const clearThreeDsPromise = (): void => {\n threeDsPromise.awaiting = false;\n threeDsPromise.resolver = null;\n threeDsPromise.reject = null;\n};\n\n// HPP handle 3ds success\nexport const onHppSuccess = (value: ExtendEventDetail | undefined): void => {\n const customEvent = new CustomEvent('on3dsSuccess', {\n detail: value,\n bubbles: true,\n composed: true,\n });\n window.document.dispatchEvent(customEvent);\n};\n\n// HPP handle 3ds error\nexport const onHppError = (error?: ElementError): void => {\n const customEvent = new CustomEvent('on3dsError', {\n detail: {\n error,\n },\n bubbles: true,\n composed: true,\n });\n window.document.dispatchEvent(customEvent);\n};\n\ninterface ThreeDsHandlerProps {\n intent: Intent;\n gatewayUrl: string;\n cardBin: string;\n next_action: NextAction;\n authFormContainer?: string;\n componentType: ExtendElementType | 'hpp' | 'api';\n challengeWindowSize?: string;\n}\n\n/**\n * Both the handle3ds function(for api integration) and threeDsListener(for elements integration) would go through this function\n * @return {Promise<ExtendEventDetail>} Promise type which will resolve ExtendEventDetail type when success\n */\nexport const threeDsHandler = ({\n intent,\n gatewayUrl,\n cardBin,\n next_action,\n authFormContainer,\n componentType,\n challengeWindowSize,\n}: ThreeDsHandlerProps): Promise<ExtendEventDetail> => {\n if (threeDsPromise.awaiting) {\n console.warn('Should wait previous 3ds flow finished before execute new one!');\n }\n console.log('threeDsHandler onChallenge type', new Date().toLocaleTimeString());\n customizeAuthFormContainer = document.getElementById(authFormContainer || '');\n type = componentType;\n customizeChallengeWindowSize = challengeWindowSize;\n customizeGatewayUrl = gatewayUrl;\n intentData = intent;\n\n clear3Ds(threeDsFrictionlessType);\n setElement(\n threeDsFrictionlessType,\n new ThreeDsFrictionlessElement(\n customizeGatewayUrl,\n {\n code: '',\n type: threeDsFrictionlessType,\n cardBin,\n next_action,\n },\n {\n intent: intentData,\n origin: window.location.origin,\n },\n ),\n );\n const frictionlessDiv = document.createElement('div');\n frictionlessDiv.setAttribute('id', threeDsFrictionlessType);\n document.body.appendChild(frictionlessDiv);\n window.addEventListener('message', frictionlessHandler);\n getElement(threeDsFrictionlessType)?.mount(frictionlessDiv);\n\n return new Promise((resolve: Resolver, reject: Reject) => {\n threeDsPromise.resolver = resolve;\n threeDsPromise.reject = reject;\n threeDsPromise.awaiting = true;\n });\n};\n\n/**\n * Setup the frictionless iframe listeners\n * @param {CustomEvent | MessageEvent} event the event received from the frictionless iframe\n */\nconst frictionlessHandler = (event: CustomEvent | MessageEvent) => {\n const eventData = 'data' in event ? event.data : event.detail;\n const isHppOrApi = ['hpp', 'api'].includes(type);\n const element = isHppOrApi ? null : getElement(type as ExtendElementType);\n const gatewayUrl = element?.gatewayUrl || window.location.origin;\n const eventIsTrusted = ('data' in event && event.origin === gatewayUrl && event.isTrusted) || isHppOrApi;\n\n if (eventIsTrusted && eventData?.type === threeDsFrictionlessType) {\n clear3Ds(threeDsChallengeType);\n if (eventData?.code === 'onSuccess') {\n console.log('frictionlessHandler onSuccess', new Date().toLocaleTimeString());\n threeDsPromise.resolver?.(eventData);\n clearThreeDsPromise();\n clear3Ds(threeDsFrictionlessType);\n }\n if (['onError', 'onChallengeError'].includes(eventData?.code)) {\n console.log(`frictionlessHandler ${eventData?.code}`, new Date().toLocaleTimeString());\n threeDsPromise.reject?.(eventData);\n clearThreeDsPromise();\n clear3Ds(threeDsFrictionlessType);\n }\n if (eventData?.code === 'onChallenge') {\n console.log('frictionlessHandler onChallenge threeDsFrictionlessType', new Date().toLocaleTimeString());\n clear3Ds(threeDsFrictionlessType);\n if (!customizeAuthFormContainer) {\n challengeDiv = document.createElement('div');\n challengeDiv.setAttribute('id', threeDsChallengeType);\n challengeDiv.setAttribute(\n 'style',\n `\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 0;\n z-index: 1500;\n overflow: hidden;\n background: rgba(0, 0, 0, 0.75);\n `,\n );\n document.body.appendChild(challengeDiv);\n } else {\n challengeDiv = customizeAuthFormContainer;\n }\n setElement(\n threeDsChallengeType,\n new ThreeDsChallengeElement(customizeGatewayUrl, eventData as ExtendEventDetail, {\n origin: window.location.origin,\n style: {\n popupWidth: customizePopupWidth,\n popupHeight: customizePopupHeight,\n },\n useDefaultStyle: customizeAuthFormContainer === null,\n customizeChallengeWindowSize,\n intent: intentData,\n }),\n );\n window.addEventListener('message', challengeHandler);\n getElement(threeDsChallengeType)?.mount(challengeDiv);\n }\n }\n};\n\n/**\n * Setup the challenge iframe listeners\n * @param {CustomEvent | MessageEvent} event the event received from the challenge iframe\n */\nconst challengeHandler = (event: CustomEvent | MessageEvent) => {\n const eventData = 'data' in event ? event.data : event.detail;\n const isHppOrApi = ['hpp', 'api'].includes(type);\n const element = isHppOrApi ? null : getElement(type as ExtendElementType);\n const gatewayUrl = element?.gatewayUrl || window.location.origin;\n const eventIsTrusted = ('data' in event && event.origin === gatewayUrl && event.isTrusted) || isHppOrApi;\n\n if (eventIsTrusted && eventData?.type === threeDsChallengeType) {\n if (eventData?.code === 'onReady') {\n console.log('challengeHandler onReady', new Date().toLocaleTimeString());\n setTimeout(() => {\n challengeDiv.style.height = '100%';\n }, 2000);\n }\n if (eventData?.code === 'onChallengeSuccess') {\n challengeDiv.style.height = '0';\n }\n if (eventData?.code === 'onSuccess') {\n console.log('challengeHandler onSuccess', new Date().toLocaleTimeString());\n threeDsPromise.resolver?.(eventData);\n clearThreeDsPromise();\n clear3Ds(threeDsChallengeType);\n }\n if (['onError', 'onChallengeError'].includes(eventData?.code)) {\n console.log(`challengeHandler ${eventData?.code}`, new Date().toLocaleTimeString());\n threeDsPromise.reject?.(eventData);\n clearThreeDsPromise();\n clear3Ds(threeDsChallengeType);\n }\n }\n};\n\ninterface Handle3dsFlowProps {\n type: ElementType | 'hpp';\n popupWidth?: number;\n popupHeight?: number;\n authFormContainer?: string;\n}\n\nexport const handle3dsFlow = ({ type, popupWidth, popupHeight, authFormContainer }: Handle3dsFlowProps): void => {\n customizePopupWidth = popupWidth;\n customizePopupHeight = popupHeight;\n\n /**\n * This function will listener to the message event from elements including HPP\n * @param {CustomEvent | MessageEvent} event add listener to handle event from elements\n */\n const threeDsListener = async (event: CustomEvent | MessageEvent) => {\n const eventData = 'data' in event ? event.data : event.detail;\n const isHpp = type === 'hpp';\n const element = isHpp ? null : getElement(type as ExtendElementType);\n const gatewayUrl = element?.gatewayUrl || window.location.origin;\n const eventIsTrusted = ('data' in event && event.origin === gatewayUrl && event.isTrusted) || isHpp;\n\n if (eventIsTrusted && eventData?.type === type && eventData?.code === 'onChallenge') {\n const { cardBin, next_action, intent } = eventData;\n try {\n const confirmResult = await threeDsHandler({\n gatewayUrl,\n cardBin,\n intent,\n next_action,\n authFormContainer,\n componentType: type,\n });\n\n if (type === 'hpp') {\n onHppSuccess(confirmResult);\n } else {\n if (confirmResult?.intent) {\n element?.success(confirmResult?.intent);\n }\n element?.iframe?.contentWindow?.postMessage({ code: 'on3dsSuccess', confirmResult }, gatewayUrl);\n }\n\n window.removeEventListener('message', threeDsListener);\n window.removeEventListener('message', frictionlessHandler);\n window.removeEventListener('message', challengeHandler);\n } catch (error) {\n if (type === 'hpp') {\n onHppError(error);\n } else {\n error && element?.fail(error);\n element?.iframe?.contentWindow?.postMessage({ code: 'on3dsError', error }, gatewayUrl);\n }\n\n window.removeEventListener('message', challengeHandler);\n }\n }\n };\n\n window.addEventListener('message', threeDsListener);\n};\n","import {\n Handle3dsRequest,\n Get3dsReturnUrlRequest,\n getBrowserInfo as getBrowserInfoFn,\n getDeviceFingerprint as getDeviceFingerprintFn,\n handle3ds as handle3dsFn,\n get3dsReturnUrl as get3dsReturnUrlFn,\n} from '../types/fraud';\nimport { threeDsHandler } from './handle3dsFlow';\nimport { ENV_HOST, ENV_CHECKOUT_SERVER_HOST } from './util';\n\nexport const CHALLENGE_WINDOW_SIZE_MAP: { [key: string]: [string, string] } = {\n '01': ['250px', '400px'],\n '02': ['390px', '400px'],\n '03': ['500px', '600px'],\n '04': ['600px', '400px'],\n '05': ['100%', '100%'],\n};\n\nexport const getBrowserInfo: typeof getBrowserInfoFn = (fingerprintRequest) => {\n const { navigator, screen } = window || {};\n const { language } = navigator || {};\n const { colorDepth, height, width } = screen || {};\n const { intent_id, env } = fingerprintRequest || {};\n let device_id;\n if (fingerprintRequest) {\n device_id = getDeviceFingerprint({ intent_id, env });\n }\n\n return {\n device_id,\n screen_height: height,\n screen_width: width,\n screen_color_depth: colorDepth,\n language: language,\n timezone: new Date().getTimezoneOffset(),\n browser: {\n java_enabled: window.navigator.javaEnabled(),\n javascript_enabled: true,\n user_agent: navigator.userAgent,\n },\n };\n};\n\nlet fraudSessionId = '';\n\nexport const getDeviceFingerprint: typeof getDeviceFingerprintFn = ({ intent_id = '', env = 'prod' }) => {\n if (!fraudSessionId.includes(intent_id)) {\n const ORG_ID = env === 'prod' ? '9ozphlqx' : '45ssiuz3';\n const script = document.createElement('script');\n fraudSessionId = `${intent_id}${Date.now()}`;\n script.src = `https://h.online-metrix.net/fp/tags.js?org_id=${ORG_ID}&session_id=${fraudSessionId}`;\n document.body.appendChild(script);\n }\n\n return fraudSessionId;\n};\n\nexport const get3dsReturnUrl: typeof get3dsReturnUrlFn = (props: Get3dsReturnUrlRequest) => {\n const { env, checkoutOrigin } = props;\n return `${ENV_CHECKOUT_SERVER_HOST[env || 'prod']}/api/v1/checkout/elements/3ds?origin=https://${\n ENV_HOST[env || 'prod']\n }&checkoutOrigin=${checkoutOrigin || window.location.origin}`;\n};\n\nexport const handle3ds: typeof handle3dsFn = (props: Handle3dsRequest) => {\n const { cardBin, next_action, authFormContainer, intent, challengeWindowSize, env } = props;\n return threeDsHandler({\n gatewayUrl: `https://${ENV_HOST[env]}`,\n cardBin,\n intent,\n next_action,\n authFormContainer,\n componentType: 'api',\n challengeWindowSize,\n });\n};\n","import Airwallex, {\n init as initFn,\n redirectToCheckout as redirectToCheckoutFn,\n createElement as createElementFn,\n destroyElement as destroyElementFn,\n getElement as getElementFn,\n confirmPaymentIntent as confirmPaymentIntentFn,\n confirmPaymentIntentWithSavedCard as confirmPaymentIntentWithSavedCardFn,\n createPaymentMethod as createPaymentMethodFn,\n getPaymentIntent as getPaymentIntentFn,\n createPaymentConsent as createPaymentConsentFn,\n AirwallexEnv,\n} from '../../types/airwallex';\nexport { getBrowserInfo, getDeviceFingerprint, get3dsReturnUrl, handle3ds } from '../../src/fraud';\nimport { loadAirwallex as loadAirwallexFn } from '../../types/index';\nimport { ENV_HOST } from '../util';\n\ndeclare global {\n interface Window {\n Airwallex: Airwallex;\n ReactNativeWebView: {\n postMessage: (message: string) => void;\n };\n }\n}\n\nexport const getGatewayUrl = (env: AirwallexEnv): string => `https://${ENV_HOST[env] || 'checkout.airwallex.com'}`;\n\nconst version = [process.env.version_major, process.env.version_minor, process.env.version_patch].join('.');\n\nconst STATIC_JS_URL = `/assets/bundle.${version}.min.js`;\n\nexport const loadAirwallexJs = (gatewayUrl: string): HTMLScriptElement => {\n const script = document.createElement('script');\n script.src = `${gatewayUrl}${STATIC_JS_URL}`;\n\n const headOrBody = document.head || document.body;\n\n if (!headOrBody) {\n throw new Error('Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.');\n }\n\n headOrBody.appendChild(script);\n\n return script;\n};\n\nexport const loadAirwallex: typeof loadAirwallexFn = (options) => {\n return Promise.resolve().then(() => {\n if (typeof window === 'undefined') {\n return null;\n }\n if (window.Airwallex) {\n return window.Airwallex;\n }\n\n const script: HTMLScriptElement =\n document.querySelector(`script[src=\"${STATIC_JS_URL}\"], script[src=\"${STATIC_JS_URL}/\"]`) ||\n loadAirwallexJs(getGatewayUrl(options?.env || 'prod'));\n\n return new Promise((resolve, reject) => {\n script.addEventListener('load', () => {\n if (window.Airwallex) {\n window.Airwallex.init(options);\n resolve(window.Airwallex);\n } else {\n reject(new Error('Failed to load Airwallex on load event'));\n }\n });\n\n script.addEventListener('error', () => {\n reject(new Error('Failed to load Airwallex scripts'));\n });\n });\n });\n};\n\nexport const init: typeof initFn = (options) => {\n if (!window.Airwallex) {\n console.error('Please loadAirwallex() before init();');\n } else {\n window.Airwallex.init(options);\n }\n};\n\nexport const redirectToCheckout: typeof redirectToCheckoutFn = (props) => {\n if (!window.Airwallex) {\n console.error('Please loadAirwallex() before redirectToCheckout();');\n } else {\n window.Airwallex.redirectToCheckout(props);\n }\n};\n\nexport const createElement: typeof createElementFn = (type, options) => {\n if (!window.Airwallex) {\n console.error('Please loadAirwallex() before createElement();');\n return null;\n } else {\n return window.Airwallex.createElement(type, options);\n }\n};\n\nexport const destroyElement: typeof destroyElementFn = (type) => {\n if (!window.Airwallex) {\n console.error('Please loadAirwallex() before destroyElement();');\n return false;\n } else {\n return window.Airwallex.destroyElement(type);\n }\n};\n\nexport const getElement: typeof getElementFn = (type) => {\n if (!window.Airwallex) {\n console.error('Please loadAirwallex() before getElement();');\n return null;\n } else {\n return window.Airwallex.getElement(type);\n }\n};\n\nexport const confirmPaymentIntent: typeof confirmPaymentIntentFn = async (data) => {\n if (!window.Airwallex) {\n const err = 'Please loadAirwallex() before confirmPaymentIntent();';\n console.error(err);\n throw new Error(err);\n } else {\n return window.Airwallex.confirmPaymentIntent(data);\n }\n};\n\nexport const confirmPaymentIntentWithSavedCard: typeof confirmPaymentIntentWithSavedCardFn = async (data) => {\n if (!window.Airwallex) {\n const err = 'Please loadAirwallex() before confirmPaymentIntentWithSavedCard();';\n console.error(err);\n throw new Error(err);\n } else {\n return window.Airwallex.confirmPaymentIntentWithSavedCard(data);\n }\n};\n\nexport const createPaymentMethod: typeof createPaymentMethodFn = async (client_secret, data) => {\n if (!window.Airwallex) {\n const err = 'Please loadAirwallex() before createPaymentMethod();';\n console.error(err);\n throw new Error(err);\n } else {\n return window.Airwallex.createPaymentMethod(client_secret, data);\n }\n};\n\nexport const getPaymentIntent: typeof getPaymentIntentFn = async (id, client_secret) => {\n if (!window.Airwallex) {\n const err = 'Please loadAirwallex() before getPaymentIntent();';\n console.error(err);\n throw new Error(err);\n } else {\n return window.Airwallex.getPaymentIntent(id, client_secret);\n }\n};\n\nexport const createPaymentConsent: typeof createPaymentConsentFn = async (data) => {\n if (!window.Airwallex) {\n const err = 'Please loadAirwallex() before createPaymentConsent();';\n console.error(err);\n throw new Error(err);\n } else {\n return window.Airwallex.createPaymentConsent(data);\n }\n};\n"],"names":["ENV_HOST","prod","demo","staging","qa","preview","dev","ENV_CHECKOUT_SERVER_HOST","ElementBase","[object Object]","gatewayUrl","options","eventHandler","this","domElement","iframe","window","document","createElement","setAttribute","event","origin","isTrusted","data","code","customEvent","CustomEvent","detail","type","bubbles","composed","dispatchEvent","addEventListener","ReactNativeWebView","postMessage","JSON","stringify","styleAttribute","style","height","hasChildNodes","innerHTML","appendChild","getDomElement","getElementById","contentWindow","clear","remove","removeChild","Error","value","id","error","message","ExtentElementList","CONFIG","ELEMENTS","cardNumber","expiry","cvc","threeDsFrictionless","threeDsChallenge","paymentRequestButton","card","wechat","qrcode","redirect","dropIn","fullFeaturedCard","destroyElement","includes","destroy","console","warn","getElement","setElement","element","ThreeDsFrictionlessElement","confirmResponse","super","encodeURIComponent","locale","ThreeDsChallengeElement","challengeWindowSize","customizeChallengeWindowSize","CHALLENGE_WINDOW_SIZE_MAP","authPopupWidth","popupWidth","authPopupHeight","popupHeight","useDefaultStyle","threeDsFrictionlessType","threeDsChallengeType","challengeDiv","customizeAuthFormContainer","customizeGatewayUrl","intentData","threeDsPromise","resolver","reject","awaiting","clear3Ds","querySelector","clearThreeDsPromise","frictionlessHandler","eventData","isHppOrApi","location","log","Date","toLocaleTimeString","body","customizePopupWidth","customizePopupHeight","intent","challengeHandler","mount","setTimeout","01","02","03","04","05","fraudSessionId","getDeviceFingerprint","intent_id","env","ORG_ID","script","now","src","getGatewayUrl","STATIC_JS_URL","join","loadAirwallexJs","headOrBody","head","async","Airwallex","confirmPaymentIntent","err","confirmPaymentIntentWithSavedCard","createPaymentConsent","client_secret","createPaymentMethod","props","checkoutOrigin","fingerprintRequest","navigator","screen","language","colorDepth","width","device_id","screen_height","screen_width","screen_color_depth","timezone","getTimezoneOffset","browser","java_enabled","javaEnabled","javascript_enabled","user_agent","userAgent","getPaymentIntent","cardBin","next_action","authFormContainer","componentType","frictionlessDiv","Promise","resolve","threeDsHandler","init","then","redirectToCheckout"],"mappings":";uCAqBO,MAUMA,EAAW,CACtBC,KAAM,yBACNC,KAAM,8BACNC,QAAS,iCAKTC,GAAI,uBACJC,QAAS,4BACTC,IAAK,kBAGMC,EAA2B,CACtCN,KAAM,gCACNC,KAAM,qCACNC,QAAS,wCAKTC,GAAI,mCACJC,QAAS,wCACTC,IAAK,+BClDME,EAMXC,YAAYC,EAAoBC,SDWCC,ECV/BC,KAAKC,WAAa,KAClBD,KAAKH,WAAaA,EAClBG,KAAKF,QAAUA,EACfE,KAAKE,OAASC,OAAOC,SAASC,cAAc,UAC5CL,KAAKE,OAAOI,aAAa,cAAe,KACxCN,KAAKE,OAAOI,aAAa,oBAAqB,QAC9CN,KAAKE,OAAO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StF,UAI9B,MAAMqJ,EAAkBzJ,SAASC,cAAc,OAM/C,OALAwJ,EAAgBvJ,aAAa,KAAMwE,GACnC1E,SAAS8F,KAAKrE,YAAYgI,GAC1B1J,OAAOgB,iBAAiB,UAAWwE,aACnC9B,EAAWiB,mBAA0ByB,MAAMsD,GAEpC,IAAIC,SAAQ,CAACC,EAAmBzE,KACrCF,EAAeC,SAAW0E,EAC1B3E,EAAeE,OAASA,EACxBF,EAAeG,UAAW,MC5FrByE,CAAe,CACpBnK,WAAY,WAAWV,EAAS8H,KAChCwC,QAAAA,EACApD,OAAAA,EACAqD,YAAAA,EACAC,kBAAAA,EACAC,cAAe,MACftF,oBAAAA,YCGgCxE,IAC7BK,OAAO0H,UAGV1H,OAAO0H,UAAUoC,KAAKnK,GAFtB6D,QAAQpB,MAAM,0DAhCoCzC,GAC7CgK,QAAQC,UAAUG,MAAK,KAC5B,GAAsB,oBAAX/J,OACT,OAAO,KAET,GAAIA,OAAO0H,UACT,OAAO1H,OAAO0H,UAGhB,MAAMV,EACJ/G,SAASqF,cAAc,eAAe8B,oBAAgCA,SACtEE,EAAgBH,GAAcxH,MAAAA,SAAAA,EAASmH,MAAO,SAEhD,OAAO,IAAI6C,SAAQ,CAACC,EAASzE,KAC3B6B,EAAOhG,iBAAiB,QAAQ,KAC1BhB,OAAO0H,WACT1H,OAAO0H,UAAUoC,KAAKnK,GACtBiK,EAAQ5J,OAAO0H,YAEfvC,EAAO,IAAIlD,MAAM,8CAIrB+E,EAAOhG,iBAAiB,SAAS,KAC/BmE,EAAO,IAAIlD,MAAM,uFAcuCgG,IACzDjI,OAAO0H,UAGV1H,OAAO0H,UAAUsC,mBAAmB/B,GAFpCzE,QAAQpB,MAAM"}
1
+ {"version":3,"file":"airwallex.iife.js","sources":["../../src/index.ts"],"sourcesContent":["import Airwallex, {\n init as initFn,\n redirectToCheckout as redirectToCheckoutFn,\n createElement as createElementFn,\n destroyElement as destroyElementFn,\n getElement as getElementFn,\n confirmPaymentIntent as confirmPaymentIntentFn,\n confirmPaymentIntentWithSavedCard as confirmPaymentIntentWithSavedCardFn,\n createPaymentMethod as createPaymentMethodFn,\n getPaymentIntent as getPaymentIntentFn,\n createPaymentConsent as createPaymentConsentFn,\n AirwallexEnv,\n} from '../types/airwallex';\nimport {\n getBrowserInfo as getBrowserInfoFn,\n getDeviceFingerprint as getDeviceFingerprintFn,\n get3dsReturnUrl as get3dsReturnUrlFn,\n handle3ds as handle3dsFn,\n} from '../types/fraud';\nimport { loadAirwallex as loadAirwallexFn } from '../types/index';\n\nconst ENV_HOST = {\n prod: 'checkout.airwallex.com',\n demo: 'checkout-demo.airwallex.com',\n staging: 'checkout-staging.airwallex.com',\n /**\n * Below env only for the npm package development\n * Should not using them when integrate with Airwallex\n */\n qa: 'checkoutui.qa.awx.im',\n preview: 'checkoutui.preview.awx.im',\n dev: 'localhost:3000',\n};\n\ndeclare global {\n interface Window {\n Airwallex: Airwallex;\n ReactNativeWebView: {\n postMessage: (message: string) => void;\n };\n }\n}\n\nexport const getGatewayUrl = (env: AirwallexEnv): string => `https://${ENV_HOST[env] || ENV_HOST.prod}`;\n\nconst STATIC_JS_URL = `/assets/elements.bundle.min.js`;\n\nexport const loadAirwallexJs = (gatewayUrl: string): HTMLScriptElement => {\n const script = document.createElement('script');\n script.src = `${gatewayUrl}${STATIC_JS_URL}`;\n\n const headOrBody = document.head || document.body;\n\n if (!headOrBody) {\n throw new Error('Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.');\n }\n\n headOrBody.appendChild(script);\n\n return script;\n};\n\nexport const loadAirwallex: typeof loadAirwallexFn = (options) => {\n return Promise.resolve().then(() => {\n if (typeof window === 'undefined') {\n return null;\n }\n if (window.Airwallex) {\n return window.Airwallex;\n }\n\n const script: HTMLScriptElement =\n document.querySelector(`script[src=\"${STATIC_JS_URL}\"], script[src=\"${STATIC_JS_URL}/\"]`) ||\n loadAirwallexJs(getGatewayUrl(options?.env || 'prod'));\n\n return new Promise((resolve, reject) => {\n script.addEventListener('load', () => {\n if (window.Airwallex) {\n window.Airwallex.init(options);\n resolve(window.Airwallex);\n } else {\n reject(new Error('Failed to load Airwallex on load event'));\n }\n });\n\n script.addEventListener('error', () => {\n reject(new Error('Failed to load Airwallex scripts'));\n });\n });\n });\n};\n\nexport const init: typeof initFn = (options) => {\n if (!window.Airwallex) {\n console.error('Please loadAirwallex() before init();');\n } else {\n window.Airwallex.init(options);\n }\n};\n\nexport const redirectToCheckout: typeof redirectToCheckoutFn = (props) => {\n if (!window.Airwallex) {\n console.error('Please loadAirwallex() before redirectToCheckout();');\n } else {\n window.Airwallex.redirectToCheckout(props);\n }\n};\n\nexport const createElement: typeof createElementFn = (type, options) => {\n if (!window.Airwallex) {\n console.error('Please loadAirwallex() before createElement();');\n return null;\n } else {\n return window.Airwallex.createElement(type, options);\n }\n};\n\nexport const destroyElement: typeof destroyElementFn = (type) => {\n if (!window.Airwallex) {\n console.error('Please loadAirwallex() before destroyElement();');\n return false;\n } else {\n return window.Airwallex.destroyElement(type);\n }\n};\n\nexport const getElement: typeof getElementFn = (type) => {\n if (!window.Airwallex) {\n console.error('Please loadAirwallex() before getElement();');\n return null;\n } else {\n return window.Airwallex.getElement(type);\n }\n};\n\nexport const confirmPaymentIntent: typeof confirmPaymentIntentFn = async (data) => {\n if (!window.Airwallex) {\n const err = 'Please loadAirwallex() before confirmPaymentIntent();';\n console.error(err);\n throw new Error(err);\n } else {\n return window.Airwallex.confirmPaymentIntent(data);\n }\n};\n\nexport const confirmPaymentIntentWithSavedCard: typeof confirmPaymentIntentWithSavedCardFn = async (data) => {\n if (!window.Airwallex) {\n const err = 'Please loadAirwallex() before confirmPaymentIntentWithSavedCard();';\n console.error(err);\n throw new Error(err);\n } else {\n return window.Airwallex.confirmPaymentIntentWithSavedCard(data);\n }\n};\n\nexport const createPaymentMethod: typeof createPaymentMethodFn = async (client_secret, data) => {\n if (!window.Airwallex) {\n const err = 'Please loadAirwallex() before createPaymentMethod();';\n console.error(err);\n throw new Error(err);\n } else {\n return window.Airwallex.createPaymentMethod(client_secret, data);\n }\n};\n\nexport const getPaymentIntent: typeof getPaymentIntentFn = async (id, client_secret) => {\n if (!window.Airwallex) {\n const err = 'Please loadAirwallex() before getPaymentIntent();';\n console.error(err);\n throw new Error(err);\n } else {\n return window.Airwallex.getPaymentIntent(id, client_secret);\n }\n};\n\nexport const createPaymentConsent: typeof createPaymentConsentFn = async (data) => {\n if (!window.Airwallex) {\n const err = 'Please loadAirwallex() before createPaymentConsent();';\n console.error(err);\n throw new Error(err);\n } else {\n return window.Airwallex.createPaymentConsent(data);\n }\n};\n\nexport const getBrowserInfo: typeof getBrowserInfoFn = (data) => {\n return window.Airwallex.getBrowserInfo(data);\n};\n\nexport const getDeviceFingerprint: typeof getDeviceFingerprintFn = (data) => {\n return window.Airwallex.getDeviceFingerprint(data);\n};\n\nexport const get3dsReturnUrl: typeof get3dsReturnUrlFn = (data) => {\n return window.Airwallex.get3dsReturnUrl(data);\n};\n\nexport const handle3ds: typeof handle3dsFn = (data) => {\n return window.Airwallex.handle3ds(data);\n};\n"],"names":["ENV_HOST","prod","demo","staging","qa","preview","dev","getGatewayUrl","env","STATIC_JS_URL","loadAirwallexJs","gatewayUrl","script","document","createElement","src","headOrBody","head","body","Error","appendChild","async","data","window","Airwallex","confirmPaymentIntent","err","console","error","confirmPaymentIntentWithSavedCard","type","options","createPaymentConsent","client_secret","createPaymentMethod","destroyElement","get3dsReturnUrl","getBrowserInfo","getDeviceFingerprint","getElement","id","getPaymentIntent","handle3ds","init","Promise","resolve","then","querySelector","reject","addEventListener","props","redirectToCheckout"],"mappings":";uCAqBA,MAAMA,EAAW,CACfC,KAAM,yBACNC,KAAM,8BACNC,QAAS,iCAKTC,GAAI,uBACJC,QAAS,4BACTC,IAAK,kBAYMC,EAAiBC,GAA8B,WAAWR,EAASQ,IAAQR,EAASC,OAE3FQ,EAAgB,iCAETC,EAAmBC,IAC9B,MAAMC,EAASC,SAASC,cAAc,UACtCF,EAAOG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,GALxB,CACrB,MAAMP,EAAM,oDAEZ,MADAC,QAAQC,MAAMF,GACR,IAAIP,MAAMO,iBA4B0BJ,GACrCC,OAAOC,UAAUkB,UAAUpB,UA1GAS,IAC7BR,OAAOC,UAGVD,OAAOC,UAAUmB,KAAKZ,GAFtBJ,QAAQC,MAAM,0DAhCoCG,GAC7Ca,QAAQC,UAAUC,MAAK,KAC5B,GAAsB,oBAAXvB,OACT,OAAO,KAET,GAAIA,OAAOC,UACT,OAAOD,OAAOC,UAGhB,MAAMZ,EACJC,SAASkC,cAAc,eAAetC,oBAAgCA,SACtEC,EAAgBH,GAAcwB,MAAAA,SAAAA,EAASvB,MAAO,SAEhD,OAAO,IAAIoC,SAAQ,CAACC,EAASG,KAC3BpC,EAAOqC,iBAAiB,QAAQ,KAC1B1B,OAAOC,WACTD,OAAOC,UAAUmB,KAAKZ,GACtBc,EAAQtB,OAAOC,YAEfwB,EAAO,IAAI7B,MAAM,8CAIrBP,EAAOqC,iBAAiB,SAAS,KAC/BD,EAAO,IAAI7B,MAAM,uFAcuC+B,IACzD3B,OAAOC,UAGVD,OAAOC,UAAU2B,mBAAmBD,GAFpCvB,QAAQC,MAAM"}
@@ -1,4 +1,28 @@
1
- import { init, createElement, getElement, destroyElement, confirmPaymentIntent, confirmPaymentIntentWithSavedCard, createPaymentMethod, createPaymentConsent, getPaymentIntent, redirectToCheckout } from './airwallex';
2
- import { getBrowserInfo, getDeviceFingerprint, get3dsReturnUrl, handle3ds } from './fraud';
3
- import { handle3dsFlow } from './handle3dsFlow';
4
- export { init, createElement, getElement, destroyElement, confirmPaymentIntent, confirmPaymentIntentWithSavedCard, createPaymentMethod, createPaymentConsent, getPaymentIntent, handle3dsFlow, redirectToCheckout, getBrowserInfo, getDeviceFingerprint, get3dsReturnUrl, handle3ds, };
1
+ import Airwallex, { init as initFn, redirectToCheckout as redirectToCheckoutFn, createElement as createElementFn, destroyElement as destroyElementFn, getElement as getElementFn, confirmPaymentIntent as confirmPaymentIntentFn, confirmPaymentIntentWithSavedCard as confirmPaymentIntentWithSavedCardFn, createPaymentMethod as createPaymentMethodFn, getPaymentIntent as getPaymentIntentFn, createPaymentConsent as createPaymentConsentFn, AirwallexEnv } from '../types/airwallex';
2
+ import { getBrowserInfo as getBrowserInfoFn, getDeviceFingerprint as getDeviceFingerprintFn, get3dsReturnUrl as get3dsReturnUrlFn, handle3ds as handle3dsFn } from '../types/fraud';
3
+ import { loadAirwallex as loadAirwallexFn } from '../types/index';
4
+ declare global {
5
+ interface Window {
6
+ Airwallex: Airwallex;
7
+ ReactNativeWebView: {
8
+ postMessage: (message: string) => void;
9
+ };
10
+ }
11
+ }
12
+ export declare const getGatewayUrl: (env: AirwallexEnv) => string;
13
+ export declare const loadAirwallexJs: (gatewayUrl: string) => HTMLScriptElement;
14
+ export declare const loadAirwallex: typeof loadAirwallexFn;
15
+ export declare const init: typeof initFn;
16
+ export declare const redirectToCheckout: typeof redirectToCheckoutFn;
17
+ export declare const createElement: typeof createElementFn;
18
+ export declare const destroyElement: typeof destroyElementFn;
19
+ export declare const getElement: typeof getElementFn;
20
+ export declare const confirmPaymentIntent: typeof confirmPaymentIntentFn;
21
+ export declare const confirmPaymentIntentWithSavedCard: typeof confirmPaymentIntentWithSavedCardFn;
22
+ export declare const createPaymentMethod: typeof createPaymentMethodFn;
23
+ export declare const getPaymentIntent: typeof getPaymentIntentFn;
24
+ export declare const createPaymentConsent: typeof createPaymentConsentFn;
25
+ export declare const getBrowserInfo: typeof getBrowserInfoFn;
26
+ export declare const getDeviceFingerprint: typeof getDeviceFingerprintFn;
27
+ export declare const get3dsReturnUrl: typeof get3dsReturnUrlFn;
28
+ export declare const handle3ds: typeof handle3dsFn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "airwallex-payment-elements",
3
- "version": "0.2.40",
3
+ "version": "0.2.49",
4
4
  "module": "lib/bin/airwallex.es.js",
5
5
  "main": "lib/bin/airwallex.cjs.js",
6
6
  "bin": "lib/bin/airwallex.cjs.js",
@@ -15,6 +15,7 @@ import { BoxStyle, PaymentMethodType } from './element';
15
15
  import { getBrowserInfo, getDeviceFingerprint, get3dsReturnUrl, handle3ds } from './fraud';
16
16
  import { DropInElementOptions } from './dropInElement';
17
17
  import { RedirectElementOptions } from './redirectElement';
18
+
18
19
  /**
19
20
  * Global font option config for Airwallex integration methods
20
21
  */
@@ -59,7 +60,7 @@ export interface InitOptions {
59
60
  /**
60
61
  * i18n localization config
61
62
  */
62
- locale?: 'en' | 'zh' | 'ja' | 'ko';
63
+ locale?: 'en' | 'zh' | 'ja' | 'ko' | 'ar';
63
64
  /**
64
65
  * Global font options
65
66
  */
@@ -154,7 +155,7 @@ export interface HostPaymentPage {
154
155
  /**
155
156
  * i18n localization config
156
157
  */
157
- locale?: 'en' | 'zh' | 'ja' | 'ko';
158
+ locale?: 'en' | 'zh' | 'ja' | 'ko' | 'ar';
158
159
  /**
159
160
  * Apply only for card, to improve 3DS experience, indicate if the payment form will collect billing info from shopper
160
161
  */
@@ -66,7 +66,20 @@ export type PaymentMethodWithRedirect =
66
66
  | 'paysafecash'
67
67
  | 'paysafecard'
68
68
  | 'paysera'
69
- | 'satispay';
69
+ | 'satispay'
70
+ | 'family_mart'
71
+ | 'hi_life'
72
+ | 'sam_kiosk'
73
+ | 'axs_kiosk'
74
+ | 'bigc'
75
+ | 'esun'
76
+ | 'permata_atm'
77
+ | 'boost'
78
+ | 'shopee_pay'
79
+ | 'paypal'
80
+ | 'payu'
81
+ | 'ovo'
82
+ | 'bitpay';
70
83
 
71
84
  /**
72
85
  * Supported integration payment method type for dropin and hostPaymentPage
@@ -433,10 +446,6 @@ export interface FullFeaturedCardRecurringOptions extends FullFeaturedCardPaymen
433
446
  * If no intent provided, this should be the client_secret of the customer
434
447
  */
435
448
  client_secret: string;
436
- /**
437
- * Currency of your payment intent or consent. Three-letter ISO currency code
438
- */
439
- currency: string;
440
449
  /**
441
450
  * Checkout mode
442
451
  */
package/types/fraud.d.ts CHANGED
@@ -79,6 +79,9 @@ interface NextAction {
79
79
  stage: string;
80
80
  version: string;
81
81
  };
82
+ type: string;
83
+ url: string;
84
+ stage?: string;
82
85
  }
83
86
 
84
87
  /**
package/types/index.d.ts CHANGED
@@ -26,6 +26,7 @@ import Airwallex, {
26
26
  HppTheme,
27
27
  HostPaymentPage,
28
28
  Mode,
29
+ HppRecurringOptions,
29
30
  } from './airwallex';
30
31
 
31
32
  export {
@@ -49,6 +50,7 @@ export {
49
50
  FontOptions,
50
51
  HppTheme,
51
52
  HostPaymentPage,
53
+ HppRecurringOptions,
52
54
  };
53
55
 
54
56
  /**
@@ -16,14 +16,16 @@ interface RedirectElementPaymentBasicOptions extends ElementOptions {
16
16
  }
17
17
 
18
18
  /**
19
- * For poli, grab_pay, konbini, eps, giropay, ideal, multibankco, bancontact, blik, mybank, paybybankapp, maxima, narvesen, paypost, perlas_terminals
19
+ * For poli, grab_pay, konbini, eps, giropay, ideal, multibankco, bancontact, blik
20
+ * mybank, paybybankapp, maxima, narvesen, paypost, perlas_terminals
20
21
  */
21
22
  interface RedirectElementPaymentOptionsForPoli extends RedirectElementPaymentBasicOptions {
22
23
  shopper_name?: string;
23
24
  }
24
25
 
25
26
  /**
26
- * For fpx, enets, pay_easy, tesco_lotus, dragonpay
27
+ * For fpx, enets, pay_easy, tesco_lotus, dragonpay, family_mart, hi_life
28
+ * sam_kiosk, axs_kiosk, bigc, esun, permata_atm, boost, shopee_pay
27
29
  */
28
30
  interface RedirectElementPaymentOptionsForFpx extends RedirectElementPaymentBasicOptions {
29
31
  shopper_name?: string;
@@ -32,7 +34,7 @@ interface RedirectElementPaymentOptionsForFpx extends RedirectElementPaymentBasi
32
34
  }
33
35
 
34
36
  /**
35
- * For bank_transfer, paysafecash
37
+ * For paysafecash
36
38
  */
37
39
  interface RedirectElementPaymentOptionsForBankTransfer extends RedirectElementPaymentBasicOptions {
38
40
  country_code: string;
@@ -41,7 +43,7 @@ interface RedirectElementPaymentOptionsForBankTransfer extends RedirectElementPa
41
43
  }
42
44
 
43
45
  /**
44
- * For online_banking, seven_eleven
46
+ * For bank_transfer, online_banking, seven_eleven
45
47
  */
46
48
  interface RedirectElementPaymentOptionsForOnlineBanking extends RedirectElementPaymentBasicOptions {
47
49
  country_code: string;
@@ -1,39 +0,0 @@
1
- import { ElementBase } from './element';
2
- import { ElementType } from '../types/element';
3
- import { InitOptions, HostPaymentPage, init as initFn, redirectToCheckout as redirectToCheckoutFn, createElement as createElementFn, confirmPaymentIntent as confirmPaymentIntentFn, confirmPaymentIntentWithSavedCard as confirmPaymentIntentWithSavedCardFn, createPaymentMethod as createPaymentMethodFn, getPaymentIntent as getPaymentIntentFn, createPaymentConsent as createPaymentConsentFn } from '../types/airwallex';
4
- export declare const ElementList: string[];
5
- export declare const ThreeDsElementList: readonly ["threeDsFrictionless", "threeDsChallenge"];
6
- export declare type ExtendElementType = ElementType | typeof ThreeDsElementList[number];
7
- export declare const ExtentElementList: string[];
8
- export interface Config {
9
- gatewayUrl: string;
10
- options?: InitOptions;
11
- }
12
- export interface Elements {
13
- cardNumber: ElementBase | null;
14
- expiry: ElementBase | null;
15
- cvc: ElementBase | null;
16
- threeDsFrictionless: ElementBase | null;
17
- threeDsChallenge: ElementBase | null;
18
- paymentRequestButton: ElementBase | null;
19
- card: ElementBase | null;
20
- wechat: ElementBase | null;
21
- qrcode: ElementBase | null;
22
- redirect: ElementBase | null;
23
- dropIn: ElementBase | null;
24
- fullFeaturedCard: ElementBase | null;
25
- }
26
- export declare const CONFIG: Config;
27
- export declare const ELEMENTS: Elements;
28
- export declare const init: typeof initFn;
29
- export declare type Key = Exclude<keyof HostPaymentPage, 'id' | 'intent_id' | 'host'>;
30
- export declare const redirectToCheckout: typeof redirectToCheckoutFn;
31
- export declare const createElement: typeof createElementFn;
32
- export declare const destroyElement: (type: ExtendElementType) => boolean;
33
- export declare const getElement: (type: ExtendElementType) => ElementBase | null;
34
- export declare const setElement: (type: ExtendElementType, element: ElementBase) => boolean;
35
- export declare const confirmPaymentIntent: typeof confirmPaymentIntentFn;
36
- export declare const confirmPaymentIntentWithSavedCard: typeof confirmPaymentIntentWithSavedCardFn;
37
- export declare const createPaymentMethod: typeof createPaymentMethodFn;
38
- export declare const createPaymentConsent: typeof createPaymentConsentFn;
39
- export declare const getPaymentIntent: typeof getPaymentIntentFn;
@@ -1 +0,0 @@
1
- export {};
package/lib/bin/card.d.ts DELETED
@@ -1,31 +0,0 @@
1
- import { ElementBase } from './element';
2
- import { PaymentMethod, PaymentConsentRequest, PaymentConsentResponse } from '../types/airwallex';
3
- import { Intent, PaymentMethodBasicInfo } from '../types/cardNumber';
4
- import { ElementError, CardElementOptions } from '../types/element';
5
- declare type IntentResolver = (value: Intent | PromiseLike<Intent>) => void;
6
- declare type PaymentConsentResolver = (value: PaymentConsentResponse | PromiseLike<PaymentConsentResponse>) => void;
7
- declare type Reject = (error?: ElementError) => void;
8
- export declare type PaymentConsentRawData = Intent & {
9
- latest_payment_attempt?: {
10
- payment_method: PaymentMethodBasicInfo;
11
- };
12
- };
13
- export declare const buildPaymentConsentResponse: (intent: PaymentConsentRawData) => PaymentConsentResponse;
14
- export declare class CardElement extends ElementBase {
15
- confirmIntent: {
16
- resolver: IntentResolver | null;
17
- reject: Reject | null;
18
- awaiting: boolean;
19
- };
20
- paymentConsent: {
21
- resolver: PaymentConsentResolver | null;
22
- reject: Reject | null;
23
- awaiting: boolean;
24
- };
25
- constructor(gatewayUrl: string, options?: CardElementOptions);
26
- confirm(data?: PaymentMethod): Promise<Intent>;
27
- createPaymentConsent(data: PaymentConsentRequest): Promise<PaymentConsentResponse>;
28
- success(value: Intent): void;
29
- fail(error: ElementError): void;
30
- }
31
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,38 +0,0 @@
1
- import { ElementBase } from './element';
2
- import { PaymentMethod, PaymentConsentRequest, PaymentConsentResponse } from '../types/airwallex';
3
- import { ElementError, CardNumberElementOptions } from '../types/element';
4
- import { Intent, PaymentMethodBasicInfo } from '../types/cardNumber';
5
- declare type IntentResolver = (value: Intent | PromiseLike<Intent>) => void;
6
- declare type MethodResolver = (value: PaymentMethodBasicInfo | PromiseLike<PaymentMethodBasicInfo>) => void;
7
- declare type PaymentConsentResolver = (value: PaymentConsentResponse | PromiseLike<PaymentConsentResponse>) => void;
8
- declare type Reject = (error?: ElementError) => void;
9
- export declare class CardNumberElement extends ElementBase {
10
- retrieve: {
11
- resolver: IntentResolver | null;
12
- reject: Reject | null;
13
- awaiting: boolean;
14
- };
15
- confirmIntent: {
16
- resolver: IntentResolver | null;
17
- reject: Reject | null;
18
- awaiting: boolean;
19
- };
20
- createMethod: {
21
- resolver: MethodResolver | null;
22
- reject: Reject | null;
23
- awaiting: boolean;
24
- };
25
- paymentConsent: {
26
- resolver: PaymentConsentResolver | null;
27
- reject: Reject | null;
28
- awaiting: boolean;
29
- };
30
- constructor(gatewayUrl: string, options?: CardNumberElementOptions);
31
- confirm(data?: PaymentMethod): Promise<Intent>;
32
- createPaymentMethod(data: PaymentMethod): Promise<PaymentMethodBasicInfo>;
33
- createPaymentConsent(data: PaymentConsentRequest): Promise<PaymentConsentResponse>;
34
- getPaymentIntent(id: string, client_secret: string): Promise<Intent>;
35
- success(value: Intent): void;
36
- fail(error: ElementError): void;
37
- }
38
- export {};
@@ -1 +0,0 @@
1
- export {};
package/lib/bin/cvc.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { ElementBase } from './element';
2
- import { PaymentMethod } from '../types/airwallex';
3
- import { CvcElementOptions, ElementError } from '../types/element';
4
- import { Intent } from '../types/cardNumber';
5
- declare type IntentResolver = (value: Intent | PromiseLike<Intent>) => void;
6
- declare type Reject = (error?: ElementError) => void;
7
- export declare class CvcElement extends ElementBase {
8
- confirmIntent: {
9
- resolver: IntentResolver | null;
10
- reject: Reject | null;
11
- awaiting: boolean;
12
- };
13
- constructor(gatewayUrl: string, options?: CvcElementOptions);
14
- confirm(data?: PaymentMethod): Promise<Intent>;
15
- success(value: Intent): void;
16
- fail(error: ElementError): void;
17
- }
18
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- import { ElementBase } from './element';
2
- import { ElementError } from '../types/element';
3
- import { DropInElementOptions } from '../types/dropInElement';
4
- import { Intent } from '../types/cardNumber';
5
- export declare class DropInElement extends ElementBase {
6
- constructor(gatewayUrl: string, options?: DropInElementOptions);
7
- success(value: Intent): void;
8
- fail(error: ElementError): void;
9
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,20 +0,0 @@
1
- import { Element, ElementError } from '../types/element';
2
- import { Intent } from '../types/cardNumber';
3
- export declare class ElementBase implements Element {
4
- gatewayUrl: string;
5
- options?: Element['options'];
6
- iframe: HTMLIFrameElement | null;
7
- domElement: null | HTMLElement;
8
- constructor(gatewayUrl: string, options?: Element['options']);
9
- addResizeListener(type: string): void;
10
- mount(domElement: string | HTMLElement): null | HTMLElement;
11
- blur(): void;
12
- clear(): void;
13
- destroy(): void;
14
- focus(): void;
15
- unmount(): void;
16
- update(options?: Element['options']): void;
17
- confirm(): Promise<Intent | null>;
18
- success(value: Intent): void;
19
- fail(error: ElementError): void;
20
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- import { ElementBase } from './element';
2
- import { ExpiryDateElementOptions } from '../types/element';
3
- export declare class ExpiryElement extends ElementBase {
4
- constructor(gatewayUrl: string, options?: ExpiryDateElementOptions);
5
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- import { getBrowserInfo as getBrowserInfoFn, getDeviceFingerprint as getDeviceFingerprintFn, handle3ds as handle3dsFn, get3dsReturnUrl as get3dsReturnUrlFn } from '../types/fraud';
2
- export declare const CHALLENGE_WINDOW_SIZE_MAP: {
3
- [key: string]: [string, string];
4
- };
5
- export declare const getBrowserInfo: typeof getBrowserInfoFn;
6
- export declare const getDeviceFingerprint: typeof getDeviceFingerprintFn;
7
- export declare const get3dsReturnUrl: typeof get3dsReturnUrlFn;
8
- export declare const handle3ds: typeof handle3dsFn;
@@ -1 +0,0 @@
1
- export {};
@@ -1,10 +0,0 @@
1
- import { ElementBase } from './element';
2
- import { FullFeaturedCardElementOptions } from '../types/element';
3
- import { Intent } from '../types/cardNumber';
4
- import { ElementError } from '../types/element';
5
- export declare class FullFeaturedCardElement extends ElementBase {
6
- constructor(gatewayUrl: string, options?: FullFeaturedCardElementOptions);
7
- update(options?: FullFeaturedCardElementOptions): void;
8
- success(value: Intent): void;
9
- fail(error: ElementError): void;
10
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,31 +0,0 @@
1
- import { ElementType, EventCode, ElementError, ExtendEventDetail } from '../types/element';
2
- import { NextAction } from '../types/fraud';
3
- import { Intent } from '../types/cardNumber';
4
- declare const threeDsFrictionlessType = "threeDsFrictionless";
5
- declare const threeDsChallengeType = "threeDsChallenge";
6
- declare const ThreeDsElementList: readonly ["threeDsFrictionless", "threeDsChallenge"];
7
- export declare type ExtendElementType = ElementType | typeof ThreeDsElementList[number];
8
- declare const ExtendEventList: readonly ["onResize", "onRedirect", "onComplete", "onChallenge", "onChallengeSuccess", "onChallengeError", "onIntentRetrieved", "onIntentRetrievedError", "onPaymentMethodCreated", "onPaymentMethodCreatedError"];
9
- export declare type ExtendEventCode = EventCode | typeof ExtendEventList[number];
10
- export declare const clear3Ds: (type: typeof threeDsFrictionlessType | typeof threeDsChallengeType) => void;
11
- export declare const clearThreeDsPromise: () => void;
12
- export declare const onHppSuccess: (value: ExtendEventDetail | undefined) => void;
13
- export declare const onHppError: (error?: ElementError | undefined) => void;
14
- interface ThreeDsHandlerProps {
15
- intent: Intent;
16
- gatewayUrl: string;
17
- cardBin: string;
18
- next_action: NextAction;
19
- authFormContainer?: string;
20
- componentType: ExtendElementType | 'hpp' | 'api';
21
- challengeWindowSize?: string;
22
- }
23
- export declare const threeDsHandler: ({ intent, gatewayUrl, cardBin, next_action, authFormContainer, componentType, challengeWindowSize, }: ThreeDsHandlerProps) => Promise<ExtendEventDetail>;
24
- interface Handle3dsFlowProps {
25
- type: ElementType | 'hpp';
26
- popupWidth?: number;
27
- popupHeight?: number;
28
- authFormContainer?: string;
29
- }
30
- export declare const handle3dsFlow: ({ type, popupWidth, popupHeight, authFormContainer }: Handle3dsFlowProps) => void;
31
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,24 +0,0 @@
1
- import Airwallex, { init as initFn, redirectToCheckout as redirectToCheckoutFn, createElement as createElementFn, destroyElement as destroyElementFn, getElement as getElementFn, confirmPaymentIntent as confirmPaymentIntentFn, confirmPaymentIntentWithSavedCard as confirmPaymentIntentWithSavedCardFn, createPaymentMethod as createPaymentMethodFn, getPaymentIntent as getPaymentIntentFn, createPaymentConsent as createPaymentConsentFn, AirwallexEnv } from '../../types/airwallex';
2
- export { getBrowserInfo, getDeviceFingerprint, get3dsReturnUrl, handle3ds } from '../../src/fraud';
3
- import { loadAirwallex as loadAirwallexFn } from '../../types/index';
4
- declare global {
5
- interface Window {
6
- Airwallex: Airwallex;
7
- ReactNativeWebView: {
8
- postMessage: (message: string) => void;
9
- };
10
- }
11
- }
12
- export declare const getGatewayUrl: (env: AirwallexEnv) => string;
13
- export declare const loadAirwallexJs: (gatewayUrl: string) => HTMLScriptElement;
14
- export declare const loadAirwallex: typeof loadAirwallexFn;
15
- export declare const init: typeof initFn;
16
- export declare const redirectToCheckout: typeof redirectToCheckoutFn;
17
- export declare const createElement: typeof createElementFn;
18
- export declare const destroyElement: typeof destroyElementFn;
19
- export declare const getElement: typeof getElementFn;
20
- export declare const confirmPaymentIntent: typeof confirmPaymentIntentFn;
21
- export declare const confirmPaymentIntentWithSavedCard: typeof confirmPaymentIntentWithSavedCardFn;
22
- export declare const createPaymentMethod: typeof createPaymentMethodFn;
23
- export declare const getPaymentIntent: typeof getPaymentIntentFn;
24
- export declare const createPaymentConsent: typeof createPaymentConsentFn;
@@ -1,9 +0,0 @@
1
- import { ElementBase } from './element';
2
- import { PaymentRequestButtonOptions } from '../types/element';
3
- import { ElementError } from '../types/element';
4
- import { Intent } from '../types/cardNumber';
5
- export declare class PaymentRequestButtonElement extends ElementBase {
6
- constructor(gatewayUrl: string, options?: PaymentRequestButtonOptions);
7
- success(value: Intent): void;
8
- fail(error: ElementError): void;
9
- }
@@ -1 +0,0 @@
1
- export {};