Socket
Socket
Sign inDemoInstall

@grammarly/editor-sdk

Package Overview
Dependencies
Maintainers
7
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@grammarly/editor-sdk - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

44

lib/index.d.ts

@@ -263,15 +263,4 @@ /**

collectUserFeedback?: boolean;
/** Configuration for the UI */
ui?: {
/**
* Text shown to introduce first-time users to Grammarly.
*
* @remarks
* This introductory text shows in the footer of the first shown suggestion card
* as well as in the Grammarly button menu.
*
* @defaultValue "Grammarly helps you write clearly and mistake-free."
*/
introText?: string;
};
/** Configuration for the user interface of Grammarly. */
ui?: UIConfig;
/**

@@ -322,2 +311,29 @@ * Callback to receive stats about the user-entered text and Grammarly session.

/**
* Configuration for the user interface of Grammarly.
*
* @public
*/
interface UIConfig {
/**
* Text shown to introduce first-time users to Grammarly.
*
* @remarks
* This introductory text shows in the footer of the first shown suggestion card
* as well as in the Grammarly button menu.
*
* @defaultValue "Grammarly helps you write clearly and mistake-free."
*/
introText?: string;
/**
* Show the tone detector interface (beside the Grammarly button).
* @defaultValue false
*
* @remarks
* Note that tone detection requires a text of at least 150 characters.
*
* @internal
*/
showToneDetector?: boolean;
}
/**
* Specific variety of English being written.

@@ -413,2 +429,2 @@ *

export { ClientId, Dialect, DocumentConfig, Domain, Editor, EditorConfig, EditorFactory, PluginDisableReason, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, TextStats, Time, init };
export { ClientId, Dialect, DocumentConfig, Domain, Editor, EditorConfig, EditorFactory, PluginDisableReason, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, TextStats, Time, UIConfig, init };

@@ -17,2 +17,2 @@ /**

*/
var ExceptionCodes={};ExceptionCodes[ExceptionCodes["UNKNOWN"]=1e3]="UNKNOWN";ExceptionCodes[ExceptionCodes["ENVIRONMENT_UNSUPPORTED"]=3001]="ENVIRONMENT_UNSUPPORTED";const messages={[ExceptionCodes.UNKNOWN]:"Unknown error",[ExceptionCodes.ENVIRONMENT_UNSUPPORTED]:"The environment is not supported"};class GrammarlyException extends Error{constructor(code=ExceptionCodes.UNKNOWN,message=messages[code]){super(message);this.code=code}}GrammarlyException.codes=ExceptionCodes;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.head.appendChild(script);return script}const promises=new Map;function initGrammarlyGlobalAPI(){if(typeof window==="undefined"){return}if(window.Grammarly!=null)return;window.Grammarly={}}async function loadScript(url,clientId){if(typeof window==="undefined"){return await Promise.reject(new GrammarlyException(GrammarlyException.codes.ENVIRONMENT_UNSUPPORTED,"Cannot load script in non-browser environment"))}initGrammarlyGlobalAPI();if(promises.has(url)){return await promises.get(url)}else{const grammarlyPromise=new Promise(((resolve,reject)=>{try{let script=findScript(url);if(script!=null){resolve(window.Grammarly)}else{script=injectScript(clientId!=null?`${url}?clientId=${clientId}`:url);script.addEventListener("load",(()=>{if(window.Grammarly!=null){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)}})).finally((()=>{promises.delete(url)}));promises.set(url,grammarlyPromise);return grammarlyPromise}}const[versionMajor,versionMinor]="1.2.2".split(".");const resolvedVersion=`${versionMajor}.${versionMinor}`;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};
var ExceptionCodes={};ExceptionCodes[ExceptionCodes["UNKNOWN"]=1e3]="UNKNOWN";ExceptionCodes[ExceptionCodes["ENVIRONMENT_UNSUPPORTED"]=3001]="ENVIRONMENT_UNSUPPORTED";const messages={[ExceptionCodes.UNKNOWN]:"Unknown error",[ExceptionCodes.ENVIRONMENT_UNSUPPORTED]:"The environment is not supported"};class GrammarlyException extends Error{constructor(code=ExceptionCodes.UNKNOWN,message=messages[code]){super(message);this.code=code}}GrammarlyException.codes=ExceptionCodes;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.head.appendChild(script);return script}const promises=new Map;function initGrammarlyGlobalAPI(){if(typeof window==="undefined"){return}if(window.Grammarly!=null)return;window.Grammarly={}}async function loadScript(url,clientId){if(typeof window==="undefined"){return await Promise.reject(new GrammarlyException(GrammarlyException.codes.ENVIRONMENT_UNSUPPORTED,"Cannot load script in non-browser environment"))}initGrammarlyGlobalAPI();if(promises.has(url)){return await promises.get(url)}else{const grammarlyPromise=new Promise(((resolve,reject)=>{try{let script=findScript(url);if(script!=null){resolve(window.Grammarly)}else{script=injectScript(clientId!=null?`${url}?clientId=${clientId}`:url);script.addEventListener("load",(()=>{if(window.Grammarly!=null){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)}})).finally((()=>{promises.delete(url)}));promises.set(url,grammarlyPromise);return grammarlyPromise}}const[versionMajor,versionMinor]="1.2.3".split(".");const resolvedVersion=`${versionMajor}.${versionMinor}`;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";var n={};n[n.UNKNOWN=1e3]="UNKNOWN",n[n.ENVIRONMENT_UNSUPPORTED=3001]="ENVIRONMENT_UNSUPPORTED";const r={[n.UNKNOWN]:"Unknown error",[n.ENVIRONMENT_UNSUPPORTED]:"The environment is not supported"};class t extends Error{constructor(t=n.UNKNOWN,e=r[t]){super(e),this.code=t}}t.codes=n;const e=new Map;async function o(n,r){if("undefined"==typeof window)return await Promise.reject(new t(t.codes.ENVIRONMENT_UNSUPPORTED,"Cannot load script in non-browser environment"));if("undefined"!=typeof window&&null==window.Grammarly&&(window.Grammarly={}),e.has(n))return await e.get(n);{const t=new Promise(((t,e)=>{try{let o=function(n){return document.querySelectorAll(`script[src^="${n}"]`)[0]}(n);null!=o?t(window.Grammarly):(o=function(n){const r=document.createElement("script");return r.src=n,document.head.appendChild(r),r}(null!=r?`${n}?clientId=${r}`:n),o.addEventListener("load",(()=>{null!=window.Grammarly?t(window.Grammarly):e(new Error("Grammarly not available"))})),o.addEventListener("error",(function(){e(new Error(`Failed to load ${n}`))})))}catch(n){return e(n)}})).finally((()=>{e.delete(n)}));return e.set(n,t),t}}const[i,a]="1.2.2".split("."),c=`${i}.${a}`;async function l(n){var r;const t=await o((void 0,`https://js.${null!==(r="grammarly.com")?r:"grammarly.com"}/grammarly-editor-sdk@${c}`),n);if(null!=n)return new t.EditorFactory(n)}const s=function(){const n=function(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}();if(n){const r=n.src;if(r){const n=new URL(r).searchParams.get("clientId");if(null!=n)return n}const t=n.getAttribute("clientId");if(null!=t)return t}}(),u=null!=s?l(s):void 0;window.Grammarly.init=async(n=s)=>{const r=s===n?await u:null!=n?await l(n):void 0;if(null==r)throw new Error('A "clientId" is required to init Grammarly SDK.');return r}}();
!function(){"use strict";var n={};n[n.UNKNOWN=1e3]="UNKNOWN",n[n.ENVIRONMENT_UNSUPPORTED=3001]="ENVIRONMENT_UNSUPPORTED";const r={[n.UNKNOWN]:"Unknown error",[n.ENVIRONMENT_UNSUPPORTED]:"The environment is not supported"};class t extends Error{constructor(t=n.UNKNOWN,e=r[t]){super(e),this.code=t}}t.codes=n;const e=new Map;async function o(n,r){if("undefined"==typeof window)return await Promise.reject(new t(t.codes.ENVIRONMENT_UNSUPPORTED,"Cannot load script in non-browser environment"));if("undefined"!=typeof window&&null==window.Grammarly&&(window.Grammarly={}),e.has(n))return await e.get(n);{const t=new Promise(((t,e)=>{try{let o=function(n){return document.querySelectorAll(`script[src^="${n}"]`)[0]}(n);null!=o?t(window.Grammarly):(o=function(n){const r=document.createElement("script");return r.src=n,document.head.appendChild(r),r}(null!=r?`${n}?clientId=${r}`:n),o.addEventListener("load",(()=>{null!=window.Grammarly?t(window.Grammarly):e(new Error("Grammarly not available"))})),o.addEventListener("error",(function(){e(new Error(`Failed to load ${n}`))})))}catch(n){return e(n)}})).finally((()=>{e.delete(n)}));return e.set(n,t),t}}const[i,a]="1.2.3".split("."),c=`${i}.${a}`;async function l(n){var r;const t=await o((void 0,`https://js.${null!==(r="grammarly.com")?r:"grammarly.com"}/grammarly-editor-sdk@${c}`),n);if(null!=n)return new t.EditorFactory(n)}const s=function(){const n=function(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}();if(n){const r=n.src;if(r){const n=new URL(r).searchParams.get("clientId");if(null!=n)return n}const t=n.getAttribute("clientId");if(null!=t)return t}}(),u=null!=s?l(s):void 0;window.Grammarly.init=async(n=s)=>{const r=s===n?await u:null!=n?await l(n):void 0;if(null==r)throw new Error('A "clientId" is required to init Grammarly SDK.');return r}}();

@@ -17,2 +17,2 @@ /**

*/
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var ExceptionCodes={};ExceptionCodes[ExceptionCodes["UNKNOWN"]=1e3]="UNKNOWN";ExceptionCodes[ExceptionCodes["ENVIRONMENT_UNSUPPORTED"]=3001]="ENVIRONMENT_UNSUPPORTED";const messages={[ExceptionCodes.UNKNOWN]:"Unknown error",[ExceptionCodes.ENVIRONMENT_UNSUPPORTED]:"The environment is not supported"};class GrammarlyException extends Error{constructor(code=ExceptionCodes.UNKNOWN,message=messages[code]){super(message);this.code=code}}GrammarlyException.codes=ExceptionCodes;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.head.appendChild(script);return script}const promises=new Map;function initGrammarlyGlobalAPI(){if(typeof window==="undefined"){return}if(window.Grammarly!=null)return;window.Grammarly={}}async function loadScript(url,clientId){if(typeof window==="undefined"){return await Promise.reject(new GrammarlyException(GrammarlyException.codes.ENVIRONMENT_UNSUPPORTED,"Cannot load script in non-browser environment"))}initGrammarlyGlobalAPI();if(promises.has(url)){return await promises.get(url)}else{const grammarlyPromise=new Promise(((resolve,reject)=>{try{let script=findScript(url);if(script!=null){resolve(window.Grammarly)}else{script=injectScript(clientId!=null?`${url}?clientId=${clientId}`:url);script.addEventListener("load",(()=>{if(window.Grammarly!=null){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)}})).finally((()=>{promises.delete(url)}));promises.set(url,grammarlyPromise);return grammarlyPromise}}const[versionMajor,versionMinor]="1.2.2".split(".");const resolvedVersion=`${versionMajor}.${versionMinor}`;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;
"use strict";Object.defineProperty(exports,"__esModule",{value:true});var ExceptionCodes={};ExceptionCodes[ExceptionCodes["UNKNOWN"]=1e3]="UNKNOWN";ExceptionCodes[ExceptionCodes["ENVIRONMENT_UNSUPPORTED"]=3001]="ENVIRONMENT_UNSUPPORTED";const messages={[ExceptionCodes.UNKNOWN]:"Unknown error",[ExceptionCodes.ENVIRONMENT_UNSUPPORTED]:"The environment is not supported"};class GrammarlyException extends Error{constructor(code=ExceptionCodes.UNKNOWN,message=messages[code]){super(message);this.code=code}}GrammarlyException.codes=ExceptionCodes;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.head.appendChild(script);return script}const promises=new Map;function initGrammarlyGlobalAPI(){if(typeof window==="undefined"){return}if(window.Grammarly!=null)return;window.Grammarly={}}async function loadScript(url,clientId){if(typeof window==="undefined"){return await Promise.reject(new GrammarlyException(GrammarlyException.codes.ENVIRONMENT_UNSUPPORTED,"Cannot load script in non-browser environment"))}initGrammarlyGlobalAPI();if(promises.has(url)){return await promises.get(url)}else{const grammarlyPromise=new Promise(((resolve,reject)=>{try{let script=findScript(url);if(script!=null){resolve(window.Grammarly)}else{script=injectScript(clientId!=null?`${url}?clientId=${clientId}`:url);script.addEventListener("load",(()=>{if(window.Grammarly!=null){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)}})).finally((()=>{promises.delete(url)}));promises.set(url,grammarlyPromise);return grammarlyPromise}}const[versionMajor,versionMinor]="1.2.3".split(".");const resolvedVersion=`${versionMajor}.${versionMinor}`;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.2.2",
"version": "1.2.3",
"main": "lib/index.js",

@@ -27,4 +27,4 @@ "module": "lib/index.esm.js",

"devDependencies": {
"@grammarly/plugin-core": "1.2.2",
"@grammarly/plugin-editor": "1.2.2",
"@grammarly/plugin-core": "1.2.3",
"@grammarly/plugin-editor": "1.2.3",
"@microsoft/api-extractor": "^7.15.1",

@@ -31,0 +31,0 @@ "@testing-library/jest-dom": "^5.11.10",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc