airwallex-payment-elements
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -1,43 +0,26 @@ | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { | ||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } | ||
return cooked; | ||
}; | ||
import { LitElement, html } from 'lit-element'; | ||
var CHECKOUT_IFRAME_NAME = 'airwallex_checkout_frame'; | ||
var IframeStyle = { | ||
width: '100%', | ||
height: '550px', | ||
margin: '4px' | ||
}; | ||
var Airwallex = (function (_super) { | ||
__extends(Airwallex, _super); | ||
function Airwallex() { | ||
var _this = _super.call(this) || this; | ||
_this.host = _this.paymentId = _this.successUrl = _this.cancelUrl = _this.errorUrl = ''; | ||
return _this; | ||
import { css, LitElement, html } from 'lit-element'; | ||
const CHECKOUT_IFRAME_NAME = 'airwallex_checkout_frame'; | ||
export class Airwallex extends LitElement { | ||
constructor() { | ||
super(); | ||
this.host = this.paymentId = this.successUrl = this.cancelUrl = this.errorUrl = ''; | ||
} | ||
Object.defineProperty(Airwallex, "properties", { | ||
get: function () { | ||
return { host: { type: String }, paymentId: { type: String }, successUrl: { type: String }, cancelUrl: { type: String }, errorUrl: { type: String } }; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Airwallex.prototype.checkoutEventHandler = function (event) { | ||
static get properties() { | ||
return { host: { type: String }, paymentId: { type: String }, successUrl: { type: String }, cancelUrl: { type: String }, errorUrl: { type: String } }; | ||
} | ||
static get styles() { | ||
return css ` | ||
:host { | ||
width: 100%; | ||
} | ||
iframe { | ||
width: 100%; | ||
height: 550px; | ||
margin: 4px; | ||
}`; | ||
} | ||
checkoutEventHandler(event) { | ||
if (event.origin === window.location.origin) { | ||
console.info("Iframe Source Name: [" + event.source.name + "]"); | ||
console.info("Iframe Msg: [" + event.data + "]"); | ||
console.info(`Iframe Source Name: [${event.source.name}]`); | ||
console.info(`Iframe Msg: [${event.data}]`); | ||
if (CHECKOUT_IFRAME_NAME === event.source.name) { | ||
@@ -57,22 +40,27 @@ if (event.data === 'AWX_CHECKOUT_SUCCESS') { | ||
} | ||
}; | ||
Airwallex.prototype.connectedCallback = function () { | ||
_super.prototype.connectedCallback.call(this); | ||
window.addEventListener("message", this.checkoutEventHandler); | ||
}; | ||
Airwallex.prototype.disconnectedCallback = function () { | ||
window.removeEventListener("message", this.checkoutEventHandler); | ||
_super.prototype.disconnectedCallback.call(this); | ||
}; | ||
Airwallex.prototype.render = function () { | ||
return html(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n <iframe\n frameBorder=\"0\"\n allowtransparency=\"true\"\n importance=\"high\"\n scrolling=\"no\"\n name=\"", "\"\n allowpaymentrequest=\"true\"\n src=\"https://", "/checkout/", "?origin=", "\"\n title=\"Secure airwallex payment frame\"\n style=\"", "\"\n />\n "], ["\n <iframe\n frameBorder=\"0\"\n allowtransparency=\"true\"\n importance=\"high\"\n scrolling=\"no\"\n name=\"", "\"\n allowpaymentrequest=\"true\"\n src=\"https://", | ||
"/checkout/", | ||
"?origin=", | ||
"\"\n title=\"Secure airwallex payment frame\"\n style=\"", "\"\n />\n "])), CHECKOUT_IFRAME_NAME, this.host, this.paymentId, window.location.origin, IframeStyle); | ||
}; | ||
return Airwallex; | ||
}(LitElement)); | ||
export { Airwallex }; | ||
} | ||
connectedCallback() { | ||
super.connectedCallback(); | ||
window.addEventListener("message", (event) => this.checkoutEventHandler(event)); | ||
} | ||
disconnectedCallback() { | ||
window.removeEventListener("message", (event) => this.checkoutEventHandler(event)); | ||
super.disconnectedCallback(); | ||
} | ||
render() { | ||
return html ` | ||
<iframe | ||
frameBorder="0" | ||
allowtransparency="true" | ||
importance="high" | ||
scrolling="no" | ||
name="${CHECKOUT_IFRAME_NAME}" | ||
allowpaymentrequest="true" | ||
src="https://${this.host}/checkout/${this.paymentId}?origin=${window.location.origin}" | ||
title="Secure airwallex payment frame" | ||
/> | ||
`; | ||
} | ||
} | ||
customElements.define('airwallex-element', Airwallex); | ||
var templateObject_1; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "airwallex-payment-elements", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"main": "dist/index.js", | ||
@@ -15,11 +15,10 @@ "module": "dist/index.js", | ||
"author": "Charlie.Lang", | ||
"peerDependencies": { | ||
"lit-element": "^2.2.1" | ||
}, | ||
"devDependencies": { | ||
"lit-element": "^2.2.1", | ||
"tslint": "^5.18.0", | ||
"tslint-eslint-rules": "^5.4.0", | ||
"typescript": "^3.5.3" | ||
}, | ||
"dependencies": { | ||
"lit-element": "^2.2.1" | ||
} | ||
} |
/// | ||
declare module JSX { | ||
export namespace JSX { | ||
interface IntrinsicElements { | ||
"airwallex-element": any; | ||
} | ||
} | ||
} | ||
// declare global { | ||
// namespace JSX { | ||
// interface IntrinsicElements { | ||
// "airwallex-element": any; | ||
// } | ||
// } | ||
// } |
@@ -5,3 +5,3 @@ { | ||
// "incremental": true, /* Enable incremental compilation */ | ||
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ | ||
"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'. */ | ||
@@ -66,3 +66,3 @@ "lib": ["es2017", "dom"], /* Specify library files to be included in the compilation. */ | ||
/* Experimental Options */ | ||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ | ||
"experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ | ||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ | ||
@@ -69,0 +69,0 @@ }, |
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
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
15340
3
10
271
+ Addedlit-element@^2.2.1