roboto-js 1.6.14 → 1.6.16

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.
@@ -108,7 +108,7 @@ var Roboto = exports["default"] = /*#__PURE__*/function () {
108
108
  _createClass(Roboto, [{
109
109
  key: "getVersion",
110
110
  value: function getVersion() {
111
- return '1.6.12';
111
+ return '1.6.15';
112
112
  }
113
113
  }, {
114
114
  key: "setSiteEnv",
@@ -70,7 +70,7 @@ var RbtMetricsApi = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
70
70
  * sendEvent({ event: 'foo', ... });
71
71
  *
72
72
  roboto.metrics.sendEvent("UIMain.userAction.login", { foo: 123, bar: "baz" });
73
- This will POST a payload like:
73
+ This will POST a payload like:
74
74
  {
75
75
  "event": "UIMain.userAction.login",
76
76
  "category": "UIMain",
@@ -146,6 +146,43 @@ var RbtMetricsApi = exports["default"] = /*#__PURE__*/function (_EventEmitter) {
146
146
  return _sendEvent.apply(this, arguments);
147
147
  }
148
148
  return sendEvent;
149
+ }()
150
+ /**
151
+ * Count-based metric event (requires `count` param).
152
+ * Example:
153
+ * roboto.metrics.countEvents("PGPT.Tool.SendSMS", { count: 4, agentId: "ABC" })
154
+ *
155
+ * is equivalent to:
156
+ * roboto.metrics.sendEvent("PGPT.Tool.SendSMS", { count: 4, agentId: "ABC" })
157
+ */
158
+ )
159
+ }, {
160
+ key: "countEvents",
161
+ value: (function () {
162
+ var _countEvents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(eventOrObj) {
163
+ var paramsObj,
164
+ _args2 = arguments;
165
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
166
+ while (1) switch (_context2.prev = _context2.next) {
167
+ case 0:
168
+ paramsObj = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
169
+ if (!(!paramsObj || typeof paramsObj.count !== 'number')) {
170
+ _context2.next = 3;
171
+ break;
172
+ }
173
+ throw new Error('countEvent requires a count param (number)');
174
+ case 3:
175
+ return _context2.abrupt("return", this.sendEvent(eventOrObj, paramsObj));
176
+ case 4:
177
+ case "end":
178
+ return _context2.stop();
179
+ }
180
+ }, _callee2, this);
181
+ }));
182
+ function countEvents(_x2) {
183
+ return _countEvents.apply(this, arguments);
184
+ }
185
+ return countEvents;
149
186
  }())
150
187
  }]);
151
188
  return RbtMetricsApi;
package/dist/esm/index.js CHANGED
@@ -8,7 +8,7 @@ export { RbtApi, RbtObject, RbtFile
8
8
  };
9
9
  export default class Roboto {
10
10
  getVersion() {
11
- return '1.6.12';
11
+ return '1.6.15';
12
12
  }
13
13
  constructor({
14
14
  host,
@@ -40,7 +40,7 @@ export default class RbtMetricsApi extends EventEmitter {
40
40
  * sendEvent({ event: 'foo', ... });
41
41
  *
42
42
  roboto.metrics.sendEvent("UIMain.userAction.login", { foo: 123, bar: "baz" });
43
- This will POST a payload like:
43
+ This will POST a payload like:
44
44
  {
45
45
  "event": "UIMain.userAction.login",
46
46
  "category": "UIMain",
@@ -82,4 +82,19 @@ export default class RbtMetricsApi extends EventEmitter {
82
82
  throw err;
83
83
  }
84
84
  }
85
+
86
+ /**
87
+ * Count-based metric event (requires `count` param).
88
+ * Example:
89
+ * roboto.metrics.countEvents("PGPT.Tool.SendSMS", { count: 4, agentId: "ABC" })
90
+ *
91
+ * is equivalent to:
92
+ * roboto.metrics.sendEvent("PGPT.Tool.SendSMS", { count: 4, agentId: "ABC" })
93
+ */
94
+ async countEvents(eventOrObj, paramsObj = {}) {
95
+ if (!paramsObj || typeof paramsObj.count !== 'number') {
96
+ throw new Error('countEvent requires a count param (number)');
97
+ }
98
+ return this.sendEvent(eventOrObj, paramsObj);
99
+ }
85
100
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.6.14",
3
+ "version": "1.6.16",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.cjs",
package/src/index.js CHANGED
@@ -15,7 +15,7 @@ export {
15
15
  export default class Roboto{
16
16
 
17
17
  getVersion(){
18
- return '1.6.12';
18
+ return '1.6.15';
19
19
  }
20
20
 
21
21
  constructor({ host, accessKey, localStorageAdaptor, disableWebSocket = false, metricsHost }, proxyReq = null) {
@@ -42,6 +42,7 @@ export default class RbtMetricsApi extends EventEmitter {
42
42
  * sendEvent({ event: 'foo', ... });
43
43
  *
44
44
  roboto.metrics.sendEvent("UIMain.userAction.login", { foo: 123, bar: "baz" });
45
+
45
46
  This will POST a payload like:
46
47
  {
47
48
  "event": "UIMain.userAction.login",
@@ -87,4 +88,20 @@ export default class RbtMetricsApi extends EventEmitter {
87
88
  throw err;
88
89
  }
89
90
  }
91
+
92
+ /**
93
+ * Count-based metric event (requires `count` param).
94
+ * Example:
95
+ * roboto.metrics.countEvents("PGPT.Tool.SendSMS", { count: 4, agentId: "ABC" })
96
+ *
97
+ * is equivalent to:
98
+ * roboto.metrics.sendEvent("PGPT.Tool.SendSMS", { count: 4, agentId: "ABC" })
99
+ */
100
+ async countEvents(eventOrObj, paramsObj = {}) {
101
+ if (!paramsObj || typeof paramsObj.count !== 'number') {
102
+ throw new Error('countEvent requires a count param (number)');
103
+ }
104
+ return this.sendEvent(eventOrObj, paramsObj);
105
+ }
106
+
90
107
  }