diff --git a/examples/template-url/wafir.yaml b/examples/template-url/wafir.yaml new file mode 100644 index 0000000..ece1c58 --- /dev/null +++ b/examples/template-url/wafir.yaml @@ -0,0 +1,56 @@ +# Uses simpler.grants.gov's issue templates for an example on how to use templateUrl +title: "Project Management Portal" +targets: + - id: "main-repo" + type: "github/issues" + target: "HHS/simpler-grants-gov" + authRef: "YOUR_INSTALLATION_ID" + +forms: + - id: "bug-report" + label: "Bug Report" + icon: "🐞" + targets: ["main-repo"] + templateUrl: "https://raw.githubusercontent.com/HHS/simpler-grants-gov/main/.github/ISSUE_TEMPLATE/1_bug_report.yml" + + - id: "feature-request" + label: "Feature Request" + icon: "💡" + targets: ["main-repo"] + templateUrl: "https://raw.githubusercontent.com/HHS/simpler-grants-gov/main/.github/ISSUE_TEMPLATE/2_feature_request.yml" + + - id: "internal-decision" + label: "Internal Decision" + icon: "⚖️" + targets: ["main-repo"] + templateUrl: "https://raw.githubusercontent.com/HHS/simpler-grants-gov/main/.github/ISSUE_TEMPLATE/3_internal_decision.yml" + + - id: "internal-deliverable" + label: "Internal Deliverable" + icon: "📦" + targets: ["main-repo"] + templateUrl: "https://raw.githubusercontent.com/HHS/simpler-grants-gov/main/.github/ISSUE_TEMPLATE/4_internal_deliverable.yml" + + - id: "internal-epic" + label: "Internal Epic" + icon: "🏔️" + targets: ["main-repo"] + templateUrl: "https://raw.githubusercontent.com/HHS/simpler-grants-gov/main/.github/ISSUE_TEMPLATE/5_internal_epic.yml" + + - id: "internal-task" + label: "Internal Task" + icon: "✅" + targets: ["main-repo"] + templateUrl: "https://raw.githubusercontent.com/HHS/simpler-grants-gov/main/.github/ISSUE_TEMPLATE/6_internal_task.yml" + + - id: "internal-proposal" + label: "Internal Proposal" + icon: "📝" + targets: ["main-repo"] + templateUrl: "https://raw.githubusercontent.com/HHS/simpler-grants-gov/main/.github/ISSUE_TEMPLATE/7_internal_proposal.yml" + + - id: "internal-recurring-sam" + label: "Recurring SAM" + icon: "🔄" + targets: ["main-repo"] + templateUrl: "https://raw.githubusercontent.com/HHS/simpler-grants-gov/main/.github/ISSUE_TEMPLATE/8_internal_reoccuring_sam.yml" diff --git a/packages/wafir/injector.js b/packages/wafir/injector.js new file mode 100644 index 0000000..7fb92e5 --- /dev/null +++ b/packages/wafir/injector.js @@ -0,0 +1,43 @@ +/** + * HOW TO ADD TO CHROME: + * 1. Press Ctrl+Shift+B (Cmd+Shift+B on Mac) to ensure your Bookmarks Bar is visible. + * 2. Right-click any empty space on the Bookmarks Bar and select "Add Page...". + * 3. In the "Name" field, type something like "Launch Wafir". + * 4. In the "URL" field, paste the MINIFIED code provided below (the one starting with javascript:). + * 5. Click "Save". + * + * TO USE: + * Go to any website and click the "Launch Wafir" bookmark you just created. + */ +(function () { + const TAG_NAME = "wafir-widget"; + const SCRIPT_URL = + "https://wafir-all.s3.us-east-2.amazonaws.com/wafir/latest/wafir.js"; + + const BRIDGE_URL = ""; // Blank for default + const CONFIG_URL = "https://your-config-url.com"; + + // Prevent multiple injections + if (document.querySelector(TAG_NAME)) { + console.log("Widget already loaded."); + return; + } + + const script = document.createElement("script"); + script.type = "module"; + script.crossOrigin = "anonymous"; // Required for loading ES modules from S3/CORS + script.src = SCRIPT_URL; + + script.onload = () => { + const widget = document.createElement(TAG_NAME); + + // Set the attributes only if they are provided + if (BRIDGE_URL) widget.setAttribute("bridge-url", BRIDGE_URL); + if (CONFIG_URL) widget.setAttribute("config-url", CONFIG_URL); + + // Append to body + document.body.appendChild(widget); + }; + + document.head.appendChild(script); +})();