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.0.5 to 0.0.6

6

dist/acrolinx-app-sdk.min.js
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}({"//Qm":[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,e){void 0===e&&(e={}),this.listener.forEach(function(n){e.noDispatchTo&&n===e.noDispatchTo||n(t)})},t}();exports.InternalEventEmitter=t;
"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;
},{}],"/eMv":[function(require,module,exports) {
"use strict";var e,n;function o(e){window.parent&&window.parent!==window?window.parent.postMessage({command:"acrolinx.sidebar.openWindow",url:e},"*"):window.open(e)}function a(e){i({command:"acrolinx.sidebar.selectRanges",ranges:e})}function t(e){i({command:"acrolinx.sidebar.replaceRanges",ranges:e})}function r(e){i({command:"acrolinx.sidebar.configureAddon",config:e})}function i(e){window.parent&&window.parent!==window?window.parent.postMessage(e,"*"):console.warn("Missing parent window with sidebar.",e)}Object.defineProperty(exports,"__esModule",{value:!0}),function(e){e.extractedText="extractedText"}(e=exports.ReportType||(exports.ReportType={})),function(e){e.selectRanges="selectRanges",e.replaceRanges="replaceRanges"}(n=exports.AppApiCapability||(exports.AppApiCapability={})),exports.openWindow=o,exports.selectRanges=a,exports.replaceRanges=t,exports.configureAddon=r;
},{}],"UnXq":[function(require,module,exports) {
"use strict";function e(e,t){return!!e&&e.indexOf(t)>=0}Object.defineProperty(exports,"__esModule",{value:!0}),exports.includes=e;
"use strict";function e(e,n){return!!e&&e.indexOf(n)>=0}function n(e,n){return!(n.begin>=e.end||n.end<=e.begin)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.includes=e,exports.isOverlapping=n;
},{}],"7QCb":[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 i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./event-emitter"),n=require("./raw");exports.OffsetRange=n.OffsetRange;var r,i,a=require("./utils");exports.DEVELOPMENT_APP_SIGNATURE="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiS2lsbGVyIEFwcCIsImlkIjoiNGVlZDM3NjctMGYzMS00ZDVmLWI2MjktYzg2MWFiM2VkODUyIiwidHlwZSI6IkFQUCIsImlhdCI6MTU2MTE4ODI5M30.zlVJuGITMjAJ2p4nl-qtpj4N0p_8e4tenr-4dkrGdXg",function(e){e.selectRanges="selectRanges",e.replaceRanges="replaceRanges",e.openWindow="openWindow"}(r=exports.ApiCommands||(exports.ApiCommands={})),function(e){e.textExtracted="textExtracted",e.textExtractedLink="textExtractedLink",e.invalidRanges="invalidRanges"}(i=exports.ApiEvents||(exports.ApiEvents={}));var s={appSignature:exports.DEVELOPMENT_APP_SIGNATURE,title:"Acrolinx App",requiredReportContent:[],requiredReportLinks:[]},o=function(){function r(r){var o=this;this._events={textExtracted:new t.InternalEventEmitter,textExtractedLink:new t.InternalEventEmitter,invalidRanges:new t.InternalEventEmitter},this._commands={selectRanges:n.selectRanges,replaceRanges:n.replaceRanges,openWindow:n.openWindow};var p=[];a.includes(r.requiredEvents,i.textExtractedLink)&&p.push(n.ReportType.extractedText);var d=[];a.includes(r.requiredEvents,i.textExtracted)&&d.push(n.ReportType.extractedText),n.configureAddon(e({},s,r,{requiredReportLinks:p,requiredReportContent:d,requires:r.requiredCommands})),window.addEventListener("message",function(e){console.log("Got message from sidebar",e.data.type,e);var t=e.data;if(t)if("analysisResult"===t.type){var r=t,i=r.reports[n.ReportType.extractedText]||{};i.url&&o._events.textExtractedLink.dispatchEvent({url:i.url,languageId:r.languageId}),"string"==typeof i.content&&o._events.textExtracted.dispatchEvent({text:i.content,languageId:r.languageId})}else"invalidRanges"===t.type&&o._events.invalidRanges.dispatchEvent(t)},!1)}return Object.defineProperty(r.prototype,"events",{get:function(){return this._events},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"commands",{get:function(){return this._commands},enumerable:!0,configurable:!0}),r}();function p(e){return new o(e)}function d(e,t){return e.ranges.some(function(e){return e.begin<=t.begin&&t.begin<=e.end||e.begin<=t.end&&t.end<=e.end})}exports.AppApiConnection=o,exports.initApi=p,exports.isInvalid=d;
"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 i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0});var t=require("./event-emitter"),n=require("./raw");exports.OffsetRange=n.OffsetRange;var r,i,a=require("./utils");exports.DEVELOPMENT_APP_SIGNATURE="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJuYW1lIjoiS2lsbGVyIEFwcCIsImlkIjoiNGVlZDM3NjctMGYzMS00ZDVmLWI2MjktYzg2MWFiM2VkODUyIiwidHlwZSI6IkFQUCIsImlhdCI6MTU2MTE4ODI5M30.zlVJuGITMjAJ2p4nl-qtpj4N0p_8e4tenr-4dkrGdXg",function(e){e.selectRanges="selectRanges",e.replaceRanges="replaceRanges",e.openWindow="openWindow"}(r=exports.ApiCommands||(exports.ApiCommands={})),function(e){e.textExtracted="textExtracted",e.textExtractedLink="textExtractedLink",e.invalidRanges="invalidRanges"}(i=exports.ApiEvents||(exports.ApiEvents={}));var s={appSignature:exports.DEVELOPMENT_APP_SIGNATURE,title:"Acrolinx App",requiredReportContent:[],requiredReportLinks:[]},o=function(){function r(r){var o=this;this._events={textExtracted:new t.InternalEventEmitter,textExtractedLink:new t.InternalEventEmitter,invalidRanges:new t.InternalEventEmitter},this._commands={selectRanges:n.selectRanges,replaceRanges:n.replaceRanges,openWindow:n.openWindow};var p=[];a.includes(r.requiredEvents,i.textExtractedLink)&&p.push(n.ReportType.extractedText);var d=[];a.includes(r.requiredEvents,i.textExtracted)&&d.push(n.ReportType.extractedText),n.configureAddon(e({},s,r,{requiredReportLinks:p,requiredReportContent:d,requires:r.requiredCommands})),window.addEventListener("message",function(e){console.log("Got message from sidebar",e.data.type,e);var t=e.data;if(t)if("analysisResult"===t.type){var r=t,i=r.reports[n.ReportType.extractedText]||{};i.url&&o._events.textExtractedLink.dispatchEvent({url:i.url,languageId:r.languageId}),"string"==typeof i.content&&o._events.textExtracted.dispatchEvent({text:i.content,languageId:r.languageId})}else"invalidRanges"===t.type&&o._events.invalidRanges.dispatchEvent(t)},!1)}return Object.defineProperty(r.prototype,"events",{get:function(){return this._events},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"commands",{get:function(){return this._commands},enumerable:!0,configurable:!0}),r}();function p(e){return new o(e)}function d(e,t){return e.ranges.some(function(e){return a.isOverlapping(e,t)})}exports.AppApiConnection=o,exports.initApi=p,exports.isInvalid=d;
},{"./event-emitter":"//Qm","./raw":"/eMv","./utils":"UnXq"}]},{},["7QCb"], "acrolinxAppSdk")
//# sourceMappingURL=/acrolinx-app-sdk.min.js.map
declare type TypedEventListener<T> = (event: T) => void;
export interface DispatchOptions<T> {
noDispatchTo?: TypedEventListener<T>;
}
export interface TypedEventEmitter<T> {

@@ -13,4 +10,4 @@ addEventListener(listener: TypedEventListener<T>): void;

removeEventListener(listener: TypedEventListener<T>): void;
dispatchEvent(event: T, opts?: DispatchOptions<T>): void;
dispatchEvent(event: T): void;
}
export {};

@@ -28,8 +28,5 @@ "use strict";

};
InternalEventEmitter.prototype.dispatchEvent = function (event, opts) {
if (opts === void 0) { opts = {}; }
InternalEventEmitter.prototype.dispatchEvent = function (event) {
this.listener.forEach(function (listener) {
if (!opts.noDispatchTo || listener !== opts.noDispatchTo) {
listener(event);
}
listener(event);
});

@@ -36,0 +33,0 @@ };

@@ -124,8 +124,5 @@ "use strict";

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

@@ -0,1 +1,3 @@

import { OffsetRange } from './raw';
export declare function includes<T>(array: T[] | undefined, element: any): boolean;
export declare function isOverlapping(range1: OffsetRange, range2: OffsetRange): boolean;

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

exports.includes = includes;
function isOverlapping(range1, range2) {
var isNotOverlapping = (range2.begin >= range1.end || range2.end <= range1.begin);
return !isNotOverlapping;
}
exports.isOverlapping = isOverlapping;
//# sourceMappingURL=utils.js.map
{
"name": "@acrolinx/app-sdk",
"version": "0.0.5",
"version": "0.0.6",
"description": "Acrolinx App SDK",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

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

## Example Code

@@ -42,3 +39,2 @@

### Plain old JavaScript

@@ -56,3 +52,10 @@ If you prefer to code in plain old JavaScript without npm and without a bundler,

Please have a look at the corresponding [live demo](https://acrolinx.github.io/app-sdk-js/examples/text-extraction/).
Please note that this app does not do much when not loaded inside of an Acrolinx Sidebar.
## App Icon
The app icon needs to be named by convention "acrolinx-app-icon.svg" and must put next to the app html file ([example](./docs/examples/text-extraction)).
## Demo Projects

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

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