airwallex-payment-elements
Advanced tools
Comparing version 0.0.52 to 0.0.53
@@ -1,77 +0,2 @@ | ||
import { LitElement } from 'lit-element'; | ||
export declare class Airwallex extends LitElement { | ||
gatewayBaseurl: string; | ||
clientSecret: string; | ||
currency: string; | ||
intentId: string; | ||
customerId: string; | ||
successUrl: string; | ||
cancelUrl: string; | ||
errorUrl: string; | ||
enable3dSecure: string; | ||
autoCapture: string; | ||
component: string; | ||
theme: object; | ||
height: number; | ||
constructor(); | ||
static readonly properties: { | ||
gatewayBaseurl: { | ||
type: StringConstructor; | ||
reflect: boolean; | ||
}; | ||
clientSecret: { | ||
type: StringConstructor; | ||
reflect: boolean; | ||
}; | ||
currency: { | ||
type: StringConstructor; | ||
reflect: boolean; | ||
}; | ||
intentId: { | ||
type: StringConstructor; | ||
reflect: boolean; | ||
}; | ||
customerId: { | ||
type: StringConstructor; | ||
reflect: boolean; | ||
}; | ||
successUrl: { | ||
type: StringConstructor; | ||
reflect: boolean; | ||
}; | ||
cancelUrl: { | ||
type: StringConstructor; | ||
reflect: boolean; | ||
}; | ||
errorUrl: { | ||
type: StringConstructor; | ||
reflect: boolean; | ||
}; | ||
enable3dSecure: { | ||
type: StringConstructor; | ||
reflect: boolean; | ||
}; | ||
autoCapture: { | ||
type: StringConstructor; | ||
reflect: boolean; | ||
}; | ||
component: { | ||
type: StringConstructor; | ||
reflect: boolean; | ||
}; | ||
theme: { | ||
type: ObjectConstructor; | ||
reflect: boolean; | ||
}; | ||
height: { | ||
type: NumberConstructor; | ||
hasChanged(): boolean; | ||
}; | ||
}; | ||
static readonly styles: import("lit-element").CSSResult; | ||
handleEvent(data: any): void; | ||
checkoutEventHandler(event: any): void; | ||
connectedCallback(): void; | ||
disconnectedCallback(): void; | ||
render(): any; | ||
} | ||
import { init, createElement, getElement, destroyElement, confirmPaymentIntent, createPaymentMethod, getPaymentIntent } from './airwallex'; | ||
export { init, createElement, getElement, destroyElement, confirmPaymentIntent, createPaymentMethod, getPaymentIntent }; |
@@ -1,116 +0,5 @@ | ||
import { css, html, LitElement } from 'lit-element'; | ||
const CHECKOUT_IFRAME_NAME = 'airwallex_checkout_frame'; | ||
export class Airwallex extends LitElement { | ||
constructor() { | ||
super(); | ||
this.gatewayBaseurl = this.clientSecret = this.currency = this.intentId = this.customerId = ''; | ||
this.successUrl = this.cancelUrl = this.errorUrl = this.autoCapture = this.enable3dSecure = this.component = ''; | ||
this.theme = {}; | ||
this.height = 0; | ||
} | ||
static get properties() { | ||
return { | ||
gatewayBaseurl: { type: String, reflect: true }, | ||
clientSecret: { type: String, reflect: true }, | ||
currency: { type: String, reflect: true }, | ||
intentId: { type: String, reflect: true }, | ||
customerId: { type: String, reflect: true }, | ||
successUrl: { type: String, reflect: true }, | ||
cancelUrl: { type: String, reflect: true }, | ||
errorUrl: { type: String, reflect: true }, | ||
enable3dSecure: { type: String, reflect: true }, | ||
autoCapture: { type: String, reflect: true }, | ||
component: { type: String, reflect: true }, | ||
theme: { type: Object, reflect: true }, | ||
height: { | ||
type: Number, | ||
hasChanged() { | ||
return true; | ||
} | ||
} | ||
}; | ||
} | ||
static get styles() { | ||
return css ` | ||
:host { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
`; | ||
} | ||
handleEvent(data) { | ||
console.info(`Airwallex Checkout Message: [${JSON.stringify(data)}]`); | ||
const event = new CustomEvent('airwallex-checkout', { | ||
detail: data, | ||
bubbles: true, | ||
composed: true | ||
}); | ||
this.dispatchEvent(event); | ||
} | ||
checkoutEventHandler(event) { | ||
if (event.origin === this.gatewayBaseurl && event.isTrusted) { | ||
const { style, ...rest } = event.data; | ||
this.height = ((style && style.height) || 0) + 8; | ||
if (event.data.code !== 'AWX_CHECKOUT_STYLE') { | ||
this.handleEvent(rest); | ||
} | ||
if (event.data.code === 'AWX_CHECKOUT_SUCCESS') { | ||
const status = event.data.status ? `status=${event.data.status}` : ''; | ||
const intentId = event.data.id ? `&intentId=${event.data.id}` : ''; | ||
const parameters = `${status}${intentId}`; | ||
if (this.successUrl) { | ||
window.location.href = | ||
this.successUrl.indexOf('?') === -1 | ||
? `${this.successUrl}?${parameters}` | ||
: `${this.successUrl}&${parameters}`; | ||
} | ||
} | ||
else if (event.data.code === 'AWX_CHECKOUT_CANCEL') { | ||
if (this.cancelUrl) { | ||
window.location.href = this.cancelUrl; | ||
} | ||
} | ||
else if (event.data.code === 'AWX_CHECKOUT_ERROR') { | ||
if (this.errorUrl) { | ||
window.location.href = this.errorUrl; | ||
} | ||
} | ||
else { | ||
} | ||
this.requestUpdate(); | ||
} | ||
} | ||
connectedCallback() { | ||
super.connectedCallback(); | ||
window.addEventListener('message', (event) => this.checkoutEventHandler(event)); | ||
} | ||
disconnectedCallback() { | ||
window.removeEventListener('message', (event) => this.checkoutEventHandler(event)); | ||
super.disconnectedCallback(); | ||
} | ||
render() { | ||
return html ` | ||
<style> | ||
iframe { | ||
width: 100%; | ||
background: white; | ||
height: ${this.height}px; | ||
} | ||
</style> | ||
<iframe | ||
frameborder="0" | ||
allowtransparency="true" | ||
importance="high" | ||
scrolling="no" | ||
name="${CHECKOUT_IFRAME_NAME}" | ||
allowpaymentrequest="true" | ||
src="${this.gatewayBaseurl}/checkout/${this.intentId}?origin=${window.location.origin}&customerId=${this | ||
.customerId}¤cy=${this.currency}&theme=${encodeURIComponent(JSON.stringify(this.theme))}&autoCapture=${this.autoCapture}&component=${this.component}&enable3dSecure=${this | ||
.enable3dSecure}&clientSecret=${encodeURIComponent(this.clientSecret)}" | ||
title="Secured airwallex payment frame" | ||
/> | ||
`; | ||
} | ||
} | ||
customElements.define('airwallex-element', Airwallex); | ||
import DropIn from './dropIn'; | ||
import { init, createElement, getElement, destroyElement, confirmPaymentIntent, createPaymentMethod, getPaymentIntent, } from './airwallex'; | ||
customElements.define('airwallex-element', DropIn); | ||
export { init, createElement, getElement, destroyElement, confirmPaymentIntent, createPaymentMethod, getPaymentIntent }; | ||
//# sourceMappingURL=index.js.map |
@@ -1,27 +0,4 @@ | ||
/* Airwallex Checkout Component Version [0.0.52] */ | ||
"use strict";const directives=new WeakMap,isDirective=e=>"function"==typeof e&&directives.has(e),isCEPolyfill=void 0!==window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,removeNodes=(e,t,s=null)=>{for(;t!==s;){const s=t.nextSibling;e.removeChild(t),t=s}},noChange={},nothing={},marker=`{{lit-${String(Math.random()).slice(2)}}}`,nodeMarker=`\x3c!--${marker}--\x3e`,markerRegex=new RegExp(`${marker}|${nodeMarker}`),boundAttributeSuffix="$lit$";class Template{constructor(e,t){this.parts=[],this.element=t;const s=[],r=[],i=document.createTreeWalker(t.content,133,null,!1);let n=0,o=-1,a=0;const{strings:l,values:{length:c}}=e;for(;a<c;){const e=i.nextNode();if(null!==e){if(o++,1===e.nodeType){if(e.hasAttributes()){const t=e.attributes,{length:s}=t;let r=0;for(let e=0;e<s;e++)endsWith(t[e].name,boundAttributeSuffix)&&r++;for(;r-- >0;){const t=l[a],s=lastAttributeNameRegex.exec(t)[2],r=s.toLowerCase()+boundAttributeSuffix,i=e.getAttribute(r);e.removeAttribute(r);const n=i.split(markerRegex);this.parts.push({type:"attribute",index:o,name:s,strings:n}),a+=n.length-1}}"TEMPLATE"===e.tagName&&(r.push(e),i.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(marker)>=0){const r=e.parentNode,i=t.split(markerRegex),n=i.length-1;for(let t=0;t<n;t++){let s,n=i[t];if(""===n)s=createMarker();else{const e=lastAttributeNameRegex.exec(n);null!==e&&endsWith(e[2],boundAttributeSuffix)&&(n=n.slice(0,e.index)+e[1]+e[2].slice(0,-boundAttributeSuffix.length)+e[3]),s=document.createTextNode(n)}r.insertBefore(s,e),this.parts.push({type:"node",index:++o})}""===i[n]?(r.insertBefore(createMarker(),e),s.push(e)):e.data=i[n],a+=n}}else if(8===e.nodeType)if(e.data===marker){const t=e.parentNode;null!==e.previousSibling&&o!==n||(o++,t.insertBefore(createMarker(),e)),n=o,this.parts.push({type:"node",index:o}),null===e.nextSibling?e.data="":(s.push(e),o--),a++}else{let t=-1;for(;-1!==(t=e.data.indexOf(marker,t+1));)this.parts.push({type:"node",index:-1}),a++}}else i.currentNode=r.pop()}for(const e of s)e.parentNode.removeChild(e)}}const endsWith=(e,t)=>{const s=e.length-t.length;return s>=0&&e.slice(s)===t},isTemplatePartActive=e=>-1!==e.index,createMarker=()=>document.createComment(""),lastAttributeNameRegex=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;class TemplateInstance{constructor(e,t,s){this.__parts=[],this.template=e,this.processor=t,this.options=s}update(e){let t=0;for(const s of this.__parts)void 0!==s&&s.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=isCEPolyfill?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],s=this.template.parts,r=document.createTreeWalker(e,133,null,!1);let i,n=0,o=0,a=r.nextNode();for(;n<s.length;)if(i=s[n],isTemplatePartActive(i)){for(;o<i.index;)o++,"TEMPLATE"===a.nodeName&&(t.push(a),r.currentNode=a.content),null===(a=r.nextNode())&&(r.currentNode=t.pop(),a=r.nextNode());if("node"===i.type){const e=this.processor.handleTextExpression(this.options);e.insertAfterNode(a.previousSibling),this.__parts.push(e)}else this.__parts.push(...this.processor.handleAttributeExpressions(a,i.name,i.strings,this.options));n++}else this.__parts.push(void 0),n++;return isCEPolyfill&&(document.adoptNode(e),customElements.upgrade(e)),e}}const commentMarker=` ${marker} `;class TemplateResult{constructor(e,t,s,r){this.strings=e,this.values=t,this.type=s,this.processor=r}getHTML(){const e=this.strings.length-1;let t="",s=!1;for(let r=0;r<e;r++){const e=this.strings[r],i=e.lastIndexOf("\x3c!--");s=(i>-1||s)&&-1===e.indexOf("--\x3e",i+1);const n=lastAttributeNameRegex.exec(e);t+=null===n?e+(s?commentMarker:nodeMarker):e.substr(0,n.index)+n[1]+n[2]+boundAttributeSuffix+n[3]+marker}return t+=this.strings[e]}getTemplateElement(){const e=document.createElement("template");return e.innerHTML=this.getHTML(),e}}const isPrimitive=e=>null===e||!("object"==typeof e||"function"==typeof e),isIterable=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class AttributeCommitter{constructor(e,t,s){this.dirty=!0,this.element=e,this.name=t,this.strings=s,this.parts=[];for(let e=0;e<s.length-1;e++)this.parts[e]=this._createPart()}_createPart(){return new AttributePart(this)}_getValue(){const e=this.strings,t=e.length-1;let s="";for(let r=0;r<t;r++){s+=e[r];const t=this.parts[r];if(void 0!==t){const e=t.value;if(isPrimitive(e)||!isIterable(e))s+="string"==typeof e?e:String(e);else for(const t of e)s+="string"==typeof t?t:String(t)}}return s+=e[t]}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class AttributePart{constructor(e){this.value=void 0,this.committer=e}setValue(e){e===noChange||isPrimitive(e)&&e===this.value||(this.value=e,isDirective(e)||(this.committer.dirty=!0))}commit(){for(;isDirective(this.value);){const e=this.value;this.value=noChange,e(this)}this.value!==noChange&&this.committer.commit()}}class NodePart{constructor(e){this.value=void 0,this.__pendingValue=void 0,this.options=e}appendInto(e){this.startNode=e.appendChild(createMarker()),this.endNode=e.appendChild(createMarker())}insertAfterNode(e){this.startNode=e,this.endNode=e.nextSibling}appendIntoPart(e){e.__insert(this.startNode=createMarker()),e.__insert(this.endNode=createMarker())}insertAfterPart(e){e.__insert(this.startNode=createMarker()),this.endNode=e.endNode,e.endNode=this.startNode}setValue(e){this.__pendingValue=e}commit(){for(;isDirective(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=noChange,e(this)}const e=this.__pendingValue;e!==noChange&&(isPrimitive(e)?e!==this.value&&this.__commitText(e):e instanceof TemplateResult?this.__commitTemplateResult(e):e instanceof Node?this.__commitNode(e):isIterable(e)?this.__commitIterable(e):e===nothing?(this.value=nothing,this.clear()):this.__commitText(e))}__insert(e){this.endNode.parentNode.insertBefore(e,this.endNode)}__commitNode(e){this.value!==e&&(this.clear(),this.__insert(e),this.value=e)}__commitText(e){const t=this.startNode.nextSibling,s="string"==typeof(e=null==e?"":e)?e:String(e);t===this.endNode.previousSibling&&3===t.nodeType?t.data=s:this.__commitNode(document.createTextNode(s)),this.value=e}__commitTemplateResult(e){const t=this.options.templateFactory(e);if(this.value instanceof TemplateInstance&&this.value.template===t)this.value.update(e.values);else{const s=new TemplateInstance(t,e.processor,this.options),r=s._clone();s.update(e.values),this.__commitNode(r),this.value=s}}__commitIterable(e){Array.isArray(this.value)||(this.value=[],this.clear());const t=this.value;let s,r=0;for(const i of e)void 0===(s=t[r])&&(s=new NodePart(this.options),t.push(s),0===r?s.appendIntoPart(this):s.insertAfterPart(t[r-1])),s.setValue(i),s.commit(),r++;r<t.length&&(t.length=r,this.clear(s&&s.endNode))}clear(e=this.startNode){removeNodes(this.startNode.parentNode,e.nextSibling,this.endNode)}}class BooleanAttributePart{constructor(e,t,s){if(this.value=void 0,this.__pendingValue=void 0,2!==s.length||""!==s[0]||""!==s[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=s}setValue(e){this.__pendingValue=e}commit(){for(;isDirective(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=noChange,e(this)}if(this.__pendingValue===noChange)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=noChange}}class PropertyCommitter extends AttributeCommitter{constructor(e,t,s){super(e,t,s),this.single=2===s.length&&""===s[0]&&""===s[1]}_createPart(){return new PropertyPart(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class PropertyPart extends AttributePart{}let eventOptionsSupported=!1;try{const e={get capture(){return eventOptionsSupported=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}class EventPart{constructor(e,t,s){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=s,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;isDirective(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=noChange,e(this)}if(this.__pendingValue===noChange)return;const e=this.__pendingValue,t=this.value,s=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),r=null!=e&&(null==t||s);s&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),r&&(this.__options=getOptions(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=noChange}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const getOptions=e=>e&&(eventOptionsSupported?{capture:e.capture,passive:e.passive,once:e.once}:e.capture);class DefaultTemplateProcessor{handleAttributeExpressions(e,t,s,r){const i=t[0];if("."===i){return new PropertyCommitter(e,t.slice(1),s).parts}return"@"===i?[new EventPart(e,t.slice(1),r.eventContext)]:"?"===i?[new BooleanAttributePart(e,t.slice(1),s)]:new AttributeCommitter(e,t,s).parts}handleTextExpression(e){return new NodePart(e)}}const defaultTemplateProcessor=new DefaultTemplateProcessor;function templateFactory(e){let t=templateCaches.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},templateCaches.set(e.type,t));let s=t.stringsArray.get(e.strings);if(void 0!==s)return s;const r=e.strings.join(marker);return void 0===(s=t.keyString.get(r))&&(s=new Template(e,e.getTemplateElement()),t.keyString.set(r,s)),t.stringsArray.set(e.strings,s),s}const templateCaches=new Map,parts=new WeakMap,render=(e,t,s)=>{let r=parts.get(t);void 0===r&&(removeNodes(t,t.firstChild),parts.set(t,r=new NodePart(Object.assign({templateFactory:templateFactory},s))),r.appendInto(t)),r.setValue(e),r.commit()};(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.1.2");const html=(e,...t)=>new TemplateResult(e,t,"html",defaultTemplateProcessor),walkerNodeFilter=133;function removeNodesFromTemplate(e,t){const{element:{content:s},parts:r}=e,i=document.createTreeWalker(s,walkerNodeFilter,null,!1);let n=nextActiveIndexInTemplateParts(r),o=r[n],a=-1,l=0;const c=[];let h=null;for(;i.nextNode();){a++;const e=i.currentNode;for(e.previousSibling===h&&(h=null),t.has(e)&&(c.push(e),null===h&&(h=e)),null!==h&&l++;void 0!==o&&o.index===a;)o.index=null!==h?-1:o.index-l,o=r[n=nextActiveIndexInTemplateParts(r,n)]}c.forEach(e=>e.parentNode.removeChild(e))}const countNodes=e=>{let t=11===e.nodeType?0:1;const s=document.createTreeWalker(e,walkerNodeFilter,null,!1);for(;s.nextNode();)t++;return t},nextActiveIndexInTemplateParts=(e,t=-1)=>{for(let s=t+1;s<e.length;s++){const t=e[s];if(isTemplatePartActive(t))return s}return-1};function insertNodeIntoTemplate(e,t,s=null){const{element:{content:r},parts:i}=e;if(null==s)return void r.appendChild(t);const n=document.createTreeWalker(r,walkerNodeFilter,null,!1);let o=nextActiveIndexInTemplateParts(i),a=0,l=-1;for(;n.nextNode();){for(l++,n.currentNode===s&&(a=countNodes(t),s.parentNode.insertBefore(t,s));-1!==o&&i[o].index===l;){if(a>0){for(;-1!==o;)i[o].index+=a,o=nextActiveIndexInTemplateParts(i,o);return}o=nextActiveIndexInTemplateParts(i,o)}}}const getTemplateCacheKey=(e,t)=>`${e}--${t}`;let compatibleShadyCSSVersion=!0;void 0===window.ShadyCSS?compatibleShadyCSSVersion=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),compatibleShadyCSSVersion=!1);const shadyTemplateFactory=e=>t=>{const s=getTemplateCacheKey(t.type,e);let r=templateCaches.get(s);void 0===r&&(r={stringsArray:new WeakMap,keyString:new Map},templateCaches.set(s,r));let i=r.stringsArray.get(t.strings);if(void 0!==i)return i;const n=t.strings.join(marker);if(void 0===(i=r.keyString.get(n))){const s=t.getTemplateElement();compatibleShadyCSSVersion&&window.ShadyCSS.prepareTemplateDom(s,e),i=new Template(t,s),r.keyString.set(n,i)}return r.stringsArray.set(t.strings,i),i},TEMPLATE_TYPES=["html","svg"],removeStylesFromLitTemplates=e=>{TEMPLATE_TYPES.forEach(t=>{const s=templateCaches.get(getTemplateCacheKey(t,e));void 0!==s&&s.keyString.forEach(e=>{const{element:{content:t}}=e,s=new Set;Array.from(t.querySelectorAll("style")).forEach(e=>{s.add(e)}),removeNodesFromTemplate(e,s)})})},shadyRenderSet=new Set,prepareTemplateStyles=(e,t,s)=>{shadyRenderSet.add(e);const r=s?s.element:document.createElement("template"),i=t.querySelectorAll("style"),{length:n}=i;if(0===n)return void window.ShadyCSS.prepareTemplateStyles(r,e);const o=document.createElement("style");for(let e=0;e<n;e++){const t=i[e];t.parentNode.removeChild(t),o.textContent+=t.textContent}removeStylesFromLitTemplates(e);const a=r.content;s?insertNodeIntoTemplate(s,o,a.firstChild):a.insertBefore(o,a.firstChild),window.ShadyCSS.prepareTemplateStyles(r,e);const l=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(s){a.insertBefore(o,a.firstChild);const e=new Set;e.add(o),removeNodesFromTemplate(s,e)}},render$1=(e,t,s)=>{if(!s||"object"!=typeof s||!s.scopeName)throw new Error("The `scopeName` option is required.");const r=s.scopeName,i=parts.has(t),n=compatibleShadyCSSVersion&&11===t.nodeType&&!!t.host,o=n&&!shadyRenderSet.has(r),a=o?document.createDocumentFragment():t;if(render(e,a,Object.assign({templateFactory:shadyTemplateFactory(r)},s)),o){const e=parts.get(a);parts.delete(a);const s=e.value instanceof TemplateInstance?e.value.template:void 0;prepareTemplateStyles(r,a,s),removeNodes(t,t.firstChild),t.appendChild(a),parts.set(t,e)}!i&&n&&window.ShadyCSS.styleElement(t.host)};var _a;window.JSCompiler_renameProperty=(e,t)=>e;const defaultConverter={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},notEqual=(e,t)=>t!==e&&(t==t||e==e),defaultPropertyDeclaration={attribute:!0,type:String,converter:defaultConverter,reflect:!1,hasChanged:notEqual},microtaskPromise=Promise.resolve(!0),STATE_HAS_UPDATED=1,STATE_UPDATE_REQUESTED=4,STATE_IS_REFLECTING_TO_ATTRIBUTE=8,STATE_IS_REFLECTING_TO_PROPERTY=16,STATE_HAS_CONNECTED=32,finalized="finalized";class UpdatingElement extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=microtaskPromise,this._hasConnectedResolver=void 0,this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,s)=>{const r=this._attributeNameForProperty(s,t);void 0!==r&&(this._attributeToPropertyMap.set(r,s),e.push(r))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e,t=defaultPropertyDeclaration){if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const s="symbol"==typeof e?Symbol():`__${e}`;Object.defineProperty(this.prototype,e,{get(){return this[s]},set(t){const r=this[e];this[s]=t,this._requestUpdate(e,r)},configurable:!0,enumerable:!0})}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(finalized)||e.finalize(),this[finalized]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const s of t)this.createProperty(s,e[s])}}static _attributeNameForProperty(e,t){const s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t,s=notEqual){return s(e,t)}static _propertyValueFromAttribute(e,t){const s=t.type,r=t.converter||defaultConverter,i="function"==typeof r?r:r.fromAttribute;return i?i(e,s):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const s=t.type,r=t.converter;return(r&&r.toAttribute||defaultConverter.toAttribute)(e,s)}initialize(){this._saveInstanceProperties(),this._requestUpdate()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this._updateState=this._updateState|STATE_HAS_CONNECTED,this._hasConnectedResolver&&(this._hasConnectedResolver(),this._hasConnectedResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,s){t!==s&&this._attributeToProperty(e,s)}_propertyToAttribute(e,t,s=defaultPropertyDeclaration){const r=this.constructor,i=r._attributeNameForProperty(e,s);if(void 0!==i){const e=r._propertyValueToAttribute(t,s);if(void 0===e)return;this._updateState=this._updateState|STATE_IS_REFLECTING_TO_ATTRIBUTE,null==e?this.removeAttribute(i):this.setAttribute(i,e),this._updateState=this._updateState&~STATE_IS_REFLECTING_TO_ATTRIBUTE}}_attributeToProperty(e,t){if(this._updateState&STATE_IS_REFLECTING_TO_ATTRIBUTE)return;const s=this.constructor,r=s._attributeToPropertyMap.get(e);if(void 0!==r){const e=s._classProperties.get(r)||defaultPropertyDeclaration;this._updateState=this._updateState|STATE_IS_REFLECTING_TO_PROPERTY,this[r]=s._propertyValueFromAttribute(t,e),this._updateState=this._updateState&~STATE_IS_REFLECTING_TO_PROPERTY}}_requestUpdate(e,t){let s=!0;if(void 0!==e){const r=this.constructor,i=r._classProperties.get(e)||defaultPropertyDeclaration;r._valueHasChanged(this[e],t,i.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==i.reflect||this._updateState&STATE_IS_REFLECTING_TO_PROPERTY||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,i))):s=!1}!this._hasRequestedUpdate&&s&&this._enqueueUpdate()}requestUpdate(e,t){return this._requestUpdate(e,t),this.updateComplete}async _enqueueUpdate(){let e,t;this._updateState=this._updateState|STATE_UPDATE_REQUESTED;const s=this._updatePromise;this._updatePromise=new Promise((s,r)=>{e=s,t=r});try{await s}catch(e){}this._hasConnected||await new Promise(e=>this._hasConnectedResolver=e);try{const e=this.performUpdate();null!=e&&await e}catch(e){t(e)}e(!this._hasRequestedUpdate)}get _hasConnected(){return this._updateState&STATE_HAS_CONNECTED}get _hasRequestedUpdate(){return this._updateState&STATE_UPDATE_REQUESTED}get hasUpdated(){return this._updateState&STATE_HAS_UPDATED}performUpdate(){this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{(e=this.shouldUpdate(t))&&this.update(t)}catch(t){throw e=!1,t}finally{this._markUpdated()}e&&(this._updateState&STATE_HAS_UPDATED||(this._updateState=this._updateState|STATE_HAS_UPDATED,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~STATE_UPDATE_REQUESTED}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0)}updated(e){}firstUpdated(e){}}UpdatingElement[_a=finalized]=!0;const supportsAdoptingStyleSheets="adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,constructionToken=Symbol();class CSSResult{constructor(e,t){if(t!==constructionToken)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){return void 0===this._styleSheet&&(supportsAdoptingStyleSheets?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const textFromCSSResult=e=>{if(e instanceof CSSResult)return e.cssText;if("number"==typeof e)return e;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`)},css=(e,...t)=>{const s=t.reduce((t,s,r)=>t+textFromCSSResult(s)+e[r+1],e[0]);return new CSSResult(s,constructionToken)};function arrayFlat(e,t=[]){for(let s=0,r=e.length;s<r;s++){const r=e[s];Array.isArray(r)?arrayFlat(r,t):t.push(r)}return t}(window.litElementVersions||(window.litElementVersions=[])).push("2.2.1");const flattenStyles=e=>e.flat?e.flat(1/0):arrayFlat(e);class LitElement extends UpdatingElement{static finalize(){super.finalize.call(this),this._styles=this.hasOwnProperty(JSCompiler_renameProperty("styles",this))?this._getUniqueStyles():this._styles||[]}static _getUniqueStyles(){const e=this.styles,t=[];if(Array.isArray(e)){flattenStyles(e).reduceRight((e,t)=>(e.add(t),e),new Set).forEach(e=>t.unshift(e))}else e&&t.push(e);return t}initialize(){super.initialize(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?supportsAdoptingStyleSheets?this.renderRoot.adoptedStyleSheets=e.map(e=>e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){super.update(e);const t=this.render();t instanceof TemplateResult&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){}}LitElement.finalized=!0,LitElement.render=render$1;const CHECKOUT_IFRAME_NAME="airwallex_checkout_frame";class Airwallex extends LitElement{constructor(){super(),this.gatewayBaseurl=this.clientSecret=this.currency=this.intentId=this.customerId="",this.successUrl=this.cancelUrl=this.errorUrl=this.autoCapture=this.enable3dSecure=this.component="",this.theme={},this.height=0}static get properties(){return{gatewayBaseurl:{type:String,reflect:!0},clientSecret:{type:String,reflect:!0},currency:{type:String,reflect:!0},intentId:{type:String,reflect:!0},customerId:{type:String,reflect:!0},successUrl:{type:String,reflect:!0},cancelUrl:{type:String,reflect:!0},errorUrl:{type:String,reflect:!0},enable3dSecure:{type:String,reflect:!0},autoCapture:{type:String,reflect:!0},component:{type:String,reflect:!0},theme:{type:Object,reflect:!0},height:{type:Number,hasChanged:()=>!0}}}static get styles(){return css` | ||
:host { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
`}handleEvent(e){console.info(`Airwallex Checkout Message: [${JSON.stringify(e)}]`);const t=new CustomEvent("airwallex-checkout",{detail:e,bubbles:!0,composed:!0});this.dispatchEvent(t)}checkoutEventHandler(e){if(e.origin===this.gatewayBaseurl&&e.isTrusted){const{style:t,...s}=e.data;if(this.height=(t&&t.height||0)+8,"AWX_CHECKOUT_STYLE"!==e.data.code&&this.handleEvent(s),"AWX_CHECKOUT_SUCCESS"===e.data.code){const t=`${e.data.status?`status=${e.data.status}`:""}${e.data.id?`&intentId=${e.data.id}`:""}`;this.successUrl&&(window.location.href=-1===this.successUrl.indexOf("?")?`${this.successUrl}?${t}`:`${this.successUrl}&${t}`)}else"AWX_CHECKOUT_CANCEL"===e.data.code?this.cancelUrl&&(window.location.href=this.cancelUrl):"AWX_CHECKOUT_ERROR"===e.data.code&&this.errorUrl&&(window.location.href=this.errorUrl);this.requestUpdate()}}connectedCallback(){super.connectedCallback(),window.addEventListener("message",e=>this.checkoutEventHandler(e))}disconnectedCallback(){window.removeEventListener("message",e=>this.checkoutEventHandler(e)),super.disconnectedCallback()}render(){return html` | ||
<style> | ||
iframe { | ||
width: 100%; | ||
background: white; | ||
height: ${this.height}px; | ||
} | ||
</style> | ||
<iframe | ||
frameborder="0" | ||
allowtransparency="true" | ||
importance="high" | ||
scrolling="no" | ||
name="${CHECKOUT_IFRAME_NAME}" | ||
allowpaymentrequest="true" | ||
src="${this.gatewayBaseurl}/checkout/${this.intentId}?origin=${window.location.origin}&customerId=${this.customerId}¤cy=${this.currency}&theme=${encodeURIComponent(JSON.stringify(this.theme))}&autoCapture=${this.autoCapture}&component=${this.component}&enable3dSecure=${this.enable3dSecure}&clientSecret=${encodeURIComponent(this.clientSecret)}" | ||
title="Secured airwallex payment frame" | ||
/> | ||
`}}customElements.define("airwallex-element",Airwallex); | ||
/* Airwallex Checkout Component Version [0.0.53] */ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e="https://checkout.airwallex.com/assets/bundle.min.js",r=Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const r=document.querySelector(`script[src="${e}"], script[src="${e}/"]`)||(()=>{const r=document.createElement("script");r.src=e;const t=document.head||document.body;if(!t)throw new Error("Expected document.body not to be null. Airwallex.js requires a <head> or <body> element.");return t.appendChild(r),r})();return new Promise((e,t)=>{r.addEventListener("load",()=>{window.Airwallex?e():t(new Error("Failed to load Airwallex.js"))}),r.addEventListener("error",()=>{t(new Error("Failed to load Airwallex.js"))})})});exports.loadAirwallex=()=>r; | ||
/* Airwallex @Charlie.Lang */ | ||
//# sourceMappingURL=airwallex.cjs.js.map |
@@ -1,27 +0,4 @@ | ||
/* Airwallex Checkout Component Version [0.0.52] */ | ||
const t=new WeakMap,e=e=>"function"==typeof e&&t.has(e),s=void 0!==window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,i=(t,e,s=null)=>{for(;e!==s;){const s=e.nextSibling;t.removeChild(e),e=s}},n={},r={},o=`{{lit-${String(Math.random()).slice(2)}}}`,a=`\x3c!--${o}--\x3e`,l=new RegExp(`${o}|${a}`),c="$lit$";class h{constructor(t,e){this.parts=[],this.element=e;const s=[],i=[],n=document.createTreeWalker(e.content,133,null,!1);let r=0,a=-1,h=0;const{strings:p,values:{length:_}}=t;for(;h<_;){const t=n.nextNode();if(null!==t){if(a++,1===t.nodeType){if(t.hasAttributes()){const e=t.attributes,{length:s}=e;let i=0;for(let t=0;t<s;t++)d(e[t].name,c)&&i++;for(;i-- >0;){const e=p[h],s=m.exec(e)[2],i=s.toLowerCase()+c,n=t.getAttribute(i);t.removeAttribute(i);const r=n.split(l);this.parts.push({type:"attribute",index:a,name:s,strings:r}),h+=r.length-1}}"TEMPLATE"===t.tagName&&(i.push(t),n.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(o)>=0){const i=t.parentNode,n=e.split(l),r=n.length-1;for(let e=0;e<r;e++){let s,r=n[e];if(""===r)s=u();else{const t=m.exec(r);null!==t&&d(t[2],c)&&(r=r.slice(0,t.index)+t[1]+t[2].slice(0,-c.length)+t[3]),s=document.createTextNode(r)}i.insertBefore(s,t),this.parts.push({type:"node",index:++a})}""===n[r]?(i.insertBefore(u(),t),s.push(t)):t.data=n[r],h+=r}}else if(8===t.nodeType)if(t.data===o){const e=t.parentNode;null!==t.previousSibling&&a!==r||(a++,e.insertBefore(u(),t)),r=a,this.parts.push({type:"node",index:a}),null===t.nextSibling?t.data="":(s.push(t),a--),h++}else{let e=-1;for(;-1!==(e=t.data.indexOf(o,e+1));)this.parts.push({type:"node",index:-1}),h++}}else n.currentNode=i.pop()}for(const t of s)t.parentNode.removeChild(t)}}const d=(t,e)=>{const s=t.length-e.length;return s>=0&&t.slice(s)===e},p=t=>-1!==t.index,u=()=>document.createComment(""),m=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;class _{constructor(t,e,s){this.__parts=[],this.template=t,this.processor=e,this.options=s}update(t){let e=0;for(const s of this.__parts)void 0!==s&&s.setValue(t[e]),e++;for(const t of this.__parts)void 0!==t&&t.commit()}_clone(){const t=s?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),e=[],i=this.template.parts,n=document.createTreeWalker(t,133,null,!1);let r,o=0,a=0,l=n.nextNode();for(;o<i.length;)if(r=i[o],p(r)){for(;a<r.index;)a++,"TEMPLATE"===l.nodeName&&(e.push(l),n.currentNode=l.content),null===(l=n.nextNode())&&(n.currentNode=e.pop(),l=n.nextNode());if("node"===r.type){const t=this.processor.handleTextExpression(this.options);t.insertAfterNode(l.previousSibling),this.__parts.push(t)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,r.name,r.strings,this.options));o++}else this.__parts.push(void 0),o++;return s&&(document.adoptNode(t),customElements.upgrade(t)),t}}const f=` ${o} `;class y{constructor(t,e,s,i){this.strings=t,this.values=e,this.type=s,this.processor=i}getHTML(){const t=this.strings.length-1;let e="",s=!1;for(let i=0;i<t;i++){const t=this.strings[i],n=t.lastIndexOf("\x3c!--");s=(n>-1||s)&&-1===t.indexOf("--\x3e",n+1);const r=m.exec(t);e+=null===r?t+(s?f:a):t.substr(0,r.index)+r[1]+r[2]+c+r[3]+o}return e+=this.strings[t]}getTemplateElement(){const t=document.createElement("template");return t.innerHTML=this.getHTML(),t}}const g=t=>null===t||!("object"==typeof t||"function"==typeof t),S=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class v{constructor(t,e,s){this.dirty=!0,this.element=t,this.name=e,this.strings=s,this.parts=[];for(let t=0;t<s.length-1;t++)this.parts[t]=this._createPart()}_createPart(){return new w(this)}_getValue(){const t=this.strings,e=t.length-1;let s="";for(let i=0;i<e;i++){s+=t[i];const e=this.parts[i];if(void 0!==e){const t=e.value;if(g(t)||!S(t))s+="string"==typeof t?t:String(t);else for(const e of t)s+="string"==typeof e?e:String(e)}}return s+=t[e]}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class w{constructor(t){this.value=void 0,this.committer=t}setValue(t){t===n||g(t)&&t===this.value||(this.value=t,e(t)||(this.committer.dirty=!0))}commit(){for(;e(this.value);){const t=this.value;this.value=n,t(this)}this.value!==n&&this.committer.commit()}}class b{constructor(t){this.value=void 0,this.__pendingValue=void 0,this.options=t}appendInto(t){this.startNode=t.appendChild(u()),this.endNode=t.appendChild(u())}insertAfterNode(t){this.startNode=t,this.endNode=t.nextSibling}appendIntoPart(t){t.__insert(this.startNode=u()),t.__insert(this.endNode=u())}insertAfterPart(t){t.__insert(this.startNode=u()),this.endNode=t.endNode,t.endNode=this.startNode}setValue(t){this.__pendingValue=t}commit(){for(;e(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=n,t(this)}const t=this.__pendingValue;t!==n&&(g(t)?t!==this.value&&this.__commitText(t):t instanceof y?this.__commitTemplateResult(t):t instanceof Node?this.__commitNode(t):S(t)?this.__commitIterable(t):t===r?(this.value=r,this.clear()):this.__commitText(t))}__insert(t){this.endNode.parentNode.insertBefore(t,this.endNode)}__commitNode(t){this.value!==t&&(this.clear(),this.__insert(t),this.value=t)}__commitText(t){const e=this.startNode.nextSibling,s="string"==typeof(t=null==t?"":t)?t:String(t);e===this.endNode.previousSibling&&3===e.nodeType?e.data=s:this.__commitNode(document.createTextNode(s)),this.value=t}__commitTemplateResult(t){const e=this.options.templateFactory(t);if(this.value instanceof _&&this.value.template===e)this.value.update(t.values);else{const s=new _(e,t.processor,this.options),i=s._clone();s.update(t.values),this.__commitNode(i),this.value=s}}__commitIterable(t){Array.isArray(this.value)||(this.value=[],this.clear());const e=this.value;let s,i=0;for(const n of t)void 0===(s=e[i])&&(s=new b(this.options),e.push(s),0===i?s.appendIntoPart(this):s.insertAfterPart(e[i-1])),s.setValue(n),s.commit(),i++;i<e.length&&(e.length=i,this.clear(s&&s.endNode))}clear(t=this.startNode){i(this.startNode.parentNode,t.nextSibling,this.endNode)}}class C{constructor(t,e,s){if(this.value=void 0,this.__pendingValue=void 0,2!==s.length||""!==s[0]||""!==s[1])throw new Error("Boolean attributes can only contain a single expression");this.element=t,this.name=e,this.strings=s}setValue(t){this.__pendingValue=t}commit(){for(;e(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=n,t(this)}if(this.__pendingValue===n)return;const t=!!this.__pendingValue;this.value!==t&&(t?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=t),this.__pendingValue=n}}class x extends v{constructor(t,e,s){super(t,e,s),this.single=2===s.length&&""===s[0]&&""===s[1]}_createPart(){return new P(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class P extends w{}let N=!1;try{const t={get capture(){return N=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}class E{constructor(t,e,s){this.value=void 0,this.__pendingValue=void 0,this.element=t,this.eventName=e,this.eventContext=s,this.__boundHandleEvent=t=>this.handleEvent(t)}setValue(t){this.__pendingValue=t}commit(){for(;e(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=n,t(this)}if(this.__pendingValue===n)return;const t=this.__pendingValue,s=this.value,i=null==t||null!=s&&(t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive),r=null!=t&&(null==s||i);i&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),r&&(this.__options=A(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=n}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const A=t=>t&&(N?{capture:t.capture,passive:t.passive,once:t.once}:t.capture);const T=new class{handleAttributeExpressions(t,e,s,i){const n=e[0];if("."===n){return new x(t,e.slice(1),s).parts}return"@"===n?[new E(t,e.slice(1),i.eventContext)]:"?"===n?[new C(t,e.slice(1),s)]:new v(t,e,s).parts}handleTextExpression(t){return new b(t)}};function U(t){let e=V.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},V.set(t.type,e));let s=e.stringsArray.get(t.strings);if(void 0!==s)return s;const i=t.strings.join(o);return void 0===(s=e.keyString.get(i))&&(s=new h(t,t.getTemplateElement()),e.keyString.set(i,s)),e.stringsArray.set(t.strings,s),s}const V=new Map,k=new WeakMap;(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.1.2");const O=(t,...e)=>new y(t,e,"html",T),$=133;function R(t,e){const{element:{content:s},parts:i}=t,n=document.createTreeWalker(s,$,null,!1);let r=I(i),o=i[r],a=-1,l=0;const c=[];let h=null;for(;n.nextNode();){a++;const t=n.currentNode;for(t.previousSibling===h&&(h=null),e.has(t)&&(c.push(t),null===h&&(h=t)),null!==h&&l++;void 0!==o&&o.index===a;)o.index=null!==h?-1:o.index-l,o=i[r=I(i,r)]}c.forEach(t=>t.parentNode.removeChild(t))}const M=t=>{let e=11===t.nodeType?0:1;const s=document.createTreeWalker(t,$,null,!1);for(;s.nextNode();)e++;return e},I=(t,e=-1)=>{for(let s=e+1;s<t.length;s++){const e=t[s];if(p(e))return s}return-1};const q=(t,e)=>`${t}--${e}`;let H=!0;void 0===window.ShadyCSS?H=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),H=!1);const j=t=>e=>{const s=q(e.type,t);let i=V.get(s);void 0===i&&(i={stringsArray:new WeakMap,keyString:new Map},V.set(s,i));let n=i.stringsArray.get(e.strings);if(void 0!==n)return n;const r=e.strings.join(o);if(void 0===(n=i.keyString.get(r))){const s=e.getTemplateElement();H&&window.ShadyCSS.prepareTemplateDom(s,t),n=new h(e,s),i.keyString.set(r,n)}return i.stringsArray.set(e.strings,n),n},L=["html","svg"],B=new Set,W=(t,e,s)=>{B.add(t);const i=s?s.element:document.createElement("template"),n=e.querySelectorAll("style"),{length:r}=n;if(0===r)return void window.ShadyCSS.prepareTemplateStyles(i,t);const o=document.createElement("style");for(let t=0;t<r;t++){const e=n[t];e.parentNode.removeChild(e),o.textContent+=e.textContent}(t=>{L.forEach(e=>{const s=V.get(q(e,t));void 0!==s&&s.keyString.forEach(t=>{const{element:{content:e}}=t,s=new Set;Array.from(e.querySelectorAll("style")).forEach(t=>{s.add(t)}),R(t,s)})})})(t);const a=i.content;s?function(t,e,s=null){const{element:{content:i},parts:n}=t;if(null==s)return void i.appendChild(e);const r=document.createTreeWalker(i,$,null,!1);let o=I(n),a=0,l=-1;for(;r.nextNode();){for(l++,r.currentNode===s&&(a=M(e),s.parentNode.insertBefore(e,s));-1!==o&&n[o].index===l;){if(a>0){for(;-1!==o;)n[o].index+=a,o=I(n,o);return}o=I(n,o)}}}(s,o,a.firstChild):a.insertBefore(o,a.firstChild),window.ShadyCSS.prepareTemplateStyles(i,t);const l=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(s){a.insertBefore(o,a.firstChild);const t=new Set;t.add(o),R(s,t)}};window.JSCompiler_renameProperty=(t,e)=>t;const F={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return null!==t;case Number:return null===t?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},z=(t,e)=>e!==t&&(e==e||t==t),J={attribute:!0,type:String,converter:F,reflect:!1,hasChanged:z},D=Promise.resolve(!0),K=1,X=4,Y=8,G=16,Q=32,Z="finalized";class tt extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=D,this._hasConnectedResolver=void 0,this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this.finalize();const t=[];return this._classProperties.forEach((e,s)=>{const i=this._attributeNameForProperty(s,e);void 0!==i&&(this._attributeToPropertyMap.set(i,s),t.push(i))}),t}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const t=Object.getPrototypeOf(this)._classProperties;void 0!==t&&t.forEach((t,e)=>this._classProperties.set(e,t))}}static createProperty(t,e=J){if(this._ensureClassProperties(),this._classProperties.set(t,e),e.noAccessor||this.prototype.hasOwnProperty(t))return;const s="symbol"==typeof t?Symbol():`__${t}`;Object.defineProperty(this.prototype,t,{get(){return this[s]},set(e){const i=this[t];this[s]=e,this._requestUpdate(t,i)},configurable:!0,enumerable:!0})}static finalize(){const t=Object.getPrototypeOf(this);if(t.hasOwnProperty(Z)||t.finalize(),this[Z]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const t=this.properties,e=[...Object.getOwnPropertyNames(t),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]];for(const s of e)this.createProperty(s,t[s])}}static _attributeNameForProperty(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}static _valueHasChanged(t,e,s=z){return s(t,e)}static _propertyValueFromAttribute(t,e){const s=e.type,i=e.converter||F,n="function"==typeof i?i:i.fromAttribute;return n?n(t,s):t}static _propertyValueToAttribute(t,e){if(void 0===e.reflect)return;const s=e.type,i=e.converter;return(i&&i.toAttribute||F.toAttribute)(t,s)}initialize(){this._saveInstanceProperties(),this._requestUpdate()}_saveInstanceProperties(){this.constructor._classProperties.forEach((t,e)=>{if(this.hasOwnProperty(e)){const t=this[e];delete this[e],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(e,t)}})}_applyInstanceProperties(){this._instanceProperties.forEach((t,e)=>this[e]=t),this._instanceProperties=void 0}connectedCallback(){this._updateState=this._updateState|Q,this._hasConnectedResolver&&(this._hasConnectedResolver(),this._hasConnectedResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(t,e,s){e!==s&&this._attributeToProperty(t,s)}_propertyToAttribute(t,e,s=J){const i=this.constructor,n=i._attributeNameForProperty(t,s);if(void 0!==n){const t=i._propertyValueToAttribute(e,s);if(void 0===t)return;this._updateState=this._updateState|Y,null==t?this.removeAttribute(n):this.setAttribute(n,t),this._updateState=this._updateState&~Y}}_attributeToProperty(t,e){if(this._updateState&Y)return;const s=this.constructor,i=s._attributeToPropertyMap.get(t);if(void 0!==i){const t=s._classProperties.get(i)||J;this._updateState=this._updateState|G,this[i]=s._propertyValueFromAttribute(e,t),this._updateState=this._updateState&~G}}_requestUpdate(t,e){let s=!0;if(void 0!==t){const i=this.constructor,n=i._classProperties.get(t)||J;i._valueHasChanged(this[t],e,n.hasChanged)?(this._changedProperties.has(t)||this._changedProperties.set(t,e),!0!==n.reflect||this._updateState&G||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(t,n))):s=!1}!this._hasRequestedUpdate&&s&&this._enqueueUpdate()}requestUpdate(t,e){return this._requestUpdate(t,e),this.updateComplete}async _enqueueUpdate(){let t,e;this._updateState=this._updateState|X;const s=this._updatePromise;this._updatePromise=new Promise((s,i)=>{t=s,e=i});try{await s}catch(t){}this._hasConnected||await new Promise(t=>this._hasConnectedResolver=t);try{const t=this.performUpdate();null!=t&&await t}catch(t){e(t)}t(!this._hasRequestedUpdate)}get _hasConnected(){return this._updateState&Q}get _hasRequestedUpdate(){return this._updateState&X}get hasUpdated(){return this._updateState&K}performUpdate(){this._instanceProperties&&this._applyInstanceProperties();let t=!1;const e=this._changedProperties;try{(t=this.shouldUpdate(e))&&this.update(e)}catch(e){throw t=!1,e}finally{this._markUpdated()}t&&(this._updateState&K||(this._updateState=this._updateState|K,this.firstUpdated(e)),this.updated(e))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~X}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(t){return!0}update(t){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((t,e)=>this._propertyToAttribute(e,this[e],t)),this._reflectingProperties=void 0)}updated(t){}firstUpdated(t){}}tt[Z]=!0;const et="adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,st=Symbol();class it{constructor(t,e){if(e!==st)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){return void 0===this._styleSheet&&(et?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const nt=(t,...e)=>{const s=e.reduce((e,s,i)=>e+(t=>{if(t instanceof it)return t.cssText;if("number"==typeof t)return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`)})(s)+t[i+1],t[0]);return new it(s,st)};(window.litElementVersions||(window.litElementVersions=[])).push("2.2.1");const rt=t=>t.flat?t.flat(1/0):function t(e,s=[]){for(let i=0,n=e.length;i<n;i++){const n=e[i];Array.isArray(n)?t(n,s):s.push(n)}return s}(t);class ot extends tt{static finalize(){super.finalize.call(this),this._styles=this.hasOwnProperty(JSCompiler_renameProperty("styles",this))?this._getUniqueStyles():this._styles||[]}static _getUniqueStyles(){const t=this.styles,e=[];if(Array.isArray(t)){rt(t).reduceRight((t,e)=>(t.add(e),t),new Set).forEach(t=>e.unshift(t))}else t&&e.push(t);return e}initialize(){super.initialize(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?et?this.renderRoot.adoptedStyleSheets=t.map(t=>t.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(t.map(t=>t.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(t){super.update(t);const e=this.render();e instanceof y&&this.constructor.render(e,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(t=>{const e=document.createElement("style");e.textContent=t.cssText,this.renderRoot.appendChild(e)}))}render(){}}ot.finalized=!0,ot.render=(t,e,s)=>{if(!s||"object"!=typeof s||!s.scopeName)throw new Error("The `scopeName` option is required.");const n=s.scopeName,r=k.has(e),o=H&&11===e.nodeType&&!!e.host,a=o&&!B.has(n),l=a?document.createDocumentFragment():e;if(((t,e,s)=>{let n=k.get(e);void 0===n&&(i(e,e.firstChild),k.set(e,n=new b(Object.assign({templateFactory:U},s))),n.appendInto(e)),n.setValue(t),n.commit()})(t,l,Object.assign({templateFactory:j(n)},s)),a){const t=k.get(l);k.delete(l);const s=t.value instanceof _?t.value.template:void 0;W(n,l,s),i(e,e.firstChild),e.appendChild(l),k.set(e,t)}!r&&o&&window.ShadyCSS.styleElement(e.host)};const at="airwallex_checkout_frame";customElements.define("airwallex-element",class extends ot{constructor(){super(),this.gatewayBaseurl=this.clientSecret=this.currency=this.intentId=this.customerId="",this.successUrl=this.cancelUrl=this.errorUrl=this.autoCapture=this.enable3dSecure=this.component="",this.theme={},this.height=0}static get properties(){return{gatewayBaseurl:{type:String,reflect:!0},clientSecret:{type:String,reflect:!0},currency:{type:String,reflect:!0},intentId:{type:String,reflect:!0},customerId:{type:String,reflect:!0},successUrl:{type:String,reflect:!0},cancelUrl:{type:String,reflect:!0},errorUrl:{type:String,reflect:!0},enable3dSecure:{type:String,reflect:!0},autoCapture:{type:String,reflect:!0},component:{type:String,reflect:!0},theme:{type:Object,reflect:!0},height:{type:Number,hasChanged:()=>!0}}}static get styles(){return nt` | ||
:host { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
`}handleEvent(t){console.info(`Airwallex Checkout Message: [${JSON.stringify(t)}]`);const e=new CustomEvent("airwallex-checkout",{detail:t,bubbles:!0,composed:!0});this.dispatchEvent(e)}checkoutEventHandler(t){if(t.origin===this.gatewayBaseurl&&t.isTrusted){const{style:e,...s}=t.data;if(this.height=(e&&e.height||0)+8,"AWX_CHECKOUT_STYLE"!==t.data.code&&this.handleEvent(s),"AWX_CHECKOUT_SUCCESS"===t.data.code){const e=`${t.data.status?`status=${t.data.status}`:""}${t.data.id?`&intentId=${t.data.id}`:""}`;this.successUrl&&(window.location.href=-1===this.successUrl.indexOf("?")?`${this.successUrl}?${e}`:`${this.successUrl}&${e}`)}else"AWX_CHECKOUT_CANCEL"===t.data.code?this.cancelUrl&&(window.location.href=this.cancelUrl):"AWX_CHECKOUT_ERROR"===t.data.code&&this.errorUrl&&(window.location.href=this.errorUrl);this.requestUpdate()}}connectedCallback(){super.connectedCallback(),window.addEventListener("message",t=>this.checkoutEventHandler(t))}disconnectedCallback(){window.removeEventListener("message",t=>this.checkoutEventHandler(t)),super.disconnectedCallback()}render(){return O` | ||
<style> | ||
iframe { | ||
width: 100%; | ||
background: white; | ||
height: ${this.height}px; | ||
} | ||
</style> | ||
<iframe | ||
frameborder="0" | ||
allowtransparency="true" | ||
importance="high" | ||
scrolling="no" | ||
name="${at}" | ||
allowpaymentrequest="true" | ||
src="${this.gatewayBaseurl}/checkout/${this.intentId}?origin=${window.location.origin}&customerId=${this.customerId}¤cy=${this.currency}&theme=${encodeURIComponent(JSON.stringify(this.theme))}&autoCapture=${this.autoCapture}&component=${this.component}&enable3dSecure=${this.enable3dSecure}&clientSecret=${encodeURIComponent(this.clientSecret)}" | ||
title="Secured airwallex payment frame" | ||
/> | ||
`}}); | ||
/* Airwallex Checkout Component Version [0.0.53] */ | ||
const e="https://checkout.airwallex.com/assets/bundle.min.js",r=Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const r=document.querySelector(`script[src="${e}"], script[src="${e}/"]`)||(()=>{const r=document.createElement("script");r.src=e;const o=document.head||document.body;if(!o)throw new Error("Expected document.body not to be null. Airwallex.js requires a <head> or <body> element.");return o.appendChild(r),r})();return new Promise((e,o)=>{r.addEventListener("load",()=>{window.Airwallex?e():o(new Error("Failed to load Airwallex.js"))}),r.addEventListener("error",()=>{o(new Error("Failed to load Airwallex.js"))})})}),o=()=>r;export{o as loadAirwallex}; | ||
/* Airwallex @Charlie.Lang */ | ||
//# sourceMappingURL=airwallex.es.js.map |
@@ -1,27 +0,4 @@ | ||
/* Airwallex Checkout Component Version [0.0.52] */ | ||
!function(){"use strict";const t=new WeakMap,e=e=>"function"==typeof e&&t.has(e),s=void 0!==window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,i=(t,e,s=null)=>{for(;e!==s;){const s=e.nextSibling;t.removeChild(e),e=s}},n={},r={},o=`{{lit-${String(Math.random()).slice(2)}}}`,a=`\x3c!--${o}--\x3e`,l=new RegExp(`${o}|${a}`),c="$lit$";class h{constructor(t,e){this.parts=[],this.element=e;const s=[],i=[],n=document.createTreeWalker(e.content,133,null,!1);let r=0,a=-1,h=0;const{strings:u,values:{length:_}}=t;for(;h<_;){const t=n.nextNode();if(null!==t){if(a++,1===t.nodeType){if(t.hasAttributes()){const e=t.attributes,{length:s}=e;let i=0;for(let t=0;t<s;t++)d(e[t].name,c)&&i++;for(;i-- >0;){const e=u[h],s=m.exec(e)[2],i=s.toLowerCase()+c,n=t.getAttribute(i);t.removeAttribute(i);const r=n.split(l);this.parts.push({type:"attribute",index:a,name:s,strings:r}),h+=r.length-1}}"TEMPLATE"===t.tagName&&(i.push(t),n.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(o)>=0){const i=t.parentNode,n=e.split(l),r=n.length-1;for(let e=0;e<r;e++){let s,r=n[e];if(""===r)s=p();else{const t=m.exec(r);null!==t&&d(t[2],c)&&(r=r.slice(0,t.index)+t[1]+t[2].slice(0,-c.length)+t[3]),s=document.createTextNode(r)}i.insertBefore(s,t),this.parts.push({type:"node",index:++a})}""===n[r]?(i.insertBefore(p(),t),s.push(t)):t.data=n[r],h+=r}}else if(8===t.nodeType)if(t.data===o){const e=t.parentNode;null!==t.previousSibling&&a!==r||(a++,e.insertBefore(p(),t)),r=a,this.parts.push({type:"node",index:a}),null===t.nextSibling?t.data="":(s.push(t),a--),h++}else{let e=-1;for(;-1!==(e=t.data.indexOf(o,e+1));)this.parts.push({type:"node",index:-1}),h++}}else n.currentNode=i.pop()}for(const t of s)t.parentNode.removeChild(t)}}const d=(t,e)=>{const s=t.length-e.length;return s>=0&&t.slice(s)===e},u=t=>-1!==t.index,p=()=>document.createComment(""),m=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;class _{constructor(t,e,s){this.__parts=[],this.template=t,this.processor=e,this.options=s}update(t){let e=0;for(const s of this.__parts)void 0!==s&&s.setValue(t[e]),e++;for(const t of this.__parts)void 0!==t&&t.commit()}_clone(){const t=s?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),e=[],i=this.template.parts,n=document.createTreeWalker(t,133,null,!1);let r,o=0,a=0,l=n.nextNode();for(;o<i.length;)if(r=i[o],u(r)){for(;a<r.index;)a++,"TEMPLATE"===l.nodeName&&(e.push(l),n.currentNode=l.content),null===(l=n.nextNode())&&(n.currentNode=e.pop(),l=n.nextNode());if("node"===r.type){const t=this.processor.handleTextExpression(this.options);t.insertAfterNode(l.previousSibling),this.__parts.push(t)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,r.name,r.strings,this.options));o++}else this.__parts.push(void 0),o++;return s&&(document.adoptNode(t),customElements.upgrade(t)),t}}const f=` ${o} `;class y{constructor(t,e,s,i){this.strings=t,this.values=e,this.type=s,this.processor=i}getHTML(){const t=this.strings.length-1;let e="",s=!1;for(let i=0;i<t;i++){const t=this.strings[i],n=t.lastIndexOf("\x3c!--");s=(n>-1||s)&&-1===t.indexOf("--\x3e",n+1);const r=m.exec(t);e+=null===r?t+(s?f:a):t.substr(0,r.index)+r[1]+r[2]+c+r[3]+o}return e+=this.strings[t]}getTemplateElement(){const t=document.createElement("template");return t.innerHTML=this.getHTML(),t}}const g=t=>null===t||!("object"==typeof t||"function"==typeof t),S=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class v{constructor(t,e,s){this.dirty=!0,this.element=t,this.name=e,this.strings=s,this.parts=[];for(let t=0;t<s.length-1;t++)this.parts[t]=this._createPart()}_createPart(){return new w(this)}_getValue(){const t=this.strings,e=t.length-1;let s="";for(let i=0;i<e;i++){s+=t[i];const e=this.parts[i];if(void 0!==e){const t=e.value;if(g(t)||!S(t))s+="string"==typeof t?t:String(t);else for(const e of t)s+="string"==typeof e?e:String(e)}}return s+=t[e]}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class w{constructor(t){this.value=void 0,this.committer=t}setValue(t){t===n||g(t)&&t===this.value||(this.value=t,e(t)||(this.committer.dirty=!0))}commit(){for(;e(this.value);){const t=this.value;this.value=n,t(this)}this.value!==n&&this.committer.commit()}}class b{constructor(t){this.value=void 0,this.__pendingValue=void 0,this.options=t}appendInto(t){this.startNode=t.appendChild(p()),this.endNode=t.appendChild(p())}insertAfterNode(t){this.startNode=t,this.endNode=t.nextSibling}appendIntoPart(t){t.__insert(this.startNode=p()),t.__insert(this.endNode=p())}insertAfterPart(t){t.__insert(this.startNode=p()),this.endNode=t.endNode,t.endNode=this.startNode}setValue(t){this.__pendingValue=t}commit(){for(;e(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=n,t(this)}const t=this.__pendingValue;t!==n&&(g(t)?t!==this.value&&this.__commitText(t):t instanceof y?this.__commitTemplateResult(t):t instanceof Node?this.__commitNode(t):S(t)?this.__commitIterable(t):t===r?(this.value=r,this.clear()):this.__commitText(t))}__insert(t){this.endNode.parentNode.insertBefore(t,this.endNode)}__commitNode(t){this.value!==t&&(this.clear(),this.__insert(t),this.value=t)}__commitText(t){const e=this.startNode.nextSibling,s="string"==typeof(t=null==t?"":t)?t:String(t);e===this.endNode.previousSibling&&3===e.nodeType?e.data=s:this.__commitNode(document.createTextNode(s)),this.value=t}__commitTemplateResult(t){const e=this.options.templateFactory(t);if(this.value instanceof _&&this.value.template===e)this.value.update(t.values);else{const s=new _(e,t.processor,this.options),i=s._clone();s.update(t.values),this.__commitNode(i),this.value=s}}__commitIterable(t){Array.isArray(this.value)||(this.value=[],this.clear());const e=this.value;let s,i=0;for(const n of t)void 0===(s=e[i])&&(s=new b(this.options),e.push(s),0===i?s.appendIntoPart(this):s.insertAfterPart(e[i-1])),s.setValue(n),s.commit(),i++;i<e.length&&(e.length=i,this.clear(s&&s.endNode))}clear(t=this.startNode){i(this.startNode.parentNode,t.nextSibling,this.endNode)}}class C{constructor(t,e,s){if(this.value=void 0,this.__pendingValue=void 0,2!==s.length||""!==s[0]||""!==s[1])throw new Error("Boolean attributes can only contain a single expression");this.element=t,this.name=e,this.strings=s}setValue(t){this.__pendingValue=t}commit(){for(;e(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=n,t(this)}if(this.__pendingValue===n)return;const t=!!this.__pendingValue;this.value!==t&&(t?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=t),this.__pendingValue=n}}class x extends v{constructor(t,e,s){super(t,e,s),this.single=2===s.length&&""===s[0]&&""===s[1]}_createPart(){return new P(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class P extends w{}let N=!1;try{const t={get capture(){return N=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}class E{constructor(t,e,s){this.value=void 0,this.__pendingValue=void 0,this.element=t,this.eventName=e,this.eventContext=s,this.__boundHandleEvent=t=>this.handleEvent(t)}setValue(t){this.__pendingValue=t}commit(){for(;e(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=n,t(this)}if(this.__pendingValue===n)return;const t=this.__pendingValue,s=this.value,i=null==t||null!=s&&(t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive),r=null!=t&&(null==s||i);i&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),r&&(this.__options=A(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=n}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const A=t=>t&&(N?{capture:t.capture,passive:t.passive,once:t.once}:t.capture);const T=new class{handleAttributeExpressions(t,e,s,i){const n=e[0];if("."===n){return new x(t,e.slice(1),s).parts}return"@"===n?[new E(t,e.slice(1),i.eventContext)]:"?"===n?[new C(t,e.slice(1),s)]:new v(t,e,s).parts}handleTextExpression(t){return new b(t)}};function U(t){let e=V.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},V.set(t.type,e));let s=e.stringsArray.get(t.strings);if(void 0!==s)return s;const i=t.strings.join(o);return void 0===(s=e.keyString.get(i))&&(s=new h(t,t.getTemplateElement()),e.keyString.set(i,s)),e.stringsArray.set(t.strings,s),s}const V=new Map,k=new WeakMap;(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.1.2");const O=(t,...e)=>new y(t,e,"html",T),$=133;function R(t,e){const{element:{content:s},parts:i}=t,n=document.createTreeWalker(s,$,null,!1);let r=I(i),o=i[r],a=-1,l=0;const c=[];let h=null;for(;n.nextNode();){a++;const t=n.currentNode;for(t.previousSibling===h&&(h=null),e.has(t)&&(c.push(t),null===h&&(h=t)),null!==h&&l++;void 0!==o&&o.index===a;)o.index=null!==h?-1:o.index-l,o=i[r=I(i,r)]}c.forEach(t=>t.parentNode.removeChild(t))}const M=t=>{let e=11===t.nodeType?0:1;const s=document.createTreeWalker(t,$,null,!1);for(;s.nextNode();)e++;return e},I=(t,e=-1)=>{for(let s=e+1;s<t.length;s++){const e=t[s];if(u(e))return s}return-1};const q=(t,e)=>`${t}--${e}`;let H=!0;void 0===window.ShadyCSS?H=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),H=!1);const j=t=>e=>{const s=q(e.type,t);let i=V.get(s);void 0===i&&(i={stringsArray:new WeakMap,keyString:new Map},V.set(s,i));let n=i.stringsArray.get(e.strings);if(void 0!==n)return n;const r=e.strings.join(o);if(void 0===(n=i.keyString.get(r))){const s=e.getTemplateElement();H&&window.ShadyCSS.prepareTemplateDom(s,t),n=new h(e,s),i.keyString.set(r,n)}return i.stringsArray.set(e.strings,n),n},L=["html","svg"],B=new Set,W=(t,e,s)=>{B.add(t);const i=s?s.element:document.createElement("template"),n=e.querySelectorAll("style"),{length:r}=n;if(0===r)return void window.ShadyCSS.prepareTemplateStyles(i,t);const o=document.createElement("style");for(let t=0;t<r;t++){const e=n[t];e.parentNode.removeChild(e),o.textContent+=e.textContent}(t=>{L.forEach(e=>{const s=V.get(q(e,t));void 0!==s&&s.keyString.forEach(t=>{const{element:{content:e}}=t,s=new Set;Array.from(e.querySelectorAll("style")).forEach(t=>{s.add(t)}),R(t,s)})})})(t);const a=i.content;s?function(t,e,s=null){const{element:{content:i},parts:n}=t;if(null==s)return void i.appendChild(e);const r=document.createTreeWalker(i,$,null,!1);let o=I(n),a=0,l=-1;for(;r.nextNode();){for(l++,r.currentNode===s&&(a=M(e),s.parentNode.insertBefore(e,s));-1!==o&&n[o].index===l;){if(a>0){for(;-1!==o;)n[o].index+=a,o=I(n,o);return}o=I(n,o)}}}(s,o,a.firstChild):a.insertBefore(o,a.firstChild),window.ShadyCSS.prepareTemplateStyles(i,t);const l=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(s){a.insertBefore(o,a.firstChild);const t=new Set;t.add(o),R(s,t)}};window.JSCompiler_renameProperty=(t,e)=>t;const F={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return null!==t;case Number:return null===t?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},z=(t,e)=>e!==t&&(e==e||t==t),J={attribute:!0,type:String,converter:F,reflect:!1,hasChanged:z},D=Promise.resolve(!0),K=1,X=4,Y=8,G=16,Q=32,Z="finalized";class tt extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=D,this._hasConnectedResolver=void 0,this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this.finalize();const t=[];return this._classProperties.forEach((e,s)=>{const i=this._attributeNameForProperty(s,e);void 0!==i&&(this._attributeToPropertyMap.set(i,s),t.push(i))}),t}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const t=Object.getPrototypeOf(this)._classProperties;void 0!==t&&t.forEach((t,e)=>this._classProperties.set(e,t))}}static createProperty(t,e=J){if(this._ensureClassProperties(),this._classProperties.set(t,e),e.noAccessor||this.prototype.hasOwnProperty(t))return;const s="symbol"==typeof t?Symbol():`__${t}`;Object.defineProperty(this.prototype,t,{get(){return this[s]},set(e){const i=this[t];this[s]=e,this._requestUpdate(t,i)},configurable:!0,enumerable:!0})}static finalize(){const t=Object.getPrototypeOf(this);if(t.hasOwnProperty(Z)||t.finalize(),this[Z]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const t=this.properties,e=[...Object.getOwnPropertyNames(t),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]];for(const s of e)this.createProperty(s,t[s])}}static _attributeNameForProperty(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}static _valueHasChanged(t,e,s=z){return s(t,e)}static _propertyValueFromAttribute(t,e){const s=e.type,i=e.converter||F,n="function"==typeof i?i:i.fromAttribute;return n?n(t,s):t}static _propertyValueToAttribute(t,e){if(void 0===e.reflect)return;const s=e.type,i=e.converter;return(i&&i.toAttribute||F.toAttribute)(t,s)}initialize(){this._saveInstanceProperties(),this._requestUpdate()}_saveInstanceProperties(){this.constructor._classProperties.forEach((t,e)=>{if(this.hasOwnProperty(e)){const t=this[e];delete this[e],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(e,t)}})}_applyInstanceProperties(){this._instanceProperties.forEach((t,e)=>this[e]=t),this._instanceProperties=void 0}connectedCallback(){this._updateState=this._updateState|Q,this._hasConnectedResolver&&(this._hasConnectedResolver(),this._hasConnectedResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(t,e,s){e!==s&&this._attributeToProperty(t,s)}_propertyToAttribute(t,e,s=J){const i=this.constructor,n=i._attributeNameForProperty(t,s);if(void 0!==n){const t=i._propertyValueToAttribute(e,s);if(void 0===t)return;this._updateState=this._updateState|Y,null==t?this.removeAttribute(n):this.setAttribute(n,t),this._updateState=this._updateState&~Y}}_attributeToProperty(t,e){if(this._updateState&Y)return;const s=this.constructor,i=s._attributeToPropertyMap.get(t);if(void 0!==i){const t=s._classProperties.get(i)||J;this._updateState=this._updateState|G,this[i]=s._propertyValueFromAttribute(e,t),this._updateState=this._updateState&~G}}_requestUpdate(t,e){let s=!0;if(void 0!==t){const i=this.constructor,n=i._classProperties.get(t)||J;i._valueHasChanged(this[t],e,n.hasChanged)?(this._changedProperties.has(t)||this._changedProperties.set(t,e),!0!==n.reflect||this._updateState&G||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(t,n))):s=!1}!this._hasRequestedUpdate&&s&&this._enqueueUpdate()}requestUpdate(t,e){return this._requestUpdate(t,e),this.updateComplete}async _enqueueUpdate(){let t,e;this._updateState=this._updateState|X;const s=this._updatePromise;this._updatePromise=new Promise((s,i)=>{t=s,e=i});try{await s}catch(t){}this._hasConnected||await new Promise(t=>this._hasConnectedResolver=t);try{const t=this.performUpdate();null!=t&&await t}catch(t){e(t)}t(!this._hasRequestedUpdate)}get _hasConnected(){return this._updateState&Q}get _hasRequestedUpdate(){return this._updateState&X}get hasUpdated(){return this._updateState&K}performUpdate(){this._instanceProperties&&this._applyInstanceProperties();let t=!1;const e=this._changedProperties;try{(t=this.shouldUpdate(e))&&this.update(e)}catch(e){throw t=!1,e}finally{this._markUpdated()}t&&(this._updateState&K||(this._updateState=this._updateState|K,this.firstUpdated(e)),this.updated(e))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~X}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(t){return!0}update(t){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((t,e)=>this._propertyToAttribute(e,this[e],t)),this._reflectingProperties=void 0)}updated(t){}firstUpdated(t){}}tt[Z]=!0;const et="adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,st=Symbol();class it{constructor(t,e){if(e!==st)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){return void 0===this._styleSheet&&(et?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}const nt=(t,...e)=>{const s=e.reduce((e,s,i)=>e+(t=>{if(t instanceof it)return t.cssText;if("number"==typeof t)return t;throw new Error(`Value passed to 'css' function must be a 'css' function result: ${t}. Use 'unsafeCSS' to pass non-literal values, but\n take care to ensure page security.`)})(s)+t[i+1],t[0]);return new it(s,st)};(window.litElementVersions||(window.litElementVersions=[])).push("2.2.1");const rt=t=>t.flat?t.flat(1/0):function t(e,s=[]){for(let i=0,n=e.length;i<n;i++){const n=e[i];Array.isArray(n)?t(n,s):s.push(n)}return s}(t);class ot extends tt{static finalize(){super.finalize.call(this),this._styles=this.hasOwnProperty(JSCompiler_renameProperty("styles",this))?this._getUniqueStyles():this._styles||[]}static _getUniqueStyles(){const t=this.styles,e=[];if(Array.isArray(t)){rt(t).reduceRight((t,e)=>(t.add(e),t),new Set).forEach(t=>e.unshift(t))}else t&&e.push(t);return e}initialize(){super.initialize(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?et?this.renderRoot.adoptedStyleSheets=t.map(t=>t.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(t.map(t=>t.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(t){super.update(t);const e=this.render();e instanceof y&&this.constructor.render(e,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(t=>{const e=document.createElement("style");e.textContent=t.cssText,this.renderRoot.appendChild(e)}))}render(){}}ot.finalized=!0,ot.render=(t,e,s)=>{if(!s||"object"!=typeof s||!s.scopeName)throw new Error("The `scopeName` option is required.");const n=s.scopeName,r=k.has(e),o=H&&11===e.nodeType&&!!e.host,a=o&&!B.has(n),l=a?document.createDocumentFragment():e;if(((t,e,s)=>{let n=k.get(e);void 0===n&&(i(e,e.firstChild),k.set(e,n=new b(Object.assign({templateFactory:U},s))),n.appendInto(e)),n.setValue(t),n.commit()})(t,l,Object.assign({templateFactory:j(n)},s)),a){const t=k.get(l);k.delete(l);const s=t.value instanceof _?t.value.template:void 0;W(n,l,s),i(e,e.firstChild),e.appendChild(l),k.set(e,t)}!r&&o&&window.ShadyCSS.styleElement(e.host)};const at="airwallex_checkout_frame";customElements.define("airwallex-element",class extends ot{constructor(){super(),this.gatewayBaseurl=this.clientSecret=this.currency=this.intentId=this.customerId="",this.successUrl=this.cancelUrl=this.errorUrl=this.autoCapture=this.enable3dSecure=this.component="",this.theme={},this.height=0}static get properties(){return{gatewayBaseurl:{type:String,reflect:!0},clientSecret:{type:String,reflect:!0},currency:{type:String,reflect:!0},intentId:{type:String,reflect:!0},customerId:{type:String,reflect:!0},successUrl:{type:String,reflect:!0},cancelUrl:{type:String,reflect:!0},errorUrl:{type:String,reflect:!0},enable3dSecure:{type:String,reflect:!0},autoCapture:{type:String,reflect:!0},component:{type:String,reflect:!0},theme:{type:Object,reflect:!0},height:{type:Number,hasChanged:()=>!0}}}static get styles(){return nt` | ||
:host { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
`}handleEvent(t){console.info(`Airwallex Checkout Message: [${JSON.stringify(t)}]`);const e=new CustomEvent("airwallex-checkout",{detail:t,bubbles:!0,composed:!0});this.dispatchEvent(e)}checkoutEventHandler(t){if(t.origin===this.gatewayBaseurl&&t.isTrusted){const{style:e,...s}=t.data;if(this.height=(e&&e.height||0)+8,"AWX_CHECKOUT_STYLE"!==t.data.code&&this.handleEvent(s),"AWX_CHECKOUT_SUCCESS"===t.data.code){const e=`${t.data.status?`status=${t.data.status}`:""}${t.data.id?`&intentId=${t.data.id}`:""}`;this.successUrl&&(window.location.href=-1===this.successUrl.indexOf("?")?`${this.successUrl}?${e}`:`${this.successUrl}&${e}`)}else"AWX_CHECKOUT_CANCEL"===t.data.code?this.cancelUrl&&(window.location.href=this.cancelUrl):"AWX_CHECKOUT_ERROR"===t.data.code&&this.errorUrl&&(window.location.href=this.errorUrl);this.requestUpdate()}}connectedCallback(){super.connectedCallback(),window.addEventListener("message",t=>this.checkoutEventHandler(t))}disconnectedCallback(){window.removeEventListener("message",t=>this.checkoutEventHandler(t)),super.disconnectedCallback()}render(){return O` | ||
<style> | ||
iframe { | ||
width: 100%; | ||
background: white; | ||
height: ${this.height}px; | ||
} | ||
</style> | ||
<iframe | ||
frameborder="0" | ||
allowtransparency="true" | ||
importance="high" | ||
scrolling="no" | ||
name="${at}" | ||
allowpaymentrequest="true" | ||
src="${this.gatewayBaseurl}/checkout/${this.intentId}?origin=${window.location.origin}&customerId=${this.customerId}¤cy=${this.currency}&theme=${encodeURIComponent(JSON.stringify(this.theme))}&autoCapture=${this.autoCapture}&component=${this.component}&enable3dSecure=${this.enable3dSecure}&clientSecret=${encodeURIComponent(this.clientSecret)}" | ||
title="Secured airwallex payment frame" | ||
/> | ||
`}})}(); | ||
/* Airwallex Checkout Component Version [0.0.53] */ | ||
var Airwallex=function(e){"use strict";const r="https://checkout.airwallex.com/assets/bundle.min.js",t=Promise.resolve().then(()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const e=document.querySelector(`script[src="${r}"], script[src="${r}/"]`)||(()=>{const e=document.createElement("script");e.src=r;const t=document.head||document.body;if(!t)throw new Error("Expected document.body not to be null. Airwallex.js requires a <head> or <body> element.");return t.appendChild(e),e})();return new Promise((r,t)=>{e.addEventListener("load",()=>{window.Airwallex?r():t(new Error("Failed to load Airwallex.js"))}),e.addEventListener("error",()=>{t(new Error("Failed to load Airwallex.js"))})})});return e.loadAirwallex=()=>t,e}({}); | ||
/* Airwallex @Charlie.Lang */ | ||
//# sourceMappingURL=airwallex.iife.js.map |
{ | ||
"name": "airwallex-payment-elements", | ||
"version": "0.0.52", | ||
"version": "0.0.53", | ||
"main": "dist/index.js", | ||
"module": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"module": "lib/airwallex.es.js", | ||
"types": "types/index.d.ts", | ||
"directories": { | ||
@@ -12,7 +12,7 @@ "lib": "lib" | ||
"scripts": { | ||
"build": "rollup -c --environment INCLUDE_DEPS && tsc", | ||
"build-component": "rollup -c && tsc", | ||
"build-polyfill": "rollup -c --environment INCLUDE_DEPS && tsc", | ||
"build": "rollup -c && tsc", | ||
"watch": "rollup -c -w && tsc", | ||
"prepare": "tsc", | ||
"lint": "tslint -c tslint.json -p tsconfig.json", | ||
"lint": "eslint \"src/*.{js,ts,tsx}\" ", | ||
"start": "serve public", | ||
@@ -23,22 +23,28 @@ "test-sonar": "sonar-scanner" | ||
"devDependencies": { | ||
"@babel/core": "^7.5.5", | ||
"@webcomponents/webcomponentsjs": "^2.2.10", | ||
"core-js": "^3.2.0", | ||
"husky": "^3.0.3", | ||
"lint-staged": "^9.2.1", | ||
"prettier": "^1.18.2", | ||
"rollup": "^1.19.4", | ||
"rollup-plugin-analyzer": "^3.1.2", | ||
"@babel/core": "^7.8.4", | ||
"@rollup/plugin-commonjs": "^11.0.2", | ||
"@rollup/plugin-typescript": "^3.0.0", | ||
"@typescript-eslint/eslint-plugin": "^2.21.0", | ||
"@typescript-eslint/parser": "^2.21.0", | ||
"@webcomponents/webcomponentsjs": "^2.4.2", | ||
"confusing-browser-globals": "^1.0.9", | ||
"core-js": "^3.6.4", | ||
"eslint": "^6.8.0", | ||
"eslint-config-google": "^0.14.0", | ||
"eslint-config-prettier": "^6.10.0", | ||
"eslint-plugin-prettier": "^3.1.2", | ||
"husky": "^4.2.3", | ||
"lint-staged": "^10.0.8", | ||
"prettier": "^1.19.1", | ||
"rollup": "^1.31.1", | ||
"rollup-plugin-analyzer": "^3.2.2", | ||
"rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-commonjs": "^10.0.2", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-terser": "^5.1.1", | ||
"rollup-plugin-typescript2": "^0.22.1", | ||
"serve": "^11.1.0", | ||
"rollup-plugin-terser": "^5.2.0", | ||
"serve": "^11.3.0", | ||
"sonarqube-scanner": "^2.5.0", | ||
"tslint": "^5.18.0", | ||
"tslint-config-prettier": "^1.18.0", | ||
"tslint-eslint-rules": "^5.4.0", | ||
"tslint-plugin-prettier": "^2.0.1", | ||
"typescript": "^3.5.3" | ||
"tslint-plugin-prettier": "^2.1.0", | ||
"typescript": "^3.8.2" | ||
}, | ||
@@ -50,3 +56,3 @@ "dependencies": { | ||
"hooks": { | ||
"pre-commit": "lint-staged" | ||
"pre-commit": "lint-staged && yarn build" | ||
} | ||
@@ -58,10 +64,9 @@ }, | ||
"arrowParens": "always", | ||
"trailingComma": "none" | ||
"trailingComma": "all" | ||
}, | ||
"lint-staged": { | ||
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [ | ||
"prettier --write", | ||
"git add" | ||
"prettier --write" | ||
] | ||
} | ||
} |
@@ -81,4 +81,4 @@ # airwallex-payment-elements | ||
Demo: https://demo-checkout.airwallex.com | ||
Staging: https://staging-checkout.airwallex.com | ||
Dev: https://dev-checkout.airwallex.com/ | ||
Staging: https://staging-pacheckoutui.airwallex.com | ||
Dev: https://dev-pacheckoutui.airwallex.com/ | ||
``` | ||
@@ -85,0 +85,0 @@ |
@@ -5,6 +5,6 @@ { | ||
// "incremental": true, /* Enable incremental compilation */ | ||
"target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ | ||
"module": "es2015", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ | ||
"lib": ["es2017", "dom"], /* Specify library files to be included in the compilation. */ | ||
// "allowJs": true, /* Allow javascript files to be compiled. */ | ||
"target": "es2019", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ | ||
"module": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ | ||
"lib": ["es2019", "dom", "dom.iterable"], /* Specify library files to be included in the compilation. */ | ||
"allowJs": true, /* Allow javascript files to be compiled. */ | ||
// "checkJs": true, /* Report errors in .js files. */ | ||
@@ -16,3 +16,3 @@ //"jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ | ||
// "outFile": "./", /* Concatenate and emit output to single file. */ | ||
"outDir": "dist", /* Redirect output structure to the directory. */ | ||
"outDir": "dist", /* Redirect output structure to the directory. */ | ||
@@ -28,3 +28,3 @@ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ | ||
/* Strict Type-Checking Options */ | ||
// "strict": true, /* Enable all strict type-checking options. */ | ||
"strict": true, /* Enable all strict type-checking options. */ | ||
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ | ||
@@ -70,6 +70,8 @@ // "strictNullChecks": true, /* Enable strict null checks. */ | ||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ | ||
"forceConsistentCasingInFileNames": true, | ||
"skipLibCheck": true, | ||
}, | ||
"include": [ | ||
"src/*" | ||
"src" | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
70
1724
130182
26
1