aura-get-verified
Version:
137 lines (135 loc) • 4.45 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
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/index.ts
var index_exports = {};
__export(index_exports, {
IFramePorjectVerification: () => IFramePorjectVerification
});
module.exports = __toCommonJS(index_exports);
// src/components/iframe-project-verification.ts
var import_lit = require("lit");
var import_decorators = require("lit/decorators.js");
var productionAuraGetVerifiedURL = "https://aura-get-verified.vercel.app";
var IFramePorjectVerification = class extends import_lit.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 import_lit.html`
<iframe
id="iframe"
@load=${this.onIframeLoad}
.height=${`${this.height}px`}
.src=${productionAuraGetVerifiedURL + "/embed/projects/" + this.projectId}
></iframe>
`;
}
return import_lit.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([
(0, import_decorators.property)({
type: Number
})
], IFramePorjectVerification.prototype, "height", 2);
__decorateClass([
(0, import_decorators.property)({
type: Number
})
], IFramePorjectVerification.prototype, "projectId", 2);
__decorateClass([
(0, import_decorators.property)({
type: Number
})
], IFramePorjectVerification.prototype, "level", 2);
__decorateClass([
(0, import_decorators.property)({
type: String
})
], IFramePorjectVerification.prototype, "projectName", 2);
__decorateClass([
(0, import_decorators.property)({
type: String
})
], IFramePorjectVerification.prototype, "description", 2);
__decorateClass([
(0, import_decorators.property)({
type: String
})
], IFramePorjectVerification.prototype, "image", 2);
__decorateClass([
(0, import_decorators.property)({
type: String
})
], IFramePorjectVerification.prototype, "foregroundColor", 2);
IFramePorjectVerification = __decorateClass([
(0, import_decorators.customElement)("iframe-project-verification")
], IFramePorjectVerification);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
IFramePorjectVerification
});
//# sourceMappingURL=index.cjs.map