@grammarly/editor-sdk
Advanced tools
Comparing version 2.3.13 to 2.3.14
@@ -405,2 +405,13 @@ /** | ||
/** | ||
* Triggered when a suggestion card is acted upon by the user (accept, dismiss, or close). | ||
* @public | ||
* | ||
* @since v2.3.14 | ||
* | ||
* | ||
*/ | ||
onSuggestionCardAction?: (event: CustomEvent<{ | ||
action: /** Suggestion was accepted by the user. */ "accept" | /** Suggestion was dismissed by the user. */ "dismiss" | /** Suggestion card was closed by the user using close button. (excludes when closed due to click-outside) */ "close"; | ||
}>) => void; | ||
/** | ||
* Triggered when the user turns off Grammarly. | ||
@@ -566,2 +577,19 @@ * @public | ||
/** | ||
* Triggered when a suggestion card is acted upon by the user (accept, dismiss, or close). | ||
* | ||
* @public | ||
* @since v2.3.14 | ||
* | ||
* @example | ||
* ```js | ||
* const editor = document.querySelector("grammarly-editor-plugin"); | ||
* editor.addEventListener("suggestion-card-action", (event) => { | ||
* console.log('Suggestion card action:', event.detail.action); | ||
* }); | ||
* ``` | ||
*/ | ||
"suggestion-card-action": CustomEvent<{ | ||
action: /** Suggestion was accepted by the user. */ "accept" | /** Suggestion was dismissed by the user. */ "dismiss" | /** Suggestion card was closed by the user using close button. (excludes when closed due to click-outside) */ "close"; | ||
}>; | ||
/** | ||
* Triggered when the user turns off Grammarly. | ||
@@ -568,0 +596,0 @@ * |
@@ -397,2 +397,13 @@ /** | ||
/** | ||
* Triggered when a suggestion card is acted upon by the user (accept, dismiss, or close). | ||
* @public | ||
* | ||
* @since v2.3.14 | ||
* | ||
* | ||
*/ | ||
onSuggestionCardAction?: (event: CustomEvent<{ | ||
action: /** Suggestion was accepted by the user. */ "accept" | /** Suggestion was dismissed by the user. */ "dismiss" | /** Suggestion card was closed by the user using close button. (excludes when closed due to click-outside) */ "close"; | ||
}>) => void; | ||
/** | ||
* Triggered when the user turns off Grammarly. | ||
@@ -558,2 +569,19 @@ * @public | ||
/** | ||
* Triggered when a suggestion card is acted upon by the user (accept, dismiss, or close). | ||
* | ||
* @public | ||
* @since v2.3.14 | ||
* | ||
* @example | ||
* ```js | ||
* const editor = document.querySelector("grammarly-editor-plugin"); | ||
* editor.addEventListener("suggestion-card-action", (event) => { | ||
* console.log('Suggestion card action:', event.detail.action); | ||
* }); | ||
* ``` | ||
*/ | ||
"suggestion-card-action": CustomEvent<{ | ||
action: /** Suggestion was accepted by the user. */ "accept" | /** Suggestion was dismissed by the user. */ "dismiss" | /** Suggestion card was closed by the user using close button. (excludes when closed due to click-outside) */ "close"; | ||
}>; | ||
/** | ||
* Triggered when the user turns off Grammarly. | ||
@@ -560,0 +588,0 @@ * |
@@ -17,2 +17,2 @@ /** | ||
*/ | ||
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){super(),t(this,"args",void 0),t(this,"code",void 0),t(this,"url",void 0),t(this,"_c",void 0);var e=new URL("https://developer.grammarly.com/docs/error-explainer");e.searchParams.set("code",n.toString()),r.forEach((t=>e.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&&e.searchParams.set("trace",this.stack),this.message="Minified error #".concat(n,": See ").concat(e.toString()," for details."),this.args=r,this.code=n,this.url=e.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]))),e=t.split(/(\${\d+})/).filter((t=>""!==t));return e.map((t=>{var n;return null!==(n=r.get(t))&&void 0!==n?n:t}))}toJSON(){return{name:"InvariantError",message:this.message,description:this._n,code:this.code,args:this.args,stack:this.stack}}static setMessages(t){n=t}static create(t,n,e,a){null!=a&&n.push(a);var o=new r(t,n,e);return o.stack=null==a?void 0:a.stack,o._n=e,o}}const e=new WeakMap;async function a(t,n){const a=e.get(t);if(null!=a)return await a;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const o=new Promise(((e,a)=>{try{let e=function(t,n){return t.document.querySelectorAll(`script[src^="${n.replace(/\?.*$/,"")}"]`)[0]}(t,n);null!=e?o():(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",o),e.addEventListener("error",(function(){try{throw new r(23,[])}catch(t){a(t)}})))}catch(t){return a(t)}function o(){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,o),await o}async function o(t,n,r){return await s("@grammarly/editor-sdk",t,n,r)}async function s(t,n,e,o){if("undefined"==typeof window&&void 0===o)throw new r(21,[]);const s=function(t){return"null"!==t.location.origin?t.location.origin:"null"!==t.origin?t.origin:"null"}(null!=o?o:window);"null"===s&&(null!=o?o:window).top!==(null!=o?o:window)&&console.warn("Grammarly is not supported in IFrames with `null` origin. Consider adding `sandbox='allow-same-origin allow-scripts'` to <iframe> element.");const i=new URL("https://js.grammarly.com/grammarly-editor-sdk@2.3",s);null!=n&&i.searchParams.set("clientId",n),i.searchParams.set("packageName",t);const c=await a(null!=o?o:window,i.toString());if(null!=n)return new c.EditorSDK(n,e)}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,s as init_with_packageName}; | ||
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){super(),t(this,"args",void 0),t(this,"code",void 0),t(this,"url",void 0),t(this,"_c",void 0);var e=new URL("https://developer.grammarly.com/docs/error-explainer");e.searchParams.set("code",n.toString()),r.forEach((t=>e.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&&e.searchParams.set("trace",this.stack),this.message="Minified error #".concat(n,": See ").concat(e.toString()," for details."),this.args=r,this.code=n,this.url=e.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]))),e=t.split(/(\${\d+})/).filter((t=>""!==t));return e.map((t=>{var n;return null!==(n=r.get(t))&&void 0!==n?n:t}))}toJSON(){return{name:"InvariantError",message:this.message,description:this._n,code:this.code,args:this.args,stack:this.stack}}static setMessages(t){n=t}static create(t,n,e,a){null!=a&&n.push(a);var o=new r(t,n,e);return o.stack=null==a?void 0:a.stack,o._n=e,o}}const e=new WeakMap;async function a(t,n){const a=e.get(t);if(null!=a)return await a;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const o=new Promise(((e,a)=>{try{let e=function(t,n){return t.document.querySelectorAll(`script[src^="${n.replace(/\?.*$/,"")}"]`)[0]}(t,n);null!=e?o():(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",o),e.addEventListener("error",(function(){try{throw new r(23,[])}catch(t){a(t)}})))}catch(t){return a(t)}function o(){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,o),await o}async function o(t,n,r){return await s("@grammarly/editor-sdk",t,n,r)}async function s(t,n,e,o){if("undefined"==typeof window&&void 0===o)throw new r(21,[]);const s=function(t){return"null"!==t.location.origin?t.location.origin:"null"!==t.origin?t.origin:"null"}(null!=o?o:window);"null"===s&&(null!=o?o:window).top!==(null!=o?o:window)&&console.warn("Grammarly is not supported in IFrames with `null` origin. Consider adding `sandbox='allow-same-origin allow-scripts'` to <iframe> element.");const i=new URL("https://js.grammarly.com/grammarly-editor-sdk@2.3",s);null!=n&&i.searchParams.set("clientId",n),i.searchParams.set("packageName",t);const c=await a(null!=o?o:window,i.toString());if(null!=n)return new c.EditorSDK(n,e)}const i={onBeforeSuggestionCardOpen:"before-suggestion-card-open",onSuggestionCardOpen:"suggestion-card-open",onSuggestionCardClose:"suggestion-card-close",onSuggestionCardAction:"suggestion-card-action",onPluginTurnedOff:"plugin-turned-off",onPluginError:"plugin-error",onDocumentStats:"document-stats",onSessionStats:"session-stats"};export{i as callbackToEventName,o as init,s as init_with_packageName}; |
@@ -17,2 +17,2 @@ /** | ||
*/ | ||
"use strict";function t(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e=new Map;class r extends Error{constructor(e,r){super(),t(this,"args",void 0),t(this,"code",void 0),t(this,"url",void 0),t(this,"_c",void 0);var n=new URL("https://developer.grammarly.com/docs/error-explainer");n.searchParams.set("code",e.toString()),r.forEach((t=>n.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&&n.searchParams.set("trace",this.stack),this.message="Minified error #".concat(e,": See ").concat(n.toString()," for details."),this.args=r,this.code=e,this.url=n.toString()}toUserMessage(){var t=e.get("".concat(this.code));if(null==t)return[this];var r=new Map(this.args.map(((t,e)=>["${".concat(e,"}"),t]))),n=t.split(/(\${\d+})/).filter((t=>""!==t));return n.map((t=>{var e;return null!==(e=r.get(t))&&void 0!==e?e:t}))}toJSON(){return{name:"InvariantError",message:this.message,description:this._n,code:this.code,args:this.args,stack:this.stack}}static setMessages(t){e=t}static create(t,e,n,a){null!=a&&e.push(a);var o=new r(t,e,n);return o.stack=null==a?void 0:a.stack,o._n=n,o}}const n=new WeakMap;async function a(t,e){const a=n.get(t);if(null!=a)return await a;!function(t){null==t.Grammarly&&(t.Grammarly={})}(t);const o=new Promise(((n,a)=>{try{let n=function(t,e){return t.document.querySelectorAll(`script[src^="${e.replace(/\?.*$/,"")}"]`)[0]}(t,e);null!=n?o():(n=function(t,e){const r=t.document.createElement("script");return r.src=e,t.document.head.appendChild(r),r}(t,e),n.addEventListener("load",o),n.addEventListener("error",(function(){try{throw new r(23,[])}catch(t){a(t)}})))}catch(t){return a(t)}function o(){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,o),await o}async function o(t,e,n,o){if("undefined"==typeof window&&void 0===o)throw new r(21,[]);const s=function(t){return"null"!==t.location.origin?t.location.origin:"null"!==t.origin?t.origin:"null"}(null!=o?o:window);"null"===s&&(null!=o?o:window).top!==(null!=o?o:window)&&console.warn("Grammarly is not supported in IFrames with `null` origin. Consider adding `sandbox='allow-same-origin allow-scripts'` to <iframe> element.");const i=new URL("https://js.grammarly.com/grammarly-editor-sdk@2.3",s);null!=e&&i.searchParams.set("clientId",e),i.searchParams.set("packageName",t);const c=await a(null!=o?o:window,i.toString());if(null!=e)return new c.EditorSDK(e,n)}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,r){return await o("@grammarly/editor-sdk",t,e,r)},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){super(),t(this,"args",void 0),t(this,"code",void 0),t(this,"url",void 0),t(this,"_c",void 0);var r=new URL("https://developer.grammarly.com/docs/error-explainer");r.searchParams.set("code",e.toString()),n.forEach((t=>r.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&&r.searchParams.set("trace",this.stack),this.message="Minified error #".concat(e,": See ").concat(r.toString()," for details."),this.args=n,this.code=e,this.url=r.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]))),r=t.split(/(\${\d+})/).filter((t=>""!==t));return r.map((t=>{var e;return null!==(e=n.get(t))&&void 0!==e?e:t}))}toJSON(){return{name:"InvariantError",message:this.message,description:this._n,code:this.code,args:this.args,stack:this.stack}}static setMessages(t){e=t}static create(t,e,r,o){null!=o&&e.push(o);var a=new n(t,e,r);return a.stack=null==o?void 0:o.stack,a._n=r,a}}const r=new WeakMap;async function o(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}async function a(t,e,r,a){if("undefined"==typeof window&&void 0===a)throw new n(21,[]);const s=function(t){return"null"!==t.location.origin?t.location.origin:"null"!==t.origin?t.origin:"null"}(null!=a?a:window);"null"===s&&(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 i=new URL("https://js.grammarly.com/grammarly-editor-sdk@2.3",s);null!=e&&i.searchParams.set("clientId",e),i.searchParams.set("packageName",t);const c=await o(null!=a?a:window,i.toString());if(null!=e)return new c.EditorSDK(e,r)}exports.callbackToEventName={onBeforeSuggestionCardOpen:"before-suggestion-card-open",onSuggestionCardOpen:"suggestion-card-open",onSuggestionCardClose:"suggestion-card-close",onSuggestionCardAction:"suggestion-card-action",onPluginTurnedOff:"plugin-turned-off",onPluginError:"plugin-error",onDocumentStats:"document-stats",onSessionStats:"session-stats"},exports.init=async function(t,e,n){return await a("@grammarly/editor-sdk",t,e,n)},exports.init_with_packageName=a; |
@@ -22,3 +22,3 @@ { | ||
], | ||
"version": "2.3.13", | ||
"version": "2.3.14", | ||
"main": "./lib/index.js", | ||
@@ -47,6 +47,6 @@ "module": "./lib/index.esm.js", | ||
"devDependencies": { | ||
"@grammarly/plugin-core": "2.3.13", | ||
"@grammarly/plugin-editor": "2.3.13", | ||
"@grammarly/plugin-invariant": "2.3.13", | ||
"@grammarly/plugin-reactivity": "2.3.13", | ||
"@grammarly/plugin-core": "2.3.14", | ||
"@grammarly/plugin-editor": "2.3.14", | ||
"@grammarly/plugin-invariant": "2.3.14", | ||
"@grammarly/plugin-reactivity": "2.3.14", | ||
"@microsoft/api-extractor": "^7.28.7", | ||
@@ -53,0 +53,0 @@ "@testing-library/jest-dom": "^5.11.10", |
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
93103
2029