@adobe/spacecat-shared-rum-api-client 1.6.3 → 1.6.5

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [@adobe/spacecat-shared-rum-api-client-v1.6.5](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v1.6.4...@adobe/spacecat-shared-rum-api-client-v1.6.5) (2024-03-01)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fix data desk params ([bb0c231](https://github.com/adobe/spacecat-shared/commit/bb0c23153ac8da510644b96da489135f0209d3c2))
7
+
8
+ # [@adobe/spacecat-shared-rum-api-client-v1.6.4](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v1.6.3...@adobe/spacecat-shared-rum-api-client-v1.6.4) (2024-02-27)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * create404Backlink and createRUMBacklink documentation ([#165](https://github.com/adobe/spacecat-shared/issues/165)) ([418ec68](https://github.com/adobe/spacecat-shared/commit/418ec68a1cabf22054688342438dcf2ea60acf38))
14
+
1
15
  # [@adobe/spacecat-shared-rum-api-client-v1.6.3](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-rum-api-client-v1.6.2...@adobe/spacecat-shared-rum-api-client-v1.6.3) (2024-02-27)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-rum-api-client",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "description": "Shared modules of the Spacecat Services - Rum API client",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.d.ts CHANGED
@@ -14,11 +14,23 @@ import { UniversalContext } from '@adobe/helix-universal';
14
14
 
15
15
  export interface RUMAPIOptions {
16
16
  interval?: number;
17
+ startdate?: string,
18
+ enddate?: string,
17
19
  offset?: number;
18
20
  limit?: number;
19
21
  url?: string;
20
22
  }
21
23
 
24
+ export interface RUMDashboardOptions {
25
+ interval?: number;
26
+ startdate?: string,
27
+ enddate?: string,
28
+ offset?: number;
29
+ limit?: number;
30
+ domainkey?: string,
31
+ url?: string;
32
+ }
33
+
22
34
  export default class RUMAPIClient {
23
35
  /**
24
36
  * Static factory method to create an instance of RUMAPIClient.
@@ -42,21 +54,23 @@ export default class RUMAPIClient {
42
54
  * Asynchronous method to create a RUM backlink.
43
55
  * @param {string} url - A string representing the URL for the backlink.
44
56
  * @param {number} expiry - An integer representing the expiry value for the backlink.
57
+ * @param {RUMDashboardOptions} params - An object representing the parameters to be included
45
58
  * @returns A Promise resolving to a string representing url of the created backlink.
46
59
  * @remarks This method creates a backlink to the RUM dashboard, allowing users
47
60
  * to view their reports and monitor real user activities.
48
61
  */
49
- createRUMBacklink(url: string, expiry: number): Promise<string>;
62
+ createRUMBacklink(url: string, expiry: number, params?: RUMDashboardOptions): Promise<string>;
50
63
 
51
64
  /**
52
65
  * Asynchronous method to create a 404 backlink.
53
66
  * @param {string} url - A string representing the URL for the backlink.
54
67
  * @param {number} expiry - An integer representing the expiry value for the backlink.
68
+ * @param {RUMDashboardOptions} params - An object representing the parameters to be included
55
69
  * @returns A Promise resolving to a string representing url of the created backlink.
56
70
  * @remarks This method creates a backlink to the 404 report, allowing users
57
71
  * to view their 404 pages.
58
72
  */
59
- create404Backlink(url: string, expiry: number): Promise<string>;
73
+ create404Backlink(url: string, expiry: number, params?: RUMDashboardOptions): Promise<string>;
60
74
 
61
75
  /**
62
76
  * Asynchronous method to return the RUM dashboard API call response data.
package/src/index.js CHANGED
@@ -88,15 +88,19 @@ async function generateDomainKey(domainkey, url, expiry) {
88
88
  return data[0].key;
89
89
  }
90
90
 
91
- async function createBacklink(dashboardUrl, domainKey, domainUrl, expiry, params) {
91
+ async function createBacklink(dashboardUrl, domainKey, domainUrl, expiry, params = {}) {
92
92
  const scopedDomainKey = await generateDomainKey(domainKey, domainUrl, expiry);
93
+ const dataDeskParams = { ...params };
94
+ if (dataDeskParams.startdate) {
95
+ delete dataDeskParams.interval;
96
+ }
93
97
  return createUrl(dashboardUrl, {
94
98
  offset: 0,
95
99
  limit: 100,
96
100
  url: domainUrl,
97
101
  domainkey: scopedDomainKey,
98
- interval: expiry,
99
- ...params,
102
+ ...(dataDeskParams?.startdate ? {} : { interval: expiry }),
103
+ ...dataDeskParams,
100
104
  });
101
105
  }
102
106