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

@acrolinx/app-sdk

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@acrolinx/app-sdk - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

dist/src/common-types.d.ts

8

dist/acrolinx-app-sdk-auto-form.min.js

@@ -1,2 +0,4 @@

parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"QmUd":[function(require,module,exports) {
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"c5rb":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
},{}],"QmUd":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=function(){function t(){this.listener=[]}return t.prototype.addEventListener=function(t){this.listener.push(t)},t.prototype.removeEventListener=function(t){this.listener=this.listener.filter(function(e){return e!==t})},t.prototype.dispatchEvent=function(t){this.listener.forEach(function(e){e(t)})},t}();exports.InternalEventEmitter=t;

@@ -8,6 +10,6 @@ },{}],"eMvI":[function(require,module,exports) {

},{}],"QCba":[function(require,module,exports) {
"use strict";var e=this&&this.__assign||function(){return(e=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./event-emitter"),n=require("./raw");exports.AppAccessTokenEvent=n.AppAccessTokenEvent,exports.CommonCapabilityAvailability=n.CommonCapabilityAvailability,exports.HttpGetRequest=n.HttpGetRequest,exports.OffsetRange=n.OffsetRange,exports.OffsetRangeWithReplacement=n.OffsetRangeWithReplacement,exports.VisibilityEvent=n.VisibilityEvent;var i,s,r=require("./utils");exports.DEVELOPMENT_APP_SIGNATURE="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiS2lsbGVyIEFwcCIsImlkIjoiNGVlZDM3NjctMGYzMS00ZDVmLWI2MjktYzg2MWFiM2VkODUyIiwidHlwZSI6IkFQUCIsImlhdCI6MTU2MTE4ODI5M30.zlVJuGITMjAJ2p4nl-qtpj4N0p_8e4tenr-4dkrGdXg",function(e){e.selectRanges="selectRanges",e.replaceRanges="replaceRanges",e.openWindow="openWindow",e.getAppAccessToken="getAppAccessToken"}(i=exports.RequiredCommands||(exports.RequiredCommands={})),function(e){e.textExtracted="textExtracted",e.textExtractedLink="textExtractedLink",e.invalidRanges="invalidRanges",e.visibility="visibility",e.capabilities="capabilities"}(s=exports.RequiredEvents||(exports.RequiredEvents={}));var a={appSignature:exports.DEVELOPMENT_APP_SIGNATURE,title:"Acrolinx App",requiredReportContent:[],requiredReportLinks:[]},o=function(){function i(i){var o=this;this._events={textExtracted:new t.InternalEventEmitter,textExtractedLink:new t.InternalEventEmitter,invalidRanges:new t.InternalEventEmitter,visibility:new t.InternalEventEmitter,capabilities:new t.InternalEventEmitter},this.waitingAppAccessTokenResolvers=[],this._commands={selectRanges:n.selectRanges,replaceRanges:n.replaceRanges,openWindow:n.openWindow,getAppAccessToken:function(){return o.getAppAccessToken()}};var p=[];r.includes(i.requiredEvents,s.textExtractedLink)&&p.push(n.ReportType.extractedText);var c=[];r.includes(i.requiredEvents,s.textExtracted)&&c.push(n.ReportType.extractedText),n.configureAddon(e(e(e({},a),i),{requiredReportLinks:p,requiredReportContent:c,requires:i.requiredCommands,requiredEvents:{visibility:r.getEmptyObjectIfIncluded(i.requiredEvents,s.visibility),capabilities:r.getEmptyObjectIfIncluded(i.requiredEvents,s.capabilities)}})),window.addEventListener("message",function(e){var t,n=e.data;if(e.source===window.parent&&(null===(t=n)||void 0===t?void 0:t.type))switch(console.log("Got message from sidebar",e.data.type,e),n.type){case"analysisResult":o.handleAnalysisResultEvent(n);break;case"invalidRanges":o._events.invalidRanges.dispatchEvent(n);break;case"appAccessToken":o.waitingAppAccessTokenResolvers.forEach(function(e){e(n)}),o.waitingAppAccessTokenResolvers=[];break;case"visibility":o._events.visibility.dispatchEvent(n);break;case"capabilities":o._events.capabilities.dispatchEvent(n);break;default:r.exhaustiveSwitchCheck(n,"AppApiEvent")}},!1)}return Object.defineProperty(i.prototype,"events",{get:function(){return this._events},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"commands",{get:function(){return this._commands},enumerable:!0,configurable:!0}),i.prototype.handleAnalysisResultEvent=function(e){var t=e.reports[n.ReportType.extractedText]||{};t.url&&this._events.textExtractedLink.dispatchEvent({url:t.url,languageId:e.languageId}),"string"==typeof t.content&&this._events.textExtracted.dispatchEvent({text:t.content,languageId:e.languageId,selection:e.selection})},i.prototype.getAppAccessToken=function(){var e=this,t=new Promise(function(t){e.waitingAppAccessTokenResolvers.push(t)});return n.getAppAccessToken(),t},i}();function p(e){return new o(e)}function c(e,t){return e.ranges.some(function(e){return r.isOverlapping(e,t)})}exports.initApi=p,exports.isInvalid=c;
},{"./event-emitter":"QmUd","./raw":"eMvI","./utils":"UnXq"}],"M10p":[function(require,module,exports) {
"use strict";var e=this&&this.__assign||function(){return(e=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./common-types");exports.CommonCapabilityAvailability=t.CommonCapabilityAvailability,exports.HttpGetRequest=t.HttpGetRequest,exports.OffsetRange=t.OffsetRange,exports.OffsetRangeWithReplacement=t.OffsetRangeWithReplacement,exports.VisibilityEvent=t.VisibilityEvent;var n=require("./event-emitter");exports.TypedEventEmitter=n.TypedEventEmitter;var i=require("./raw");exports.AppAccessTokenEvent=i.AppAccessTokenEvent;var s,r,a=require("./utils");exports.DEVELOPMENT_APP_SIGNATURE="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiS2lsbGVyIEFwcCIsImlkIjoiNGVlZDM3NjctMGYzMS00ZDVmLWI2MjktYzg2MWFiM2VkODUyIiwidHlwZSI6IkFQUCIsImlhdCI6MTU2MTE4ODI5M30.zlVJuGITMjAJ2p4nl-qtpj4N0p_8e4tenr-4dkrGdXg",function(e){e.selectRanges="selectRanges",e.replaceRanges="replaceRanges",e.openWindow="openWindow",e.getAppAccessToken="getAppAccessToken"}(s=exports.RequiredCommands||(exports.RequiredCommands={})),function(e){e.textExtracted="textExtracted",e.textExtractedLink="textExtractedLink",e.invalidRanges="invalidRanges",e.visibility="visibility",e.capabilities="capabilities",e.documentChange="documentChange"}(r=exports.RequiredEvents||(exports.RequiredEvents={}));var c={appSignature:exports.DEVELOPMENT_APP_SIGNATURE,title:"Acrolinx App",requiredReportContent:[],requiredReportLinks:[]},o=function(){function t(t){var s=this;this._events={textExtracted:new n.InternalEventEmitter,textExtractedLink:new n.InternalEventEmitter,invalidRanges:new n.InternalEventEmitter,visibility:new n.InternalEventEmitter,documentChange:new n.InternalEventEmitter,capabilities:new n.InternalEventEmitter},this.waitingAppAccessTokenResolvers=[],this._commands={selectRanges:i.selectRanges,replaceRanges:i.replaceRanges,openWindow:i.openWindow,getAppAccessToken:function(){return s.getAppAccessToken()}};var o=[];a.includes(t.requiredEvents,r.textExtractedLink)&&o.push(i.ReportType.extractedText);var p=[];a.includes(t.requiredEvents,r.textExtracted)&&p.push(i.ReportType.extractedText),i.configureAddon(e(e(e({},c),t),{requiredReportLinks:o,requiredReportContent:p,requires:t.requiredCommands,requiredEvents:{visibility:a.getEmptyObjectIfIncluded(t.requiredEvents,r.visibility),capabilities:a.getEmptyObjectIfIncluded(t.requiredEvents,r.capabilities),documentChange:a.getEmptyObjectIfIncluded(t.requiredEvents,r.documentChange)}})),window.addEventListener("message",function(e){var t=e.data;if(e.source===window.parent&&(null==t?void 0:t.type))switch(console.log("Got message from sidebar",e.data.type,e),t.type){case"analysisResult":s.handleAnalysisResultEvent(t);break;case"invalidRanges":s._events.invalidRanges.dispatchEvent(t);break;case"appAccessToken":s.waitingAppAccessTokenResolvers.forEach(function(e){e(t)}),s.waitingAppAccessTokenResolvers=[];break;case"visibility":s._events.visibility.dispatchEvent(t);break;case"capabilities":s._events.capabilities.dispatchEvent(t);break;case"documentChange":s._events.documentChange.dispatchEvent(t);break;default:a.exhaustiveSwitchCheck(t,"AppApiEvent")}},!1)}return Object.defineProperty(t.prototype,"events",{get:function(){return this._events},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"commands",{get:function(){return this._commands},enumerable:!0,configurable:!0}),t.prototype.handleAnalysisResultEvent=function(e){var t=e.reports[i.ReportType.extractedText]||{};t.url&&this._events.textExtractedLink.dispatchEvent({url:t.url,languageId:e.languageId}),"string"==typeof t.content&&this._events.textExtracted.dispatchEvent({text:t.content,languageId:e.languageId,selection:e.selection,document:e.document})},t.prototype.getAppAccessToken=function(){var e=this,t=new Promise(function(t){e.waitingAppAccessTokenResolvers.push(t)});return i.getAppAccessToken(),t},t}();function p(e){return new o(e)}function l(e,t){return e.ranges.some(function(e){return a.isOverlapping(e,t)})}exports.initApi=p,exports.isInvalid=l;
},{"./common-types":"c5rb","./event-emitter":"QmUd","./raw":"eMvI","./utils":"UnXq"}],"M10p":[function(require,module,exports) {
"use strict";var e=this&&this.__assign||function(){return(e=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},t=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,a,i=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(l){a={error:l}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(a)throw a.error}}return o},r=this&&this.__spread||function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(n(arguments[t]));return e};Object.defineProperty(exports,"__esModule",{value:!0});var a=require("./index"),i=require("./raw"),o=require("./utils");function l(e){var t=document.querySelector("meta[name="+e+"]");return t&&t.content}function c(){var e,n,r=document.querySelectorAll('[data-acrolinx="hide"]');try{for(var a=t(r),i=a.next();!i.done;i=a.next()){i.value.style.display="none"}}catch(o){e={error:o}}finally{try{i&&!i.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}}function u(e,t){return d(e,function(e){return void 0!==e.dataset[t]})}function d(e,t){for(var n=e;n&&n!==document.body;){if(t(n))return n;n=n.parentElement}}function s(e){var n,r;try{for(var a=t(document.getElementsByClassName(e)),i=a.next();!i.done;i=a.next()){i.value.classList.remove(e)}}catch(o){n={error:o}}finally{try{i&&!i.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}function f(e){return e.filter(function(e){return e})}var v="acrolinx-invalid-range";function p(e){var n=l("acrolinx-app-invalid-range-tooltip");e.events.invalidRanges.addEventListener(function(e){var r,i,o=document.querySelectorAll("[data-acrolinx-select-range]");try{for(var l=t(o),c=l.next();!c.done;c=l.next()){var u=c.value,d=JSON.parse(u.dataset.acrolinxSelectRange);a.isInvalid(e,d)&&(u.classList.add(v),n&&(u.title=n))}}catch(s){r={error:s}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}})}function m(e){var t=u(e,"acrolinxSelectRange");if(t&&!t.classList.contains(v)){var n=t.dataset.acrolinxSelectRange;return{element:t,range:JSON.parse(n)}}}function x(e){document.addEventListener("click",function(t){var n=m(t.target);n&&(s("acrolinx-selected-range"),n.element.classList.add("acrolinx-selected-range"),e.commands.selectRanges([n.range]))})}function y(t){document.addEventListener("click",function(n){var r=u(n.target,"acrolinxReplaceRange");if(r){var a=r.dataset.acrolinxReplaceRange,i=m(r);i&&(i.element.classList.add("acrolinx-replaced-range"),t.commands.replaceRanges([e(e({},i.range),{replacement:a})]))}})}function g(){i.hasParentWindow()&&c();var e=document.querySelector("title"),t=l("acrolinx-app-title")||e&&e.innerText,n=document.querySelector('[data-acrolinx="extractedText"]'),u=(l("acrolinx-app-required-commands")||"").split(/, */),d=(l("acrolinx-app-required-events")||"").split(/, *?/),s=a.initApi({title:t||window.location.href,button:{text:l("acrolinx-app-button-text")||"Check",tooltip:l("acrolinx-app-button-tooltip")||""},requiredCommands:u,requiredEvents:f(r([n&&a.RequiredEvents.textExtracted],d))});n&&s.events.textExtracted.addEventListener(function(e){n.value=e.text,n.form.submit()}),o.includes(d,a.RequiredEvents.invalidRanges)&&p(s),o.includes(u,a.RequiredCommands.selectRanges)&&x(s),o.includes(u,a.RequiredCommands.replaceRanges)&&y(s)}window.addEventListener("DOMContentLoaded",g);
},{"./index":"QCba","./raw":"eMvI","./utils":"UnXq"}]},{},["M10p"], null)
//# sourceMappingURL=/acrolinx-app-sdk-auto-form.min.js.map

@@ -1,2 +0,4 @@

parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"QmUd":[function(require,module,exports) {
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"c5rb":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
},{}],"QmUd":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=function(){function t(){this.listener=[]}return t.prototype.addEventListener=function(t){this.listener.push(t)},t.prototype.removeEventListener=function(t){this.listener=this.listener.filter(function(e){return e!==t})},t.prototype.dispatchEvent=function(t){this.listener.forEach(function(e){e(t)})},t}();exports.InternalEventEmitter=t;

@@ -8,4 +10,4 @@ },{}],"eMvI":[function(require,module,exports) {

},{}],"QCba":[function(require,module,exports) {
"use strict";var e=this&&this.__assign||function(){return(e=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./event-emitter"),n=require("./raw");exports.AppAccessTokenEvent=n.AppAccessTokenEvent,exports.CommonCapabilityAvailability=n.CommonCapabilityAvailability,exports.HttpGetRequest=n.HttpGetRequest,exports.OffsetRange=n.OffsetRange,exports.OffsetRangeWithReplacement=n.OffsetRangeWithReplacement,exports.VisibilityEvent=n.VisibilityEvent;var i,s,r=require("./utils");exports.DEVELOPMENT_APP_SIGNATURE="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiS2lsbGVyIEFwcCIsImlkIjoiNGVlZDM3NjctMGYzMS00ZDVmLWI2MjktYzg2MWFiM2VkODUyIiwidHlwZSI6IkFQUCIsImlhdCI6MTU2MTE4ODI5M30.zlVJuGITMjAJ2p4nl-qtpj4N0p_8e4tenr-4dkrGdXg",function(e){e.selectRanges="selectRanges",e.replaceRanges="replaceRanges",e.openWindow="openWindow",e.getAppAccessToken="getAppAccessToken"}(i=exports.RequiredCommands||(exports.RequiredCommands={})),function(e){e.textExtracted="textExtracted",e.textExtractedLink="textExtractedLink",e.invalidRanges="invalidRanges",e.visibility="visibility",e.capabilities="capabilities"}(s=exports.RequiredEvents||(exports.RequiredEvents={}));var a={appSignature:exports.DEVELOPMENT_APP_SIGNATURE,title:"Acrolinx App",requiredReportContent:[],requiredReportLinks:[]},o=function(){function i(i){var o=this;this._events={textExtracted:new t.InternalEventEmitter,textExtractedLink:new t.InternalEventEmitter,invalidRanges:new t.InternalEventEmitter,visibility:new t.InternalEventEmitter,capabilities:new t.InternalEventEmitter},this.waitingAppAccessTokenResolvers=[],this._commands={selectRanges:n.selectRanges,replaceRanges:n.replaceRanges,openWindow:n.openWindow,getAppAccessToken:function(){return o.getAppAccessToken()}};var p=[];r.includes(i.requiredEvents,s.textExtractedLink)&&p.push(n.ReportType.extractedText);var c=[];r.includes(i.requiredEvents,s.textExtracted)&&c.push(n.ReportType.extractedText),n.configureAddon(e(e(e({},a),i),{requiredReportLinks:p,requiredReportContent:c,requires:i.requiredCommands,requiredEvents:{visibility:r.getEmptyObjectIfIncluded(i.requiredEvents,s.visibility),capabilities:r.getEmptyObjectIfIncluded(i.requiredEvents,s.capabilities)}})),window.addEventListener("message",function(e){var t,n=e.data;if(e.source===window.parent&&(null===(t=n)||void 0===t?void 0:t.type))switch(console.log("Got message from sidebar",e.data.type,e),n.type){case"analysisResult":o.handleAnalysisResultEvent(n);break;case"invalidRanges":o._events.invalidRanges.dispatchEvent(n);break;case"appAccessToken":o.waitingAppAccessTokenResolvers.forEach(function(e){e(n)}),o.waitingAppAccessTokenResolvers=[];break;case"visibility":o._events.visibility.dispatchEvent(n);break;case"capabilities":o._events.capabilities.dispatchEvent(n);break;default:r.exhaustiveSwitchCheck(n,"AppApiEvent")}},!1)}return Object.defineProperty(i.prototype,"events",{get:function(){return this._events},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"commands",{get:function(){return this._commands},enumerable:!0,configurable:!0}),i.prototype.handleAnalysisResultEvent=function(e){var t=e.reports[n.ReportType.extractedText]||{};t.url&&this._events.textExtractedLink.dispatchEvent({url:t.url,languageId:e.languageId}),"string"==typeof t.content&&this._events.textExtracted.dispatchEvent({text:t.content,languageId:e.languageId,selection:e.selection})},i.prototype.getAppAccessToken=function(){var e=this,t=new Promise(function(t){e.waitingAppAccessTokenResolvers.push(t)});return n.getAppAccessToken(),t},i}();function p(e){return new o(e)}function c(e,t){return e.ranges.some(function(e){return r.isOverlapping(e,t)})}exports.initApi=p,exports.isInvalid=c;
},{"./event-emitter":"QmUd","./raw":"eMvI","./utils":"UnXq"}]},{},["QCba"], "acrolinxAppSdk")
"use strict";var e=this&&this.__assign||function(){return(e=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./common-types");exports.CommonCapabilityAvailability=t.CommonCapabilityAvailability,exports.HttpGetRequest=t.HttpGetRequest,exports.OffsetRange=t.OffsetRange,exports.OffsetRangeWithReplacement=t.OffsetRangeWithReplacement,exports.VisibilityEvent=t.VisibilityEvent;var n=require("./event-emitter");exports.TypedEventEmitter=n.TypedEventEmitter;var i=require("./raw");exports.AppAccessTokenEvent=i.AppAccessTokenEvent;var s,r,a=require("./utils");exports.DEVELOPMENT_APP_SIGNATURE="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiS2lsbGVyIEFwcCIsImlkIjoiNGVlZDM3NjctMGYzMS00ZDVmLWI2MjktYzg2MWFiM2VkODUyIiwidHlwZSI6IkFQUCIsImlhdCI6MTU2MTE4ODI5M30.zlVJuGITMjAJ2p4nl-qtpj4N0p_8e4tenr-4dkrGdXg",function(e){e.selectRanges="selectRanges",e.replaceRanges="replaceRanges",e.openWindow="openWindow",e.getAppAccessToken="getAppAccessToken"}(s=exports.RequiredCommands||(exports.RequiredCommands={})),function(e){e.textExtracted="textExtracted",e.textExtractedLink="textExtractedLink",e.invalidRanges="invalidRanges",e.visibility="visibility",e.capabilities="capabilities",e.documentChange="documentChange"}(r=exports.RequiredEvents||(exports.RequiredEvents={}));var c={appSignature:exports.DEVELOPMENT_APP_SIGNATURE,title:"Acrolinx App",requiredReportContent:[],requiredReportLinks:[]},o=function(){function t(t){var s=this;this._events={textExtracted:new n.InternalEventEmitter,textExtractedLink:new n.InternalEventEmitter,invalidRanges:new n.InternalEventEmitter,visibility:new n.InternalEventEmitter,documentChange:new n.InternalEventEmitter,capabilities:new n.InternalEventEmitter},this.waitingAppAccessTokenResolvers=[],this._commands={selectRanges:i.selectRanges,replaceRanges:i.replaceRanges,openWindow:i.openWindow,getAppAccessToken:function(){return s.getAppAccessToken()}};var o=[];a.includes(t.requiredEvents,r.textExtractedLink)&&o.push(i.ReportType.extractedText);var p=[];a.includes(t.requiredEvents,r.textExtracted)&&p.push(i.ReportType.extractedText),i.configureAddon(e(e(e({},c),t),{requiredReportLinks:o,requiredReportContent:p,requires:t.requiredCommands,requiredEvents:{visibility:a.getEmptyObjectIfIncluded(t.requiredEvents,r.visibility),capabilities:a.getEmptyObjectIfIncluded(t.requiredEvents,r.capabilities),documentChange:a.getEmptyObjectIfIncluded(t.requiredEvents,r.documentChange)}})),window.addEventListener("message",function(e){var t=e.data;if(e.source===window.parent&&(null==t?void 0:t.type))switch(console.log("Got message from sidebar",e.data.type,e),t.type){case"analysisResult":s.handleAnalysisResultEvent(t);break;case"invalidRanges":s._events.invalidRanges.dispatchEvent(t);break;case"appAccessToken":s.waitingAppAccessTokenResolvers.forEach(function(e){e(t)}),s.waitingAppAccessTokenResolvers=[];break;case"visibility":s._events.visibility.dispatchEvent(t);break;case"capabilities":s._events.capabilities.dispatchEvent(t);break;case"documentChange":s._events.documentChange.dispatchEvent(t);break;default:a.exhaustiveSwitchCheck(t,"AppApiEvent")}},!1)}return Object.defineProperty(t.prototype,"events",{get:function(){return this._events},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"commands",{get:function(){return this._commands},enumerable:!0,configurable:!0}),t.prototype.handleAnalysisResultEvent=function(e){var t=e.reports[i.ReportType.extractedText]||{};t.url&&this._events.textExtractedLink.dispatchEvent({url:t.url,languageId:e.languageId}),"string"==typeof t.content&&this._events.textExtracted.dispatchEvent({text:t.content,languageId:e.languageId,selection:e.selection,document:e.document})},t.prototype.getAppAccessToken=function(){var e=this,t=new Promise(function(t){e.waitingAppAccessTokenResolvers.push(t)});return i.getAppAccessToken(),t},t}();function p(e){return new o(e)}function l(e,t){return e.ranges.some(function(e){return a.isOverlapping(e,t)})}exports.initApi=p,exports.isInvalid=l;
},{"./common-types":"c5rb","./event-emitter":"QmUd","./raw":"eMvI","./utils":"UnXq"}]},{},["QCba"], "acrolinxAppSdk")
//# sourceMappingURL=/acrolinx-app-sdk.min.js.map

@@ -164,3 +164,3 @@ "use strict";

element: elementWithSelectRange,
range: JSON.parse(offsetRangeString)
range: JSON.parse(offsetRangeString),
};

@@ -207,3 +207,3 @@ }

text: getMetaValue('acrolinx-app-button-text') || 'Check',
tooltip: getMetaValue('acrolinx-app-button-tooltip') || ''
tooltip: getMetaValue('acrolinx-app-button-tooltip') || '',
},

@@ -213,3 +213,3 @@ requiredCommands: requiredCommands,

acrolinxExtractedTextField && index_1.RequiredEvents.textExtracted
], requiredEvents))
], requiredEvents)),
});

@@ -216,0 +216,0 @@ if (acrolinxExtractedTextField) {

@@ -6,2 +6,5 @@ declare type TypedEventListener<T> = (event: T) => void;

}
/**
* @internal
*/
export declare class InternalEventEmitter<T> implements TypedEventEmitter<T> {

@@ -8,0 +11,0 @@ private listener;

@@ -18,2 +18,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/**
* @internal
*/
var InternalEventEmitter = /** @class */ (function () {

@@ -20,0 +23,0 @@ function InternalEventEmitter() {

@@ -0,4 +1,5 @@

import { AppButtonConfig, CommonCapabilityAvailability, DocumentChangeEvent, DocumentDescriptor, HttpGetRequest, OffsetRange, OffsetRangeWithReplacement, VisibilityEvent } from './common-types';
import { TypedEventEmitter } from './event-emitter';
import { AppAccessTokenEvent, AppButtonConfig, CommonCapabilityAvailability, DocumentSelection, HttpGetRequest, OffsetRange, OffsetRangeWithReplacement, VisibilityEvent } from './raw';
export { OffsetRange, OffsetRangeWithReplacement, AppAccessTokenEvent, HttpGetRequest, CommonCapabilityAvailability, VisibilityEvent };
import { AppAccessTokenEvent, DocumentSelection } from './raw';
export { OffsetRange, OffsetRangeWithReplacement, AppAccessTokenEvent, HttpGetRequest, CommonCapabilityAvailability, VisibilityEvent, TypedEventEmitter, };
/**

@@ -19,2 +20,7 @@ * @public

selection?: DocumentSelection;
/**
* Since 2021.2
* Currently it's only set if the user has done a regular check before.
*/
document?: DocumentDescriptor;
}

@@ -66,3 +72,8 @@ /**

*/
capabilities = "capabilities"
capabilities = "capabilities",
/**
* Since Acrolinx 2021.2
* Currently triggered only by regular checks.
*/
documentChange = "documentChange"
}

@@ -77,2 +88,3 @@ /**

visibility: TypedEventEmitter<VisibilityEvent>;
documentChange: TypedEventEmitter<DocumentChangeEvent>;
capabilities: TypedEventEmitter<CapabilitiesEvent>;

@@ -85,2 +97,3 @@ }

visibility: CommonCapabilityAvailability;
documentChange?: CommonCapabilityAvailability;
capabilities: CommonCapabilityAvailability;

@@ -87,0 +100,0 @@ };

@@ -64,2 +64,7 @@ "use strict";

RequiredEvents["capabilities"] = "capabilities";
/**
* Since Acrolinx 2021.2
* Currently triggered only by regular checks.
*/
RequiredEvents["documentChange"] = "documentChange";
})(RequiredEvents = exports.RequiredEvents || (exports.RequiredEvents = {}));

@@ -73,3 +78,3 @@ /**

requiredReportContent: [],
requiredReportLinks: []
requiredReportLinks: [],
};

@@ -87,3 +92,4 @@ /**

visibility: new event_emitter_1.InternalEventEmitter(),
capabilities: new event_emitter_1.InternalEventEmitter()
documentChange: new event_emitter_1.InternalEventEmitter(),
capabilities: new event_emitter_1.InternalEventEmitter(),
};

@@ -95,3 +101,3 @@ this.waitingAppAccessTokenResolvers = [];

openWindow: raw_1.openWindow,
getAppAccessToken: function () { return _this.getAppAccessToken(); }
getAppAccessToken: function () { return _this.getAppAccessToken(); },
};

@@ -109,8 +115,8 @@ var requiredReportLinks = [];

visibility: utils_1.getEmptyObjectIfIncluded(config.requiredEvents, RequiredEvents.visibility),
capabilities: utils_1.getEmptyObjectIfIncluded(config.requiredEvents, RequiredEvents.capabilities)
capabilities: utils_1.getEmptyObjectIfIncluded(config.requiredEvents, RequiredEvents.capabilities),
documentChange: utils_1.getEmptyObjectIfIncluded(config.requiredEvents, RequiredEvents.documentChange),
} }));
window.addEventListener('message', function (messageEvent) {
var _a;
var eventForApp = messageEvent.data;
if (messageEvent.source !== window.parent || !((_a = eventForApp) === null || _a === void 0 ? void 0 : _a.type)) {
if (messageEvent.source !== window.parent || !(eventForApp === null || eventForApp === void 0 ? void 0 : eventForApp.type)) {
// Message is probably not from the Sidebar. Ignore it.

@@ -139,2 +145,5 @@ return;

break;
case 'documentChange':
_this._events.documentChange.dispatchEvent(eventForApp);
break;
default:

@@ -165,3 +174,3 @@ utils_1.exhaustiveSwitchCheck(eventForApp, 'AppApiEvent');

url: textExtractedReport.url,
languageId: analysisResult.languageId
languageId: analysisResult.languageId,
});

@@ -173,3 +182,4 @@ }

languageId: analysisResult.languageId,
selection: analysisResult.selection
selection: analysisResult.selection,
document: analysisResult.document,
});

@@ -199,5 +209,7 @@ }

function isInvalid(event, range) {
return event.ranges.some(function (inValidRange) { return utils_1.isOverlapping(inValidRange, range); });
return event.ranges.some(function (inValidRange) {
return utils_1.isOverlapping(inValidRange, range);
});
}
exports.isInvalid = isInvalid;
//# sourceMappingURL=index.js.map

@@ -1,5 +0,6 @@

export interface AppButtonConfig {
text: string;
tooltip?: string;
}
/**
* @packageDocumentation
* @internal
*/
import { AppButtonConfig, CommonCapabilityAvailability, DocumentChangeEvent, DocumentDescriptor, HttpGetRequest, OffsetRange, OffsetRangeWithReplacement, VisibilityEvent } from './common-types';
export declare enum ReportType {

@@ -26,2 +27,3 @@ extractedText = "extractedText"

visibility?: AppApiEventConfig;
documentChange?: AppApiEventConfig;
capabilities?: AppApiEventConfig;

@@ -48,2 +50,7 @@ };

reports: ReportsForAddon;
/**
* Since 2021.2
* Currently it's only set if the user has done a regular check before.
*/
document?: DocumentDescriptor;
}

@@ -61,10 +68,2 @@ /**

}
export interface VisibilityEvent {
type: 'visibility';
visible: boolean;
}
export interface CommonCapabilityAvailability {
available: boolean;
temporary: boolean;
}
export interface CapabilitiesEventInternal {

@@ -77,2 +76,3 @@ type: 'capabilities';

visibility: CommonCapabilityAvailability;
documentChange: CommonCapabilityAvailability;
capabilities: CommonCapabilityAvailability;

@@ -97,27 +97,3 @@ };

}
/**
* @public
*/
export interface HttpGetRequest {
url: string;
headers: {
[key: string]: string;
};
}
export declare type EventForApp = AnalysisResultEvent | InvalidateRangesEvent | AppAccessTokenEvent | CapabilitiesEventInternal | VisibilityEvent;
/**
* @public
*/
export interface OffsetRange {
begin: number;
end: number;
}
/**
* @public
*/
export interface OffsetRangeWithReplacement {
replacement: string;
begin: number;
end: number;
}
export declare type EventForApp = AnalysisResultEvent | InvalidateRangesEvent | AppAccessTokenEvent | CapabilitiesEventInternal | VisibilityEvent | DocumentChangeEvent;
export declare function hasParentWindow(): boolean;

@@ -124,0 +100,0 @@ export declare function openWindow(url: string): void;

@@ -0,1 +1,2 @@

/** @internal Make all the code in this file (Dynamic Module) external */
/**

@@ -17,3 +18,3 @@ * Copyright 2019-present Acrolinx GmbH

*/
import { OffsetRange } from './raw';
import { OffsetRange } from './common-types';
/**

@@ -20,0 +21,0 @@ * @packageDocumentation

"use strict";
/** @internal Make all the code in this file (Dynamic Module) external */
/**

@@ -3,0 +4,0 @@ * Copyright 2019-present Acrolinx GmbH

{
"name": "@acrolinx/app-sdk",
"version": "0.1.2",
"version": "0.1.3",
"description": "Acrolinx App SDK",

@@ -37,23 +37,26 @@ "license": "Apache-2.0",

"prettier": "prettier --write \"{src,test}/**/*.ts\"",
"gendoc": "tsc && api-extractor run --local --verbose && api-documenter markdown --input-folder tmp --output-folder docs/api",
"typedoc": "typedoc"
"docs": "npm run apiDocumenter && npm run typeDoc",
"apiDocumenter": "tsc && api-extractor run --local --verbose && api-documenter markdown --input-folder tmp --output-folder docs/api",
"genImages": "mmdc -i docs/images/authentication.mmd",
"typeDoc": "rm -rf docs/typedoc && typedoc"
},
"devDependencies": {
"@microsoft/api-documenter": "^7.7.2",
"@microsoft/api-extractor": "^7.7.0",
"@types/jest": "^24.0.25",
"@typescript-eslint/eslint-plugin": "^2.15.0",
"@typescript-eslint/parser": "^2.15.0",
"@mermaid-js/mermaid-cli": "^8.4.8",
"@microsoft/api-documenter": "^7.7.18",
"@microsoft/api-extractor": "^7.7.13",
"@types/jest": "^25.2.1",
"@typescript-eslint/eslint-plugin": "^2.28.0",
"@typescript-eslint/parser": "^2.28.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.9.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-prettier": "^3.1.2",
"jest": "^24.9.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-prettier": "^3.1.3",
"jest": "^25.4.0",
"jest-junit": "^10.0.0",
"markdown-doctest": "^1.0.0",
"parcel": "^1.12.4",
"prettier": "1.19.1",
"ts-jest": "^24.3.0",
"typedoc": "^0.16.9",
"typescript": "^3.7.4"
"prettier": "^2.0.4",
"ts-jest": "^25.4.0",
"typedoc": "^0.17.4",
"typescript": "^3.8.3"
},

@@ -60,0 +63,0 @@ "jest": {

@@ -64,2 +64,10 @@ # Acrolinx App SDK

## References
* [API documentation](https://acrolinx.github.io/app-sdk-js/typedoc/modules/_index_.html)
## Authentication
![Sequence Diagram](./docs/images/authentication.mmd.svg)
## License

@@ -66,0 +74,0 @@

@@ -35,3 +35,3 @@ /**

isInvalid,
OffsetRange
OffsetRange,
} from './index';

@@ -63,3 +63,3 @@ import { hasParentWindow } from './raw';

startElement,
el => el.dataset[dataAttribute] !== undefined
(el) => el.dataset[dataAttribute] !== undefined
);

@@ -89,3 +89,3 @@ }

function compact<T>(array: Array<T | null>): T[] {
return array.filter(el => el) as T[];
return array.filter((el) => el) as T[];
}

@@ -99,3 +99,3 @@

);
appApi.events.invalidRanges.addEventListener(invalidRangesEvent => {
appApi.events.invalidRanges.addEventListener((invalidRangesEvent) => {
const selectRangesElements = document.querySelectorAll<HTMLElement>(

@@ -137,3 +137,3 @@ '[data-acrolinx-select-range]'

element: elementWithSelectRange,
range: JSON.parse(offsetRangeString)
range: JSON.parse(offsetRangeString),
};

@@ -143,3 +143,3 @@ }

function addClickSelectRangeListener(appApi: AcrolinxAppApi) {
document.addEventListener('click', ev => {
document.addEventListener('click', (ev) => {
const elementWithRange = findAncestorWithValidSelectRange(

@@ -160,3 +160,3 @@ ev.target as HTMLElement

function addClickReplaceRangeListener(appApi: AcrolinxAppApi) {
document.addEventListener('click', ev => {
document.addEventListener('click', (ev) => {
const elementWithReplaceRange = findAncestorWithData(

@@ -207,3 +207,3 @@ ev.target as HTMLElement,

text: getMetaValue('acrolinx-app-button-text') || 'Check',
tooltip: getMetaValue('acrolinx-app-button-tooltip') || ''
tooltip: getMetaValue('acrolinx-app-button-tooltip') || '',
},

@@ -213,8 +213,8 @@ requiredCommands: requiredCommands as RequiredCommands[],

acrolinxExtractedTextField && RequiredEvents.textExtracted,
...(requiredEvents as RequiredEvents[])
])
...(requiredEvents as RequiredEvents[]),
]),
});
if (acrolinxExtractedTextField) {
appApi.events.textExtracted.addEventListener(event => {
appApi.events.textExtracted.addEventListener((event) => {
acrolinxExtractedTextField.value = event.text;

@@ -221,0 +221,0 @@ acrolinxExtractedTextField.form!.submit();

@@ -24,2 +24,5 @@ /*

/**
* @internal
*/
export class InternalEventEmitter<T> implements TypedEventEmitter<T> {

@@ -33,7 +36,7 @@ private listener: Array<TypedEventListener<T>> = [];

public removeEventListener(listener: TypedEventListener<T>) {
this.listener = this.listener.filter(li => li !== listener);
this.listener = this.listener.filter((li) => li !== listener);
}
public dispatchEvent(event: T) {
this.listener.forEach(listener => {
this.listener.forEach((listener) => {
listener(event);

@@ -40,0 +43,0 @@ });

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

import {
AppButtonConfig,
CommonCapabilityAvailability,
DocumentChangeEvent,
DocumentDescriptor,
HttpGetRequest,
OffsetRange,
OffsetRangeWithReplacement,
VisibilityEvent,
} from './common-types';
import { InternalEventEmitter, TypedEventEmitter } from './event-emitter';

@@ -22,5 +32,3 @@ import {

AppAccessTokenEvent,
AppButtonConfig,
CapabilitiesEventInternal,
CommonCapabilityAvailability,
configureAddon,

@@ -30,5 +38,2 @@ DocumentSelection,

getAppAccessToken,
HttpGetRequest,
OffsetRange,
OffsetRangeWithReplacement,
openWindow,

@@ -40,3 +45,2 @@ replaceRanges,

SidebarAddonConfig,
VisibilityEvent
} from './raw';

@@ -47,3 +51,3 @@ import {

includes,
isOverlapping
isOverlapping,
} from './utils';

@@ -57,3 +61,4 @@

CommonCapabilityAvailability,
VisibilityEvent
VisibilityEvent,
TypedEventEmitter,
};

@@ -79,2 +84,8 @@

selection?: DocumentSelection;
/**
* Since 2021.2
* Currently it's only set if the user has done a regular check before.
*/
document?: DocumentDescriptor;
}

@@ -112,3 +123,3 @@

openWindow = 'openWindow',
getAppAccessToken = 'getAppAccessToken'
getAppAccessToken = 'getAppAccessToken',
}

@@ -134,3 +145,9 @@

*/
capabilities = 'capabilities'
capabilities = 'capabilities',
/**
* Since Acrolinx 2021.2
* Currently triggered only by regular checks.
*/
documentChange = 'documentChange',
}

@@ -145,3 +162,3 @@

requiredReportContent: [],
requiredReportLinks: []
requiredReportLinks: [],
};

@@ -158,3 +175,4 @@

visibility: new InternalEventEmitter<VisibilityEvent>(),
capabilities: new InternalEventEmitter<CapabilitiesEventInternal>()
documentChange: new InternalEventEmitter<DocumentChangeEvent>(),
capabilities: new InternalEventEmitter<CapabilitiesEventInternal>(),
};

@@ -170,3 +188,3 @@

openWindow,
getAppAccessToken: () => this.getAppAccessToken()
getAppAccessToken: () => this.getAppAccessToken(),
};

@@ -207,4 +225,8 @@

RequiredEvents.capabilities
)
}
),
documentChange: getEmptyObjectIfIncluded(
config.requiredEvents,
RequiredEvents.documentChange
),
},
});

@@ -214,3 +236,3 @@

'message',
messageEvent => {
(messageEvent) => {
const eventForApp: EventForApp | undefined = messageEvent.data;

@@ -237,3 +259,3 @@

case 'appAccessToken':
this.waitingAppAccessTokenResolvers.forEach(resolve => {
this.waitingAppAccessTokenResolvers.forEach((resolve) => {
resolve(eventForApp);

@@ -249,2 +271,5 @@ });

break;
case 'documentChange':
this._events.documentChange.dispatchEvent(eventForApp);
break;
default:

@@ -265,3 +290,3 @@ exhaustiveSwitchCheck(eventForApp, 'AppApiEvent');

url: textExtractedReport.url,
languageId: analysisResult.languageId
languageId: analysisResult.languageId,
});

@@ -274,3 +299,4 @@ }

languageId: analysisResult.languageId,
selection: analysisResult.selection
selection: analysisResult.selection,
document: analysisResult.document,
});

@@ -281,3 +307,3 @@ }

private getAppAccessToken(): Promise<AppAccessTokenResult> {
const promise = new Promise<AppAccessTokenResult>(resolve => {
const promise = new Promise<AppAccessTokenResult>((resolve) => {
this.waitingAppAccessTokenResolvers.push(resolve);

@@ -298,2 +324,3 @@ });

visibility: TypedEventEmitter<VisibilityEvent>;
documentChange: TypedEventEmitter<DocumentChangeEvent>;
capabilities: TypedEventEmitter<CapabilitiesEvent>;

@@ -307,2 +334,3 @@ }

visibility: CommonCapabilityAvailability;
documentChange?: CommonCapabilityAvailability;
capabilities: CommonCapabilityAvailability;

@@ -317,2 +345,3 @@ };

}
/**

@@ -369,3 +398,5 @@ * @public

): boolean {
return event.ranges.some(inValidRange => isOverlapping(inValidRange, range));
return event.ranges.some((inValidRange) =>
isOverlapping(inValidRange, range)
);
}

@@ -17,9 +17,20 @@ /*

export interface AppButtonConfig {
text: string;
tooltip?: string;
}
/**
* @packageDocumentation
* @internal
*/
import {
AppButtonConfig,
CommonCapabilityAvailability,
DocumentChangeEvent,
DocumentDescriptor,
HttpGetRequest,
OffsetRange,
OffsetRangeWithReplacement,
VisibilityEvent,
} from './common-types';
export enum ReportType {
extractedText = 'extractedText'
extractedText = 'extractedText',
}

@@ -29,3 +40,3 @@

selectRanges = 'selectRanges',
replaceRanges = 'replaceRanges'
replaceRanges = 'replaceRanges',
}

@@ -50,2 +61,3 @@

visibility?: AppApiEventConfig;
documentChange?: AppApiEventConfig;
capabilities?: AppApiEventConfig;

@@ -77,2 +89,8 @@ };

reports: ReportsForAddon;
/**
* Since 2021.2
* Currently it's only set if the user has done a regular check before.
*/
document?: DocumentDescriptor;
}

@@ -93,12 +111,2 @@

export interface VisibilityEvent {
type: 'visibility';
visible: boolean;
}
export interface CommonCapabilityAvailability {
available: boolean;
temporary: boolean;
}
export interface CapabilitiesEventInternal {

@@ -111,2 +119,3 @@ type: 'capabilities';

visibility: CommonCapabilityAvailability;
documentChange: CommonCapabilityAvailability;
capabilities: CommonCapabilityAvailability;

@@ -133,10 +142,2 @@ };

/**
* @public
*/
export interface HttpGetRequest {
url: string;
headers: { [key: string]: string };
}
export type EventForApp =

@@ -147,21 +148,5 @@ | AnalysisResultEvent

| CapabilitiesEventInternal
| VisibilityEvent;
| VisibilityEvent
| DocumentChangeEvent;
/**
* @public
*/
export interface OffsetRange {
begin: number;
end: number;
}
/**
* @public
*/
export interface OffsetRangeWithReplacement {
replacement: string;
begin: number;
end: number;
}
export function hasParentWindow() {

@@ -168,0 +153,0 @@ return window.parent && window.parent !== window;

@@ -0,1 +1,2 @@

/** @internal Make all the code in this file (Dynamic Module) external */
/**

@@ -18,3 +19,3 @@ * Copyright 2019-present Acrolinx GmbH

import { OffsetRange } from './raw';
import { OffsetRange } from './common-types';

@@ -21,0 +22,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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