@sap-ux/preview-middleware 0.19.20 → 0.19.21

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.
@@ -2,13 +2,19 @@
2
2
  sap.ui.define([
3
3
  'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
4
4
  '../adp/dialog-factory',
5
- '../i18n'
6
- ], function (___sap_ux_private_control_property_editor_common, ___adp_dialog_factory, ___i18n) {
5
+ '../i18n',
6
+ 'sap/base/Log',
7
+ '../utils/core',
8
+ '../utils/version'
9
+ ], function (___sap_ux_private_control_property_editor_common, ___adp_dialog_factory, ___i18n, Log, ___utils_core, ___utils_version) {
7
10
  'use strict';
8
11
  const executeContextMenuAction = ___sap_ux_private_control_property_editor_common['executeContextMenuAction'];
12
+ const reportTelemetry = ___sap_ux_private_control_property_editor_common['reportTelemetry'];
9
13
  const requestControlContextMenu = ___sap_ux_private_control_property_editor_common['requestControlContextMenu'];
10
14
  const DialogFactory = ___adp_dialog_factory['DialogFactory'];
11
15
  const getTextBundle = ___i18n['getTextBundle'];
16
+ const getControlById = ___utils_core['getControlById'];
17
+ const getUi5Version = ___utils_version['getUi5Version'];
12
18
  class ContextMenuService {
13
19
  sendAction = () => {
14
20
  };
@@ -23,6 +29,18 @@ sap.ui.define([
23
29
  if (executeContextMenuAction.match(action)) {
24
30
  const {actionName, controlId} = action.payload;
25
31
  await this.actionService.execute(controlId, actionName);
32
+ try {
33
+ const controlName = getControlById(controlId)?.getMetadata().getName();
34
+ const versionInfo = await getUi5Version();
35
+ await reportTelemetry({
36
+ category: 'OutlineContextMenu',
37
+ actionName,
38
+ controlName,
39
+ ui5Version: `${ versionInfo.major }.${ versionInfo.minor }.${ versionInfo.patch }`
40
+ });
41
+ } catch (err) {
42
+ Log.error('Error in reporting Telemetry:', err);
43
+ }
26
44
  }
27
45
  if (requestControlContextMenu.pending.match(action)) {
28
46
  const controlId = action.payload;
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  executeContextMenuAction,
3
3
  ExternalAction,
4
+ reportTelemetry,
4
5
  requestControlContextMenu
5
6
  } from '@sap-ux-private/control-property-editor-common';
6
7
  import { ActionSenderFunction, SubscribeFunction } from './types';
@@ -8,6 +9,9 @@ import RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
8
9
  import { ActionService } from 'sap/ui/rta/service/Action';
9
10
  import { DialogFactory } from '../adp/dialog-factory';
10
11
  import { getTextBundle } from '../i18n';
12
+ import Log from 'sap/base/Log';
13
+ import { getControlById } from '../utils/core';
14
+ import { getUi5Version } from '../utils/version';
11
15
 
12
16
  /**
13
17
  * A Class of ContextMenuService
@@ -35,6 +39,18 @@ export class ContextMenuService {
35
39
  if (executeContextMenuAction.match(action)) {
36
40
  const { actionName, controlId } = action.payload;
37
41
  await this.actionService.execute(controlId, actionName);
42
+ try {
43
+ const controlName = getControlById(controlId)?.getMetadata().getName();
44
+ const versionInfo = await getUi5Version();
45
+ await reportTelemetry({
46
+ category: 'OutlineContextMenu',
47
+ actionName,
48
+ controlName,
49
+ ui5Version: `${versionInfo.major}.${versionInfo.minor}.${versionInfo.patch}`
50
+ });
51
+ } catch (err) {
52
+ Log.error('Error in reporting Telemetry:', err);
53
+ }
38
54
  }
39
55
  if (requestControlContextMenu.pending.match(action)) {
40
56
  const controlId = action.payload;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
11
11
  },
12
- "version": "0.19.20",
12
+ "version": "0.19.21",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -49,7 +49,7 @@
49
49
  "nock": "13.4.0",
50
50
  "npm-run-all2": "6.2.0",
51
51
  "supertest": "6.3.3",
52
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.13.15",
52
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.13.16",
53
53
  "@sap-ux/axios-extension": "1.19.3",
54
54
  "@sap-ux/i18n": "0.2.3",
55
55
  "@sap-ux/store": "1.0.0",