added gk lib for appenablement

This commit is contained in:
2026-04-02 08:29:44 +02:00
parent 586ac4c5c2
commit e8bec486c5
8 changed files with 1938 additions and 6 deletions
+178
View File
@@ -0,0 +1,178 @@
// Shorthand syntax to check if the namespace already exists, if not create an empty Object.
var comGkSoftwareGkrAppEnablementApi = comGkSoftwareGkrAppEnablementApi || {};
/*global oAppEnablementConnectorInstance*/
/**
* @class
* @classdesc App Enablement class for all common used functionalities like registering and unregistering to events
* and to get the session context.
* @author mluzius
* @since 2.0.0
* @public
* @name com.gk_software.gkr.app_enablement.api.Common
*/
comGkSoftwareGkrAppEnablementApi.Common = function () {
"use strict";
this._prefix = "comGkSoftwareGkrAppEnablementApi.Common/";
};
/**
* The internally returned object looks like the following example:
* {
* businessUnitGroupID: "100000000000000001",
* businessUnitID: "9090", // Equivalent to store ID
* isoCurrencyCode: "USD",
* storeLanguage: "en_US",
* tenantID: "004",
* userLanguage: "zh_CN",
* workstationID: "107"
* }
* @summary This function will provide the session context. For example currency, language.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.Common.getSessionContext
* @param {string} sResultFunction
* Name of the success callback function. Data type is string but internal data type is function.
* @param {string} sErrorFunction
* Name of the error callback function. Data type is string but internal data type is function.
* @function
*/
comGkSoftwareGkrAppEnablementApi.Common.prototype.getSessionContext = function (sResultFunction, sErrorFunction) {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "getSessionContext", sResultFunction, sErrorFunction);
};
/**
* @summary This function will create a request object for the function 'registerListener'.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.Common.createRegisterListenerRequest
* @param {string} sEventName
* Name of the event that should be registered. For example: 'EVENT_TRANSACTION_UPDATED'.
* @param {string} sEventListenerName
* Name of the event listener function that should be executed when the event is fired.
* @param {boolean} bPassData
* Flag to indicate if the event listener function receives a data parameter. For example needed for
* Scan events to provide the barcodeFormat and the rawScanData.
* @function
* @returns (String) Returns a stringified Object for the registerListener request.
*/
comGkSoftwareGkrAppEnablementApi.Common.prototype.createRegisterListenerRequest = function (sEventName, sEventListenerName, bPassData) {
return JSON.stringify({
"event": sEventName,
"listener": sEventListenerName,
"passData": bPassData
});
};
/**
* @summary This function will register a listener for the given event.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.Common.registerListener
* @param {string} oRegisterListenerRequest
* Necessary request object to register event listeners. Data type is string but internal
* data type is Object.
* The internally used object should look like the following example:
* {
* "event": "EVENT_TRANSACTION_UPDATED",
"listener": "returnEventNotification",
"passData": false || true
* }
* @function
*/
comGkSoftwareGkrAppEnablementApi.Common.prototype.registerListener = function (sRegisterListenerRequest) {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "registerListener", "", "", sRegisterListenerRequest);
};
/**
* @summary This function will create a request object for the function 'unregisterListener'.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.Common.createUnregisterListenerRequest
* @param {string} sEventName
* Name of the event that should be unregistered. For example: 'EVENT_TRANSACTION_UPDATED'.
* @param {string} sEventListenerName
* Name of the event listener function that should be unregistered.
* @function
* @returns (String) Returns a stringified Object for the unregisterListener request.
*/
comGkSoftwareGkrAppEnablementApi.Common.prototype.createUnregisterListenerRequest = function (sEventName, sEventListenerName) {
return JSON.stringify({
"event": sEventName,
"listener": sEventListenerName
});
};
/**
* @summary This function will unregister a listener for the given event.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.Common.unregisterListener
* @param {string} sUnregisterListenerRequest
* Name of the event that should be unregistered so that it can't be fired any longer.
* Data type is string but internal data type is Object.
* @function
*/
comGkSoftwareGkrAppEnablementApi.Common.prototype.unregisterListener = function (sUnregisterListenerRequest) {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "unregisterListener", "", "", sUnregisterListenerRequest);
};
/**
* @summary This function will close the app
*
* @author nmankel (Last modified by: nmankel)
* @since 2.1.0
* @name com.gk_software.gkr.app_enablement.api.Common.closeBrowser
* @function
*/
comGkSoftwareGkrAppEnablementApi.Common.prototype.closeBrowser = function () {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "closeBrowser", "", "");
};
/**
* @summary This function will hide the app
*
* @author nmankel (Last modified by: nmankel)
* @since 2.1.0
* @name com.gk_software.gkr.app_enablement.api.Common.hideBrowser
* @function
*/
comGkSoftwareGkrAppEnablementApi.Common.prototype.hideBrowser = function () {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "hideBrowser", "", "");
};
/**
* The internally returned object looks like the following example:
* {
* operatorID: "1",
* workerID: "1",
* salutation: "Herr",
* firstName: "Max",
* lastName: "Mustermann",
* rightsSet: ["S.00000000001.00","S.00000000001.01"],
* }
* @summary This function will provide operator data. For example operatorID, name, rights.
*
* @author nmankel (Last modified by: nmankel)
* @since 2.1.0
* @name com.gk_software.gkr.app_enablement.api.Common.getOperatorData
* @param {string} sResultFunction
* Name of the success callback function. Data type is string but internal data type is function.
* @param {string} sErrorFunction
* Name of the error callback function. Data type is string but internal data type is function.
* @function
*/
comGkSoftwareGkrAppEnablementApi.Common.prototype.getOperatorData = function (sResultFunction, sErrorFunction) {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "getOperatorData", sResultFunction, sErrorFunction);
};
+200
View File
@@ -0,0 +1,200 @@
/*global oAppEnablementConnectorInstance*/
// Shorthand syntax to check if the namespace already exists, if not create an empty Object.
var comGkSoftwareGkrAppEnablementApi = comGkSoftwareGkrAppEnablementApi || {};
/**
* @class
* @classdesc App Enablement class for all functionalities related to external masterdata like searching,
* registering external items and to grab the image url from external webshops.
* @author mluzius
* @since 2.0.0
* @public
* @name com.gk_software.gkr.app_enablement.api.ExternalMasterdata
*/
comGkSoftwareGkrAppEnablementApi.ExternalMasterdata = function () {
"use strict";
this._prefix = "comGkSoftwareGkrAppEnablementApi.ExternalMasterdata/";
};
/**
* @summary This function will create a request object for the function 'getItemByCriteria'.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.ExternalMasterdata.createGetItemByCriteriaRequest
* @param {string} sItemID
* Item ID to get the item information for external items.
* @param {string} oContext
* Provides the session context. For example currency, language. Data type is string but internal
* data type is Object.
* The internally used object should look like the following example:
* {
* businessUnitGroupID: "100000000000000001",
* businessUnitID: "9090", // Equivalent to store ID
* isoCurrencyCode: "USD",
* storeLanguage: "en_US",
* tenantID: "004",
* userLanguage: "zh_CN",
* workstationID: "107"
* }
* @function
* @returns (String) Returns a stringified Object for the getItemByCriteria request.
*/
comGkSoftwareGkrAppEnablementApi.ExternalMasterdata.prototype.createGetItemByCriteriaRequest = function (sItemID, oContext) {
return JSON.stringify({
"itemID": sItemID,
"language": (oContext && oContext.userLanguage) ? oContext.userLanguage : null,
"isoCurrencyCode": (oContext && oContext.isoCurrencyCode) ? oContext.isoCurrencyCode : null
});
};
/**
* @summary This function will provide external item information for a given item ID.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.ExternalMasterdata.getItemByCriteria
* @param {string} sResultFunction
* Name of the success callback function. Data type is string but internal data type is function.
* @param {string} sErrorFunction
* Name of the error callback function. Data type is string but internal data type is function.
* @param {string} oGetItemByCriteriaRequest
* Stringified Object from the createGetItemByCriteriaRequest.
* Data type is string but internal
* data type is Object.
* The internally used object should look like the following example:
* {
* itemID: "030039",
* language: "en_US",
* isoCurrencyCode: "USD"
* }
* @function
*/
comGkSoftwareGkrAppEnablementApi.ExternalMasterdata.prototype.getItemByCriteria = function (sResultFunction, sErrorFunction, oGetItemByCriteriaRequest) {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "getItemByCriteria", sResultFunction, sErrorFunction, oGetItemByCriteriaRequest);
};
/**
* @summary This function will create a request object for the function 'getItemListBySearchCriteria'.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.ExternalMasterdata.createGetItemByCriteriaRequest
* @param {string} sSearchQuery
* The string that is used to search external items.
* @param {number} iRecordCount
* Determines the maximum count of items that should be displayed per page.
* @param {string} oContext
* Provides the session context. For example currency, language. Data type is string but internal
* data type is Object.
* The internally used object should look like the following example:
* {
* businessUnitGroupID: "100000000000000001",
* businessUnitID: "9090", // Equivalent to store ID
* isoCurrencyCode: "USD",
* storeLanguage: "en_US",
* tenantID: "004",
* userLanguage: "zh_CN",
* workstationID: "107"
* }
* @function
* @returns (String) Returns a stringified Object for the getItemListBySearchCriteria request.
*/
comGkSoftwareGkrAppEnablementApi.ExternalMasterdata.prototype.createGetItemListBySearchCriteriaRequest = function (sSearchQuery, iRecordCount, oContext) {
return JSON.stringify({
"query": (sSearchQuery && sSearchQuery !== "") ? sSearchQuery : "",
"language": (oContext && oContext.userLanguage) ? oContext.userLanguage : null,
"isoCurrencyCode": (oContext && oContext.isoCurrencyCode) ? oContext.isoCurrencyCode : null,
"recordCount": iRecordCount
});
};
/**
* @summary This function will provide a list of external items that you searched for.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.ExternalMasterdata.getItemListBySearchCriteria
* @param {string} sResultFunction
* Name of the success callback function. Data type is string but internal data type is function.
* @param {string} sErrorFunction
* Name of the error callback function. Data type is string but internal data type is function.
* @param {string} oGetItemListBySearchCriteriaRequest
* Stringified Object from the createGetItemListBySearchCriteriaRequest.
* Data type is string but internal data type is Object.
* The internally used object should look like the following example:
* {
* query: "camera",
* language: "en_US",
* isoCurrencyCode: "USD",
* recordCount: 60
* }
* @function
*/
comGkSoftwareGkrAppEnablementApi.ExternalMasterdata.prototype.getItemListBySearchCriteria = function (sResultFunction, sErrorFunction, oGetItemListBySearchCriteriaRequest) {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "getItemListBySearchCriteria", sResultFunction, sErrorFunction, oGetItemListBySearchCriteriaRequest);
};
/**
* @summary This function will create a request object for the function 'getImageUrl'.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.ExternalMasterdata.createGetExternalImageUrlRequest
* @param {string} sItemID
* The string that is used to search external items.
* @param {string} oContext
* Provides the session context. For example currency, language. Data type is string but internal
* data type is Object.
* The internally used object should look like the following example:
* {
* businessUnitGroupID: "100000000000000001",
* businessUnitID: "9090", // Equivalent to store ID
* isoCurrencyCode: "USD",
* storeLanguage: "en_US",
* tenantID: "004",
* userLanguage: "zh_CN",
* workstationID: "107"
* }
* @function
* @returns (String) Returns a stringified Object for the getImageUrl request.
*/
comGkSoftwareGkrAppEnablementApi.ExternalMasterdata.prototype.createGetExternalImageUrlRequest = function (sItemID, oContext) {
return JSON.stringify({
"itemID": sItemID,
"type": "item",
"language": (oContext && oContext.userLanguage) ? oContext.userLanguage : null,
"isoCurrencyCode": (oContext && oContext.isoCurrencyCode) ? oContext.isoCurrencyCode : null
});
};
/**
* @summary This function will provide an image URL for external items.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.ExternalMasterdata.getImageUrl
* @param {string} sResultFunction
* Name of the success callback function. Data type is string but internal data type is function.
* @param {string} sErrorFunction
* Name of the error callback function. Data type is string but internal data type is function.
* @param {string} oGetExternalImageUrlRequest
* Stringified Object from the createGetExternalImageUrlRequest.
* Data type is string but internal data type is Object.
* The internally used object should look like the following example:
* {
* itemID: "030039",
* type: "item",
* language: "en_US",
* isoCurrencyCode: "USD"
* }
* @function
*/
comGkSoftwareGkrAppEnablementApi.ExternalMasterdata.prototype.getImageUrl = function (sResultFunction, sErrorFunction, oGetExternalImageUrlRequest) {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "getImageUrl", sResultFunction, sErrorFunction, oGetExternalImageUrlRequest);
};
+145
View File
@@ -0,0 +1,145 @@
/*global oAppEnablementConnectorInstance*/
// Shorthand syntax to check if the namespace already exists, if not create an empty Object.
var comGkSoftwareGkrAppEnablementApi = comGkSoftwareGkrAppEnablementApi || {};
/**
* @class
* @classdesc App Enablement class for all functionalities related to GK masterdata like getting single item
* information, get item list by id list and to grab the image url from Digital Signage Server.
* @author mluzius
* @since 2.0.0
* @public
* @name com.gk_software.gkr.app_enablement.api.Masterdata
*/
comGkSoftwareGkrAppEnablementApi.Masterdata = function () {
"use strict";
this._prefix = "comGkSoftwareGkrAppEnablementApi.Masterdata/";
};
/**
* @summary This function will create a request object for the function 'getItemDataByID'.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.Masterdata.createGetItemDataByIDRequest
* @param {string} sItemID
* Item ID to get the item information for GK masterdata items.
* @function
* @returns (String) Returns a stringified Object for the getItemDataByID request.
*/
comGkSoftwareGkrAppEnablementApi.Masterdata.prototype.createGetItemDataByIDRequest = function (sItemID) {
return JSON.stringify({
"itemID": sItemID
});
};
/**
* @summary This function will provide GK masterdata item information for a given item ID.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.Masterdata.getItemDataByID
* @param {string} sResultFunction
* Name of the success callback function. Data type is string but internal data type is function.
* @param {string} sErrorFunction
* Name of the error callback function. Data type is string but internal data type is function.
* @param {string} oGetItemDataByIDRequest
* Stringified Object from the createGetItemDataByIDRequest.
* Data type is string but internal
* data type is Object.
* The internally used object should look like the following example:
* {
* itemID: "030039"
* }
* @function
*/
comGkSoftwareGkrAppEnablementApi.Masterdata.prototype.getItemDataByID = function (sResultFunction, sErrorFunction, oGetItemDataByIDRequest) {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "getItemDataByID", sResultFunction, sErrorFunction, oGetItemDataByIDRequest);
};
/**
* @summary This function will create a request object for the function 'getItemDataListByIDList'.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.Masterdata.createGetItemDataListByIDListRequest
* @param {Array} aItemIDList
* Array of item IDs to get the item information for GK masterdata items.
* @function
* @returns (String) Returns a stringified Object for the getItemDataListByIDList request.
*/
comGkSoftwareGkrAppEnablementApi.Masterdata.prototype.createGetItemDataListByIDListRequest = function (aItemIDList) {
return JSON.stringify({
"itemIDList": aItemIDList
});
};
/**
* @summary This function will provide an array of GK masterdata items with their information for a given item ID list.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.Masterdata.getItemDataListByIDList
* @param {string} sResultFunction
* Name of the success callback function. Data type is string but internal data type is function.
* @param {string} sErrorFunction
* Name of the error callback function. Data type is string but internal data type is function.
* @param {string} oGetItemDataListByIDListRequest
* Stringified Object from the createGetItemDataListByIDListRequest.
* Data type is string but internal data type is Object.
* The internally used object should look like the following example:
* {
* itemIDList: ["03039", "65005", "65007"]
* }
* @function
*/
comGkSoftwareGkrAppEnablementApi.Masterdata.prototype.getItemDataListByIDList = function (sResultFunction, sErrorFunction, oGetItemDataListByIDListRequest) {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "getItemDataListByIDList", sResultFunction, sErrorFunction, oGetItemDataListByIDListRequest);
};
/**
* @summary This function will create a request object for the function 'getImageUrl'.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.Masterdata.createGetImageUrlRequest
* @param {string} sItemID
* Item ID to get the item image url for a GK masterdata item.
* @function
* @returns (String) Returns a stringified Object for the getImageUrl request.
*/
comGkSoftwareGkrAppEnablementApi.Masterdata.prototype.createGetImageUrlRequest = function (sItemID) {
return JSON.stringify({
"itemID": sItemID,
"type": "item"
});
};
/**
* @summary This function will provide an image url via an item ID and the Digital Signage Server.
*
* @author mluzius (Last modified by: mluzius)
* @since 2.0.0
* @name com.gk_software.gkr.app_enablement.api.Masterdata.getImageUrl
* @param {string} sResultFunction
* Name of the success callback function. Data type is string but internal data type is function.
* @param {string} sErrorFunction
* Name of the error callback function. Data type is string but internal data type is function.
* @param {string} oCreateGetImageUrlRequest
* Stringified Object from the createGetImageUrlRequest.
* Data type is string but internal data type is Object.
* The internally used object should look like the following example:
* {
* itemID: "03039",
* type: "item"
* }
* @function
*/
comGkSoftwareGkrAppEnablementApi.Masterdata.prototype.getImageUrl = function (sResultFunction, sErrorFunction, oCreateGetImageUrlRequest) {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "getImageUrl", sResultFunction, sErrorFunction, oCreateGetImageUrlRequest);
};
+1061
View File
File diff suppressed because it is too large Load Diff
+61
View File
@@ -0,0 +1,61 @@
// Shorthand syntax to check if the namespace already exists, if not create an empty Object.
var comGkSoftwareGkrAppEnablementApi = comGkSoftwareGkrAppEnablementApi || {};
comGkSoftwareGkrAppEnablementApi.Pos_EXT = function () {
"use strict";
this._prefix = "comGkSoftwareGkrAppEnablementApi.Pos_EXT/";
};
/**
* @summary This function sets the emailRequestedFlag, emailAddressLocalPart and emailAddressDomainPart
* of the current retailTransaction.
*
* @author jsousa
* @name com.gk_software.gkr.app_enablement.api.Pos_EXT.receiptAsEmail
* @function
*/
comGkSoftwareGkrAppEnablementApi.Pos_EXT.prototype.receiptAsEmail = function (sResultFunction, sErrorFunction, oReceiptAsEmailRequest) {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "receiptAsEmail", sResultFunction, sErrorFunction, oReceiptAsEmailRequest);
};
/**
* @summary This function will create a sub-request object for the function 'receiptAsEmail'.
*
* @author jsousa
* @name com.gk_software.gkr.app_enablement.api.Pos_EXT.createReceiptAsEmailRequest
* @param {boolean} eReceiptFlag
* @param {string} emailAddress
* @returns (String) Returns a stringified object of com.gk_software.cst.pos.ui.app_enablement.ReceiptAsEmailRequest.
*/
comGkSoftwareGkrAppEnablementApi.Pos_EXT.prototype.createReceiptAsEmailRequest = function (eReceiptFlag, emailAddress) {
return JSON.stringify({
"ereceiptFlag": eReceiptFlag,
"emailAddress": emailAddress
});
};
/**
* @summary This function will invoke function to register multiple external lineitems by one single call
*
* @author jdanisik
*
* @param {string} oRegisterExternalLineItemListRequest
*/
comGkSoftwareGkrAppEnablementApi.Pos_EXT.prototype.registerExternalLineItemList = function (sResultFunction, sErrorFunction, oRegisterExternalLineItemListRequest) {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "registerExternalLineItemList", sResultFunction, sErrorFunction, oRegisterExternalLineItemListRequest);
};
/**
* @summary This function creates a transaction discount for Tommy 4 life
*
* @author mkuda
*
* @param {string} oTradeInRequest
*/
comGkSoftwareGkrAppEnablementApi.Pos_EXT.prototype.createTradeVoucherRequest = function (sResultFunction, sErrorFunction, oTradeInRequest) {
oAppEnablementConnectorInstance.invokeMethod(this._prefix + "createTradeVoucherRequest", sResultFunction, sErrorFunction, oTradeInRequest);
};