@webex/cc-station-login 1.0.1-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/.babelrc.js +3 -0
- package/CHANGELOG.md +13 -0
- package/dist/helper.js +11 -0
- package/dist/helper.js.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/station-login/index.js +28 -0
- package/dist/station-login/index.js.map +1 -0
- package/dist/station-login/station-login.presentational.js +16 -0
- package/dist/station-login/station-login.presentational.js.map +1 -0
- package/dist/station-login/station-login.types.js +3 -0
- package/dist/station-login/station-login.types.js.map +1 -0
- package/dist/types/helper.d.ts +3 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/station-login/index.d.ts +4 -0
- package/dist/types/station-login/station-login.presentational.d.ts +4 -0
- package/dist/types/station-login/station-login.types.d.ts +26 -0
- package/package.json +55 -0
- package/release.config.js +36 -0
- package/src/helper.ts +6 -0
- package/src/index.ts +3 -0
- package/src/station-login/index.tsx +29 -0
- package/src/station-login/station-login.presentational.tsx +15 -0
- package/src/station-login/station-login.types.ts +30 -0
- package/src/station-login/styles-module.scss +0 -0
- package/tests/helper.ts +8 -0
- package/tests/station-login/index.tsx +21 -0
- package/tests/station-login/station-login.presentational.tsx +21 -0
- package/tsconfig.json +11 -0
- package/webpack.config.js +12 -0
package/.babelrc.js
ADDED
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# [@webex/cc-station-login-v1.28.0-alpha.12](https://github.com/webex/widgets/compare/1.28.0-alpha.11...1.28.0-alpha.12) (2024-11-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **cc-widgets:** test-commit-to-check-release ([#269](https://github.com/webex/widgets/issues/269)) ([49ec94f](https://github.com/webex/widgets/commit/49ec94f2b2ef0758951ce51cc56675390e9d49cc))
|
|
7
|
+
|
|
8
|
+
# [@webex/cc-station-login-v1.28.0-alpha.11](https://github.com/webex/widgets/compare/1.28.0-alpha.10...1.28.0-alpha.11) (2024-11-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **cc-widgets:** remove-dry-run ([#268](https://github.com/webex/widgets/issues/268)) ([4e2038c](https://github.com/webex/widgets/commit/4e2038c216cb915a1233667e259be619b92212b1))
|
package/dist/helper.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useStationLogin = void 0;
|
|
4
|
+
/*
|
|
5
|
+
* StationLogin helpers
|
|
6
|
+
*/
|
|
7
|
+
const useStationLogin = () => {
|
|
8
|
+
return { name: 'StationLogin' };
|
|
9
|
+
};
|
|
10
|
+
exports.useStationLogin = useStationLogin;
|
|
11
|
+
//# sourceMappingURL=helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,OAAO,EAAC,IAAI,EAAE,cAAc,EAAC,CAAC;AAChC,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebStationLogin = exports.StationLogin = void 0;
|
|
4
|
+
const station_login_1 = require("./station-login");
|
|
5
|
+
Object.defineProperty(exports, "StationLogin", { enumerable: true, get: function () { return station_login_1.StationLogin; } });
|
|
6
|
+
Object.defineProperty(exports, "WebStationLogin", { enumerable: true, get: function () { return station_login_1.WebStationLogin; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAA8D;AAEtD,6FAFA,4BAAY,OAEA;AAAE,gGAFA,+BAAe,OAEA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
exports.WebStationLogin = exports.StationLogin = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const react_to_web_component_1 = __importDefault(require("@r2wc/react-to-web-component"));
|
|
9
|
+
const cc_store_1 = __importDefault(require("@webex/cc-store"));
|
|
10
|
+
const mobx_react_1 = require("mobx-react");
|
|
11
|
+
const station_login_presentational_1 = __importDefault(require("./station-login.presentational"));
|
|
12
|
+
const helper_1 = require("../helper");
|
|
13
|
+
const StationLogin = (0, mobx_react_1.observer)(() => {
|
|
14
|
+
const { loginState, setLoginState, ccSdk, isAvailable } = cc_store_1.default;
|
|
15
|
+
const result = (0, helper_1.useStationLogin)();
|
|
16
|
+
const props = Object.assign(Object.assign({}, result), { loginState,
|
|
17
|
+
setLoginState,
|
|
18
|
+
ccSdk,
|
|
19
|
+
isAvailable });
|
|
20
|
+
return react_1.default.createElement(station_login_presentational_1.default, Object.assign({}, props));
|
|
21
|
+
});
|
|
22
|
+
exports.StationLogin = StationLogin;
|
|
23
|
+
const WebStationLogin = (0, react_to_web_component_1.default)(StationLogin);
|
|
24
|
+
exports.WebStationLogin = WebStationLogin;
|
|
25
|
+
if (!customElements.get('widget-cc-station-login')) {
|
|
26
|
+
customElements.define('widget-cc-station-login', WebStationLogin);
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/station-login/index.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,0FAAgD;AAChD,+DAAoC;AACpC,2CAAoC;AAEpC,kGAAwE;AACxE,sCAA0C;AAE1C,MAAM,YAAY,GAA4B,IAAA,qBAAQ,EAAC,GAAG,EAAE;IAC1D,MAAM,EAAC,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAC,GAAG,kBAAK,CAAC;IAC9D,MAAM,MAAM,GAAG,IAAA,wBAAe,GAAE,CAAC;IAEjC,MAAM,KAAK,mCACN,MAAM,KACT,UAAU;QACV,aAAa;QACb,KAAK;QACL,WAAW,GACZ,CAAC;IACF,OAAO,8BAAC,sCAA0B,oBAAK,KAAK,EAAI,CAAC;AACnD,CAAC,CAAC,CAAC;AAQK,oCAAY;AANpB,MAAM,eAAe,GAAG,IAAA,gCAAI,EAAC,YAAY,CAAC,CAAC;AAMrB,0CAAe;AAJrC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,yBAAyB,CAAC,EAAE,CAAC;IACnD,cAAc,CAAC,MAAM,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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 react_1 = __importDefault(require("react"));
|
|
7
|
+
const StationLoginPresentational = (props) => {
|
|
8
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
9
|
+
react_1.default.createElement("h1", { "data-testid": "station-login-heading" }, props.name),
|
|
10
|
+
react_1.default.createElement("h4", null,
|
|
11
|
+
"Station Login State: ",
|
|
12
|
+
props.loginState),
|
|
13
|
+
react_1.default.createElement("button", { onClick: () => props.setLoginState('Logged In') }, "Click to change state")));
|
|
14
|
+
};
|
|
15
|
+
exports.default = StationLoginPresentational;
|
|
16
|
+
//# sourceMappingURL=station-login.presentational.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"station-login.presentational.js","sourceRoot":"","sources":["../../src/station-login/station-login.presentational.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAI1B,MAAM,0BAA0B,GAAgD,CAAC,KAAK,EAAE,EAAE;IACxF,OAAO,CACL;QACE,qDAAgB,uBAAuB,IAAE,KAAK,CAAC,IAAI,CAAM;QACzD;;YAA0B,KAAK,CAAC,UAAU,CAAM;QAChD,0CAAQ,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,4BAAgC,CACtF,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"station-login.types.js","sourceRoot":"","sources":["../../src/station-login/station-login.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface representing the properties for the Station Login component.
|
|
3
|
+
*/
|
|
4
|
+
export interface IStationLoginProps {
|
|
5
|
+
/**
|
|
6
|
+
* The name of the station.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* The current login state of the station.
|
|
12
|
+
*/
|
|
13
|
+
loginState: any;
|
|
14
|
+
/**
|
|
15
|
+
* Function to set the login state of the station.
|
|
16
|
+
*/
|
|
17
|
+
setLoginState: any;
|
|
18
|
+
/**
|
|
19
|
+
* The Customer Care SDK instance.
|
|
20
|
+
*/
|
|
21
|
+
ccSdk: any;
|
|
22
|
+
/**
|
|
23
|
+
* Indicates whether the station is available.
|
|
24
|
+
*/
|
|
25
|
+
isAvailable: any;
|
|
26
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webex/cc-station-login",
|
|
3
|
+
"description": "Webex Contact Center Widgets: Station Login",
|
|
4
|
+
"version": "1.0.1-0",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "yarn run -T tsc",
|
|
11
|
+
"build:src": "webpack && yarn run build",
|
|
12
|
+
"build:watch": "webpack --watch",
|
|
13
|
+
"test:unit": "jest",
|
|
14
|
+
"release": "semantic-release"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@r2wc/react-to-web-component": "2.0.3",
|
|
18
|
+
"@webex/cc-store": "1.0.1-0",
|
|
19
|
+
"mobx-react": "9.1.1",
|
|
20
|
+
"react": "18.3.1",
|
|
21
|
+
"react-dom": "18.3.1",
|
|
22
|
+
"typescript": "5.6.3"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@babel/core": "7.25.2",
|
|
26
|
+
"@babel/preset-env": "7.25.4",
|
|
27
|
+
"@babel/preset-react": "7.24.7",
|
|
28
|
+
"@babel/preset-typescript": "7.25.9",
|
|
29
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
30
|
+
"@semantic-release/git": "^10.0.1",
|
|
31
|
+
"@testing-library/dom": "10.4.0",
|
|
32
|
+
"@testing-library/jest-dom": "6.6.2",
|
|
33
|
+
"@testing-library/react": "16.0.1",
|
|
34
|
+
"@types/jest": "29.5.14",
|
|
35
|
+
"@types/react-test-renderer": "18",
|
|
36
|
+
"babel-jest": "29.7.0",
|
|
37
|
+
"babel-loader": "9.2.1",
|
|
38
|
+
"file-loader": "6.2.0",
|
|
39
|
+
"jest": "29.7.0",
|
|
40
|
+
"jest-environment-jsdom": "29.7.0",
|
|
41
|
+
"semantic-release": "^24.2.0",
|
|
42
|
+
"ts-loader": "9.5.1",
|
|
43
|
+
"webpack": "5.94.0",
|
|
44
|
+
"webpack-cli": "5.1.4",
|
|
45
|
+
"webpack-merge": "6.0.1"
|
|
46
|
+
},
|
|
47
|
+
"jest": {
|
|
48
|
+
"testEnvironment": "jsdom",
|
|
49
|
+
"testMatch": [
|
|
50
|
+
"**/tests/**/*.ts",
|
|
51
|
+
"**/tests/**/*.tsx"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"stableVersion": "1.0.0"
|
|
55
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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/helper.ts
ADDED
package/src/index.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import r2wc from '@r2wc/react-to-web-component';
|
|
3
|
+
import store from '@webex/cc-store';
|
|
4
|
+
import {observer} from 'mobx-react';
|
|
5
|
+
|
|
6
|
+
import StationLoginPresentational from './station-login.presentational';
|
|
7
|
+
import {useStationLogin} from '../helper';
|
|
8
|
+
|
|
9
|
+
const StationLogin: React.FunctionComponent = observer(() => {
|
|
10
|
+
const {loginState, setLoginState, ccSdk, isAvailable} = store;
|
|
11
|
+
const result = useStationLogin();
|
|
12
|
+
|
|
13
|
+
const props = {
|
|
14
|
+
...result,
|
|
15
|
+
loginState,
|
|
16
|
+
setLoginState,
|
|
17
|
+
ccSdk,
|
|
18
|
+
isAvailable,
|
|
19
|
+
};
|
|
20
|
+
return <StationLoginPresentational {...props} />;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const WebStationLogin = r2wc(StationLogin);
|
|
24
|
+
|
|
25
|
+
if (!customElements.get('widget-cc-station-login')) {
|
|
26
|
+
customElements.define('widget-cc-station-login', WebStationLogin);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export {StationLogin, WebStationLogin};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {IStationLoginProps} from './station-login.types';
|
|
4
|
+
|
|
5
|
+
const StationLoginPresentational: React.FunctionComponent<IStationLoginProps> = (props) => {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<h1 data-testid="station-login-heading">{props.name}</h1>
|
|
9
|
+
<h4>Station Login State: {props.loginState}</h4>
|
|
10
|
+
<button onClick={() => props.setLoginState('Logged In')}>Click to change state</button>
|
|
11
|
+
</>
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default StationLoginPresentational;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface representing the properties for the Station Login component.
|
|
3
|
+
*/
|
|
4
|
+
export interface IStationLoginProps {
|
|
5
|
+
/**
|
|
6
|
+
* The name of the station.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The current login state of the station.
|
|
13
|
+
*/
|
|
14
|
+
loginState: any;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Function to set the login state of the station.
|
|
18
|
+
*/
|
|
19
|
+
setLoginState: any;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The Customer Care SDK instance.
|
|
23
|
+
*/
|
|
24
|
+
ccSdk: any;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Indicates whether the station is available.
|
|
28
|
+
*/
|
|
29
|
+
isAvailable: any;
|
|
30
|
+
}
|
|
File without changes
|
package/tests/helper.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import '@testing-library/jest-dom';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {render, screen, cleanup} from '@testing-library/react';
|
|
4
|
+
|
|
5
|
+
import * as helper from '../../src/helper';
|
|
6
|
+
import {StationLogin} from '../../src/station-login/index';
|
|
7
|
+
|
|
8
|
+
describe('StationLogin', () => {
|
|
9
|
+
afterEach(cleanup);
|
|
10
|
+
|
|
11
|
+
it('CheckboxWithLabel changes the text after click', () => {
|
|
12
|
+
const stationLoginHelperSpy = jest.spyOn(helper, 'useStationLogin').mockReturnValue({name: 'MockStationLogin'});
|
|
13
|
+
|
|
14
|
+
render(<StationLogin />);
|
|
15
|
+
|
|
16
|
+
expect(stationLoginHelperSpy).toHaveBeenCalledWith();
|
|
17
|
+
|
|
18
|
+
const heading = screen.getByTestId('station-login-heading');
|
|
19
|
+
expect(heading).toHaveTextContent('MockStationLogin');
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {render, screen, cleanup} from '@testing-library/react';
|
|
3
|
+
import StationLoginPresentational from '../../src/station-login/station-login.presentational';
|
|
4
|
+
import '@testing-library/jest-dom';
|
|
5
|
+
|
|
6
|
+
describe('StationLoginPresentational', () => {
|
|
7
|
+
afterEach(cleanup);
|
|
8
|
+
|
|
9
|
+
it('renders the component name', () => {
|
|
10
|
+
const props = {
|
|
11
|
+
name: 'StationLogin',
|
|
12
|
+
loginState: 'idle',
|
|
13
|
+
setLoginState: jest.fn(),
|
|
14
|
+
ccSdk: {},
|
|
15
|
+
isAvailable: jest.fn(),
|
|
16
|
+
};
|
|
17
|
+
render(<StationLoginPresentational {...props} />);
|
|
18
|
+
const heading = screen.getByTestId('station-login-heading');
|
|
19
|
+
expect(heading).toHaveTextContent('StationLogin');
|
|
20
|
+
});
|
|
21
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
});
|