UNPKG

aura-get-verified

Version:
182 lines (177 loc) 6.44 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; 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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); 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/react.ts var react_exports = {}; __export(react_exports, { AuraReactIFrameVerification: () => AuraReactIFrameVerification }); module.exports = __toCommonJS(react_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(e2) { const message = e2.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); // ../../node_modules/@lit/react/node/create-component.js var e = /* @__PURE__ */ new Set(["children", "localName", "ref", "style", "className"]); var t = ({ react: t2, tagName: n, elementClass: l, events: a, displayName: c }) => { const s = new Set(Object.keys(a ?? {})), o = t2.forwardRef((a2, c2) => { t2.useRef(/* @__PURE__ */ new Map()); const o2 = t2.useRef(null), r = {}, m = {}; for (const [t3, n2] of Object.entries(a2)) e.has(t3) ? r["className" === t3 ? "class" : t3] = n2 : s.has(t3) || t3 in l.prototype ? m[t3] = n2 : r[t3] = n2; return ("litPatchedCreateElement" === t2.createElement.name || globalThis.litSsrReactEnabled) && Object.keys(m).length && (r._$litProps$ = m), t2.createElement(n, { ...r, ref: t2.useCallback((e2) => { o2.current = e2, "function" == typeof c2 ? c2(e2) : null !== c2 && (c2.current = e2); }, [c2]) }); }); return o.displayName = c ?? l.name, o; }; // src/react.ts var React = __toESM(require("react"), 1); var AuraReactIFrameVerification = t({ tagName: "iframe-project-verification", elementClass: IFramePorjectVerification, react: React, events: { onReady: "on-ready", onVerificationSuccess: "on-verification-success" } }); // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { AuraReactIFrameVerification }); /*! Bundled license information: @lit/react/node/create-component.js: (** * @license * Copyright 2018 Google LLC * SPDX-License-Identifier: BSD-3-Clause *) */ //# sourceMappingURL=react.cjs.map