aura-get-verified
Version:
114 lines (112 loc) • 3.29 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
if (decorator = decorators[i])
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
if (kind && result) __defProp(target, key, result);
return result;
};
// src/components/iframe-project-verification.ts
import { html, LitElement } from "lit";
import { customElement, property } from "lit/decorators.js";
var productionAuraGetVerifiedURL = "https://aura-get-verified.vercel.app";
var IFramePorjectVerification = class extends LitElement {
constructor() {
super(...arguments);
this.height = 525;
this.level = 1;
this.foregroundColor = "#fffff";
this.iframeElement = null;
}
connectedCallback() {
super.connectedCallback();
window.addEventListener("message", this.onWindowMessage);
}
disconnectedCallback() {
window.removeEventListener("message", this.onWindowMessage);
}
onIframeLoad() {
this.iframeElement = this.renderRoot.querySelector("#iframe");
}
onWindowMessage(e) {
const message = e.data;
try {
const data = JSON.parse(message);
if (data.app !== "aura-get-verified") return;
switch (data.type) {
case "app-ready":
this.dispatchEvent(new CustomEvent("on-ready"));
return;
case "verification-success":
this.dispatchEvent(new CustomEvent("on-verification-success"));
return;
}
} catch {
return;
}
}
render() {
if (this.projectId) {
return html`
<iframe
id="iframe"
@load=${this.onIframeLoad}
.height=${`${this.height}px`}
.src=${productionAuraGetVerifiedURL + "/embed/projects/" + this.projectId}
></iframe>
`;
}
return html`
<iframe
id="iframe"
@load=${this.onIframeLoad}
.height=${`${this.height}px`}
.src=${productionAuraGetVerifiedURL + `/embed/verification?description=${this.description}&image=${this.image}&level=${this.level}&name=${this.projectName}`}
></iframe>
`;
}
};
__decorateClass([
property({
type: Number
})
], IFramePorjectVerification.prototype, "height", 2);
__decorateClass([
property({
type: Number
})
], IFramePorjectVerification.prototype, "projectId", 2);
__decorateClass([
property({
type: Number
})
], IFramePorjectVerification.prototype, "level", 2);
__decorateClass([
property({
type: String
})
], IFramePorjectVerification.prototype, "projectName", 2);
__decorateClass([
property({
type: String
})
], IFramePorjectVerification.prototype, "description", 2);
__decorateClass([
property({
type: String
})
], IFramePorjectVerification.prototype, "image", 2);
__decorateClass([
property({
type: String
})
], IFramePorjectVerification.prototype, "foregroundColor", 2);
IFramePorjectVerification = __decorateClass([
customElement("iframe-project-verification")
], IFramePorjectVerification);
export {
IFramePorjectVerification
};
//# sourceMappingURL=chunk-XU34N3CD.js.map