@webex/cc-store 1.28.0-alpha.9 → 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
@@ -4,24 +4,48 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const mobx_1 = require("mobx");
7
- const sdk_1 = __importDefault(require("./sdk"));
8
- /*
9
- * Store Class
10
- */
7
+ const webex_1 = __importDefault(require("webex"));
11
8
  class Store {
12
9
  constructor() {
13
- this.loginState = '';
14
- this.isAvailable = false;
15
- this.ccSdk = sdk_1.default;
16
- this.setLoginState = (state) => {
17
- this.loginState = state;
18
- };
19
- this.setIsAvailable = (state) => {
20
- this.isAvailable = state;
21
- };
22
- (0, mobx_1.makeAutoObservable)(this, { ccSdk: mobx_1.observable.ref });
23
- this.ccSdk.on('presence:state', (payload) => {
24
- this.setIsAvailable(payload === 'available');
10
+ this.teams = [];
11
+ this.loginOptions = [];
12
+ (0, mobx_1.makeAutoObservable)(this, { cc: mobx_1.observable.ref });
13
+ }
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
+ }
30
+ return new Promise((resolve, reject) => {
31
+ const timer = setTimeout(() => {
32
+ reject(new Error('Webex SDK failed to initialize'));
33
+ }, 6000);
34
+ const webex = webex_1.default.init({
35
+ config: options.webexConfig,
36
+ credentials: {
37
+ access_token: options.access_token
38
+ }
39
+ });
40
+ webex.once('ready', () => {
41
+ clearTimeout(timer);
42
+ this.registerCC(webex).then(() => {
43
+ resolve();
44
+ })
45
+ .catch((error) => {
46
+ reject(error);
47
+ });
48
+ });
25
49
  });
26
50
  }
27
51
  }
package/dist/store.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":";;;;;AAAA,+BAAoD;AAEpD,gDAAwB;AACxB;;GAEG;AACH,MAAM,KAAK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 +1,3 @@
1
+ "use 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,32 +1,11 @@
1
- declare class Store {
2
- loginState: string;
3
- isAvailable: boolean;
4
- ccSdk: {
5
- accessToken: string;
6
- callbacks: {};
7
- init: ({ accessToken }: {
8
- accessToken: any;
9
- }) => Promise<void>;
10
- logout: () => void;
11
- presence: {
12
- currentState: string;
13
- set: (state: any) => void;
14
- };
15
- callControls: {
16
- currentState: string;
17
- mute: () => void;
18
- unmute: () => void;
19
- };
20
- on: (eventName: any, callback: any) => {
21
- eventName: any;
22
- callback: any;
23
- };
24
- off: (eventName: any, callback: any) => void;
25
- emit: (eventName: any, payload: any) => void;
26
- };
1
+ import { IContactCenter, Team, WithWebex, InitParams, IStore } from './store.types';
2
+ declare class Store implements IStore {
3
+ teams: Team[];
4
+ loginOptions: string[];
5
+ cc: IContactCenter;
27
6
  constructor();
28
- setLoginState: (state: any) => void;
29
- setIsAvailable: (state: any) => void;
7
+ registerCC(webex: WithWebex['webex']): Promise<void>;
8
+ init(options: InitParams): Promise<void>;
30
9
  }
31
10
  declare const store: Store;
32
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,32 +1,34 @@
1
1
  {
2
2
  "name": "@webex/cc-store",
3
3
  "description": "Webex Contact Center Widgets: Widgets Store",
4
- "version": "1.28.0-alpha.9",
4
+ "version": "1.28.0-ccwidgets.2",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
10
+ "files": [
11
+ "dist/",
12
+ "package.json"
13
+ ],
10
14
  "scripts": {
11
15
  "build": "yarn run -T tsc",
12
16
  "build:src": "webpack && yarn run build",
13
17
  "build:watch": "webpack --watch",
14
- "test:unit": "jest",
15
- "release": "semantic-release"
18
+ "test:unit": "jest"
16
19
  },
17
20
  "dependencies": {
18
21
  "mobx": "6.13.5",
19
22
  "react": "18.3.1",
20
23
  "react-dom": "18.3.1",
21
- "typescript": "5.6.3"
24
+ "typescript": "5.6.3",
25
+ "webex": "3.6.0-wxcc.5"
22
26
  },
23
27
  "devDependencies": {
24
28
  "@babel/core": "7.25.2",
25
29
  "@babel/preset-env": "7.25.4",
26
30
  "@babel/preset-react": "7.24.7",
27
31
  "@babel/preset-typescript": "7.25.9",
28
- "@semantic-release/changelog": "^6.0.3",
29
- "@semantic-release/git": "^10.0.1",
30
32
  "@testing-library/dom": "10.4.0",
31
33
  "@testing-library/jest-dom": "6.6.2",
32
34
  "@testing-library/react": "16.0.1",
@@ -37,16 +39,19 @@
37
39
  "file-loader": "6.2.0",
38
40
  "jest": "29.7.0",
39
41
  "jest-environment-jsdom": "29.7.0",
40
- "semantic-release": "^24.2.0",
41
- "semantic-release-monorepo": "^8.0.2",
42
- "semantic-release-yarn": "^3.0.2",
43
42
  "ts-loader": "9.5.1",
44
43
  "webpack": "5.94.0",
45
44
  "webpack-cli": "5.1.4",
46
45
  "webpack-merge": "6.0.1"
47
46
  },
48
47
  "jest": {
49
- "testEnvironment": "jsdom"
48
+ "testEnvironment": "jsdom",
49
+ "//": "We can remove this when we have tests",
50
+ "passWithNoTests": true,
51
+ "testMatch": [
52
+ "**/tests/**/*.ts",
53
+ "**/tests/**/*.tsx"
54
+ ]
50
55
  },
51
- "stableVersion": "1.0.0"
56
+ "stableVersion": "1.28.0-ccwidgets.1"
52
57
  }
package/.babelrc.js DELETED
@@ -1,3 +0,0 @@
1
- const baseConfig = require('../../../.babelrc');
2
-
3
- module.exports = baseConfig;
package/CHANGELOG.md DELETED
@@ -1,78 +0,0 @@
1
- # [@webex/cc-store-v1.28.0-alpha.9](https://github.com/webex/widgets/compare/1.28.0-alpha.8...1.28.0-alpha.9) (2024-11-15)
2
-
3
-
4
- ### Features
5
-
6
- * **release:** release-all-cc-widgets ([#265](https://github.com/webex/widgets/issues/265)) ([ca4d845](https://github.com/webex/widgets/commit/ca4d8454865be8a7e86c247c6769f25a08380636))
7
-
8
- # [@webex/cc-store-v1.28.0-alpha.8](https://github.com/webex/widgets/compare/1.28.0-alpha.7...1.28.0-alpha.8) (2024-11-15)
9
-
10
-
11
- ### Bug Fixes
12
-
13
- * **release:** fix-add-channel-in-releaserc ([#264](https://github.com/webex/widgets/issues/264)) ([f47d2b1](https://github.com/webex/widgets/commit/f47d2b1d054d8e071360090254edae7de3503509))
14
-
15
- # [@webex/cc-store-v1.28.0-alpha.7](https://github.com/webex/widgets/compare/1.28.0-alpha.6...1.28.0-alpha.7) (2024-11-15)
16
-
17
-
18
- ### Bug Fixes
19
-
20
- * **release:** add-chanel-in-smeantic-release-yarn ([#263](https://github.com/webex/widgets/issues/263)) ([837d974](https://github.com/webex/widgets/commit/837d974e576cc8fdecfa3ba4a200aa9bdc9666a3))
21
-
22
- # [@webex/cc-store-v1.28.0-alpha.6](https://github.com/webex/widgets/compare/1.28.0-alpha.5...1.28.0-alpha.6) (2024-11-15)
23
-
24
-
25
- ### Bug Fixes
26
-
27
- * **release:** fix-npm-tag ([#256](https://github.com/webex/widgets/issues/256)) ([9ac693a](https://github.com/webex/widgets/commit/9ac693aff72e152c383a4d373f87239f593d4b20))
28
- * **cc-store:** trigger-a-release ([#259](https://github.com/webex/widgets/issues/259)) ([b5bd817](https://github.com/webex/widgets/commit/b5bd8173d55ef7cad496208f5ee2fb1264777520))
29
- * **cc-store:** trigger-a-release ([#261](https://github.com/webex/widgets/issues/261)) ([f15ba04](https://github.com/webex/widgets/commit/f15ba0456c372cf4a70756c301053cd74b836d1b))
30
- * **cc-store:** trigger-a-release-2 ([#262](https://github.com/webex/widgets/issues/262)) ([bfc5a15](https://github.com/webex/widgets/commit/bfc5a15d90cc5cfefe5ae4d92826ba32005843c4))
31
- * **cc-store:** trigger-npm-release ([#257](https://github.com/webex/widgets/issues/257)) ([b6f8a56](https://github.com/webex/widgets/commit/b6f8a56469580b26d7f5e78dbef2a91093e802f8))
32
- * **release:** update-release-rs ([#258](https://github.com/webex/widgets/issues/258)) ([b58d02f](https://github.com/webex/widgets/commit/b58d02f9238319f0a87c00f6fc0404995f7fe0a8))
33
-
34
- # [@webex/cc-store-v1.28.0-alpha.5](https://github.com/webex/widgets/compare/v1.28.0-alpha.4...1.28.0-alpha.5) (2024-11-14)
35
-
36
-
37
- ### Bug Fixes
38
-
39
- * **release:** add-monorepo-semantic-release-support ([#253](https://github.com/webex/widgets/issues/253)) ([a4cb745](https://github.com/webex/widgets/commit/a4cb74587029ae11aeb0fda65d0362fc346e4d8a))
40
- * **release:** sync-packgejson-and-npm-version ([#254](https://github.com/webex/widgets/issues/254)) ([a7b2793](https://github.com/webex/widgets/commit/a7b2793e6dd51ba32762c204e04ab204d1bcf96e))
41
-
42
- # [1.28.0-alpha.4](https://github.com/webex/widgets/compare/v1.28.0-alpha.3...v1.28.0-alpha.4) (2024-11-14)
43
-
44
-
45
- ### Bug Fixes
46
-
47
- * **store:** add-documentation ([#252](https://github.com/webex/widgets/issues/252)) ([f754731](https://github.com/webex/widgets/commit/f7547314196af9ceb1185ab23da6a2df030f3d2c))
48
-
49
- # [1.28.0-alpha.3](https://github.com/webex/widgets/compare/v1.28.0-alpha.2...v1.28.0-alpha.3) (2024-11-14)
50
-
51
-
52
- ### Features
53
-
54
- * **release:** add-publishconfig ([#250](https://github.com/webex/widgets/issues/250)) ([2ee17f6](https://github.com/webex/widgets/commit/2ee17f64f13d51340347dfeb492fd37a2dc40501))
55
-
56
- # [1.28.0-alpha.2](https://github.com/webex/widgets/compare/v1.28.0-alpha.1...v1.28.0-alpha.2) (2024-11-14)
57
-
58
-
59
- ### Bug Fixes
60
-
61
- * **station-login:** test-commit ([#249](https://github.com/webex/widgets/issues/249)) ([706d3d4](https://github.com/webex/widgets/commit/706d3d412574987a9f84079a24697879dc6dba33))
62
-
63
- # [1.28.0-alpha.1](https://github.com/webex/widgets/compare/v1.27.5...v1.28.0-alpha.1) (2024-11-14)
64
-
65
-
66
- ### Bug Fixes
67
-
68
- * **release:** add-mono-repo-support-for-scemantic-release ([#246](https://github.com/webex/widgets/issues/246)) ([4d2a572](https://github.com/webex/widgets/commit/4d2a57280eed3ef3caf5efb8a58c6cea433e1f53))
69
- * convert npm to yarn ([#234](https://github.com/webex/widgets/issues/234)) ([432ed3c](https://github.com/webex/widgets/commit/432ed3cc1b2521f69cd9383cd0dbefad8f0a2eee))
70
- * **circleci:** fix-caching-path-in-ci ([#243](https://github.com/webex/widgets/issues/243)) ([77f40f0](https://github.com/webex/widgets/commit/77f40f098a2f51620bc7af294ec429feeaf8caf1))
71
- * **circleci:** fix-test-branch-name ([#242](https://github.com/webex/widgets/issues/242)) ([d60859a](https://github.com/webex/widgets/commit/d60859ad562a93d2f1fecd1cfe207729c475edd2))
72
- * **release:** remove-semantic-release-npm ([#248](https://github.com/webex/widgets/issues/248)) ([c4e7bb1](https://github.com/webex/widgets/commit/c4e7bb18133fd1500f53ce686076868e00e15ec0))
73
-
74
-
75
- ### Features
76
-
77
- * **release:** add-release-script-and-config ([#241](https://github.com/webex/widgets/issues/241)) ([376e348](https://github.com/webex/widgets/commit/376e34835a11ccf55d43b207a3777aeeb442aaba))
78
- * **pipeline:** run-npm-publish-for-cc-store ([#245](https://github.com/webex/widgets/issues/245)) ([d9ef7ae](https://github.com/webex/widgets/commit/d9ef7ae064f334478391637b9b70359edf0b40de))
package/dist/sdk.js DELETED
@@ -1,71 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const sdk = {
13
- accessToken: '',
14
- callbacks: {},
15
- init: function (_a) {
16
- return __awaiter(this, arguments, void 0, function* ({ accessToken }) {
17
- this.accessToken = accessToken;
18
- });
19
- },
20
- logout: function () {
21
- this.accessToken = '';
22
- this.callControls.unmute();
23
- this.presence.set('busy');
24
- },
25
- presence: {
26
- currentState: 'busy',
27
- set: function (state) {
28
- this.currentState = state;
29
- console.log(`%cWxCCSDK\t\t\t%cpresence.set:%c Received`, 'background: red; color: white;', 'background: lightgreen; color: black;', 'background: transparent; color: grey;');
30
- setTimeout(() => {
31
- sdk.emit('presence:state', this.currentState);
32
- }, 1500);
33
- },
34
- },
35
- callControls: {
36
- currentState: 'unmuted',
37
- mute: function () {
38
- this.currentState = 'muted';
39
- console.log(`%cWxCCSDK\t\t\t%ccallControls.mute:%c Received`, 'background: red; color: white;', 'background: lightgreen; color: black;', 'background: transparent; color: grey;');
40
- setTimeout(() => {
41
- sdk.emit('callControls:muteState', this.currentState);
42
- }, 1500);
43
- },
44
- unmute: function () {
45
- this.currentState = 'unmuted';
46
- console.log(`%cWxCCSDK\t\t\t%ccallControls.unmute:%c Received`, 'background: red; color: white;', 'background: lightgreen; color: black;', 'background: transparent; color: grey;');
47
- setTimeout(() => {
48
- sdk.emit('callControls:muteState', this.currentState);
49
- }, 3000);
50
- },
51
- },
52
- on: function (eventName, callback) {
53
- if (this.callbacks[eventName] === undefined) {
54
- this.callbacks[eventName] = [];
55
- }
56
- this.callbacks[eventName].push(callback);
57
- return {
58
- eventName,
59
- callback,
60
- };
61
- },
62
- off: function (eventName, callback) {
63
- this.callbacks[eventName] = this.callbacks[eventName].filter((cb) => cb !== callback);
64
- },
65
- emit: function (eventName, payload) {
66
- console.log(`%cWxCCSDK\t\t\t%cEmitEvent:%c ${eventName}\t\t%cPayload:%c ${payload}`, 'background: red; color: white;', 'background: lightgreen; color: black;', 'background: transparent; color: grey;', 'background: lightgreen; color: black;', 'background: transparent; color: grey;');
67
- this.callbacks[eventName].forEach((cb) => cb(payload));
68
- },
69
- };
70
- exports.default = sdk;
71
- //# sourceMappingURL=sdk.js.map
package/dist/sdk.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,MAAM,GAAG,GAAG;IACV,WAAW,EAAE,EAAE;IACf,SAAS,EAAE,EAAE;IACb,IAAI,EAAE;6DAAe,EAAC,WAAW,EAAC;YAChC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QACjC,CAAC;KAAA;IACD,MAAM,EAAE;QACN,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;QAC3B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;IACD,QAAQ,EAAE;QACR,YAAY,EAAE,MAAM;QACpB,GAAG,EAAE,UAAS,KAAK;YACjB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;YAC1B,OAAO,CAAC,GAAG,CACT,2CAA2C,EAC3C,gCAAgC,EAChC,uCAA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AC,SAAS,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC;IACxF,CAAC;IACD,IAAI,EAAE,UAAS,SAAS,EAAE,OAAO;QAC/B,OAAO,CAAC,GAAG,CACT,iCAAiC,SAAS,oBAAoB,OAAO,EAAE,EACvE,gCAAgC,EAChC,uCAAuC,EACvC,uCAAuC,EACvC,uCAAuC,EACvC,uCAAuC,CACxC,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACzD,CAAC;CACF,CAAC;AAEF,kBAAe,GAAG,CAAC"}
@@ -1,24 +0,0 @@
1
- declare const sdk: {
2
- accessToken: string;
3
- callbacks: {};
4
- init: ({ accessToken }: {
5
- accessToken: any;
6
- }) => Promise<void>;
7
- logout: () => void;
8
- presence: {
9
- currentState: string;
10
- set: (state: any) => void;
11
- };
12
- callControls: {
13
- currentState: string;
14
- mute: () => void;
15
- unmute: () => void;
16
- };
17
- on: (eventName: any, callback: any) => {
18
- eventName: any;
19
- callback: any;
20
- };
21
- off: (eventName: any, callback: any) => void;
22
- emit: (eventName: any, payload: any) => void;
23
- };
24
- export default sdk;
package/release.config.js DELETED
@@ -1,36 +0,0 @@
1
- module.exports = {
2
- extends: 'semantic-release-monorepo',
3
- branches: [
4
- 'master',
5
- {
6
- name: 'eft-pipeline',
7
- prerelease: 'alpha',
8
- },
9
- ],
10
- plugins: [
11
- '@semantic-release/commit-analyzer',
12
- [
13
- '@semantic-release/release-notes-generator',
14
- {
15
- writerOpts: {
16
- commitsSort: ['subject', 'scope'],
17
- },
18
- },
19
- ],
20
- '@semantic-release/changelog',
21
- [
22
- 'semantic-release-yarn',
23
- {
24
- yarnPublish: false,
25
- },
26
- ],
27
- [
28
- '@semantic-release/git',
29
- {
30
- assets: ['CHANGELOG.md', 'package.json'],
31
- },
32
- ],
33
- '@semantic-release/github',
34
- ],
35
- tagFormat: '${version}',
36
- };
package/src/index.ts DELETED
@@ -1,2 +0,0 @@
1
- import store from './store';
2
- export default store;
package/src/sdk.ts DELETED
@@ -1,80 +0,0 @@
1
- const sdk = {
2
- accessToken: '',
3
- callbacks: {},
4
- init: async function({accessToken}) {
5
- this.accessToken = accessToken;
6
- },
7
- logout: function() {
8
- this.accessToken = '';
9
- this.callControls.unmute();
10
- this.presence.set('busy');
11
- },
12
- presence: {
13
- currentState: 'busy',
14
- set: function(state) {
15
- this.currentState = state;
16
- console.log(
17
- `%cWxCCSDK\t\t\t%cpresence.set:%c Received`,
18
- 'background: red; color: white;',
19
- 'background: lightgreen; color: black;',
20
- 'background: transparent; color: grey;'
21
- );
22
- setTimeout(() => {
23
- sdk.emit('presence:state', this.currentState);
24
- }, 1500);
25
- },
26
- },
27
- callControls: {
28
- currentState: 'unmuted',
29
- mute: function() {
30
- this.currentState = 'muted';
31
- console.log(
32
- `%cWxCCSDK\t\t\t%ccallControls.mute:%c Received`,
33
- 'background: red; color: white;',
34
- 'background: lightgreen; color: black;',
35
- 'background: transparent; color: grey;'
36
- );
37
- setTimeout(() => {
38
- sdk.emit('callControls:muteState', this.currentState);
39
- }, 1500);
40
- },
41
- unmute: function() {
42
- this.currentState = 'unmuted';
43
- console.log(
44
- `%cWxCCSDK\t\t\t%ccallControls.unmute:%c Received`,
45
- 'background: red; color: white;',
46
- 'background: lightgreen; color: black;',
47
- 'background: transparent; color: grey;'
48
- );
49
- setTimeout(() => {
50
- sdk.emit('callControls:muteState', this.currentState);
51
- }, 3000);
52
- },
53
- },
54
- on: function(eventName, callback) {
55
- if (this.callbacks[eventName] === undefined) {
56
- this.callbacks[eventName] = [];
57
- }
58
- this.callbacks[eventName].push(callback);
59
- return {
60
- eventName,
61
- callback,
62
- };
63
- },
64
- off: function(eventName, callback) {
65
- this.callbacks[eventName] = this.callbacks[eventName].filter((cb) => cb !== callback);
66
- },
67
- emit: function(eventName, payload) {
68
- console.log(
69
- `%cWxCCSDK\t\t\t%cEmitEvent:%c ${eventName}\t\t%cPayload:%c ${payload}`,
70
- 'background: red; color: white;',
71
- 'background: lightgreen; color: black;',
72
- 'background: transparent; color: grey;',
73
- 'background: lightgreen; color: black;',
74
- 'background: transparent; color: grey;'
75
- );
76
- this.callbacks[eventName].forEach((cb) => cb(payload));
77
- },
78
- };
79
-
80
- export default sdk;
package/src/store.ts DELETED
@@ -1,30 +0,0 @@
1
- import {makeAutoObservable, observable} from 'mobx';
2
-
3
- import sdk from './sdk';
4
- /*
5
- * Store Class
6
- */
7
- class Store {
8
- loginState = '';
9
- isAvailable = false;
10
- ccSdk = sdk;
11
-
12
- constructor() {
13
- makeAutoObservable(this, {ccSdk: observable.ref});
14
-
15
- this.ccSdk.on('presence:state', (payload) => {
16
- this.setIsAvailable(payload === 'available');
17
- });
18
- }
19
-
20
- setLoginState = (state) => {
21
- this.loginState = state;
22
- };
23
-
24
- setIsAvailable = (state) => {
25
- this.isAvailable = state;
26
- };
27
- }
28
-
29
- const store = new Store();
30
- export default store;
package/tsconfig.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "extends": "../../../tsconfig.json",
3
- "include": [
4
- "./src"
5
- ],
6
- "compilerOptions": {
7
- "outDir": "./dist",
8
- "declaration": true,
9
- "declarationDir": "./dist/types"
10
- },
11
- }
package/webpack.config.js DELETED
@@ -1,12 +0,0 @@
1
- const {merge} = require('webpack-merge');
2
- const path = require('path');
3
-
4
- const baseConfig = require('../../../webpack.config');
5
-
6
- module.exports = merge(baseConfig, {
7
- output: {
8
- path: path.resolve(__dirname, 'dist'),
9
- filename: 'index.js', // Set the output filename to index.js
10
- libraryTarget: 'commonjs2',
11
- },
12
- });