@adyen/adyen-web 6.40.0 → 6.40.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +6 -21
- package/dist/es/components/ANCV/ANCV.js +1 -1
- package/dist/es/components/ANCV/ANCV.js.map +1 -1
- package/dist/es/components/Blik/Blik.js +1 -1
- package/dist/es/components/Blik/Blik.js.map +1 -1
- package/dist/es/components/Iris/Iris.js +1 -1
- package/dist/es/components/Iris/Iris.js.map +1 -1
- package/dist/es/components/MBWay/MBWay.js +1 -1
- package/dist/es/components/MBWay/MBWay.js.map +1 -1
- package/dist/es/components/PayTo/PayTo.js +1 -1
- package/dist/es/components/PayTo/PayTo.js.map +1 -1
- package/dist/es/components/PayTo/components/BSBInput.js +1 -1
- package/dist/es/components/PayTo/components/BSBInput.js.map +1 -1
- package/dist/es/components/PayTo/components/IdentifierSelector.js +1 -1
- package/dist/es/components/PayTo/components/IdentifierSelector.js.map +1 -1
- package/dist/es/components/PayTo/components/PayIDInput.js +1 -1
- package/dist/es/components/PayTo/components/PayIDInput.js.map +1 -1
- package/dist/es/components/PayTo/components/validate.js +1 -1
- package/dist/es/components/PayTo/components/validate.js.map +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
- package/dist/es/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
- package/dist/es/components/UPI/UPI.js +1 -1
- package/dist/es/components/UPI/UPI.js.map +1 -1
- package/dist/es/components/internal/Await/Await.js +1 -1
- package/dist/es/components/internal/Await/Await.js.map +1 -1
- package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
- package/dist/es/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
- package/dist/es/components/internal/FormFields/InputBase.js +1 -1
- package/dist/es/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es/components/internal/FormFields/Select/Select.js +1 -1
- package/dist/es/components/internal/FormFields/Select/Select.js.map +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectButton.js +1 -1
- package/dist/es/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/utils/createIframe.js +1 -1
- package/dist/es/components/internal/SecuredFields/lib/securedField/utils/createIframe.js.map +1 -1
- package/dist/es/core/config.js +1 -1
- package/dist/es/index.d.ts +6 -21
- package/dist/es/language/utils.js +1 -1
- package/dist/es/language/utils.js.map +1 -1
- package/dist/es/packages/server/translations/en-US.json.js +1 -1
- package/dist/es/utils/get-process-message-handler.js +1 -1
- package/dist/es/utils/get-process-message-handler.js.map +1 -1
- package/dist/es-legacy/components/ANCV/ANCV.js +1 -1
- package/dist/es-legacy/components/ANCV/ANCV.js.map +1 -1
- package/dist/es-legacy/components/Blik/Blik.js +1 -1
- package/dist/es-legacy/components/Blik/Blik.js.map +1 -1
- package/dist/es-legacy/components/Iris/Iris.js +1 -1
- package/dist/es-legacy/components/Iris/Iris.js.map +1 -1
- package/dist/es-legacy/components/MBWay/MBWay.js +1 -1
- package/dist/es-legacy/components/MBWay/MBWay.js.map +1 -1
- package/dist/es-legacy/components/PayTo/PayTo.js +1 -1
- package/dist/es-legacy/components/PayTo/PayTo.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/BSBInput.js +1 -1
- package/dist/es-legacy/components/PayTo/components/BSBInput.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/IdentifierSelector.js +1 -1
- package/dist/es-legacy/components/PayTo/components/IdentifierSelector.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/PayIDInput.js +1 -1
- package/dist/es-legacy/components/PayTo/components/PayIDInput.js.map +1 -1
- package/dist/es-legacy/components/PayTo/components/validate.js +1 -1
- package/dist/es-legacy/components/PayTo/components/validate.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2Challenge.js.map +1 -1
- package/dist/es-legacy/components/ThreeDS2/ThreeDS2DeviceFingerprint.js.map +1 -1
- package/dist/es-legacy/components/UPI/UPI.js +1 -1
- package/dist/es-legacy/components/UPI/UPI.js.map +1 -1
- package/dist/es-legacy/components/internal/Await/Await.js +1 -1
- package/dist/es-legacy/components/internal/Await/Await.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Fieldset/Fieldset.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/InputBase.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/Select.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/Select.js.map +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js +1 -1
- package/dist/es-legacy/components/internal/FormFields/Select/components/SelectButton.js.map +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/createIframe.js +1 -1
- package/dist/es-legacy/components/internal/SecuredFields/lib/securedField/utils/createIframe.js.map +1 -1
- package/dist/es-legacy/core/config.js +1 -1
- package/dist/es-legacy/language/utils.js +1 -1
- package/dist/es-legacy/language/utils.js.map +1 -1
- package/dist/es-legacy/packages/server/translations/en-US.json.js +1 -1
- package/dist/es-legacy/utils/get-process-message-handler.js +1 -1
- package/dist/es-legacy/utils/get-process-message-handler.js.map +1 -1
- package/package.json +19 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MBWay.js","sources":["../../../../src/components/MBWay/MBWay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport MBWayInput from './components/MBWayInput';\nimport config from './components/MBWayAwait/config';\nimport { Await } from '../../components/internal/Await';\nimport { TxVariants } from '../tx-variants';\nimport { AwaitConfiguration } from '../internal/Await/types';\n\nexport class MBWayElement extends UIElement<AwaitConfiguration> {\n public static readonly type = TxVariants.mbway;\n\n formatProps(props) {\n const { data = {}, placeholders = {} } = props;\n\n return {\n ...props,\n data: {\n phoneNumber: data.telephoneNumber || data.phoneNumber,\n phonePrefix: data.phonePrefix || '+351' // if not specified default to Portuguese country code\n },\n placeholders: {\n phoneNumber: placeholders.telephoneNumber || placeholders.phoneNumber\n }\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): object {\n return {\n paymentMethod: {\n type: MBWayElement.type,\n ...(this.state.data?.phoneNumber && { telephoneNumber: this.state.data.phonePrefix + this.state.data.phoneNumber })\n }\n };\n }\n\n get isValid(): boolean {\n return !!this.state.isValid;\n }\n\n get displayName(): string {\n return this.props.name;\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.paymentData) {\n return (\n <Await\n clientKey={this.props.clientKey}\n paymentData={this.props.paymentData}\n onError={this.props.onError}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n type={config.type}\n messageText={this.props.i18n.get(config.messageTextId)}\n awaitText={this.props.i18n.get(config.awaitTextId)}\n showCountdownTimer={config.showCountdownTimer}\n delay={config.STATUS_INTERVAL}\n countdownTime={config.COUNTDOWN_MINUTES}\n throttleTime={config.THROTTLE_TIME}\n throttleInterval={config.THROTTLE_INTERVAL}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n\n return (\n <MBWayInput\n /* @ts-ignore ref handled internally by Component */\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n setComponentRef={this.setComponentRef}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n />\n );\n }\n}\n\nexport default MBWayElement;\n"],"names":["MBWayElement","UIElement","formatProps","props","data","placeholders","_object_spread_props","_object_spread","phoneNumber","telephoneNumber","phonePrefix","formatData","_this_state_data","paymentMethod","type","this","state","isValid","displayName","name","componentToRender","paymentData","h","Await","clientKey","onError","onComplete","brandLogo","icon","config","messageText","i18n","get","messageTextId","awaitText","awaitTextId","showCountdownTimer","delay","STATUS_INTERVAL","countdownTime","COUNTDOWN_MINUTES","throttleTime","THROTTLE_TIME","throttleInterval","THROTTLE_INTERVAL","onActionHandled","MBWayInput","ref","componentRef","setComponentRef","onChange","setState","onSubmit","submit","payButton","_define_property","TxVariants","mbway"],"mappings":"qnCAQO,MAAMA,UAAqBC,EAG9BC,WAAAA,CAAYC,GACR,MAAMC,KAAEA,EAAO,CAAA,EAAEC,aAAEA,EAAe,CAAA,GAAOF,EAEzC,OAAOG,EAAAC,EAAA,CAAA,EACAJ,GAAAA,CACHC,KAAM,CACFI,YAAaJ,EAAKK,iBAAmBL,EAAKI,YAC1CE,YAAaN,EAAKM,aAAe,QAErCL,aAAc,CACVG,YAAaH,EAAaI,iBAAmBJ,EAAaG,cAGtE,CAKAG,UAAAA,GAIgB,IAAAC,EAHZ,MAAO,CACHC,cAAeN,EAAA,CACXO,KAAMd,EAAac,OACA,QAAfF,EAAAG,KAAKC,MAAMZ,YAAX,IAAAQ,SAAAA,EAAiBJ,cAAe,CAAEC,gBAAiBM,KAAKC,MAAMZ,KAAKM,YAAcK,KAAKC,MAAMZ,KAAKI,cAGjH,CAEA,WAAIS,GACA,QAASF,KAAKC,MAAMC,OACxB,CAEA,eAAIC,GACA,OAAOH,KAAKZ,MAAMgB,IACtB,CAEmBC,iBAAAA,GACf,OAAIL,KAAKZ,MAAMkB,YAEPC,EAACC,EAAAA,CACGC,UAAWT,KAAKZ,MAAMqB,UACtBH,YAAaN,KAAKZ,MAAMkB,YACxBI,QAASV,KAAKZ,MAAMsB,QACpBC,WAAYX,KAAKW,WACjBC,UAAWZ,KAAKa,
|
|
1
|
+
{"version":3,"file":"MBWay.js","sources":["../../../../src/components/MBWay/MBWay.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport MBWayInput from './components/MBWayInput';\nimport config from './components/MBWayAwait/config';\nimport { Await } from '../../components/internal/Await';\nimport { TxVariants } from '../tx-variants';\nimport { AwaitConfiguration } from '../internal/Await/types';\n\nexport class MBWayElement extends UIElement<AwaitConfiguration> {\n public static readonly type = TxVariants.mbway;\n\n formatProps(props) {\n const { data = {}, placeholders = {} } = props;\n\n return {\n ...props,\n data: {\n phoneNumber: data.telephoneNumber || data.phoneNumber,\n phonePrefix: data.phonePrefix || '+351' // if not specified default to Portuguese country code\n },\n placeholders: {\n phoneNumber: placeholders.telephoneNumber || placeholders.phoneNumber\n }\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData(): object {\n return {\n paymentMethod: {\n type: MBWayElement.type,\n ...(this.state.data?.phoneNumber && { telephoneNumber: this.state.data.phonePrefix + this.state.data.phoneNumber })\n }\n };\n }\n\n get isValid(): boolean {\n return !!this.state.isValid;\n }\n\n get displayName(): string {\n return this.props.name;\n }\n\n protected override componentToRender(): h.JSX.Element {\n if (this.props.paymentData) {\n return (\n <Await\n clientKey={this.props.clientKey}\n paymentData={this.props.paymentData}\n onError={this.props.onError}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n brandName={this.displayName}\n type={config.type}\n messageText={this.props.i18n.get(config.messageTextId)}\n awaitText={this.props.i18n.get(config.awaitTextId)}\n showCountdownTimer={config.showCountdownTimer}\n delay={config.STATUS_INTERVAL}\n countdownTime={config.COUNTDOWN_MINUTES}\n throttleTime={config.THROTTLE_TIME}\n throttleInterval={config.THROTTLE_INTERVAL}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n\n return (\n <MBWayInput\n /* @ts-ignore ref handled internally by Component */\n ref={ref => {\n this.componentRef = ref;\n }}\n {...this.props}\n setComponentRef={this.setComponentRef}\n onChange={this.setState}\n onSubmit={this.submit}\n payButton={this.payButton}\n />\n );\n }\n}\n\nexport default MBWayElement;\n"],"names":["MBWayElement","UIElement","formatProps","props","data","placeholders","_object_spread_props","_object_spread","phoneNumber","telephoneNumber","phonePrefix","formatData","_this_state_data","paymentMethod","type","this","state","isValid","displayName","name","componentToRender","paymentData","h","Await","clientKey","onError","onComplete","brandLogo","icon","brandName","config","messageText","i18n","get","messageTextId","awaitText","awaitTextId","showCountdownTimer","delay","STATUS_INTERVAL","countdownTime","COUNTDOWN_MINUTES","throttleTime","THROTTLE_TIME","throttleInterval","THROTTLE_INTERVAL","onActionHandled","MBWayInput","ref","componentRef","setComponentRef","onChange","setState","onSubmit","submit","payButton","_define_property","TxVariants","mbway"],"mappings":"qnCAQO,MAAMA,UAAqBC,EAG9BC,WAAAA,CAAYC,GACR,MAAMC,KAAEA,EAAO,CAAA,EAAEC,aAAEA,EAAe,CAAA,GAAOF,EAEzC,OAAOG,EAAAC,EAAA,CAAA,EACAJ,GAAAA,CACHC,KAAM,CACFI,YAAaJ,EAAKK,iBAAmBL,EAAKI,YAC1CE,YAAaN,EAAKM,aAAe,QAErCL,aAAc,CACVG,YAAaH,EAAaI,iBAAmBJ,EAAaG,cAGtE,CAKAG,UAAAA,GAIgB,IAAAC,EAHZ,MAAO,CACHC,cAAeN,EAAA,CACXO,KAAMd,EAAac,OACA,QAAfF,EAAAG,KAAKC,MAAMZ,YAAX,IAAAQ,SAAAA,EAAiBJ,cAAe,CAAEC,gBAAiBM,KAAKC,MAAMZ,KAAKM,YAAcK,KAAKC,MAAMZ,KAAKI,cAGjH,CAEA,WAAIS,GACA,QAASF,KAAKC,MAAMC,OACxB,CAEA,eAAIC,GACA,OAAOH,KAAKZ,MAAMgB,IACtB,CAEmBC,iBAAAA,GACf,OAAIL,KAAKZ,MAAMkB,YAEPC,EAACC,EAAAA,CACGC,UAAWT,KAAKZ,MAAMqB,UACtBH,YAAaN,KAAKZ,MAAMkB,YACxBI,QAASV,KAAKZ,MAAMsB,QACpBC,WAAYX,KAAKW,WACjBC,UAAWZ,KAAKa,KAChBC,UAAWd,KAAKG,YAChBJ,KAAMgB,EAAOhB,KACbiB,YAAahB,KAAKZ,MAAM6B,KAAKC,IAAIH,EAAOI,eACxCC,UAAWpB,KAAKZ,MAAM6B,KAAKC,IAAIH,EAAOM,aACtCC,mBAAoBP,EAAOO,mBAC3BC,MAAOR,EAAOS,gBACdC,cAAeV,EAAOW,kBACtBC,aAAcZ,EAAOa,cACrBC,iBAAkBd,EAAOe,kBACzBC,gBAAiB/B,KAAK+B,kBAM9BxB,EAACyB,EAAAA,EAAAA,EAAAA,CAEGC,IAAKA,IACDjC,KAAKkC,aAAeD,IAEpBjC,KAAKZ,OAAK,CACd+C,gBAAiBnC,KAAKmC,gBACtBC,SAAUpC,KAAKqC,SACfC,SAAUtC,KAAKuC,OACfC,UAAWxC,KAAKwC,YAG5B,EAzEAC,EADSxD,EACcc,OAAO2C,EAAWC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as t,Fragment as e}from"../../external/preact/dist/preact.js";import{UIElement as o}from"../internal/UIElement/UIElement.js";import{Await as r}from"../internal/Await/Await.js";import{TxVariants as n}from"../tx-variants.js";import{PayToIdentifierEnum as s}from"./components/IdentifierSelector.js";import a from"./components/PayToComponent.js";import{PayToInstructions as p}from"./components/PayToInstructions.js";import i from"./components/MandateSummary.js";import m from"../internal/PayButton/PayButton.js";import{payAmountLabel as c}from"../internal/PayButton/utils.js";function
|
|
1
|
+
import{createElement as t,Fragment as e}from"../../external/preact/dist/preact.js";import{UIElement as o}from"../internal/UIElement/UIElement.js";import{Await as r}from"../internal/Await/Await.js";import{TxVariants as n}from"../tx-variants.js";import{PayToIdentifierEnum as s}from"./components/IdentifierSelector.js";import a from"./components/PayToComponent.js";import{PayToInstructions as p}from"./components/PayToInstructions.js";import i from"./components/MandateSummary.js";import m from"../internal/PayButton/PayButton.js";import{payAmountLabel as c}from"../internal/PayButton/utils.js";function d(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function h(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},r=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),r.forEach(function(e){d(t,e,o[e])})}return t}function l(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}),t}const y=6e4,u=1e4,f=!1,b=t=>{if("bsb-option"===t.selectedInput)return`${t.bsb}-${t.bankAccountNumber}`;if("payid-option"===t.selectedInput)switch(t.selectedIdentifier){case s.email:return t.email;case s.abn:return t.abn;case s.orgid:return t.orgid;case s.phone:return`${t.phonePrefix}-${t.phoneNumber}`}};class P extends o{formatProps(t){return l(h({},t),{data:l(h({},t.data),{phonePrefix:"+61"})})}formatData(){return this.props.storedPaymentMethodId?{paymentMethod:{type:P.type,storedPaymentMethodId:this.props.storedPaymentMethodId}}:{paymentMethod:{type:P.type,shopperAccountIdentifier:b(this.state.data)},shopperName:{firstName:this.state.data.firstName,lastName:this.state.data.lastName}}}get isValid(){return!!this.props.storedPaymentMethodId||!!this.state.isValid}get displayName(){return this.props.storedPaymentMethodId&&this.props.label?this.props.label:this.props.name}get additionalInfo(){return this.props.storedPaymentMethodId?this.props.name:""}componentToRender(){return this.props.storedPaymentMethodId?t(e,null,this.props.showPayButton&&t(m,l(h({},this.props),{classNameModifiers:["standalone"],label:c(this.props.i18n,this.props.amount),onClick:this.submit}))):this.props.paymentData?t(r,{showAmount:!0,instructions:p,clientKey:this.props.clientKey,paymentData:this.props.paymentData,onError:this.props.onError,onComplete:this.onComplete,brandLogo:this.icon,brandName:this.displayName,type:this.constructor.type,messageText:this.props.i18n.get("payto.confirmPayment"),awaitText:this.props.i18n.get("payto.await.waitForConfirmation"),showCountdownTimer:f,throttleTime:y,throttleInterval:u,onActionHandled:this.onActionHandled,endSlot:()=>!!this.props.mandate&&t(i,{mandate:this.props.mandate,payee:this.props.payee,currencyCode:this.props.amount.currency})}):t(a,{data:this.props.data,placeholders:this.props.placeholders,setComponentRef:this.setComponentRef,onChange:this.setState,payButton:this.payButton,showPayButton:this.props.showPayButton})}}d(P,"type",n.payto),d(P,"defaultProps",{placeholders:{}});export{P as PayToElement,P as default};
|
|
2
2
|
//# sourceMappingURL=PayTo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayTo.js","sources":["../../../../src/components/PayTo/PayTo.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { Await } from '../../components/internal/Await';\nimport { TxVariants } from '../tx-variants';\nimport { PayToIdentifierEnum } from './components/IdentifierSelector';\nimport PayToComponent from './components/PayToComponent';\nimport { PayToInstructions } from './components/PayToInstructions';\nimport MandateSummary from './components/MandateSummary';\nimport { PayToConfiguration, PayToData } from './types';\nimport PayButton from '../internal/PayButton';\nimport { payAmountLabel } from '../internal/PayButton/utils';\n\n/*\nAwait Config (previously in its own file)\n */\nconst COUNTDOWN_MINUTES = 15; // min\nconst THROTTLE_TIME = 60000; // ms\nconst THROTTLE_INTERVAL = 10000; // ms\n\nconst config = {\n COUNTDOWN_MINUTES,\n THROTTLE_TIME,\n THROTTLE_INTERVAL,\n showCountdownTimer: false\n};\n\nconst getAccountIdentifier = (state: PayToData) => {\n // if it's BSB Input type merge bankAccount with BSB\n if (state.selectedInput === 'bsb-option') {\n return `${state.bsb}-${state.bankAccountNumber}`;\n } else if (state.selectedInput === 'payid-option') {\n // otherwise use the option in the dropdown\n switch (state.selectedIdentifier) {\n case PayToIdentifierEnum.email:\n return state.email;\n case PayToIdentifierEnum.abn:\n return state.abn;\n case PayToIdentifierEnum.orgid:\n return state.orgid;\n case PayToIdentifierEnum.phone:\n // merge the phone prefix and number - see comment in ticket\n return `${state.phonePrefix}-${state.phoneNumber}`;\n }\n }\n};\n/**\n *\n */\nexport class PayToElement extends UIElement<PayToConfiguration> {\n public static readonly type = TxVariants.payto;\n\n protected static readonly defaultProps = {\n placeholders: {}\n };\n\n formatProps(props: PayToConfiguration) {\n return {\n ...props,\n data: {\n ...props.data,\n phonePrefix: '+61' // hardcode +61\n }\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n if (this.props.storedPaymentMethodId) {\n return {\n paymentMethod: {\n type: PayToElement.type,\n storedPaymentMethodId: this.props.storedPaymentMethodId\n }\n };\n }\n\n return {\n paymentMethod: {\n type: PayToElement.type,\n shopperAccountIdentifier: getAccountIdentifier(this.state.data)\n },\n shopperName: {\n firstName: this.state.data.firstName,\n lastName: this.state.data.lastName\n }\n };\n }\n\n get isValid(): boolean {\n if (this.props.storedPaymentMethodId) {\n return true;\n }\n\n return !!this.state.isValid;\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.label) {\n return this.props.label;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? this.props.name : '';\n }\n\n protected override componentToRender(): h.JSX.Element {\n // Stored\n if (this.props.storedPaymentMethodId) {\n return (\n <Fragment>\n {this.props.showPayButton && (\n <PayButton\n {...this.props}\n classNameModifiers={['standalone']}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n onClick={this.submit}\n />\n )}\n </Fragment>\n );\n }\n // Await\n if (this.props.paymentData) {\n return (\n <Await\n showAmount={true}\n instructions={PayToInstructions}\n clientKey={this.props.clientKey}\n paymentData={this.props.paymentData}\n onError={this.props.onError}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n type={this.constructor['type']}\n messageText={this.props.i18n.get('payto.confirmPayment')}\n awaitText={this.props.i18n.get('payto.await.waitForConfirmation')}\n showCountdownTimer={config.showCountdownTimer}\n throttleTime={config.THROTTLE_TIME}\n throttleInterval={config.THROTTLE_INTERVAL}\n onActionHandled={this.onActionHandled}\n endSlot={() =>\n !!this.props.mandate && (\n <MandateSummary mandate={this.props.mandate} payee={this.props.payee} currencyCode={this.props.amount.currency} />\n )\n }\n />\n );\n }\n // Input\n return (\n <PayToComponent\n data={this.props.data}\n placeholders={this.props.placeholders}\n setComponentRef={this.setComponentRef}\n onChange={this.setState}\n payButton={this.payButton}\n showPayButton={this.props.showPayButton}\n />\n );\n }\n}\n\nexport default PayToElement;\n"],"names":["config","getAccountIdentifier","state","selectedInput","bsb","bankAccountNumber","selectedIdentifier","PayToIdentifierEnum","email","abn","orgid","phone","phonePrefix","phoneNumber","PayToElement","UIElement","formatProps","props","_object_spread_props","_object_spread","data","formatData","this","storedPaymentMethodId","paymentMethod","type","shopperAccountIdentifier","shopperName","firstName","lastName","isValid","displayName","label","name","additionalInfo","componentToRender","h","Fragment","showPayButton","PayButton","classNameModifiers","payAmountLabel","i18n","amount","onClick","submit","paymentData","Await","showAmount","instructions","PayToInstructions","clientKey","onError","onComplete","brandLogo","icon","constructor","messageText","get","awaitText","showCountdownTimer","throttleTime","throttleInterval","onActionHandled","endSlot","mandate","MandateSummary","payee","currencyCode","currency","PayToComponent","placeholders","setComponentRef","onChange","setState","payButton","_define_property","TxVariants","payto","defaultProps"],"mappings":"03CAgBA,MAGMA,EAHgB,IAGhBA,EAFoB,IAEpBA,GAIkB,EAGlBC,EAAwBC,IAE1B,GAA4B,eAAxBA,EAAMC,cACN,MAAO,GAAGD,EAAME,OAAOF,EAAMG,oBAC1B,GAA4B,iBAAxBH,EAAMC,cAEb,OAAQD,EAAMI,oBACV,KAAKC,EAAoBC,MACrB,OAAON,EAAMM,MACjB,KAAKD,EAAoBE,IACrB,OAAOP,EAAMO,IACjB,KAAKF,EAAoBG,MACrB,OAAOR,EAAMQ,MACjB,KAAKH,EAAoBI,MAErB,MAAO,GAAGT,EAAMU,eAAeV,EAAMW,gBAO9C,MAAMC,UAAqBC,EAO9BC,WAAAA,CAAYC,GACR,OAAOC,EAAAC,EAAA,CAAA,EACAF,GAAAA,CACHG,KAAMF,EAAAC,EAAA,CAAA,EACCF,EAAMG,MAAI,CACbR,YAAa,SAGzB,CAKAS,UAAAA,GACI,OAAIC,KAAKL,MAAMM,sBACJ,CACHC,cAAe,CACXC,KAAMX,EAAaW,KACnBF,sBAAuBD,KAAKL,MAAMM,wBAKvC,CACHC,cAAe,CACXC,KAAMX,EAAaW,KACnBC,yBAA0BzB,EAAqBqB,KAAKpB,MAAMkB,OAE9DO,YAAa,CACTC,UAAWN,KAAKpB,MAAMkB,KAAKQ,UAC3BC,SAAUP,KAAKpB,MAAMkB,KAAKS,UAGtC,CAEA,WAAIC,GACA,QAAIR,KAAKL,MAAMM,yBAIND,KAAKpB,MAAM4B,OACxB,CAEA,eAAIC,GACA,OAAIT,KAAKL,MAAMM,uBAAyBD,KAAKL,MAAMe,MACxCV,KAAKL,MAAMe,MAEfV,KAAKL,MAAMgB,IACtB,CAEA,kBAAIC,GACA,OAAOZ,KAAKL,MAAMM,sBAAwBD,KAAKL,MAAMgB,KAAO,EAChE,CAEmBE,iBAAAA,GAEf,OAAIb,KAAKL,MAAMM,sBAEPa,EAACC,EAAAA,KACIf,KAAKL,MAAMqB,eACRF,EAACG,EAAAA,EAAAA,EAAAA,CAAAA,EACOjB,KAAKL,OAAK,CACduB,mBAAoB,CAAC,cACrBR,MAAOS,EAAenB,KAAKL,MAAMyB,KAAMpB,KAAKL,MAAM0B,QAClDC,QAAStB,KAAKuB,WAO9BvB,KAAKL,MAAM6B,YAEPV,EAACW,EAAAA,CACGC,YAAY,EACZC,aAAcC,EACdC,UAAW7B,KAAKL,MAAMkC,UACtBL,YAAaxB,KAAKL,MAAM6B,YACxBM,QAAS9B,KAAKL,MAAMmC,QACpBC,WAAY/B,KAAK+B,WACjBC,UAAWhC,KAAKiC,
|
|
1
|
+
{"version":3,"file":"PayTo.js","sources":["../../../../src/components/PayTo/PayTo.tsx"],"sourcesContent":["import { Fragment, h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport { Await } from '../../components/internal/Await';\nimport { TxVariants } from '../tx-variants';\nimport { PayToIdentifierEnum } from './components/IdentifierSelector';\nimport PayToComponent from './components/PayToComponent';\nimport { PayToInstructions } from './components/PayToInstructions';\nimport MandateSummary from './components/MandateSummary';\nimport { PayToConfiguration, PayToData } from './types';\nimport PayButton from '../internal/PayButton';\nimport { payAmountLabel } from '../internal/PayButton/utils';\n\n/*\nAwait Config (previously in its own file)\n */\nconst COUNTDOWN_MINUTES = 15; // min\nconst THROTTLE_TIME = 60000; // ms\nconst THROTTLE_INTERVAL = 10000; // ms\n\nconst config = {\n COUNTDOWN_MINUTES,\n THROTTLE_TIME,\n THROTTLE_INTERVAL,\n showCountdownTimer: false\n};\n\nconst getAccountIdentifier = (state: PayToData) => {\n // if it's BSB Input type merge bankAccount with BSB\n if (state.selectedInput === 'bsb-option') {\n return `${state.bsb}-${state.bankAccountNumber}`;\n } else if (state.selectedInput === 'payid-option') {\n // otherwise use the option in the dropdown\n switch (state.selectedIdentifier) {\n case PayToIdentifierEnum.email:\n return state.email;\n case PayToIdentifierEnum.abn:\n return state.abn;\n case PayToIdentifierEnum.orgid:\n return state.orgid;\n case PayToIdentifierEnum.phone:\n // merge the phone prefix and number - see comment in ticket\n return `${state.phonePrefix}-${state.phoneNumber}`;\n }\n }\n};\n/**\n *\n */\nexport class PayToElement extends UIElement<PayToConfiguration> {\n public static readonly type = TxVariants.payto;\n\n protected static readonly defaultProps = {\n placeholders: {}\n };\n\n formatProps(props: PayToConfiguration) {\n return {\n ...props,\n data: {\n ...props.data,\n phonePrefix: '+61' // hardcode +61\n }\n };\n }\n\n /**\n * Formats the component data output\n */\n formatData() {\n if (this.props.storedPaymentMethodId) {\n return {\n paymentMethod: {\n type: PayToElement.type,\n storedPaymentMethodId: this.props.storedPaymentMethodId\n }\n };\n }\n\n return {\n paymentMethod: {\n type: PayToElement.type,\n shopperAccountIdentifier: getAccountIdentifier(this.state.data)\n },\n shopperName: {\n firstName: this.state.data.firstName,\n lastName: this.state.data.lastName\n }\n };\n }\n\n get isValid(): boolean {\n if (this.props.storedPaymentMethodId) {\n return true;\n }\n\n return !!this.state.isValid;\n }\n\n get displayName() {\n if (this.props.storedPaymentMethodId && this.props.label) {\n return this.props.label;\n }\n return this.props.name;\n }\n\n get additionalInfo() {\n return this.props.storedPaymentMethodId ? this.props.name : '';\n }\n\n protected override componentToRender(): h.JSX.Element {\n // Stored\n if (this.props.storedPaymentMethodId) {\n return (\n <Fragment>\n {this.props.showPayButton && (\n <PayButton\n {...this.props}\n classNameModifiers={['standalone']}\n label={payAmountLabel(this.props.i18n, this.props.amount)}\n onClick={this.submit}\n />\n )}\n </Fragment>\n );\n }\n // Await\n if (this.props.paymentData) {\n return (\n <Await\n showAmount={true}\n instructions={PayToInstructions}\n clientKey={this.props.clientKey}\n paymentData={this.props.paymentData}\n onError={this.props.onError}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n brandName={this.displayName}\n type={this.constructor['type']}\n messageText={this.props.i18n.get('payto.confirmPayment')}\n awaitText={this.props.i18n.get('payto.await.waitForConfirmation')}\n showCountdownTimer={config.showCountdownTimer}\n throttleTime={config.THROTTLE_TIME}\n throttleInterval={config.THROTTLE_INTERVAL}\n onActionHandled={this.onActionHandled}\n endSlot={() =>\n !!this.props.mandate && (\n <MandateSummary mandate={this.props.mandate} payee={this.props.payee} currencyCode={this.props.amount.currency} />\n )\n }\n />\n );\n }\n // Input\n return (\n <PayToComponent\n data={this.props.data}\n placeholders={this.props.placeholders}\n setComponentRef={this.setComponentRef}\n onChange={this.setState}\n payButton={this.payButton}\n showPayButton={this.props.showPayButton}\n />\n );\n }\n}\n\nexport default PayToElement;\n"],"names":["config","getAccountIdentifier","state","selectedInput","bsb","bankAccountNumber","selectedIdentifier","PayToIdentifierEnum","email","abn","orgid","phone","phonePrefix","phoneNumber","PayToElement","UIElement","formatProps","props","_object_spread_props","_object_spread","data","formatData","this","storedPaymentMethodId","paymentMethod","type","shopperAccountIdentifier","shopperName","firstName","lastName","isValid","displayName","label","name","additionalInfo","componentToRender","h","Fragment","showPayButton","PayButton","classNameModifiers","payAmountLabel","i18n","amount","onClick","submit","paymentData","Await","showAmount","instructions","PayToInstructions","clientKey","onError","onComplete","brandLogo","icon","brandName","constructor","messageText","get","awaitText","showCountdownTimer","throttleTime","throttleInterval","onActionHandled","endSlot","mandate","MandateSummary","payee","currencyCode","currency","PayToComponent","placeholders","setComponentRef","onChange","setState","payButton","_define_property","TxVariants","payto","defaultProps"],"mappings":"03CAgBA,MAGMA,EAHgB,IAGhBA,EAFoB,IAEpBA,GAIkB,EAGlBC,EAAwBC,IAE1B,GAA4B,eAAxBA,EAAMC,cACN,MAAO,GAAGD,EAAME,OAAOF,EAAMG,oBAC1B,GAA4B,iBAAxBH,EAAMC,cAEb,OAAQD,EAAMI,oBACV,KAAKC,EAAoBC,MACrB,OAAON,EAAMM,MACjB,KAAKD,EAAoBE,IACrB,OAAOP,EAAMO,IACjB,KAAKF,EAAoBG,MACrB,OAAOR,EAAMQ,MACjB,KAAKH,EAAoBI,MAErB,MAAO,GAAGT,EAAMU,eAAeV,EAAMW,gBAO9C,MAAMC,UAAqBC,EAO9BC,WAAAA,CAAYC,GACR,OAAOC,EAAAC,EAAA,CAAA,EACAF,GAAAA,CACHG,KAAMF,EAAAC,EAAA,CAAA,EACCF,EAAMG,MAAI,CACbR,YAAa,SAGzB,CAKAS,UAAAA,GACI,OAAIC,KAAKL,MAAMM,sBACJ,CACHC,cAAe,CACXC,KAAMX,EAAaW,KACnBF,sBAAuBD,KAAKL,MAAMM,wBAKvC,CACHC,cAAe,CACXC,KAAMX,EAAaW,KACnBC,yBAA0BzB,EAAqBqB,KAAKpB,MAAMkB,OAE9DO,YAAa,CACTC,UAAWN,KAAKpB,MAAMkB,KAAKQ,UAC3BC,SAAUP,KAAKpB,MAAMkB,KAAKS,UAGtC,CAEA,WAAIC,GACA,QAAIR,KAAKL,MAAMM,yBAIND,KAAKpB,MAAM4B,OACxB,CAEA,eAAIC,GACA,OAAIT,KAAKL,MAAMM,uBAAyBD,KAAKL,MAAMe,MACxCV,KAAKL,MAAMe,MAEfV,KAAKL,MAAMgB,IACtB,CAEA,kBAAIC,GACA,OAAOZ,KAAKL,MAAMM,sBAAwBD,KAAKL,MAAMgB,KAAO,EAChE,CAEmBE,iBAAAA,GAEf,OAAIb,KAAKL,MAAMM,sBAEPa,EAACC,EAAAA,KACIf,KAAKL,MAAMqB,eACRF,EAACG,EAAAA,EAAAA,EAAAA,CAAAA,EACOjB,KAAKL,OAAK,CACduB,mBAAoB,CAAC,cACrBR,MAAOS,EAAenB,KAAKL,MAAMyB,KAAMpB,KAAKL,MAAM0B,QAClDC,QAAStB,KAAKuB,WAO9BvB,KAAKL,MAAM6B,YAEPV,EAACW,EAAAA,CACGC,YAAY,EACZC,aAAcC,EACdC,UAAW7B,KAAKL,MAAMkC,UACtBL,YAAaxB,KAAKL,MAAM6B,YACxBM,QAAS9B,KAAKL,MAAMmC,QACpBC,WAAY/B,KAAK+B,WACjBC,UAAWhC,KAAKiC,KAChBC,UAAWlC,KAAKS,YAChBN,KAAMH,KAAKmC,YAAY,KACvBC,YAAapC,KAAKL,MAAMyB,KAAKiB,IAAI,wBACjCC,UAAWtC,KAAKL,MAAMyB,KAAKiB,IAAI,mCAC/BE,mBAAoB7D,EACpB8D,aAAc9D,EACd+D,iBAAkB/D,EAClBgE,gBAAiB1C,KAAK0C,gBACtBC,QAAS,MACH3C,KAAKL,MAAMiD,SACT9B,EAAC+B,EAAAA,CAAeD,QAAS5C,KAAKL,MAAMiD,QAASE,MAAO9C,KAAKL,MAAMmD,MAAOC,aAAc/C,KAAKL,MAAM0B,OAAO2B,aAQtHlC,EAACmC,EAAAA,CACGnD,KAAME,KAAKL,MAAMG,KACjBoD,aAAclD,KAAKL,MAAMuD,aACzBC,gBAAiBnD,KAAKmD,gBACtBC,SAAUpD,KAAKqD,SACfC,UAAWtD,KAAKsD,UAChBtC,cAAehB,KAAKL,MAAMqB,eAGtC,EAlHAuC,EADS/D,EACcW,OAAOqD,EAAWC,OAEzCF,EAHS/D,EAGiBkE,eAAe,CACrCR,aAAc,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import r from"../../internal/FormFields/Fieldset/Fieldset.js";import{
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import r from"../../internal/FormFields/Fieldset/Fieldset.js";import{useMemo as t,useEffect as a,useRef as o}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as s}from"../../../core/Context/CoreProvider.js";import i from"../../../utils/useForm/useFormWithA11y.js";import"../../internal/SecuredFields/lib/CSF/utils/userAgent.js";import{getErrorMessage as n}from"../../../utils/getErrorMessage.js";import l from"../../internal/FormFields/Field/Field.js";import u from"../../internal/FormFields/InputText.js";import{bsbValidationRules as m}from"./validate.js";import{phoneFormatters as b}from"../../internal/PhoneInput/validate.js";import c from"./PayToNameFields.js";import{getUniqueId as d}from"../../../utils/idGenerator.js";const p=["bankAccountNumber","bsb","firstName","lastName"];function f({setComponentRef:f,defaultData:h,placeholders:F,onChange:N,setStatus:k,id:g}){const{i18n:j}=s(),v=t(()=>d("payid-instruction"),[]),A=i({schema:p,defaultData:h,rules:m,formatters:b,formHolder:`#${g}`}),{handleChangeFor:y,triggerValidation:B,data:C,errors:M,valid:S,isValid:x}=A;a(()=>{N({data:C,valid:S,errors:M,isValid:x})},[C,S,M,x]);const I=o({setStatus:k,showValidation:B});return a(()=>{f(I.current)},[f]),e(r,{id:g,classNameModifiers:["payto__bsb_input"],label:"BSB",description:"payto.bsb.description",descriptionId:v},e(l,{label:j.get("payto.bsb.label.bankAccountNumber"),classNameModifiers:["col-60","bankAccountNumber"],errorMessage:n(j,M.bankAccountNumber,j.get("payto.bsb.label.bankAccountNumber")),name:"bankAccountNumber",i18n:j,errorLive:!0},e(u,{name:"bankAccountNumber",value:C.bankAccountNumber,onInput:y("bankAccountNumber","input"),onBlur:y("bankAccountNumber","blur"),placeholder:null==F?void 0:F.bankAccountNumber,"aria-describedby":v,required:!0,autocomplete:void 0})),e(l,{label:j.get("Bank State Branch"),classNameModifiers:["col-40","bsb"],errorMessage:n(j,M.bsb,j.get("Bank State Branch")),name:"bsb",i18n:j,errorLive:!0},e(u,{name:"bsb",value:C.bsb,onInput:y("bsb","input"),onBlur:y("bsb","blur"),placeholder:null==F?void 0:F.bsb,required:!0,autocomplete:void 0})),e(c,{i18n:j,data:C,handleChangeFor:y,errors:M,placeholders:F}))}export{f as default};
|
|
2
2
|
//# sourceMappingURL=BSBInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BSBInput.js","sources":["../../../../../src/components/PayTo/components/BSBInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport { useEffect, useRef } from 'preact/hooks';\nimport { useFormWithA11y } from '../../../utils/useForm';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport Field from '../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport InputText from '../../internal/FormFields/InputText';\nimport { bsbValidationRules } from './validate';\nimport './PayIDInput.scss';\nimport { phoneFormatters } from '../../internal/PhoneInput/validate';\nimport { ComponentMethodsRef, UIElementStatus } from '../../internal/UIElement/types';\nimport PayToNameFields from './PayToNameFields';\nimport { PayToPlaceholdersType } from '../types';\n\nexport interface BSBFormData {\n bsb: string;\n bankAccountNumber: string;\n firstName: string;\n lastName: string;\n}\n\nexport interface BSBInputProps {\n status: UIElementStatus;\n setStatus: (status: UIElementStatus) => void;\n defaultData: BSBFormData;\n placeholders: PayToPlaceholdersType;\n onChange: (e) => void;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n id?: string;\n}\n\nconst BASE_SCHEMA = ['bankAccountNumber', 'bsb', 'firstName', 'lastName'];\n\nexport default function BSBInput({ setComponentRef, defaultData, placeholders, onChange, setStatus, id }: Readonly<BSBInputProps>) {\n const { i18n } = useCoreContext();\n\n const form = useFormWithA11y<BSBFormData>({\n schema: BASE_SCHEMA,\n defaultData: defaultData,\n rules: bsbValidationRules,\n formatters: phoneFormatters,\n formHolder: `#${id}`\n });\n const { handleChangeFor, triggerValidation, data, errors, valid, isValid } = form;\n\n // standard onChange propagate to parent state\n useEffect(() => {\n onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n const payToRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: triggerValidation\n });\n\n useEffect(() => {\n setComponentRef(payToRef.current);\n }, [setComponentRef]);\n\n return (\n <Fieldset id={id} classNameModifiers={['payto__bsb_input']} label={'BSB'} description={'payto.bsb.description'}>\n <Field\n label={i18n.get('payto.bsb.label.bankAccountNumber')}\n classNameModifiers={['col-60', 'bankAccountNumber']}\n errorMessage={getErrorMessage(i18n, errors.bankAccountNumber, i18n.get('payto.bsb.label.bankAccountNumber'))}\n name={'bankAccountNumber'}\n i18n={i18n}\n errorLive={true}\n >\n <InputText\n name={'bankAccountNumber'}\n value={data.bankAccountNumber}\n onInput={handleChangeFor('bankAccountNumber', 'input')}\n onBlur={handleChangeFor('bankAccountNumber', 'blur')}\n placeholder={placeholders?.bankAccountNumber}\n required={true}\n autocomplete={undefined}\n />\n </Field>\n\n <Field\n label={i18n.get('Bank State Branch')}\n classNameModifiers={['col-40', 'bsb']}\n errorMessage={getErrorMessage(i18n, errors.bsb, i18n.get('Bank State Branch'))}\n name={'bsb'}\n i18n={i18n}\n errorLive={true}\n >\n <InputText\n name={'bsb'}\n value={data.bsb}\n onInput={handleChangeFor('bsb', 'input')}\n onBlur={handleChangeFor('bsb', 'blur')}\n placeholder={placeholders?.bsb}\n required={true}\n autocomplete={undefined}\n />\n </Field>\n\n <PayToNameFields i18n={i18n} data={data} handleChangeFor={handleChangeFor} errors={errors} placeholders={placeholders} />\n </Fieldset>\n );\n}\n"],"names":["BASE_SCHEMA","BSBInput","setComponentRef","defaultData","placeholders","onChange","setStatus","id","i18n","useCoreContext","form","useFormWithA11y","schema","rules","bsbValidationRules","formatters","phoneFormatters","formHolder","handleChangeFor","triggerValidation","data","errors","valid","isValid","useEffect","payToRef","useRef","showValidation","current","h","Fieldset","classNameModifiers","label","description","Field","get","errorMessage","getErrorMessage","bankAccountNumber","name","errorLive","InputText","value","onInput","onBlur","placeholder","required","autocomplete","undefined","bsb","PayToNameFields"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BSBInput.js","sources":["../../../../../src/components/PayTo/components/BSBInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport { useEffect, useMemo, useRef } from 'preact/hooks';\nimport { useFormWithA11y } from '../../../utils/useForm';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport Field from '../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport InputText from '../../internal/FormFields/InputText';\nimport { bsbValidationRules } from './validate';\nimport './PayIDInput.scss';\nimport { phoneFormatters } from '../../internal/PhoneInput/validate';\nimport { ComponentMethodsRef, UIElementStatus } from '../../internal/UIElement/types';\nimport PayToNameFields from './PayToNameFields';\nimport { PayToPlaceholdersType } from '../types';\nimport { getUniqueId } from '../../../utils/idGenerator';\n\nexport interface BSBFormData {\n bsb: string;\n bankAccountNumber: string;\n firstName: string;\n lastName: string;\n}\n\nexport interface BSBInputProps {\n status: UIElementStatus;\n setStatus: (status: UIElementStatus) => void;\n defaultData: BSBFormData;\n placeholders: PayToPlaceholdersType;\n onChange: (e) => void;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n id?: string;\n}\n\nconst BASE_SCHEMA = ['bankAccountNumber', 'bsb', 'firstName', 'lastName'];\n\nexport default function BSBInput({ setComponentRef, defaultData, placeholders, onChange, setStatus, id }: Readonly<BSBInputProps>) {\n const { i18n } = useCoreContext();\n\n const descriptionId = useMemo(() => getUniqueId('payid-instruction'), []);\n\n const form = useFormWithA11y<BSBFormData>({\n schema: BASE_SCHEMA,\n defaultData: defaultData,\n rules: bsbValidationRules,\n formatters: phoneFormatters,\n formHolder: `#${id}`\n });\n const { handleChangeFor, triggerValidation, data, errors, valid, isValid } = form;\n\n // standard onChange propagate to parent state\n useEffect(() => {\n onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n const payToRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: triggerValidation\n });\n\n useEffect(() => {\n setComponentRef(payToRef.current);\n }, [setComponentRef]);\n\n return (\n <Fieldset id={id} classNameModifiers={['payto__bsb_input']} label={'BSB'} description={'payto.bsb.description'} descriptionId={descriptionId}>\n <Field\n label={i18n.get('payto.bsb.label.bankAccountNumber')}\n classNameModifiers={['col-60', 'bankAccountNumber']}\n errorMessage={getErrorMessage(i18n, errors.bankAccountNumber, i18n.get('payto.bsb.label.bankAccountNumber'))}\n name={'bankAccountNumber'}\n i18n={i18n}\n errorLive={true}\n >\n <InputText\n name={'bankAccountNumber'}\n value={data.bankAccountNumber}\n onInput={handleChangeFor('bankAccountNumber', 'input')}\n onBlur={handleChangeFor('bankAccountNumber', 'blur')}\n placeholder={placeholders?.bankAccountNumber}\n aria-describedby={descriptionId}\n required={true}\n autocomplete={undefined}\n />\n </Field>\n\n <Field\n label={i18n.get('Bank State Branch')}\n classNameModifiers={['col-40', 'bsb']}\n errorMessage={getErrorMessage(i18n, errors.bsb, i18n.get('Bank State Branch'))}\n name={'bsb'}\n i18n={i18n}\n errorLive={true}\n >\n <InputText\n name={'bsb'}\n value={data.bsb}\n onInput={handleChangeFor('bsb', 'input')}\n onBlur={handleChangeFor('bsb', 'blur')}\n placeholder={placeholders?.bsb}\n required={true}\n autocomplete={undefined}\n />\n </Field>\n\n <PayToNameFields i18n={i18n} data={data} handleChangeFor={handleChangeFor} errors={errors} placeholders={placeholders} />\n </Fieldset>\n );\n}\n"],"names":["BASE_SCHEMA","BSBInput","setComponentRef","defaultData","placeholders","onChange","setStatus","id","i18n","useCoreContext","descriptionId","useMemo","getUniqueId","form","useFormWithA11y","schema","rules","bsbValidationRules","formatters","phoneFormatters","formHolder","handleChangeFor","triggerValidation","data","errors","valid","isValid","useEffect","payToRef","useRef","showValidation","current","h","Fieldset","classNameModifiers","label","description","Field","get","errorMessage","getErrorMessage","bankAccountNumber","name","errorLive","InputText","value","onInput","onBlur","placeholder","aria-describedby","required","autocomplete","undefined","bsb","PayToNameFields"],"mappings":"qzBAiCA,MAAMA,EAAc,CAAC,oBAAqB,MAAO,YAAa,YAE/C,SAASC,GAASC,gBAAEA,EAAeC,YAAEA,EAAWC,aAAEA,EAAYC,SAAEA,EAAQC,UAAEA,EAASC,GAAEA,IAChG,MAAMC,KAAEA,GAASC,IAEXC,EAAgBC,EAAQ,IAAMC,EAAY,qBAAsB,IAEhEC,EAAOC,EAA6B,CACtCC,OAAQf,EACRG,YAAaA,EACba,MAAOC,EACPC,WAAYC,EACZC,WAAY,IAAIb,OAEdc,gBAAEA,EAAeC,kBAAEA,EAAiBC,KAAEA,EAAIC,OAAEA,EAAMC,MAAEA,EAAKC,QAAEA,GAAYb,EAG7Ec,EAAU,KACNtB,EAAS,CAAEkB,OAAME,QAAOD,SAAQE,aACjC,CAACH,EAAME,EAAOD,EAAQE,IAEzB,MAAME,EAAWC,EAA4B,CACzCvB,UAAWA,EACXwB,eAAgBR,IAOpB,OAJAK,EAAU,KACNzB,EAAgB0B,EAASG,UAC1B,CAAC7B,IAGA8B,EAACC,EAAAA,CAAS1B,GAAIA,EAAI2B,mBAAoB,CAAC,oBAAqBC,MAAO,MAAOC,YAAa,wBAAyB1B,cAAeA,GAC3HsB,EAACK,EAAAA,CACGF,MAAO3B,EAAK8B,IAAI,qCAChBJ,mBAAoB,CAAC,SAAU,qBAC/BK,aAAcC,EAAgBhC,EAAMgB,EAAOiB,kBAAmBjC,EAAK8B,IAAI,sCACvEI,KAAM,oBACNlC,KAAMA,EACNmC,WAAW,GAEXX,EAACY,EAAAA,CACGF,KAAM,oBACNG,MAAOtB,EAAKkB,kBACZK,QAASzB,EAAgB,oBAAqB,SAC9C0B,OAAQ1B,EAAgB,oBAAqB,QAC7C2B,YAAa5C,aAAAA,EAAAA,EAAcqC,kBAC3BQ,mBAAkBvC,EAClBwC,UAAU,EACVC,kBAAcC,KAItBpB,EAACK,EAAAA,CACGF,MAAO3B,EAAK8B,IAAI,qBAChBJ,mBAAoB,CAAC,SAAU,OAC/BK,aAAcC,EAAgBhC,EAAMgB,EAAO6B,IAAK7C,EAAK8B,IAAI,sBACzDI,KAAM,MACNlC,KAAMA,EACNmC,WAAW,GAEXX,EAACY,EAAAA,CACGF,KAAM,MACNG,MAAOtB,EAAK8B,IACZP,QAASzB,EAAgB,MAAO,SAChC0B,OAAQ1B,EAAgB,MAAO,QAC/B2B,YAAa5C,aAAAA,EAAAA,EAAciD,IAC3BH,UAAU,EACVC,kBAAcC,KAItBpB,EAACsB,EAAAA,CAAgB9C,KAAMA,EAAMe,KAAMA,EAAMF,gBAAiBA,EAAiBG,OAAQA,EAAQpB,aAAcA,IAGrH"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import i from"../../internal/FormFields/Select/Select.js";import
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import i from"../../internal/FormFields/Select/Select.js";import a from"../../internal/FormFields/Field/Field.js";import{useCoreContext as t}from"../../../core/Context/CoreProvider.js";import{createEnumChecker as o}from"../../../core/utils.js";var n=function(e){return e.phone="phone",e.email="email",e.abn="abn",e.orgid="orgid",e}({});const r=o(n),d=[{id:"phone",nameKey:"payto.payid.option.phone"},{id:"email",nameKey:"payto.payid.option.email"},{id:"abn",nameKey:"ABN"},{id:"orgid",nameKey:"payto.payid.option.orgid"}];function l({selectedIdentifier:o,onSelectedIdentifier:n,classNameModifiers:l,describedBy:m}){const{i18n:s}=t(),p=((e,i)=>i.map(i=>({id:i.id,name:e.get(i.nameKey)})))(s,d);return e(a,{className:"",name:"payid-identifier",useLabelElement:!0,label:s.get("payto.payid.label.identifier"),showContextualElement:!1,classNameModifiers:l},e(i,{filterable:!1,items:p,selectedValue:o,onChange:e=>{const i=e.target.value+"";r(i)&&n(i)},name:"payid-identifier",additionalDescribedBy:m}))}export{d as PAYID_IDENTIFIER_OPTIONS,n as PayToIdentifierEnum,l as default};
|
|
2
2
|
//# sourceMappingURL=IdentifierSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdentifierSelector.js","sources":["../../../../../src/components/PayTo/components/IdentifierSelector.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Select from '../../internal/FormFields/Select';\nimport { SelectTargetObject } from '../../internal/FormFields/Select/types';\nimport Field from '../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Language from '../../../language';\nimport { createEnumChecker } from '../../../core/utils';\n\nexport enum PayToIdentifierEnum {\n phone = 'phone',\n email = 'email',\n abn = 'abn',\n orgid = 'orgid'\n}\n\nconst payToIdentifierEnumCheck = createEnumChecker(PayToIdentifierEnum);\n\nexport type PayToPayIDInputIdentifierValues = keyof typeof PayToIdentifierEnum;\n\ntype PayIdOptionsType = { id: PayToPayIDInputIdentifierValues; nameKey: string }[];\n\nexport const PAYID_IDENTIFIER_OPTIONS: PayIdOptionsType = [\n {\n id: PayToIdentifierEnum.phone,\n nameKey: 'payto.payid.option.phone'\n },\n {\n id: PayToIdentifierEnum.email,\n nameKey: 'payto.payid.option.email'\n },\n {\n id: PayToIdentifierEnum.abn,\n nameKey: 'ABN'\n },\n {\n id: PayToIdentifierEnum.orgid,\n nameKey: 'payto.payid.option.orgid'\n }\n];\n\ninterface IdentifierSelectorProps {\n classNameModifiers?: string[];\n selectedIdentifier: PayToPayIDInputIdentifierValues;\n onSelectedIdentifier: (value: PayToPayIDInputIdentifierValues) => void;\n}\n\nconst loadI18nForOptions = (i18n: Language, options: PayIdOptionsType) =>\n options.map(option => ({\n id: option.id,\n name: i18n.get(option.nameKey)\n }));\n\nexport default function IdentifierSelector({
|
|
1
|
+
{"version":3,"file":"IdentifierSelector.js","sources":["../../../../../src/components/PayTo/components/IdentifierSelector.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Select from '../../internal/FormFields/Select';\nimport { SelectTargetObject } from '../../internal/FormFields/Select/types';\nimport Field from '../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport Language from '../../../language';\nimport { createEnumChecker } from '../../../core/utils';\n\nexport enum PayToIdentifierEnum {\n phone = 'phone',\n email = 'email',\n abn = 'abn',\n orgid = 'orgid'\n}\n\nconst payToIdentifierEnumCheck = createEnumChecker(PayToIdentifierEnum);\n\nexport type PayToPayIDInputIdentifierValues = keyof typeof PayToIdentifierEnum;\n\ntype PayIdOptionsType = { id: PayToPayIDInputIdentifierValues; nameKey: string }[];\n\nexport const PAYID_IDENTIFIER_OPTIONS: PayIdOptionsType = [\n {\n id: PayToIdentifierEnum.phone,\n nameKey: 'payto.payid.option.phone'\n },\n {\n id: PayToIdentifierEnum.email,\n nameKey: 'payto.payid.option.email'\n },\n {\n id: PayToIdentifierEnum.abn,\n nameKey: 'ABN'\n },\n {\n id: PayToIdentifierEnum.orgid,\n nameKey: 'payto.payid.option.orgid'\n }\n];\n\ninterface IdentifierSelectorProps {\n classNameModifiers?: string[];\n selectedIdentifier: PayToPayIDInputIdentifierValues;\n onSelectedIdentifier: (value: PayToPayIDInputIdentifierValues) => void;\n describedBy?: string;\n}\n\nconst loadI18nForOptions = (i18n: Language, options: PayIdOptionsType) =>\n options.map(option => ({\n id: option.id,\n name: i18n.get(option.nameKey)\n }));\n\nexport default function IdentifierSelector({\n selectedIdentifier,\n onSelectedIdentifier,\n classNameModifiers,\n describedBy\n}: Readonly<IdentifierSelectorProps>) {\n const { i18n } = useCoreContext();\n\n const hydratedOptions = loadI18nForOptions(i18n, PAYID_IDENTIFIER_OPTIONS);\n\n const onChange = (e: { target: SelectTargetObject }) => {\n const valueStr = e.target.value + '';\n\n if (payToIdentifierEnumCheck(valueStr)) {\n onSelectedIdentifier(valueStr);\n }\n };\n\n return (\n <Field\n className={''}\n name={'payid-identifier'}\n useLabelElement={true}\n label={i18n.get('payto.payid.label.identifier')}\n showContextualElement={false}\n classNameModifiers={classNameModifiers}\n >\n <Select\n filterable={false}\n items={hydratedOptions}\n selectedValue={selectedIdentifier}\n onChange={onChange}\n name={'payid-identifier'}\n additionalDescribedBy={describedBy}\n />\n </Field>\n );\n}\n"],"names":["PayToIdentifierEnum","payToIdentifierEnumCheck","createEnumChecker","PAYID_IDENTIFIER_OPTIONS","id","nameKey","IdentifierSelector","selectedIdentifier","onSelectedIdentifier","classNameModifiers","describedBy","i18n","useCoreContext","hydratedOptions","options","map","option","name","get","loadI18nForOptions","h","Field","className","useLabelElement","label","showContextualElement","Select","filterable","items","selectedValue","onChange","e","valueStr","target","value","additionalDescribedBy"],"mappings":"4TAQO,IAAAA,EAAKA,SAAAA,GAAAA,mEAAAA,CAKX,CALWA,CAKX,CAAA,GAED,MAAMC,EAA2BC,EAAkBF,GAMtCG,EAA6C,CACtD,CACIC,GAAE,QACFC,QAAS,4BAEb,CACID,GAAE,QACFC,QAAS,4BAEb,CACID,GAAE,MACFC,QAAS,OAEb,CACID,GAAE,QACFC,QAAS,6BAiBF,SAASC,GAAmBC,mBACvCA,EAAkBC,qBAClBA,EAAoBC,mBACpBA,EAAkBC,YAClBA,IAEA,MAAMC,KAAEA,GAASC,IAEXC,EAdiB,EAACF,EAAgBG,IACxCA,EAAQC,IAAIC,IAAAA,CACRZ,GAAIY,EAAOZ,GACXa,KAAMN,EAAKO,IAAIF,EAAOX,YAWFc,CAAmBR,EAAMR,GAUjD,OACIiB,EAACC,EAAAA,CACGC,UAAW,GACXL,KAAM,mBACNM,iBAAiB,EACjBC,MAAOb,EAAKO,IAAI,gCAChBO,uBAAuB,EACvBhB,mBAAoBA,GAEpBW,EAACM,EAAAA,CACGC,YAAY,EACZC,MAAOf,EACPgB,cAAetB,EACfuB,SArBMC,IACd,MAAMC,EAAWD,EAAEE,OAAOC,MAAQ,GAE9BjC,EAAyB+B,IACzBxB,EAAqBwB,IAkBjBf,KAAM,mBACNkB,sBAAuBzB,IAIvC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as e}from"../../../external/preact/dist/preact.js";import r from"../../internal/FormFields/Fieldset/Fieldset.js";import i,{PayToIdentifierEnum as t}from"./IdentifierSelector.js";import{
|
|
1
|
+
import{createElement as e}from"../../../external/preact/dist/preact.js";import r from"../../internal/FormFields/Fieldset/Fieldset.js";import i,{PayToIdentifierEnum as t}from"./IdentifierSelector.js";import{useMemo as o,useEffect as a,useRef as l}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as n}from"../../../core/Context/CoreProvider.js";import s from"../../../utils/useForm/useFormWithA11y.js";import"../../internal/SecuredFields/lib/CSF/utils/userAgent.js";import d from"./PayToPhone.js";import m from"../../internal/FormFields/InputEmail.js";import{getErrorMessage as p}from"../../../utils/getErrorMessage.js";import c from"../../internal/FormFields/Field/Field.js";import u from"../../internal/FormFields/InputText.js";import{payIdValidationRules as f}from"./validate.js";import{getUniqueId as g}from"../../../utils/idGenerator.js";import{phoneFormatters as b}from"../../internal/PhoneInput/validate.js";import h from"./PayToNameFields.js";function y(e,r,i){return r in e?Object.defineProperty(e,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[r]=i,e}function j(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{},t=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(t=t.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),t.forEach(function(r){y(e,r,i[r])})}return e}const I=["selectedIdentifier","firstName","lastName"],v={[t.email]:["email"],[t.phone]:["phoneNumber","phonePrefix"],[t.abn]:["abn"],[t.orgid]:["orgid"]};function F({setComponentRef:y,defaultData:F,placeholders:N,onChange:P,setStatus:M,id:S}){const{i18n:O}=n(),B=o(()=>g("payid-instruction"),[]),C=s({schema:I,defaultData:j({selectedIdentifier:t.phone},F),rules:f,formatters:b,formHolder:`#${S}`}),{handleChangeFor:E,triggerValidation:x,data:w,errors:A,valid:D,isValid:V,setSchema:k}=C;a(()=>{k([...v[w.selectedIdentifier],...I])},[w.selectedIdentifier]),a(()=>{P({data:w,valid:D,errors:A,isValid:V})},[w,D,A,V]);const q=l({setStatus:M,showValidation:x});return a(()=>{y(q.current)},[y]),e(r,{id:S,classNameModifiers:["payto__payid_input"],label:"PayID",description:"payto.payid.description",descriptionId:B},e(i,{classNameModifiers:["col-40"],onSelectedIdentifier:E("selectedIdentifier"),selectedIdentifier:w.selectedIdentifier,describedBy:B}),w.selectedIdentifier===t.phone&&e(d,{form:C}),w.selectedIdentifier===t.email&&e(c,{label:O.get("shopperEmail"),classNameModifiers:["col-60","email"],errorMessage:p(O,A.email,O.get("shopperEmail")),dir:"ltr",name:"email",i18n:O,errorLive:!0},e(m,{name:"email",value:w.email,onInput:E("email","input"),onBlur:E("email","blur"),placeholder:null==N?void 0:N.email,required:!0,autocomplete:"email"})),w.selectedIdentifier===t.abn&&e(c,{label:O.get("ABN"),classNameModifiers:["col-60","abn"],errorMessage:p(O,A.abn,O.get("ABN")),name:"ABN",i18n:O,errorLive:!0},e(u,{name:"abn",value:w.abn,onInput:E("abn","input"),onBlur:E("abn","blur"),placeholder:null==N?void 0:N.abn,required:!0,autocomplete:void 0})),w.selectedIdentifier===t.orgid&&e(c,{label:O.get("payto.payid.label.orgid"),classNameModifiers:["col-60","orgid"],errorMessage:p(O,A.orgid,O.get("payto.payid.label.orgid")),name:"orgid",i18n:O,errorLive:!0},e(u,{name:"orgid",value:w.orgid,onInput:E("orgid","input"),onBlur:E("orgid","blur"),placeholder:null==N?void 0:N.orgid,required:!0,autocomplete:void 0})),e(h,{i18n:O,data:w,handleChangeFor:E,errors:A,placeholders:N}))}export{F as default};
|
|
2
2
|
//# sourceMappingURL=PayIDInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayIDInput.js","sources":["../../../../../src/components/PayTo/components/PayIDInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport IdentifierSelector, { PayToIdentifierEnum } from './IdentifierSelector';\nimport { useEffect, useRef } from 'preact/hooks';\nimport { useFormWithA11y } from '../../../utils/useForm';\nimport PayToPhone from './PayToPhone';\nimport InputEmail from '../../internal/FormFields/InputEmail';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport Field from '../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport InputText from '../../internal/FormFields/InputText';\nimport { payIdValidationRules } from './validate';\nimport './PayIDInput.scss';\nimport { phoneFormatters } from '../../internal/PhoneInput/validate';\nimport { ComponentMethodsRef, UIElementStatus } from '../../internal/UIElement/types';\nimport PayToNameFields from './PayToNameFields';\nimport { PayToPlaceholdersType } from '../types';\n\nexport interface PayIdFormData {\n email: string;\n phone: string;\n abn: string;\n orgid: string;\n firstName: string;\n lastName: string;\n phoneNumber?: string;\n phonePrefix?: string;\n selectedIdentifier: PayToIdentifierEnum;\n}\n\nexport interface PayIDInputProps {\n status: UIElementStatus;\n setStatus: (status: UIElementStatus) => void;\n defaultData: PayIdFormData;\n placeholders: PayToPlaceholdersType;\n onChange: (e) => void;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n id?: string;\n}\n\nconst BASE_SCHEMA = ['selectedIdentifier', 'firstName', 'lastName'];\n\nconst IDENTIFIER_SCHEMA = {\n [PayToIdentifierEnum.email]: ['email'],\n [PayToIdentifierEnum.phone]: ['phoneNumber', 'phonePrefix'],\n [PayToIdentifierEnum.abn]: ['abn'],\n [PayToIdentifierEnum.orgid]: ['orgid']\n};\n\nexport default function PayIDInput({ setComponentRef, defaultData, placeholders, onChange, setStatus, id }: Readonly<PayIDInputProps>) {\n const { i18n } = useCoreContext();\n\n const form = useFormWithA11y<PayIdFormData>({\n schema: BASE_SCHEMA,\n defaultData: { selectedIdentifier: PayToIdentifierEnum.phone, ...defaultData },\n rules: payIdValidationRules,\n formatters: phoneFormatters,\n formHolder: `#${id}`\n });\n const { handleChangeFor, triggerValidation, data, errors, valid, isValid, setSchema } = form;\n\n // handle the changes of identifier, each identifier gets its own schema\n useEffect(() => {\n // get the correct schema for each identifier and merge it with the base\n setSchema([...IDENTIFIER_SCHEMA[data.selectedIdentifier], ...BASE_SCHEMA]);\n }, [data.selectedIdentifier]);\n\n // standard onChange propagate to parent state\n useEffect(() => {\n onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n const payToRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: triggerValidation\n });\n\n useEffect(() => {\n setComponentRef(payToRef.current);\n }, [setComponentRef]);\n\n return (\n <Fieldset id={id} classNameModifiers={['payto__payid_input']} label={'PayID'} description={'payto.payid.description'}>\n <IdentifierSelector\n classNameModifiers={['col-40']}\n onSelectedIdentifier={handleChangeFor('selectedIdentifier')}\n selectedIdentifier={data.selectedIdentifier}\n />\n {data.selectedIdentifier === PayToIdentifierEnum.phone && <PayToPhone form={form} />}\n\n {/* TODO probably worth refactoring this into either re-usable components or builder */}\n {data.selectedIdentifier === PayToIdentifierEnum.email && (\n <Field\n label={i18n.get('shopperEmail')}\n classNameModifiers={['col-60', 'email']}\n errorMessage={getErrorMessage(i18n, errors.email, i18n.get('shopperEmail'))}\n dir={'ltr'}\n name={'email'}\n i18n={i18n}\n errorLive={true}\n >\n <InputEmail\n name={'email'}\n value={data.email}\n onInput={handleChangeFor('email', 'input')}\n onBlur={handleChangeFor('email', 'blur')}\n placeholder={placeholders?.email}\n required={true}\n autocomplete={'email'}\n />\n </Field>\n )}\n\n {data.selectedIdentifier === PayToIdentifierEnum.abn && (\n <Field\n label={i18n.get('ABN')}\n classNameModifiers={['col-60', 'abn']}\n errorMessage={getErrorMessage(i18n, errors.abn, i18n.get('ABN'))}\n name={'ABN'}\n i18n={i18n}\n errorLive={true}\n >\n <InputText\n name={'abn'}\n value={data.abn}\n onInput={handleChangeFor('abn', 'input')}\n onBlur={handleChangeFor('abn', 'blur')}\n placeholder={placeholders?.abn}\n required={true}\n autocomplete={undefined}\n />\n </Field>\n )}\n\n {data.selectedIdentifier === PayToIdentifierEnum.orgid && (\n <Field\n label={i18n.get('payto.payid.label.orgid')}\n classNameModifiers={['col-60', 'orgid']}\n errorMessage={getErrorMessage(i18n, errors.orgid, i18n.get('payto.payid.label.orgid'))}\n name={'orgid'}\n i18n={i18n}\n errorLive={true}\n >\n <InputText\n name={'orgid'}\n value={data.orgid}\n onInput={handleChangeFor('orgid', 'input')}\n onBlur={handleChangeFor('orgid', 'blur')}\n placeholder={placeholders?.orgid}\n required={true}\n autocomplete={undefined}\n />\n </Field>\n )}\n\n <PayToNameFields i18n={i18n} data={data} handleChangeFor={handleChangeFor} errors={errors} placeholders={placeholders} />\n </Fieldset>\n );\n}\n"],"names":["BASE_SCHEMA","IDENTIFIER_SCHEMA","PayToIdentifierEnum","email","phone","abn","orgid","PayIDInput","setComponentRef","defaultData","placeholders","onChange","setStatus","id","i18n","useCoreContext","form","useFormWithA11y","schema","_object_spread","selectedIdentifier","rules","payIdValidationRules","formatters","phoneFormatters","formHolder","handleChangeFor","triggerValidation","data","errors","valid","isValid","setSchema","useEffect","payToRef","useRef","showValidation","current","h","Fieldset","classNameModifiers","label","description","IdentifierSelector","onSelectedIdentifier","PayToPhone","Field","get","errorMessage","getErrorMessage","dir","name","errorLive","InputEmail","value","onInput","onBlur","placeholder","required","autocomplete","InputText","undefined","PayToNameFields"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"PayIDInput.js","sources":["../../../../../src/components/PayTo/components/PayIDInput.tsx"],"sourcesContent":["import { h } from 'preact';\nimport Fieldset from '../../internal/FormFields/Fieldset';\nimport IdentifierSelector, { PayToIdentifierEnum } from './IdentifierSelector';\nimport { useEffect, useMemo, useRef } from 'preact/hooks';\nimport { useFormWithA11y } from '../../../utils/useForm';\nimport PayToPhone from './PayToPhone';\nimport InputEmail from '../../internal/FormFields/InputEmail';\nimport { getErrorMessage } from '../../../utils/getErrorMessage';\nimport Field from '../../internal/FormFields/Field';\nimport { useCoreContext } from '../../../core/Context/CoreProvider';\nimport InputText from '../../internal/FormFields/InputText';\nimport { payIdValidationRules } from './validate';\nimport { getUniqueId } from '../../../utils/idGenerator';\nimport './PayIDInput.scss';\nimport { phoneFormatters } from '../../internal/PhoneInput/validate';\nimport { ComponentMethodsRef, UIElementStatus } from '../../internal/UIElement/types';\nimport PayToNameFields from './PayToNameFields';\nimport { PayToPlaceholdersType } from '../types';\n\nexport interface PayIdFormData {\n email: string;\n phone: string;\n abn: string;\n orgid: string;\n firstName: string;\n lastName: string;\n phoneNumber?: string;\n phonePrefix?: string;\n selectedIdentifier: PayToIdentifierEnum;\n}\n\nexport interface PayIDInputProps {\n status: UIElementStatus;\n setStatus: (status: UIElementStatus) => void;\n defaultData: PayIdFormData;\n placeholders: PayToPlaceholdersType;\n onChange: (e) => void;\n setComponentRef: (ref: ComponentMethodsRef) => void;\n id?: string;\n}\n\nconst BASE_SCHEMA = ['selectedIdentifier', 'firstName', 'lastName'];\n\nconst IDENTIFIER_SCHEMA = {\n [PayToIdentifierEnum.email]: ['email'],\n [PayToIdentifierEnum.phone]: ['phoneNumber', 'phonePrefix'],\n [PayToIdentifierEnum.abn]: ['abn'],\n [PayToIdentifierEnum.orgid]: ['orgid']\n};\n\nexport default function PayIDInput({ setComponentRef, defaultData, placeholders, onChange, setStatus, id }: Readonly<PayIDInputProps>) {\n const { i18n } = useCoreContext();\n\n const instructionId = useMemo(() => getUniqueId('payid-instruction'), []);\n\n const form = useFormWithA11y<PayIdFormData>({\n schema: BASE_SCHEMA,\n defaultData: { selectedIdentifier: PayToIdentifierEnum.phone, ...defaultData },\n rules: payIdValidationRules,\n formatters: phoneFormatters,\n formHolder: `#${id}`\n });\n const { handleChangeFor, triggerValidation, data, errors, valid, isValid, setSchema } = form;\n\n // handle the changes of identifier, each identifier gets its own schema\n useEffect(() => {\n // get the correct schema for each identifier and merge it with the base\n setSchema([...IDENTIFIER_SCHEMA[data.selectedIdentifier], ...BASE_SCHEMA]);\n }, [data.selectedIdentifier]);\n\n // standard onChange propagate to parent state\n useEffect(() => {\n onChange({ data, valid, errors, isValid });\n }, [data, valid, errors, isValid]);\n\n const payToRef = useRef<ComponentMethodsRef>({\n setStatus: setStatus,\n showValidation: triggerValidation\n });\n\n useEffect(() => {\n setComponentRef(payToRef.current);\n }, [setComponentRef]);\n\n return (\n <Fieldset\n id={id}\n classNameModifiers={['payto__payid_input']}\n label={'PayID'}\n description={'payto.payid.description'}\n // this is needed for the identifier selector to know which element to describe since\n // Select doesn't automatically associate the fieldset description (at least on VoiceOver)\n descriptionId={instructionId}\n >\n <IdentifierSelector\n classNameModifiers={['col-40']}\n onSelectedIdentifier={handleChangeFor('selectedIdentifier')}\n selectedIdentifier={data.selectedIdentifier}\n describedBy={instructionId}\n />\n {data.selectedIdentifier === PayToIdentifierEnum.phone && <PayToPhone form={form} />}\n\n {/* TODO probably worth refactoring this into either re-usable components or builder */}\n {data.selectedIdentifier === PayToIdentifierEnum.email && (\n <Field\n label={i18n.get('shopperEmail')}\n classNameModifiers={['col-60', 'email']}\n errorMessage={getErrorMessage(i18n, errors.email, i18n.get('shopperEmail'))}\n dir={'ltr'}\n name={'email'}\n i18n={i18n}\n errorLive={true}\n >\n <InputEmail\n name={'email'}\n value={data.email}\n onInput={handleChangeFor('email', 'input')}\n onBlur={handleChangeFor('email', 'blur')}\n placeholder={placeholders?.email}\n required={true}\n autocomplete={'email'}\n />\n </Field>\n )}\n\n {data.selectedIdentifier === PayToIdentifierEnum.abn && (\n <Field\n label={i18n.get('ABN')}\n classNameModifiers={['col-60', 'abn']}\n errorMessage={getErrorMessage(i18n, errors.abn, i18n.get('ABN'))}\n name={'ABN'}\n i18n={i18n}\n errorLive={true}\n >\n <InputText\n name={'abn'}\n value={data.abn}\n onInput={handleChangeFor('abn', 'input')}\n onBlur={handleChangeFor('abn', 'blur')}\n placeholder={placeholders?.abn}\n required={true}\n autocomplete={undefined}\n />\n </Field>\n )}\n\n {data.selectedIdentifier === PayToIdentifierEnum.orgid && (\n <Field\n label={i18n.get('payto.payid.label.orgid')}\n classNameModifiers={['col-60', 'orgid']}\n errorMessage={getErrorMessage(i18n, errors.orgid, i18n.get('payto.payid.label.orgid'))}\n name={'orgid'}\n i18n={i18n}\n errorLive={true}\n >\n <InputText\n name={'orgid'}\n value={data.orgid}\n onInput={handleChangeFor('orgid', 'input')}\n onBlur={handleChangeFor('orgid', 'blur')}\n placeholder={placeholders?.orgid}\n required={true}\n autocomplete={undefined}\n />\n </Field>\n )}\n\n <PayToNameFields i18n={i18n} data={data} handleChangeFor={handleChangeFor} errors={errors} placeholders={placeholders} />\n </Fieldset>\n );\n}\n"],"names":["BASE_SCHEMA","IDENTIFIER_SCHEMA","PayToIdentifierEnum","email","phone","abn","orgid","PayIDInput","setComponentRef","defaultData","placeholders","onChange","setStatus","id","i18n","useCoreContext","instructionId","useMemo","getUniqueId","form","useFormWithA11y","schema","_object_spread","selectedIdentifier","rules","payIdValidationRules","formatters","phoneFormatters","formHolder","handleChangeFor","triggerValidation","data","errors","valid","isValid","setSchema","useEffect","payToRef","useRef","showValidation","current","h","Fieldset","classNameModifiers","label","description","descriptionId","IdentifierSelector","onSelectedIdentifier","describedBy","PayToPhone","Field","get","errorMessage","getErrorMessage","dir","name","errorLive","InputEmail","value","onInput","onBlur","placeholder","required","autocomplete","InputText","undefined","PayToNameFields"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{isEmpty as e}from"../../../utils/validator-utils.js";import{ERROR_FIELD_REQUIRED as
|
|
1
|
+
import{isEmpty as e}from"../../../utils/validator-utils.js";import{ERROR_FIELD_REQUIRED as r,ERROR_FIELD_INVALID as a}from"../../../core/Errors/constants.js";const s=/^((\d{9})|(\d{11}))$/,l=/`^[!-@[-~][ -@[-~]{0,254}[!-@[-~]$`/,o=/^(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)$/,i=/^[0-9]{1,29}$/,d=(s,l,o)=>e(s)?(o.errorMessage=r,null):(o.errorMessage=a,l.test(s)),t={validate:e=>d(e,o,t),errorMessage:"abn.invalid",modes:["blur"]},n={validate:e=>d(e,s,n),errorMessage:"abn.invalid",modes:["blur"]},m={validate:e=>d(e,l,m),errorMessage:"orgid.invalid",modes:["blur"]},u={default:{validate:e=>e&&e.length>0,errorMessage:r,modes:["blur"]},email:t,abn:n,orgid:m,firstName:{validate:r=>!e(r)||null,errorMessage:"payto.errors.accountHolderFirstName.invalid",modes:["blur"]},lastName:{validate:r=>!e(r)||null,errorMessage:"payto.errors.accountHolderLastName.invalid",modes:["blur"]},phoneNumber:{modes:["blur"],validate:r=>e(r)?null:i.test(r),errorMessage:"mobileNumber.invalid"},phonePrefix:{modes:["blur"],validate:e=>!!e,errorMessage:"mobileNumber.invalid"}},b=/^\d{6}$/,v=/^[ -~]{1,28}$/,g={validate:e=>d(e,b,g),errorMessage:"bsb.invalid",modes:["blur"]},c={validate:e=>d(e,v,c),errorMessage:"bankAccountNumber.invalid",modes:["blur"]},M={bsb:g,bankAccountNumber:c,firstName:{validate:r=>!e(r)||null,errorMessage:"payto.errors.accountHolderFirstName.invalid",modes:["blur"]},lastName:{validate:r=>!e(r)||null,errorMessage:"payto.errors.accountHolderLastName.invalid",modes:["blur"]}};export{M as bsbValidationRules,u as payIdValidationRules,d as validationFromRegex};
|
|
2
2
|
//# sourceMappingURL=validate.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","sources":["../../../../../src/components/PayTo/components/validate.ts"],"sourcesContent":["import { ValidatorRule, ValidatorRules } from '../../../utils/Validator/types';\nimport { isEmpty } from '../../../utils/validator-utils';\nimport { ERROR_FIELD_INVALID, ERROR_FIELD_REQUIRED } from '../../../core/Errors/constants';\n\nconst abnRegex = /^((\\d{9})|(\\d{11}))$/;\n\nconst orgidRegex = /`^[!-@[-~][ -@[-~]{0,254}[!-@[-~]$`/;\n\nconst emailRegex =\n /^(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)$/;\n\n// Full phone number regex with country code: ^+\\[0-9\\]{1,3}-\\[1-9\\]{1,1}\\[0-9\\]{1,29}$\nconst phoneNumberRegexWithoutCountryCode = /^[0-9]{1,29}$/;\n\nexport const validationFromRegex = (value: string, regex: RegExp, validationRule: ValidatorRule): boolean | null => {\n // null is returned here for legacy reasons\n // check comment on hasError() ValidatorRulesResult.ts:17\n if (isEmpty(value)) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return null;\n }\n validationRule.errorMessage = ERROR_FIELD_INVALID;\n return regex.test(value);\n};\n\nconst emailValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, emailRegex, emailValidatorRule),\n errorMessage: 'abn.invalid',\n modes: ['blur']\n};\n\nconst abnValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, abnRegex, abnValidatorRule),\n errorMessage: 'abn.invalid',\n modes: ['blur']\n};\n\nconst orgidValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, orgidRegex, orgidValidatorRule),\n errorMessage: 'orgid.invalid',\n modes: ['blur']\n};\n\nexport const payIdValidationRules: ValidatorRules = {\n default: {\n validate: value => {\n return value && value.length > 0;\n },\n errorMessage: ERROR_FIELD_REQUIRED,\n modes: ['blur']\n },\n email: emailValidatorRule,\n abn: abnValidatorRule,\n orgid: orgidValidatorRule,\n firstName: {\n validate: value => (isEmpty(value) ? null : true), // valid, if there are chars other than spaces,\n errorMessage: '
|
|
1
|
+
{"version":3,"file":"validate.js","sources":["../../../../../src/components/PayTo/components/validate.ts"],"sourcesContent":["import { ValidatorRule, ValidatorRules } from '../../../utils/Validator/types';\nimport { isEmpty } from '../../../utils/validator-utils';\nimport { ERROR_FIELD_INVALID, ERROR_FIELD_REQUIRED } from '../../../core/Errors/constants';\n\nconst abnRegex = /^((\\d{9})|(\\d{11}))$/;\n\nconst orgidRegex = /`^[!-@[-~][ -@[-~]{0,254}[!-@[-~]$`/;\n\nconst emailRegex =\n /^(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?)$/;\n\n// Full phone number regex with country code: ^+\\[0-9\\]{1,3}-\\[1-9\\]{1,1}\\[0-9\\]{1,29}$\nconst phoneNumberRegexWithoutCountryCode = /^[0-9]{1,29}$/;\n\nexport const validationFromRegex = (value: string, regex: RegExp, validationRule: ValidatorRule): boolean | null => {\n // null is returned here for legacy reasons\n // check comment on hasError() ValidatorRulesResult.ts:17\n if (isEmpty(value)) {\n validationRule.errorMessage = ERROR_FIELD_REQUIRED;\n return null;\n }\n validationRule.errorMessage = ERROR_FIELD_INVALID;\n return regex.test(value);\n};\n\nconst emailValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, emailRegex, emailValidatorRule),\n errorMessage: 'abn.invalid',\n modes: ['blur']\n};\n\nconst abnValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, abnRegex, abnValidatorRule),\n errorMessage: 'abn.invalid',\n modes: ['blur']\n};\n\nconst orgidValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, orgidRegex, orgidValidatorRule),\n errorMessage: 'orgid.invalid',\n modes: ['blur']\n};\n\nexport const payIdValidationRules: ValidatorRules = {\n default: {\n validate: value => {\n return value && value.length > 0;\n },\n errorMessage: ERROR_FIELD_REQUIRED,\n modes: ['blur']\n },\n email: emailValidatorRule,\n abn: abnValidatorRule,\n orgid: orgidValidatorRule,\n firstName: {\n validate: value => (isEmpty(value) ? null : true), // valid, if there are chars other than spaces,\n errorMessage: 'payto.errors.accountHolderFirstName.invalid',\n modes: ['blur']\n },\n lastName: {\n validate: value => (isEmpty(value) ? null : true),\n errorMessage: 'payto.errors.accountHolderLastName.invalid',\n modes: ['blur']\n },\n phoneNumber: {\n modes: ['blur'],\n validate: value => {\n return isEmpty(value) ? null : phoneNumberRegexWithoutCountryCode.test(value);\n },\n errorMessage: 'mobileNumber.invalid'\n },\n phonePrefix: {\n modes: ['blur'],\n validate: phonePrefix => !!phonePrefix,\n errorMessage: 'mobileNumber.invalid'\n }\n};\n\n//original regex /^\\d{6}-[ -~]{1,28}$/\nconst bsbRegex = /^\\d{6}$/;\nconst bankAccountNumberRegex = /^[ -~]{1,28}$/;\n\nconst bsbValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, bsbRegex, bsbValidatorRule),\n errorMessage: 'bsb.invalid',\n modes: ['blur']\n};\n\nconst bankAccountNumberValidatorRule: ValidatorRule = {\n validate: value => validationFromRegex(value, bankAccountNumberRegex, bankAccountNumberValidatorRule),\n errorMessage: 'bankAccountNumber.invalid',\n modes: ['blur']\n};\n\nexport const bsbValidationRules: ValidatorRules = {\n bsb: bsbValidatorRule,\n bankAccountNumber: bankAccountNumberValidatorRule,\n firstName: {\n validate: value => (isEmpty(value) ? null : true), // valid, if there are chars other than spaces,\n errorMessage: 'payto.errors.accountHolderFirstName.invalid',\n modes: ['blur']\n },\n lastName: {\n validate: value => (isEmpty(value) ? null : true),\n errorMessage: 'payto.errors.accountHolderLastName.invalid',\n modes: ['blur']\n }\n};\n"],"names":["abnRegex","orgidRegex","emailRegex","phoneNumberRegexWithoutCountryCode","validationFromRegex","value","regex","validationRule","isEmpty","errorMessage","ERROR_FIELD_REQUIRED","ERROR_FIELD_INVALID","test","emailValidatorRule","validate","modes","abnValidatorRule","orgidValidatorRule","payIdValidationRules","default","length","email","abn","orgid","firstName","lastName","phoneNumber","phonePrefix","bsbRegex","bankAccountNumberRegex","bsbValidatorRule","bankAccountNumberValidatorRule","bsbValidationRules","bsb","bankAccountNumber"],"mappings":"8JAIA,MAAMA,EAAW,uBAEXC,EAAa,sCAEbC,EACF,sKAGEC,EAAqC,gBAE9BC,EAAsB,CAACC,EAAeC,EAAeC,IAG1DC,EAAQH,IACRE,EAAeE,aAAeC,EACvB,OAEXH,EAAeE,aAAeE,EACvBL,EAAMM,KAAKP,IAGhBQ,EAAoC,CACtCC,SAAUT,GAASD,EAAoBC,EAAOH,EAAYW,GAC1DJ,aAAc,cACdM,MAAO,CAAC,SAGNC,EAAkC,CACpCF,SAAUT,GAASD,EAAoBC,EAAOL,EAAUgB,GACxDP,aAAc,cACdM,MAAO,CAAC,SAGNE,EAAoC,CACtCH,SAAUT,GAASD,EAAoBC,EAAOJ,EAAYgB,GAC1DR,aAAc,gBACdM,MAAO,CAAC,SAGCG,EAAuC,CAChDC,QAAS,CACLL,SAAUT,GACCA,GAASA,EAAMe,OAAS,EAEnCX,aAAcC,EACdK,MAAO,CAAC,SAEZM,MAAOR,EACPS,IAAKN,EACLO,MAAON,EACPO,UAAW,CACPV,SAAUT,IAAUG,EAAQH,IAAS,KACrCI,aAAc,8CACdM,MAAO,CAAC,SAEZU,SAAU,CACNX,SAAUT,IAAUG,EAAQH,IAAS,KACrCI,aAAc,6CACdM,MAAO,CAAC,SAEZW,YAAa,CACTX,MAAO,CAAC,QACRD,SAAUT,GACCG,EAAQH,GAAS,KAAOF,EAAmCS,KAAKP,GAE3EI,aAAc,wBAElBkB,YAAa,CACTZ,MAAO,CAAC,QACRD,SAAUa,KAAiBA,EAC3BlB,aAAc,yBAKhBmB,EAAW,UACXC,EAAyB,gBAEzBC,EAAkC,CACpChB,SAAUT,GAASD,EAAoBC,EAAOuB,EAAUE,GACxDrB,aAAc,cACdM,MAAO,CAAC,SAGNgB,EAAgD,CAClDjB,SAAUT,GAASD,EAAoBC,EAAOwB,EAAwBE,GACtEtB,aAAc,4BACdM,MAAO,CAAC,SAGCiB,EAAqC,CAC9CC,IAAKH,EACLI,kBAAmBH,EACnBP,UAAW,CACPV,SAAUT,IAAUG,EAAQH,IAAS,KACrCI,aAAc,8CACdM,MAAO,CAAC,SAEZU,SAAU,CACNX,SAAUT,IAAUG,EAAQH,IAAS,KACrCI,aAAc,6CACdM,MAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreeDS2Challenge.js","sources":["../../../../src/components/ThreeDS2/ThreeDS2Challenge.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PrepareChallenge from './components/Challenge';\nimport { DEFAULT_CHALLENGE_WINDOW_SIZE, THREEDS2_CHALLENGE, THREEDS2_CHALLENGE_ERROR } from './constants';\nimport { existy } from '../../utils/commonUtils';\nimport { hasOwnProperty } from '../../utils/hasOwnProperty';\nimport { TxVariants } from '../tx-variants';\nimport { ChallengeResolveData,
|
|
1
|
+
{"version":3,"file":"ThreeDS2Challenge.js","sources":["../../../../src/components/ThreeDS2/ThreeDS2Challenge.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PrepareChallenge from './components/Challenge';\nimport { DEFAULT_CHALLENGE_WINDOW_SIZE, THREEDS2_CHALLENGE, THREEDS2_CHALLENGE_ERROR } from './constants';\nimport { existy } from '../../utils/commonUtils';\nimport { hasOwnProperty } from '../../utils/hasOwnProperty';\nimport { TxVariants } from '../tx-variants';\nimport { ChallengeResolveData, ThreeDS2ChallengeConfiguration } from './types';\nimport AdyenCheckoutError, { API_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { ActionHandledReturnObject } from '../../types/global-types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass ThreeDS2Challenge extends UIElement<ThreeDS2ChallengeConfiguration> {\n public static readonly type = TxVariants.threeDS2Challenge;\n\n public static readonly defaultProps = {\n dataKey: 'threeDSResult',\n size: DEFAULT_CHALLENGE_WINDOW_SIZE,\n type: THREEDS2_CHALLENGE\n };\n\n protected override beforeRender() {\n /* Do not send rendered events for ThreeDS2Challenge - it will have the same timestamp as the \"creq sent\" event */\n }\n\n protected onActionHandled = (rtnObj: ActionHandledReturnObject) => {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.challengeIframeLoaded,\n message: rtnObj.actionDescription\n });\n\n this.submitAnalytics(event);\n\n super.onActionHandled(rtnObj);\n };\n\n /**\n * Will make a call to onAdditionalDetails (as set in actionTypes.ts) for the regular, \"native\" flow.\n * However, if the action to create this component came from the 3DS2InMDFlow process it will instead equal a call to the onComplete callback\n * (as defined in the 3DS2InMDFlow and passed in as a config prop).\n */\n onComplete(state: ChallengeResolveData) {\n if (this.props.isMDFlow) {\n this.props.on3DS2RedirectFlowComplete?.(state, this.elementRef);\n } else {\n super.onComplete(state);\n }\n\n this.unmount(); // re. fixing issue around back to back challenge calls\n }\n\n protected override componentToRender(): h.JSX.Element {\n // existy used because threeds2InMDFlow might send an empty string for paymentData and we should be allowed to proceed with this\n if (!existy(this.props.paymentData)) {\n /**\n * The presence of props.isMDFlow indicates the action to create this component came from the threeds2InMDFlow process which passes (an empty) paymentsData.\n * The regular, \"native\" flow uses the authorisationToken from the 3DS2 action, which actionTypes.ts assigns to a property called paymentData\n */\n const dataTypeForError = hasOwnProperty(this.props, 'isMDFlow') ? 'paymentData' : 'authorisationToken';\n\n this.props.onError(new AdyenCheckoutError(API_ERROR, `No ${dataTypeForError} received. 3DS2 Challenge cannot proceed`));\n\n const event = new AnalyticsErrorEvent({\n component: this.type,\n code: ErrorEventCode.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_CHALLENGE_ERROR}: Missing 'paymentData' property from threeDS2 action`\n });\n\n this.submitAnalytics(event);\n\n return null;\n }\n\n return (\n <PrepareChallenge\n {...this.props}\n onComplete={this.onComplete}\n onSubmitAnalytics={this.submitAnalytics}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n}\n\nexport default ThreeDS2Challenge;\n"],"names":["ThreeDS2Challenge","UIElement","beforeRender","onComplete","state","_this_props_on3DS2RedirectFlowComplete","_this_props","this","props","isMDFlow","on3DS2RedirectFlowComplete","call","elementRef","super","unmount","componentToRender","existy","paymentData","dataTypeForError","hasOwnProperty","onError","AdyenCheckoutError","API_ERROR","event","AnalyticsErrorEvent","component","type","code","ErrorEventCode","THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA","errorType","ErrorEventType","threeDS2","message","THREEDS2_CHALLENGE_ERROR","submitAnalytics","h","PrepareChallenge","onSubmitAnalytics","onActionHandled","args","_define_property","rtnObj","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","challengeIframeLoaded","actionDescription","TxVariants","threeDS2Challenge","defaultProps","dataKey","size","DEFAULT_CHALLENGE_WINDOW_SIZE","THREEDS2_CHALLENGE"],"mappings":"kwCAaA,MAAMA,UAA0BC,EASTC,YAAAA,GAEnB,CAoBAC,UAAAA,CAAWC,OAEHC,EAAAC,EADAC,KAAKC,MAAMC,SAC0B,QAArCJ,GAAAC,EAAAC,KAAKC,OAAME,kCAAX,IAAAL,GAAAA,EAAAM,KAAAL,EAAwCF,EAAOG,KAAKK,YAEpDC,MAAMV,WAAWC,GAGrBG,KAAKO,SACT,CAEmBC,iBAAAA,GAEf,IAAKC,EAAOT,KAAKC,MAAMS,aAAc,CAKjC,MAAMC,EAAmBC,EAAeZ,KAAKC,MAAO,YAAc,cAAgB,qBAElFD,KAAKC,MAAMY,QAAQ,IAAIC,EAAmBC,EAAW,MAAMJ,8CAE3D,MAAMK,EAAQ,IAAIC,EAAoB,CAClCC,UAAWlB,KAAKmB,KAChBC,KAAMC,EAAeC,wCACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,2DAKhB,OAFA3B,KAAK4B,gBAAgBZ,GAEd,IACX,CAEA,OACIa,EAACC,EAAAA,oUAAAA,CAAAA,GACO9B,KAAKC,OAAK,CACdL,WAAYI,KAAKJ,WACjBmC,kBAAmB/B,KAAK4B,gBACxBI,gBAAiBhC,KAAKgC,kBAGlC,mBAxEJ1B,SAAA2B,GAaIC,EAAAlC,KAAUgC,kBAAmBG,IACzB,MAAMnB,EAAQ,IAAIoB,EAAkB,CAChClB,UAAWlB,KAAKmB,KAChBA,KAAMkB,EAAaZ,SACnBa,QAASC,EAAgBC,sBACzBd,QAASS,EAAOM,oBAGpBzC,KAAK4B,gBAAgBZ,GAErBV,MAAM0B,gBAAgBG,MAtB1BD,EADEzC,EACqB0B,OAAOuB,EAAWC,mBAEzCT,EAHEzC,EAGqBmD,eAAe,CAClCC,QAAS,gBACTC,KAAMC,EACN5B,KAAM6B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreeDS2DeviceFingerprint.js","sources":["../../../../src/components/ThreeDS2/ThreeDS2DeviceFingerprint.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PrepareFingerprint from './components/DeviceFingerprint';\nimport callSubmit3DS2Fingerprint from './callSubmit3DS2Fingerprint';\nimport { existy } from '../../utils/commonUtils';\nimport { TxVariants } from '../tx-variants';\nimport { FingerprintResolveData,
|
|
1
|
+
{"version":3,"file":"ThreeDS2DeviceFingerprint.js","sources":["../../../../src/components/ThreeDS2/ThreeDS2DeviceFingerprint.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport PrepareFingerprint from './components/DeviceFingerprint';\nimport callSubmit3DS2Fingerprint from './callSubmit3DS2Fingerprint';\nimport { existy } from '../../utils/commonUtils';\nimport { TxVariants } from '../tx-variants';\nimport { FingerprintResolveData, ThreeDS2DeviceFingerprintConfiguration } from './types';\nimport AdyenCheckoutError, { API_ERROR } from '../../core/Errors/AdyenCheckoutError';\nimport { THREEDS2_FINGERPRINT, THREEDS2_FINGERPRINT_ERROR } from './constants';\nimport { ActionHandledReturnObject } from '../../types/global-types';\nimport { AnalyticsLogEvent, LogEventSubtype, LogEventType } from '../../core/Analytics/events/AnalyticsLogEvent';\nimport { AnalyticsErrorEvent, ErrorEventCode, ErrorEventType } from '../../core/Analytics/events/AnalyticsErrorEvent';\n\nclass ThreeDS2DeviceFingerprint extends UIElement<ThreeDS2DeviceFingerprintConfiguration> {\n public static readonly type = TxVariants.threeDS2Fingerprint;\n\n public static readonly defaultProps = {\n dataKey: 'fingerprintResult',\n type: THREEDS2_FINGERPRINT\n };\n\n private callSubmit3DS2Fingerprint = callSubmit3DS2Fingerprint.bind(this); // New 3DS2 flow\n\n protected override beforeRender() {\n /* Do not send rendered events for ThreeDS2DeviceFingerprint - it will have the same timestamp as the \"threeDSMethodData sent\" event */\n }\n\n protected onActionHandled = (rtnObj: ActionHandledReturnObject) => {\n const event = new AnalyticsLogEvent({\n component: this.type,\n type: LogEventType.threeDS2,\n subType: LogEventSubtype.fingerprintIframeLoaded,\n message: rtnObj.actionDescription\n });\n\n this.submitAnalytics(event);\n\n super.onActionHandled(rtnObj);\n };\n\n /**\n * Can be called directly from PrepareFingerprint (MDFlow) or after the call to /submitThreeDS2Fingerprint endpoint (native flow)\n */\n onComplete(state: FingerprintResolveData) {\n if (this.props.isMDFlow) {\n this.props.on3DS2RedirectFlowComplete?.(state, this.elementRef);\n } else {\n super.onComplete(state);\n }\n\n this.unmount(); // re. fixing issue around back to back fingerprinting calls\n }\n\n protected override componentToRender(): h.JSX.Element {\n /**\n * In the regular components (aka \"native\") flow we can't proceed because something has gone wrong with the payment if paymentData is missing from the threeDS2 action.\n * In the MDFlow the paymentData is always present (albeit an empty string, which is why we use 'existy' since we should be allowed to proceed with this)\n */\n if (!existy(this.props.paymentData)) {\n this.props.onError(new AdyenCheckoutError(API_ERROR, `No paymentData received. 3DS2 Fingerprint cannot proceed`));\n\n // TODO - check logs to see if this *ever* happens\n const event = new AnalyticsErrorEvent({\n component: this.type,\n code: ErrorEventCode.THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA,\n errorType: ErrorEventType.threeDS2,\n message: `${THREEDS2_FINGERPRINT_ERROR}: Missing 'paymentData' property from threeDS2 action`\n });\n\n this.submitAnalytics(event);\n\n return null;\n }\n\n /**\n * this.props.isMDFlow indicates the action to create this component came from the 3DS2InMDFlow process and upon completion should call the\n * passed onComplete callback (as defined in the 3DS2InMDFlow) instead of the /submitThreeDS2Fingerprint endpoint for the regular, \"native\" flow\n */\n return (\n <PrepareFingerprint\n {...this.props}\n // For MDFlow will bypass the /submitThreeDS2Fingerprint endpoint\n onComplete={this.props.isMDFlow ? this.onComplete : this.callSubmit3DS2Fingerprint}\n onSubmitAnalytics={this.submitAnalytics}\n onActionHandled={this.onActionHandled}\n />\n );\n }\n}\n\nexport default ThreeDS2DeviceFingerprint;\n"],"names":["ThreeDS2DeviceFingerprint","UIElement","beforeRender","onComplete","state","_this_props_on3DS2RedirectFlowComplete","_this_props","this","props","isMDFlow","on3DS2RedirectFlowComplete","call","elementRef","super","unmount","componentToRender","existy","paymentData","onError","AdyenCheckoutError","API_ERROR","event","AnalyticsErrorEvent","component","type","code","ErrorEventCode","THREEDS2_ACTION_IS_MISSING_PAYMENT_DATA","errorType","ErrorEventType","threeDS2","message","THREEDS2_FINGERPRINT_ERROR","submitAnalytics","h","PrepareFingerprint","callSubmit3DS2Fingerprint","onSubmitAnalytics","onActionHandled","args","_define_property","bind","rtnObj","AnalyticsLogEvent","LogEventType","subType","LogEventSubtype","fingerprintIframeLoaded","actionDescription","TxVariants","threeDS2Fingerprint","defaultProps","dataKey","THREEDS2_FINGERPRINT"],"mappings":"4tCAaA,MAAMA,UAAkCC,EAUjBC,YAAAA,GAEnB,CAkBAC,UAAAA,CAAWC,OAEHC,EAAAC,EADAC,KAAKC,MAAMC,SAC0B,QAArCJ,GAAAC,EAAAC,KAAKC,OAAME,kCAAX,IAAAL,GAAAA,EAAAM,KAAAL,EAAwCF,EAAOG,KAAKK,YAEpDC,MAAMV,WAAWC,GAGrBG,KAAKO,SACT,CAEmBC,iBAAAA,GAKf,IAAKC,EAAOT,KAAKC,MAAMS,aAAc,CACjCV,KAAKC,MAAMU,QAAQ,IAAIC,EAAmBC,EAAW,6DAGrD,MAAMC,EAAQ,IAAIC,EAAoB,CAClCC,UAAWhB,KAAKiB,KAChBC,KAAMC,EAAeC,wCACrBC,UAAWC,EAAeC,SAC1BC,QAAS,GAAGC,2DAKhB,OAFAzB,KAAK0B,gBAAgBZ,GAEd,IACX,CAMA,OACIa,EAACC,EAAAA,oUAAAA,CAAAA,GACO5B,KAAKC,OAAK,CAEdL,WAAYI,KAAKC,MAAMC,SAAWF,KAAKJ,WAAaI,KAAK6B,0BACzDC,kBAAmB9B,KAAK0B,gBACxBK,gBAAiB/B,KAAK+B,kBAGlC,mBA1EJzB,SAAA0B,GAQIC,OAAQJ,4BAA4BA,EAA0BK,KAAKlC,OAMnEiC,EAAAjC,KAAU+B,kBAAmBI,IACzB,MAAMrB,EAAQ,IAAIsB,EAAkB,CAChCpB,UAAWhB,KAAKiB,KAChBA,KAAMoB,EAAad,SACnBe,QAASC,EAAgBC,wBACzBhB,QAASW,EAAOM,oBAGpBzC,KAAK0B,gBAAgBZ,GAErBR,MAAMyB,gBAAgBI,MAvB1BF,EADExC,EACqBwB,OAAOyB,EAAWC,qBAEzCV,EAHExC,EAGqBmD,eAAe,CAClCC,QAAS,oBACT5B,KAAM6B"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"./components/UPIComponent/UPIComponent.js";import{Await as n}from"../internal/Await/Await.js";import{QRLoader as r}from"../internal/QRLoader/QRLoader.js";import"../../core/Context/CoreProvider.js";import"../../external/preact/hooks/dist/hooks.js";import"../../core/Errors/SRPanelContext.js";import"../internal/Button/Button.js";import"../internal/QRLoader/QRLoaderDetailsProvider.js";import{TxVariants as i}from"../tx-variants.js";import s from"../../utils/isMobile.js";import{UPI_MODE as a,UPI_COUNTDOWN_TIME as p}from"./constants.js";function m(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function d(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),n.forEach(function(e){m(t,e,o[e])})}return t}function u(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}),t}class l extends e{formatProps(t){return d({showOtherInsteadOfNumber:!s()},t)}get isValid(){return this.state.isValid}formatData(){const{app:t}=this.state.data||{};return{paymentMethod:d({type:this.paymentType},this.paymentType===i.upi_intent&&(null==t?void 0:t.id)&&{appId:t.id})}}get brands(){const{showPaymentMethodItemImages:t}=this.props;return t?this.appsList.map(t=>({icon:t.icon,name:t.name})):[]}get paymentType(){return this.mode===a.QR_CODE?i.upi_qr:i.upi_intent}componentToRender(){const{type:e,url:s,paymentMethodType:a}=this.props,p=!!this.props.mandate;switch(e){case"qrCode":var m,l;return t(r,u(d({},this.props),{qrCodeData:this.props.qrCodeData?encodeURIComponent(this.props.qrCodeData):void 0,type:i.upi_qr,brandLogo:this.props.brandLogo||this.icon,onComplete:this.onComplete,introduction:null!==(m=null===(l=this.props.i18n)||void 0===l?void 0:l.get("upi.qrCodeWaitingMessage"))&&void 0!==m?m:"",countdownTime:this.props.countdownTime,onActionHandled:this.onActionHandled,showAmount:!p}));case"await":var c,h,y,f,
|
|
1
|
+
import{createElement as t}from"../../external/preact/dist/preact.js";import{UIElement as e}from"../internal/UIElement/UIElement.js";import o from"./components/UPIComponent/UPIComponent.js";import{Await as n}from"../internal/Await/Await.js";import{QRLoader as r}from"../internal/QRLoader/QRLoader.js";import"../../core/Context/CoreProvider.js";import"../../external/preact/hooks/dist/hooks.js";import"../../core/Errors/SRPanelContext.js";import"../internal/Button/Button.js";import"../internal/QRLoader/QRLoaderDetailsProvider.js";import{TxVariants as i}from"../tx-variants.js";import s from"../../utils/isMobile.js";import{UPI_MODE as a,UPI_COUNTDOWN_TIME as p}from"./constants.js";function m(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}function d(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{},n=Object.keys(o);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(o).filter(function(t){return Object.getOwnPropertyDescriptor(o,t).enumerable}))),n.forEach(function(e){m(t,e,o[e])})}return t}function u(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e.push.apply(e,o)}return e}(Object(e)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(e,o))}),t}class l extends e{formatProps(t){return d({showOtherInsteadOfNumber:!s()},t)}get isValid(){return this.state.isValid}formatData(){const{app:t}=this.state.data||{};return{paymentMethod:d({type:this.paymentType},this.paymentType===i.upi_intent&&(null==t?void 0:t.id)&&{appId:t.id})}}get brands(){const{showPaymentMethodItemImages:t}=this.props;return t?this.appsList.map(t=>({icon:t.icon,name:t.name})):[]}get paymentType(){return this.mode===a.QR_CODE?i.upi_qr:i.upi_intent}componentToRender(){const{type:e,url:s,paymentMethodType:a}=this.props,p=!!this.props.mandate;switch(e){case"qrCode":var m,l;return t(r,u(d({},this.props),{qrCodeData:this.props.qrCodeData?encodeURIComponent(this.props.qrCodeData):void 0,type:i.upi_qr,brandLogo:this.props.brandLogo||this.icon,brandName:this.displayName,onComplete:this.onComplete,introduction:null!==(m=null===(l=this.props.i18n)||void 0===l?void 0:l.get("upi.qrCodeWaitingMessage"))&&void 0!==m?m:"",countdownTime:this.props.countdownTime,onActionHandled:this.onActionHandled,showAmount:!p}));case"await":var c,h,y,f,b;return t(n,{url:s,type:null!=a?a:"",showCountdownTimer:!0,shouldRedirectAutomatically:!0,showAmount:!p,countdownTime:this.props.countdownTime,clientKey:null!==(c=this.props.clientKey)&&void 0!==c?c:"",paymentData:this.props.paymentData,onActionHandled:this.onActionHandled,onError:this.props.onError,messageText:null!==(h=null===(f=this.props.i18n)||void 0===f?void 0:f.get("upi.vpaWaitingMessage"))&&void 0!==h?h:"",awaitText:null!==(y=null===(b=this.props.i18n)||void 0===b?void 0:b.get("await.waitForConfirmation"))&&void 0!==y?y:"",onComplete:this.onComplete,brandLogo:this.icon,brandName:this.displayName});default:var v;return t(o,{setComponentRef:this.setComponentRef,payButton:this.payButton,onChange:this.setState,appsList:this.appsList,mode:this.mode,showPayButton:null===(v=this.props.showPayButton)||void 0===v||v,mandate:this.props.mandate,onSubmitAnalytics:this.submitAnalytics})}}constructor(t,e){super(t,e),m(this,"mode",void 0),m(this,"appsList",void 0);const{apps:o=[]}=this.props,n=o.length>0;this.mode=s()&&n?a.INTENT:a.QR_CODE,this.appsList=o.map(t=>{var e,o;const n=`upi/${t.id.toLowerCase()}`,r=null!==(e=null===(o=this.core.modules.resources)||void 0===o?void 0:o.getImage()(n))&&void 0!==e?e:"";return{id:t.id,name:t.name,icon:r}})}}m(l,"type",i.upi),m(l,"txVariants",[i.upi,i.upi_qr,i.upi_intent]),m(l,"defaultProps",{showPaymentMethodItemImages:!0,countdownTime:p});export{l as default};
|
|
2
2
|
//# sourceMappingURL=UPI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UPI.js","sources":["../../../../src/components/UPI/UPI.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport UPIComponent from './components/UPIComponent';\nimport { Await } from '../internal/Await';\nimport { QRLoader } from '../internal/QRLoader';\nimport { UPIAppList, UPIConfiguration, UpiMode, UpiPaymentData, UpiType } from './types';\nimport { TxVariants } from '../tx-variants';\nimport isMobile from '../../utils/isMobile';\nimport { UPI_COUNTDOWN_TIME, UPI_MODE } from './constants';\nimport { PaymentMethodBrand } from '../../types/global-types';\nimport { ICore } from '../../types';\n\n/**\n * For mobile:\n * We should show upi_intent depending on if `apps` are returned in /paymentMethods response.\n *\n * For non-mobile:\n * We should never show the upi_intent (ignore `apps` in /paymentMethods response)\n * Show upi_qr as default\n */\n\nclass UPI extends UIElement<UPIConfiguration> {\n public static readonly type = TxVariants.upi;\n public static readonly txVariants = [TxVariants.upi, TxVariants.upi_qr, TxVariants.upi_intent];\n private readonly mode: UpiMode;\n private readonly appsList: UPIAppList;\n\n protected static readonly defaultProps = {\n showPaymentMethodItemImages: true,\n countdownTime: UPI_COUNTDOWN_TIME\n };\n\n constructor(checkout: ICore, props: UPIConfiguration) {\n super(checkout, props);\n const { apps = [] } = this.props;\n const hasIntentApps = apps.length > 0;\n\n this.mode = isMobile() && hasIntentApps ? UPI_MODE.INTENT : UPI_MODE.QR_CODE;\n\n this.appsList = apps.map(app => {\n const imageName = `upi/${app.id.toLowerCase()}`;\n const brandIcon = this.core.modules.resources?.getImage()(imageName) ?? '';\n return { id: app.id, name: app.name, icon: brandIcon };\n });\n }\n\n protected formatProps(props: UPIConfiguration): UPIConfiguration {\n return {\n showOtherInsteadOfNumber: !isMobile(),\n ...props\n };\n }\n\n public get isValid(): boolean {\n return this.state.isValid;\n }\n\n public formatData(): UpiPaymentData {\n const { app } = this.state.data || {};\n\n return {\n paymentMethod: {\n type: this.paymentType,\n ...(this.paymentType === TxVariants.upi_intent && app?.id && { appId: app.id })\n }\n };\n }\n\n get brands(): PaymentMethodBrand[] {\n const { showPaymentMethodItemImages } = this.props;\n\n if (!showPaymentMethodItemImages) {\n return [];\n }\n\n return this.appsList.map(app => ({ icon: app.icon, name: app.name }));\n }\n\n get paymentType(): UpiType {\n if (this.mode === UPI_MODE.QR_CODE) {\n return TxVariants.upi_qr;\n }\n return TxVariants.upi_intent;\n }\n\n protected override componentToRender(): h.JSX.Element {\n const { type, url, paymentMethodType } = this.props;\n\n const isAutoPay = !!this.props.mandate;\n\n switch (type) {\n case 'qrCode':\n return (\n <QRLoader\n {...this.props}\n qrCodeData={this.props.qrCodeData ? encodeURIComponent(this.props.qrCodeData) : undefined}\n type={TxVariants.upi_qr}\n brandLogo={this.props.brandLogo || this.icon}\n onComplete={this.onComplete}\n introduction={this.props.i18n?.get('upi.qrCodeWaitingMessage') ?? ''}\n countdownTime={this.props.countdownTime}\n onActionHandled={this.onActionHandled}\n showAmount={!isAutoPay}\n />\n );\n case 'await':\n return (\n <Await\n url={url}\n type={paymentMethodType ?? ''}\n showCountdownTimer\n shouldRedirectAutomatically\n showAmount={!isAutoPay}\n countdownTime={this.props.countdownTime}\n clientKey={this.props.clientKey ?? ''}\n paymentData={this.props.paymentData}\n onActionHandled={this.onActionHandled}\n onError={this.props.onError}\n messageText={this.props.i18n?.get('upi.vpaWaitingMessage') ?? ''}\n awaitText={this.props.i18n?.get('await.waitForConfirmation') ?? ''}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n />\n );\n default:\n return (\n <UPIComponent\n setComponentRef={this.setComponentRef}\n payButton={this.payButton}\n onChange={this.setState}\n appsList={this.appsList}\n mode={this.mode}\n showPayButton={this.props.showPayButton ?? true}\n mandate={this.props.mandate}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n }\n}\n\nexport default UPI;\n"],"names":["UPI","UIElement","formatProps","props","_object_spread","showOtherInsteadOfNumber","isMobile","isValid","this","state","formatData","app","data","paymentMethod","type","paymentType","TxVariants","upi_intent","id","appId","brands","showPaymentMethodItemImages","appsList","map","icon","name","mode","UPI_MODE","QR_CODE","upi_qr","componentToRender","url","paymentMethodType","isAutoPay","mandate","_this_props_i18n","h","QRLoader","qrCodeData","encodeURIComponent","undefined","brandLogo","onComplete","introduction","_ref","i18n","get","countdownTime","onActionHandled","showAmount","_this_props_clientKey","_ref1","_ref2","_this_props_i18n1","_this_props_i18n2","Await","showCountdownTimer","shouldRedirectAutomatically","clientKey","paymentData","onError","messageText","awaitText","_this_props_showPayButton","UPIComponent","setComponentRef","payButton","onChange","setState","showPayButton","onSubmitAnalytics","submitAnalytics","constructor","checkout","super","_define_property","apps","hasIntentApps","length","INTENT","_this_core_modules_resources","imageName","toLowerCase","brandIcon","core","modules","resources","getImage","upi","txVariants","defaultProps","UPI_COUNTDOWN_TIME"],"mappings":"m9CAqBA,MAAMA,UAAYC,EAyBJC,WAAAA,CAAYC,GAClB,OAAOC,EAAA,CACHC,0BAA2BC,KACxBH,EAEX,CAEA,WAAWI,GACP,OAAOC,KAAKC,MAAMF,OACtB,CAEOG,UAAAA,GACH,MAAMC,IAAEA,GAAQH,KAAKC,MAAMG,MAAQ,CAAA,EAEnC,MAAO,CACHC,cAAeT,EAAA,CACXU,KAAMN,KAAKO,aACPP,KAAKO,cAAgBC,EAAWC,aAAcN,aAAAA,EAAAA,EAAKO,KAAM,CAAEC,MAAOR,EAAIO,KAGtF,CAEA,UAAIE,GACA,MAAMC,4BAAEA,GAAgCb,KAAKL,MAE7C,OAAKkB,EAIEb,KAAKc,SAASC,IAAIZ,KAAUa,KAAMb,EAAIa,KAAMC,KAAMd,EAAIc,QAHlD,EAIf,CAEA,eAAIV,GACA,OAAIP,KAAKkB,OAASC,EAASC,QAChBZ,EAAWa,OAEfb,EAAWC,UACtB,CAEmBa,iBAAAA,GACf,MAAMhB,KAAEA,EAAIiB,IAAEA,EAAGC,kBAAEA,GAAsBxB,KAAKL,MAExC8B,IAAczB,KAAKL,MAAM+B,QAE/B,OAAQpB,GACJ,IAAK,
|
|
1
|
+
{"version":3,"file":"UPI.js","sources":["../../../../src/components/UPI/UPI.tsx"],"sourcesContent":["import { h } from 'preact';\nimport UIElement from '../internal/UIElement/UIElement';\nimport UPIComponent from './components/UPIComponent';\nimport { Await } from '../internal/Await';\nimport { QRLoader } from '../internal/QRLoader';\nimport { UPIAppList, UPIConfiguration, UpiMode, UpiPaymentData, UpiType } from './types';\nimport { TxVariants } from '../tx-variants';\nimport isMobile from '../../utils/isMobile';\nimport { UPI_COUNTDOWN_TIME, UPI_MODE } from './constants';\nimport { PaymentMethodBrand } from '../../types/global-types';\nimport { ICore } from '../../types';\n\n/**\n * For mobile:\n * We should show upi_intent depending on if `apps` are returned in /paymentMethods response.\n *\n * For non-mobile:\n * We should never show the upi_intent (ignore `apps` in /paymentMethods response)\n * Show upi_qr as default\n */\n\nclass UPI extends UIElement<UPIConfiguration> {\n public static readonly type = TxVariants.upi;\n public static readonly txVariants = [TxVariants.upi, TxVariants.upi_qr, TxVariants.upi_intent];\n private readonly mode: UpiMode;\n private readonly appsList: UPIAppList;\n\n protected static readonly defaultProps = {\n showPaymentMethodItemImages: true,\n countdownTime: UPI_COUNTDOWN_TIME\n };\n\n constructor(checkout: ICore, props: UPIConfiguration) {\n super(checkout, props);\n const { apps = [] } = this.props;\n const hasIntentApps = apps.length > 0;\n\n this.mode = isMobile() && hasIntentApps ? UPI_MODE.INTENT : UPI_MODE.QR_CODE;\n\n this.appsList = apps.map(app => {\n const imageName = `upi/${app.id.toLowerCase()}`;\n const brandIcon = this.core.modules.resources?.getImage()(imageName) ?? '';\n return { id: app.id, name: app.name, icon: brandIcon };\n });\n }\n\n protected formatProps(props: UPIConfiguration): UPIConfiguration {\n return {\n showOtherInsteadOfNumber: !isMobile(),\n ...props\n };\n }\n\n public get isValid(): boolean {\n return this.state.isValid;\n }\n\n public formatData(): UpiPaymentData {\n const { app } = this.state.data || {};\n\n return {\n paymentMethod: {\n type: this.paymentType,\n ...(this.paymentType === TxVariants.upi_intent && app?.id && { appId: app.id })\n }\n };\n }\n\n get brands(): PaymentMethodBrand[] {\n const { showPaymentMethodItemImages } = this.props;\n\n if (!showPaymentMethodItemImages) {\n return [];\n }\n\n return this.appsList.map(app => ({ icon: app.icon, name: app.name }));\n }\n\n get paymentType(): UpiType {\n if (this.mode === UPI_MODE.QR_CODE) {\n return TxVariants.upi_qr;\n }\n return TxVariants.upi_intent;\n }\n\n protected override componentToRender(): h.JSX.Element {\n const { type, url, paymentMethodType } = this.props;\n\n const isAutoPay = !!this.props.mandate;\n\n switch (type) {\n case 'qrCode':\n return (\n <QRLoader\n {...this.props}\n qrCodeData={this.props.qrCodeData ? encodeURIComponent(this.props.qrCodeData) : undefined}\n type={TxVariants.upi_qr}\n brandLogo={this.props.brandLogo || this.icon}\n brandName={this.displayName}\n onComplete={this.onComplete}\n introduction={this.props.i18n?.get('upi.qrCodeWaitingMessage') ?? ''}\n countdownTime={this.props.countdownTime}\n onActionHandled={this.onActionHandled}\n showAmount={!isAutoPay}\n />\n );\n case 'await':\n return (\n <Await\n url={url}\n type={paymentMethodType ?? ''}\n showCountdownTimer\n shouldRedirectAutomatically\n showAmount={!isAutoPay}\n countdownTime={this.props.countdownTime}\n clientKey={this.props.clientKey ?? ''}\n paymentData={this.props.paymentData}\n onActionHandled={this.onActionHandled}\n onError={this.props.onError}\n messageText={this.props.i18n?.get('upi.vpaWaitingMessage') ?? ''}\n awaitText={this.props.i18n?.get('await.waitForConfirmation') ?? ''}\n onComplete={this.onComplete}\n brandLogo={this.icon}\n brandName={this.displayName}\n />\n );\n default:\n return (\n <UPIComponent\n setComponentRef={this.setComponentRef}\n payButton={this.payButton}\n onChange={this.setState}\n appsList={this.appsList}\n mode={this.mode}\n showPayButton={this.props.showPayButton ?? true}\n mandate={this.props.mandate}\n onSubmitAnalytics={this.submitAnalytics}\n />\n );\n }\n }\n}\n\nexport default UPI;\n"],"names":["UPI","UIElement","formatProps","props","_object_spread","showOtherInsteadOfNumber","isMobile","isValid","this","state","formatData","app","data","paymentMethod","type","paymentType","TxVariants","upi_intent","id","appId","brands","showPaymentMethodItemImages","appsList","map","icon","name","mode","UPI_MODE","QR_CODE","upi_qr","componentToRender","url","paymentMethodType","isAutoPay","mandate","_this_props_i18n","h","QRLoader","qrCodeData","encodeURIComponent","undefined","brandLogo","brandName","displayName","onComplete","introduction","_ref","i18n","get","countdownTime","onActionHandled","showAmount","_this_props_clientKey","_ref1","_ref2","_this_props_i18n1","_this_props_i18n2","Await","showCountdownTimer","shouldRedirectAutomatically","clientKey","paymentData","onError","messageText","awaitText","_this_props_showPayButton","UPIComponent","setComponentRef","payButton","onChange","setState","showPayButton","onSubmitAnalytics","submitAnalytics","constructor","checkout","super","_define_property","apps","hasIntentApps","length","INTENT","_this_core_modules_resources","imageName","toLowerCase","brandIcon","core","modules","resources","getImage","upi","txVariants","defaultProps","UPI_COUNTDOWN_TIME"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"../../../_virtual/index.js";import{createElement as e}from"../../../external/preact/dist/preact.js";import{useEffect as a}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";import{usePaymentStatusTimer as n}from"../../../hooks/usePaymentStatusTimer/usePaymentStatusTimer.js";import{DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS as i,DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS as r,DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS as s,DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN as
|
|
1
|
+
import t from"../../../_virtual/index.js";import{createElement as e}from"../../../external/preact/dist/preact.js";import{useEffect as a}from"../../../external/preact/hooks/dist/hooks.js";import{useCoreContext as o}from"../../../core/Context/CoreProvider.js";import{usePaymentStatusTimer as n}from"../../../hooks/usePaymentStatusTimer/usePaymentStatusTimer.js";import{DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_INTERVAL_MS as i,DEFAULT_PAYMENT_STATUS_TIMER_THROTTLE_TIME_MS as r,DEFAULT_PAYMENT_STATUS_TIMER_DELAY_MS as s,DEFAULT_PAYMENT_STATUS_TIMER_COUNTDOWN_TIME_MIN as l}from"../../../hooks/usePaymentStatusTimer/constants.js";import c from"../Spinner/Spinner.js";import m from"../Button/Button.js";import d from"../ContentSeparator/ContentSeparator.js";import u from"../Countdown/index.js";import{AwaitFinalState as _}from"./components/AwaitFinalState.js";import{redirectToApp as p}from"../../../utils/urls.js";import{useAmount as y}from"../../../core/Context/AmountProvider.js";import{useA11yReporter as h}from"../../../core/Errors/useA11yReporter.js";function w(i){var r,s;const{i18n:l,loadingContext:w}=o();h(i.awaitText);const{state:v,actions:g}=n({loadingContext:w,paymentData:i.paymentData,clientKey:i.clientKey,delay:i.delay,throttleTime:i.throttleTime,throttleInterval:i.throttleInterval,type:i.type,onError:i.onError,onComplete:i.onComplete,pollStatus:i.pollStatus,onActionHandled:i.onActionHandled}),{completed:k,expired:f,loading:N,percentage:T}=v,{onTick:C,onTimeUp:x}=g,{amount:j}=y();if(a(()=>{i.shouldRedirectAutomatically&&i.url&&p(i.url)},[i.shouldRedirectAutomatically,i.url]),f)return e(_,{image:"error",message:l.get("error.subtitle.payment")});if(k)return e(_,{image:"success",message:l.get("creditCard.success")});var S;if(N)return e("div",{className:"adyen-checkout__await"},i.brandLogo&&e("img",{src:i.brandLogo,alt:null!==(S=i.brandName)&&void 0!==S?S:i.type,className:"adyen-checkout__await__brand-logo"}),e(c,{inline:!1,size:"large"}));const b=l.get("wechatpay.timetopay").split("%@");return e("div",{className:t("adyen-checkout__await",`adyen-checkout__await--${i.type}`,i.classNameModifiers.map(t=>`adyen-checkout__await--${t}`))},i.brandLogo&&e("img",{src:i.brandLogo,alt:null!==(r=i.brandName)&&void 0!==r?r:i.type,className:"adyen-checkout__await__brand-logo"}),!(!i.showAmount||null===(null==j?void 0:j.value)||!(null==j?void 0:j.currency))&&e("div",{className:"adyen-checkout__await__amount"},l.amount(j.value,j.currency)),null!=i.messageText&&e("div",{className:"adyen-checkout__await__subtitle"},i.messageText),e("div",{className:"adyen-checkout__await__indicator-holder"},e("div",{className:"adyen-checkout__await__indicator-spinner"},e(c,{inline:!1,size:"medium"})),e("div",{className:"adyen-checkout__await__indicator-text"},i.awaitText)),i.showCountdownTimer&&e("div",{className:"adyen-checkout__await__countdown-holder"},e("div",{className:"adyen-checkout__await__progress"},e("span",{className:"adyen-checkout__await__percentage",style:{width:`${T}%`}})),e("div",{className:"adyen-checkout__await__countdown"},b[0]," ",e(u,{minutesFromNow:i.countdownTime,onTick:C,onCompleted:x})," ",b[1])),i.url&&!i.shouldRedirectAutomatically&&e("div",{className:"adyen-checkout__await__app-link"},e(d,null),e(m,{classNameModifiers:["await"],onClick:()=>p(i.url),label:l.get("openApp")})),i.instructions&&e("div",{className:"adyen-checkout__await__instructions"},"string"==typeof i.instructions?l.get(i.instructions):null===(s=i.instructions)||void 0===s?void 0:s.call(i)),i.endSlot&&e("div",{className:"adyen-checkout__await__end-slot"},i.endSlot()))}w.defaultProps={countdownTime:l,delay:s,throttleTime:r,throttleInterval:i,onError:()=>{},onComplete:()=>{},showCountdownTimer:!0,classNameModifiers:[],url:null};export{w as Await};
|
|
2
2
|
//# sourceMappingURL=Await.js.map
|