Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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.9.1 to 1.9.2

313

lib/editor-sdk.beta.d.ts

@@ -49,7 +49,7 @@ /**

/** @since v1.3.0 */
| "auto-text"
| "auto-text"
/** @since v1.3.0 */
| "auto-browser"
| "auto-browser"
/** @deprecated since v1.3.0 - Use "auto-browser" instead */
| "auto";
| "auto";

@@ -124,5 +124,5 @@ /**

declare class Editor {
/**

@@ -136,3 +136,3 @@ * Returns the GrammarlyEditorPlugin element directly if you need to

get element(): GrammarlyEditorPluginElement;
/**

@@ -198,5 +198,14 @@ * Current editor configuration

* @public
* @deprecated since v1.9.2 - use `suggestionCategories` instead
*/
suggestions?: SuggestionCategories;
suggestions?: SuggestionCategoriesDeprecated;
/**
* Categories of suggestions that can be muted.
*
* {@link https://codesandbox.io/s/github/grammarly/grammarly-for-developers/tree/main/examples/editor-sdk-suggestions-config?file=/public/index.html | Try it out}
*
* @public
*/
suggestionCategories?: SuggestionCategories;
/**
* Collect user feedback after the user takes action on 5 suggestions.

@@ -227,3 +236,4 @@ *

* @remarks
* This introductory text shows in the footer of the first shown suggestion card.
* This introductory text shows in the footer of suggestion cards until the user first accepts
* or dismisses a suggestion.
*

@@ -311,2 +321,11 @@ * {@link https://codesandbox.io/s/github/grammarly/grammarly-for-developers/tree/main/examples/editor-sdk-intro-text?file=/public/index.html | Try it out}

/**
* Show underlines for suggestions.
*
*
* @defaultValue "on"
* @public
* @since v1.9.2
*/
underlines?: "on" | "off";
/**
* Callback to receive stats about the user-entered text and Grammarly session.

@@ -318,2 +337,3 @@ * @deprecated since v1.9.0 - use `document-stats` or `session-stats` events instead.

* Triggered when the user consciously disables the plugin. Not triggered again once already disabled.
* @deprecated since v1.9.0 - use plugin-turned-off event
*/

@@ -357,5 +377,5 @@ onPluginDisable?: (reason: PluginDisableReason) => void;

declare class EditorSDK {
/**

@@ -370,3 +390,3 @@ * Enhance a specific HTML element with Grammarly.

addPlugin(element: HTMLElement, config?: EditorConfig, viewport?: HTMLElement): GrammarlyEditorPluginElement;
/**

@@ -431,3 +451,3 @@ * Enhance a specific HTML element with Grammarly.

declare interface GrammarlyEditorPluginCallbacks {
/**

@@ -485,14 +505,13 @@ * Triggered when a suggestion card is opened

declare class GrammarlyEditorPluginElement extends HTMLElement {
disconnect(): void;
/**

@@ -517,14 +536,21 @@ * Current editor configuration

connect(editor: EditorElement, viewport?: HTMLElement): void;
/**
* Remove plugin from the editor.
*
* @public
* @since v1.9.2
*/
disconnect(): void;
addEventListener<K extends keyof GrammarlyEditorPluginElementEventMap>(type: K, listener: (this: HTMLElement, ev: GrammarlyEditorPluginElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
removeEventListener<K extends keyof GrammarlyEditorPluginElementEventMap>(type: K, listener: (this: HTMLElement, ev: GrammarlyEditorPluginElementEventMap[K]) => any, options?: boolean | EventListenerOptions | undefined): void;
}

@@ -535,2 +561,4 @@

*
* {@link https://codesandbox.io/s/github/grammarly/grammarly-for-developers/tree/main/examples/editor-sdk-events?file=/public/index.html | Try it out}
*
* @public

@@ -540,3 +568,3 @@ * @since v1.8.0

declare interface GrammarlyEditorPluginElementEventMap extends HTMLElementEventMap {
/**

@@ -672,3 +700,3 @@ * Triggered when a suggestion card is opened

* @remarks
* `false` means any suggestions belonging to that category will be "muted" (not visible to the user)
* "off" means any suggestions belonging to that category will be "muted" (not visible to the user)
*

@@ -681,2 +709,209 @@ * @public

*
* @defaultValue "on"
*/
variety?: "on" | "off";
/**
* Suggests alternatives to bland and overused words such as "good" and "nice".
*
* @defaultValue "on"
*/
vocabulary?: "on" | "off";
/**
* Suggests ways to sound more natural and fluent.
*
* @defaultValue "on"
*/
fluency?: "on" | "off";
/**
* Suggests adding the Oxford comma after the second-to-last item in a list of things.
*
* @defaultValue "off"
*/
oxfordComma?: "on" | "off";
/**
* Flags unnecessary use of ellipses (...).
*
* @defaultValue "off"
*/
unnecessaryEllipses?: "on" | "off";
/**
* Suggests placing punctuation before closing quotation marks.
*
* @defaultValue "on"
*/
punctuationWithQuotation?: "on" | "off";
/**
* Suggests completing all incomplete sentences, including stylistic sentence fragments that may be intentional.
*
* @defaultValue "off"
*/
stylisticFragments?: "on" | "off";
/**
* Flags use of personal pronouns such as "I" and "you" in academic writing.
*
* @defaultValue "off"
*/
informalPronounsAcademic?: "on" | "off";
/**
* Flags use of conjunctions such as "but" and "and" at the beginning of sentences.
*
* @defaultValue "off"
*/
conjunctionAtStartOfSentence?: "on" | "off";
/**
* Flags use of prepositions such as "with" and "in" at the end of sentences.
*
* @defaultValue "off"
*/
prepositionAtTheEndOfSentence?: "on" | "off";
/**
* Suggests rewriting split infinitives so that an adverb doesn't come between "to" and the verb.
*
* @defaultValue "on"
*/
splitInfinitive?: "on" | "off";
/**
* Suggests adding missing spacing after a numeral when writing times.
*
* @defaultValue "on"
*/
missingSpaces?: "on" | "off";
/**
* Flags use of passive voice.
*
* @defaultValue "off"
*/
passiveVoice?: "on" | "off";
/**
* Flags long, complicated sentences that could potentially confuse your reader.
*
* @defaultValue "on"
*/
readabilityFillerWords?: "on" | "off";
/**
* Suggests splitting long, complicated sentences that could potentially confuse your reader.
*
* @defaultValue "on"
*/
readabilityTransforms?: "on" | "off";
/**
* Suggests using person-first language to refer respectfully to an individual with a disability.
*
* @defaultValue "on"
*/
personFirstLanguage?: "on" | "off";
/**
* Suggests alternatives to potentially gender-biased and non-inclusive phrasing.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageGenderRelated?: "on" | "off";
/**
* Flags LGBTQIA+-related terms that may be seen as biased, outdated, or disrespectful in some contexts.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageLGBTQIARelated?: "on" | "off";
/**
* Suggests alternatives to language that may be considered politically incorrect.
*
* @defaultValue "on"
*/
possiblyPoliticallyIncorrectLanguage?: "on" | "off";
/**
* Suggests alternatives to potentially biased language related to race and ethnicity.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageRaceEthnicityRelated?: "on" | "off";
/**
* Suggests alternatives to potentially biased language related to older adults.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageAgeRelated?: "on" | "off";
/**
* Suggests alternatives to potentially ableist language.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageDisabilityRelated?: "on" | "off";
/**
* Suggests alternatives to potentially biased language related to parenting and family systems.
*
* @example
* Quinn hoped to meet their \{ real father =\> birth father \} one day.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageFamilyRelated?: "on" | "off";
/**
* Suggests spelling out numbers zero through ten.
*
* @defaultValue "on"
*/
numbersZeroThroughTen?: "on" | "off";
/**
* Suggests spelling out numbers at the beginning of sentences.
*
* @defaultValue "on"
*/
numbersBeginningSentences?: "on" | "off";
/**
* Flags a series of nouns that modify a final noun.
*
* @example
* The \{store manager policy handbook update meeting \} is tomorrow.
*
* @defaultValue "on"
*/
nounStrings?: "on" | "off";
/**
* Flags series of sentences that follow the same pattern.
*
* @example
* I read an interesting book recently. It was about computers. I usually read novels.
*
* @defaultValue "on"
*/
sentenceVariety?: "on" | "off";
/**
* Suggests removing extra spaces surrounding a slash.
*
* @example
* I just wanted to send a \{ reminder / follow-up =\> reminder/follow-up \}.
*
* @defaultValue "on"
*/
spacesSurroundingSlash?: "on" | "off";
/**
* Suggests alternatives to language related to human slavery.
*
* @example
* My professor wrote a book about \{ slaves =\> enslaved people \} in America.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageHumanRights?: "on" | "off";
/**
* Suggests alternatives to terms with origins in the institution of slavery.
*
* @example
* The apartment’s \{ master =\> main|primary \} bedroom has a view of the sea.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageHumanRightsRelated?: "on" | "off";
}
/**
* Categories of suggestions that can be muted.
*
* @public
* @deprecated since v1.9.2 - use `SuggestionCategories` instead
*/
declare interface SuggestionCategoriesDeprecated {
/**
* Suggests alternatives to words that occur frequently in the same paragraph.
*
* @defaultValue true

@@ -967,2 +1202,2 @@ */

export { ClientId, Config, Dialect, DocumentConfig, DocumentStats, Domain, Editor, EditorConfig, EditorFactory, EditorSDK, Event_2 as Event, EventListener_2 as EventListener, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, OAuthConfig, PluginDisableReason, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, TextStats, Time, UIConfig, init };
export { ClientId, Config, Dialect, DocumentConfig, DocumentStats, Domain, Editor, EditorConfig, EditorFactory, EditorSDK, Event_2 as Event, EventListener_2 as EventListener, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, OAuthConfig, PluginDisableReason, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, SuggestionCategoriesDeprecated, TextStats, Time, UIConfig, init };

@@ -49,7 +49,7 @@ /**

/** @since v1.3.0 */
| "auto-text"
| "auto-text"
/** @since v1.3.0 */
| "auto-browser"
| "auto-browser"
/** @deprecated since v1.3.0 - Use "auto-browser" instead */
| "auto";
| "auto";

@@ -124,5 +124,5 @@ /**

declare class Editor {
/**

@@ -136,3 +136,3 @@ * Returns the GrammarlyEditorPlugin element directly if you need to

get element(): GrammarlyEditorPluginElement;
/**

@@ -198,5 +198,14 @@ * Current editor configuration

* @public
* @deprecated since v1.9.2 - use `suggestionCategories` instead
*/
suggestions?: SuggestionCategories;
suggestions?: SuggestionCategoriesDeprecated;
/**
* Categories of suggestions that can be muted.
*
* {@link https://codesandbox.io/s/github/grammarly/grammarly-for-developers/tree/main/examples/editor-sdk-suggestions-config?file=/public/index.html | Try it out}
*
* @public
*/
suggestionCategories?: SuggestionCategories;
/**
* Collect user feedback after the user takes action on 5 suggestions.

@@ -227,3 +236,4 @@ *

* @remarks
* This introductory text shows in the footer of the first shown suggestion card.
* This introductory text shows in the footer of suggestion cards until the user first accepts
* or dismisses a suggestion.
*

@@ -282,3 +292,3 @@ * {@link https://codesandbox.io/s/github/grammarly/grammarly-for-developers/tree/main/examples/editor-sdk-intro-text?file=/public/index.html | Try it out}

oauthRedirectUri?: string;
/**

@@ -304,2 +314,11 @@ * Configuration for the user interface of Grammarly.

/**
* Show underlines for suggestions.
*
*
* @defaultValue "on"
* @public
* @since v1.9.2
*/
underlines?: "on" | "off";
/**
* Callback to receive stats about the user-entered text and Grammarly session.

@@ -311,2 +330,3 @@ * @deprecated since v1.9.0 - use `document-stats` or `session-stats` events instead.

* Triggered when the user consciously disables the plugin. Not triggered again once already disabled.
* @deprecated since v1.9.0 - use plugin-turned-off event
*/

@@ -350,5 +370,5 @@ onPluginDisable?: (reason: PluginDisableReason) => void;

declare class EditorSDK {
/**

@@ -363,3 +383,3 @@ * Enhance a specific HTML element with Grammarly.

addPlugin(element: HTMLElement, config?: EditorConfig, viewport?: HTMLElement): GrammarlyEditorPluginElement;
/**

@@ -424,3 +444,3 @@ * Enhance a specific HTML element with Grammarly.

declare interface GrammarlyEditorPluginCallbacks {
/**

@@ -478,14 +498,13 @@ * Triggered when a suggestion card is opened

declare class GrammarlyEditorPluginElement extends HTMLElement {
disconnect(): void;
/**

@@ -510,14 +529,21 @@ * Current editor configuration

connect(editor: EditorElement, viewport?: HTMLElement): void;
/**
* Remove plugin from the editor.
*
* @public
* @since v1.9.2
*/
disconnect(): void;
addEventListener<K extends keyof GrammarlyEditorPluginElementEventMap>(type: K, listener: (this: HTMLElement, ev: GrammarlyEditorPluginElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions | undefined): void;
removeEventListener<K extends keyof GrammarlyEditorPluginElementEventMap>(type: K, listener: (this: HTMLElement, ev: GrammarlyEditorPluginElementEventMap[K]) => any, options?: boolean | EventListenerOptions | undefined): void;
}

@@ -528,2 +554,4 @@

*
* {@link https://codesandbox.io/s/github/grammarly/grammarly-for-developers/tree/main/examples/editor-sdk-events?file=/public/index.html | Try it out}
*
* @public

@@ -533,3 +561,3 @@ * @since v1.8.0

declare interface GrammarlyEditorPluginElementEventMap extends HTMLElementEventMap {
/**

@@ -665,3 +693,3 @@ * Triggered when a suggestion card is opened

* @remarks
* `false` means any suggestions belonging to that category will be "muted" (not visible to the user)
* "off" means any suggestions belonging to that category will be "muted" (not visible to the user)
*

@@ -674,2 +702,209 @@ * @public

*
* @defaultValue "on"
*/
variety?: "on" | "off";
/**
* Suggests alternatives to bland and overused words such as "good" and "nice".
*
* @defaultValue "on"
*/
vocabulary?: "on" | "off";
/**
* Suggests ways to sound more natural and fluent.
*
* @defaultValue "on"
*/
fluency?: "on" | "off";
/**
* Suggests adding the Oxford comma after the second-to-last item in a list of things.
*
* @defaultValue "off"
*/
oxfordComma?: "on" | "off";
/**
* Flags unnecessary use of ellipses (...).
*
* @defaultValue "off"
*/
unnecessaryEllipses?: "on" | "off";
/**
* Suggests placing punctuation before closing quotation marks.
*
* @defaultValue "on"
*/
punctuationWithQuotation?: "on" | "off";
/**
* Suggests completing all incomplete sentences, including stylistic sentence fragments that may be intentional.
*
* @defaultValue "off"
*/
stylisticFragments?: "on" | "off";
/**
* Flags use of personal pronouns such as "I" and "you" in academic writing.
*
* @defaultValue "off"
*/
informalPronounsAcademic?: "on" | "off";
/**
* Flags use of conjunctions such as "but" and "and" at the beginning of sentences.
*
* @defaultValue "off"
*/
conjunctionAtStartOfSentence?: "on" | "off";
/**
* Flags use of prepositions such as "with" and "in" at the end of sentences.
*
* @defaultValue "off"
*/
prepositionAtTheEndOfSentence?: "on" | "off";
/**
* Suggests rewriting split infinitives so that an adverb doesn't come between "to" and the verb.
*
* @defaultValue "on"
*/
splitInfinitive?: "on" | "off";
/**
* Suggests adding missing spacing after a numeral when writing times.
*
* @defaultValue "on"
*/
missingSpaces?: "on" | "off";
/**
* Flags use of passive voice.
*
* @defaultValue "off"
*/
passiveVoice?: "on" | "off";
/**
* Flags long, complicated sentences that could potentially confuse your reader.
*
* @defaultValue "on"
*/
readabilityFillerWords?: "on" | "off";
/**
* Suggests splitting long, complicated sentences that could potentially confuse your reader.
*
* @defaultValue "on"
*/
readabilityTransforms?: "on" | "off";
/**
* Suggests using person-first language to refer respectfully to an individual with a disability.
*
* @defaultValue "on"
*/
personFirstLanguage?: "on" | "off";
/**
* Suggests alternatives to potentially gender-biased and non-inclusive phrasing.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageGenderRelated?: "on" | "off";
/**
* Flags LGBTQIA+-related terms that may be seen as biased, outdated, or disrespectful in some contexts.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageLGBTQIARelated?: "on" | "off";
/**
* Suggests alternatives to language that may be considered politically incorrect.
*
* @defaultValue "on"
*/
possiblyPoliticallyIncorrectLanguage?: "on" | "off";
/**
* Suggests alternatives to potentially biased language related to race and ethnicity.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageRaceEthnicityRelated?: "on" | "off";
/**
* Suggests alternatives to potentially biased language related to older adults.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageAgeRelated?: "on" | "off";
/**
* Suggests alternatives to potentially ableist language.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageDisabilityRelated?: "on" | "off";
/**
* Suggests alternatives to potentially biased language related to parenting and family systems.
*
* @example
* Quinn hoped to meet their \{ real father =\> birth father \} one day.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageFamilyRelated?: "on" | "off";
/**
* Suggests spelling out numbers zero through ten.
*
* @defaultValue "on"
*/
numbersZeroThroughTen?: "on" | "off";
/**
* Suggests spelling out numbers at the beginning of sentences.
*
* @defaultValue "on"
*/
numbersBeginningSentences?: "on" | "off";
/**
* Flags a series of nouns that modify a final noun.
*
* @example
* The \{store manager policy handbook update meeting \} is tomorrow.
*
* @defaultValue "on"
*/
nounStrings?: "on" | "off";
/**
* Flags series of sentences that follow the same pattern.
*
* @example
* I read an interesting book recently. It was about computers. I usually read novels.
*
* @defaultValue "on"
*/
sentenceVariety?: "on" | "off";
/**
* Suggests removing extra spaces surrounding a slash.
*
* @example
* I just wanted to send a \{ reminder / follow-up =\> reminder/follow-up \}.
*
* @defaultValue "on"
*/
spacesSurroundingSlash?: "on" | "off";
/**
* Suggests alternatives to language related to human slavery.
*
* @example
* My professor wrote a book about \{ slaves =\> enslaved people \} in America.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageHumanRights?: "on" | "off";
/**
* Suggests alternatives to terms with origins in the institution of slavery.
*
* @example
* The apartment’s \{ master =\> main|primary \} bedroom has a view of the sea.
*
* @defaultValue "on"
*/
possiblyBiasedLanguageHumanRightsRelated?: "on" | "off";
}
/**
* Categories of suggestions that can be muted.
*
* @public
* @deprecated since v1.9.2 - use `SuggestionCategories` instead
*/
declare interface SuggestionCategoriesDeprecated {
/**
* Suggests alternatives to words that occur frequently in the same paragraph.
*
* @defaultValue true

@@ -960,2 +1195,2 @@ */

export { ClientId, Config, Dialect, DocumentConfig, DocumentStats, Domain, Editor, EditorConfig, EditorFactory, EditorSDK, Event_2 as Event, EventListener_2 as EventListener, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, OAuthConfig, PluginDisableReason, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, TextStats, Time, UIConfig, init };
export { ClientId, Config, Dialect, DocumentConfig, DocumentStats, Domain, Editor, EditorConfig, EditorFactory, EditorSDK, Event_2 as Event, EventListener_2 as EventListener, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, OAuthConfig, PluginDisableReason, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, SuggestionCategoriesDeprecated, TextStats, Time, UIConfig, init };

2

lib/index.esm.js

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

*/
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}class InvariantError extends Error{constructor(code,args){var message=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"";super();_defineProperty(this,"args",void 0);_defineProperty(this,"code",void 0);_defineProperty(this,"url",void 0);var url=new URL("https://developer.grammarly.com/docs/error-explainer");url.searchParams.set("code",code.toString());args.forEach((arg=>url.searchParams.append("args",String(arg))));if(this.stack!=null)url.searchParams.set("trace",this.stack);this.message="Minified error #".concat(code,": ").concat(message," See ").concat(url.toString()," for details.");this.args=args;this.code=code;this.url=url.toString()}}function findScript(win,url){const scripts=win.document.querySelectorAll(`script[src^="${url}"]`);return scripts[0]}function injectScript(win,url){const script=win.document.createElement("script");script.src=url;win.document.head.appendChild(script);return script}const initPromise=new WeakMap;function initGrammarlyGlobalAPI(win){if(win.Grammarly!=null)return;win.Grammarly={}}async function loadScript(win,url,clientId){const loaded=initPromise.get(win);if(loaded!=null)return await loaded;initGrammarlyGlobalAPI(win);const promise=new Promise(((resolve,reject)=>{try{let script=findScript(win,url);if(script!=null){onLoad()}else{script=injectScript(win,clientId!=null?`${url}?clientId=${clientId}`:url);script.addEventListener("load",onLoad);script.addEventListener("error",onError)}}catch(error){return reject(error)}function onLoad(){try{if(false);else{if(!(win.Grammarly!=null&&typeof win.Grammarly.EditorSDK==="function"))throw new InvariantError(22,[])}resolve(win.Grammarly)}catch(error){reject(error)}}function onError(){try{if(false);else{if(!false)throw new InvariantError(23,[])}}catch(error){reject(error)}}}));initPromise.set(win,promise);return await promise}const[versionMajor,versionMinor]="1.9.1".split(".");const resolvedVersion=`${versionMajor}.${versionMinor}`;async function init(clientId,config,win){var _a,_b;{if(!(typeof window!=="undefined"||typeof win!=="undefined"))throw new InvariantError(21,[])}const Grammarly=await loadScript(win!==null&&win!==void 0?win:window,(_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.EditorSDK(clientId,config)}}const callbackToEventName={onBeforeSuggestionCardOpen:"before-suggestion-card-open",onSuggestionCardOpen:"suggestion-card-open",onSuggestionCardClose:"suggestion-card-close",onPluginTurnedOff:"plugin-turned-off",onPluginError:"plugin-error",onDocumentStats:"document-stats",onSessionStats:"session-stats"};export{callbackToEventName,init};
class r extends Error{args;code;url;constructor(r,t,n=""){super();const e=new URL("https://developer.grammarly.com/docs/error-explainer");e.searchParams.set("code",r.toString()),t.forEach((r=>e.searchParams.append("args",String(r)))),null!=this.stack&&e.searchParams.set("trace",this.stack),this.message=`Minified error #${r}: ${n} See ${e.toString()} for details.`,this.args=t,this.code=r,this.url=e.toString()}}const t=new WeakMap;async function n(n,e,o){if("undefined"==typeof window&&void 0===o)throw new r(21,[]);const s=await async function(n,e,o){const s=t.get(n);if(null!=s)return await s;!function(r){null==r.Grammarly&&(r.Grammarly={})}(n);const a=new Promise(((t,s)=>{try{let t=function(r,t){return r.document.querySelectorAll(`script[src^="${t}"]`)[0]}(n,e);null!=t?a():(t=function(r,t){const n=r.document.createElement("script");return n.src=t,r.document.head.appendChild(n),n}(n,null!=o?`${e}?clientId=${o}`:e),t.addEventListener("load",a),t.addEventListener("error",(function(){try{throw new r(23,[])}catch(r){s(r)}})))}catch(r){return s(r)}function a(){try{if(null==n.Grammarly||"function"!=typeof n.Grammarly.EditorSDK)throw new r(22,[]);t(n.Grammarly)}catch(r){s(r)}}}));return t.set(n,a),await a}(o??window,"https://js.grammarly.com/grammarly-editor-sdk@1.9",n);if(null!=n)return new s.EditorSDK(n,e)}const e={onBeforeSuggestionCardOpen:"before-suggestion-card-open",onSuggestionCardOpen:"suggestion-card-open",onSuggestionCardClose:"suggestion-card-close",onPluginTurnedOff:"plugin-turned-off",onPluginError:"plugin-error",onDocumentStats:"document-stats",onSessionStats:"session-stats"};export{e as callbackToEventName,n as init};

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

*/
!function(){"use strict";function t(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}class r extends Error{constructor(r,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),t(this,"args",void 0),t(this,"code",void 0),t(this,"url",void 0);var c=new URL("https://developer.grammarly.com/docs/error-explainer");c.searchParams.set("code",r.toString()),n.forEach((t=>c.searchParams.append("args",String(t)))),null!=this.stack&&c.searchParams.set("trace",this.stack),this.message="Minified error #".concat(r,": ").concat(e," See ").concat(c.toString()," for details."),this.args=n,this.code=r,this.url=c.toString()}}const n=new WeakMap;const[e,c]="1.9.1".split("."),a=`${e}.${c}`;async function i(t,e,c){var i;if("undefined"==typeof window&&void 0===c)throw new r(21,[]);const o=await async function(t,e,c){const a=n.get(t);if(null!=a)return await a;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const i=new Promise(((n,a)=>{try{let n=function(t,r){return t.document.querySelectorAll(`script[src^="${r}"]`)[0]}(t,e);null!=n?i():(n=function(t,r){const n=t.document.createElement("script");return n.src=r,t.document.head.appendChild(n),n}(t,null!=c?`${e}?clientId=${c}`:e),n.addEventListener("load",i),n.addEventListener("error",(function(){try{throw new r(23,[])}catch(t){a(t)}})))}catch(t){return a(t)}function i(){try{if(null==t.Grammarly||"function"!=typeof t.Grammarly.EditorSDK)throw new r(22,[]);n(t.Grammarly)}catch(t){a(t)}}}));return n.set(t,i),await i}(null!=c?c:window,(void 0,`https://js.${null!==(i="grammarly.com")?i:"grammarly.com"}/grammarly-editor-sdk@${a}`),t);if(null!=t)return new o.EditorSDK(t,e)}const o=function(){const t=function(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}();if(t){const r=t.src;if(r){const t=new URL(r).searchParams.get("clientId");if(null!=t)return t}const n=t.getAttribute("clientId");if(null!=n)return n}}(),s=l(null!=o?i(o):i());async function l(t){return await t.catch((t=>{console.error(t.message)}))}window.Grammarly.init=async(t=o)=>{const n=o===t?await s:null!=t?await i(t):void 0;if(null==n)throw new r(20,[]);return n}}();
!function(){"use strict";class t extends Error{args;code;url;constructor(t,r,n=""){super();const e=new URL("https://developer.grammarly.com/docs/error-explainer");e.searchParams.set("code",t.toString()),r.forEach((t=>e.searchParams.append("args",String(t)))),null!=this.stack&&e.searchParams.set("trace",this.stack),this.message=`Minified error #${t}: ${n} See ${e.toString()} for details.`,this.args=r,this.code=t,this.url=e.toString()}}const r=new WeakMap;async function n(n,e,c){if("undefined"==typeof window&&void 0===c)throw new t(21,[]);const a=await async function(n,e,c){const a=r.get(n);if(null!=a)return await a;!function(t){null==t.Grammarly&&(t.Grammarly={})}(n);const i=new Promise(((r,a)=>{try{let r=function(t,r){return t.document.querySelectorAll('script[src^="https://js.grammarly.com/grammarly-editor-sdk@1.9"]')[0]}(n);null!=r?i():(r=function(t,r){const n=t.document.createElement("script");return n.src=r,t.document.head.appendChild(n),n}(n,null!=c?`${e}?clientId=${c}`:e),r.addEventListener("load",i),r.addEventListener("error",(function(){try{throw new t(23,[])}catch(t){a(t)}})))}catch(t){return a(t)}function i(){try{if(null==n.Grammarly||"function"!=typeof n.Grammarly.EditorSDK)throw new t(22,[]);r(n.Grammarly)}catch(t){a(t)}}}));return r.set(n,i),await i}(c??window,"https://js.grammarly.com/grammarly-editor-sdk@1.9",n);if(null!=n)return new a.EditorSDK(n,e)}const e=function(){const t=function(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}();if(t){const r=t.src;if(r){const t=new URL(r).searchParams.get("clientId");if(null!=t)return t}const n=t.getAttribute("clientId");if(null!=n)return n}}(),c=async function(t){return await t.catch((t=>{console.error(t.message)}))}(null!=e?n(e):n());window.Grammarly.init=async(r=e)=>{const a=e===r?await c:null!=r?await n(r):void 0;if(null==a)throw new t(20,[]);return a}}();

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

*/
"use strict";Object.defineProperty(exports,"__esModule",{value:true});function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true})}else{obj[key]=value}return obj}class InvariantError extends Error{constructor(code,args){var message=arguments.length>2&&arguments[2]!==undefined?arguments[2]:"";super();_defineProperty(this,"args",void 0);_defineProperty(this,"code",void 0);_defineProperty(this,"url",void 0);var url=new URL("https://developer.grammarly.com/docs/error-explainer");url.searchParams.set("code",code.toString());args.forEach((arg=>url.searchParams.append("args",String(arg))));if(this.stack!=null)url.searchParams.set("trace",this.stack);this.message="Minified error #".concat(code,": ").concat(message," See ").concat(url.toString()," for details.");this.args=args;this.code=code;this.url=url.toString()}}function findScript(win,url){const scripts=win.document.querySelectorAll(`script[src^="${url}"]`);return scripts[0]}function injectScript(win,url){const script=win.document.createElement("script");script.src=url;win.document.head.appendChild(script);return script}const initPromise=new WeakMap;function initGrammarlyGlobalAPI(win){if(win.Grammarly!=null)return;win.Grammarly={}}async function loadScript(win,url,clientId){const loaded=initPromise.get(win);if(loaded!=null)return await loaded;initGrammarlyGlobalAPI(win);const promise=new Promise(((resolve,reject)=>{try{let script=findScript(win,url);if(script!=null){onLoad()}else{script=injectScript(win,clientId!=null?`${url}?clientId=${clientId}`:url);script.addEventListener("load",onLoad);script.addEventListener("error",onError)}}catch(error){return reject(error)}function onLoad(){try{if(false);else{if(!(win.Grammarly!=null&&typeof win.Grammarly.EditorSDK==="function"))throw new InvariantError(22,[])}resolve(win.Grammarly)}catch(error){reject(error)}}function onError(){try{if(false);else{if(!false)throw new InvariantError(23,[])}}catch(error){reject(error)}}}));initPromise.set(win,promise);return await promise}const[versionMajor,versionMinor]="1.9.1".split(".");const resolvedVersion=`${versionMajor}.${versionMinor}`;async function init(clientId,config,win){var _a,_b;{if(!(typeof window!=="undefined"||typeof win!=="undefined"))throw new InvariantError(21,[])}const Grammarly=await loadScript(win!==null&&win!==void 0?win:window,(_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.EditorSDK(clientId,config)}}const callbackToEventName={onBeforeSuggestionCardOpen:"before-suggestion-card-open",onSuggestionCardOpen:"suggestion-card-open",onSuggestionCardClose:"suggestion-card-close",onPluginTurnedOff:"plugin-turned-off",onPluginError:"plugin-error",onDocumentStats:"document-stats",onSessionStats:"session-stats"};exports.callbackToEventName=callbackToEventName;exports.init=init;
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});class e extends Error{args;code;url;constructor(e,t,r=""){super();const n=new URL("https://developer.grammarly.com/docs/error-explainer");n.searchParams.set("code",e.toString()),t.forEach((e=>n.searchParams.append("args",String(e)))),null!=this.stack&&n.searchParams.set("trace",this.stack),this.message=`Minified error #${e}: ${r} See ${n.toString()} for details.`,this.args=t,this.code=e,this.url=n.toString()}}const t=new WeakMap;exports.callbackToEventName={onBeforeSuggestionCardOpen:"before-suggestion-card-open",onSuggestionCardOpen:"suggestion-card-open",onSuggestionCardClose:"suggestion-card-close",onPluginTurnedOff:"plugin-turned-off",onPluginError:"plugin-error",onDocumentStats:"document-stats",onSessionStats:"session-stats"},exports.init=async function(r,n,o){if("undefined"==typeof window&&void 0===o)throw new e(21,[]);const s=await async function(r,n,o){const s=t.get(r);if(null!=s)return await s;!function(e){null==e.Grammarly&&(e.Grammarly={})}(r);const a=new Promise(((t,s)=>{try{let t=function(e,t){return e.document.querySelectorAll(`script[src^="${t}"]`)[0]}(r,n);null!=t?a():(t=function(e,t){const r=e.document.createElement("script");return r.src=t,e.document.head.appendChild(r),r}(r,null!=o?`${n}?clientId=${o}`:n),t.addEventListener("load",a),t.addEventListener("error",(function(){try{throw new e(23,[])}catch(e){s(e)}})))}catch(e){return s(e)}function a(){try{if(null==r.Grammarly||"function"!=typeof r.Grammarly.EditorSDK)throw new e(22,[]);t(r.Grammarly)}catch(e){s(e)}}}));return t.set(r,a),await a}(o??window,"https://js.grammarly.com/grammarly-editor-sdk@1.9",r);if(null!=r)return new s.EditorSDK(r,n)};

@@ -5,3 +5,3 @@ {

"description": "Grammarly writing SDK for web editors",
"version": "1.9.1",
"version": "1.9.2",
"main": "./lib/index.js",

@@ -29,7 +29,7 @@ "module": "./lib/index.esm.js",

"devDependencies": {
"@grammarly/plugin-core": "1.9.1",
"@grammarly/plugin-editor": "1.9.1",
"@grammarly/plugin-invariant": "1.9.1",
"@grammarly/plugin-reactivity": "1.9.1",
"@microsoft/api-extractor": "^7.15.1",
"@grammarly/plugin-core": "1.9.2",
"@grammarly/plugin-editor": "1.9.2",
"@grammarly/plugin-invariant": "1.9.2",
"@grammarly/plugin-reactivity": "1.9.2",
"@microsoft/api-extractor": "^7.28.7",
"@testing-library/jest-dom": "^5.11.10",

@@ -42,5 +42,4 @@ "@types/jest": "^26.0.22",

"scripts": {
"test": "jest",
"docs:api": "api-extractor run --verbose"
"test": "jest"
}
}
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