@resconet/jsbridge 17.2.1 → 18.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/JSBridge.d.ts +26 -1
- package/src/JSBridge.js +72 -7
package/package.json
CHANGED
package/src/JSBridge.d.ts
CHANGED
|
@@ -1114,6 +1114,13 @@ declare module MobileCRM.FetchXml {
|
|
|
1114
1114
|
* @param scope A scope for calling the callbacks. Set to call the callbacks in global scope.
|
|
1115
1115
|
*/
|
|
1116
1116
|
public static executeFromXML(fetchXmlData: string, success: (res: any[]) => void, failed?: (error: string) => void, scope?: any);
|
|
1117
|
+
/**
|
|
1118
|
+
* Executes fetch XML asynchronously.
|
|
1119
|
+
* The format of result output is controlled by internal XML attribute "resultformat" on root fetch XML element.
|
|
1120
|
+
* @param fetchXmlData CRM fetch in XML representation.
|
|
1121
|
+
* @returns A promise object fulfilled with the array of objects having type specified by resultformat XML attribute (Array, JSON, XML or DynamicEntities).
|
|
1122
|
+
*/
|
|
1123
|
+
public static executeFromXmlAsync(fetchXmlData: string): Promise<any[]>;
|
|
1117
1124
|
/**
|
|
1118
1125
|
* @since 10.0
|
|
1119
1126
|
* Deserializes XML to the Fetch object.
|
|
@@ -1452,6 +1459,10 @@ declare module MobileCRM.Services {
|
|
|
1452
1459
|
mimeType: string;
|
|
1453
1460
|
nextInfo: FileInfo;
|
|
1454
1461
|
}
|
|
1462
|
+
class ZebraScanner {
|
|
1463
|
+
static connect: (success: (result: string) => void, failed?: (err: string) => void, scope?: any) => void;
|
|
1464
|
+
static onScan: (handler: (questionnaireForm: QuestionnaireForm) => void, bind: boolean, scope?: any) => void;
|
|
1465
|
+
}
|
|
1455
1466
|
class DocumentService {
|
|
1456
1467
|
/**Gets or sets the maximum captured image size. If captured image size is greater, the image is resized to specified maximum size. [640x480,1024x768,1600x1200,2048x1536,2592x1936].*/
|
|
1457
1468
|
maxImageSize: string;
|
|
@@ -2128,7 +2139,21 @@ declare module MobileCRM.UI {
|
|
|
2128
2139
|
*/
|
|
2129
2140
|
public static openSalesEntityDetail(detail: MobileCRM.DynamicEntity, errorCallback: (err?: string) => void);
|
|
2130
2141
|
/**
|
|
2131
|
-
* @
|
|
2142
|
+
* @since 18.0
|
|
2143
|
+
* The clearance must be dutifully released using leaveUiTransaction() when manipulation is finished.
|
|
2144
|
+
* The clearance will not be obtained if background sync is running and form sync behavior is configured to 'Block save during sync'
|
|
2145
|
+
* or 'Block save during sync and prevent sync while form is open'".
|
|
2146
|
+
* If form sync behavior is configured as 'No action', the clearance is always obtained.
|
|
2147
|
+
* @returns true if form can give the clearance, false if it is not possible at this time.
|
|
2148
|
+
*/
|
|
2149
|
+
public static tryEnterUiTransaction(): Promise<boolean>;
|
|
2150
|
+
/**
|
|
2151
|
+
* @since 18.0
|
|
2152
|
+
* Notifies UI form that clearance obtained using successful call to tryEnterUiTransaction() is no longer needed, because data manipulation is complete.
|
|
2153
|
+
*/
|
|
2154
|
+
public static leaveUiTransaction(): Promise;
|
|
2155
|
+
/**
|
|
2156
|
+
* @since 9.3
|
|
2132
2157
|
* Binds or unbinds the handler for onSelectedViewChanged event on EntityForm.
|
|
2133
2158
|
* @description Bound handler is called with the EntityForm object as an argument. The EntityForm context object contains 'selectedView' property with the name of currently selected view.
|
|
2134
2159
|
* @param handler The handler function that has to be bound or unbound.
|
package/src/JSBridge.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-this-alias */
|
|
2
2
|
/* globals MobileCRM:writable, MobileCrmException:writable, CrmBridge, webkit, chrome */
|
|
3
3
|
(function () {
|
|
4
|
-
var _scriptVersion =
|
|
4
|
+
var _scriptVersion = 18.0;
|
|
5
5
|
// Private objects & functions
|
|
6
6
|
var _inherit = (function () {
|
|
7
7
|
function _() {
|
|
@@ -420,14 +420,14 @@
|
|
|
420
420
|
if (entity) {
|
|
421
421
|
this.entity = entity;
|
|
422
422
|
}
|
|
423
|
-
if (
|
|
423
|
+
if (count !== undefined && count !== null) {
|
|
424
424
|
this.count = count;
|
|
425
425
|
}
|
|
426
|
-
if (
|
|
426
|
+
if (page) {
|
|
427
427
|
this.page = page;
|
|
428
428
|
}
|
|
429
429
|
this.aggregate = !!aggregate;
|
|
430
|
-
if (
|
|
430
|
+
if (distinct !== undefined && distinct !== null) {
|
|
431
431
|
this.distinct = distinct;
|
|
432
432
|
}
|
|
433
433
|
},
|
|
@@ -990,6 +990,9 @@
|
|
|
990
990
|
},
|
|
991
991
|
},
|
|
992
992
|
Services: {
|
|
993
|
+
ZebraScanner: function () {
|
|
994
|
+
/// <summary>Represents a service for scanning barcodes using Zebra scanner.</summary>
|
|
995
|
+
},
|
|
993
996
|
FileInfo: function (filePath, url, mimeType, nextInfo) {
|
|
994
997
|
/// <summary>Carries the result of a DocumentService operation.</summary>
|
|
995
998
|
/// <remarks>In case of canceled document service operation, all properties in this object will be set to "null".</remarks>
|
|
@@ -1178,6 +1181,46 @@
|
|
|
1178
1181
|
return typeof result == "string" ? result : JSON.stringify(result);
|
|
1179
1182
|
}
|
|
1180
1183
|
};
|
|
1184
|
+
|
|
1185
|
+
MobileCRM.Services.ZebraScanner.onScan = function (handler, bind, scope) {
|
|
1186
|
+
/// <summary>Registers the handler for the scan event.</summary>
|
|
1187
|
+
/// <param name="handler" type="function(data)">The handler function that is called when the scan event is raised.</param>
|
|
1188
|
+
/// <param name="bind" type="Boolean">Indicates whether to bind the handler to the event.</param>
|
|
1189
|
+
/// <param name="scope" type="Object">The scope in which the handler function is called.</param>
|
|
1190
|
+
let handlerName = "onScan";
|
|
1191
|
+
let handlers = MobileCRM.Services.ZebraScanner._handlers[handlerName];
|
|
1192
|
+
|
|
1193
|
+
if (!handlers) {
|
|
1194
|
+
MobileCRM.Services.ZebraScanner._handlers[handlerName] = handlers = [];
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
const register = handlers.length == 0;
|
|
1198
|
+
_bindHandler(handler, handlers, bind, scope);
|
|
1199
|
+
|
|
1200
|
+
if (register) {
|
|
1201
|
+
MobileCRM.bridge.command("registerEvents", handlerName);
|
|
1202
|
+
}
|
|
1203
|
+
};
|
|
1204
|
+
|
|
1205
|
+
MobileCRM.Services.ZebraScanner.connect = function (successCallback, errorCallback, scope) {
|
|
1206
|
+
/// <summary>Connects to the Zebra scanner.</summary>
|
|
1207
|
+
/// <param name="successCallback" type="function">The callback function that is called when the connection is established.</param>
|
|
1208
|
+
/// <param name="errorCallback" type="function(errorMsg)">The errorCallback which is called in case of error.</param>
|
|
1209
|
+
/// <param name="scope" type="Object">The scope in which the callback function is called.</param>
|
|
1210
|
+
MobileCRM.bridge.command("initZebra", null, successCallback, errorCallback, scope);
|
|
1211
|
+
};
|
|
1212
|
+
|
|
1213
|
+
MobileCRM.Services.ZebraScanner._callHandlers = function (event, data) {
|
|
1214
|
+
/// <summary>Invokes the registered handlers for the specified event.</summary>
|
|
1215
|
+
const handlers = MobileCRM.Services.ZebraScanner._handlers[event];
|
|
1216
|
+
|
|
1217
|
+
if (handlers && handlers.length > 0) {
|
|
1218
|
+
return _callHandlers(handlers, data);
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
return null;
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1181
1224
|
// MobileCRM.UI._MediaTab
|
|
1182
1225
|
MobileCRM.UI.MediaTab.prototype._onCommand = function (commandIndex, errorCallback) {
|
|
1183
1226
|
/// <summary>Executes the MediaTab command by index.</summary>
|
|
@@ -2617,6 +2660,13 @@
|
|
|
2617
2660
|
/// <param name="scope" type="">A scope for calling the callbacks; set "null" to call the callbacks in global scope.</param>
|
|
2618
2661
|
_global.MobileCRM.bridge.command("fetchXML", fetchXmlData, success, failed, scope);
|
|
2619
2662
|
};
|
|
2663
|
+
MobileCRM.FetchXml.Fetch.executeFromXmlAsync = function (fetchXmlData) {
|
|
2664
|
+
/// <summary>Executes fetch XML asynchronously.</summary>
|
|
2665
|
+
/// <remarks>The format of result output is controlled by internal XML attribute "resultformat" on root fetch XML element.</remarks>
|
|
2666
|
+
/// <param name="fetchXmlData" type="String">CRM fetch in XML representation.</param>
|
|
2667
|
+
/// <returns type="Promise">A promise object fulfilled with the array of objects having type specified by resultformat XML attribute (Array, JSON, XML or DynamicEntities).</returns>
|
|
2668
|
+
return MobileCRM.bridge.invokeCommandPromise("fetchXML", fetchXmlData);
|
|
2669
|
+
};
|
|
2620
2670
|
MobileCRM.FetchXml.Condition._constructConditionParams = function (condition) {
|
|
2621
2671
|
if (condition) {
|
|
2622
2672
|
var conditionParams = {};
|
|
@@ -2736,13 +2786,13 @@
|
|
|
2736
2786
|
};
|
|
2737
2787
|
MobileCRM.FetchXml.Fetch.prototype._constructFetchParams = function () {
|
|
2738
2788
|
var reqParams = { entity: MobileCRM.FetchXml.Entity._constructEntityParams(this.entity) };
|
|
2739
|
-
if (
|
|
2789
|
+
if (this.page) {
|
|
2740
2790
|
reqParams.page = this.page;
|
|
2741
2791
|
}
|
|
2742
|
-
if (
|
|
2792
|
+
if (this.count !== undefined && this.count !== null) {
|
|
2743
2793
|
reqParams.count = this.count;
|
|
2744
2794
|
}
|
|
2745
|
-
if (
|
|
2795
|
+
if (this.aggregate !== undefined && this.aggregate !== null) {
|
|
2746
2796
|
reqParams.aggregate = this.aggregate;
|
|
2747
2797
|
}
|
|
2748
2798
|
if (this.distinct) {
|
|
@@ -4941,6 +4991,7 @@
|
|
|
4941
4991
|
/// <param name="entities" type="Array[MobileCRM.DynamicEntity]">A chunk (array) of <see cref="MobileCRM.DynamicEntity">DynamicEntities</see> that has to be passed back to the native code to fill in to the list view.</param>
|
|
4942
4992
|
MobileCRM.bridge.command(this._chunkReadyCmdId, JSON.stringify(entities));
|
|
4943
4993
|
};
|
|
4994
|
+
MobileCRM.Services.ZebraScanner._handlers = { onScan: [] };
|
|
4944
4995
|
// MobileCRM.UI.QuestionnaireForm
|
|
4945
4996
|
_inherit(MobileCRM.UI.QuestionnaireForm, MobileCRM.ObservableObject);
|
|
4946
4997
|
MobileCRM.UI.QuestionnaireForm._handlers = { onChange: [], onSave: [], onPostSave: [], onRepeatGroup: [], onDeleteGroup: [] };
|
|
@@ -5761,6 +5812,20 @@
|
|
|
5761
5812
|
/// <param name="errorCallback" type="function(errorMsg)">The errorCallback which is called asynchronously in case of error.</param>
|
|
5762
5813
|
MobileCRM.bridge.invokeMethodAsync("EntityForm", "ShowEntityDetailDialog", [detail.id], null, errorCallback, null);
|
|
5763
5814
|
};
|
|
5815
|
+
/// <summary>[v18.0] Obtains a clearance to perform manipulation with data.
|
|
5816
|
+
/// The clearance must be dutifully released using leaveUiTransaction() when manipulation is finished.
|
|
5817
|
+
/// The clearance will not be obtained if background sync is running and form sync behavior is configured to 'Block save during sync'
|
|
5818
|
+
/// or 'Block save during sync and prevent sync while form is open'".
|
|
5819
|
+
/// If form sync behavior is configured as 'No action', the clearance is always obtained.
|
|
5820
|
+
/// </summary>
|
|
5821
|
+
/// <returns>Returns true if form can give the clearance, false if it is not possible at this time.</returns>
|
|
5822
|
+
MobileCRM.UI.EntityForm.tryEnterUiTransaction = function () {
|
|
5823
|
+
return MobileCRM.bridge.invokeCommandPromise("tryEnterUiTransaction");
|
|
5824
|
+
};
|
|
5825
|
+
/// <summary>[v18.0] Notifies UI form that clearance obtained using successful call to tryEnterUiTransaction() is no longer needed, because data manipulation is complete.</summary>
|
|
5826
|
+
MobileCRM.UI.EntityForm.leaveUiTransaction = function () {
|
|
5827
|
+
return MobileCRM.bridge.invokeCommandPromise("leaveUiTransaction");
|
|
5828
|
+
};
|
|
5764
5829
|
// MobileCRM.UI.EntityForm.DetailCollection
|
|
5765
5830
|
MobileCRM.UI.EntityForm.DetailCollection = function () {
|
|
5766
5831
|
/// <summary>Provides functions accessing the collection of the sales entity details (e.g. Order details)</summary>
|