@webex/internal-plugin-support 3.0.0-beta.14 → 3.0.0-beta.15
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.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/support.js +1 -1
- 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.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;eAEe;EACbA,MAAM,EAAE;IACNC,oBAAoB,EAAE;MACpBC,eAAe,EAAEC,OAAO,CAACC,GAAR,CAAYC,iBAAZ,IAAiC,uCAD9B;MAEpBC,KAAK,EAAEH,OAAO,CAACC,GAAR,CAAYC,iBAAZ,IAAiC,uCAFpB;MAGpBE,UAAU,EAAEJ,OAAO,CAACC,GAAR,CAAYI,uBAAZ,IAAuC,uCAH/B;MAIpBC,oBAAoB,EAClBN,OAAO,CAACC,GAAR,CAAYI,uBAAZ,IAAuC;IALrB;EADhB,CADK;EAWbE,OAAO,EAAE;IACPC,OAAO,EAAE,EADF;IAEPC,UAAU,EAAE,EAFL;IAGPC,YAAY,EAAE;EAHP;AAXI,C"}
|
package/dist/index.js
CHANGED
|
@@ -15,14 +15,14 @@ _Object$defineProperty(exports, "default", {
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
require("@webex/internal-plugin-device");
|
|
19
|
+
|
|
18
20
|
var _webexCore = require("@webex/webex-core");
|
|
19
21
|
|
|
20
22
|
var _support = _interopRequireDefault(require("./support"));
|
|
21
23
|
|
|
22
24
|
var _config = _interopRequireDefault(require("./config"));
|
|
23
25
|
|
|
24
|
-
require("@webex/internal-plugin-device");
|
|
25
|
-
|
|
26
26
|
/*!
|
|
27
27
|
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
28
28
|
*/
|
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,iCAAA,EAAuB,SAAvB,EAAkCC,gBAAlC,EAA2C;EACzCC,MAAM,EAANA;AADyC,CAA3C"}
|
package/dist/support.js
CHANGED
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,sBAAA,CAAYC,MAAZ,CAAmB;EACjCC,SAAS,EAAE,SADsB;EAGjCC,cAHiC,0BAGlBC,OAHkB,EAGT;IACtBA,OAAO,GAAGA,OAAO,IAAI,EAArB;IAEA,OAAO,KAAKC,OAAL,CAAa;MAClBC,MAAM,EAAE,MADU;MAElBC,GAAG,EAAE,cAFa;MAGlBC,QAAQ,EAAE,uBAHQ;MAIlBC,IAAI,EAAE,wBAASL,OAAT,EAAkB;QACtBM,UAAU,EAAE,KAAKC,MAAL,CAAYD,UADF;QAEtBE,OAAO,EAAE,KAAKD,MAAL,CAAYC,OAFC;QAGtBC,UAAU,EAAET,OAAO,CAACS,UAAR,IAAsBC,aAAA,CAAKC,EAAL,EAHZ;QAItBC,YAAY,EAAE,KAAKL,MAAL,CAAYK;MAJJ,CAAlB;IAJY,CAAb,EAUJC,IAVI,CAUC,UAACC,GAAD;MAAA,OAASA,GAAG,CAACT,IAAJ,CAASU,GAAlB;IAAA,CAVD,CAAP;EAWD,CAjBgC;EAmBjCC,aAnBiC,2BAmBjB;IACd,OAAO,KAAKC,KAAL,CACJhB,OADI,CACI;MACPC,MAAM,EAAE,KADD;MAEPC,GAAG,EAAE,cAFE;MAGPC,QAAQ,EAAE,sBAHH;MAIPc,EAAE,EAAE;QACFN,YAAY,EAAE,KAAKL,MAAL,CAAYK;MADxB;IAJG,CADJ,EASJC,IATI,CASC,UAACC,GAAD;MAAA,OAASA,GAAG,CAACT,IAAJ,CAASU,GAAlB;IAAA,CATD,CAAP;EAUD,CA9BgC;EAgCjCI,UAhCiC,sBAgC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UAELC,KAAK,EAAEzC,QAAQ,CAACwC,GAAD;QAFV,CAAP;MAID;;MAED,OAAO,IAAP;IACD,CAjBmB,EAkBnBE,MAlBmB,CAkBZ,UAACC,KAAD;MAAA,OAAWC,OAAO,CAACD,KAAD,CAAlB;IAAA,CAlBY,CAAtB;;IAoBA,IAAI,KAAK9C,KAAL,CAAWe,SAAf,EAA0B;MACxBV,aAAa,CAAC2C,IAAd,CAAmB;QACjBL,GAAG,EAAE,YADY;QAEjBC,KAAK,EAAE,KAAK5C,KAAL,CAAWe;MAFD,CAAnB;IAID;;IAED,IAAI,KAAKf,KAAL,CAAWwC,QAAX,CAAoBC,MAApB,CAA2BzB,MAA/B,EAAuC;MACrCX,aAAa,CAAC2C,IAAd,CAAmB;QACjBL,GAAG,EAAE,QADY;QAEjBC,KAAK,EAAE,KAAK5C,KAAL,CAAWwC,QAAX,CAAoBC,MAApB,CAA2BzB;MAFjB,CAAnB;IAID;;IAED,IAAI,KAAKhB,KAAL,CAAWwC,QAAX,CAAoBC,MAApB,CAA2BQ,KAA/B,EAAsC;MACpC5C,aAAa,CAAC2C,IAAd,CAAmB;QACjBL,GAAG,EAAE,OADY;QAEjBC,KAAK,EAAE,KAAK5C,KAAL,CAAWwC,QAAX,CAAoBC,MAApB,CAA2BQ;MAFjB,CAAnB;IAID;;IAED,OAAO5C,aAAP;EACD,CA7JgC;EAAA;AAAA,CAAnB,CAAhB;;eAgKe3B,O"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/internal-plugin-support",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.15",
|
|
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.15",
|
|
25
|
+
"@webex/internal-plugin-search": "3.0.0-beta.15",
|
|
26
|
+
"@webex/internal-plugin-support": "3.0.0-beta.15",
|
|
27
|
+
"@webex/test-helper-chai": "3.0.0-beta.15",
|
|
28
|
+
"@webex/test-helper-file": "3.0.0-beta.15",
|
|
29
|
+
"@webex/test-helper-mock-webex": "3.0.0-beta.15",
|
|
30
|
+
"@webex/test-helper-test-users": "3.0.0-beta.15",
|
|
31
|
+
"@webex/webex-core": "3.0.0-beta.15",
|
|
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', () => {
|