@webex/cc-store 1.28.0-alpha.7 → 1.28.0-ccwidgets.1

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/store.js CHANGED
@@ -4,24 +4,32 @@ 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
+ 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
+ });
25
33
  });
26
34
  }
27
35
  }
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;IAKT;QAJA,eAAU,GAAG,EAAE,CAAC;QAChB,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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"}
@@ -1,32 +1,10 @@
1
+ import { IContactCenter, Team } from '@webex/plugin-cc';
1
2
  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
- };
3
+ teams: Team[];
4
+ loginOptions: string[];
5
+ cc: IContactCenter;
27
6
  constructor();
28
- setLoginState: (state: any) => void;
29
- setIsAvailable: (state: any) => void;
7
+ init(webexConfig: any, access_token: string): Promise<void>;
30
8
  }
31
9
  declare const store: Store;
32
10
  export default store;
package/package.json CHANGED
@@ -1,32 +1,35 @@
1
1
  {
2
2
  "name": "@webex/cc-store",
3
3
  "description": "Webex Contact Center Widgets: Widgets Store",
4
- "version": "1.28.0-alpha.7",
4
+ "version": "1.28.0-ccwidgets.1",
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": {
21
+ "@webex/plugin-cc": "3.5.0-wxcc.2",
18
22
  "mobx": "6.13.5",
19
23
  "react": "18.3.1",
20
24
  "react-dom": "18.3.1",
21
- "typescript": "5.6.3"
25
+ "typescript": "5.6.3",
26
+ "webex": "3.6.0-wxcc.3"
22
27
  },
23
28
  "devDependencies": {
24
29
  "@babel/core": "7.25.2",
25
30
  "@babel/preset-env": "7.25.4",
26
31
  "@babel/preset-react": "7.24.7",
27
32
  "@babel/preset-typescript": "7.25.9",
28
- "@semantic-release/changelog": "^6.0.3",
29
- "@semantic-release/git": "^10.0.1",
30
33
  "@testing-library/dom": "10.4.0",
31
34
  "@testing-library/jest-dom": "6.6.2",
32
35
  "@testing-library/react": "16.0.1",
@@ -37,16 +40,15 @@
37
40
  "file-loader": "6.2.0",
38
41
  "jest": "29.7.0",
39
42
  "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
43
  "ts-loader": "9.5.1",
44
44
  "webpack": "5.94.0",
45
45
  "webpack-cli": "5.1.4",
46
46
  "webpack-merge": "6.0.1"
47
47
  },
48
48
  "jest": {
49
- "testEnvironment": "jsdom"
49
+ "testEnvironment": "jsdom",
50
+ "//": "We can remove this when we have tests",
51
+ "passWithNoTests": true
50
52
  },
51
53
  "stableVersion": "1.0.0"
52
54
  }
package/.babelrc.js DELETED
@@ -1,3 +0,0 @@
1
- const baseConfig = require('../../../.babelrc');
2
-
3
- module.exports = baseConfig;
package/CHANGELOG.md DELETED
@@ -1,64 +0,0 @@
1
- # [@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)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * **release:** add-chanel-in-smeantic-release-yarn ([#263](https://github.com/webex/widgets/issues/263)) ([837d974](https://github.com/webex/widgets/commit/837d974e576cc8fdecfa3ba4a200aa9bdc9666a3))
7
-
8
- # [@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)
9
-
10
-
11
- ### Bug Fixes
12
-
13
- * **release:** fix-npm-tag ([#256](https://github.com/webex/widgets/issues/256)) ([9ac693a](https://github.com/webex/widgets/commit/9ac693aff72e152c383a4d373f87239f593d4b20))
14
- * **cc-store:** trigger-a-release ([#259](https://github.com/webex/widgets/issues/259)) ([b5bd817](https://github.com/webex/widgets/commit/b5bd8173d55ef7cad496208f5ee2fb1264777520))
15
- * **cc-store:** trigger-a-release ([#261](https://github.com/webex/widgets/issues/261)) ([f15ba04](https://github.com/webex/widgets/commit/f15ba0456c372cf4a70756c301053cd74b836d1b))
16
- * **cc-store:** trigger-a-release-2 ([#262](https://github.com/webex/widgets/issues/262)) ([bfc5a15](https://github.com/webex/widgets/commit/bfc5a15d90cc5cfefe5ae4d92826ba32005843c4))
17
- * **cc-store:** trigger-npm-release ([#257](https://github.com/webex/widgets/issues/257)) ([b6f8a56](https://github.com/webex/widgets/commit/b6f8a56469580b26d7f5e78dbef2a91093e802f8))
18
- * **release:** update-release-rs ([#258](https://github.com/webex/widgets/issues/258)) ([b58d02f](https://github.com/webex/widgets/commit/b58d02f9238319f0a87c00f6fc0404995f7fe0a8))
19
-
20
- # [@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)
21
-
22
-
23
- ### Bug Fixes
24
-
25
- * **release:** add-monorepo-semantic-release-support ([#253](https://github.com/webex/widgets/issues/253)) ([a4cb745](https://github.com/webex/widgets/commit/a4cb74587029ae11aeb0fda65d0362fc346e4d8a))
26
- * **release:** sync-packgejson-and-npm-version ([#254](https://github.com/webex/widgets/issues/254)) ([a7b2793](https://github.com/webex/widgets/commit/a7b2793e6dd51ba32762c204e04ab204d1bcf96e))
27
-
28
- # [1.28.0-alpha.4](https://github.com/webex/widgets/compare/v1.28.0-alpha.3...v1.28.0-alpha.4) (2024-11-14)
29
-
30
-
31
- ### Bug Fixes
32
-
33
- * **store:** add-documentation ([#252](https://github.com/webex/widgets/issues/252)) ([f754731](https://github.com/webex/widgets/commit/f7547314196af9ceb1185ab23da6a2df030f3d2c))
34
-
35
- # [1.28.0-alpha.3](https://github.com/webex/widgets/compare/v1.28.0-alpha.2...v1.28.0-alpha.3) (2024-11-14)
36
-
37
-
38
- ### Features
39
-
40
- * **release:** add-publishconfig ([#250](https://github.com/webex/widgets/issues/250)) ([2ee17f6](https://github.com/webex/widgets/commit/2ee17f64f13d51340347dfeb492fd37a2dc40501))
41
-
42
- # [1.28.0-alpha.2](https://github.com/webex/widgets/compare/v1.28.0-alpha.1...v1.28.0-alpha.2) (2024-11-14)
43
-
44
-
45
- ### Bug Fixes
46
-
47
- * **station-login:** test-commit ([#249](https://github.com/webex/widgets/issues/249)) ([706d3d4](https://github.com/webex/widgets/commit/706d3d412574987a9f84079a24697879dc6dba33))
48
-
49
- # [1.28.0-alpha.1](https://github.com/webex/widgets/compare/v1.27.5...v1.28.0-alpha.1) (2024-11-14)
50
-
51
-
52
- ### Bug Fixes
53
-
54
- * **release:** add-mono-repo-support-for-scemantic-release ([#246](https://github.com/webex/widgets/issues/246)) ([4d2a572](https://github.com/webex/widgets/commit/4d2a57280eed3ef3caf5efb8a58c6cea433e1f53))
55
- * convert npm to yarn ([#234](https://github.com/webex/widgets/issues/234)) ([432ed3c](https://github.com/webex/widgets/commit/432ed3cc1b2521f69cd9383cd0dbefad8f0a2eee))
56
- * **circleci:** fix-caching-path-in-ci ([#243](https://github.com/webex/widgets/issues/243)) ([77f40f0](https://github.com/webex/widgets/commit/77f40f098a2f51620bc7af294ec429feeaf8caf1))
57
- * **circleci:** fix-test-branch-name ([#242](https://github.com/webex/widgets/issues/242)) ([d60859a](https://github.com/webex/widgets/commit/d60859ad562a93d2f1fecd1cfe207729c475edd2))
58
- * **release:** remove-semantic-release-npm ([#248](https://github.com/webex/widgets/issues/248)) ([c4e7bb1](https://github.com/webex/widgets/commit/c4e7bb18133fd1500f53ce686076868e00e15ec0))
59
-
60
-
61
- ### Features
62
-
63
- * **release:** add-release-script-and-config ([#241](https://github.com/webex/widgets/issues/241)) ([376e348](https://github.com/webex/widgets/commit/376e34835a11ccf55d43b207a3777aeeb442aaba))
64
- * **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":";;;;;;;;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C,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"}
@@ -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,37 +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
- addChannel: 'alpha',
26
- },
27
- ],
28
- [
29
- '@semantic-release/git',
30
- {
31
- assets: ['CHANGELOG.md', 'package.json'],
32
- },
33
- ],
34
- '@semantic-release/github',
35
- ],
36
- tagFormat: '${version}',
37
- };
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
- });