@webex/internal-plugin-support 3.0.0-beta.14 → 3.0.0-beta.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.
- package/README.md +1 -3
- package/dist/config.js +0 -3
- package/dist/config.js.map +1 -1
- package/dist/index.js +2 -9
- package/dist/index.js.map +1 -1
- package/dist/support.js +48 -72
- package/dist/support.js.map +1 -1
- package/package.json +9 -9
- package/src/config.js +5 -4
- package/src/index.js +2 -2
- package/src/support.js +45 -39
- package/test/integration/spec/support.js +29 -29
- package/test/unit/spec/support.js +16 -14
package/README.md
CHANGED
|
@@ -21,14 +21,12 @@ npm install --save @webex/internal-plugin-support
|
|
|
21
21
|
## Usage
|
|
22
22
|
|
|
23
23
|
```js
|
|
24
|
-
|
|
25
24
|
import '@webex/internal-plugin-support';
|
|
26
25
|
|
|
27
26
|
import WebexCore from '@webex/webex-core';
|
|
28
27
|
|
|
29
28
|
const webex = new WebexCore();
|
|
30
|
-
webex.internal.support.WHATEVER
|
|
31
|
-
|
|
29
|
+
webex.internal.support.WHATEVER;
|
|
32
30
|
```
|
|
33
31
|
|
|
34
32
|
## Maintainers
|
package/dist/config.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
|
|
9
7
|
exports.default = void 0;
|
|
10
|
-
|
|
11
8
|
/*!
|
|
12
9
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
13
10
|
*/
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["device","preDiscoveryServices","atlasServiceUrl","process","env","ATLAS_SERVICE_URL","atlas","clientLogs","CLIENT_LOGS_SERVICE_URL","clientLogsServiceUrl","support","appType","appVersion","languageCode"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport default {\n device: {\n preDiscoveryServices: {\n atlasServiceUrl: process.env.ATLAS_SERVICE_URL || 'https://atlas-a.wbx2.com/admin/api/v1',\n atlas: process.env.ATLAS_SERVICE_URL || 'https://atlas-a.wbx2.com/admin/api/v1',\n clientLogs: process.env.CLIENT_LOGS_SERVICE_URL || 'https://client-logs-a.wbx2.com/api/v1',\n clientLogsServiceUrl
|
|
1
|
+
{"version":3,"names":["device","preDiscoveryServices","atlasServiceUrl","process","env","ATLAS_SERVICE_URL","atlas","clientLogs","CLIENT_LOGS_SERVICE_URL","clientLogsServiceUrl","support","appType","appVersion","languageCode"],"sources":["config.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nexport default {\n device: {\n preDiscoveryServices: {\n atlasServiceUrl: process.env.ATLAS_SERVICE_URL || 'https://atlas-a.wbx2.com/admin/api/v1',\n atlas: process.env.ATLAS_SERVICE_URL || 'https://atlas-a.wbx2.com/admin/api/v1',\n clientLogs: process.env.CLIENT_LOGS_SERVICE_URL || 'https://client-logs-a.wbx2.com/api/v1',\n clientLogsServiceUrl:\n process.env.CLIENT_LOGS_SERVICE_URL || 'https://client-logs-a.wbx2.com/api/v1',\n },\n },\n\n support: {\n appType: '',\n appVersion: '',\n languageCode: '',\n },\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAFA,eAIe;EACbA,MAAM,EAAE;IACNC,oBAAoB,EAAE;MACpBC,eAAe,EAAEC,OAAO,CAACC,GAAG,CAACC,iBAAiB,IAAI,uCAAuC;MACzFC,KAAK,EAAEH,OAAO,CAACC,GAAG,CAACC,iBAAiB,IAAI,uCAAuC;MAC/EE,UAAU,EAAEJ,OAAO,CAACC,GAAG,CAACI,uBAAuB,IAAI,uCAAuC;MAC1FC,oBAAoB,EAClBN,OAAO,CAACC,GAAG,CAACI,uBAAuB,IAAI;IAC3C;EACF,CAAC;EAEDE,OAAO,EAAE;IACPC,OAAO,EAAE,EAAE;IACXC,UAAU,EAAE,EAAE;IACdC,YAAY,EAAE;EAChB;AACF,CAAC;AAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
_Object$defineProperty(exports, "default", {
|
|
12
9
|
enumerable: true,
|
|
13
10
|
get: function get() {
|
|
14
11
|
return _support.default;
|
|
15
12
|
}
|
|
16
13
|
});
|
|
17
|
-
|
|
14
|
+
require("@webex/internal-plugin-device");
|
|
18
15
|
var _webexCore = require("@webex/webex-core");
|
|
19
|
-
|
|
20
16
|
var _support = _interopRequireDefault(require("./support"));
|
|
21
|
-
|
|
22
17
|
var _config = _interopRequireDefault(require("./config"));
|
|
23
|
-
|
|
24
|
-
require("@webex/internal-plugin-device");
|
|
25
|
-
|
|
26
18
|
/*!
|
|
27
19
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
28
20
|
*/
|
|
21
|
+
|
|
29
22
|
(0, _webexCore.registerInternalPlugin)('support', _support.default, {
|
|
30
23
|
config: _config.default
|
|
31
24
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["registerInternalPlugin","Support","config"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {registerInternalPlugin} from '@webex/webex-core';\n\nimport Support from './support';\nimport config from './config';\
|
|
1
|
+
{"version":3,"names":["registerInternalPlugin","Support","config"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\nimport '@webex/internal-plugin-device';\n\nimport {registerInternalPlugin} from '@webex/webex-core';\n\nimport Support from './support';\nimport config from './config';\n\nregisterInternalPlugin('support', Support, {\n config,\n});\n\nexport {default} from './support';\n"],"mappings":";;;;;;;;;;;;;AAGA;AAEA;AAEA;AACA;AARA;AACA;AACA;;AAQA,IAAAA,iCAAsB,EAAC,SAAS,EAAEC,gBAAO,EAAE;EACzCC,MAAM,EAANA;AACF,CAAC,CAAC"}
|
package/dist/support.js
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
|
-
|
|
11
8
|
exports.default = void 0;
|
|
12
|
-
|
|
13
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
14
|
-
|
|
15
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
16
|
-
|
|
17
11
|
var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
|
|
18
|
-
|
|
19
12
|
var _webexCore = require("@webex/webex-core");
|
|
20
|
-
|
|
21
13
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
22
|
-
|
|
23
14
|
/*!
|
|
24
15
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
25
16
|
*/
|
|
17
|
+
|
|
26
18
|
var Support = _webexCore.WebexPlugin.extend({
|
|
27
19
|
namespace: 'Support',
|
|
28
20
|
getFeedbackUrl: function getFeedbackUrl(options) {
|
|
@@ -55,22 +47,18 @@ var Support = _webexCore.WebexPlugin.extend({
|
|
|
55
47
|
},
|
|
56
48
|
submitLogs: function submitLogs(metadata, logs) {
|
|
57
49
|
var _this = this;
|
|
50
|
+
var metadataArray = this._constructFileMetadata(metadata);
|
|
58
51
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
52
|
+
// this is really testing that Ampersand is fully ready. once it's ready, these exist
|
|
62
53
|
if (!logs && this.webex.logger.sdkBuffer && this.webex.logger.clientBuffer && this.webex.logger.buffer) {
|
|
63
54
|
logs = this.webex.logger.formatLogs();
|
|
64
55
|
}
|
|
65
|
-
|
|
66
56
|
var filename;
|
|
67
|
-
|
|
68
57
|
if (metadata.locusId && metadata.callStart) {
|
|
69
58
|
filename = "".concat(metadata.locusId, "_").concat(metadata.callStart, ".txt");
|
|
70
59
|
} else {
|
|
71
60
|
filename = "".concat(this.webex.sessionId, ".txt");
|
|
72
61
|
}
|
|
73
|
-
|
|
74
62
|
var userId;
|
|
75
63
|
return this.webex.credentials.getUserToken().catch(function () {
|
|
76
64
|
return _this.webex.credentials.getClientToken();
|
|
@@ -78,57 +66,53 @@ var Support = _webexCore.WebexPlugin.extend({
|
|
|
78
66
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(token) {
|
|
79
67
|
var headers, initalOpts, finalOpts, options;
|
|
80
68
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
81
|
-
while (1) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
case "end":
|
|
126
|
-
return _context.stop();
|
|
127
|
-
}
|
|
69
|
+
while (1) switch (_context.prev = _context.next) {
|
|
70
|
+
case 0:
|
|
71
|
+
headers = {
|
|
72
|
+
authorization: token.toString()
|
|
73
|
+
};
|
|
74
|
+
initalOpts = {
|
|
75
|
+
service: 'clientLogs',
|
|
76
|
+
resource: 'logs/urls'
|
|
77
|
+
};
|
|
78
|
+
finalOpts = {
|
|
79
|
+
service: 'clientLogs',
|
|
80
|
+
resource: 'logs/meta'
|
|
81
|
+
};
|
|
82
|
+
options = (0, _defaults2.default)(initalOpts, {
|
|
83
|
+
file: logs,
|
|
84
|
+
shouldAttemptReauth: false,
|
|
85
|
+
headers: headers,
|
|
86
|
+
phases: {
|
|
87
|
+
initialize: {
|
|
88
|
+
body: {
|
|
89
|
+
file: filename
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
upload: {
|
|
93
|
+
$uri: function $uri(session) {
|
|
94
|
+
return session.tempURL;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
finalize: (0, _defaults2.default)(finalOpts, {
|
|
98
|
+
$body: function $body(session) {
|
|
99
|
+
userId = session.userId;
|
|
100
|
+
return {
|
|
101
|
+
filename: session.logFilename,
|
|
102
|
+
data: metadataArray,
|
|
103
|
+
userId: _this.webex.internal.device.userId || session.userId
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return _context.abrupt("return", _this.webex.upload(options));
|
|
110
|
+
case 5:
|
|
111
|
+
case "end":
|
|
112
|
+
return _context.stop();
|
|
128
113
|
}
|
|
129
114
|
}, _callee);
|
|
130
115
|
}));
|
|
131
|
-
|
|
132
116
|
return function (_x) {
|
|
133
117
|
return _ref.apply(this, arguments);
|
|
134
118
|
};
|
|
@@ -136,11 +120,9 @@ var Support = _webexCore.WebexPlugin.extend({
|
|
|
136
120
|
if (userId && !body.userId) {
|
|
137
121
|
body.userId = userId;
|
|
138
122
|
}
|
|
139
|
-
|
|
140
123
|
return body;
|
|
141
124
|
});
|
|
142
125
|
},
|
|
143
|
-
|
|
144
126
|
/**
|
|
145
127
|
* Constructs an array of key-value pairs for log upload.
|
|
146
128
|
* @param {*} metadata
|
|
@@ -154,38 +136,32 @@ var Support = _webexCore.WebexPlugin.extend({
|
|
|
154
136
|
value: metadata[key]
|
|
155
137
|
};
|
|
156
138
|
}
|
|
157
|
-
|
|
158
139
|
return null;
|
|
159
140
|
}).filter(function (entry) {
|
|
160
141
|
return Boolean(entry);
|
|
161
142
|
});
|
|
162
|
-
|
|
163
143
|
if (this.webex.sessionId) {
|
|
164
144
|
metadataArray.push({
|
|
165
145
|
key: 'trackingId',
|
|
166
146
|
value: this.webex.sessionId
|
|
167
147
|
});
|
|
168
148
|
}
|
|
169
|
-
|
|
170
149
|
if (this.webex.internal.device.userId) {
|
|
171
150
|
metadataArray.push({
|
|
172
151
|
key: 'userId',
|
|
173
152
|
value: this.webex.internal.device.userId
|
|
174
153
|
});
|
|
175
154
|
}
|
|
176
|
-
|
|
177
155
|
if (this.webex.internal.device.orgId) {
|
|
178
156
|
metadataArray.push({
|
|
179
157
|
key: 'orgId',
|
|
180
158
|
value: this.webex.internal.device.orgId
|
|
181
159
|
});
|
|
182
160
|
}
|
|
183
|
-
|
|
184
161
|
return metadataArray;
|
|
185
162
|
},
|
|
186
|
-
version: "3.0.0-beta.
|
|
163
|
+
version: "3.0.0-beta.16"
|
|
187
164
|
});
|
|
188
|
-
|
|
189
165
|
var _default = Support;
|
|
190
166
|
exports.default = _default;
|
|
191
167
|
//# sourceMappingURL=support.js.map
|
package/dist/support.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Support","WebexPlugin","extend","namespace","getFeedbackUrl","options","request","method","api","resource","body","appVersion","config","appType","feedbackId","uuid","v4","languageCode","then","res","url","getSupportUrl","webex","qs","submitLogs","metadata","logs","metadataArray","_constructFileMetadata","logger","sdkBuffer","clientBuffer","buffer","formatLogs","filename","locusId","callStart","sessionId","userId","credentials","getUserToken","catch","getClientToken","token","headers","authorization","toString","initalOpts","service","finalOpts","file","shouldAttemptReauth","phases","initialize","upload","$uri","session","tempURL","finalize","$body","logFilename","data","internal","device","map","key","value","filter","entry","Boolean","push","orgId"],"sources":["support.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {WebexPlugin} from '@webex/webex-core';\nimport {defaults} from 'lodash';\nimport uuid from 'uuid';\n\nconst Support = WebexPlugin.extend({\n namespace: 'Support',\n\n getFeedbackUrl(options) {\n options = options || {};\n\n return this.request({\n method: 'POST',\n api: 'conversation',\n resource: 'users/deskFeedbackUrl',\n body: defaults(options, {\n appVersion: this.config.appVersion,\n appType: this.config.appType,\n feedbackId: options.feedbackId || uuid.v4(),\n languageCode: this.config.languageCode
|
|
1
|
+
{"version":3,"names":["Support","WebexPlugin","extend","namespace","getFeedbackUrl","options","request","method","api","resource","body","appVersion","config","appType","feedbackId","uuid","v4","languageCode","then","res","url","getSupportUrl","webex","qs","submitLogs","metadata","logs","metadataArray","_constructFileMetadata","logger","sdkBuffer","clientBuffer","buffer","formatLogs","filename","locusId","callStart","sessionId","userId","credentials","getUserToken","catch","getClientToken","token","headers","authorization","toString","initalOpts","service","finalOpts","file","shouldAttemptReauth","phases","initialize","upload","$uri","session","tempURL","finalize","$body","logFilename","data","internal","device","map","key","value","filter","entry","Boolean","push","orgId"],"sources":["support.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\nimport {WebexPlugin} from '@webex/webex-core';\nimport {defaults} from 'lodash';\nimport uuid from 'uuid';\n\nconst Support = WebexPlugin.extend({\n namespace: 'Support',\n\n getFeedbackUrl(options) {\n options = options || {};\n\n return this.request({\n method: 'POST',\n api: 'conversation',\n resource: 'users/deskFeedbackUrl',\n body: defaults(options, {\n appVersion: this.config.appVersion,\n appType: this.config.appType,\n feedbackId: options.feedbackId || uuid.v4(),\n languageCode: this.config.languageCode,\n }),\n }).then((res) => res.body.url);\n },\n\n getSupportUrl() {\n return this.webex\n .request({\n method: 'GET',\n api: 'conversation',\n resource: 'users/deskSupportUrl',\n qs: {\n languageCode: this.config.languageCode,\n },\n })\n .then((res) => res.body.url);\n },\n\n submitLogs(metadata, logs) {\n const metadataArray = this._constructFileMetadata(metadata);\n\n // this is really testing that Ampersand is fully ready. once it's ready, these exist\n if (\n !logs &&\n this.webex.logger.sdkBuffer &&\n this.webex.logger.clientBuffer &&\n this.webex.logger.buffer\n ) {\n logs = this.webex.logger.formatLogs();\n }\n\n let filename;\n\n if (metadata.locusId && metadata.callStart) {\n filename = `${metadata.locusId}_${metadata.callStart}.txt`;\n } else {\n filename = `${this.webex.sessionId}.txt`;\n }\n\n let userId;\n\n return this.webex.credentials\n .getUserToken()\n .catch(() => this.webex.credentials.getClientToken())\n .then(async (token) => {\n const headers = {authorization: token.toString()};\n\n const initalOpts = {\n service: 'clientLogs',\n resource: 'logs/urls',\n };\n\n const finalOpts = {\n service: 'clientLogs',\n resource: 'logs/meta',\n };\n\n const options = defaults(initalOpts, {\n file: logs,\n shouldAttemptReauth: false,\n headers,\n phases: {\n initialize: {\n body: {\n file: filename,\n },\n },\n upload: {\n $uri: (session) => session.tempURL,\n },\n finalize: defaults(finalOpts, {\n $body: (session) => {\n userId = session.userId;\n\n return {\n filename: session.logFilename,\n data: metadataArray,\n userId: this.webex.internal.device.userId || session.userId,\n };\n },\n }),\n },\n });\n\n return this.webex.upload(options);\n })\n .then((body) => {\n if (userId && !body.userId) {\n body.userId = userId;\n }\n\n return body;\n });\n },\n\n /**\n * Constructs an array of key-value pairs for log upload.\n * @param {*} metadata\n * @returns {array}\n */\n _constructFileMetadata(metadata) {\n const metadataArray = [\n 'locusId',\n 'callStart',\n 'feedbackId',\n 'correlationId',\n 'meetingId',\n 'surveySessionId',\n ]\n .map((key) => {\n if (metadata[key]) {\n return {\n key,\n value: metadata[key],\n };\n }\n\n return null;\n })\n .filter((entry) => Boolean(entry));\n\n if (this.webex.sessionId) {\n metadataArray.push({\n key: 'trackingId',\n value: this.webex.sessionId,\n });\n }\n\n if (this.webex.internal.device.userId) {\n metadataArray.push({\n key: 'userId',\n value: this.webex.internal.device.userId,\n });\n }\n\n if (this.webex.internal.device.orgId) {\n metadataArray.push({\n key: 'orgId',\n value: this.webex.internal.device.orgId,\n });\n }\n\n return metadataArray;\n },\n});\n\nexport default Support;\n"],"mappings":";;;;;;;;;;;AAIA;AAEA;AANA;AACA;AACA;;AAMA,IAAMA,OAAO,GAAGC,sBAAW,CAACC,MAAM,CAAC;EACjCC,SAAS,EAAE,SAAS;EAEpBC,cAAc,0BAACC,OAAO,EAAE;IACtBA,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;IAEvB,OAAO,IAAI,CAACC,OAAO,CAAC;MAClBC,MAAM,EAAE,MAAM;MACdC,GAAG,EAAE,cAAc;MACnBC,QAAQ,EAAE,uBAAuB;MACjCC,IAAI,EAAE,wBAASL,OAAO,EAAE;QACtBM,UAAU,EAAE,IAAI,CAACC,MAAM,CAACD,UAAU;QAClCE,OAAO,EAAE,IAAI,CAACD,MAAM,CAACC,OAAO;QAC5BC,UAAU,EAAET,OAAO,CAACS,UAAU,IAAIC,aAAI,CAACC,EAAE,EAAE;QAC3CC,YAAY,EAAE,IAAI,CAACL,MAAM,CAACK;MAC5B,CAAC;IACH,CAAC,CAAC,CAACC,IAAI,CAAC,UAACC,GAAG;MAAA,OAAKA,GAAG,CAACT,IAAI,CAACU,GAAG;IAAA,EAAC;EAChC,CAAC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|
2
2
|
"name": "@webex/internal-plugin-support",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "nickclar <nickclar@cisco.com>",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
]
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@webex/internal-plugin-device": "3.0.0-beta.
|
|
25
|
-
"@webex/internal-plugin-search": "3.0.0-beta.
|
|
26
|
-
"@webex/internal-plugin-support": "3.0.0-beta.
|
|
27
|
-
"@webex/test-helper-chai": "3.0.0-beta.
|
|
28
|
-
"@webex/test-helper-file": "3.0.0-beta.
|
|
29
|
-
"@webex/test-helper-mock-webex": "3.0.0-beta.
|
|
30
|
-
"@webex/test-helper-test-users": "3.0.0-beta.
|
|
31
|
-
"@webex/webex-core": "3.0.0-beta.
|
|
24
|
+
"@webex/internal-plugin-device": "3.0.0-beta.16",
|
|
25
|
+
"@webex/internal-plugin-search": "3.0.0-beta.16",
|
|
26
|
+
"@webex/internal-plugin-support": "3.0.0-beta.16",
|
|
27
|
+
"@webex/test-helper-chai": "3.0.0-beta.16",
|
|
28
|
+
"@webex/test-helper-file": "3.0.0-beta.16",
|
|
29
|
+
"@webex/test-helper-mock-webex": "3.0.0-beta.16",
|
|
30
|
+
"@webex/test-helper-test-users": "3.0.0-beta.16",
|
|
31
|
+
"@webex/webex-core": "3.0.0-beta.16",
|
|
32
32
|
"lodash": "^4.17.21",
|
|
33
33
|
"uuid": "^3.3.2"
|
|
34
34
|
}
|
package/src/config.js
CHANGED
|
@@ -8,13 +8,14 @@ export default {
|
|
|
8
8
|
atlasServiceUrl: process.env.ATLAS_SERVICE_URL || 'https://atlas-a.wbx2.com/admin/api/v1',
|
|
9
9
|
atlas: process.env.ATLAS_SERVICE_URL || 'https://atlas-a.wbx2.com/admin/api/v1',
|
|
10
10
|
clientLogs: process.env.CLIENT_LOGS_SERVICE_URL || 'https://client-logs-a.wbx2.com/api/v1',
|
|
11
|
-
clientLogsServiceUrl:
|
|
12
|
-
|
|
11
|
+
clientLogsServiceUrl:
|
|
12
|
+
process.env.CLIENT_LOGS_SERVICE_URL || 'https://client-logs-a.wbx2.com/api/v1',
|
|
13
|
+
},
|
|
13
14
|
},
|
|
14
15
|
|
|
15
16
|
support: {
|
|
16
17
|
appType: '',
|
|
17
18
|
appVersion: '',
|
|
18
|
-
languageCode: ''
|
|
19
|
-
}
|
|
19
|
+
languageCode: '',
|
|
20
|
+
},
|
|
20
21
|
};
|
package/src/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
3
|
*/
|
|
4
|
+
import '@webex/internal-plugin-device';
|
|
4
5
|
|
|
5
6
|
import {registerInternalPlugin} from '@webex/webex-core';
|
|
6
7
|
|
|
7
8
|
import Support from './support';
|
|
8
9
|
import config from './config';
|
|
9
|
-
import '@webex/internal-plugin-device';
|
|
10
10
|
|
|
11
11
|
registerInternalPlugin('support', Support, {
|
|
12
|
-
config
|
|
12
|
+
config,
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
export {default} from './support';
|
package/src/support.js
CHANGED
|
@@ -20,21 +20,21 @@ const Support = WebexPlugin.extend({
|
|
|
20
20
|
appVersion: this.config.appVersion,
|
|
21
21
|
appType: this.config.appType,
|
|
22
22
|
feedbackId: options.feedbackId || uuid.v4(),
|
|
23
|
-
languageCode: this.config.languageCode
|
|
24
|
-
})
|
|
25
|
-
})
|
|
26
|
-
.then((res) => res.body.url);
|
|
23
|
+
languageCode: this.config.languageCode,
|
|
24
|
+
}),
|
|
25
|
+
}).then((res) => res.body.url);
|
|
27
26
|
},
|
|
28
27
|
|
|
29
28
|
getSupportUrl() {
|
|
30
|
-
return this.webex
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
return this.webex
|
|
30
|
+
.request({
|
|
31
|
+
method: 'GET',
|
|
32
|
+
api: 'conversation',
|
|
33
|
+
resource: 'users/deskSupportUrl',
|
|
34
|
+
qs: {
|
|
35
|
+
languageCode: this.config.languageCode,
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
38
|
.then((res) => res.body.url);
|
|
39
39
|
},
|
|
40
40
|
|
|
@@ -42,7 +42,12 @@ const Support = WebexPlugin.extend({
|
|
|
42
42
|
const metadataArray = this._constructFileMetadata(metadata);
|
|
43
43
|
|
|
44
44
|
// this is really testing that Ampersand is fully ready. once it's ready, these exist
|
|
45
|
-
if (
|
|
45
|
+
if (
|
|
46
|
+
!logs &&
|
|
47
|
+
this.webex.logger.sdkBuffer &&
|
|
48
|
+
this.webex.logger.clientBuffer &&
|
|
49
|
+
this.webex.logger.buffer
|
|
50
|
+
) {
|
|
46
51
|
logs = this.webex.logger.formatLogs();
|
|
47
52
|
}
|
|
48
53
|
|
|
@@ -50,26 +55,26 @@ const Support = WebexPlugin.extend({
|
|
|
50
55
|
|
|
51
56
|
if (metadata.locusId && metadata.callStart) {
|
|
52
57
|
filename = `${metadata.locusId}_${metadata.callStart}.txt`;
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
58
|
+
} else {
|
|
55
59
|
filename = `${this.webex.sessionId}.txt`;
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
let userId;
|
|
59
63
|
|
|
60
|
-
return this.webex.credentials
|
|
64
|
+
return this.webex.credentials
|
|
65
|
+
.getUserToken()
|
|
61
66
|
.catch(() => this.webex.credentials.getClientToken())
|
|
62
67
|
.then(async (token) => {
|
|
63
68
|
const headers = {authorization: token.toString()};
|
|
64
69
|
|
|
65
70
|
const initalOpts = {
|
|
66
71
|
service: 'clientLogs',
|
|
67
|
-
resource: 'logs/urls'
|
|
72
|
+
resource: 'logs/urls',
|
|
68
73
|
};
|
|
69
74
|
|
|
70
75
|
const finalOpts = {
|
|
71
76
|
service: 'clientLogs',
|
|
72
|
-
resource: 'logs/meta'
|
|
77
|
+
resource: 'logs/meta',
|
|
73
78
|
};
|
|
74
79
|
|
|
75
80
|
const options = defaults(initalOpts, {
|
|
@@ -79,11 +84,11 @@ const Support = WebexPlugin.extend({
|
|
|
79
84
|
phases: {
|
|
80
85
|
initialize: {
|
|
81
86
|
body: {
|
|
82
|
-
file: filename
|
|
83
|
-
}
|
|
87
|
+
file: filename,
|
|
88
|
+
},
|
|
84
89
|
},
|
|
85
90
|
upload: {
|
|
86
|
-
$uri: (session) => session.tempURL
|
|
91
|
+
$uri: (session) => session.tempURL,
|
|
87
92
|
},
|
|
88
93
|
finalize: defaults(finalOpts, {
|
|
89
94
|
$body: (session) => {
|
|
@@ -92,11 +97,11 @@ const Support = WebexPlugin.extend({
|
|
|
92
97
|
return {
|
|
93
98
|
filename: session.logFilename,
|
|
94
99
|
data: metadataArray,
|
|
95
|
-
userId: this.webex.internal.device.userId || session.userId
|
|
100
|
+
userId: this.webex.internal.device.userId || session.userId,
|
|
96
101
|
};
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
|
-
}
|
|
102
|
+
},
|
|
103
|
+
}),
|
|
104
|
+
},
|
|
100
105
|
});
|
|
101
106
|
|
|
102
107
|
return this.webex.upload(options);
|
|
@@ -122,42 +127,43 @@ const Support = WebexPlugin.extend({
|
|
|
122
127
|
'feedbackId',
|
|
123
128
|
'correlationId',
|
|
124
129
|
'meetingId',
|
|
125
|
-
'surveySessionId'
|
|
126
|
-
]
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
'surveySessionId',
|
|
131
|
+
]
|
|
132
|
+
.map((key) => {
|
|
133
|
+
if (metadata[key]) {
|
|
134
|
+
return {
|
|
135
|
+
key,
|
|
136
|
+
value: metadata[key],
|
|
137
|
+
};
|
|
138
|
+
}
|
|
133
139
|
|
|
134
|
-
|
|
135
|
-
|
|
140
|
+
return null;
|
|
141
|
+
})
|
|
136
142
|
.filter((entry) => Boolean(entry));
|
|
137
143
|
|
|
138
144
|
if (this.webex.sessionId) {
|
|
139
145
|
metadataArray.push({
|
|
140
146
|
key: 'trackingId',
|
|
141
|
-
value: this.webex.sessionId
|
|
147
|
+
value: this.webex.sessionId,
|
|
142
148
|
});
|
|
143
149
|
}
|
|
144
150
|
|
|
145
151
|
if (this.webex.internal.device.userId) {
|
|
146
152
|
metadataArray.push({
|
|
147
153
|
key: 'userId',
|
|
148
|
-
value: this.webex.internal.device.userId
|
|
154
|
+
value: this.webex.internal.device.userId,
|
|
149
155
|
});
|
|
150
156
|
}
|
|
151
157
|
|
|
152
158
|
if (this.webex.internal.device.orgId) {
|
|
153
159
|
metadataArray.push({
|
|
154
160
|
key: 'orgId',
|
|
155
|
-
value: this.webex.internal.device.orgId
|
|
161
|
+
value: this.webex.internal.device.orgId,
|
|
156
162
|
});
|
|
157
163
|
}
|
|
158
164
|
|
|
159
165
|
return metadataArray;
|
|
160
|
-
}
|
|
166
|
+
},
|
|
161
167
|
});
|
|
162
168
|
|
|
163
169
|
export default Support;
|
|
@@ -20,46 +20,46 @@ describe('plugin-support', function () {
|
|
|
20
20
|
|
|
21
21
|
let sampleTextOne = 'sample-text-one.txt';
|
|
22
22
|
|
|
23
|
-
before('fetch fixtures', () =>
|
|
24
|
-
fh.fetch(sampleTextOne)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
sampleTextOne
|
|
29
|
-
] = res;
|
|
30
|
-
}));
|
|
23
|
+
before('fetch fixtures', () =>
|
|
24
|
+
Promise.all([fh.fetch(sampleTextOne)]).then((res) => {
|
|
25
|
+
[sampleTextOne] = res;
|
|
26
|
+
})
|
|
27
|
+
);
|
|
31
28
|
|
|
32
29
|
// Disabled because rackspace is broken
|
|
33
30
|
describe('#submitLogs()', () => {
|
|
34
31
|
describe('when the current user is authorized', () => {
|
|
35
|
-
before(() =>
|
|
36
|
-
.then((users) => {
|
|
32
|
+
before(() =>
|
|
33
|
+
testUsers.create({count: 1}).then((users) => {
|
|
37
34
|
webex = new WebexCore({
|
|
38
35
|
credentials: {
|
|
39
|
-
authorization: users[0].token
|
|
40
|
-
}
|
|
36
|
+
authorization: users[0].token,
|
|
37
|
+
},
|
|
41
38
|
});
|
|
42
39
|
|
|
43
40
|
return webex.internal.device.register();
|
|
44
|
-
}));
|
|
45
|
-
|
|
46
|
-
it('uploads logs', () => webex.internal.support.submitLogs({}, sampleTextOne)
|
|
47
|
-
.then((body) => {
|
|
48
|
-
assert.isDefined(body);
|
|
49
|
-
assert.property(body, 'url');
|
|
50
|
-
assert.property(body, 'userId');
|
|
51
|
-
assert.equal(body.userId, webex.internal.device.userId);
|
|
52
41
|
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
it('uploads logs', () =>
|
|
45
|
+
webex.internal.support
|
|
46
|
+
.submitLogs({}, sampleTextOne)
|
|
47
|
+
.then((body) => {
|
|
48
|
+
assert.isDefined(body);
|
|
49
|
+
assert.property(body, 'url');
|
|
50
|
+
assert.property(body, 'userId');
|
|
51
|
+
assert.equal(body.userId, webex.internal.device.userId);
|
|
52
|
+
})
|
|
53
|
+
// Atlas has a really unfortunate rate limit in place, so we're going
|
|
54
|
+
// to rely on hope that enough of the node/browser runs don't get rate
|
|
55
|
+
// limited to prove this code works.
|
|
56
|
+
.catch((err) => {
|
|
57
|
+
if (err instanceof TooManyRequests) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
throw err;
|
|
62
|
+
}));
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
});
|
|
@@ -16,8 +16,8 @@ describe('plugin-support', function () {
|
|
|
16
16
|
beforeEach(() => {
|
|
17
17
|
webex = new MockWebex({
|
|
18
18
|
children: {
|
|
19
|
-
support: Support
|
|
20
|
-
}
|
|
19
|
+
support: Support,
|
|
20
|
+
},
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
webex.internal.device.userId = 'user-abc-123';
|
|
@@ -29,18 +29,20 @@ describe('plugin-support', function () {
|
|
|
29
29
|
const result = webex.internal.support._constructFileMetadata({});
|
|
30
30
|
|
|
31
31
|
assert.equal(result.length, 3);
|
|
32
|
-
assert.deepEqual(result, [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
32
|
+
assert.deepEqual(result, [
|
|
33
|
+
{
|
|
34
|
+
key: 'trackingId',
|
|
35
|
+
value: 'mock-webex_88888888-4444-4444-4444-aaaaaaaaaaaa',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
key: 'userId',
|
|
39
|
+
value: webex.internal.device.userId,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
key: 'orgId',
|
|
43
|
+
value: webex.internal.device.orgId,
|
|
44
|
+
},
|
|
45
|
+
]);
|
|
44
46
|
});
|
|
45
47
|
|
|
46
48
|
it('does not send sessionId key if sessionId is not defined', () => {
|