Socket
Socket
Sign inDemoInstall

@grammarly/editor-sdk

Package Overview
Dependencies
Maintainers
8
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 2.0.6 to 2.1.0

36

lib/editor-sdk.beta.d.ts

@@ -37,5 +37,5 @@ /**

* @remarks
* Use "auto-text" to choose an appropriate value based on the user's written text.
* Use "auto-browser" to choose an appropriate value based on the user's browser settings.
*
* Use "auto-browser" to choose an appropriate value based on the user's browser locale.
* Use "auto-text" to attempt detecting an appropriate value based on the user's written text.
*

@@ -48,7 +48,7 @@ * Note that the user can override this setting in the Grammarly button menu.

*/
declare type Dialect = "american" | "british" | "canadian" | "australian"
declare type Dialect =
/** @since v1.3.0 */
| "auto-text"
"auto-browser" | "american" | "british" | "canadian" | "australian"
/** @since v1.3.0 */
| "auto-browser";
| "auto-text";

@@ -149,3 +149,3 @@ /**

* @demo {@link https://codesandbox.io/s/github/grammarly/grammarly-for-developers/tree/main/examples/editor-sdk-document-dialect?file=/public/index.html | Try it now}
* @defaultValue "auto-text"
* @defaultValue "auto-browser"
* @since v1.6.3

@@ -334,2 +334,16 @@ * @public

set tonePosition(value: TonePosition | undefined);
/**
* Position of the Grammarly button menu relative to the Grammarly button.
*
* @example
* ```html
* <grammarly-button menu-position="left"></grammarly-button>
* ```
*
* @defaultValue "left"
* @since v2.1.0
* @public
*/
get menuPosition(): MenuPosition | undefined;
set menuPosition(value: MenuPosition | undefined);
private _render;

@@ -644,2 +658,10 @@ /**

/**
* Position of the Grammarly button menu relative to the Grammarly button.
*
* @since v2.1.0
* @public
*/
declare type MenuPosition = "left" | "right";
/**
* Statistics about the Grammarly session.

@@ -903,2 +925,2 @@ *

export { ClientId, Config, Dialect, DocumentStats, Domain, Editor, EditorConfig, EditorSDK, GrammarlyButtonElement, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, Time, TonePosition, init };
export { ClientId, Config, Dialect, DocumentStats, Domain, Editor, EditorConfig, EditorSDK, GrammarlyButtonElement, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, MenuPosition, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, Time, TonePosition, init };

@@ -37,5 +37,5 @@ /**

* @remarks
* Use "auto-text" to choose an appropriate value based on the user's written text.
* Use "auto-browser" to choose an appropriate value based on the user's browser settings.
*
* Use "auto-browser" to choose an appropriate value based on the user's browser locale.
* Use "auto-text" to attempt detecting an appropriate value based on the user's written text.
*

@@ -48,7 +48,7 @@ * Note that the user can override this setting in the Grammarly button menu.

*/
declare type Dialect = "american" | "british" | "canadian" | "australian"
declare type Dialect =
/** @since v1.3.0 */
| "auto-text"
"auto-browser" | "american" | "british" | "canadian" | "australian"
/** @since v1.3.0 */
| "auto-browser";
| "auto-text";

@@ -149,3 +149,3 @@ /**

* @demo {@link https://codesandbox.io/s/github/grammarly/grammarly-for-developers/tree/main/examples/editor-sdk-document-dialect?file=/public/index.html | Try it now}
* @defaultValue "auto-text"
* @defaultValue "auto-browser"
* @since v1.6.3

@@ -326,2 +326,16 @@ * @public

set tonePosition(value: TonePosition | undefined);
/**
* Position of the Grammarly button menu relative to the Grammarly button.
*
* @example
* ```html
* <grammarly-button menu-position="left"></grammarly-button>
* ```
*
* @defaultValue "left"
* @since v2.1.0
* @public
*/
get menuPosition(): MenuPosition | undefined;
set menuPosition(value: MenuPosition | undefined);
private _render;

@@ -636,2 +650,10 @@ /**

/**
* Position of the Grammarly button menu relative to the Grammarly button.
*
* @since v2.1.0
* @public
*/
declare type MenuPosition = "left" | "right";
/**
* Statistics about the Grammarly session.

@@ -895,2 +917,2 @@ *

export { ClientId, Config, Dialect, DocumentStats, Domain, Editor, EditorConfig, EditorSDK, GrammarlyButtonElement, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, Time, TonePosition, init };
export { ClientId, Config, Dialect, DocumentStats, Domain, Editor, EditorConfig, EditorSDK, GrammarlyButtonElement, GrammarlyEditorPluginCallbacks, GrammarlyEditorPluginElement, GrammarlyEditorPluginElementEventMap, MenuPosition, SessionStats, SessionSuggestionBreakdown, SuggestionCategories, Time, TonePosition, init };

2

lib/index.esm.js

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

*/
function n(n,t,r){return t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r,n}var t=new Map;class r extends Error{constructor(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),n(this,"args",void 0),n(this,"code",void 0),n(this,"url",void 0);var o=new URL("https://developer.grammarly.com/docs/error-explainer");o.searchParams.set("code",t.toString()),r.forEach((n=>o.searchParams.append("args",function(n){if(n instanceof Error)return n.message+"\n"+String(n.stack);if(null==n)return"null";if("object"==typeof n)try{return Object.prototype.toString.call(n)}catch(n){}return String(n)}(n)))),null!=this.stack&&o.searchParams.set("trace",this.stack),this.message="".concat(e,"Minified error #").concat(t,": See ").concat(o.toString()," for details."),this.args=r,this.code=t,this.url=o.toString()}toUserMessage(){var n=t.get("".concat(this.code));if(null==n)return[this];var r=new Map(this.args.map(((n,t)=>["${".concat(t,"}"),n])));return n.split(/(\${\d+})/).filter((n=>""!==n)).map((n=>{var t;return null!==(t=r.get(n))&&void 0!==t?t:n}))}static setMessages(n){t=n}static create(n,t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3?arguments[3]:void 0;null!=o&&t.push(o);var a=new r(n,t,e);return a.stack=null==o?void 0:o.stack,a}}const e=new WeakMap;async function o(n,t,r){return await a("@grammarly/editor-sdk",n,t,r)}async function a(n,t,o,a){if("undefined"==typeof window&&void 0===a)throw new r(21,[]);const i=function(n){return"null"!==n.location.origin?n.location.origin:"null"!==n.origin?n.origin:"null"}(null!=a?a:window);"null"===i&&(null!=a?a:window).top!==(null!=a?a:window)&&console.warn("Grammarly is not supported in IFrames with `null` origin. Consider adding `sandbox='allow-same-origin allow-scripts'` to <iframe> element.");const s=new URL("https://js.grammarly.com/grammarly-editor-sdk@2.0",i);null!=t&&s.searchParams.set("clientId",t),s.searchParams.set("packageName",n);const c=await async function(n,t){const o=e.get(n);if(null!=o)return await o;!function(n){null==n.Grammarly&&(n.Grammarly={})}(n);const a=new Promise(((e,o)=>{try{let e=function(n,t){return n.document.querySelectorAll(`script[src^="${t.replace(/\?.*$/,"")}"]`)[0]}(n,t);null!=e?a():(e=function(n,t){const r=n.document.createElement("script");return r.src=t,n.document.head.appendChild(r),r}(n,t),e.addEventListener("load",a),e.addEventListener("error",(function(){try{throw new r(23,[])}catch(n){o(n)}})))}catch(n){return o(n)}function a(){try{if(null==n.Grammarly||"function"!=typeof n.Grammarly.EditorSDK)throw new r(22,[]);e(n.Grammarly)}catch(n){o(n)}}}));return e.set(n,a),await a}(null!=a?a:window,s.toString());if(null!=t)return new c.EditorSDK(t,o)}const i={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{i as callbackToEventName,o as init,a as init_with_packageName};
function n(n,t,r){return t in n?Object.defineProperty(n,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):n[t]=r,n}var t=new Map;class r extends Error{constructor(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";super(),n(this,"args",void 0),n(this,"code",void 0),n(this,"url",void 0);var o=new URL("https://developer.grammarly.com/docs/error-explainer");o.searchParams.set("code",t.toString()),r.forEach((n=>o.searchParams.append("args",function(n){if(n instanceof Error)return n.message+"\n"+String(n.stack);if(null==n)return"null";if("object"==typeof n)try{return Object.prototype.toString.call(n)}catch(n){}return String(n)}(n)))),null!=this.stack&&o.searchParams.set("trace",this.stack),this.message="".concat(e,"Minified error #").concat(t,": See ").concat(o.toString()," for details."),this.args=r,this.code=t,this.url=o.toString()}toUserMessage(){var n=t.get("".concat(this.code));if(null==n)return[this];var r=new Map(this.args.map(((n,t)=>["${".concat(t,"}"),n])));return n.split(/(\${\d+})/).filter((n=>""!==n)).map((n=>{var t;return null!==(t=r.get(n))&&void 0!==t?t:n}))}static setMessages(n){t=n}static create(n,t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3?arguments[3]:void 0;null!=o&&t.push(o);var a=new r(n,t,e);return a.stack=null==o?void 0:o.stack,a}}const e=new WeakMap;async function o(n,t,r){return await a("@grammarly/editor-sdk",n,t,r)}async function a(n,t,o,a){if("undefined"==typeof window&&void 0===a)throw new r(21,[]);const i=function(n){return"null"!==n.location.origin?n.location.origin:"null"!==n.origin?n.origin:"null"}(null!=a?a:window);"null"===i&&(null!=a?a:window).top!==(null!=a?a:window)&&console.warn("Grammarly is not supported in IFrames with `null` origin. Consider adding `sandbox='allow-same-origin allow-scripts'` to <iframe> element.");const s=new URL("https://js.grammarly.com/grammarly-editor-sdk@2.1",i);null!=t&&s.searchParams.set("clientId",t),s.searchParams.set("packageName",n);const c=await async function(n,t){const o=e.get(n);if(null!=o)return await o;!function(n){null==n.Grammarly&&(n.Grammarly={})}(n);const a=new Promise(((e,o)=>{try{let e=function(n,t){return n.document.querySelectorAll(`script[src^="${t.replace(/\?.*$/,"")}"]`)[0]}(n,t);null!=e?a():(e=function(n,t){const r=n.document.createElement("script");return r.src=t,n.document.head.appendChild(r),r}(n,t),e.addEventListener("load",a),e.addEventListener("error",(function(){try{throw new r(23,[])}catch(n){o(n)}})))}catch(n){return o(n)}function a(){try{if(null==n.Grammarly||"function"!=typeof n.Grammarly.EditorSDK)throw new r(22,[]);e(n.Grammarly)}catch(n){o(n)}}}));return e.set(n,a),await a}(null!=a?a:window,s.toString());if(null!=t)return new c.EditorSDK(t,o)}const i={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{i as callbackToEventName,o as init,a as init_with_packageName};

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

*/
!function(){"use strict";function t(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var n=new Map;class r extends Error{constructor(n,r){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 a=new URL("https://developer.grammarly.com/docs/error-explainer");a.searchParams.set("code",n.toString()),r.forEach((t=>a.searchParams.append("args",function(t){if(t instanceof Error)return t.message+"\n"+String(t.stack);if(null==t)return"null";if("object"==typeof t)try{return Object.prototype.toString.call(t)}catch(t){}return String(t)}(t)))),null!=this.stack&&a.searchParams.set("trace",this.stack),this.message="".concat(e,"Minified error #").concat(n,": See ").concat(a.toString()," for details."),this.args=r,this.code=n,this.url=a.toString()}toUserMessage(){var t=n.get("".concat(this.code));if(null==t)return[this];var r=new Map(this.args.map(((t,n)=>["${".concat(n,"}"),t])));return t.split(/(\${\d+})/).filter((t=>""!==t)).map((t=>{var n;return null!==(n=r.get(t))&&void 0!==n?n:t}))}static setMessages(t){n=t}static create(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3?arguments[3]:void 0;null!=a&&n.push(a);var i=new r(t,n,e);return i.stack=null==a?void 0:a.stack,i}}const e=new WeakMap;async function a(t,n,a){return await async function(t,n,a,i){if("undefined"==typeof window&&void 0===i)throw new r(21,[]);const o=function(t){return"null"!==t.location.origin?t.location.origin:"null"!==t.origin?t.origin:"null"}(null!=i?i:window);"null"===o&&(null!=i?i:window).top!==(null!=i?i:window)&&console.warn("Grammarly is not supported in IFrames with `null` origin. Consider adding `sandbox='allow-same-origin allow-scripts'` to <iframe> element.");const c=new URL("https://js.grammarly.com/grammarly-editor-sdk@2.0",o);null!=n&&c.searchParams.set("clientId",n),c.searchParams.set("packageName","@grammarly/editor-sdk");const s=await async function(t,n){const a=e.get(t);if(null!=a)return await a;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const i=new Promise(((e,a)=>{try{let e=function(t,n){return t.document.querySelectorAll(`script[src^="${n.replace(/\?.*$/,"")}"]`)[0]}(t,n);null!=e?i():(e=function(t,n){const r=t.document.createElement("script");return r.src=n,t.document.head.appendChild(r),r}(t,n),e.addEventListener("load",i),e.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,[]);e(t.Grammarly)}catch(t){a(t)}}}));return e.set(t,i),await i}(null!=i?i:window,c.toString());if(null!=n)return new s.EditorSDK(n,a)}(0,t,n,a)}const i=function(){const t=function(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}();if(t){const n=t.src;if(n){const t=new URL(n).searchParams.get("clientId");if(null!=t)return t}const r=t.getAttribute("clientId");if(null!=r)return r}}(),o=async function(t){return await t.catch((t=>{console.error(t.message)}))}(null!=i?a(i):a());window.Grammarly.init=async(t=i)=>{const n=i===t?await o:null!=t?await a(t):void 0;if(null==n)throw new r(20,[]);return n}}();
!function(){"use strict";function t(t,n,r){return n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r,t}var n=new Map;class r extends Error{constructor(n,r){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 a=new URL("https://developer.grammarly.com/docs/error-explainer");a.searchParams.set("code",n.toString()),r.forEach((t=>a.searchParams.append("args",function(t){if(t instanceof Error)return t.message+"\n"+String(t.stack);if(null==t)return"null";if("object"==typeof t)try{return Object.prototype.toString.call(t)}catch(t){}return String(t)}(t)))),null!=this.stack&&a.searchParams.set("trace",this.stack),this.message="".concat(e,"Minified error #").concat(n,": See ").concat(a.toString()," for details."),this.args=r,this.code=n,this.url=a.toString()}toUserMessage(){var t=n.get("".concat(this.code));if(null==t)return[this];var r=new Map(this.args.map(((t,n)=>["${".concat(n,"}"),t])));return t.split(/(\${\d+})/).filter((t=>""!==t)).map((t=>{var n;return null!==(n=r.get(t))&&void 0!==n?n:t}))}static setMessages(t){n=t}static create(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=arguments.length>3?arguments[3]:void 0;null!=a&&n.push(a);var i=new r(t,n,e);return i.stack=null==a?void 0:a.stack,i}}const e=new WeakMap;async function a(t,n,a){return await async function(t,n,a,i){if("undefined"==typeof window&&void 0===i)throw new r(21,[]);const o=function(t){return"null"!==t.location.origin?t.location.origin:"null"!==t.origin?t.origin:"null"}(null!=i?i:window);"null"===o&&(null!=i?i:window).top!==(null!=i?i:window)&&console.warn("Grammarly is not supported in IFrames with `null` origin. Consider adding `sandbox='allow-same-origin allow-scripts'` to <iframe> element.");const c=new URL("https://js.grammarly.com/grammarly-editor-sdk@2.1",o);null!=n&&c.searchParams.set("clientId",n),c.searchParams.set("packageName","@grammarly/editor-sdk");const s=await async function(t,n){const a=e.get(t);if(null!=a)return await a;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const i=new Promise(((e,a)=>{try{let e=function(t,n){return t.document.querySelectorAll(`script[src^="${n.replace(/\?.*$/,"")}"]`)[0]}(t,n);null!=e?i():(e=function(t,n){const r=t.document.createElement("script");return r.src=n,t.document.head.appendChild(r),r}(t,n),e.addEventListener("load",i),e.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,[]);e(t.Grammarly)}catch(t){a(t)}}}));return e.set(t,i),await i}(null!=i?i:window,c.toString());if(null!=n)return new s.EditorSDK(n,a)}(0,t,n,a)}const i=function(){const t=function(){if(document.currentScript instanceof HTMLScriptElement)return document.currentScript}();if(t){const n=t.src;if(n){const t=new URL(n).searchParams.get("clientId");if(null!=t)return t}const r=t.getAttribute("clientId");if(null!=r)return r}}(),o=async function(t){return await t.catch((t=>{console.error(t.message)}))}(null!=i?a(i):a());window.Grammarly.init=async(t=i)=>{const n=i===t?await o:null!=t?await a(t):void 0;if(null==n)throw new r(20,[]);return n}}();

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

*/
"use strict";function t(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e=new Map;class n extends Error{constructor(e,n){var r=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 o=new URL("https://developer.grammarly.com/docs/error-explainer");o.searchParams.set("code",e.toString()),n.forEach((t=>o.searchParams.append("args",function(t){if(t instanceof Error)return t.message+"\n"+String(t.stack);if(null==t)return"null";if("object"==typeof t)try{return Object.prototype.toString.call(t)}catch(t){}return String(t)}(t)))),null!=this.stack&&o.searchParams.set("trace",this.stack),this.message="".concat(r,"Minified error #").concat(e,": See ").concat(o.toString()," for details."),this.args=n,this.code=e,this.url=o.toString()}toUserMessage(){var t=e.get("".concat(this.code));if(null==t)return[this];var n=new Map(this.args.map(((t,e)=>["${".concat(e,"}"),t])));return t.split(/(\${\d+})/).filter((t=>""!==t)).map((t=>{var e;return null!==(e=n.get(t))&&void 0!==e?e:t}))}static setMessages(t){e=t}static create(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3?arguments[3]:void 0;null!=o&&e.push(o);var a=new n(t,e,r);return a.stack=null==o?void 0:o.stack,a}}const r=new WeakMap;async function o(t,e,o,a){if("undefined"==typeof window&&void 0===a)throw new n(21,[]);const i=function(t){return"null"!==t.location.origin?t.location.origin:"null"!==t.origin?t.origin:"null"}(null!=a?a:window);"null"===i&&(null!=a?a:window).top!==(null!=a?a:window)&&console.warn("Grammarly is not supported in IFrames with `null` origin. Consider adding `sandbox='allow-same-origin allow-scripts'` to <iframe> element.");const s=new URL("https://js.grammarly.com/grammarly-editor-sdk@2.0",i);null!=e&&s.searchParams.set("clientId",e),s.searchParams.set("packageName",t);const l=await async function(t,e){const o=r.get(t);if(null!=o)return await o;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const a=new Promise(((r,o)=>{try{let r=function(t,e){return t.document.querySelectorAll(`script[src^="${e.replace(/\?.*$/,"")}"]`)[0]}(t,e);null!=r?a():(r=function(t,e){const n=t.document.createElement("script");return n.src=e,t.document.head.appendChild(n),n}(t,e),r.addEventListener("load",a),r.addEventListener("error",(function(){try{throw new n(23,[])}catch(t){o(t)}})))}catch(t){return o(t)}function a(){try{if(null==t.Grammarly||"function"!=typeof t.Grammarly.EditorSDK)throw new n(22,[]);r(t.Grammarly)}catch(t){o(t)}}}));return r.set(t,a),await a}(null!=a?a:window,s.toString());if(null!=e)return new l.EditorSDK(e,o)}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(t,e,n){return await o("@grammarly/editor-sdk",t,e,n)},exports.init_with_packageName=o;
"use strict";function t(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e=new Map;class n extends Error{constructor(e,n){var r=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 o=new URL("https://developer.grammarly.com/docs/error-explainer");o.searchParams.set("code",e.toString()),n.forEach((t=>o.searchParams.append("args",function(t){if(t instanceof Error)return t.message+"\n"+String(t.stack);if(null==t)return"null";if("object"==typeof t)try{return Object.prototype.toString.call(t)}catch(t){}return String(t)}(t)))),null!=this.stack&&o.searchParams.set("trace",this.stack),this.message="".concat(r,"Minified error #").concat(e,": See ").concat(o.toString()," for details."),this.args=n,this.code=e,this.url=o.toString()}toUserMessage(){var t=e.get("".concat(this.code));if(null==t)return[this];var n=new Map(this.args.map(((t,e)=>["${".concat(e,"}"),t])));return t.split(/(\${\d+})/).filter((t=>""!==t)).map((t=>{var e;return null!==(e=n.get(t))&&void 0!==e?e:t}))}static setMessages(t){e=t}static create(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3?arguments[3]:void 0;null!=o&&e.push(o);var a=new n(t,e,r);return a.stack=null==o?void 0:o.stack,a}}const r=new WeakMap;async function o(t,e,o,a){if("undefined"==typeof window&&void 0===a)throw new n(21,[]);const i=function(t){return"null"!==t.location.origin?t.location.origin:"null"!==t.origin?t.origin:"null"}(null!=a?a:window);"null"===i&&(null!=a?a:window).top!==(null!=a?a:window)&&console.warn("Grammarly is not supported in IFrames with `null` origin. Consider adding `sandbox='allow-same-origin allow-scripts'` to <iframe> element.");const s=new URL("https://js.grammarly.com/grammarly-editor-sdk@2.1",i);null!=e&&s.searchParams.set("clientId",e),s.searchParams.set("packageName",t);const l=await async function(t,e){const o=r.get(t);if(null!=o)return await o;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const a=new Promise(((r,o)=>{try{let r=function(t,e){return t.document.querySelectorAll(`script[src^="${e.replace(/\?.*$/,"")}"]`)[0]}(t,e);null!=r?a():(r=function(t,e){const n=t.document.createElement("script");return n.src=e,t.document.head.appendChild(n),n}(t,e),r.addEventListener("load",a),r.addEventListener("error",(function(){try{throw new n(23,[])}catch(t){o(t)}})))}catch(t){return o(t)}function a(){try{if(null==t.Grammarly||"function"!=typeof t.Grammarly.EditorSDK)throw new n(22,[]);r(t.Grammarly)}catch(t){o(t)}}}));return r.set(t,a),await a}(null!=a?a:window,s.toString());if(null!=e)return new l.EditorSDK(e,o)}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(t,e,n){return await o("@grammarly/editor-sdk",t,e,n)},exports.init_with_packageName=o;

@@ -16,3 +16,3 @@ {

],
"version": "2.0.6",
"version": "2.1.0",
"main": "./lib/index.js",

@@ -40,6 +40,6 @@ "module": "./lib/index.esm.js",

"devDependencies": {
"@grammarly/plugin-core": "2.0.6",
"@grammarly/plugin-editor": "2.0.6",
"@grammarly/plugin-invariant": "2.0.6",
"@grammarly/plugin-reactivity": "2.0.6",
"@grammarly/plugin-core": "2.1.0",
"@grammarly/plugin-editor": "2.1.0",
"@grammarly/plugin-invariant": "2.1.0",
"@grammarly/plugin-reactivity": "2.1.0",
"@microsoft/api-extractor": "^7.28.7",

@@ -46,0 +46,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