gogo-ai-site-search
Version:
A plugin for Angular and Vue that integrates GOGO Get AI Site Search.
31 lines (24 loc) • 1 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.GOGOAISearchPlugin = factory());
})(this, (function () { 'use strict';
function GOGOAISearchPlugin(apiKey) {
if (!apiKey) {
throw new Error("API key is required");
}
// Create div with data-api-key attribute
var div = document.createElement("div");
div.id = "root";
div.setAttribute("data-api-key", apiKey);
document.body.appendChild(div);
// Set global variable
window.pluginApiKey = apiKey;
// Append script to body
var script = document.createElement("script");
script.src = "https://gogostorage-f9fhfkgge4g8dvgk.z03.azurefd.net/search-plugin-snippet/main.js";
script.async = true;
document.body.appendChild(script);
}
return GOGOAISearchPlugin;
}));