@resconet/jsbridge 17.1.0-beta.2 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resconet/jsbridge",
3
- "version": "17.1.0-beta.2",
3
+ "version": "17.1.0-beta.3",
4
4
  "main": "./src/JSBridge.js",
5
5
  "types": "./src/JSBridge.d.ts",
6
6
  "description": "Install npm JSBridge module",
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,7 +156,7 @@
156
156
  }
157
157
  };
158
158
  };
159
- var _global = window || global;
159
+ var _global = typeof window == "undefined" ? global : window;
160
160
  var MobileCrmException = _global.MobileCrmException;
161
161
  if (typeof MobileCrmException === "undefined") {
162
162
  _global.MobileCrmException = MobileCrmException = function (msg) {
@@ -1048,6 +1048,38 @@
1048
1048
  this.url = "";
1049
1049
  this.serviceType = "Azure"; // [v12.3] supports only azure service, used as default.
1050
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
+ },
1051
1083
  },
1052
1084
  };
1053
1085
 
@@ -1420,7 +1452,7 @@
1420
1452
  callback.call(scope);
1421
1453
  }
1422
1454
  });
1423
- window.setTimeout(function () {
1455
+ _global.setTimeout(function () {
1424
1456
  var nextWorker = _alertQueue.splice(0, 1);
1425
1457
  nextWorker[0]();
1426
1458
  });
@@ -2277,7 +2309,7 @@
2277
2309
  }
2278
2310
  var cmdParams = JSON.stringify(request);
2279
2311
  var self = this;
2280
- window.MobileCRM.bridge.command(
2312
+ _global.MobileCRM.bridge.command(
2281
2313
  "entitysave",
2282
2314
  cmdParams,
2283
2315
  function (res) {
@@ -2493,7 +2525,7 @@
2493
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>
2494
2526
  /// <param name="failed" type="function(error)">A callback function for command failure. The <b>error</b> argument will carry the error message.</param>
2495
2527
  /// <param name="scope" type="">A scope for calling the callbacks; set &quot;null&quot; to call the callbacks in global scope.</param>
2496
- window.MobileCRM.bridge.command("fetchXML", fetchXmlData, success, failed, scope);
2528
+ _global.MobileCRM.bridge.command("fetchXML", fetchXmlData, success, failed, scope);
2497
2529
  };
2498
2530
  MobileCRM.FetchXml.Fetch.prototype.execute = function (output, success, failed, scope) {
2499
2531
  /// <summary>Performs the asynchronous CRM Fetch request.</summary>
@@ -6094,6 +6126,30 @@
6094
6126
  scope
6095
6127
  );
6096
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
+
6097
6153
  MobileCRM.Services.DynamicsReport.prototype.download = function (fileName, format, success, failed, scope) {
6098
6154
  /// <summary>Downloads the MS Dynamics report into a file.</summary>
6099
6155
  /// <param name="fileName" type="String">A file name for resulting file. Leave &quot;null&quot; to let app to safely generate the file name and extension.</param>
@@ -6192,7 +6248,7 @@
6192
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>
6193
6249
  /// <param name="failed" type="function(error)">A callback function for command failure. The <b>error</b> argument will carry the error message.</param>
6194
6250
  /// <param name="scope" type="">A scope for calling the callbacks; set &quot;null&quot; to call the callbacks in global scope.</param>
6195
- window.MobileCRM.bridge.command(
6251
+ _global.MobileCRM.bridge.command(
6196
6252
  "executeWorkflowAction",
6197
6253
  JSON.stringify({ actionName: actionName, actionParameters: JSON.stringify(parameters) }),
6198
6254
  success,