@webex/cc-store 1.28.0-wxcc.2 → 1.28.0
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 +2 -8
- package/dist/index.js.LICENSE.txt +71 -0
- package/dist/types/constants.d.ts +25 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/store.d.ts +38 -29
- package/dist/types/store.types.d.ts +240 -0
- package/dist/types/storeEventsWrapper.d.ts +118 -0
- package/dist/types/task-utils.d.ts +48 -0
- package/dist/types/util.d.ts +2 -0
- package/package.json +28 -18
- package/.babelrc.js +0 -3
- package/CHANGELOG.md +0 -113
- package/dist/index.js.map +0 -1
- package/dist/sdk.js +0 -71
- package/dist/sdk.js.map +0 -1
- package/dist/store.js +0 -30
- package/dist/store.js.map +0 -1
- package/dist/types/sdk.d.ts +0 -24
- package/src/index.ts +0 -2
- package/src/sdk.ts +0 -80
- package/src/store.ts +0 -30
- package/tsconfig.json +0 -11
- package/webpack.config.js +0 -12
package/CHANGELOG.md
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
# [@webex/cc-store-v1.28.0-alpha.16](https://github.com/webex/widgets/compare/1.28.0-alpha.15...1.28.0-alpha.16) (2024-11-15)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Bug Fixes
|
|
5
|
-
|
|
6
|
-
* **cc-widgets:** update-docs-in-user-state ([#275](https://github.com/webex/widgets/issues/275)) ([b59f0c4](https://github.com/webex/widgets/commit/b59f0c45ef64e847588b31a512452b317c296331))
|
|
7
|
-
|
|
8
|
-
# [@webex/cc-store-v1.28.0-alpha.15](https://github.com/webex/widgets/compare/1.28.0-alpha.14...1.28.0-alpha.15) (2024-11-15)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Bug Fixes
|
|
12
|
-
|
|
13
|
-
* **release:** add-central-releaserc ([#273](https://github.com/webex/widgets/issues/273)) ([fe4dc35](https://github.com/webex/widgets/commit/fe4dc35447c405ffe2eb2b80d65adb5093c7eed5))
|
|
14
|
-
|
|
15
|
-
# [@webex/cc-store-v1.28.0-alpha.14](https://github.com/webex/widgets/compare/1.28.0-alpha.13...1.28.0-alpha.14) (2024-11-15)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
### Bug Fixes
|
|
19
|
-
|
|
20
|
-
* **cc-widgets:** add-logs-for-release ([#272](https://github.com/webex/widgets/issues/272)) ([1864d7a](https://github.com/webex/widgets/commit/1864d7ad2827ccbf780b103cc785235214a5676c))
|
|
21
|
-
|
|
22
|
-
# [@webex/cc-store-v1.28.0-alpha.13](https://github.com/webex/widgets/compare/1.28.0-alpha.12...1.28.0-alpha.13) (2024-11-15)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### Bug Fixes
|
|
26
|
-
|
|
27
|
-
* **release:** update-commit-analyzer-rules ([#271](https://github.com/webex/widgets/issues/271)) ([45451c0](https://github.com/webex/widgets/commit/45451c09c02645a6563b593f262196aee2f02173))
|
|
28
|
-
|
|
29
|
-
# [@webex/cc-store-v1.28.0-alpha.10](https://github.com/webex/widgets/compare/1.28.0-alpha.9...1.28.0-alpha.10) (2024-11-15)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
### Bug Fixes
|
|
33
|
-
|
|
34
|
-
* **cc-widgets:** trigger-a-release ([#266](https://github.com/webex/widgets/issues/266)) ([7dffb95](https://github.com/webex/widgets/commit/7dffb957db894d7d7892a602feb50a6074b59f2c))
|
|
35
|
-
|
|
36
|
-
# [@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)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
### Features
|
|
40
|
-
|
|
41
|
-
* **release:** release-all-cc-widgets ([#265](https://github.com/webex/widgets/issues/265)) ([ca4d845](https://github.com/webex/widgets/commit/ca4d8454865be8a7e86c247c6769f25a08380636))
|
|
42
|
-
|
|
43
|
-
# [@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)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
### Bug Fixes
|
|
47
|
-
|
|
48
|
-
* **release:** fix-add-channel-in-releaserc ([#264](https://github.com/webex/widgets/issues/264)) ([f47d2b1](https://github.com/webex/widgets/commit/f47d2b1d054d8e071360090254edae7de3503509))
|
|
49
|
-
|
|
50
|
-
# [@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)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
### Bug Fixes
|
|
54
|
-
|
|
55
|
-
* **release:** add-chanel-in-smeantic-release-yarn ([#263](https://github.com/webex/widgets/issues/263)) ([837d974](https://github.com/webex/widgets/commit/837d974e576cc8fdecfa3ba4a200aa9bdc9666a3))
|
|
56
|
-
|
|
57
|
-
# [@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)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### Bug Fixes
|
|
61
|
-
|
|
62
|
-
* **release:** fix-npm-tag ([#256](https://github.com/webex/widgets/issues/256)) ([9ac693a](https://github.com/webex/widgets/commit/9ac693aff72e152c383a4d373f87239f593d4b20))
|
|
63
|
-
* **cc-store:** trigger-a-release ([#259](https://github.com/webex/widgets/issues/259)) ([b5bd817](https://github.com/webex/widgets/commit/b5bd8173d55ef7cad496208f5ee2fb1264777520))
|
|
64
|
-
* **cc-store:** trigger-a-release ([#261](https://github.com/webex/widgets/issues/261)) ([f15ba04](https://github.com/webex/widgets/commit/f15ba0456c372cf4a70756c301053cd74b836d1b))
|
|
65
|
-
* **cc-store:** trigger-a-release-2 ([#262](https://github.com/webex/widgets/issues/262)) ([bfc5a15](https://github.com/webex/widgets/commit/bfc5a15d90cc5cfefe5ae4d92826ba32005843c4))
|
|
66
|
-
* **cc-store:** trigger-npm-release ([#257](https://github.com/webex/widgets/issues/257)) ([b6f8a56](https://github.com/webex/widgets/commit/b6f8a56469580b26d7f5e78dbef2a91093e802f8))
|
|
67
|
-
* **release:** update-release-rs ([#258](https://github.com/webex/widgets/issues/258)) ([b58d02f](https://github.com/webex/widgets/commit/b58d02f9238319f0a87c00f6fc0404995f7fe0a8))
|
|
68
|
-
|
|
69
|
-
# [@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)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
### Bug Fixes
|
|
73
|
-
|
|
74
|
-
* **release:** add-monorepo-semantic-release-support ([#253](https://github.com/webex/widgets/issues/253)) ([a4cb745](https://github.com/webex/widgets/commit/a4cb74587029ae11aeb0fda65d0362fc346e4d8a))
|
|
75
|
-
* **release:** sync-packgejson-and-npm-version ([#254](https://github.com/webex/widgets/issues/254)) ([a7b2793](https://github.com/webex/widgets/commit/a7b2793e6dd51ba32762c204e04ab204d1bcf96e))
|
|
76
|
-
|
|
77
|
-
# [1.28.0-alpha.4](https://github.com/webex/widgets/compare/v1.28.0-alpha.3...v1.28.0-alpha.4) (2024-11-14)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
### Bug Fixes
|
|
81
|
-
|
|
82
|
-
* **store:** add-documentation ([#252](https://github.com/webex/widgets/issues/252)) ([f754731](https://github.com/webex/widgets/commit/f7547314196af9ceb1185ab23da6a2df030f3d2c))
|
|
83
|
-
|
|
84
|
-
# [1.28.0-alpha.3](https://github.com/webex/widgets/compare/v1.28.0-alpha.2...v1.28.0-alpha.3) (2024-11-14)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
### Features
|
|
88
|
-
|
|
89
|
-
* **release:** add-publishconfig ([#250](https://github.com/webex/widgets/issues/250)) ([2ee17f6](https://github.com/webex/widgets/commit/2ee17f64f13d51340347dfeb492fd37a2dc40501))
|
|
90
|
-
|
|
91
|
-
# [1.28.0-alpha.2](https://github.com/webex/widgets/compare/v1.28.0-alpha.1...v1.28.0-alpha.2) (2024-11-14)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
### Bug Fixes
|
|
95
|
-
|
|
96
|
-
* **station-login:** test-commit ([#249](https://github.com/webex/widgets/issues/249)) ([706d3d4](https://github.com/webex/widgets/commit/706d3d412574987a9f84079a24697879dc6dba33))
|
|
97
|
-
|
|
98
|
-
# [1.28.0-alpha.1](https://github.com/webex/widgets/compare/v1.27.5...v1.28.0-alpha.1) (2024-11-14)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
### Bug Fixes
|
|
102
|
-
|
|
103
|
-
* **release:** add-mono-repo-support-for-scemantic-release ([#246](https://github.com/webex/widgets/issues/246)) ([4d2a572](https://github.com/webex/widgets/commit/4d2a57280eed3ef3caf5efb8a58c6cea433e1f53))
|
|
104
|
-
* convert npm to yarn ([#234](https://github.com/webex/widgets/issues/234)) ([432ed3c](https://github.com/webex/widgets/commit/432ed3cc1b2521f69cd9383cd0dbefad8f0a2eee))
|
|
105
|
-
* **circleci:** fix-caching-path-in-ci ([#243](https://github.com/webex/widgets/issues/243)) ([77f40f0](https://github.com/webex/widgets/commit/77f40f098a2f51620bc7af294ec429feeaf8caf1))
|
|
106
|
-
* **circleci:** fix-test-branch-name ([#242](https://github.com/webex/widgets/issues/242)) ([d60859a](https://github.com/webex/widgets/commit/d60859ad562a93d2f1fecd1cfe207729c475edd2))
|
|
107
|
-
* **release:** remove-semantic-release-npm ([#248](https://github.com/webex/widgets/issues/248)) ([c4e7bb1](https://github.com/webex/widgets/commit/c4e7bb18133fd1500f53ce686076868e00e15ec0))
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
### Features
|
|
111
|
-
|
|
112
|
-
* **release:** add-release-script-and-config ([#241](https://github.com/webex/widgets/issues/241)) ([376e348](https://github.com/webex/widgets/commit/376e34835a11ccf55d43b207a3777aeeb442aaba))
|
|
113
|
-
* **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/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/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,uCAAuC,EACvC,uCAAuC,CACxC,CAAC;YACF,UAAU,CAAC,GAAG,EAAE;gBACd,GAAG,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YAChD,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC;KACF;IACD,YAAY,EAAE;QACZ,YAAY,EAAE,SAAS;QACvB,IAAI,EAAE;YACJ,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;YAC5B,OAAO,CAAC,GAAG,CACT,gDAAgD,EAChD,gCAAgC,EAChC,uCAAuC,EACvC,uCAAuC,CACxC,CAAC;YACF,UAAU,CAAC,GAAG,EAAE;gBACd,GAAG,CAAC,IAAI,CAAC,wBAAwB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YACxD,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC;QACD,MAAM,EAAE;YACN,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;YAC9B,OAAO,CAAC,GAAG,CACT,kDAAkD,EAClD,gCAAgC,EAChC,uCAAuC,EACvC,uCAAuC,CACxC,CAAC;YACF,UAAU,CAAC,GAAG,EAAE;gBACd,GAAG,CAAC,IAAI,CAAC,wBAAwB,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YACxD,CAAC,EAAE,IAAI,CAAC,CAAC;QACX,CAAC;KACF;IACD,EAAE,EAAE,UAAS,SAAS,EAAE,QAAQ;QAC9B,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE,CAAC;YAC5C,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACzC,OAAO;YACL,SAAS;YACT,QAAQ;SACT,CAAC;IACJ,CAAC;IACD,GAAG,EAAE,UAAS,SAAS,EAAE,QAAQ;QAC/B,IAAI,CAAC,SAAS,CAAC,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"}
|
package/dist/store.js
DELETED
|
@@ -1,30 +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 sdk_1 = __importDefault(require("./sdk"));
|
|
8
|
-
/*
|
|
9
|
-
* Store class
|
|
10
|
-
*/
|
|
11
|
-
class Store {
|
|
12
|
-
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');
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const store = new Store();
|
|
29
|
-
exports.default = store;
|
|
30
|
-
//# 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;AAEpD,gDAAwB;AACxB;;GAEG;AACH,MAAM,KAAK;IAKT;QAJA,eAAU,GAAG,EAAE,CAAC;QAChB,gBAAW,GAAG,KAAK,CAAC;QACpB,UAAK,GAAG,aAAG,CAAC;QAUZ,kBAAa,GAAG,CAAC,KAAK,EAAE,EAAE;YACxB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QAC1B,CAAC,CAAC;QAEF,mBAAc,GAAG,CAAC,KAAK,EAAE,EAAE;YACzB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC3B,CAAC,CAAC;QAbA,IAAA,yBAAkB,EAAC,IAAI,EAAE,EAAC,KAAK,EAAE,iBAAU,CAAC,GAAG,EAAC,CAAC,CAAC;QAElD,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,gBAAgB,EAAE,CAAC,OAAO,EAAE,EAAE;YAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,KAAK,WAAW,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;CASF;AAED,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;AAC1B,kBAAe,KAAK,CAAC"}
|
package/dist/types/sdk.d.ts
DELETED
|
@@ -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/src/index.ts
DELETED
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
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
|
-
});
|