@webex/cc-store 1.28.0-ccwidgets.1 → 1.28.0-ccwidgets.11

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.
@@ -1,2 +1,3 @@
1
1
  import store from './store';
2
+ export * from './store.types';
2
3
  export default store;
@@ -1,10 +1,20 @@
1
- import { IContactCenter, Team } from '@webex/plugin-cc';
2
- declare class Store {
1
+ import { IContactCenter, Team, WithWebex, IdleCode, InitParams, IStore, ILogger } from './store.types';
2
+ declare class Store implements IStore {
3
+ private static instance;
3
4
  teams: Team[];
4
5
  loginOptions: string[];
5
6
  cc: IContactCenter;
7
+ logger: ILogger;
8
+ idleCodes: IdleCode[];
9
+ agentId: string;
10
+ selectedLoginOption: string;
11
+ isAgentLoggedIn: boolean;
12
+ deviceType: string;
6
13
  constructor();
7
- init(webexConfig: any, access_token: string): Promise<void>;
14
+ static getInstance(): Store;
15
+ setSelectedLoginOption(option: string): void;
16
+ registerCC(webex: WithWebex['webex']): Promise<void>;
17
+ init(options: InitParams): Promise<void>;
8
18
  }
9
19
  declare const store: Store;
10
20
  export default store;
@@ -0,0 +1,36 @@
1
+ import { AgentLogin, IContactCenter, Profile, Team, LogContext } from '@webex/plugin-cc';
2
+ type ILogger = {
3
+ log: (message: string, context?: LogContext) => void;
4
+ info: (message: string, context?: LogContext) => void;
5
+ warn: (message: string, context?: LogContext) => void;
6
+ trace: (message: string, context?: LogContext) => void;
7
+ error: (message: string, context?: LogContext) => void;
8
+ };
9
+ interface WithWebex {
10
+ webex: {
11
+ cc: IContactCenter;
12
+ logger: ILogger;
13
+ };
14
+ }
15
+ interface WithWebexConfig {
16
+ webexConfig: any;
17
+ access_token: string;
18
+ }
19
+ type InitParams = WithWebex | WithWebexConfig;
20
+ type IdleCode = {
21
+ name: string;
22
+ id: string;
23
+ isSystem: boolean;
24
+ isDefault: boolean;
25
+ };
26
+ interface IStore {
27
+ teams: Team[];
28
+ loginOptions: string[];
29
+ cc: IContactCenter;
30
+ idleCodes: IdleCode[];
31
+ agentId: string;
32
+ logger: ILogger;
33
+ registerCC(webex: WithWebex['webex']): Promise<Profile>;
34
+ init(params: InitParams): Promise<void>;
35
+ }
36
+ export type { IContactCenter, Profile, Team, AgentLogin, WithWebex, IdleCode, InitParams, IStore, ILogger, };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@webex/cc-store",
3
3
  "description": "Webex Contact Center Widgets: Widgets Store",
4
- "version": "1.28.0-ccwidgets.1",
4
+ "version": "1.28.0-ccwidgets.11",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
7
7
  "publishConfig": {
@@ -12,18 +12,17 @@
12
12
  "package.json"
13
13
  ],
14
14
  "scripts": {
15
+ "clean": "rm -rf dist && rm -rf node_modules",
16
+ "clean:dist": "rm -rf dist",
15
17
  "build": "yarn run -T tsc",
16
- "build:src": "webpack && yarn run build",
18
+ "build:src": "yarn run clean:dist && webpack",
17
19
  "build:watch": "webpack --watch",
18
20
  "test:unit": "jest"
19
21
  },
20
22
  "dependencies": {
21
- "@webex/plugin-cc": "3.5.0-wxcc.2",
22
23
  "mobx": "6.13.5",
23
- "react": "18.3.1",
24
- "react-dom": "18.3.1",
25
24
  "typescript": "5.6.3",
26
- "webex": "3.6.0-wxcc.3"
25
+ "webex": "3.7.0-wxcc.6"
27
26
  },
28
27
  "devDependencies": {
29
28
  "@babel/core": "7.25.2",
@@ -47,8 +46,10 @@
47
46
  },
48
47
  "jest": {
49
48
  "testEnvironment": "jsdom",
50
- "//": "We can remove this when we have tests",
51
- "passWithNoTests": true
49
+ "testMatch": [
50
+ "**/tests/**/*.ts",
51
+ "**/tests/**/*.tsx"
52
+ ]
52
53
  },
53
- "stableVersion": "1.0.0"
54
+ "stableVersion": "1.28.0-ccwidgets.10"
54
55
  }
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAC5B,kBAAe,eAAK,CAAC"}
package/dist/store.js DELETED
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const mobx_1 = require("mobx");
7
- const webex_1 = __importDefault(require("webex"));
8
- class Store {
9
- constructor() {
10
- this.teams = [];
11
- this.loginOptions = [];
12
- (0, mobx_1.makeAutoObservable)(this, { cc: mobx_1.observable.ref });
13
- }
14
- init(webexConfig, access_token) {
15
- return new Promise((resolve, reject) => {
16
- const webex = webex_1.default.init({
17
- config: webexConfig,
18
- credentials: {
19
- access_token: access_token
20
- }
21
- });
22
- webex.once('ready', () => {
23
- this.cc = webex.cc;
24
- this.cc.register().then((response) => {
25
- this.teams = response.teams;
26
- this.loginOptions = response.loginVoiceOptions;
27
- resolve();
28
- })
29
- .catch((error) => {
30
- reject(error);
31
- });
32
- });
33
- });
34
- }
35
- }
36
- const store = new Store();
37
- exports.default = store;
38
- //# sourceMappingURL=store.js.map
package/dist/store.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":";;;;;AAAA,+BAAoD;AACpD,kDAA0B;AAG1B,MAAM,KAAK;IAKT;QAJA,UAAK,GAAW,EAAE,CAAC;QACnB,iBAAY,GAAa,EAAE,CAAC;QAI1B,IAAA,yBAAkB,EAAC,IAAI,EAAE,EAAC,EAAE,EAAE,iBAAU,CAAC,GAAG,EAAC,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,CAAC,WAAgB,EAAE,YAAoB;QACzC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,KAAK,GAAG,eAAK,CAAC,IAAI,CAAC;gBACvB,MAAM,EAAE,WAAW;gBACnB,WAAW,EAAE;oBACX,YAAY,EAAE,YAAY;iBAC3B;aACF,CAAC,CAAC;YAEH,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;gBACvB,IAAI,CAAC,EAAE,GAAG,KAAK,CAAC,EAAE,CAAC;gBACnB,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,QAAuB,EAAE,EAAE;oBAClD,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;oBAC5B,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,iBAAiB,CAAC;oBAC/C,OAAO,EAAE,CAAC;gBACZ,CAAC,CAAC;qBACD,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;oBACf,MAAM,CAAC,KAAK,CAAC,CAAC;gBAChB,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;AAC1B,kBAAe,KAAK,CAAC"}