@grammarly/editor-sdk
Advanced tools
Comparing version 1.0.0-beta.11 to 1.0.0-beta.12
@@ -17,2 +17,2 @@ /** | ||
*/ | ||
function findScript(url){const scripts=document.querySelectorAll(`script[src^="${url}"]`);return scripts[0]}function injectScript(url){const script=document.createElement("script");script.src=url;document.body.appendChild(script);return script}const promises=new Map;const scripts=new Set;async function loadScript(url,clientId){if(promises.has(url)){return await promises.get(url)}else if(scripts.has(url)){return window.Grammarly}else{const grammarlyPromise=new Promise(((resolve,reject)=>{if(typeof window==="undefined"){return resolve(null)}try{let script=findScript(url);if(script!=null){console.warn(`<script src="${url}" /> already exists.`)}else{script=injectScript(clientId!=null?`${url}?clientId=${clientId}`:url)}script.addEventListener("load",(()=>{if(window.Grammarly!=null){scripts.add(url);resolve(window.Grammarly)}else{reject(new Error("Grammarly not available"))}}));script.addEventListener("error",(function(){reject(new Error(`Failed to load ${url}`))}))}catch(error){return reject(error)}}));promises.set(url,grammarlyPromise);return grammarlyPromise}}const resolvedVersion="1.0.0-beta.11";async function init(clientId){var _a,_b;const Grammarly=await loadScript((_a=undefined)!==null&&_a!==void 0?_a:`https://js.${(_b="grammarly.com")!==null&&_b!==void 0?_b:"grammarly.com"}/grammarly-editor-sdk@${resolvedVersion}`,clientId);if(clientId!=null){return new Grammarly.EditorFactory(clientId)}}export{init}; | ||
function findScript(url){const scripts=document.querySelectorAll(`script[src^="${url}"]`);return scripts[0]}function injectScript(url){const script=document.createElement("script");script.src=url;document.body.appendChild(script);return script}const promises=new Map;const scripts=new Set;async function loadScript(url,clientId){if(promises.has(url)){return await promises.get(url)}else if(scripts.has(url)){return window.Grammarly}else{const grammarlyPromise=new Promise(((resolve,reject)=>{if(typeof window==="undefined"){return resolve(null)}try{let script=findScript(url);if(script!=null){console.warn(`<script src="${url}" /> already exists.`)}else{script=injectScript(clientId!=null?`${url}?clientId=${clientId}`:url)}script.addEventListener("load",(()=>{if(window.Grammarly!=null){scripts.add(url);resolve(window.Grammarly)}else{reject(new Error("Grammarly not available"))}}));script.addEventListener("error",(function(){reject(new Error(`Failed to load ${url}`))}))}catch(error){return reject(error)}}));promises.set(url,grammarlyPromise);return grammarlyPromise}}const resolvedVersion="1.0.0-beta.12";async function init(clientId){var _a,_b;const Grammarly=await loadScript((_a=undefined)!==null&&_a!==void 0?_a:`https://js.${(_b="grammarly.com")!==null&&_b!==void 0?_b:"grammarly.com"}/grammarly-editor-sdk@${resolvedVersion}`,clientId);if(clientId!=null){return new Grammarly.EditorFactory(clientId)}}export{init}; |
@@ -17,2 +17,2 @@ !function(){"use strict"; | ||
* limitations under the License. | ||
*/const n=new Map,t=new Set;async function r(r,e){if(n.has(r))return await n.get(r);if(t.has(r))return window.Grammarly;{const c=new Promise(((n,c)=>{if("undefined"==typeof window)return n(null);try{let i=function(n){return document.querySelectorAll(`script[src^="${n}"]`)[0]}(r);null!=i?console.warn(`<script src="${r}" /> already exists.`):i=function(n){const t=document.createElement("script");return t.src=n,document.body.appendChild(t),t}(null!=e?`${r}?clientId=${e}`:r),i.addEventListener("load",(()=>{null!=window.Grammarly?(t.add(r),n(window.Grammarly)):c(new Error("Grammarly not available"))})),i.addEventListener("error",(function(){c(new Error(`Failed to load ${r}`))}))}catch(n){return c(n)}}));return n.set(r,c),c}}async function e(n){var t;const e=await r((void 0,`https://js.${null!==(t="grammarly.com")?t:"grammarly.com"}/grammarly-editor-sdk@1.0.0-beta.11`),n);if(null!=n)return new e.EditorFactory(n)}const c=function(){const n=function(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}();if(n){const t=n.src;if(t){const n=new URL(t).searchParams.get("clientId");if(null!=n)return n}const r=n.getAttribute("clientId");if(null!=r)return r}}();null!=c?e(c):e()}(); | ||
*/const n=new Map,t=new Set;async function r(r,e){if(n.has(r))return await n.get(r);if(t.has(r))return window.Grammarly;{const c=new Promise(((n,c)=>{if("undefined"==typeof window)return n(null);try{let i=function(n){return document.querySelectorAll(`script[src^="${n}"]`)[0]}(r);null!=i?console.warn(`<script src="${r}" /> already exists.`):i=function(n){const t=document.createElement("script");return t.src=n,document.body.appendChild(t),t}(null!=e?`${r}?clientId=${e}`:r),i.addEventListener("load",(()=>{null!=window.Grammarly?(t.add(r),n(window.Grammarly)):c(new Error("Grammarly not available"))})),i.addEventListener("error",(function(){c(new Error(`Failed to load ${r}`))}))}catch(n){return c(n)}}));return n.set(r,c),c}}async function e(n){var t;const e=await r((void 0,`https://js.${null!==(t="grammarly.com")?t:"grammarly.com"}/grammarly-editor-sdk@1.0.0-beta.12`),n);if(null!=n)return new e.EditorFactory(n)}const c=function(){const n=function(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}();if(n){const t=n.src;if(t){const n=new URL(t).searchParams.get("clientId");if(null!=n)return n}const r=n.getAttribute("clientId");if(null!=r)return r}}();null!=c?e(c):e()}(); |
@@ -17,2 +17,2 @@ "use strict"; | ||
* limitations under the License. | ||
*/Object.defineProperty(exports,"__esModule",{value:true});function findScript(url){const scripts=document.querySelectorAll(`script[src^="${url}"]`);return scripts[0]}function injectScript(url){const script=document.createElement("script");script.src=url;document.body.appendChild(script);return script}const promises=new Map;const scripts=new Set;async function loadScript(url,clientId){if(promises.has(url)){return await promises.get(url)}else if(scripts.has(url)){return window.Grammarly}else{const grammarlyPromise=new Promise(((resolve,reject)=>{if(typeof window==="undefined"){return resolve(null)}try{let script=findScript(url);if(script!=null){console.warn(`<script src="${url}" /> already exists.`)}else{script=injectScript(clientId!=null?`${url}?clientId=${clientId}`:url)}script.addEventListener("load",(()=>{if(window.Grammarly!=null){scripts.add(url);resolve(window.Grammarly)}else{reject(new Error("Grammarly not available"))}}));script.addEventListener("error",(function(){reject(new Error(`Failed to load ${url}`))}))}catch(error){return reject(error)}}));promises.set(url,grammarlyPromise);return grammarlyPromise}}const resolvedVersion="1.0.0-beta.11";async function init(clientId){var _a,_b;const Grammarly=await loadScript((_a=undefined)!==null&&_a!==void 0?_a:`https://js.${(_b="grammarly.com")!==null&&_b!==void 0?_b:"grammarly.com"}/grammarly-editor-sdk@${resolvedVersion}`,clientId);if(clientId!=null){return new Grammarly.EditorFactory(clientId)}}exports.init=init; | ||
*/Object.defineProperty(exports,"__esModule",{value:true});function findScript(url){const scripts=document.querySelectorAll(`script[src^="${url}"]`);return scripts[0]}function injectScript(url){const script=document.createElement("script");script.src=url;document.body.appendChild(script);return script}const promises=new Map;const scripts=new Set;async function loadScript(url,clientId){if(promises.has(url)){return await promises.get(url)}else if(scripts.has(url)){return window.Grammarly}else{const grammarlyPromise=new Promise(((resolve,reject)=>{if(typeof window==="undefined"){return resolve(null)}try{let script=findScript(url);if(script!=null){console.warn(`<script src="${url}" /> already exists.`)}else{script=injectScript(clientId!=null?`${url}?clientId=${clientId}`:url)}script.addEventListener("load",(()=>{if(window.Grammarly!=null){scripts.add(url);resolve(window.Grammarly)}else{reject(new Error("Grammarly not available"))}}));script.addEventListener("error",(function(){reject(new Error(`Failed to load ${url}`))}))}catch(error){return reject(error)}}));promises.set(url,grammarlyPromise);return grammarlyPromise}}const resolvedVersion="1.0.0-beta.12";async function init(clientId){var _a,_b;const Grammarly=await loadScript((_a=undefined)!==null&&_a!==void 0?_a:`https://js.${(_b="grammarly.com")!==null&&_b!==void 0?_b:"grammarly.com"}/grammarly-editor-sdk@${resolvedVersion}`,clientId);if(clientId!=null){return new Grammarly.EditorFactory(clientId)}}exports.init=init; |
@@ -5,3 +5,3 @@ { | ||
"description": "Grammarly writing SDK for web editors", | ||
"version": "1.0.0-beta.11", | ||
"version": "1.0.0-beta.12", | ||
"main": "lib/index.js", | ||
@@ -27,4 +27,4 @@ "module": "lib/index.esm.js", | ||
"devDependencies": { | ||
"@grammarly/plugin-core": "1.0.0-beta.11", | ||
"@grammarly/plugin-editor": "1.0.0-beta.11", | ||
"@grammarly/plugin-core": "1.0.0-beta.12", | ||
"@grammarly/plugin-editor": "1.0.0-beta.12", | ||
"@microsoft/api-extractor": "^7.15.1", | ||
@@ -31,0 +31,0 @@ "@types/jest": "^26.0.22", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package