@dynatrace/rum-javascript-sdk 1.333.15 → 1.337.1
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/dist/api/index.d.ts +16 -0
- package/dist/api/index.js +25 -1
- package/dist/api/interactions.d.ts +25 -0
- package/dist/api/interactions.js +51 -0
- package/dist/api/promises/index.d.ts +23 -0
- package/dist/api/promises/index.js +36 -7
- package/dist/api/promises/interactions.d.ts +18 -0
- package/dist/api/promises/interactions.js +22 -0
- package/dist/api/promises/wait-for-interactions.d.ts +9 -0
- package/dist/api/promises/wait-for-interactions.js +18 -0
- package/dist/api/user-actions.d.ts +5 -5
- package/dist/api/user-actions.js +6 -6
- package/dist/testing/index.d.ts +3 -1
- package/dist/testing/index.js +1 -1
- package/dist/testing/install.js +1 -1
- package/dist/testing/test.d.ts +1 -119
- package/dist/testing/test.js +12 -11
- package/dist/testing/types/dynatrace-config.d.ts +36 -0
- package/dist/testing/types/dynatrace-config.js +2 -0
- package/dist/testing/types/dynatrace-testing-fixtures.d.ts +24 -0
- package/dist/testing/types/dynatrace-testing-fixtures.js +2 -0
- package/dist/testing/types/dynatrace-testing.d.ts +66 -0
- package/dist/testing/types/dynatrace-testing.js +2 -0
- package/dist/types/api/dynatrace-api-types.d.ts +126 -24
- package/dist/types/api/dynatrace-api-types.js +1 -1
- package/dist/types/index-typedoc.d.ts +1 -0
- package/dist/types/index-typedoc.js +2 -1
- package/dist/types/rum-events/index.d.ts +1 -0
- package/dist/types/rum-events/index.js +2 -1
- package/dist/types/rum-events/json-event.d.ts +0 -6
- package/dist/types/rum-events/json-event.js +1 -1
- package/dist/types/rum-events/open-fields.d.ts +74 -0
- package/dist/types/rum-events/open-fields.js +84 -0
- package/dist/types/rum-events/rum-internal-selfmonitoring-event.d.ts +21 -1
- package/dist/types/rum-events/rum-internal-selfmonitoring-event.js +21 -1
- package/dist/types/rum-events/rum-user-interaction-event.d.ts +47 -0
- package/dist/types/rum-events/rum-user-interaction-event.js +43 -1
- package/dist/types/rum-events/shared-namespaces-and-fields/general-rum-event-fields.d.ts +3 -2
- package/dist/types/rum-events/shared-namespaces-and-fields/general-rum-event-fields.js +1 -1
- package/dist/types/user-actions/user-action-start-options.d.ts +13 -0
- package/dist/types/user-actions/user-action-start-options.js +1 -1
- package/dist/types/user-actions/user-action-tracker.d.ts +35 -3
- package/dist/types/user-actions/user-action-tracker.js +1 -1
- package/docs/1-overview.md +95 -0
- package/docs/2-testing.md +3 -3
- package/docs/3-types.md +1 -0
- package/docs/4-useractions.md +94 -76
- package/docs/5-interactions.md +85 -0
- package/package.json +24 -8
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlci1hY3Rpb24tdHJhY2tlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NvdXJjZS90eXBlcy91c2VyLWFjdGlvbnMvdXNlci1hY3Rpb24tdHJhY2tlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBVbnN1YnNjcmliZXIgfSBmcm9tIFwiLi4vYXBpL2R5bmF0cmFjZS1hcGktdHlwZXMuanNcIjtcbmltcG9ydCB0eXBlIHsgVXNlckFjdGlvbkVuZEV2ZW50IH0gZnJvbSBcIi4vdXNlci1hY3Rpb24tZW5kLWV2ZW50LmpzXCI7XG5cbi8qKlxuICogQW4gb2JqZWN0IHRvIHdvcmsgd2l0aCB1c2VyIGFjdGlvbnMuXG4gKlxuICogQGNhdGVnb3J5IFVzZXIgQWN0aW9uc1xuICogQGV4cGVyaW1lbnRhbFxuICovXG5leHBvcnQgaW50ZXJmYWNlIFVzZXJBY3Rpb25UcmFja2VyIHtcbiAgICAvKipcbiAgICAgKiB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bmRlZmluZWQ7XG5cbiAgICAvKipcbiAgICAgKiBTZXRzIHRoZSBuYW1lIG9mIHRoZSB1c2VyIGFjdGlvbi5cbiAgICAgKlxuICAgICAqIEBkZXByZWNhdGVkIFVzZSB7QGxpbmsgY3VzdG9tTmFtZX0gaW5zdGVhZC5cbiAgICAgKiBAcGFyYW0gICAgICB2YWx1ZSBUaGUgbmFtZSB0byBzZXQgZm9yIHRoZSB1c2VyIGFjdGlvbi5cbiAgICAgKi9cbiAgICBzZXQgbmFtZSh2YWx1ZTogc3RyaW5nIHwgdW5kZWZpbmVkKTtcbn1cbiJdfQ==
|
package/docs/1-overview.md
CHANGED
|
@@ -18,6 +18,7 @@ This package provides two main API approaches for interacting with the Dynatrace
|
|
|
18
18
|
- **Synchronous API**: Safe wrapper functions that gracefully handle cases where the RUM JavaScript is not available
|
|
19
19
|
- **Asynchronous API**: Promise-based functions that wait for the RUM JavaScript to become available
|
|
20
20
|
- **User Actions API**: Manual control over user action creation and lifecycle (see [User Actions API](./4-useractions.md))
|
|
21
|
+
- **Interactions API**: Report custom user interaction events (see [Interactions API](./5-interactions.md))
|
|
21
22
|
- **TypeScript Support**: Comprehensive type definitions for all RUM API functions
|
|
22
23
|
- **Testing Framework**: Playwright-based utilities for testing RUM integration
|
|
23
24
|
|
|
@@ -151,6 +152,30 @@ import { identifyUser } from '@dynatrace/rum-javascript-sdk/api';
|
|
|
151
152
|
identifyUser('john.doe@example.com');
|
|
152
153
|
```
|
|
153
154
|
|
|
155
|
+
#### `userOptIn(): void`
|
|
156
|
+
|
|
157
|
+
Grants consent for data collection. When consent management is enabled, calls to other APIs (e.g., `sendEvent`, `identifyUser`) are blocked until consent is granted.
|
|
158
|
+
|
|
159
|
+
**Example:**
|
|
160
|
+
```typescript
|
|
161
|
+
import { userOptIn } from '@dynatrace/rum-javascript-sdk/api';
|
|
162
|
+
|
|
163
|
+
// Grant consent after the user accepts the cookie banner
|
|
164
|
+
userOptIn();
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### `userOptOut(): void`
|
|
168
|
+
|
|
169
|
+
Revokes consent for data collection. When opted out, no events or beacons are sent, but consent APIs remain callable.
|
|
170
|
+
|
|
171
|
+
**Example:**
|
|
172
|
+
```typescript
|
|
173
|
+
import { userOptOut } from '@dynatrace/rum-javascript-sdk/api';
|
|
174
|
+
|
|
175
|
+
// Revoke consent when the user opts out
|
|
176
|
+
userOptOut();
|
|
177
|
+
```
|
|
178
|
+
|
|
154
179
|
#### `sendSessionPropertyEvent(fields): void`
|
|
155
180
|
|
|
156
181
|
Sends session-level properties that will be attached to all subsequent events in the session.
|
|
@@ -195,6 +220,33 @@ const yourError = new Error("Your Error Message");
|
|
|
195
220
|
sendExceptionEvent(yourError, { "event_properties.component": "myExampleComponent" });
|
|
196
221
|
```
|
|
197
222
|
|
|
223
|
+
### Interactions API (`@dynatrace/rum-javascript-sdk/api/interactions`)
|
|
224
|
+
|
|
225
|
+
#### `sendKeyPressEvent(fields, elementOrEvent?): void`
|
|
226
|
+
|
|
227
|
+
Sends a user interaction event to report custom keyboard shortcuts or key combinations.
|
|
228
|
+
Only available if the User Interaction module is enabled.
|
|
229
|
+
|
|
230
|
+
**Parameters:**
|
|
231
|
+
|
|
232
|
+
- `fields: SendUserInteractionFields` - Must be a JSON-serializable object with a `keys` array (at least one key).
|
|
233
|
+
Keys can be `UserInteractionSpecialKey` members or raw [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) strings — raw values are normalized internally.
|
|
234
|
+
Optional `ui_element.custom_name` and `event_properties.*` entries are allowed.
|
|
235
|
+
- `elementOrEvent?: Element | KeyboardEvent` - Optional Element or KeyboardEvent to auto-capture UI element fields.
|
|
236
|
+
|
|
237
|
+
**Example:**
|
|
238
|
+
```typescript
|
|
239
|
+
import * as interactions from '@dynatrace/rum-javascript-sdk/api/interactions';
|
|
240
|
+
import { UserInteractionSpecialKey } from '@dynatrace/rum-javascript-sdk/types/rum-events';
|
|
241
|
+
|
|
242
|
+
interactions.sendKeyPressEvent({
|
|
243
|
+
keys: [UserInteractionSpecialKey.CTRL, "S"],
|
|
244
|
+
"event_properties.context": "editor"
|
|
245
|
+
});
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
For detailed documentation and examples, see [Interactions API](./5-interactions.md).
|
|
249
|
+
|
|
198
250
|
### Asynchronous API (`@dynatrace/rum-javascript-sdk/promises`)
|
|
199
251
|
|
|
200
252
|
The asynchronous API provides Promise-based functions that wait for the Dynatrace RUM JavaScript to become available. These functions will throw a `DynatraceError` if the RUM JavaScript is not available within the specified timeout. This is useful for scenarios where you don't want to
|
|
@@ -266,6 +318,34 @@ Async wrapper for user identification, with automatic waiting for RUM JavaScript
|
|
|
266
318
|
- `value: string` - User identifier
|
|
267
319
|
- `timeout?: number` - Timeout in milliseconds to wait for RUM JavaScript (default: 10,000)
|
|
268
320
|
|
|
321
|
+
#### `userOptIn(timeout?): Promise<void>`
|
|
322
|
+
|
|
323
|
+
Async wrapper for granting consent for data collection, with automatic waiting for RUM JavaScript availability.
|
|
324
|
+
|
|
325
|
+
**Parameters:**
|
|
326
|
+
- `timeout?: number` - Timeout in milliseconds to wait for RUM JavaScript (default: 10,000)
|
|
327
|
+
|
|
328
|
+
**Example:**
|
|
329
|
+
```typescript
|
|
330
|
+
import { userOptIn } from '@dynatrace/rum-javascript-sdk/api/promises';
|
|
331
|
+
|
|
332
|
+
await userOptIn();
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
#### `userOptOut(timeout?): Promise<void>`
|
|
336
|
+
|
|
337
|
+
Async wrapper for revoking consent for data collection, with automatic waiting for RUM JavaScript availability.
|
|
338
|
+
|
|
339
|
+
**Parameters:**
|
|
340
|
+
- `timeout?: number` - Timeout in milliseconds to wait for RUM JavaScript (default: 10,000)
|
|
341
|
+
|
|
342
|
+
**Example:**
|
|
343
|
+
```typescript
|
|
344
|
+
import { userOptOut } from '@dynatrace/rum-javascript-sdk/api/promises';
|
|
345
|
+
|
|
346
|
+
await userOptOut();
|
|
347
|
+
```
|
|
348
|
+
|
|
269
349
|
#### `sendSessionPropertyEvent(fields, timeout?): Promise<void>`
|
|
270
350
|
|
|
271
351
|
Async wrapper for sending session properties, with automatic waiting for RUM JavaScript availability.
|
|
@@ -285,6 +365,21 @@ Only available if the Errors module is enabled.
|
|
|
285
365
|
- `error: Error` - The error object to report. Must be an instance of the standard JavaScript `Error` class.
|
|
286
366
|
- `fields: ApiCreatedEventPropertiesEvent` - Optional Event properties object. Must be serializable JSON with properties prefixed with `event_properties.`, plus optional `duration` and `start_time` properties.
|
|
287
367
|
|
|
368
|
+
### Interactions API (`@dynatrace/rum-javascript-sdk/api/promises/interactions`)
|
|
369
|
+
|
|
370
|
+
#### `sendKeyPressEvent(fields, elementOrEvent?, timeout?): Promise<void>`
|
|
371
|
+
|
|
372
|
+
Async wrapper for sending a user interaction event, with automatic waiting for RUM JavaScript availability.
|
|
373
|
+
Only available if the User Interaction module is enabled.
|
|
374
|
+
|
|
375
|
+
**Parameters:**
|
|
376
|
+
|
|
377
|
+
- `fields: SendUserInteractionFields` - Must be a JSON-serializable object with a `keys` array (at least one key).
|
|
378
|
+
Keys can be `UserInteractionSpecialKey` members or raw [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) strings — raw values are normalized internally.
|
|
379
|
+
Optional `ui_element.custom_name` and `event_properties.*` entries are allowed.
|
|
380
|
+
- `elementOrEvent?: Element | KeyboardEvent` - Optional Element or KeyboardEvent to auto-capture UI element fields.
|
|
381
|
+
- `timeout?: number` - Timeout in milliseconds to wait for RUM JavaScript (default: 10,000)
|
|
382
|
+
|
|
288
383
|
### User Actions API
|
|
289
384
|
|
|
290
385
|
Both synchronous and asynchronous wrappers are available for the User Actions API. For detailed documentation and examples, see [User Actions API](./4-useractions.md).
|
package/docs/2-testing.md
CHANGED
|
@@ -372,10 +372,10 @@ The snapshot files contain JSON-formatted event data with ignored fields replace
|
|
|
372
372
|
|
|
373
373
|
#### Updating Snapshots
|
|
374
374
|
|
|
375
|
-
To update snapshots when event structures change intentionally, run Playwright with the `--update-snapshots` flag:
|
|
375
|
+
To update snapshots when event structures change intentionally, run Playwright with the `--update-snapshots=all` flag:
|
|
376
376
|
|
|
377
377
|
```bash
|
|
378
|
-
npx playwright test --update-snapshots
|
|
378
|
+
npx playwright test --update-snapshots=all
|
|
379
379
|
```
|
|
380
380
|
|
|
381
381
|
#### Default Ignored Fields
|
|
@@ -417,7 +417,7 @@ When a snapshot comparison fails, the error message includes:
|
|
|
417
417
|
3. Instructions for updating the snapshot
|
|
418
418
|
|
|
419
419
|
Common causes of snapshot failures:
|
|
420
|
-
- **New fields added to events**: Update the snapshot with `--update-snapshots`
|
|
420
|
+
- **New fields added to events**: Update the snapshot with `--update-snapshots=all`
|
|
421
421
|
- **Volatile field values**: Add the field to `ignoredFields` to replace values with `[IGNORED]`
|
|
422
422
|
- **Varying field presence**: Add the field to `removedFields` (use `fieldname.*` wildcard to remove all fields with that prefix)
|
|
423
423
|
- **Unwanted events**: Add an event pattern to `ignoreEvents` to filter them out
|
package/docs/3-types.md
CHANGED