@resconet/jsbridge 18.0.0-beta.1 → 18.0.0-beta.3
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 +16 -3
- package/src/JSBridge.js +81 -12
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.
|
|
@@ -1233,10 +1240,10 @@ declare module MobileCRM.FetchXml {
|
|
|
1233
1240
|
* @param target The target entity.
|
|
1234
1241
|
* @param from The "from" field (if parent then target entity primary key).
|
|
1235
1242
|
* @param to The "to" field.
|
|
1236
|
-
* @param
|
|
1243
|
+
* @param linktype The link (join) type ("inner" or "outer").
|
|
1237
1244
|
* @returns MobileCRM.FetchXml.LinkEntity
|
|
1238
1245
|
*/
|
|
1239
|
-
addLink(target: string, from: string, to: string,
|
|
1246
|
+
addLink(target: string, from: string, to: string, linktype: string): MobileCRM.FetchXml.LinkEntity;
|
|
1240
1247
|
removeLink(link: MobileCRM.FetchXml.LinkEntity): void;
|
|
1241
1248
|
/**
|
|
1242
1249
|
* Adds a filter for this fetch entity.
|
|
@@ -1290,7 +1297,7 @@ declare module MobileCRM.FetchXml {
|
|
|
1290
1297
|
from?: string,
|
|
1291
1298
|
to?: string,
|
|
1292
1299
|
alias?: string,
|
|
1293
|
-
|
|
1300
|
+
linktype?: string
|
|
1294
1301
|
);
|
|
1295
1302
|
|
|
1296
1303
|
from: string;
|
|
@@ -1452,6 +1459,12 @@ 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 setPower: (power: number, success: (result: string) => void, failed?: (err: string) => void, scope?: any) => void;
|
|
1465
|
+
static setVolume: (volume: number, success: (result: string) => void, failed?: (err: string) => void, scope?: any) => void;
|
|
1466
|
+
static onScan: (handler: (tags: string[]) => void, bind: boolean, scope?: any) => void;
|
|
1467
|
+
}
|
|
1455
1468
|
class DocumentService {
|
|
1456
1469
|
/**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
1470
|
maxImageSize: string;
|
package/src/JSBridge.js
CHANGED
|
@@ -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
|
},
|
|
@@ -456,7 +456,7 @@
|
|
|
456
456
|
this.filter = filter ? filter : null;
|
|
457
457
|
this.linkentities = linkentities ? linkentities : [];
|
|
458
458
|
},
|
|
459
|
-
LinkEntity: function (name, attributes, order, filter, linkentities, from, to, alias,
|
|
459
|
+
LinkEntity: function (name, attributes, order, filter, linkentities, from, to, alias, linktype) {
|
|
460
460
|
/// <summary>Represents a FetchXml query linked entity.</summary>
|
|
461
461
|
/// <remarks>This object is derived from <see cref="MobileCRM.FetchXml.Entity">MobileCRM.FetchXml.Entity</see></remarks>
|
|
462
462
|
/// <param name="name" type="String">An entity name</param>
|
|
@@ -474,8 +474,8 @@
|
|
|
474
474
|
if (alias) {
|
|
475
475
|
this.alias = alias;
|
|
476
476
|
}
|
|
477
|
-
if (
|
|
478
|
-
this.linktype =
|
|
477
|
+
if (linktype) {
|
|
478
|
+
this.linktype = linktype;
|
|
479
479
|
}
|
|
480
480
|
},
|
|
481
481
|
Attribute: function (name, alias, aggregate, groupBy, dateGrouping) {
|
|
@@ -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,64 @@
|
|
|
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.setPower = function (power, successCallback, errorCallback, scope) {
|
|
1214
|
+
/// <summary>Set power of antenna the Zebra scanner.</summary>
|
|
1215
|
+
/// <param name="power" type="Number">The power of the scanner.</param>
|
|
1216
|
+
/// <param name="successCallback" type="function">The callback function that is called when the connection is established.</param>
|
|
1217
|
+
/// <param name="errorCallback" type="function(errorMsg)">The errorCallback which is called in case of error.</param>
|
|
1218
|
+
/// <param name="scope" type="Object">The scope in which the callback function is called.</param>
|
|
1219
|
+
MobileCRM.bridge.command("setPower", JSON.stringify({ power: power }), successCallback, errorCallback, scope);
|
|
1220
|
+
};
|
|
1221
|
+
|
|
1222
|
+
MobileCRM.Services.ZebraScanner.setVolume = function (volume, successCallback, errorCallback, scope) {
|
|
1223
|
+
/// <summary>Set volume of the Zebra scanner.</summary>
|
|
1224
|
+
/// <param name="volume" type="Number">The volume of the scanner.</param>
|
|
1225
|
+
/// <param name="successCallback" type="function">The callback function that is called when the connection is established.</param>
|
|
1226
|
+
/// <param name="errorCallback" type="function(errorMsg)">The errorCallback which is called in case of error.</param>
|
|
1227
|
+
/// <param name="scope" type="Object">The scope in which the callback function is called.</param>
|
|
1228
|
+
MobileCRM.bridge.command("setVolume", JSON.stringify({ volume: volume }), successCallback, errorCallback, scope);
|
|
1229
|
+
};
|
|
1230
|
+
|
|
1231
|
+
MobileCRM.Services.ZebraScanner._callHandlers = function (event, data) {
|
|
1232
|
+
/// <summary>Invokes the registered handlers for the specified event.</summary>
|
|
1233
|
+
const handlers = MobileCRM.Services.ZebraScanner._handlers[event];
|
|
1234
|
+
|
|
1235
|
+
if (handlers && handlers.length > 0) {
|
|
1236
|
+
return _callHandlers(handlers, JSON.parse(data));
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
return null;
|
|
1240
|
+
};
|
|
1241
|
+
|
|
1181
1242
|
// MobileCRM.UI._MediaTab
|
|
1182
1243
|
MobileCRM.UI.MediaTab.prototype._onCommand = function (commandIndex, errorCallback) {
|
|
1183
1244
|
/// <summary>Executes the MediaTab command by index.</summary>
|
|
@@ -2617,6 +2678,13 @@
|
|
|
2617
2678
|
/// <param name="scope" type="">A scope for calling the callbacks; set "null" to call the callbacks in global scope.</param>
|
|
2618
2679
|
_global.MobileCRM.bridge.command("fetchXML", fetchXmlData, success, failed, scope);
|
|
2619
2680
|
};
|
|
2681
|
+
MobileCRM.FetchXml.Fetch.executeFromXmlAsync = function (fetchXmlData) {
|
|
2682
|
+
/// <summary>Executes fetch XML asynchronously.</summary>
|
|
2683
|
+
/// <remarks>The format of result output is controlled by internal XML attribute "resultformat" on root fetch XML element.</remarks>
|
|
2684
|
+
/// <param name="fetchXmlData" type="String">CRM fetch in XML representation.</param>
|
|
2685
|
+
/// <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>
|
|
2686
|
+
return MobileCRM.bridge.invokeCommandPromise("fetchXML", fetchXmlData);
|
|
2687
|
+
};
|
|
2620
2688
|
MobileCRM.FetchXml.Condition._constructConditionParams = function (condition) {
|
|
2621
2689
|
if (condition) {
|
|
2622
2690
|
var conditionParams = {};
|
|
@@ -2728,21 +2796,21 @@
|
|
|
2728
2796
|
if (linkEntity.to) {
|
|
2729
2797
|
linkParams.to = linkEntity.to;
|
|
2730
2798
|
}
|
|
2731
|
-
if (linkEntity.
|
|
2732
|
-
linkParams.
|
|
2799
|
+
if (linkEntity.linktype) {
|
|
2800
|
+
linkParams.linktype = linkEntity.linktype;
|
|
2733
2801
|
}
|
|
2734
2802
|
}
|
|
2735
2803
|
return linkParams;
|
|
2736
2804
|
};
|
|
2737
2805
|
MobileCRM.FetchXml.Fetch.prototype._constructFetchParams = function () {
|
|
2738
2806
|
var reqParams = { entity: MobileCRM.FetchXml.Entity._constructEntityParams(this.entity) };
|
|
2739
|
-
if (
|
|
2807
|
+
if (this.page) {
|
|
2740
2808
|
reqParams.page = this.page;
|
|
2741
2809
|
}
|
|
2742
|
-
if (
|
|
2810
|
+
if (this.count !== undefined && this.count !== null) {
|
|
2743
2811
|
reqParams.count = this.count;
|
|
2744
2812
|
}
|
|
2745
|
-
if (
|
|
2813
|
+
if (this.aggregate !== undefined && this.aggregate !== null) {
|
|
2746
2814
|
reqParams.aggregate = this.aggregate;
|
|
2747
2815
|
}
|
|
2748
2816
|
if (this.distinct) {
|
|
@@ -2870,7 +2938,7 @@
|
|
|
2870
2938
|
/// <param name="target" type="String">The target entity.</param>
|
|
2871
2939
|
/// <param name="from" type="String">The "from" field (if parent then target entity primary key).</param>
|
|
2872
2940
|
/// <param name="to" type="String">The "to" field.</param>
|
|
2873
|
-
/// <param name="
|
|
2941
|
+
/// <param name="linktype" type="String">The link (join) type ("inner" or "outer").</param>
|
|
2874
2942
|
/// <returns type="MobileCRM.FetchXml.LinkEntity">The newly created MobileCRM.FetchXml.LinkEntity object.</returns>
|
|
2875
2943
|
var link = new MobileCRM.FetchXml.LinkEntity(target);
|
|
2876
2944
|
link.from = from;
|
|
@@ -4941,6 +5009,7 @@
|
|
|
4941
5009
|
/// <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
5010
|
MobileCRM.bridge.command(this._chunkReadyCmdId, JSON.stringify(entities));
|
|
4943
5011
|
};
|
|
5012
|
+
MobileCRM.Services.ZebraScanner._handlers = { onScan: [] };
|
|
4944
5013
|
// MobileCRM.UI.QuestionnaireForm
|
|
4945
5014
|
_inherit(MobileCRM.UI.QuestionnaireForm, MobileCRM.ObservableObject);
|
|
4946
5015
|
MobileCRM.UI.QuestionnaireForm._handlers = { onChange: [], onSave: [], onPostSave: [], onRepeatGroup: [], onDeleteGroup: [] };
|