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

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/dist/index.js CHANGED
@@ -1,8 +1,23 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
18
  };
5
19
  Object.defineProperty(exports, "__esModule", { value: true });
6
20
  const store_1 = __importDefault(require("./store"));
21
+ __exportStar(require("./store.types"), exports);
7
22
  exports.default = store_1.default;
8
23
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAC5B,kBAAe,eAAK,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,oDAA4B;AAC5B,gDAA8B;AAC9B,kBAAe,eAAK,CAAC"}
package/dist/store.js CHANGED
@@ -11,19 +11,35 @@ class Store {
11
11
  this.loginOptions = [];
12
12
  (0, mobx_1.makeAutoObservable)(this, { cc: mobx_1.observable.ref });
13
13
  }
14
- init(webexConfig, access_token) {
14
+ registerCC(webex) {
15
+ this.cc = webex.cc;
16
+ return this.cc.register().then((response) => {
17
+ this.teams = response.teams;
18
+ this.loginOptions = response.loginVoiceOptions;
19
+ }).catch((error) => {
20
+ console.error('Error registering contact center', error);
21
+ return Promise.reject(error);
22
+ });
23
+ }
24
+ init(options) {
25
+ if ('webex' in options) {
26
+ // If devs decide to go with webex, they will have to listen to the ready event before calling init
27
+ // This has to be documented
28
+ return this.registerCC(options.webex);
29
+ }
15
30
  return new Promise((resolve, reject) => {
31
+ const timer = setTimeout(() => {
32
+ reject(new Error('Webex SDK failed to initialize'));
33
+ }, 6000);
16
34
  const webex = webex_1.default.init({
17
- config: webexConfig,
35
+ config: options.webexConfig,
18
36
  credentials: {
19
- access_token: access_token
37
+ access_token: options.access_token
20
38
  }
21
39
  });
22
40
  webex.once('ready', () => {
23
- this.cc = webex.cc;
24
- this.cc.register().then((response) => {
25
- this.teams = response.teams;
26
- this.loginOptions = response.loginVoiceOptions;
41
+ clearTimeout(timer);
42
+ this.registerCC(webex).then(() => {
27
43
  resolve();
28
44
  })
29
45
  .catch((error) => {
package/dist/store.js.map CHANGED
@@ -1 +1 @@
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,YA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strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=store.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.types.js","sourceRoot":"","sources":["../src/store.types.ts"],"names":[],"mappings":""}
@@ -1,2 +1,3 @@
1
1
  import store from './store';
2
+ export * from './store.types';
2
3
  export default store;
@@ -1,10 +1,11 @@
1
- import { IContactCenter, Team } from '@webex/plugin-cc';
2
- declare class Store {
1
+ import { IContactCenter, Team, WithWebex, InitParams, IStore } from './store.types';
2
+ declare class Store implements IStore {
3
3
  teams: Team[];
4
4
  loginOptions: string[];
5
5
  cc: IContactCenter;
6
6
  constructor();
7
- init(webexConfig: any, access_token: string): Promise<void>;
7
+ registerCC(webex: WithWebex['webex']): Promise<void>;
8
+ init(options: InitParams): Promise<void>;
8
9
  }
9
10
  declare const store: Store;
10
11
  export default store;
@@ -0,0 +1,19 @@
1
+ import { AgentLogin, IContactCenter, Profile, Team } from '@webex/plugin-cc';
2
+ interface WithWebex {
3
+ webex: {
4
+ cc: IContactCenter;
5
+ };
6
+ }
7
+ interface WithWebexConfig {
8
+ webexConfig: any;
9
+ access_token: string;
10
+ }
11
+ type InitParams = WithWebex | WithWebexConfig;
12
+ interface IStore {
13
+ teams: Team[];
14
+ loginOptions: string[];
15
+ cc: IContactCenter;
16
+ registerCC(webex: WithWebex['webex']): Promise<Profile>;
17
+ init(params: InitParams): Promise<void>;
18
+ }
19
+ export type { IContactCenter, Profile, Team, AgentLogin, WithWebex, InitParams, IStore };
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.2",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
7
7
  "publishConfig": {
@@ -18,12 +18,11 @@
18
18
  "test:unit": "jest"
19
19
  },
20
20
  "dependencies": {
21
- "@webex/plugin-cc": "3.5.0-wxcc.2",
22
21
  "mobx": "6.13.5",
23
22
  "react": "18.3.1",
24
23
  "react-dom": "18.3.1",
25
24
  "typescript": "5.6.3",
26
- "webex": "3.6.0-wxcc.3"
25
+ "webex": "3.6.0-wxcc.5"
27
26
  },
28
27
  "devDependencies": {
29
28
  "@babel/core": "7.25.2",
@@ -48,7 +47,11 @@
48
47
  "jest": {
49
48
  "testEnvironment": "jsdom",
50
49
  "//": "We can remove this when we have tests",
51
- "passWithNoTests": true
50
+ "passWithNoTests": true,
51
+ "testMatch": [
52
+ "**/tests/**/*.ts",
53
+ "**/tests/**/*.tsx"
54
+ ]
52
55
  },
53
- "stableVersion": "1.0.0"
56
+ "stableVersion": "1.28.0-ccwidgets.1"
54
57
  }