From 2a4e490d70cb9a863608df8512d911d139316e7e Mon Sep 17 00:00:00 2001 From: MrSpoocy Date: Wed, 8 May 2024 08:26:16 +0200 Subject: [PATCH] fix(workflow): use lib folder from build --- .github/workflows/publish.yml | 11 +- lib/IMSInterface.d.ts | 128 ----- lib/IMSInterface.js | 217 -------- lib/index.d.ts | 8 - lib/index.js | 26 - lib/utils.d.ts | 12 - lib/utils.js | 114 ---- lib/v10.d.ts | 20 - lib/v10.js | 56 -- lib/v11.d.ts | 20 - lib/v11.js | 56 -- lib/v8.d.ts | 920 ------------------------------- lib/v8.js | 989 ---------------------------------- lib/v9.d.ts | 60 --- lib/v9.js | 133 ----- 15 files changed, 10 insertions(+), 2760 deletions(-) delete mode 100644 lib/IMSInterface.d.ts delete mode 100644 lib/IMSInterface.js delete mode 100644 lib/index.d.ts delete mode 100644 lib/index.js delete mode 100644 lib/utils.d.ts delete mode 100644 lib/utils.js delete mode 100644 lib/v10.d.ts delete mode 100644 lib/v10.js delete mode 100644 lib/v11.d.ts delete mode 100644 lib/v11.js delete mode 100644 lib/v8.d.ts delete mode 100644 lib/v8.js delete mode 100644 lib/v9.d.ts delete mode 100644 lib/v9.js diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8293d23..503df41 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,8 +24,13 @@ jobs: run: npm ci - name: Build 🔧 run: npm run build --if-present - - name: Test + - name: Test 🧪 run: npm run test --if-present + - name: Archive production artifacts 🚀 + uses: actions/upload-artifact@v4 + with: + name: lib + path: lib release: name: semantic-release needs: [build] @@ -39,6 +44,10 @@ jobs: uses: actions/setup-node@v4 with: node-version: '20.x' + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: lib - name: Publish package 📦 run: | npm ci diff --git a/lib/IMSInterface.d.ts b/lib/IMSInterface.d.ts deleted file mode 100644 index 3ae7bf2..0000000 --- a/lib/IMSInterface.d.ts +++ /dev/null @@ -1,128 +0,0 @@ -declare class IMSInterface { - /** - * Establishes an IMS session. Must be called before any IMS access methods. - * This method is not thread safe. - * - * @return An IMS reference string, as returned from IMSLib, which you - * can then use to make further IMS calls to this object's methods. - * - * @deprecated Please use imsConnectWithEndpoint instead. - */ - imsConnect(): string; - imsDisconnect(imsRef: string): void; - imsConnectWithEndpoint(imsEndpoint?: string): string; - imsFetchAccounts(imsRef: string, clientId: string): string; - imsFetchUserProfileData(imsRef: string, userAccountGuid: string): string; - /** - * Requests an access token from IMS for a given user and service. - * - * This function is asynchronous. To handle the result, register a callback for the event - * "com.adobe.csxs.events.internal.ims.FetchAccessToken" or "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus". - * For event "com.adobe.csxs.events.internal.ims.FetchAccessToken", the event data is a JSON string - * with format {"toua":"...",...,"emailVerified":"false"}. - * For event "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus", the event data is a JSON string - * with format {"status":"0","details":{"toua":"...",...,"emailVerified":"false"}}. - * - * @see addEventListener() - * - * @param imsRef An IMS reference returned from the \c IMSConnect() call. - * @param clientId The IMS client ID for your extension, assigned by the IMS team on registration. - * This is the service-code value in the Renga Service Account Object for your client. - * @param clientSecret The client secret associated with the provided client ID - * @param userAccountGuid The unique person GUID for the Renga account, as returned by the fetchAccounts() method. The token is generated for this user. - * @param serviceAccountGuid (optional, not currently used) A unique identifier for a Service Account Object (SAO). - * @param scope (optional) A comma delimited list of services for which the refresh and access tokens are requested. - * - * By default, this is 'openid,AdobeID'. Scope strings are case sensitive. - * If the cached version of the refresh token does not match the requested service scopes, a new refresh token is fetched. - * To request your service's own SAO, add your service to the list; - * for example, 'openid,AdobeID,browserlab'. - * - * @return A boolean status. Returning true means only the call to imsFetchAccessToken function itself is successful. - * Returning false means that failed to fetch access token. - */ - imsFetchAccessToken(imsRef: string, clientId: string, clientSecret: string, userAccountGuid: string, serviceAccountGuid?: string, scope?: string): boolean; - imsFetchContinueToken(imsRef: any, bearerToken: string, targetClientId: string, redirectUri?: string, scope?: string, responseType?: string, locale?: string): string; - imsRevokeDeviceToken(imsRef: string, clientId: string, clientSecret: string, userAccountGuid: string, serviceAccountGuid?: string): boolean; - imsSetProxyCredentials(proxyUsername: string, proxyPassword: string): void; - showAAM(clientId: string, clientSecret: string, redirectUri: string, userAccountGuid: string, serviceAccountGuid: string, scope: string): Boolean; - imsGetCurrentUserId(): object; - imsGetCurrentUserIdHelper(callback: Function): void; - imsLogoutUser(imsRef: string, userAccountGuid: string, clientId: string): object; - imsAttemptSSOJumpWorkflows(openBrowser: boolean, url: string, imsRef: string, clientId?: string, clientSecret?: string, scope?: string, userAccountGuid?: string, targetClientId?: string, targetScope?: string, targetResponseType?: string, targetLocale?: string): any; -} -declare namespace IMSInterface { - enum Events { - imsFetchAccessTokenWithStatus = "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus", - imsFetchAccessToken = "com.adobe.csxs.events.internal.ims.FetchAccessToken", - imsRevokeAccessToken = "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus", - imsFetchContinueToken = "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus", - imsAAMIMSStatus = "vulcan.SuiteMessage.com.adobe.aam.AAMIMSStatus", - imsLogoutUser = "com.adobe.csxs.events.internal.ims.LogoutUser", - imsSSOStatus = "com.adobe.csxs.events.internal.ims.SSOStatus" - } - enum Status { - IMS_SUCCESS = "0", - IMS_ERROR_FAILURE = "1", - IMS_ERROR_INVALID_ARGUMENTS = "2", - IMS_ERROR_CANCEL = "20", - IMS_ERROR_TIMEOUT = "21", - IMS_ERROR_HTTPFAILURE = "22", - IMS_ERROR_SSLFAILURE = "23", - IMS_ERROR_AUTH_PROXY_REQUIRED = "24", - IMS_ERROR_AUTH_PROXY_FAILED = "25", - IMS_ERROR_IN_ACCESS_IDP = "26", - IMS_ERROR_ANOTHER_REQUEST_IN_PROCESS = "40", - IMS_ERROR_IN_READ_USER_DATA = "60", - IMS_ERROR_IN_SAVE_USER_DATA = "61", - IMS_ERROR_IN_REMOVE_USER_DATA = "62", - IMS_ERROR_USER_DATA_NOT_PRESENT = "63", - IMS_ERROR_IN_READ_DEVICE_TOKEN = "64", - IMS_ERROR_IN_SAVE_DEVICE_TOKEN = "65", - IMS_ERROR_IN_REMOVE_DEVICE_TOKEN = "66", - IMS_ERROR_DEVICE_TOKEN_NOT_PRESENT = "67", - IMS_ERROR_INVALID_DEVICE_TOKEN = "68", - IMS_ERROR_CLIENTID_NOT_PRESENT = "69", - IMS_ERROR_IN_FETCH_USER_ACCOUNTS = "70", - IMS_ERROR_IN_SAVE_USER_FOR_CLIENTID = "71", - IMS_ERROR_DEVICE_ID_NOT_PRESENT = "72", - IMS_ERROR_DEFAULT_USER_FOR_CLIENTID_NOT_PRESENT = "73", - IMS_ERROR_NO_USER_RECORDS_PRESENT = "74", - IMS_ERROR_ACCESS_DENIED = "80", - IMS_ERROR_INVALID_REQUEST = "81", - IMS_ERROR_INVALID_CLIENT = "82", - IMS_ERROR_INVALID_GRANT = "83", - IMS_ERROR_UNAUTHORIZED_CLIENT = "84", - IMS_ERROR_UNSUPPORTED_RESPONSE_TYPE = "85", - IMS_ERROR_INVALID_SCOPE = "86", - IMS_ERROR_UNSUPPORTED_GRANT_TYPE = "87", - IMS_ERROR_BAD_REQUEST = "88", - IMS_ERROR_INVALID_CREDENTIALS = "89", - IMS_ERROR_IN_GET_AUTH_DATA_FROM_IDP = "100", - IMS_ERROR_IN_GET_DEVICE_TOKEN_FROM_IDP = "101", - IMS_ERROR_IN_GET_REFRESH_TOKEN_FROM_IDP = "102", - IMS_ERROR_IN_GET_ACCESS_TOKEN_FROM_IDP = "103", - IMS_ERROR_IN_GET_PROFILE_DATA_FROM_IDP = "104", - IMS_ERROR_TOU_CHANGED = "120", - IMS_ERROR_IN_REVOKE_DEVICE_TOKEN = "121", - IMS_ERROR_TOU_NOT_CURRENT = "122", - IMS_ERROR_EVS_INVALID = "123", - IMS_ERROR_ACCT_ACT_REQ = "124", - IMS_ERROR_ACCT_DISABLED = "125", - IMS_ERROR_SUBS_ACT_REQ = "126", - IMS_ERROR_SUBS_NO_SUB = "127", - IMS_ERROR_NO_BUDDY_GROUP_FOR_CLIENT = "150", - IMS_ERROR_CLIENT_REGISTERED_FOR_OTHER_GROUP = "151", - IMS_ERROR_GROUP_ENTRY_NOT_PRESENT = "152", - IMS_ERROR_IN_SAVE_GROUP_DATA = "153", - IMS_ERROR_CNAME_ENTRY_NOT_PRESENT = "154", - IMS_ERROR_IN_SAVE_BACKOFF_DATA = "155", - IMSMANAGER_ERROR_EXCEPTION = "3000", - IMSMANAGER_ERROR_ENCODING = "3001", - IMSMANAGER_SUCCESS_BROWSER_OPENED = "3002", - IMSMANAGER_ERROR_BROWSER_FAILED_TO_OPEN = "3003", - IMS_UNKNOWN_ERROR = "0xFFFF" - } -} -export { IMSInterface }; -export default IMSInterface; diff --git a/lib/IMSInterface.js b/lib/IMSInterface.js deleted file mode 100644 index 5eafd8d..0000000 --- a/lib/IMSInterface.js +++ /dev/null @@ -1,217 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var IMSInterface = /** @class */ (function () { - function IMSInterface() { - } - /** - * Establishes an IMS session. Must be called before any IMS access methods. - * This method is not thread safe. - * - * @return An IMS reference string, as returned from IMSLib, which you - * can then use to make further IMS calls to this object's methods. - * - * @deprecated Please use imsConnectWithEndpoint instead. - */ - IMSInterface.prototype.imsConnect = function () { - return window.__adobe_cep__.imsConnect(); - }; - IMSInterface.prototype.imsDisconnect = function (imsRef) { - window.__adobe_cep__.imsDisconnect(imsRef); - }; - IMSInterface.prototype.imsConnectWithEndpoint = function (imsEndpoint) { - return JSON.parse(window.__adobe_cep__.invokeSync("imsConnectWithEndpoint", JSON.stringify({ imsEndpoint: imsEndpoint }))).result; - }; - IMSInterface.prototype.imsFetchAccounts = function (imsRef, clientId) { - return window.__adobe_cep__.imsFetchAccounts(imsRef, clientId); - }; - IMSInterface.prototype.imsFetchUserProfileData = function (imsRef, userAccountGuid) { - var data = { - imsRef: imsRef, - userAccountGuid: userAccountGuid - }; - return window.__adobe_cep__.invokeSync("imsFetchUserProfileData", JSON.stringify(data)); - }; - /** - * Requests an access token from IMS for a given user and service. - * - * This function is asynchronous. To handle the result, register a callback for the event - * "com.adobe.csxs.events.internal.ims.FetchAccessToken" or "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus". - * For event "com.adobe.csxs.events.internal.ims.FetchAccessToken", the event data is a JSON string - * with format {"toua":"...",...,"emailVerified":"false"}. - * For event "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus", the event data is a JSON string - * with format {"status":"0","details":{"toua":"...",...,"emailVerified":"false"}}. - * - * @see addEventListener() - * - * @param imsRef An IMS reference returned from the \c IMSConnect() call. - * @param clientId The IMS client ID for your extension, assigned by the IMS team on registration. - * This is the service-code value in the Renga Service Account Object for your client. - * @param clientSecret The client secret associated with the provided client ID - * @param userAccountGuid The unique person GUID for the Renga account, as returned by the fetchAccounts() method. The token is generated for this user. - * @param serviceAccountGuid (optional, not currently used) A unique identifier for a Service Account Object (SAO). - * @param scope (optional) A comma delimited list of services for which the refresh and access tokens are requested. - * - * By default, this is 'openid,AdobeID'. Scope strings are case sensitive. - * If the cached version of the refresh token does not match the requested service scopes, a new refresh token is fetched. - * To request your service's own SAO, add your service to the list; - * for example, 'openid,AdobeID,browserlab'. - * - * @return A boolean status. Returning true means only the call to imsFetchAccessToken function itself is successful. - * Returning false means that failed to fetch access token. - */ - IMSInterface.prototype.imsFetchAccessToken = function (imsRef, clientId, clientSecret, userAccountGuid, serviceAccountGuid, scope) { - return window.__adobe_cep__.imsFetchAccessToken(imsRef, clientId, clientSecret, userAccountGuid, serviceAccountGuid, scope); - }; - IMSInterface.prototype.imsFetchContinueToken = function (imsRef, bearerToken, targetClientId, redirectUri, scope, responseType, locale) { - var data = { - imsRef: imsRef, - bearerToken: bearerToken, - targetClientId: targetClientId, - redirectUri: redirectUri, - scope: scope, - responseType: responseType, - locale: locale - }; - return JSON.parse(window.__adobe_cep__.invokeSync("imsFetchContinueToken", JSON.stringify(data))).result; - }; - IMSInterface.prototype.imsRevokeDeviceToken = function (imsRef, clientId, clientSecret, userAccountGuid, serviceAccountGuid) { - return window.__adobe_cep__.imsFetchAccessToken(imsRef, clientId, clientSecret, userAccountGuid, serviceAccountGuid, "REVOKE"); - }; - IMSInterface.prototype.imsSetProxyCredentials = function (proxyUsername, proxyPassword) { - window.__adobe_cep__.imsSetProxyCredentials(proxyUsername, proxyPassword); - }; - IMSInterface.prototype.showAAM = function (clientId, clientSecret, redirectUri, userAccountGuid, serviceAccountGuid, scope) { - return window.__adobe_cep__.showAAM(clientId, clientSecret, redirectUri, userAccountGuid, serviceAccountGuid, scope); - }; - IMSInterface.prototype.imsGetCurrentUserId = function () { - return window.__adobe_cep__.getCurrentImsUserId(); - }; - IMSInterface.prototype.imsGetCurrentUserIdHelper = function (callback) { - var hostEnvironment = JSON.parse(window.__adobe_cep__.getHostEnvironment()); - var appName = hostEnvironment.appName; - if ("ILST" === appName) { - window.__adobe_cep__.evalScript("app.userGUID", function (result) { - callback(result); - }); - } - else if ("IDSN" === appName) { - window.__adobe_cep__.evalScript("app.userGuid", function (result) { - callback(result); - }); - } - else if ("PHSP" === appName || "PHXS" === appName) { - window.__adobe_cep__.evalScript("var getUserIdPhotoshop = function() {var userId = '';try {var bhnc = app.charIDToTypeID('bhnc');var ref = new ActionReference();ref.putProperty(app.charIDToTypeID('Prpr'), bhnc);ref.putEnumerated(app.charIDToTypeID('capp'), app.charIDToTypeID('Ordn'), app.charIDToTypeID('Trgt'));var appDesc = app.executeActionGet(ref);if (appDesc.hasKey(bhnc)) {userId = appDesc.getString(bhnc);}} catch (e) {}return userId;};", function (result) { - window.__adobe_cep__.evalScript("getUserIdPhotoshop()", function (result) { - callback(result); - }); - }); - } - else { - var clientId = window.__adobe_cep__.getCurrentImsUserId(); - callback(clientId); - } - }; - IMSInterface.prototype.imsLogoutUser = function (imsRef, userAccountGuid, clientId) { - var data = { - imsRef: imsRef, - userAccountGuid: userAccountGuid, - clientId: clientId - }; - return JSON.parse(window.__adobe_cep__.invokeSync("imsLogoutUser", JSON.stringify(data))).result; - }; - IMSInterface.prototype.imsAttemptSSOJumpWorkflows = function (openBrowser, url, imsRef, clientId, clientSecret, scope, userAccountGuid, targetClientId, targetScope, targetResponseType, targetLocale) { - var data = { - openBrowser: openBrowser, - url: url, - imsRef: imsRef, - clientId: clientId, - clientSecret: clientSecret, - scope: scope, - userAccountGuid: userAccountGuid, - targetClientId: targetClientId, - targetScope: targetScope, - targetResponseType: targetResponseType, - targetLocale: targetLocale - }; - return JSON.parse(window.__adobe_cep__.invokeSync("imsAttemptSSOJumpWorkflows", JSON.stringify(data))).result; - }; - return IMSInterface; -}()); -exports.IMSInterface = IMSInterface; -(function (IMSInterface) { - var Events; - (function (Events) { - Events["imsFetchAccessTokenWithStatus"] = "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus"; - Events["imsFetchAccessToken"] = "com.adobe.csxs.events.internal.ims.FetchAccessToken"; - Events["imsRevokeAccessToken"] = "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus"; - Events["imsFetchContinueToken"] = "com.adobe.csxs.events.internal.ims.FetchAccessTokenWithStatus"; - Events["imsAAMIMSStatus"] = "vulcan.SuiteMessage.com.adobe.aam.AAMIMSStatus"; - Events["imsLogoutUser"] = "com.adobe.csxs.events.internal.ims.LogoutUser"; - Events["imsSSOStatus"] = "com.adobe.csxs.events.internal.ims.SSOStatus"; - })(Events = IMSInterface.Events || (IMSInterface.Events = {})); - var Status; - (function (Status) { - Status["IMS_SUCCESS"] = "0"; - Status["IMS_ERROR_FAILURE"] = "1"; - Status["IMS_ERROR_INVALID_ARGUMENTS"] = "2"; - Status["IMS_ERROR_CANCEL"] = "20"; - Status["IMS_ERROR_TIMEOUT"] = "21"; - Status["IMS_ERROR_HTTPFAILURE"] = "22"; - Status["IMS_ERROR_SSLFAILURE"] = "23"; - Status["IMS_ERROR_AUTH_PROXY_REQUIRED"] = "24"; - Status["IMS_ERROR_AUTH_PROXY_FAILED"] = "25"; - Status["IMS_ERROR_IN_ACCESS_IDP"] = "26"; - Status["IMS_ERROR_ANOTHER_REQUEST_IN_PROCESS"] = "40"; - Status["IMS_ERROR_IN_READ_USER_DATA"] = "60"; - Status["IMS_ERROR_IN_SAVE_USER_DATA"] = "61"; - Status["IMS_ERROR_IN_REMOVE_USER_DATA"] = "62"; - Status["IMS_ERROR_USER_DATA_NOT_PRESENT"] = "63"; - Status["IMS_ERROR_IN_READ_DEVICE_TOKEN"] = "64"; - Status["IMS_ERROR_IN_SAVE_DEVICE_TOKEN"] = "65"; - Status["IMS_ERROR_IN_REMOVE_DEVICE_TOKEN"] = "66"; - Status["IMS_ERROR_DEVICE_TOKEN_NOT_PRESENT"] = "67"; - Status["IMS_ERROR_INVALID_DEVICE_TOKEN"] = "68"; - Status["IMS_ERROR_CLIENTID_NOT_PRESENT"] = "69"; - Status["IMS_ERROR_IN_FETCH_USER_ACCOUNTS"] = "70"; - Status["IMS_ERROR_IN_SAVE_USER_FOR_CLIENTID"] = "71"; - Status["IMS_ERROR_DEVICE_ID_NOT_PRESENT"] = "72"; - Status["IMS_ERROR_DEFAULT_USER_FOR_CLIENTID_NOT_PRESENT"] = "73"; - Status["IMS_ERROR_NO_USER_RECORDS_PRESENT"] = "74"; - Status["IMS_ERROR_ACCESS_DENIED"] = "80"; - Status["IMS_ERROR_INVALID_REQUEST"] = "81"; - Status["IMS_ERROR_INVALID_CLIENT"] = "82"; - Status["IMS_ERROR_INVALID_GRANT"] = "83"; - Status["IMS_ERROR_UNAUTHORIZED_CLIENT"] = "84"; - Status["IMS_ERROR_UNSUPPORTED_RESPONSE_TYPE"] = "85"; - Status["IMS_ERROR_INVALID_SCOPE"] = "86"; - Status["IMS_ERROR_UNSUPPORTED_GRANT_TYPE"] = "87"; - Status["IMS_ERROR_BAD_REQUEST"] = "88"; - Status["IMS_ERROR_INVALID_CREDENTIALS"] = "89"; - Status["IMS_ERROR_IN_GET_AUTH_DATA_FROM_IDP"] = "100"; - Status["IMS_ERROR_IN_GET_DEVICE_TOKEN_FROM_IDP"] = "101"; - Status["IMS_ERROR_IN_GET_REFRESH_TOKEN_FROM_IDP"] = "102"; - Status["IMS_ERROR_IN_GET_ACCESS_TOKEN_FROM_IDP"] = "103"; - Status["IMS_ERROR_IN_GET_PROFILE_DATA_FROM_IDP"] = "104"; - Status["IMS_ERROR_TOU_CHANGED"] = "120"; - Status["IMS_ERROR_IN_REVOKE_DEVICE_TOKEN"] = "121"; - Status["IMS_ERROR_TOU_NOT_CURRENT"] = "122"; - Status["IMS_ERROR_EVS_INVALID"] = "123"; - Status["IMS_ERROR_ACCT_ACT_REQ"] = "124"; - Status["IMS_ERROR_ACCT_DISABLED"] = "125"; - Status["IMS_ERROR_SUBS_ACT_REQ"] = "126"; - Status["IMS_ERROR_SUBS_NO_SUB"] = "127"; - Status["IMS_ERROR_NO_BUDDY_GROUP_FOR_CLIENT"] = "150"; - Status["IMS_ERROR_CLIENT_REGISTERED_FOR_OTHER_GROUP"] = "151"; - Status["IMS_ERROR_GROUP_ENTRY_NOT_PRESENT"] = "152"; - Status["IMS_ERROR_IN_SAVE_GROUP_DATA"] = "153"; - Status["IMS_ERROR_CNAME_ENTRY_NOT_PRESENT"] = "154"; - Status["IMS_ERROR_IN_SAVE_BACKOFF_DATA"] = "155"; - Status["IMSMANAGER_ERROR_EXCEPTION"] = "3000"; - Status["IMSMANAGER_ERROR_ENCODING"] = "3001"; - Status["IMSMANAGER_SUCCESS_BROWSER_OPENED"] = "3002"; - Status["IMSMANAGER_ERROR_BROWSER_FAILED_TO_OPEN"] = "3003"; - Status["IMS_UNKNOWN_ERROR"] = "0xFFFF"; - })(Status = IMSInterface.Status || (IMSInterface.Status = {})); -})(IMSInterface || (IMSInterface = {})); -exports.IMSInterface = IMSInterface; -exports.default = IMSInterface; diff --git a/lib/index.d.ts b/lib/index.d.ts deleted file mode 100644 index c71bd74..0000000 --- a/lib/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export declare type HostId = "PHSP" | "PHXS" | "IDSN" | "AICY" | "ILST" | "PPRO" | "PRLD" | "AEFT" | "FLPR" | "AUDT" | "DRWV" | "MUSE" | "KBRG" | "RUSH"; -declare type HostNameMap = { - [K in HostId]: string; -}; -export declare const HostApplication: Partial; -export * from './v9'; -export { CSInterface as CSInterfacePromise } from "./utils"; -export { default } from './v9'; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 701dbc9..0000000 --- a/lib/index.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HostApplication = { - PHSP: "Photohsop", - PHXS: "Photoshop", - IDSN: "InDesign", - AICY: "InCopy", - ILST: "Illustrator", - PPRO: "Premiere Pro", - PRLD: "Prelude", - AEFT: "After Effects", - FLPR: "Animate (Flash Pro)", - AUDT: "Audition", - DRWV: "Dreamweaver", - MUSE: "Muse", - KBRG: "Bridge", - RUSH: "Rush" -}; -__export(require("./v9")); -var utils_1 = require("./utils"); -exports.CSInterfacePromise = utils_1.CSInterface; -var v9_1 = require("./v9"); -exports.default = v9_1.default; diff --git a/lib/utils.d.ts b/lib/utils.d.ts deleted file mode 100644 index 7b4f264..0000000 --- a/lib/utils.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import CSInterfaceBase from "./index"; -declare class CSInterface extends CSInterfaceBase { - /** - * @param {string} script - * @param {...*} args - * - * @return {Promise<*>} - */ - evalScript(script: string, ...args: unknown[]): Promise; -} -export { CSInterface }; -export default CSInterface; diff --git a/lib/utils.js b/lib/utils.js deleted file mode 100644 index 9d18770..0000000 --- a/lib/utils.js +++ /dev/null @@ -1,114 +0,0 @@ -"use strict"; -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -Object.defineProperty(exports, "__esModule", { value: true }); -var index_1 = require("./index"); -/* - * This is needed if the return type of the original method is other than `void` and we want to change it. - * @link https://github.com/Microsoft/TypeScript/issues/4544 - * type CSInterfaceWithoutEval = new() => { [P in Exclude] : CSInterfaceBase[P] } - * const CSInterfaceWithoutEval: CSInterfaceWithoutEval = CSInterfaceBase; - * class CSInterface extends CSInterfaceWithoutEval {} - */ -var CSInterface = /** @class */ (function (_super) { - __extends(CSInterface, _super); - function CSInterface() { - return _super !== null && _super.apply(this, arguments) || this; - } - CSInterface.prototype.evalScript = function (script, callback) { - var _this = this; - /** - * @param {*} value - */ - function escape(value) { - switch (typeof value) { - case 'undefined': - return '"null"'; - case 'string': - return JSON.stringify(value); - case 'number': { - if (Number.isNaN(value) || Infinity === value) { - return 0; - } - return value; - } - case 'object': { - if (value === null) { - return '"null"'; - } - return escape(JSON.stringify(value)); - } - case 'boolean': { - return value; - } - default: - throw TypeError("Nicht unterst\u00FCtzter Typ \"" + typeof value + "\""); - } - } - var args = Array.from(arguments); - // Hole den Befehl oder den Funktionsnamen - var eval_string = args.shift().trim(); - // Der Nutzer hat mehr als 1 Parameter angegeben, - // a) Entweder eine callback, wenn du Funktion wie die original Function von CSInterface verwendet wird - // b) Andere Typen wenn die Funktion automatisch die Parameter einer Funktion escapen soll - var user_callback = null; - if (args.length > 0) { - if (typeof args[0] === 'function') { - // a) - user_callback = args.shift(); - } - else { - // b) - // Prüfe ob der Nutzer vielleicht bereits die runden Klammern "()" angegeben hat und entferne die - if (eval_string.length >= 3 && eval_string.substr(-3) === '();') { - eval_string = eval_string.substr(0, eval_string.length - 3); - } - else if (eval_string.length >= 2 && eval_string.substr(-2) === '()') { - eval_string = eval_string.substr(0, eval_string.length - 2); - } - eval_string += "(" + args.map(function (param) { return escape(param); }).join(', ') + ");"; - } - } - return new Promise(function (resolve, reject) { - // Ermöglicht es eine genauere Fehlermeldung zu erhalten ("e" besitzt noch folgende Eigenschaften: start, end, source, fileName, number) - // Von der Fehlerzeile müssen wir 1 abziehen, da der Try/Catch-Block mitgezählt wird - var script = "try {\n " + eval_string + "\n } catch(e) {\n '{\"error\": \"' + e.name + '\", \"message\": \"' + e.message.replace(/\"/g, \"'\") + '\", \"line\": \"' + (e.line ? e.line - 1: -1) + '\", \"stack\": \"' + (e.stack ? e.stack.replace(/\"/g, \"'\") : \"\") + '\"}'\n }"; - _super.prototype.evalScript.call(_this, script, function (result) { - // Wenn der Nutzer eine eigene Callback angegeben hat (evalScript legacy support) - if (user_callback) { - return resolve(user_callback(result) || result); - } - if (typeof result === 'string' && result === index_1.default.EvalScript_ErrMessage) { - return reject(result); - } - if (typeof result === 'string' && result.length > 0) { - try { - var obj = JSON.parse(result); - if (typeof obj.error === 'string') { - return reject(obj); - } - return resolve(JSON.parse(result)); - } - catch (e) { - // Ignoriere Parse Error und gebe den String zurück - } - } - return resolve(result); - }); - }); - }; - return CSInterface; -}(index_1.default)); -exports.CSInterface = CSInterface; -exports.default = CSInterface; diff --git a/lib/v10.d.ts b/lib/v10.d.ts deleted file mode 100644 index a6e1431..0000000 --- a/lib/v10.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/************************************************************************************************** - * - * ADOBE SYSTEMS INCORPORATED - * Copyright 2020 Adobe Systems Incorporated - * All Rights Reserved. - * - * NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the - * terms of the Adobe license agreement accompanying it. If you have received this file from a - * source other than Adobe, then your use, modification, or distribution of it requires the prior - * written permission of Adobe. - * - **************************************************************************************************/ -import CSInterfaceV9 from "./v9"; -/** - * CSInterface - v10.0.0 - */ -declare class CSInterface extends CSInterfaceV9 { -} -export * from './v9'; -export default CSInterface; diff --git a/lib/v10.js b/lib/v10.js deleted file mode 100644 index 0690d25..0000000 --- a/lib/v10.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; -/************************************************************************************************** - * - * ADOBE SYSTEMS INCORPORATED - * Copyright 2020 Adobe Systems Incorporated - * All Rights Reserved. - * - * NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the - * terms of the Adobe license agreement accompanying it. If you have received this file from a - * source other than Adobe, then your use, modification, or distribution of it requires the prior - * written permission of Adobe. - * - **************************************************************************************************/ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var v9_1 = require("./v9"); -/** - * CSInterface - v10.0.0 - */ -var CSInterface = /** @class */ (function (_super) { - __extends(CSInterface, _super); - function CSInterface() { - return _super !== null && _super.apply(this, arguments) || this; - } - return CSInterface; -}(v9_1.default)); -__exportStar(require("./v9"), exports); -exports.default = CSInterface; diff --git a/lib/v11.d.ts b/lib/v11.d.ts deleted file mode 100644 index 1c3ba8a..0000000 --- a/lib/v11.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/************************************************************************************************** - * - * ADOBE SYSTEMS INCORPORATED - * Copyright 2020 Adobe Systems Incorporated - * All Rights Reserved. - * - * NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the - * terms of the Adobe license agreement accompanying it. If you have received this file from a - * source other than Adobe, then your use, modification, or distribution of it requires the prior - * written permission of Adobe. - * - **************************************************************************************************/ -import CSInterfaceV10 from "./v10"; -/** - * CSInterface - v10.0.0 - */ -declare class CSInterface extends CSInterfaceV10 { -} -export * from './v10'; -export default CSInterface; diff --git a/lib/v11.js b/lib/v11.js deleted file mode 100644 index 04f8b66..0000000 --- a/lib/v11.js +++ /dev/null @@ -1,56 +0,0 @@ -"use strict"; -/************************************************************************************************** - * - * ADOBE SYSTEMS INCORPORATED - * Copyright 2020 Adobe Systems Incorporated - * All Rights Reserved. - * - * NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the - * terms of the Adobe license agreement accompanying it. If you have received this file from a - * source other than Adobe, then your use, modification, or distribution of it requires the prior - * written permission of Adobe. - * - **************************************************************************************************/ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - if (typeof b !== "function" && b !== null) - throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var v10_1 = require("./v10"); -/** - * CSInterface - v10.0.0 - */ -var CSInterface = /** @class */ (function (_super) { - __extends(CSInterface, _super); - function CSInterface() { - return _super !== null && _super.apply(this, arguments) || this; - } - return CSInterface; -}(v10_1.default)); -__exportStar(require("./v10"), exports); -exports.default = CSInterface; diff --git a/lib/v8.d.ts b/lib/v8.d.ts deleted file mode 100644 index 2a00e00..0000000 --- a/lib/v8.d.ts +++ /dev/null @@ -1,920 +0,0 @@ -/** - * Stores constants for the window types supported by the CSXS infrastructure. - */ -declare enum CSXSWindowType { - _PANEL = "Panel", - _MODELESS = "Modeless", - _MODAL_DIALOG = "ModalDialog" -} -/** - * Defines a version number with major, minor, micro, and special - * components. The major, minor and micro values are numeric; the special - * value can be any string. - */ -declare class Version { - major: number; - minor: number; - micro: number; - special: string; - /** - * The maximum value allowed for a numeric version component. - * This reflects the maximum value allowed in PlugPlug and the manifest schema. - */ - static readonly MAX_NUM: number; - /** - * @param major The major version component, a positive integer up to nine digits long. - * @param minor The minor version component, a positive integer up to nine digits long. - * @param micro The micro version component, a positive integer up to nine digits long. - * @param special The special version component, an arbitrary string. - * - * @return A new Version object. - */ - constructor(major: number, minor: number, micro: number, special: string); -} -/** - * Defines a boundary for a version range, which associates a Version object - * with a flag for whether it is an inclusive or exclusive boundary. - */ -declare class VersionBound { - version: Version; - inclusive: boolean; - /** - * @param version The Version object. - * @param inclusive True if this boundary is inclusive, false if it is exclusive. - * - * @return A new VersionBound object. - */ - constructor(version: Version, inclusive: boolean); -} -/** - * Defines a range of versions using a lower boundary and optional upper boundary. - */ -declare class VersionRange { - lowerBound: VersionBound; - upperBound?: VersionBound | undefined; - /** - * @param lowerBound The VersionBound object. - * @param upperBound The VersionBound object, or null for a range with no upper boundary. - * - * @return A new VersionRange object. - */ - constructor(lowerBound: VersionBound, upperBound?: VersionBound | undefined); -} -/** - * Represents a runtime related to the CEP infrastructure. - * Extensions can declare dependencies on particular - * CEP runtime versions in the extension manifest. - */ -declare class Runtime { - name: string; - versionRange: VersionRange; - /** - * @FIXME: Documentation tell us "version" but the Javascript say "versionRange" - */ - version: VersionRange; - /** - * @param name The runtime name. - * @param version A VersionRange object that defines a range of valid versions. - * - * @return A new Runtime object. - */ - constructor(name: string, versionRange: VersionRange); -} -/** - * @FIXME: ExtensionManifest_v_7_0.xsd#205 - */ -interface ExtensionDispatchInfo { -} -/** - * @FIXME: interface? - * Encapsulates a CEP-based extension to an Adobe application. - */ -declare class Extension { - id: any; - name: string; - mainPath: string; - basePath: string; - windowType: CSXSWindowType; - width: number; - height: number; - minWidth: number; - minHeight: number; - maxWidth: number; - maxHeight: number; - defaultExtensionDataXml: ExtensionDispatchInfo; - specialExtensionDataXml: ExtensionDispatchInfo; - requiredRuntimeList: Runtime[]; - isAutoVisible: boolean; - isPluginExtension: boolean; - /** - * @param id The unique identifier of this extension. - * @param name The localizable display name of this extension. - * @param mainPath The path of the "index.html" file. - * @param basePath The base path of this extension. - * @param windowType The window type of the main window of this extension. - * Valid values are defined by CSXSWindowType. - * @param width The default width in pixels of the main window of this extension. - * @param height The default height in pixels of the main window of this extension. - * @param minWidth The minimum width in pixels of the main window of this extension. - * @param minHeight The minimum height in pixels of the main window of this extension. - * @param maxWidth The maximum width in pixels of the main window of this extension. - * @param maxHeight The maximum height in pixels of the main window of this extension. - * @param defaultExtensionDataXml The extension data contained in the default ExtensionDispatchInfo section of the extension manifest. - * @param specialExtensionDataXml The extension data contained in the application-specific ExtensionDispatchInfo section of the extension manifest. - * @param requiredRuntimeList An array of Runtime objects for runtimes required by this extension. - * @param isAutoVisible True if this extension is visible on loading. - * @param isPluginExtension True if this extension has been deployed in the Plugins folder of the host application. - */ - constructor(id: any, name: string, mainPath: string, basePath: string, windowType: CSXSWindowType, width: number, height: number, minWidth: number, minHeight: number, maxWidth: number, maxHeight: number, defaultExtensionDataXml: ExtensionDispatchInfo, specialExtensionDataXml: ExtensionDispatchInfo, requiredRuntimeList: Runtime[], isAutoVisible: boolean, isPluginExtension: boolean); -} -/** - * A standard JavaScript event, the base class for CEP events. - */ -declare class CSEvent { - type: string; - scope: CSInterface.EventScope; - appId: string; - extensionId: string; - /** - * Event-specific data. - */ - data?: any; - /** - * @param type The name of the event type. - * @param scope The scope of event, can be "GLOBAL" or "APPLICATION". - * @param appId The unique identifier of the application that generated the event. - * @param extensionId The unique identifier of the extension that generated the event. - */ - constructor(type: string, scope: CSInterface.EventScope, appId: string, extensionId: string); -} -/** - * Stores color-type constants. - */ -declare enum ColorType { - /** - * RGB color type. - */ - RGB = "rbg", - /** - * Gradient color type. - */ - GRADIENT = "gradient", - /** - * Null color type. - */ - NONE = "none" -} -/** - * @FIXME: range [0.0 to 255.0] any idea? - */ -declare type RGBNumber = number; -/** - * Stores an RGB color with red, green, blue, and alpha values. - * All values are in the range [0.0 to 255.0]. Invalid numeric values are - * converted to numbers within this range. - */ -declare class RGBColor { - red: RGBNumber; - green: RGBNumber; - blue: RGBNumber; - alpha: RGBNumber; - /** - * @param red The red value, in the range [0.0 to 255.0]. - * @param green The green value, in the range [0.0 to 255.0]. - * @param blue The blue value, in the range [0.0 to 255.0]. - * @param alpha The alpha (transparency) value, in the range [0.0 to 255.0]. - * The default, 255.0, means that the color is fully opaque. - * - * @return A new RGBColor object. - */ - constructor(red: RGBNumber, green: RGBNumber, blue: RGBNumber, alpha?: RGBNumber); -} -/** - * A point value in which the y component is 0 and the x component - * is positive or negative for a right or left direction, - * or the x component is 0 and the y component is positive or negative for - * an up or down direction. - */ -declare class Direction { - x: number; - y: number; - /** - * @param x The horizontal component of the point. - * @param y The vertical component of the point. - * - * @return A new Direction object. - */ - constructor(x: number, y: number); -} -/** - * @FIXME: range [0.0 to 1.0] any idea? - */ -declare type GradientOffset = number; -/** - * Stores gradient stop information. - */ -declare class GradientStop { - offset: GradientOffset; - rgbColor: RGBColor; - /** - * @param offset The offset of the gradient stop, in the range [0.0 to 1.0]. - * @param rgbColor The color of the gradient at this point, an RGBColor object. - * - * @return GradientStop object. - */ - constructor(offset: GradientOffset, rgbColor: RGBColor); -} -/** - * Stores gradient color information. - */ -declare class GradientColor { - type: "linear"; - direction: Direction; - numStops: number; - arrGradientStop: GradientStop; - /** - * @FIXME: Documentation tell us "gradientStopList" but the Javascript say "arrGradientStop" - */ - gradientStopList: GradientStop; - /** - * @param type The gradient type, must be "linear". - * @param direction A Direction object for the direction of the gradient (up, down, right, or left). - * @param numStops The number of stops in the gradient. - * @param gradientStopList An array of GradientStop objects. - * - * @return A new GradientColor object. - */ - constructor(type: "linear", direction: Direction, numStops: number, arrGradientStop: GradientStop); -} -/** - * Stores color information, including the type, anti-alias level, and specific color - * values in a color object of an appropriate type. - * - * @FIXME: use Conditional Type for the constructor - */ -declare class UIColor { - type: 1 | 2; - antialiasLevel: any; - color: RGBColor | GradientColor; - /** - * @param type The color type, 1 for "rgb" and 2 for "gradient". The supplied color object must correspond to this type. - * @param antialiasLevel The anti-alias level constant. - * @param color A RGBColor or GradientColor object containing specific color information. - * - * @return A new UIColor object. - */ - constructor(type: 1 | 2, antialiasLevel: any, color: RGBColor | GradientColor); -} -/** - * Stores window-skin properties, such as color and font. All color parameter values are UIColor objects except that systemHighlightColor is RGBColor object. - */ -interface AppSkinInfo { - /** - * The base font family of the application. - */ - readonly baseFontFamily: string; - /** - * The base font size of the application. - */ - readonly baseFontSize: string; - /** - * The application bar background color. - */ - readonly appBarBackgroundColor: UIColor; - /** - * The background color of the extension panel. - */ - readonly panelBackgroundColor: UIColor; - /** - * The application bar background color, as sRGB. - */ - readonly appBarBackgroundColorSRGB: UIColor; - /** - * The background color of the extension panel, as sRGB. - */ - readonly panelBackgroundColorSRGB: UIColor; - /** - * The highlight color of the extension panel, if provided by the host application. Otherwise, the operating-system highlight color. - */ - readonly systemHighlightColor: UIColor; -} -/** - * Stores information about the environment in which the extension is loaded. - */ -interface HostEnvironment { - /** - * The application's name. - */ - readonly appName: string; - /** - * The application's version. - */ - readonly appVersion: string; - /** - * The application's current license locale. - */ - readonly appLocale: string; - /** - * The application's current UI locale. - */ - readonly appUILocale: string; - /** - * The application's unique identifier. - */ - readonly appId: string; - /** - * True if the application is currently online. - */ - readonly isAppOnline: boolean; - /** - * An AppSkinInfo object containing the application's default color and font styles. - */ - readonly appSkinInfo: AppSkinInfo; -} -/** - * Stores information about the host capabilities. - */ -interface HostCapabilities { - /** - * EXTENDED_PANEL_MENU True if the application supports panel menu. - */ - readonly EXTENDED_PANEL_MENU: boolean; - /** - * EXTENDED_PANEL_ICONS True if the application supports panel icon. - */ - readonly EXTENDED_PANEL_ICONS: boolean; - /** - * DELEGATE_APE_ENGINE True if the application supports delegated APE engine. - */ - readonly DELEGATE_APE_ENGINE: boolean; - /** - * SUPPORT_HTML_EXTENSIONS True if the application supports HTML extensions. - */ - readonly SUPPORT_HTML_EXTENSIONS: boolean; - /** - * DISABLE_FLASH_EXTENSIONS True if the application disables FLASH extensions. - */ - readonly DISABLE_FLASH_EXTENSIONS: boolean; -} -/** - * Stores current api version. - * - * @since 4.2.0 - */ -interface ApiVersion { - /** - * The major version - */ - readonly major: number; - /** - * The minor version - */ - readonly minor: number; - /** - * The micro version - */ - readonly micro: number; -} -/** - * Stores flyout menu item status - * - * @since 5.2.0 - */ -declare class MenuItemStatus { - menuItemLabel: string; - enabled: boolean; - checked: boolean; - /** - * @param menuItemLabel The menu item label. - * @param enabled True if user wants to enable the menu item. - * @param checked True if user wants to check the menu item. - * - * @return MenuItemStatus object. - */ - constructor(menuItemLabel: string, enabled: boolean, checked: boolean); -} -/** - * Stores the status of the context menu item. - * - * @since 5.2.0 - */ -declare class ContextMenuItemStatus { - menuItemID: string; - enabled: boolean; - checked: boolean; - /** - * @param menuItemID The menu item id. - * @param enabled True if user wants to enable the menu item. - * @param checked True if user wants to check the menu item. - * - * @return MenuItemStatus object. - */ - constructor(menuItemID: string, enabled: boolean, checked: boolean); -} -/** - * This is the entry point to the CEP extensibility infrastructure. - * Instantiate this object and use it to: - *
    - *
  • Access information about the host application in which an extension is running
  • - *
  • Launch an extension
  • - *
  • Register interest in event notifications, and dispatch events
  • - *
- * - */ -export declare class CSInterface { - /** - * The host environment data object. - */ - hostEnvironment: HostEnvironment; - /** - * Retrieves information about the host environment in which the extension is currently running. - * - * @return {HostEnvironment} A HostEnvironment object. - */ - getHostEnvironment(): HostEnvironment; - /** - * Closes this extension. - */ - closeExtension(): void; - /** - * Retrieves a path for which a constant is defined in the system. - * - * @param pathType The path-type constant defined in SystemPath , - * - * @return {string} The platform-specific system path string. - */ - getSystemPath(pathType: CSInterface.SystemPath): string; - /** - * Evaluates a JavaScript script, which can use the JavaScript DOM - * of the host application. - * - * @param script The JavaScript script. - * @param callback Optional. A callback function that receives the result of execution. - * If execution fails, the callback function receives the error message EvalScript_ErrMessage. - */ - evalScript(script: string, callback?: (result?: any) => void | null): void; - /** - * Retrieves the unique identifier of the application. - * in which the extension is currently running. - * - * @return {string} The unique ID string. - */ - getApplicationID(): string; - /** - * Retrieves host capability information for the application - * in which the extension is currently running. - * - * @return {HostCapabilities} A HostCapabilities object. - */ - getHostCapabilities(): HostCapabilities; - /** - * Triggers a CEP event programmatically. Yoy can use it to dispatch - * an event of a predefined type, or of a type you have defined. - * - * @param event A CSEvent object. - */ - dispatchEvent(event: T): void; - /** - * Registers an interest in a CEP event of a particular type, and - * assigns an event handler. - * The event infrastructure notifies your extension when events of this type occur, - * passing the event object to the registered handler function. - * - * @param type The name of the event type of interest. - * @param listener The JavaScript handler function or method. - * @param obj Optional, the object containing the handler method, if any. Default is null. - */ - addEventListener(type: string, listener: (evt: T) => void, obj?: object): void; - /** - * Removes a registered event listener. - * - * @param type The name of the event type of interest. - * @param listener The JavaScript handler function or method that was registered. - * @param obj Optional, the object containing the handler method, if any. - * Default is null. - */ - removeEventListener(type: string, listener: any, obj?: object): void; - /** - * Loads and launches another extension, or activates the extension if it is already loaded. - * - * @param extensionId The extension's unique identifier. - * @param startupParams Not currently used, pass "". - * - * @example - * To launch the extension "help" with ID "HLP" from this extension, call: - * requestOpenExtension("HLP", ""); - * - */ - requestOpenExtension(extensionId: string, startupParams?: string): void; - /** - * @TODO: "zero" or more Extension objects. - * - * Retrieves the list of extensions currently loaded in the current host application. - * The extension list is initialized once, and remains the same during the lifetime - * of the CEP session. - * - * @param extensionIds Optional, an array of unique identifiers for extensions of interest. - * If omitted, retrieves data for all extensions. - * - * @return {Extension[]} Zero or more Extension objects. - */ - getExtensions(extensionIds?: string[]): Extension[]; - /** - * @TODO: create network interface - * - * Retrieves network-related preferences. - * - * @return {Object} A JavaScript object containing network preferences. - */ - getNetworkPreferences(): object; - /** - * Initializes the resource bundle for this extension with property values - * for the current application and locale. - * To support multiple locales, you must define a property file for each locale, - * containing keyed display-string values for that locale. - * See localization documentation for Extension Builder and related products. - * - * Keys can be in the - * form key.value="localized string", for use in HTML text elements. - * For example, in this input element, the localized \c key.value string is displayed - * instead of the empty \c value string: - * - * - * - * @return {Object} An object containing the resource bundle information. - */ - initResourceBundle(): object; - /** - * Writes installation information to a file. - * - * @return {string} The file path. - */ - dumpInstallationInfo(): string; - /** - * Retrieves version information for the current Operating System, - * See http://www.useragentstring.com/pages/Chrome/ for Chrome navigator.userAgent values. - * - * @return {string} A string containing the OS version, or "unknown Operation System". - * If user customizes the User Agent by setting CEF command parameter "--user-agent", only - * "Mac OS X" or "Windows" will be returned. - */ - getOSInformation(): string; - /** - * Opens a page in the default system browser. - * - * @since 4.2.0 - * - * @param url The URL of the page/file to open, or the email address. - * Must use HTTP/HTTPS/file/mailto protocol. For example: - * "http://www.adobe.com" - * "https://github.com" - * "file:///C:/log.txt" - * "mailto:test@adobe.com" - * - * @return {number} One of these error codes:\n - *
    - *
  • NO_ERROR - 0
  • - *
  • ERR_UNKNOWN - 1
  • - *
  • ERR_INVALID_PARAMS - 2
  • - *
  • ERR_INVALID_URL - 201
  • - *
\n - */ - openURLInDefaultBrowser(url: string): number; - /** - * Retrieves extension ID. - * - * @since 4.2.0 - * - * @return {string} extension ID. - */ - getExtensionID(): string; - /** - * Retrieves the scale factor of screen. - * On Windows platform, the value of scale factor might be different from operating system's scale factor, - * since host application may use its self-defined scale factor. - * - * @since 4.2.0 - * - * @return {number} One of the following float number. - *
    - *
  • -1.0 when error occurs
  • - *
  • 1.0 means normal screen
  • - *
  • >1.0 means HiDPI screen
  • - *
- */ - getScaleFactor(): number; - /** - * Set a handler to detect any changes of scale factor. This only works on Mac. - * - * @since 4.2.0 - * - * @param handler The function to be called when scale factor is changed. - */ - setScaleFactorChangedHandler(handler: () => void): void; - /** - * Retrieves current API version. - * - * @since 4.2.0 - * - * @return ApiVersion object. - */ - getCurrentApiVersion(): ApiVersion; - /** - * Set panel flyout menu by an XML. - * - * @since 5.2.0 - * - * Register a callback function for "com.adobe.csxs.events.flyoutMenuClicked" to get notified when a - * menu item is clicked. - * The "data" attribute of event is an object which contains "menuId" and "menuName" attributes. - * - * Register callback functions for "com.adobe.csxs.events.flyoutMenuOpened" and "com.adobe.csxs.events.flyoutMenuClosed" - * respectively to get notified when flyout menu is opened or closed. - * - * @param menu A XML string which describes menu structure. - * An example menu XML: - * - * - * - * - * - * - * - * - * - * - * - */ - setPanelFlyoutMenu(menu: string): void; - /** - * Updates a menu item in the extension window's flyout menu, by setting the enabled - * and selection status. - * - * @since 5.2.0 - * - * @param menuItemLabel The menu item label. - * @param enabled True to enable the item, false to disable it (gray it out). - * @param checked True to select the item, false to deselect it. - * - * @return {boolean} false when the host application does not support this functionality (HostCapabilities.EXTENDED_PANEL_MENU is false). - * Fails silently if menu label is invalid. - * - * @see HostCapabilities.EXTENDED_PANEL_MENU - */ - updatePanelMenuItem(menuItemLabel: string, enabled: boolean, checked: boolean): boolean; - /** - * Set context menu by XML string. - * - * @since 5.2.0 - * - * There are a number of conventions used to communicate what type of menu item to create and how it should be handled. - * - an item without menu ID or menu name is disabled and is not shown. - * - if the item name is "---" (three hyphens) then it is treated as a separator. The menu ID in this case will always be NULL. - * - Checkable attribute takes precedence over Checked attribute. - * - a PNG icon. For optimal display results please supply a 16 x 16px icon as larger dimensions will increase the size of the menu item. - * The Chrome extension contextMenus API was taken as a reference. - * https://developer.chrome.com/extensions/contextMenus - * - the items with icons and checkable items cannot coexist on the same menu level. The former take precedences over the latter. - * - * @param menu A XML string which describes menu structure. - * @param callback The callback function which is called when a menu item is clicked. The only parameter is the returned ID of clicked menu item. - * - * @description An example menu XML: - * - * - * - * - * - * - * - * - * - * - * - */ - setContextMenu(menu: string, callback: (menuItemID: string) => void): void; - /** - * Set context menu by JSON string. - * - * @since 6.0.0 - * - * There are a number of conventions used to communicate what type of menu item to create and how it should be handled. - * - an item without menu ID or menu name is disabled and is not shown. - * - if the item label is "---" (three hyphens) then it is treated as a separator. The menu ID in this case will always be NULL. - * - Checkable attribute takes precedence over Checked attribute. - * - a PNG icon. For optimal display results please supply a 16 x 16px icon as larger dimensions will increase the size of the menu item. - The Chrome extension contextMenus API was taken as a reference. - * - the items with icons and checkable items cannot coexist on the same menu level. The former take precedences over the latter. - https://developer.chrome.com/extensions/contextMenus - * - * @param menu A JSON string which describes menu structure. - * @param callback The callback function which is called when a menu item is clicked. The only parameter is the returned ID of clicked menu item. - * - * @description An example menu JSON: - * - * { - * "menu": [ - * { - * "id": "menuItemId1", - * "label": "testExample1", - * "enabled": true, - * "checkable": true, - * "checked": false, - * "icon": "./image/small_16X16.png" - * }, - * { - * "id": "menuItemId2", - * "label": "testExample2", - * "menu": [ - * { - * "id": "menuItemId2-1", - * "label": "testExample2-1", - * "menu": [ - * { - * "id": "menuItemId2-1-1", - * "label": "testExample2-1-1", - * "enabled": false, - * "checkable": true, - * "checked": true - * } - * ] - * }, - * { - * "id": "menuItemId2-2", - * "label": "testExample2-2", - * "enabled": true, - * "checkable": true, - * "checked": true - * } - * ] - * }, - * { - * "label": "---" - * }, - * { - * "id": "menuItemId3", - * "label": "testExample3", - * "enabled": false, - * "checkable": true, - * "checked": false - * } - * ] - * } - * - */ - setContextMenuByJSON(menu: string, callback: (menuItemID: string) => void): void; - /** - * Updates a context menu item by setting the enabled and selection status. - * - * @since 5.2.0 - * - * @param menuItemID The menu item ID. - * @param enabled True to enable the item, false to disable it (gray it out). - * @param checked True to select the item, false to deselect it. - */ - updateContextMenuItem(menuItemID: string, enabled: boolean, checked: boolean): void; - /** - * Get the visibility status of an extension window. - * - * @since 6.0.0 - * - * @return {boolean} true if the extension window is visible; false if the extension window is hidden. - */ - isWindowVisible(): boolean; - /** - * Resize extension's content to the specified dimensions. - * 1. Works with modal and modeless extensions in all Adobe products. - * 2. Extension's manifest min/max size constraints apply and take precedence. - * 3. For panel extensions - * 3.1 This works in all Adobe products except: - * * Premiere Pro - * * Prelude - * * After Effects - * 3.2 When the panel is in certain states (especially when being docked), - * it will not change to the desired dimensions even when the - * specified size satisfies min/max constraints. - * - * @since 6.0.0 - * - * @param width The new width - * @param height The new height - */ - resizeContent(width: number, height: number): void; - /** - * TODO: What is the return typ? - * - * Register the invalid certificate callback for an extension. - * This callback will be triggered when the extension tries to access the web site that contains the invalid certificate on the main frame. - * But if the extension does not call this function and tries to access the web site containing the invalid certificate, a default error page will be shown. - * - * Since 6.1.0 - * - * @param callback the callback function - */ - registerInvalidCertificateCallback(callback: () => void): void; - /** - * Register an interest in some key events to prevent them from being sent to the host application. - * - * This function works with modeless extensions and panel extensions. - * Generally all the key events will be sent to the host application for these two extensions if the current focused element - * is not text input or dropdown, - * If you want to intercept some key events and want them to be handled in the extension, please call this function - * in advance to prevent them being sent to the host application. - * - * @since 6.1.0 - * - * @param keyEventsInterest A JSON string describing those key events you are interested in. A null object or - an empty string will lead to removing the interest - * - * This JSON string should be an array, each object has following keys: - * - * keyCode: [Required] represents an OS system dependent virtual key code identifying - * the unmodified value of the pressed key. - * ctrlKey: [optional] a Boolean that indicates if the control key was pressed (true) or not (false) when the event occurred. - * altKey: [optional] a Boolean that indicates if the alt key was pressed (true) or not (false) when the event occurred. - * shiftKey: [optional] a Boolean that indicates if the shift key was pressed (true) or not (false) when the event occurred. - * metaKey: [optional] (Mac Only) a Boolean that indicates if the Meta key was pressed (true) or not (false) when the event occurred. - * On Macintosh keyboards, this is the command key. To detect Windows key on Windows, please use keyCode instead. - * An example JSON string: - * - * [ - * { - * "keyCode": 48 - * }, - * { - * "keyCode": 123, - * "ctrlKey": true - * }, - * { - * "keyCode": 123, - * "ctrlKey": true, - * "metaKey": true - * } - * ] - * - */ - registerKeyEventsInterest(keyEventsInterest: string): void; - /** - * Set the title of the extension window. - * This function works with modal and modeless extensions in all Adobe products, and panel extensions in Photoshop, InDesign, InCopy, Illustrator, Flash Pro and Dreamweaver. - * - * @since 6.1.0 - * - * @param title The window title. - */ - setWindowTitle(title: string): void; - /** - * Get the title of the extension window. - * This function works with modal and modeless extensions in all Adobe products, and panel extensions in Photoshop, InDesign, InCopy, Illustrator, Flash Pro and Dreamweaver. - * - * @since 6.1.0 - * - * @return {string} The window title. - */ - getWindowTitle(): string; -} -export declare namespace CSInterface { - /** - * Stores operating-system-specific location constants for use in the CSInterface.getSystemPath() method. - */ - enum SystemPath { - /** - * The path to user data. - */ - USER_DATA = "userData", - /** - * The path to common files for Adobe applications. - */ - COMMON_FILES = "commonFiles", - /** - * The path to the user's default document folder. - */ - MY_DOCUMENTS = "myDocuments", - /** - * @deprecated. Use SystemPath.Extension. - */ - APPLICATION = "application", - /** - * The path to current extension. - */ - EXTENSION = "extension", - /** - * The path to hosting application's executable. - */ - HOST_APPLICATION = "hostApplication" - } - /** - * - */ - const EvalScript_ErrMessage: string; - /** - * - */ - type EventScope = "GLOBAL" | "APPLICATION"; - /** - * - */ - const THEME_COLOR_CHANGED_EVENT: string; -} -export { CSXSWindowType, ExtensionDispatchInfo, Extension, RGBColor, UIColor, ColorType, Direction, GradientStop, GradientColor, CSEvent, ContextMenuItemStatus, MenuItemStatus, ApiVersion, HostCapabilities, HostEnvironment, AppSkinInfo }; -export default CSInterface; diff --git a/lib/v8.js b/lib/v8.js deleted file mode 100644 index 980d404..0000000 --- a/lib/v8.js +++ /dev/null @@ -1,989 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * Stores constants for the window types supported by the CSXS infrastructure. - */ -var CSXSWindowType; -(function (CSXSWindowType) { - CSXSWindowType["_PANEL"] = "Panel"; - CSXSWindowType["_MODELESS"] = "Modeless"; - CSXSWindowType["_MODAL_DIALOG"] = "ModalDialog"; -})(CSXSWindowType || (CSXSWindowType = {})); -exports.CSXSWindowType = CSXSWindowType; -/** - * Defines a version number with major, minor, micro, and special - * components. The major, minor and micro values are numeric; the special - * value can be any string. - */ -var Version = /** @class */ (function () { - /** - * @param major The major version component, a positive integer up to nine digits long. - * @param minor The minor version component, a positive integer up to nine digits long. - * @param micro The micro version component, a positive integer up to nine digits long. - * @param special The special version component, an arbitrary string. - * - * @return A new Version object. - */ - function Version(major, minor, micro, special) { - this.major = major; - this.minor = minor; - this.micro = micro; - this.special = special; - } - /** - * The maximum value allowed for a numeric version component. - * This reflects the maximum value allowed in PlugPlug and the manifest schema. - */ - Version.MAX_NUM = 999999999; - return Version; -}()); -/** - * Defines a boundary for a version range, which associates a Version object - * with a flag for whether it is an inclusive or exclusive boundary. - */ -var VersionBound = /** @class */ (function () { - /** - * @param version The Version object. - * @param inclusive True if this boundary is inclusive, false if it is exclusive. - * - * @return A new VersionBound object. - */ - function VersionBound(version, inclusive) { - this.version = version; - this.inclusive = inclusive; - } - return VersionBound; -}()); -/** - * Defines a range of versions using a lower boundary and optional upper boundary. - */ -var VersionRange = /** @class */ (function () { - /** - * @param lowerBound The VersionBound object. - * @param upperBound The VersionBound object, or null for a range with no upper boundary. - * - * @return A new VersionRange object. - */ - function VersionRange(lowerBound, upperBound) { - this.lowerBound = lowerBound; - this.upperBound = upperBound; - } - return VersionRange; -}()); -/** - * Represents a runtime related to the CEP infrastructure. - * Extensions can declare dependencies on particular - * CEP runtime versions in the extension manifest. - */ -var Runtime = /** @class */ (function () { - /** - * @param name The runtime name. - * @param version A VersionRange object that defines a range of valid versions. - * - * @return A new Runtime object. - */ - function Runtime(name, versionRange) { - this.name = name; - this.versionRange = versionRange; - this.version = versionRange; - } - return Runtime; -}()); -/** - * @FIXME: interface? - * Encapsulates a CEP-based extension to an Adobe application. - */ -var Extension = /** @class */ (function () { - /** - * @param id The unique identifier of this extension. - * @param name The localizable display name of this extension. - * @param mainPath The path of the "index.html" file. - * @param basePath The base path of this extension. - * @param windowType The window type of the main window of this extension. - * Valid values are defined by CSXSWindowType. - * @param width The default width in pixels of the main window of this extension. - * @param height The default height in pixels of the main window of this extension. - * @param minWidth The minimum width in pixels of the main window of this extension. - * @param minHeight The minimum height in pixels of the main window of this extension. - * @param maxWidth The maximum width in pixels of the main window of this extension. - * @param maxHeight The maximum height in pixels of the main window of this extension. - * @param defaultExtensionDataXml The extension data contained in the default ExtensionDispatchInfo section of the extension manifest. - * @param specialExtensionDataXml The extension data contained in the application-specific ExtensionDispatchInfo section of the extension manifest. - * @param requiredRuntimeList An array of Runtime objects for runtimes required by this extension. - * @param isAutoVisible True if this extension is visible on loading. - * @param isPluginExtension True if this extension has been deployed in the Plugins folder of the host application. - */ - function Extension(id, name, mainPath, basePath, windowType, width, height, minWidth, minHeight, maxWidth, maxHeight, defaultExtensionDataXml, specialExtensionDataXml, requiredRuntimeList, isAutoVisible, isPluginExtension) { - this.id = id; - this.name = name; - this.mainPath = mainPath; - this.basePath = basePath; - this.windowType = windowType; - this.width = width; - this.height = height; - this.minWidth = minWidth; - this.minHeight = minHeight; - this.maxWidth = maxWidth; - this.maxHeight = maxHeight; - this.defaultExtensionDataXml = defaultExtensionDataXml; - this.specialExtensionDataXml = specialExtensionDataXml; - this.requiredRuntimeList = requiredRuntimeList; - this.isAutoVisible = isAutoVisible; - this.isPluginExtension = isPluginExtension; - } - return Extension; -}()); -exports.Extension = Extension; -/** - * A standard JavaScript event, the base class for CEP events. - */ -var CSEvent = /** @class */ (function () { - /** - * @param type The name of the event type. - * @param scope The scope of event, can be "GLOBAL" or "APPLICATION". - * @param appId The unique identifier of the application that generated the event. - * @param extensionId The unique identifier of the extension that generated the event. - */ - function CSEvent(type, scope, appId, extensionId) { - this.type = type; - this.scope = scope; - this.appId = appId; - this.extensionId = extensionId; - /** - * Event-specific data. - */ - this.data = ""; - } - return CSEvent; -}()); -exports.CSEvent = CSEvent; -/** - * Stores color-type constants. - */ -var ColorType; -(function (ColorType) { - /** - * RGB color type. - */ - ColorType["RGB"] = "rbg"; - /** - * Gradient color type. - */ - ColorType["GRADIENT"] = "gradient"; - /** - * Null color type. - */ - ColorType["NONE"] = "none"; -})(ColorType || (ColorType = {})); -exports.ColorType = ColorType; -/** - * Stores an RGB color with red, green, blue, and alpha values. - * All values are in the range [0.0 to 255.0]. Invalid numeric values are - * converted to numbers within this range. - */ -var RGBColor = /** @class */ (function () { - /** - * @param red The red value, in the range [0.0 to 255.0]. - * @param green The green value, in the range [0.0 to 255.0]. - * @param blue The blue value, in the range [0.0 to 255.0]. - * @param alpha The alpha (transparency) value, in the range [0.0 to 255.0]. - * The default, 255.0, means that the color is fully opaque. - * - * @return A new RGBColor object. - */ - function RGBColor(red, green, blue, alpha) { - if (alpha === void 0) { alpha = 255; } - this.red = red; - this.green = green; - this.blue = blue; - this.alpha = alpha; - } - return RGBColor; -}()); -exports.RGBColor = RGBColor; -/** - * A point value in which the y component is 0 and the x component - * is positive or negative for a right or left direction, - * or the x component is 0 and the y component is positive or negative for - * an up or down direction. - */ -var Direction = /** @class */ (function () { - /** - * @param x The horizontal component of the point. - * @param y The vertical component of the point. - * - * @return A new Direction object. - */ - function Direction(x, y) { - this.x = x; - this.y = y; - } - return Direction; -}()); -exports.Direction = Direction; -/** - * Stores gradient stop information. - */ -var GradientStop = /** @class */ (function () { - /** - * @param offset The offset of the gradient stop, in the range [0.0 to 1.0]. - * @param rgbColor The color of the gradient at this point, an RGBColor object. - * - * @return GradientStop object. - */ - function GradientStop(offset, rgbColor) { - this.offset = offset; - this.rgbColor = rgbColor; - } - return GradientStop; -}()); -exports.GradientStop = GradientStop; -/** - * Stores gradient color information. - */ -var GradientColor = /** @class */ (function () { - /** - * @param type The gradient type, must be "linear". - * @param direction A Direction object for the direction of the gradient (up, down, right, or left). - * @param numStops The number of stops in the gradient. - * @param gradientStopList An array of GradientStop objects. - * - * @return A new GradientColor object. - */ - function GradientColor(type, direction, numStops, arrGradientStop) { - this.type = type; - this.direction = direction; - this.numStops = numStops; - this.arrGradientStop = arrGradientStop; - this.gradientStopList = arrGradientStop; - } - return GradientColor; -}()); -exports.GradientColor = GradientColor; -/** - * Stores color information, including the type, anti-alias level, and specific color - * values in a color object of an appropriate type. - * - * @FIXME: use Conditional Type for the constructor - */ -var UIColor = /** @class */ (function () { - /** - * @param type The color type, 1 for "rgb" and 2 for "gradient". The supplied color object must correspond to this type. - * @param antialiasLevel The anti-alias level constant. - * @param color A RGBColor or GradientColor object containing specific color information. - * - * @return A new UIColor object. - */ - function UIColor(type, antialiasLevel, color) { - this.type = type; - this.antialiasLevel = antialiasLevel; - this.color = color; - } - return UIColor; -}()); -exports.UIColor = UIColor; -/** - * Stores flyout menu item status - * - * @since 5.2.0 - */ -var MenuItemStatus = /** @class */ (function () { - /** - * @param menuItemLabel The menu item label. - * @param enabled True if user wants to enable the menu item. - * @param checked True if user wants to check the menu item. - * - * @return MenuItemStatus object. - */ - function MenuItemStatus(menuItemLabel, enabled, checked) { - this.menuItemLabel = menuItemLabel; - this.enabled = enabled; - this.checked = checked; - } - return MenuItemStatus; -}()); -exports.MenuItemStatus = MenuItemStatus; -/** - * Stores the status of the context menu item. - * - * @since 5.2.0 - */ -var ContextMenuItemStatus = /** @class */ (function () { - /** - * @param menuItemID The menu item id. - * @param enabled True if user wants to enable the menu item. - * @param checked True if user wants to check the menu item. - * - * @return MenuItemStatus object. - */ - function ContextMenuItemStatus(menuItemID, enabled, checked) { - this.menuItemID = menuItemID; - this.enabled = enabled; - this.checked = checked; - } - return ContextMenuItemStatus; -}()); -exports.ContextMenuItemStatus = ContextMenuItemStatus; -/** - * This is the entry point to the CEP extensibility infrastructure. - * Instantiate this object and use it to: - *
    - *
  • Access information about the host application in which an extension is running
  • - *
  • Launch an extension
  • - *
  • Register interest in event notifications, and dispatch events
  • - *
- * - */ -var CSInterface = /** @class */ (function () { - function CSInterface() { - /** - * The host environment data object. - */ - this.hostEnvironment = window.__adobe_cep__ ? JSON.parse(window.__adobe_cep__.getHostEnvironment()) : null; - } - /** - * Retrieves information about the host environment in which the extension is currently running. - * - * @return {HostEnvironment} A HostEnvironment object. - */ - CSInterface.prototype.getHostEnvironment = function () { - return JSON.parse(window.__adobe_cep__.getHostEnvironment()); - }; - /** - * Closes this extension. - */ - CSInterface.prototype.closeExtension = function () { - window.__adobe_cep__.closeExtension(); - }; - /** - * Retrieves a path for which a constant is defined in the system. - * - * @param pathType The path-type constant defined in SystemPath , - * - * @return {string} The platform-specific system path string. - */ - CSInterface.prototype.getSystemPath = function (pathType) { - var path = decodeURI(window.__adobe_cep__.getSystemPath(pathType)); - var OSVersion = this.getOSInformation(); - if (OSVersion.indexOf("Windows") >= 0) { - path = path.replace("file:///", ""); - } - else if (OSVersion.indexOf("Mac") >= 0) { - path = path.replace("file://", ""); - } - return path; - }; - /** - * Evaluates a JavaScript script, which can use the JavaScript DOM - * of the host application. - * - * @param script The JavaScript script. - * @param callback Optional. A callback function that receives the result of execution. - * If execution fails, the callback function receives the error message EvalScript_ErrMessage. - */ - CSInterface.prototype.evalScript = function (script, callback) { - if (callback === null || callback === undefined) { - callback = function (result) { - }; - } - window.__adobe_cep__.evalScript(script, callback); - }; - /** - * Retrieves the unique identifier of the application. - * in which the extension is currently running. - * - * @return {string} The unique ID string. - */ - CSInterface.prototype.getApplicationID = function () { - return this.hostEnvironment.appId; - }; - /** - * Retrieves host capability information for the application - * in which the extension is currently running. - * - * @return {HostCapabilities} A HostCapabilities object. - */ - CSInterface.prototype.getHostCapabilities = function () { - return JSON.parse(window.__adobe_cep__.getHostCapabilities()); - }; - /** - * Triggers a CEP event programmatically. Yoy can use it to dispatch - * an event of a predefined type, or of a type you have defined. - * - * @param event A CSEvent object. - */ - CSInterface.prototype.dispatchEvent = function (event) { - if (typeof event.data == "object") { - event.data = JSON.stringify(event.data); - } - window.__adobe_cep__.dispatchEvent(event); - }; - /** - * Registers an interest in a CEP event of a particular type, and - * assigns an event handler. - * The event infrastructure notifies your extension when events of this type occur, - * passing the event object to the registered handler function. - * - * @param type The name of the event type of interest. - * @param listener The JavaScript handler function or method. - * @param obj Optional, the object containing the handler method, if any. Default is null. - */ - CSInterface.prototype.addEventListener = function (type, listener, obj) { - window.__adobe_cep__.addEventListener(type, listener, obj); - }; - /** - * Removes a registered event listener. - * - * @param type The name of the event type of interest. - * @param listener The JavaScript handler function or method that was registered. - * @param obj Optional, the object containing the handler method, if any. - * Default is null. - */ - CSInterface.prototype.removeEventListener = function (type, listener, obj) { - window.__adobe_cep__.removeEventListener(type, listener, obj); - }; - /** - * Loads and launches another extension, or activates the extension if it is already loaded. - * - * @param extensionId The extension's unique identifier. - * @param startupParams Not currently used, pass "". - * - * @example - * To launch the extension "help" with ID "HLP" from this extension, call: - * requestOpenExtension("HLP", ""); - * - */ - CSInterface.prototype.requestOpenExtension = function (extensionId, startupParams) { - window.__adobe_cep__.requestOpenExtension(extensionId, startupParams); - }; - /** - * @TODO: "zero" or more Extension objects. - * - * Retrieves the list of extensions currently loaded in the current host application. - * The extension list is initialized once, and remains the same during the lifetime - * of the CEP session. - * - * @param extensionIds Optional, an array of unique identifiers for extensions of interest. - * If omitted, retrieves data for all extensions. - * - * @return {Extension[]} Zero or more Extension objects. - */ - CSInterface.prototype.getExtensions = function (extensionIds) { - var extensionIdsStr = JSON.stringify(extensionIds); - var extensionsStr = window.__adobe_cep__.getExtensions(extensionIdsStr); - return JSON.parse(extensionsStr); - }; - /** - * @TODO: create network interface - * - * Retrieves network-related preferences. - * - * @return {Object} A JavaScript object containing network preferences. - */ - CSInterface.prototype.getNetworkPreferences = function () { - return JSON.parse(window.__adobe_cep__.getNetworkPreferences()); - }; - /** - * Initializes the resource bundle for this extension with property values - * for the current application and locale. - * To support multiple locales, you must define a property file for each locale, - * containing keyed display-string values for that locale. - * See localization documentation for Extension Builder and related products. - * - * Keys can be in the - * form key.value="localized string", for use in HTML text elements. - * For example, in this input element, the localized \c key.value string is displayed - * instead of the empty \c value string: - * - * - * - * @return {Object} An object containing the resource bundle information. - */ - CSInterface.prototype.initResourceBundle = function () { - var resourceBundle = JSON.parse(window.__adobe_cep__.initResourceBundle()); - var resElms = document.querySelectorAll('[data-locale]'); - for (var n = 0; n < resElms.length; n++) { - var resEl = resElms[n]; - // Get the resource key from the element. - var resKey = resEl.getAttribute('data-locale'); - if (resKey) { - // Get all the resources that start with the key. - for (var key in resourceBundle) { - if (key.indexOf(resKey) === 0) { - var resValue = resourceBundle[key]; - if (key.length == resKey.length) { - resEl.innerHTML = resValue; - } - else if ('.' == key.charAt(resKey.length)) { - var attrKey = key.substring(resKey.length + 1); - // @ts-ignore - resEl[attrKey] = resValue; - } - } - } - } - } - return resourceBundle; - }; - /** - * Writes installation information to a file. - * - * @return {string} The file path. - */ - CSInterface.prototype.dumpInstallationInfo = function () { - return window.__adobe_cep__.dumpInstallationInfo(); - }; - /** - * Retrieves version information for the current Operating System, - * See http://www.useragentstring.com/pages/Chrome/ for Chrome navigator.userAgent values. - * - * @return {string} A string containing the OS version, or "unknown Operation System". - * If user customizes the User Agent by setting CEF command parameter "--user-agent", only - * "Mac OS X" or "Windows" will be returned. - */ - CSInterface.prototype.getOSInformation = function () { - var userAgent = navigator.userAgent; - if ((navigator.platform === "Win32") || (navigator.platform === "Windows")) { - var winVersion = "Windows"; - var winBit = ""; - if (userAgent.indexOf("Windows") > -1) { - if (userAgent.indexOf("Windows NT 5.0") > -1) { - winVersion = "Windows 2000"; - } - else if (userAgent.indexOf("Windows NT 5.1") > -1) { - winVersion = "Windows XP"; - } - else if (userAgent.indexOf("Windows NT 5.2") > -1) { - winVersion = "Windows Server 2003"; - } - else if (userAgent.indexOf("Windows NT 6.0") > -1) { - winVersion = "Windows Vista"; - } - else if (userAgent.indexOf("Windows NT 6.1") > -1) { - winVersion = "Windows 7"; - } - else if (userAgent.indexOf("Windows NT 6.2") > -1) { - winVersion = "Windows 8"; - } - else if (userAgent.indexOf("Windows NT 6.3") > -1) { - winVersion = "Windows 8.1"; - } - else if (userAgent.indexOf("Windows NT 10") > -1) { - winVersion = "Windows 10"; - } - if (userAgent.indexOf("WOW64") > -1 || userAgent.indexOf("Win64") > -1) { - winBit = " 64-bit"; - } - else { - winBit = " 32-bit"; - } - } - return winVersion + winBit; - } - else if ((navigator.platform === "MacIntel") || (navigator.platform === "Macintosh")) { - var result = "Mac OS X"; - if (userAgent.indexOf("Mac OS X") > -1) { - result = userAgent.substring(userAgent.indexOf("Mac OS X"), userAgent.indexOf(")")); - result = result.replace(/_/g, "."); - } - return result; - } - return "Unknown Operation System"; - }; - /** - * Opens a page in the default system browser. - * - * @since 4.2.0 - * - * @param url The URL of the page/file to open, or the email address. - * Must use HTTP/HTTPS/file/mailto protocol. For example: - * "http://www.adobe.com" - * "https://github.com" - * "file:///C:/log.txt" - * "mailto:test@adobe.com" - * - * @return {number} One of these error codes:\n - *
    - *
  • NO_ERROR - 0
  • - *
  • ERR_UNKNOWN - 1
  • - *
  • ERR_INVALID_PARAMS - 2
  • - *
  • ERR_INVALID_URL - 201
  • - *
\n - */ - CSInterface.prototype.openURLInDefaultBrowser = function (url) { - var result = window.cep.util.openURLInDefaultBrowser(url); - return result.err; - }; - /** - * Retrieves extension ID. - * - * @since 4.2.0 - * - * @return {string} extension ID. - */ - CSInterface.prototype.getExtensionID = function () { - return window.__adobe_cep__.getExtensionId(); - }; - /** - * Retrieves the scale factor of screen. - * On Windows platform, the value of scale factor might be different from operating system's scale factor, - * since host application may use its self-defined scale factor. - * - * @since 4.2.0 - * - * @return {number} One of the following float number. - *
    - *
  • -1.0 when error occurs
  • - *
  • 1.0 means normal screen
  • - *
  • >1.0 means HiDPI screen
  • - *
- */ - CSInterface.prototype.getScaleFactor = function () { - return window.__adobe_cep__.getScaleFactor(); - }; - /** - * Set a handler to detect any changes of scale factor. This only works on Mac. - * - * @since 4.2.0 - * - * @param handler The function to be called when scale factor is changed. - */ - CSInterface.prototype.setScaleFactorChangedHandler = function (handler) { - window.__adobe_cep__.setScaleFactorChangedHandler(handler); - }; - /** - * Retrieves current API version. - * - * @since 4.2.0 - * - * @return ApiVersion object. - */ - CSInterface.prototype.getCurrentApiVersion = function () { - return JSON.parse(window.__adobe_cep__.getCurrentApiVersion()); - }; - /** - * Set panel flyout menu by an XML. - * - * @since 5.2.0 - * - * Register a callback function for "com.adobe.csxs.events.flyoutMenuClicked" to get notified when a - * menu item is clicked. - * The "data" attribute of event is an object which contains "menuId" and "menuName" attributes. - * - * Register callback functions for "com.adobe.csxs.events.flyoutMenuOpened" and "com.adobe.csxs.events.flyoutMenuClosed" - * respectively to get notified when flyout menu is opened or closed. - * - * @param menu A XML string which describes menu structure. - * An example menu XML: - * - * - * - * - * - * - * - * - * - * - * - */ - CSInterface.prototype.setPanelFlyoutMenu = function (menu) { - window.__adobe_cep__.invokeSync("setPanelFlyoutMenu", menu); - }; - /** - * Updates a menu item in the extension window's flyout menu, by setting the enabled - * and selection status. - * - * @since 5.2.0 - * - * @param menuItemLabel The menu item label. - * @param enabled True to enable the item, false to disable it (gray it out). - * @param checked True to select the item, false to deselect it. - * - * @return {boolean} false when the host application does not support this functionality (HostCapabilities.EXTENDED_PANEL_MENU is false). - * Fails silently if menu label is invalid. - * - * @see HostCapabilities.EXTENDED_PANEL_MENU - */ - CSInterface.prototype.updatePanelMenuItem = function (menuItemLabel, enabled, checked) { - if (!this.getHostCapabilities().EXTENDED_PANEL_MENU) { - return false; - } - var itemStatus = new MenuItemStatus(menuItemLabel, enabled, checked); - // @ts-ignore @FIXME: test return result - return window.__adobe_cep__.invokeSync("updatePanelMenuItem", JSON.stringify(itemStatus)); - }; - /** - * Set context menu by XML string. - * - * @since 5.2.0 - * - * There are a number of conventions used to communicate what type of menu item to create and how it should be handled. - * - an item without menu ID or menu name is disabled and is not shown. - * - if the item name is "---" (three hyphens) then it is treated as a separator. The menu ID in this case will always be NULL. - * - Checkable attribute takes precedence over Checked attribute. - * - a PNG icon. For optimal display results please supply a 16 x 16px icon as larger dimensions will increase the size of the menu item. - * The Chrome extension contextMenus API was taken as a reference. - * https://developer.chrome.com/extensions/contextMenus - * - the items with icons and checkable items cannot coexist on the same menu level. The former take precedences over the latter. - * - * @param menu A XML string which describes menu structure. - * @param callback The callback function which is called when a menu item is clicked. The only parameter is the returned ID of clicked menu item. - * - * @description An example menu XML: - * - * - * - * - * - * - * - * - * - * - * - */ - CSInterface.prototype.setContextMenu = function (menu, callback) { - window.__adobe_cep__.invokeAsync("setContextMenu", menu, callback); - }; - /** - * Set context menu by JSON string. - * - * @since 6.0.0 - * - * There are a number of conventions used to communicate what type of menu item to create and how it should be handled. - * - an item without menu ID or menu name is disabled and is not shown. - * - if the item label is "---" (three hyphens) then it is treated as a separator. The menu ID in this case will always be NULL. - * - Checkable attribute takes precedence over Checked attribute. - * - a PNG icon. For optimal display results please supply a 16 x 16px icon as larger dimensions will increase the size of the menu item. - The Chrome extension contextMenus API was taken as a reference. - * - the items with icons and checkable items cannot coexist on the same menu level. The former take precedences over the latter. - https://developer.chrome.com/extensions/contextMenus - * - * @param menu A JSON string which describes menu structure. - * @param callback The callback function which is called when a menu item is clicked. The only parameter is the returned ID of clicked menu item. - * - * @description An example menu JSON: - * - * { - * "menu": [ - * { - * "id": "menuItemId1", - * "label": "testExample1", - * "enabled": true, - * "checkable": true, - * "checked": false, - * "icon": "./image/small_16X16.png" - * }, - * { - * "id": "menuItemId2", - * "label": "testExample2", - * "menu": [ - * { - * "id": "menuItemId2-1", - * "label": "testExample2-1", - * "menu": [ - * { - * "id": "menuItemId2-1-1", - * "label": "testExample2-1-1", - * "enabled": false, - * "checkable": true, - * "checked": true - * } - * ] - * }, - * { - * "id": "menuItemId2-2", - * "label": "testExample2-2", - * "enabled": true, - * "checkable": true, - * "checked": true - * } - * ] - * }, - * { - * "label": "---" - * }, - * { - * "id": "menuItemId3", - * "label": "testExample3", - * "enabled": false, - * "checkable": true, - * "checked": false - * } - * ] - * } - * - */ - CSInterface.prototype.setContextMenuByJSON = function (menu, callback) { - window.__adobe_cep__.invokeAsync("setContextMenuByJSON", menu, callback); - }; - /** - * Updates a context menu item by setting the enabled and selection status. - * - * @since 5.2.0 - * - * @param menuItemID The menu item ID. - * @param enabled True to enable the item, false to disable it (gray it out). - * @param checked True to select the item, false to deselect it. - */ - CSInterface.prototype.updateContextMenuItem = function (menuItemID, enabled, checked) { - var itemStatus = new ContextMenuItemStatus(menuItemID, enabled, checked); - window.__adobe_cep__.invokeSync("updateContextMenuItem", JSON.stringify(itemStatus)); - }; - /** - * Get the visibility status of an extension window. - * - * @since 6.0.0 - * - * @return {boolean} true if the extension window is visible; false if the extension window is hidden. - */ - CSInterface.prototype.isWindowVisible = function () { - return window.__adobe_cep__.invokeSync("isWindowVisible", "") === "true"; - }; - /** - * Resize extension's content to the specified dimensions. - * 1. Works with modal and modeless extensions in all Adobe products. - * 2. Extension's manifest min/max size constraints apply and take precedence. - * 3. For panel extensions - * 3.1 This works in all Adobe products except: - * * Premiere Pro - * * Prelude - * * After Effects - * 3.2 When the panel is in certain states (especially when being docked), - * it will not change to the desired dimensions even when the - * specified size satisfies min/max constraints. - * - * @since 6.0.0 - * - * @param width The new width - * @param height The new height - */ - CSInterface.prototype.resizeContent = function (width, height) { - window.__adobe_cep__.resizeContent(width, height); - }; - /** - * TODO: What is the return typ? - * - * Register the invalid certificate callback for an extension. - * This callback will be triggered when the extension tries to access the web site that contains the invalid certificate on the main frame. - * But if the extension does not call this function and tries to access the web site containing the invalid certificate, a default error page will be shown. - * - * Since 6.1.0 - * - * @param callback the callback function - */ - CSInterface.prototype.registerInvalidCertificateCallback = function (callback) { - return window.__adobe_cep__.registerInvalidCertificateCallback(callback); - }; - /** - * Register an interest in some key events to prevent them from being sent to the host application. - * - * This function works with modeless extensions and panel extensions. - * Generally all the key events will be sent to the host application for these two extensions if the current focused element - * is not text input or dropdown, - * If you want to intercept some key events and want them to be handled in the extension, please call this function - * in advance to prevent them being sent to the host application. - * - * @since 6.1.0 - * - * @param keyEventsInterest A JSON string describing those key events you are interested in. A null object or - an empty string will lead to removing the interest - * - * This JSON string should be an array, each object has following keys: - * - * keyCode: [Required] represents an OS system dependent virtual key code identifying - * the unmodified value of the pressed key. - * ctrlKey: [optional] a Boolean that indicates if the control key was pressed (true) or not (false) when the event occurred. - * altKey: [optional] a Boolean that indicates if the alt key was pressed (true) or not (false) when the event occurred. - * shiftKey: [optional] a Boolean that indicates if the shift key was pressed (true) or not (false) when the event occurred. - * metaKey: [optional] (Mac Only) a Boolean that indicates if the Meta key was pressed (true) or not (false) when the event occurred. - * On Macintosh keyboards, this is the command key. To detect Windows key on Windows, please use keyCode instead. - * An example JSON string: - * - * [ - * { - * "keyCode": 48 - * }, - * { - * "keyCode": 123, - * "ctrlKey": true - * }, - * { - * "keyCode": 123, - * "ctrlKey": true, - * "metaKey": true - * } - * ] - * - */ - CSInterface.prototype.registerKeyEventsInterest = function (keyEventsInterest) { - return window.__adobe_cep__.registerKeyEventsInterest(keyEventsInterest); - }; - /** - * Set the title of the extension window. - * This function works with modal and modeless extensions in all Adobe products, and panel extensions in Photoshop, InDesign, InCopy, Illustrator, Flash Pro and Dreamweaver. - * - * @since 6.1.0 - * - * @param title The window title. - */ - CSInterface.prototype.setWindowTitle = function (title) { - window.__adobe_cep__.invokeSync("setWindowTitle", title); - }; - /** - * Get the title of the extension window. - * This function works with modal and modeless extensions in all Adobe products, and panel extensions in Photoshop, InDesign, InCopy, Illustrator, Flash Pro and Dreamweaver. - * - * @since 6.1.0 - * - * @return {string} The window title. - */ - CSInterface.prototype.getWindowTitle = function () { - return window.__adobe_cep__.invokeSync("getWindowTitle", ""); - }; - return CSInterface; -}()); -exports.CSInterface = CSInterface; -(function (CSInterface) { - /** - * Stores operating-system-specific location constants for use in the CSInterface.getSystemPath() method. - */ - var SystemPath; - (function (SystemPath) { - /** - * The path to user data. - */ - SystemPath["USER_DATA"] = "userData"; - /** - * The path to common files for Adobe applications. - */ - SystemPath["COMMON_FILES"] = "commonFiles"; - /** - * The path to the user's default document folder. - */ - SystemPath["MY_DOCUMENTS"] = "myDocuments"; - /** - * @deprecated. Use SystemPath.Extension. - */ - SystemPath["APPLICATION"] = "application"; - /** - * The path to current extension. - */ - SystemPath["EXTENSION"] = "extension"; - /** - * The path to hosting application's executable. - */ - SystemPath["HOST_APPLICATION"] = "hostApplication"; - })(SystemPath = CSInterface.SystemPath || (CSInterface.SystemPath = {})); - /** - * - */ - CSInterface.EvalScript_ErrMessage = 'EvalScript error.'; - /** - * - */ - CSInterface.THEME_COLOR_CHANGED_EVENT = "com.adobe.csxs.events.ThemeColorChanged"; -})(CSInterface = exports.CSInterface || (exports.CSInterface = {})); -exports.CSInterface = CSInterface; -exports.default = CSInterface; diff --git a/lib/v9.d.ts b/lib/v9.d.ts deleted file mode 100644 index 68fba8b..0000000 --- a/lib/v9.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/************************************************************************************************** - * - * ADOBE SYSTEMS INCORPORATED - * Copyright 2013 Adobe Systems Incorporated - * All Rights Reserved. - * - * NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the - * terms of the Adobe license agreement accompanying it. If you have received this file from a - * source other than Adobe, then your use, modification, or distribution of it requires the prior - * written permission of Adobe. - * - **************************************************************************************************/ -import CSInterfaceV8 from "./v8"; -/** - * CSInterface - v9.4.0 - */ -declare class CSInterface extends CSInterfaceV8 { - /** - * Retrieves the scale factor of Monitor. - * - * @since 8.5.0 - * - * @return {number} value >= 1.0f only available for windows machine - */ - getMonitorScaleFactor(): number; - /** - * @since 9.4.0 - * - * Loads binary file created which is located at url asynchronously - * - * @param urlName url at which binary file is located. Local files should start with 'file://' - * @param callback Optional. A callback function that returns after binary is loaded - * - * @return {boolean} - * - * @example - * - * To create JS binary use command ./cep_compiler test.js test.bin - * To load JS binary asyncronously - * var CSLib = new CSInterface(); - * CSLib.loadBinAsync(url, function () { }); - */ - loadBinAsync(urlName: string, callback: Function): boolean; - /** - * @since 9.4.0 - * - * Loads binary file created synchronously - * - * @param pathName the local path at which binary file is located - * - * @example - * To create JS binary use command ./cep_compiler test.js test.bin - * To load JS binary syncronously - * var CSLib = new CSInterface(); - * CSLib.loadBinSync(path); - */ - loadBinSync(pathName: string): boolean; -} -export * from './v8'; -export default CSInterface; diff --git a/lib/v9.js b/lib/v9.js deleted file mode 100644 index 4a583ba..0000000 --- a/lib/v9.js +++ /dev/null @@ -1,133 +0,0 @@ -"use strict"; -/************************************************************************************************** - * - * ADOBE SYSTEMS INCORPORATED - * Copyright 2013 Adobe Systems Incorporated - * All Rights Reserved. - * - * NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the - * terms of the Adobe license agreement accompanying it. If you have received this file from a - * source other than Adobe, then your use, modification, or distribution of it requires the prior - * written permission of Adobe. - * - **************************************************************************************************/ -var __extends = (this && this.__extends) || (function () { - var extendStatics = function (d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); - }; - return function (d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; -})(); -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -Object.defineProperty(exports, "__esModule", { value: true }); -var v8_1 = require("./v8"); -/** - * CSInterface - v9.4.0 - */ -var CSInterface = /** @class */ (function (_super) { - __extends(CSInterface, _super); - function CSInterface() { - return _super !== null && _super.apply(this, arguments) || this; - } - /** - * Retrieves the scale factor of Monitor. - * - * @since 8.5.0 - * - * @return {number} value >= 1.0f only available for windows machine - */ - CSInterface.prototype.getMonitorScaleFactor = function () { - if (navigator.appVersion.toLowerCase().indexOf("windows") === -1) { - throw Error('Operation System not supported'); - } - return window.__adobe_cep__.getMonitorScaleFactor(); - }; - /** - * @since 9.4.0 - * - * Loads binary file created which is located at url asynchronously - * - * @param urlName url at which binary file is located. Local files should start with 'file://' - * @param callback Optional. A callback function that returns after binary is loaded - * - * @return {boolean} - * - * @example - * - * To create JS binary use command ./cep_compiler test.js test.bin - * To load JS binary asyncronously - * var CSLib = new CSInterface(); - * CSLib.loadBinAsync(url, function () { }); - */ - CSInterface.prototype.loadBinAsync = function (urlName, callback) { - try { - var xhr_1 = new XMLHttpRequest(); - xhr_1.responseType = 'arraybuffer'; // make response as ArrayBuffer - xhr_1.open('GET', urlName, true); - xhr_1.onerror = function () { - console.log("Unable to load snapshot from given URL"); - return false; - }; - xhr_1.send(); - xhr_1.onload = function () { - window.__adobe_cep__.loadSnapshot(xhr_1.response); - if (typeof callback === "function") { - callback(); - } - else if (typeof callback !== "undefined") { - console.log("Provided callback is not a function"); - } - }; - } - catch (err) { - console.log(err); - return false; - } - return true; - }; - /** - * @since 9.4.0 - * - * Loads binary file created synchronously - * - * @param pathName the local path at which binary file is located - * - * @example - * To create JS binary use command ./cep_compiler test.js test.bin - * To load JS binary syncronously - * var CSLib = new CSInterface(); - * CSLib.loadBinSync(path); - */ - CSInterface.prototype.loadBinSync = function (pathName) { - try { - var OSVersion = this.getOSInformation(); - if (pathName.startsWith("file://")) { - if (OSVersion.indexOf("Windows") >= 0) { - pathName = pathName.replace("file:///", ""); - } - else if (OSVersion.indexOf("Mac") >= 0) { - pathName = pathName.replace("file://", ""); - } - window.__adobe_cep__.loadSnapshot(pathName); - return true; - } - } - catch (err) { - console.log(err); - return false; - } - //control should not come here - return false; - }; - return CSInterface; -}(v8_1.default)); -__export(require("./v8")); -exports.default = CSInterface;