@resconet/jsbridge 17.1.0-beta.1 → 17.1.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 +41 -1
- package/src/JSBridge.js +65 -6
- package/src/README.md +45 -22
package/package.json
CHANGED
package/src/JSBridge.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
// JSBridge.js TypeScript definition file
|
|
2
2
|
// (c) 2023 Resco
|
|
3
3
|
|
|
4
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
5
|
+
/* eslint-disable @typescript-eslint/prefer-namespace-keyword */
|
|
6
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
7
|
+
/* eslint-disable no-var */
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
9
|
+
|
|
4
10
|
declare namespace MobileCRM {
|
|
5
11
|
class Size {
|
|
6
12
|
width: string;
|
|
@@ -1588,6 +1594,40 @@ declare module MobileCRM.Services {
|
|
|
1588
1594
|
responseText: string;
|
|
1589
1595
|
responseType: string;
|
|
1590
1596
|
}
|
|
1597
|
+
|
|
1598
|
+
class GeoFencingService {
|
|
1599
|
+
/** Indicates whether the service is active. */
|
|
1600
|
+
isEnabled: boolean;
|
|
1601
|
+
/** Indicates whether the events should be delivered realtime using Resco forwarding service.*/
|
|
1602
|
+
realtimeFlushing: boolean;
|
|
1603
|
+
/** Defines logging verbosity (0=Normal, 1=Diagnostic, -1=None) */
|
|
1604
|
+
logLevel: number;
|
|
1605
|
+
/** Defines event mask for showing notifications (0=None, 1=WhenArrived, 2=WhenExited, 3=Always) */
|
|
1606
|
+
notificationMask: number;
|
|
1607
|
+
/** Business hours interval (default value is '9:00-17:00') */
|
|
1608
|
+
businessHours: string;
|
|
1609
|
+
/** Business days mask (the lowest bit is Sunday, the next Monday, ...) */
|
|
1610
|
+
businessDaysMask: number;
|
|
1611
|
+
|
|
1612
|
+
updateGeoFences(records: GeoFenceRecord[]);
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
interface GeoFenceRecord {
|
|
1616
|
+
/** Defines numeric mask for geo fence events (Enter = 1, Exit = 2, Both = 3).*/
|
|
1617
|
+
eventTypeMask: number;
|
|
1618
|
+
/** Unique id of geo-fence record. If it is associated with some entity record, it must have form logicalname:id (e.g. appointment:4595AA3E-9873-4DC4-B723-C94DE27B82BE).*/
|
|
1619
|
+
id: string;
|
|
1620
|
+
/** Human-readable name of record used for notifications.*/
|
|
1621
|
+
name: string;
|
|
1622
|
+
/** Latitude of geo-fence center.*/
|
|
1623
|
+
latitude: number;
|
|
1624
|
+
/** Longitude of geo-fence center.*/
|
|
1625
|
+
longitude: number;
|
|
1626
|
+
/** Geo-fence radius in meters.*/
|
|
1627
|
+
radius: number;
|
|
1628
|
+
/** Geo-fence expiration in seconds.*/
|
|
1629
|
+
expiration: number;
|
|
1630
|
+
}
|
|
1591
1631
|
}
|
|
1592
1632
|
declare module MobileCRM.Services.AddressBookService {
|
|
1593
1633
|
class AddressBookRecord {
|
|
@@ -2776,9 +2816,9 @@ declare module MobileCRM.UI {
|
|
|
2776
2816
|
|
|
2777
2817
|
addView(entityName: string, viewName: string, isDefault?: boolean);
|
|
2778
2818
|
addEntityFilter(entityName: string, filterXML: string);
|
|
2819
|
+
addEntityFilter(entityName: string, filterXml);
|
|
2779
2820
|
show(success: (obj?: MobileCRM.Reference) => void, failed?: (err: string) => void, scope?: any);
|
|
2780
2821
|
showAsync(): Promise<Reference>;
|
|
2781
|
-
addEntityFilter(entityName: string, filterXml);
|
|
2782
2822
|
}
|
|
2783
2823
|
|
|
2784
2824
|
class MultiLookupForm {
|
package/src/JSBridge.js
CHANGED
|
@@ -156,8 +156,10 @@
|
|
|
156
156
|
}
|
|
157
157
|
};
|
|
158
158
|
};
|
|
159
|
+
var _global = typeof window == "undefined" ? global : window;
|
|
160
|
+
var MobileCrmException = _global.MobileCrmException;
|
|
159
161
|
if (typeof MobileCrmException === "undefined") {
|
|
160
|
-
MobileCrmException = function (msg) {
|
|
162
|
+
_global.MobileCrmException = MobileCrmException = function (msg) {
|
|
161
163
|
this.message = msg;
|
|
162
164
|
this.name = "MobileCrmException";
|
|
163
165
|
};
|
|
@@ -169,8 +171,9 @@
|
|
|
169
171
|
return "message" in err ? err.message : "Message" in err ? err.Message : err.toString();
|
|
170
172
|
}
|
|
171
173
|
// MobileCRM object definition
|
|
174
|
+
var MobileCRM = _global.MobileCRM;
|
|
172
175
|
if (typeof MobileCRM === "undefined") {
|
|
173
|
-
MobileCRM = {
|
|
176
|
+
_global.MobileCRM = MobileCRM = {
|
|
174
177
|
/// <summary>An entry point for Mobile CRM data model.</summary>
|
|
175
178
|
/// <field name="bridge" type="MobileCRM.Bridge">Singleton instance of <see cref="MobileCRM.Bridge">MobileCRM.Bridge</see> providing the management of the Javascript/native code cross-calls.</field>
|
|
176
179
|
bridge: null,
|
|
@@ -1045,6 +1048,38 @@
|
|
|
1045
1048
|
this.url = "";
|
|
1046
1049
|
this.serviceType = "Azure"; // [v12.3] supports only azure service, used as default.
|
|
1047
1050
|
},
|
|
1051
|
+
GeoFencingService: function () {
|
|
1052
|
+
/// <summary>[v17.1] Represents geo-fencing service.</summary>
|
|
1053
|
+
/// <field name="isEnabled" type="Boolean">Indicates whether the service is active.</field>
|
|
1054
|
+
/// <field name="realtimeFlushing" type="Boolean">Indicates whether the events should be delivered realtime using Resco forwarding service.</field>
|
|
1055
|
+
/// <field name="logLevel" type="number">Defines logging verbosity (0=Normal, 1=Diagnostic, -1=None)</field>
|
|
1056
|
+
/// <field name="notificationMask" type="number">Defines event mask for showing notifications (0=None, 1=WhenArrived, 2=WhenExited, 3=Always)</field>
|
|
1057
|
+
/// <field name="businessHours" type="String">Business hours interval (e.g. '9:00-17:00')</field>
|
|
1058
|
+
/// <field name="businessDaysMask" type="number">Business days mask (the lowest bit is Sunday, the next Monday, ...)</field>
|
|
1059
|
+
this.isEnabled = false;
|
|
1060
|
+
this.realtimeFlushing = true;
|
|
1061
|
+
this.logLevel = 0;
|
|
1062
|
+
this.notificationMask = 1;
|
|
1063
|
+
this.businessHours = null;
|
|
1064
|
+
this.businessDaysMask = -1;
|
|
1065
|
+
},
|
|
1066
|
+
GeoFenceRecord: function (eventTypeMask, id, name, latitude, longitude, radius, expiration) {
|
|
1067
|
+
/// <summary>[v17.1] Represents geo-fence definition record.</summary>
|
|
1068
|
+
/// <field name="eventTypeMask" type="number">Defines numeric mask for geo fence events (Enter = 1, Exit = 2, Both = 3).</field>
|
|
1069
|
+
/// <field name="id" type="String">Unique id of geo-fence record. If it is associated with some entity record, it must have form logicalname:id (e.g. appointment:4595AA3E-9873-4DC4-B723-C94DE27B82BE).</field>
|
|
1070
|
+
/// <field name="name" type="String">Human-readable name of record used for notifications.</field>
|
|
1071
|
+
/// <field name="latitude" type="number">Latitude of geo-fence center.</field>
|
|
1072
|
+
/// <field name="longitude" type="number">Longitude of geo-fence center.</field>
|
|
1073
|
+
/// <field name="radius" type="number">Geo-fence radius in meters.</field>
|
|
1074
|
+
/// <field name="expiration" type="number">Geo-fence expiration in seconds.</field>
|
|
1075
|
+
this.eventTypeMask = eventTypeMask;
|
|
1076
|
+
this.id = id;
|
|
1077
|
+
this.name = name;
|
|
1078
|
+
this.latitude = latitude;
|
|
1079
|
+
this.longitude = longitude;
|
|
1080
|
+
this.radius = radius;
|
|
1081
|
+
this.expiration = expiration;
|
|
1082
|
+
},
|
|
1048
1083
|
},
|
|
1049
1084
|
};
|
|
1050
1085
|
|
|
@@ -1417,7 +1452,7 @@
|
|
|
1417
1452
|
callback.call(scope);
|
|
1418
1453
|
}
|
|
1419
1454
|
});
|
|
1420
|
-
|
|
1455
|
+
_global.setTimeout(function () {
|
|
1421
1456
|
var nextWorker = _alertQueue.splice(0, 1);
|
|
1422
1457
|
nextWorker[0]();
|
|
1423
1458
|
});
|
|
@@ -2274,7 +2309,7 @@
|
|
|
2274
2309
|
}
|
|
2275
2310
|
var cmdParams = JSON.stringify(request);
|
|
2276
2311
|
var self = this;
|
|
2277
|
-
|
|
2312
|
+
_global.MobileCRM.bridge.command(
|
|
2278
2313
|
"entitysave",
|
|
2279
2314
|
cmdParams,
|
|
2280
2315
|
function (res) {
|
|
@@ -2490,7 +2525,7 @@
|
|
|
2490
2525
|
/// <param name="success" type="function(result)">A callback function for successful asynchronous result. The <b>result</b> argument will carry the objects array of type specified by <b>resultformat</b> XML attribute (Array, JSON, XML or DynamicEntities).</param>
|
|
2491
2526
|
/// <param name="failed" type="function(error)">A callback function for command failure. The <b>error</b> argument will carry the error message.</param>
|
|
2492
2527
|
/// <param name="scope" type="">A scope for calling the callbacks; set "null" to call the callbacks in global scope.</param>
|
|
2493
|
-
|
|
2528
|
+
_global.MobileCRM.bridge.command("fetchXML", fetchXmlData, success, failed, scope);
|
|
2494
2529
|
};
|
|
2495
2530
|
MobileCRM.FetchXml.Fetch.prototype.execute = function (output, success, failed, scope) {
|
|
2496
2531
|
/// <summary>Performs the asynchronous CRM Fetch request.</summary>
|
|
@@ -6091,6 +6126,30 @@
|
|
|
6091
6126
|
scope
|
|
6092
6127
|
);
|
|
6093
6128
|
};
|
|
6129
|
+
|
|
6130
|
+
MobileCRM.Services.GeoFencingService.prototype.updateGeoFences = function (geoFences, errorCallback) {
|
|
6131
|
+
/// <summary>[v17.1] Updates geo-fences being monitored.</summary>
|
|
6132
|
+
/// <param name="geoFences" type="Array">An array of GeoFenceRecord objects.</field>
|
|
6133
|
+
var cfg = {
|
|
6134
|
+
isEnabled: !!this.isEnabled,
|
|
6135
|
+
realtimeFlushing: !!this.realtimeFlushing,
|
|
6136
|
+
};
|
|
6137
|
+
if (this.logLevel >= -1 && this.logLevel <= 1) {
|
|
6138
|
+
cfg.logLevel = this.logLevel;
|
|
6139
|
+
}
|
|
6140
|
+
if (this.notificationMask >= 0 && this.notificationMask <= 4) {
|
|
6141
|
+
cfg.notificationMask = this.notificationMask;
|
|
6142
|
+
}
|
|
6143
|
+
if (this.businessHours) {
|
|
6144
|
+
cfg.businessHours = this.businessHours;
|
|
6145
|
+
}
|
|
6146
|
+
if (this.businessDaysMask) {
|
|
6147
|
+
cfg.businessDaysMask = this.businessDaysMask;
|
|
6148
|
+
}
|
|
6149
|
+
cfg.geoFences = geoFences;
|
|
6150
|
+
MobileCRM.bridge.command("geofencing", JSON.stringify(cfg), null, errorCallback);
|
|
6151
|
+
};
|
|
6152
|
+
|
|
6094
6153
|
MobileCRM.Services.DynamicsReport.prototype.download = function (fileName, format, success, failed, scope) {
|
|
6095
6154
|
/// <summary>Downloads the MS Dynamics report into a file.</summary>
|
|
6096
6155
|
/// <param name="fileName" type="String">A file name for resulting file. Leave "null" to let app to safely generate the file name and extension.</param>
|
|
@@ -6189,7 +6248,7 @@
|
|
|
6189
6248
|
/// <param name="success" type="function(string)">A callback function for successful asynchronous result. The <b>result</b> argument will carry the serialized response from the server.</param>
|
|
6190
6249
|
/// <param name="failed" type="function(error)">A callback function for command failure. The <b>error</b> argument will carry the error message.</param>
|
|
6191
6250
|
/// <param name="scope" type="">A scope for calling the callbacks; set "null" to call the callbacks in global scope.</param>
|
|
6192
|
-
|
|
6251
|
+
_global.MobileCRM.bridge.command(
|
|
6193
6252
|
"executeWorkflowAction",
|
|
6194
6253
|
JSON.stringify({ actionName: actionName, actionParameters: JSON.stringify(parameters) }),
|
|
6195
6254
|
success,
|
package/src/README.md
CHANGED
|
@@ -1,49 +1,71 @@
|
|
|
1
|
-
# JSBridge
|
|
1
|
+
# JSBridge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
JSBridge - Javascript API for Resco Mobile CRM
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Getting started with working and debugging of an offline HTML solution.
|
|
6
|
+
https://www.resco.net/debugging-offline-html-solution/
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
## Introduction
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
Resco Mobile CRM application functionality can be extended using HTML + Javascript code.
|
|
11
|
+
Your html file containing custom code can be executed both online and offline.
|
|
12
|
+
Offline html files are part of Woodford customization project.
|
|
12
13
|
|
|
13
|
-
|
|
14
|
+
Watch webinars for intro to OfflineHTML in Resco MobileCRM.
|
|
15
|
+
<br />[Webinar Offline HTML in Resco Mobile CRM - Part 1/2 (Intro)](https://www.youtube.com/watch?v=cplZLC_mAc0&list=PLPMCnAPD5b56XNEiGTcy5VBxdP8rcB86b&index=12)
|
|
16
|
+
[Webinar Offline HTML in Resco Mobile CRM - Part 2/2 (Data Access)](https://www.youtube.com/watch?v=R7GpdC_y17Y&t=1s)
|
|
17
|
+
|
|
18
|
+
Release contains the debugging/development build(s) of the Resco Mobile CRM application.
|
|
19
|
+
Per platform application packages are available.
|
|
20
|
+
|
|
21
|
+
## IFrame
|
|
22
|
+
|
|
23
|
+
You can put a web browser, known as IFrame, in various components in the app.
|
|
24
|
+
IFrames can be used within EntityForm, EntityList or within HomeForm.
|
|
25
|
+
IFrame points to your custom html code file.
|
|
26
|
+
|
|
27
|
+
## Documentation
|
|
28
|
+
|
|
29
|
+
Description of the methods and objects defined in Resco JavaScript Bridge.
|
|
30
|
+
[Latest Reference](https://www.resco.net/javascript-bridge-reference/)
|
|
31
|
+
[Guide](http://www.resco.net/mobilecrm/support/jsbridge.aspx)
|
|
32
|
+
|
|
33
|
+
## Installing the package
|
|
14
34
|
|
|
15
35
|
In your project directory use **npm init** to set up a new or existing npm package. If you want to create default package json file then use --yes parameter. For more information please visit https://docs.npmjs.com/cli/init
|
|
16
36
|
|
|
17
|
-
|
|
18
|
-
|
|
37
|
+
- install package **npm i @resconet/jsbridge**
|
|
38
|
+
|
|
39
|
+
## Using the library
|
|
19
40
|
|
|
20
|
-
|
|
21
|
-
You can use require to include
|
|
41
|
+
- **Javascript file**
|
|
42
|
+
You can use require to include the module from installed packages. For example
|
|
22
43
|
|
|
23
44
|
```javascript
|
|
24
|
-
require
|
|
45
|
+
require("@resconet/jsbridge");
|
|
25
46
|
|
|
26
|
-
function testAlert(){
|
|
27
|
-
|
|
47
|
+
function testAlert() {
|
|
48
|
+
MobileCRM.bridge.alert("Test");
|
|
28
49
|
}
|
|
29
50
|
```
|
|
30
51
|
|
|
31
|
-
|
|
32
|
-
You can use import to include
|
|
52
|
+
- **Typescript file**
|
|
53
|
+
You can use import to include the module from installed packages. For example
|
|
33
54
|
|
|
34
55
|
```javascript
|
|
35
|
-
import "@resconet/jsbridge
|
|
56
|
+
import "@resconet/jsbridge";
|
|
36
57
|
|
|
37
|
-
function testAlert(){
|
|
38
|
-
|
|
58
|
+
function testAlert() {
|
|
59
|
+
MobileCRM.bridge.alert("Test");
|
|
39
60
|
}
|
|
40
61
|
```
|
|
41
62
|
|
|
42
63
|
## Versioning
|
|
43
64
|
|
|
44
65
|
The package.json defines the version of JSBridge. e.g. "version": "12.3.1", it means
|
|
45
|
-
|
|
46
|
-
|
|
66
|
+
|
|
67
|
+
- 12.3: Major revision (copies the version of underlying Mobile CRM app)
|
|
68
|
+
- 1: Bug fix release
|
|
47
69
|
|
|
48
70
|
**important** first two numbers mirror the latest version of Mobile CRM native application that supports the features.
|
|
49
71
|
|
|
@@ -58,4 +80,5 @@ The Package is published to npm registry page on release publish event.
|
|
|
58
80
|
The Bug fix release number is automatically updated when new js or ts file is pushed.
|
|
59
81
|
|
|
60
82
|
## Contact
|
|
83
|
+
|
|
61
84
|
For any questions or any specific circumstances, please contact us on the email mobilecrm@resco.net
|