@wxcc-desktop/sdk 1.2.6 → 1.2.10

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.
Files changed (67) hide show
  1. package/README.md +18 -391
  2. package/dist/index.js +1 -0
  3. package/dist/types/index.d.ts +21 -0
  4. package/dist/types/jsapi/actions-jsapi.d.ts +33 -0
  5. package/dist/types/jsapi/agent-contact-jsapi.d.ts +430 -0
  6. package/dist/types/jsapi/agent-state-info-jsapi.d.ts +88 -0
  7. package/dist/types/jsapi/common/_logger.d.ts +4 -0
  8. package/dist/types/jsapi/common/_service-checker.d.ts +12 -0
  9. package/dist/types/jsapi/common/_service-events.d.ts +31 -0
  10. package/dist/types/jsapi/config-jsapi.d.ts +26 -0
  11. package/dist/types/jsapi/dialer-jsapi.d.ts +73 -0
  12. package/dist/types/jsapi/i18n-jsapi.d.ts +23 -0
  13. package/dist/types/jsapi/logger-jsapi.d.ts +19 -0
  14. package/dist/types/jsapi/screenpop-jsapi.d.ts +29 -0
  15. package/dist/types/jsapi/shortcut-key-jsapi.d.ts +67 -0
  16. package/dist/types/sdk.d.ts +1 -0
  17. package/package.json +5 -60
  18. package/.eslintignore +0 -5
  19. package/.eslintrc.js +0 -22
  20. package/.prettierignore +0 -5
  21. package/.prettierrc +0 -5
  22. package/README_PUBLISH.md +0 -36
  23. package/jenkins-automation/MergePipeline.groovy +0 -143
  24. package/jest.config.js +0 -15
  25. package/sonar-project.properties +0 -17
  26. package/src/[sandbox]/README.md +0 -55
  27. package/src/[sandbox]/assets/i18n/de/app.json +0 -6
  28. package/src/[sandbox]/assets/i18n/en/app.json +0 -6
  29. package/src/[sandbox]/assets/i18n/widget-using-js-api/de/widget-using-js-api.json +0 -5
  30. package/src/[sandbox]/assets/i18n/widget-using-js-api/en/widget-using-js-api.json +0 -5
  31. package/src/[sandbox]/favicon.ico +0 -0
  32. package/src/[sandbox]/index.html +0 -9
  33. package/src/[sandbox]/sandbox-config.ts +0 -23
  34. package/src/[sandbox]/sandbox-mock.ts +0 -218
  35. package/src/[sandbox]/sandbox.ts +0 -164
  36. package/src/[sandbox]/widget-using-js-api.ts +0 -658
  37. package/src/global.d.ts +0 -5
  38. package/src/index.ts +0 -101
  39. package/src/jsapi/actions-jsapi.test.ts +0 -155
  40. package/src/jsapi/actions-jsapi.ts +0 -410
  41. package/src/jsapi/agent-contact-jsapi.test.ts +0 -217
  42. package/src/jsapi/agent-contact-jsapi.ts +0 -275
  43. package/src/jsapi/agent-state-info-jsapi.test.ts +0 -176
  44. package/src/jsapi/agent-state-info-jsapi.ts +0 -288
  45. package/src/jsapi/common/_logger.test.ts +0 -16
  46. package/src/jsapi/common/_logger.ts +0 -9
  47. package/src/jsapi/common/_service-checker.test.ts +0 -44
  48. package/src/jsapi/common/_service-checker.ts +0 -28
  49. package/src/jsapi/common/_service-events.test.ts +0 -122
  50. package/src/jsapi/common/_service-events.ts +0 -156
  51. package/src/jsapi/config-jsapi.test.ts +0 -78
  52. package/src/jsapi/config-jsapi.ts +0 -106
  53. package/src/jsapi/dialer-jsapi.test.ts +0 -101
  54. package/src/jsapi/dialer-jsapi.ts +0 -116
  55. package/src/jsapi/i18n-jsapi.test.ts +0 -62
  56. package/src/jsapi/i18n-jsapi.ts +0 -77
  57. package/src/jsapi/logger-jsapi.test.ts +0 -45
  58. package/src/jsapi/logger-jsapi.ts +0 -62
  59. package/src/jsapi/screenpop-jsapi.test.ts +0 -80
  60. package/src/jsapi/screenpop-jsapi.ts +0 -100
  61. package/src/jsapi/shortcut-key-jsapi.test.ts +0 -88
  62. package/src/jsapi/shortcut-key-jsapi.ts +0 -112
  63. package/src/sdk.ts +0 -3
  64. package/src/tsconfig.json +0 -18
  65. package/tsconfig.json +0 -13
  66. package/webpack.config.dev.server.ts +0 -12
  67. package/webpack.config.ts +0 -134
@@ -0,0 +1,73 @@
1
+ import { AgentxService, Service } from "@wxcc-desktop/sdk-types";
2
+ import { createJsApiLogger } from "./common/_logger";
3
+ import { createServiceChecker } from "./common/_service-checker";
4
+ import { AqmServiceEntityEvents } from "./common/_service-events";
5
+ declare type Listeners = {
6
+ eOutdialFailed: Parameters<AgentxService["aqm"]["dialer"]["eOutdialFailed"]["listen"]>[0];
7
+ };
8
+ declare type AqmDialerEvents = AqmServiceEntityEvents<Listeners>;
9
+ declare type Config = {
10
+ logger: ReturnType<typeof createJsApiLogger>;
11
+ serviceChecker: ReturnType<typeof createServiceChecker>;
12
+ aqmEvents: AqmDialerEvents;
13
+ };
14
+ export declare class DialerJsApi {
15
+ private readonly logger;
16
+ private readonly serviceChecker;
17
+ private readonly aqmEvents;
18
+ private SERVICE?;
19
+ private checkService;
20
+ constructor(config: Config);
21
+ init(SERVICE?: AgentxService): void;
22
+ cleanup(): void;
23
+ startOutdial(p: {
24
+ data: Service.Aqm.Dialer.tasks;
25
+ }): Promise<import("@wxcc-desktop/sdk-types/agentx-services/core/aqm-reqs").Msg<{
26
+ mediaResourceId: string;
27
+ eventType: string;
28
+ agentId: string;
29
+ destAgentId: string;
30
+ trackingId: string;
31
+ consultMediaResourceId: string;
32
+ interaction: Service.Aqm.Contact.Interaction;
33
+ interactionId: string;
34
+ orgId: string;
35
+ owner: string;
36
+ queueMgr: string;
37
+ type: string;
38
+ ronaTimeout?: number | undefined;
39
+ isConsulted?: boolean | undefined;
40
+ isConferencing: boolean;
41
+ updatedBy?: string | undefined;
42
+ destinationType?: string | undefined;
43
+ }> | undefined>;
44
+ updateCadVariables(p: {
45
+ interactionId: string;
46
+ data: Service.Aqm.Dialer.updateCadPayLoad;
47
+ }): Promise<import("@wxcc-desktop/sdk-types/agentx-services/core/aqm-reqs").Msg<{
48
+ mediaResourceId: string;
49
+ eventType: string;
50
+ agentId: string;
51
+ destAgentId: string;
52
+ trackingId: string;
53
+ consultMediaResourceId: string;
54
+ interaction: Service.Aqm.Contact.Interaction;
55
+ interactionId: string;
56
+ orgId: string;
57
+ owner: string;
58
+ queueMgr: string;
59
+ type: string;
60
+ ronaTimeout?: number | undefined;
61
+ isConsulted?: boolean | undefined;
62
+ isConferencing: boolean;
63
+ updatedBy?: string | undefined;
64
+ destinationType?: string | undefined;
65
+ }> | undefined>;
66
+ addEventListener<T extends keyof Listeners>(eventName: T, listener: Listeners[T]): void;
67
+ addOnceEventListener<T extends keyof Listeners>(eventName: T, listener: Listeners[T]): void;
68
+ removeEventListener<T extends keyof Listeners>(eventName: T, listener: Listeners[T]): void;
69
+ removeOnceEventListener<T extends keyof Listeners>(eventName: T, listener: Listeners[T]): void;
70
+ removeAllEventListeners(): void;
71
+ }
72
+ export declare const createDialerJsApi: () => DialerJsApi;
73
+ export {};
@@ -0,0 +1,23 @@
1
+ import { I18N } from "@uuip/unified-ui-platform-sdk";
2
+ import { AgentxService } from "@wxcc-desktop/sdk-types";
3
+ import { createJsApiLogger } from "./common/_logger";
4
+ import { createServiceChecker } from "./common/_service-checker";
5
+ declare type Config = {
6
+ logger: ReturnType<typeof createJsApiLogger>;
7
+ serviceChecker: ReturnType<typeof createServiceChecker>;
8
+ };
9
+ export declare class I18NJsApi {
10
+ private readonly logger;
11
+ private readonly serviceChecker;
12
+ private SERVICE?;
13
+ private checkService;
14
+ constructor(config: Config);
15
+ init(SERVICE?: AgentxService): void;
16
+ cleanup(): void;
17
+ createInstance(createServiceOptions?: I18N.CreateServiceOptions): import("i18next").i18n;
18
+ createMixin(createMixinOptions: I18N.CreateMixinOptions): <T extends new (...args: any[]) => HTMLElement & I18N.UpdatingElement>(baseElement: T) => T & (new (...args: any[]) => I18N.I18nElement);
19
+ get DEFAULT_INIT_OPTIONS(): import("i18next").InitOptions | undefined;
20
+ getMergedInitOptions(...initOptions: I18N.InitOptions[]): import("i18next").InitOptions;
21
+ }
22
+ export declare const createI18NJsApi: () => I18NJsApi;
23
+ export {};
@@ -0,0 +1,19 @@
1
+ import { Logger } from "@uuip/unified-ui-platform-sdk";
2
+ import { createJsApiLogger } from "./common/_logger";
3
+ declare type Config = {
4
+ logger: ReturnType<typeof createJsApiLogger>;
5
+ };
6
+ export declare class LoggerJsApi {
7
+ private readonly logger;
8
+ private readonly clientLoggers;
9
+ constructor(config: Config);
10
+ createLogger(prefix: string): Logger.Service;
11
+ cleanupLogs(prefix: string): void;
12
+ browserDownloadLogsJson(prefix: string): void;
13
+ browserDownloadLogsText(prefix: string): void;
14
+ getLogsCollection(prefix: string): Logger.LogRecord[] | undefined;
15
+ getLogsJsonUrl(prefix: string): string | undefined;
16
+ getLogsTextUrl(prefix: string): string | undefined;
17
+ }
18
+ export declare const createLoggerJsApi: () => LoggerJsApi;
19
+ export {};
@@ -0,0 +1,29 @@
1
+ import { AgentxService } from "@wxcc-desktop/sdk-types";
2
+ import { createJsApiLogger } from "./common/_logger";
3
+ import { createServiceChecker } from "./common/_service-checker";
4
+ import { AqmServiceEntityEvents } from "./common/_service-events";
5
+ declare type Listeners = {
6
+ eScreenPop: Parameters<AgentxService["aqm"]["screenpop"]["eScreenPop"]["listen"]>[0];
7
+ };
8
+ declare type Config = {
9
+ logger: ReturnType<typeof createJsApiLogger>;
10
+ aqmEvents: AqmServiceEntityEvents<Listeners>;
11
+ serviceChecker: ReturnType<typeof createServiceChecker>;
12
+ };
13
+ export declare class ScreenPopJsApi {
14
+ private readonly logger;
15
+ private readonly serviceChecker;
16
+ private readonly aqmEvents;
17
+ private SERVICE?;
18
+ private checkService;
19
+ constructor(config: Config);
20
+ init(SERVICE?: AgentxService): void;
21
+ cleanup(): void;
22
+ addEventListener<T extends keyof Listeners>(eventName: T, listener: Listeners[T]): void;
23
+ addOnceEventListener<T extends keyof Listeners>(eventName: T, listener: Listeners[T]): void;
24
+ removeEventListener<T extends keyof Listeners>(eventName: T, listener: Listeners[T]): void;
25
+ removeOnceEventListener<T extends keyof Listeners>(eventName: T, listener: Listeners[T]): void;
26
+ removeAllEventListeners(): void;
27
+ }
28
+ export declare const createScreenPopJsApi: () => ScreenPopJsApi;
29
+ export {};
@@ -0,0 +1,67 @@
1
+ import { AgentxService } from "@wxcc-desktop/sdk-types";
2
+ import { createJsApiLogger } from "./common/_logger";
3
+ import { createServiceChecker } from "./common/_service-checker";
4
+ declare type Config = {
5
+ logger: ReturnType<typeof createJsApiLogger>;
6
+ serviceChecker: ReturnType<typeof createServiceChecker>;
7
+ };
8
+ export declare class ShortcutKeyJsApi {
9
+ private readonly logger;
10
+ private readonly serviceChecker;
11
+ private SERVICE?;
12
+ private checkService;
13
+ constructor(config: Config);
14
+ init(SERVICE?: AgentxService): void;
15
+ cleanup(): void;
16
+ listenKeyPress(...args: Parameters<AgentxService["shortcut"]["event"]["listenKeyPress"]>): void;
17
+ listenKeyConflict(...args: Parameters<AgentxService["shortcut"]["event"]["listenKeyConflict"]>): void;
18
+ listenConflictResolved(...args: Parameters<AgentxService["shortcut"]["event"]["listenConflictResolved"]>): void;
19
+ register(...args: Parameters<AgentxService["shortcut"]["register"]>): void;
20
+ unregisterKeys(...args: Parameters<AgentxService["shortcut"]["unregisterKeys"]>): void;
21
+ getRegisteredKeys(): Map<string, import("@wxcc-desktop/sdk-types").Service.shortcut.KeyInfo> | undefined;
22
+ get DEFAULT_SHORTCUT_KEYS(): {
23
+ [key: string]: import("@wxcc-desktop/sdk-types").Service.shortcut.KeyInfo[];
24
+ } | undefined;
25
+ get MODIFIERS(): {
26
+ CTRL_SHIFT: string;
27
+ ALT_SHIFT: string;
28
+ CTRL_ALT: string;
29
+ SHIFT: string;
30
+ CTRL: string;
31
+ ALT: string;
32
+ } | undefined;
33
+ get REGISTERED_KEYS(): {
34
+ EXPAND_COLLAPSE_INTERACTION_PANEL_KEY: string;
35
+ SAVE_EDITED_CAD_KEY: string;
36
+ REVERT_EDITED_CAD_KEY: string;
37
+ HOLD_RESUME_CALL_KEY: string;
38
+ TRANSFER_KEY: string;
39
+ CONSULT_KEY: string;
40
+ END_KEY: string;
41
+ CONFERENCE_KEY: string;
42
+ PAUSE_RESUME_RECORDING_KEY: string;
43
+ GO_TO_AVAILABLE_KEY: string;
44
+ OPEN_STATE_SELECTOR_KEY: string;
45
+ SEND_EMAIL_KEY: string;
46
+ REPLY_EMAIL_KEY: string;
47
+ REPLY_ALL_EMAIL_KEY: string;
48
+ OPEN_USER_PROFILE_KEY: string;
49
+ ENABLE_SILENT_NOTIFICATION_KEY: string;
50
+ OPEN_SHORTCUT_KEY_MODAL_KEY: string;
51
+ DOWNLOAD_ERROR_REPORT_KEY: string;
52
+ SIGNOUT_KEY: string;
53
+ ACCEPT_TASK_KEY: string;
54
+ SWITCH_POPOVER_KEY: string;
55
+ EXPAND_COLLAPSE_POPOVER_KEY: string;
56
+ OPEN_OUTDIAL_KEY: string;
57
+ OPEN_WRAP_UP_KEY: string;
58
+ EXPAND_COLLAPSE_TASK_LIST_PANEL_KEY: string;
59
+ OPEN_NOTIFICATION_CENTER_KEY: string;
60
+ OPEN_NAVIGATION_TAB_KEY: string;
61
+ REFRESH_KEY: string;
62
+ SWITCH_TASK_KEY: string;
63
+ ACCEPT_ALL_TASK_KEY: string;
64
+ } | undefined;
65
+ }
66
+ export declare const createShortcutKeyJsApi: () => ShortcutKeyJsApi;
67
+ export {};
@@ -0,0 +1 @@
1
+ export declare const logger: import("@uuip/unified-ui-platform-sdk").Logger.Service;
package/package.json CHANGED
@@ -1,72 +1,17 @@
1
1
  {
2
2
  "name": "@wxcc-desktop/sdk",
3
- "version": "1.2.6",
3
+ "version": "1.2.10",
4
4
  "author": "Roman Manchenko",
5
5
  "license": "ISC",
6
6
  "repository": "git@sqbu-github.cisco.com:CBABU/agentx-js-api.git",
7
7
  "main": "./dist/index.js",
8
8
  "types": "./dist/types/index.d.ts",
9
- "scripts": {
10
- "start": "npm run dev",
11
- "dev": "npm run check && webpack-dev-server --config ./webpack.config.dev.server.ts",
12
- "dev:build": "npm run check && webpack --config-name=dev",
13
- "dist": "npm run check && webpack --config-name=distProd",
14
- "dist:dev": "npm run check && webpack --config-name=distDev",
15
- "dist:watch": "npm run check && webpack --config-name=distDevWatch",
16
- "npm:auth": "uuip-publish-auth [agentx,uuip,wxcc-desktop]",
17
- "npm:publish:internal": "npm run npm:auth && npm run dist && uuip-publish dist wxcc-desktop && cp -a README_PUBLISH.md publish/README.md",
18
- "npm:publish:external": "cd ./publish && npm login && json -I -f package.json -e 'this.publishConfig={\"registry\": \"https://registry.npmjs.org\"}' && npm publish --access public",
19
- "publish:all": "run-s npm:publish:internal npm:publish:external",
20
- "check": "check-peer-dependencies --yarn",
21
- "test": "jest"
22
- },
23
9
  "dependencies": {
24
10
  "@uuip/unified-ui-platform-sdk": "^1.2.6",
25
- "event-emitter": "^0.3.5",
26
- "@wxcc-desktop/sdk-types": "^1.0.3"
27
- },
28
- "devDependencies": {
29
- "@types/copy-webpack-plugin": "^6.0.0",
30
- "@types/event-emitter": "^0.3.3",
31
- "@types/html-webpack-plugin": "^3.2.2",
32
- "@types/jest": "^25.1.4",
33
- "@types/luxon": "^1.24.0",
34
- "@types/node": "^13.7.7",
35
- "@types/page": "^1.8.0",
36
- "@types/webpack": "^4.41.7",
37
- "@types/webpack-dev-server": "^3.10.1",
38
- "@types/webpack-merge": "^4.1.5",
39
- "@types/webpack-node-externals": "^1.7.1",
40
- "@typescript-eslint/eslint-plugin": "^2.22.0",
41
- "@typescript-eslint/parser": "^2.22.0",
42
- "@uuip/unified-ui-platform": "2.6.1",
43
- "check-peer-dependencies": "2.0.1",
44
- "clean-webpack-plugin": "^3.0.0",
45
- "copy-webpack-plugin": "^6.0.3",
46
- "eslint": "^6.8.0",
47
- "eslint-plugin-prettier": "^3.1.2",
48
- "html-webpack-plugin": "^4.0.1",
49
- "jest": "26.4.2",
50
- "json": "^10.0.0",
51
- "lit-element": "2.3.1",
52
- "lit-html": "1.2.1",
53
- "npm-run-all": "^4.1.5",
54
- "prettier": "^1.19.1",
55
- "remove-files-webpack-plugin": "^1.4.0",
56
- "ts-jest": "26.3.0",
57
- "ts-loader": "^6.2.1",
58
- "ts-node": "^8.6.2",
59
- "typescript": "^3.8.3",
60
- "webpack": "^4.42.0",
61
- "webpack-cli": "^3.3.11",
62
- "webpack-dev-server": "^3.10.3",
63
- "webpack-merge": "^4.2.2",
64
- "webpack-node-externals": "^1.7.2"
11
+ "@wxcc-desktop/sdk-types": "^1.0.3",
12
+ "event-emitter": "^0.3.5"
65
13
  },
66
- "resolutions": {
67
- "jest": "^26.4.2",
68
- "jest-config": "^26.4.2",
69
- "lit-element": "2.3.1",
70
- "lit-html": "1.2.1"
14
+ "publishConfig": {
15
+ "registry": "https://registry.npmjs.org"
71
16
  }
72
17
  }
package/.eslintignore DELETED
@@ -1,5 +0,0 @@
1
- /node_modules
2
- /coverage
3
- /build
4
- /dist
5
- /publish
package/.eslintrc.js DELETED
@@ -1,22 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- parser: "@typescript-eslint/parser",
4
- plugins: [
5
- "@typescript-eslint",
6
- "prettier"
7
- ],
8
- extends: [
9
- "eslint:recommended",
10
- "plugin:@typescript-eslint/eslint-recommended",
11
- "plugin:@typescript-eslint/recommended"
12
- ],
13
- rules: {
14
- "prettier/prettier": "error",
15
- // custom
16
- "@typescript-eslint/explicit-function-return-type": "off",
17
- "@typescript-eslint/no-non-null-assertion": "off",
18
- "@typescript-eslint/no-empty-function": "off",
19
- "@typescript-eslint/no-namespace": "off",
20
- "@typescript-eslint/camelcase": "off"
21
- }
22
- };
package/.prettierignore DELETED
@@ -1,5 +0,0 @@
1
- /node_modules
2
- /coverage
3
- /build
4
- /dist
5
- /publish
package/.prettierrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "printWidth": 120,
3
- "tabWidth": 2,
4
- "semi": true
5
- }
package/README_PUBLISH.md DELETED
@@ -1,36 +0,0 @@
1
- # WXCC Desktop JavaScript SDK
2
-
3
- WXCC Desktop JavaScript SDK is an npm package that allows you to request up-to-date information from the WXCC Desktop. Using the SDK, you can request information such as agent details, assigned tasks, particular task details, current browser locale, and authentication token for Single Sign-On (SSO) integration.
4
-
5
- The SDK package allows you to
6
-
7
- * request data to be passed to your widgets through properties and attributes
8
-
9
- * perform more complex operations by consuming and manipulating the system data inside your widget
10
-
11
- * subscribe to data arriving asynchronously
12
-
13
- Some events in the WXCC Desktop happen asynchronously. To subscribe to the asynchronous events and access data within the payload, you can add a listener. A few examples for asynchronous events are:
14
-
15
- * New task offered
16
-
17
- * New task assigned
18
-
19
- * Consult request created
20
-
21
- * Consult ended
22
-
23
- * Screen pop arrived and more
24
-
25
- ## Get Started
26
-
27
- Run the following command in your project folder or using yarn:
28
-
29
- ```
30
- npm install @wxcc-desktop/sdk --save
31
- yarn add @wxcc-desktop/sdk
32
- ```
33
-
34
- ## For detailed Info refer the below Link
35
-
36
- ### [Webex Contact Center Desktop Docs](https://www.cisco.com/c/en/us/td/docs/voice_ip_comm/cust_contact/contact_center/webexcc/developer_20/webexcc_b_20-desktop-developer-guide-/webexcc_m_30-javascript-sdk.html)
@@ -1,143 +0,0 @@
1
- #!groovy
2
- final String MERGE_COMMAND = 'MERGE'
3
- final String REPO_NAME = 'agentx-js-api'
4
- final String REPO_URL = 'git@sqbu-github.cisco.com:CBABU/'
5
- final String MAIN_BRANCH = 'master'
6
- final String NPMRC_FILE_ID = '3ddf4a0f-ab9d-463e-b984-66d89b2b442c'
7
- final String ENV_FILE_ID = '5fd3656c-d7be-49d1-8cbf-58ba43ee95ee'
8
-
9
- String targetBranch = env.ghprbTargetBranch
10
-
11
-
12
- void gitCheckout(Map<String, Object> options = [:], String repo, String buildBranch) {
13
- static final String CCONE_NAME = "agentx.gen"
14
- static final String CCONE_EMAIL = "agentx.gen@cisco.com"
15
- def extensions = [
16
- [$class: 'RelativeTargetDirectory', relativeTargetDir: options.targetDir ?: repo],
17
- [$class: 'UserIdentity', name: CCONE_NAME, email: CCONE_EMAIL]
18
- ]
19
-
20
- if (options.mergeTarget) {
21
- extensions += [[$class: 'PreBuildMerge', options: [mergeRemote: 'origin', mergeTarget: options.mergeTarget]]]
22
- }
23
-
24
- String refSpec = options.mergeTarget ?
25
- "+refs/pull/*:refs/remotes/origin/pr/* +refs/heads/${options.mergeTarget}:refs/remotes/origin/${options.mergeTarget}" :
26
- '+refs/heads/*:refs/remotes/origin/*'
27
-
28
- String gitCredentials = options.gitCredentials ?: "git"
29
- String gitRepoUrl = options.gitRepoUrl ?: 'git@sqbu-github.cisco.com:CBABU/'
30
-
31
- checkout([$class: 'GitSCM',
32
- branches: [[name: buildBranch]],
33
- doGenerateSubmoduleConfigurations: false,
34
- extensions: extensions,
35
- submoduleCfg: [],
36
- userRemoteConfigs: [[credentialsId: gitCredentials,
37
- refspec: refSpec,
38
- url: "${gitRepoUrl}${repo}.git"]]
39
- ])
40
- }
41
-
42
- def installDependencies(String directory = '.') {
43
- sshagent([GIT_AUTH]) {
44
- dir(directory) {
45
- sh 'yarn'
46
- }
47
- }
48
- }
49
-
50
- def build(String directory = '.'){
51
- dir(directory){
52
- sh 'yarn dist'
53
- }
54
- }
55
-
56
- def unitTest(String directory = '.') {
57
- dir(directory) {
58
- sh 'yarn test'
59
- }
60
- }
61
-
62
- def mergePullRequest() {
63
- step([$class: 'GhprbPullRequestMerge', allowMergeWithoutTriggerPhrase: false, deleteOnMerge: true,
64
- disallowOwnCode: false, failOnNonMerge: true, mergeComment: "Merged to ${env.ghprbTargetBranch}",
65
- onlyAdminsMerge: false])
66
- }
67
-
68
- def sendMail() {
69
- EMAIL_TO && (currentBuild.result != "ABORTED") && node {
70
- step([$class: 'Mailer', notifyEveryUnstableBuild: true,
71
- recipients: "$EMAIL_TO", sendToIndividuals: false])
72
- }
73
- }
74
-
75
- def runSonarScanner(String directory = '.', String buildBranch){
76
- dir(directory) {
77
- def sonarqubeScanner = tool 'Jenkins-SonarQube';
78
- withSonarQubeEnv('Jenkins-SonarQube') {
79
- sh "${sonarqubeScanner}/bin/sonar-scanner -X -Dsonar.projectKey=AgentXJSAPI -Dsonar.sources=src/ -Dsonar.typescript.lcov.reportPaths=coverage/lcov.info -Dsonar.language=typescript -Dsonar.branch.name=${buildBranch}"
80
- }
81
- }
82
- }
83
-
84
- def checkSonarQualityGate(){
85
- timeout(time: 2, unit: 'MINUTES') {
86
- def qg = waitForQualityGate()
87
- if (qg.status != 'OK') {
88
- error "Pipeline aborted due to quality gate failure: ${qg.status}"
89
- }
90
- }
91
- }
92
-
93
-
94
- try {
95
-
96
- node(env.BUILD_NODE_LABEL){
97
-
98
- stage('Checkout') {
99
- gitCheckout(REPO_NAME, env.sha1 as String, gitCredentials: GIT_AUTH, gitRepoUrl: REPO_URL, mergeTarget: targetBranch)
100
- }
101
-
102
- nodejs(nodeJSInstallationName: 'NodeJS_12.16.3', configId: NPMRC_FILE_ID) {
103
- stage('Install dependencies') {
104
- installDependencies(REPO_NAME)
105
- }
106
-
107
- stage('Build') {
108
- configFileProvider(
109
- [configFile(fileId: ENV_FILE_ID, variable: 'myfile')]
110
- ) {
111
- sh "mv ${env.myfile} ${workspace}/${REPO_NAME}/.env" // Workspace Whitespace Replacement plugin required
112
- build(REPO_NAME)
113
- }
114
- }
115
-
116
- stage('Unit Test'){
117
- unitTest(REPO_NAME)
118
- }
119
- }
120
-
121
- stage('Sonar Scanner Analysis'){
122
- runSonarScanner(REPO_NAME, env.ghprbSourceBranch)
123
- sleep(15)
124
- }
125
-
126
- stage('Sonar Scanner Quality Gate'){
127
- checkSonarQualityGate()
128
- }
129
-
130
- currentBuild.result = "SUCCESS"
131
- stage('Merge Pull Request') {
132
- if (ghprbCommentBody.equals(MERGE_COMMAND)) {
133
- mergePullRequest()
134
- }
135
- runSonarScanner(REPO_NAME, MAIN_BRANCH)
136
- }
137
- }
138
- } catch(error) {
139
- currentBuild.result = "FAILURE"
140
- throw error
141
- } finally {
142
- sendMail()
143
- }
package/jest.config.js DELETED
@@ -1,15 +0,0 @@
1
- const ignorePatterns = ["/node_modules/", "/build/", "/dist/", "/publish/", "/src/[sandbox]/", "/src/index.ts"];
2
-
3
- /* eslint-disable no-undef */
4
- module.exports = {
5
- testEnvironment: "jsdom",
6
- collectCoverage: true,
7
- coverageProvider: "v8",
8
- transform: {
9
- "^.+\\.ts$": "ts-jest"
10
- },
11
- testRegex: "^.+\\.test\\.ts$",
12
- testPathIgnorePatterns: ignorePatterns,
13
- coveragePathIgnorePatterns: ignorePatterns,
14
- moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"]
15
- };
@@ -1,17 +0,0 @@
1
- # must be unique in a given SonarQube instance
2
- sonar.projectKey=AgentXJSAPI
3
-
4
- # --- optional properties ---
5
-
6
- # defaults to project key
7
- #sonar.projectName=My project
8
- # defaults to 'not provided'
9
- #sonar.projectVersion=1.0
10
-
11
- # Path is relative to the sonar-project.properties file. Defaults to .
12
- #sonar.sources=.
13
-
14
- # Encoding of the source code. Default is default system encoding
15
- #sonar.sourceEncoding=UTF-8
16
-
17
- sonar.exclusions=node_modules/**, coverage/**, dist/**, src/**/*.test.*, src/[sandbox]/**, src/index.ts
@@ -1,55 +0,0 @@
1
- # Configure JS API for testing
2
-
3
- ### `Desktop.config` sub-module
4
- ```Javascript
5
- import { Desktop } from "@wxcc-desktop/sdk";
6
- import { initAgentxServices, SERVICE } from "@wxcc-desktop/sdk-types";
7
-
8
- //...
9
-
10
- // INIT SERVICE Singleton from "@wxcc-desktop/sdk-types" somehere in root app
11
- await initAgentxServices({
12
- AQM_HOST: AQM_HOST,
13
- CMS_HOST: CMS_HOST,
14
- COMPLIANCE_SERVICE_URL: COMPLIANCE_SERVICE_URL,
15
- CONFIG_URL: CONFIG_URL,
16
- EMM_HOST: EMM_HOST,
17
- NOTIF_HOST: NOTIF_HOST,
18
- WXM_HOST: WXM_HOST,
19
- DIALER_HOST: DIALER_HOST
20
- }, ACCESS_TOKEN);
21
-
22
- //...
23
-
24
- // INIT Desktop config in third-party widget (it relies on global variable AGENTX_SERVICE under the hood)
25
- await Desktop.config.init({
26
- accessToken: ACCESS_TOKEN // Optional
27
- });
28
- // After Desktop config inited, all sub-modules will inject SERVICE instance via their init() methods automatically
29
-
30
- // CLEANUP Desktop config is possible to re-use modules with SERVICE configured to another environment
31
- Desktop.config.cleanup();
32
- // After Desktop config cleaned, all sub-modules will cleanup themselves via their cleanup() methods automatically
33
-
34
- //...
35
- ```
36
-
37
- ## Setup Cisco SonarQube Code Quality Tool integration (optional)
38
-
39
- Check VS Code extension is installed: https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarlint-vscode
40
- Navigate to https://engci-sonar-sjc.cisco.com/sonar/account/security/ and generate `<PERSONAL SONAR TOKEN>`
41
-
42
- Add to VS Code User `settings.json` such config with generated token:
43
- ```
44
- {
45
- ...
46
- "sonarlint.connectedMode.connections.sonarqube": [
47
- {
48
- "connectionId": "cisco",
49
- "serverUrl": "https://engci-sonar-sjc.cisco.com/sonar",
50
- "token": "2e83bdec5368441f6e150b02e7e74aa185522462"
51
- }
52
- ]
53
- ...
54
- }
55
- ```
@@ -1,6 +0,0 @@
1
- {
2
- "preparing": "JS-API mit config vorbereiten",
3
- "wait": "Warten",
4
- "login": "Einloggen",
5
- "logout": "Ausloggen"
6
- }
@@ -1,6 +0,0 @@
1
- {
2
- "preparing": "Preparing JS API with config",
3
- "wait": "Wait",
4
- "login": "Login",
5
- "logout": "Logout"
6
- }
@@ -1,5 +0,0 @@
1
- {
2
- "a": "a-de-widget-using-js-api",
3
- "b": "b-de-widget-using-js-api",
4
- "c": "c-de-widget-using-js-api"
5
- }
@@ -1,5 +0,0 @@
1
- {
2
- "a": "a-en-widget-using-js-api",
3
- "b": "b-en-widget-using-js-api",
4
- "c": "c-en-widget-using-js-api"
5
- }
Binary file
@@ -1,9 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <title>Sandbox [agentx-js-api]</title>
5
- </head>
6
- <body>
7
- <agentx-js-api-sandbox></agentx-js-api-sandbox>
8
- </body>
9
- </html>