@resconet/jsbridge 18.0.0-beta.3 → 18.0.0-beta.4
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 +53 -1
- package/src/JSBridge.js +42 -6
package/package.json
CHANGED
package/src/JSBridge.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// JSBridge.js TypeScript definition file
|
|
2
|
-
// (c)
|
|
2
|
+
// (c) 2024 Resco
|
|
3
3
|
|
|
4
4
|
/* eslint-disable @typescript-eslint/ban-types */
|
|
5
5
|
/* eslint-disable @typescript-eslint/prefer-namespace-keyword */
|
|
@@ -1001,6 +1001,7 @@ declare namespace MobileCRM {
|
|
|
1001
1001
|
*/
|
|
1002
1002
|
class MobileReport {
|
|
1003
1003
|
/**
|
|
1004
|
+
* @deprecated Please use {@link generateReportAsync} instead.
|
|
1004
1005
|
* @since 9.1
|
|
1005
1006
|
* Executes the mobile reporting request which produces the mobile report document of given format.
|
|
1006
1007
|
* @param fetch The fetch XML defining the entity (entities) query used as report input.
|
|
@@ -1025,6 +1026,7 @@ declare namespace MobileCRM {
|
|
|
1025
1026
|
scope?: any
|
|
1026
1027
|
);
|
|
1027
1028
|
/**
|
|
1029
|
+
* @deprecated Please use {@link generateReportAsync} instead.
|
|
1028
1030
|
* @since 9.1
|
|
1029
1031
|
* Executes the mobile reporting request which produces the mobile report document of given format.
|
|
1030
1032
|
* @param fetch The fetch XML defining the entity (entities) query used as report input.
|
|
@@ -1043,6 +1045,50 @@ declare namespace MobileCRM {
|
|
|
1043
1045
|
isOnline: boolean,
|
|
1044
1046
|
outputFile: string
|
|
1045
1047
|
): Promise<string>;
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* The request class specifying behavior of {@link generateReportAsync} function.
|
|
1051
|
+
*/
|
|
1052
|
+
static GenerateReportRequest = class {
|
|
1053
|
+
/** The identifier of report source record(s) as {@link MobileCRM.Reference} or fetch in its xml representation. */
|
|
1054
|
+
source: string | Reference;
|
|
1055
|
+
/** The identifier of report template as its string record ID, exact logical name, {@link MobileCRM.Reference} or actual xml definition of report.*/
|
|
1056
|
+
template: string | Reference;
|
|
1057
|
+
/** Optional code of report format. Supported values are: Pdf (default), Html, Excel, Text. */
|
|
1058
|
+
format = "Pdf";
|
|
1059
|
+
/** Optional custom name of report file or its full path. If not provided, default report name and path are used.
|
|
1060
|
+
* When using full path, it is recommended to place it in {@link MobileCRM.Configuration.storageDirectory}. */
|
|
1061
|
+
customNameOrPath: string;
|
|
1062
|
+
/** Optional iso code (e.g. 'en-US') of report language. Currently it only works for reports on localized Questionnaires. */
|
|
1063
|
+
languageCode: string | undefined;
|
|
1064
|
+
/** Optional custom message displayed to user while report is being generated.
|
|
1065
|
+
* When null or empty string is provided, default message is shown. When undefined, shows no wait message. */
|
|
1066
|
+
waitMessage: string | undefined;
|
|
1067
|
+
/** Optionally specifies if report should be created in Online, or Offline mode. If undefined, the mode in which app is currently running is used. */
|
|
1068
|
+
isOnline: boolean | undefined;
|
|
1069
|
+
/** A {@link MobileCRM.Reference} to parent record. If provided, method will generate new attachment record and link it to the parent record. */
|
|
1070
|
+
attachTo: Reference | undefined;
|
|
1071
|
+
/**
|
|
1072
|
+
* When {@link attachmentRecord} is provided, optionally specifies the type of attachment entity.
|
|
1073
|
+
* If not specified, the default attachment entity is created. */
|
|
1074
|
+
attachmentEntity: string | undefined;
|
|
1075
|
+
};
|
|
1076
|
+
/**
|
|
1077
|
+
* The result class for {@link generateReportAsync} function.
|
|
1078
|
+
*/
|
|
1079
|
+
static GenerateReportResult = class {
|
|
1080
|
+
/** The full file path to generated report. Not present if {@link GenerateReportRequest.attachTo} is provided. */
|
|
1081
|
+
outputReportPath: string | undefined;
|
|
1082
|
+
/** The reference to attachment record containing the generated report. Only present if {@link GenerateReportRequest.attachTo} is provided.*/
|
|
1083
|
+
attachmentRecord: Reference | undefined;
|
|
1084
|
+
};
|
|
1085
|
+
/**
|
|
1086
|
+
* @since 18.0
|
|
1087
|
+
* Generates the mobile report based on provided request parameters. The generated report will be saved to file system or attached to a record.
|
|
1088
|
+
* @param request The request specifying the details of how the report will be created.
|
|
1089
|
+
* @returns The promise with the result object.
|
|
1090
|
+
*/
|
|
1091
|
+
static generateReportAsync(request: MobileCRM.MobileReport.GenerateReportRequest): Promise<MobileCRM.MobileReport.GenerateReportResult>;
|
|
1046
1092
|
/**
|
|
1047
1093
|
* @since 10.1
|
|
1048
1094
|
* Shows new MobileReport form. Source for the report can be defined either as list of MobileCRM.Reference objects or as FetchXML query.
|
|
@@ -2255,6 +2301,7 @@ declare module MobileCRM.UI {
|
|
|
2255
2301
|
*/
|
|
2256
2302
|
public static requestObject(callback: (entityList: EntityList) => void, errorCallback?: (err: string) => void, scope?: any);
|
|
2257
2303
|
/**
|
|
2304
|
+
* @deprecated Use {@link setDataSourceFactory} instead.
|
|
2258
2305
|
* Sets the entity list data source replacement.
|
|
2259
2306
|
* @see Data source must be set during the document load stage and must not be delayed. It is used only if the entity view iFrame is marked as data source provider in Woodford.
|
|
2260
2307
|
* @param dataSource A data source object implementing the DynamicEntity list loading routine.
|
|
@@ -2489,6 +2536,11 @@ declare module MobileCRM.UI {
|
|
|
2489
2536
|
questionnaire: DynamicEntity;
|
|
2490
2537
|
/** Custom event context */
|
|
2491
2538
|
context: any;
|
|
2539
|
+
/**
|
|
2540
|
+
* @since 18.0
|
|
2541
|
+
* Language of the questionnaire
|
|
2542
|
+
*/
|
|
2543
|
+
language: string;
|
|
2492
2544
|
|
|
2493
2545
|
/**
|
|
2494
2546
|
* Stops the onSave validation and optionally causes an error message to be displayed.
|
package/src/JSBridge.js
CHANGED
|
@@ -2892,13 +2892,13 @@
|
|
|
2892
2892
|
/// <param name="success" type="function(String)">A callback function for successful asynchronous result. The <b>result</b> argument will carry the XML representation of the Fetch object.</param>
|
|
2893
2893
|
/// <param name="failed" type="function(error)">A callback function for command failure. The <b>error</b> argument will carry the error message.</param>
|
|
2894
2894
|
/// <param name="scope" type="">A scope for calling the callbacks; set "null" to call the callbacks in global scope.</param>
|
|
2895
|
-
var reqParams = this._constructFetchParams();
|
|
2895
|
+
var reqParams = JSON.stringify(this._constructFetchParams());
|
|
2896
2896
|
MobileCRM.bridge.command("fetchToXml", reqParams, success, failed, scope);
|
|
2897
2897
|
};
|
|
2898
2898
|
MobileCRM.FetchXml.Fetch.prototype.serializeToXmlAsync = function () {
|
|
2899
2899
|
/// <summary>[v10.0] Serializes the Fetch object to XML.</summary>
|
|
2900
2900
|
/// <returns type="Promise<string>">A Promise object which will be resolved with the XML representation of this Fetch object.</returns>
|
|
2901
|
-
var reqParams = this._constructFetchParams();
|
|
2901
|
+
var reqParams = JSON.stringify(this._constructFetchParams());
|
|
2902
2902
|
return MobileCRM.bridge.invokeCommandPromise("fetchToXml", reqParams);
|
|
2903
2903
|
};
|
|
2904
2904
|
// MobileCRM.FetchXml.Entity
|
|
@@ -4470,7 +4470,7 @@
|
|
|
4470
4470
|
MobileCRM.bridge.command("showReport", JSON.stringify(params), success, failed, scope);
|
|
4471
4471
|
};
|
|
4472
4472
|
MobileCRM.MobileReport.runReport = function (fetch, reportXML, reportFormat, isExportOnly, isOnline, outputFile, success, failed, scope) {
|
|
4473
|
-
/// <summary>[v9.1] Executes the mobile reporting request which produces the mobile report document of given format.</summary>
|
|
4473
|
+
/// <summary>[v9.1] Deprecated: please use MobileCRM.MobileReport.generateReportAsync instead. Executes the mobile reporting request which produces the mobile report document of given format.</summary>
|
|
4474
4474
|
/// <param name="fetch" type="String">The fetch XML defining the entity (entities) query used as report input.</param>
|
|
4475
4475
|
/// <param name="reportXML" type="String">The mobile report XML definition which can be loaded from the resco_report entity or constructed dynamically. Ignored if IsExportOnly parameter is true.</param>
|
|
4476
4476
|
/// <param name="reportFormat" type="String">Report format: Pdf (default), Html, Excel, Text.</param>
|
|
@@ -4490,7 +4490,7 @@
|
|
|
4490
4490
|
MobileCRM.bridge.command("runMobileReportAsync", JSON.stringify(params), success, failed, scope);
|
|
4491
4491
|
};
|
|
4492
4492
|
MobileCRM.MobileReport.runReportAsync = function (fetch, reportXML, reportFormat, isExportOnly, isOnline, outputFile) {
|
|
4493
|
-
/// <summary>[v9.1] Executes the mobile reporting request which produces the mobile report document of given format.</summary>
|
|
4493
|
+
/// <summary>[v9.1] Deprecated: please use MobileCRM.MobileReport.generateReportAsync instead. Executes the mobile reporting request which produces the mobile report document of given format.</summary>
|
|
4494
4494
|
/// <param name="fetch" type="String">The fetch XML defining the entity (entities) query used as report input.</param>
|
|
4495
4495
|
/// <param name="reportXML" type="String">The mobile report XML definition which can be loaded from the resco_mobilereport entity or constructed dynamically. Ignored if IsExportOnly parameter is true.</param>
|
|
4496
4496
|
/// <param name="reportFormat" type="String">Report format: Pdf (default), Html, Excel, Text.</param>
|
|
@@ -4504,6 +4504,42 @@
|
|
|
4504
4504
|
});
|
|
4505
4505
|
});
|
|
4506
4506
|
};
|
|
4507
|
+
|
|
4508
|
+
MobileCRM.MobileReport.GenerateReportRequest = function () {
|
|
4509
|
+
/// <summary>[v18.0] The request class specifying behavior of MobileCRM.MobileReport.generateReportAsync function.</summary>
|
|
4510
|
+
/// <param name="source" type="String | MobileCRM.Reference">The identifier of report source record(s) as MobileCRM.Reference or fetch in its xml representation.</param>
|
|
4511
|
+
/// <param name="template" type="String | MobileCRM.Reference">The identifier of report template as its string record ID, exact logical name, MobileCRM.Reference or actual xml definition of report.</param>
|
|
4512
|
+
/// <param name="format" type="String">Optional code of report format. Supported values are: Pdf (default), Html, Excel, Text.</param>
|
|
4513
|
+
/// <param name="customNameOrPath" type="String">Optional custom name of report file or its full path. If not provided, default report name and path are used. When using full path, it is recommended to place it in MobileCRM.Configuration.storageDirectory.</param>
|
|
4514
|
+
/// <param name="languageCode" type="String">Optional iso code (e.g. "en-US") of report language. Currently it only works for reports on localized Questionnaires.</param>
|
|
4515
|
+
/// <param name="waitMessage" type="String">Optional custom message displayed to user while report is being generated. When null or empty string is provided, default message is shown. When undefined, shows no wait message.</param>
|
|
4516
|
+
/// <param name="isOnline" type="Boolean">Optionally specifies if report should be created in Online, or Offline mode. If undefined, the mode in which app is currently running is used.</param>
|
|
4517
|
+
/// <param name="attachTo" type="MobileCRM.Reference">A MobileCRM.Reference to parent record. If provided, method will generate new attachment record and link it to the parent record.</param>
|
|
4518
|
+
/// <param name="attachmentEntity" type="String">When attachmentRecord is provided, optionally specifies the type of attachment entity. If not specified, the default attachment entity is created.</param>
|
|
4519
|
+
this.source = undefined;
|
|
4520
|
+
this.template = undefined;
|
|
4521
|
+
this.format = "Pdf";
|
|
4522
|
+
this.customNameOrPath = undefined;
|
|
4523
|
+
this.languageCode = undefined;
|
|
4524
|
+
this.waitMessage = undefined;
|
|
4525
|
+
this.isOnline = undefined;
|
|
4526
|
+
this.attachTo = undefined;
|
|
4527
|
+
this.attachmentEntity = undefined;
|
|
4528
|
+
};
|
|
4529
|
+
MobileCRM.MobileReport.GenerateReportResult = function () {
|
|
4530
|
+
/// <summary>[v18.0] The result class for MobileCRM.MobileReport.generateReportAsync function.</summary>
|
|
4531
|
+
/// <param name="outputReportPath" type="String">The full file path to generated report. Not present if MobileCRM.MobileReport.GenerateReportRequest.attachTo is provided.</param>
|
|
4532
|
+
/// <param name="attachmentRecord" type="MobileCRM.Reference">The reference to attachment record containing the generated report. Only present if MobileCRM.MobileReport.GenerateReportRequest.attachTo is provided.</param>
|
|
4533
|
+
this.outputReportPath = undefined;
|
|
4534
|
+
this.attachmentRecord = undefined;
|
|
4535
|
+
};
|
|
4536
|
+
MobileCRM.MobileReport.generateReportAsync = async function (request) {
|
|
4537
|
+
/// <summary>[v18.0] Generates the mobile report based on provided request parameters. The generated report will be saved to file system or attached to a record.</summary>
|
|
4538
|
+
/// <param name="request" type="MobileCRM.MobileReport.GenerateReportRequest">The request specifying the details of how the report will be created.</param>
|
|
4539
|
+
/// <returns type="MobileCRM.MobileReport.GenerateReportResult">The promise with <see cref="MobileCRM.MobileReport.GenerateReportResult">GenerateReportResult</see> object.</returns>
|
|
4540
|
+
return MobileCRM.bridge.invokeCommandPromise("generateMobileReportAsync", JSON.stringify(request));
|
|
4541
|
+
};
|
|
4542
|
+
|
|
4507
4543
|
MobileCRM.MobileReport.showForm = function (report, source, fetchXml, failed, scope) {
|
|
4508
4544
|
/// <summary>[v10.1] Shows new MobileReport form. Source for the report can be defined either as list of <see cref="MobileCRM.Reference">MobileCRM.Reference</see> objects or as FetchXML query.</summary>
|
|
4509
4545
|
/// <remarks>If both types of source are passed, user can select which one to use.</remarks>
|
|
@@ -4840,7 +4876,7 @@
|
|
|
4840
4876
|
);
|
|
4841
4877
|
};
|
|
4842
4878
|
MobileCRM.UI.EntityList.setDataSource = function (dataSource) {
|
|
4843
|
-
/// <summary>Sets the entity list data source replacement.</summary>
|
|
4879
|
+
/// <summary>Deprecated: Please use setDataSourceFactory instead. Sets the entity list data source replacement.</summary>
|
|
4844
4880
|
/// <remarks><p>Data source must be set during the document load stage and must not be delayed.</p><p>It is used only if the entity view iFrame is marked as data source provider in Woodford.</p></remarks>
|
|
4845
4881
|
/// <param name="dataSource" type="MobileCRM.UI.ListDataSource">A data source object implementing the DynamicEntity list loading routine.</param>
|
|
4846
4882
|
MobileCRM.UI.EntityList._dataSource = dataSource;
|
|
@@ -4994,7 +5030,7 @@
|
|
|
4994
5030
|
// MobileCRM.UI.ListDataSource
|
|
4995
5031
|
MobileCRM.UI.ListDataSource = function () {
|
|
4996
5032
|
/// <summary>The data source loading routine implementation.</summary>
|
|
4997
|
-
/// <remarks><p>An instance of this object can be used to supply the data source for <see cref="MobileCRM.UI.EntityList.
|
|
5033
|
+
/// <remarks><p>An instance of this object can be used to supply the data source for <see cref="MobileCRM.UI.EntityList.setDataSourceFactory">MobileCRM.UI.EntityList.setDataSourceFactory</see> function.</p><p>The instance of this object is valid only if the method loadNextChunk is implemented. See example <see cref="MobileCRM.UI.EntityList.setDataSourceFactory">here</see>.</p></remarks>
|
|
4998
5034
|
/// <field name="chunkSize" type="Number">Controls the number of entities loaded in once.</field>
|
|
4999
5035
|
/// <field name="fetch" type="MobileCRM.FetchXml.Fetch">Gets the original fetch request for this list view.</field>
|
|
5000
5036
|
/// <field name="loadNextChunk" type="function(page, count)">Controls the number of entities loaded in once. It is called from native code to get chunk (array) of <see cref="MobileCRM.DynamicEntity">DynamicEntities</see>. The chunk is defined by 1-based page number and the desired count which corresponds to the value of chunkSize property.</field>
|