@webex/cc-station-login 1.28.0-alpha.11 → 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/helper.js CHANGED
@@ -1,11 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useStationLogin = void 0;
4
- /*
5
- * StationLogin helper
6
- */
7
- const useStationLogin = () => {
8
- return { name: 'StationLogin' };
4
+ const react_1 = require("react");
5
+ const useStationLogin = (props) => {
6
+ const cc = props.cc;
7
+ const loginCb = props.onLogin;
8
+ const logoutCb = props.onLogout;
9
+ const [dialNumber, setDialNumber] = (0, react_1.useState)('');
10
+ const [deviceType, setDeviceType] = (0, react_1.useState)('');
11
+ const [team, setTeam] = (0, react_1.useState)('');
12
+ const [loginSuccess, setLoginSuccess] = (0, react_1.useState)();
13
+ const [loginFailure, setLoginFailure] = (0, react_1.useState)();
14
+ const [logoutSuccess, setLogoutSuccess] = (0, react_1.useState)();
15
+ const login = () => {
16
+ cc.stationLogin({ teamId: team, loginOption: deviceType, dialNumber: dialNumber })
17
+ .then((res) => {
18
+ setLoginSuccess(res);
19
+ loginCb();
20
+ }).catch((error) => {
21
+ console.error(error);
22
+ setLoginFailure(error);
23
+ });
24
+ };
25
+ const logout = () => {
26
+ cc.stationLogout({ logoutReason: 'User requested logout' })
27
+ .then((res) => {
28
+ setLogoutSuccess(res);
29
+ logoutCb();
30
+ }).catch((error) => {
31
+ console.error(error);
32
+ });
33
+ };
34
+ return { name: 'StationLogin', setDeviceType, setDialNumber, setTeam, login, logout, loginSuccess, loginFailure, logoutSuccess };
9
35
  };
10
36
  exports.useStationLogin = useStationLogin;
11
37
  //# sourceMappingURL=helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACI,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC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AAe,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,EAAE,CAAC,aAAa,CAAC,EAAC,YAAY,EAAE,uBAAuB,EAAC,CAAC;aACtD,IAAI,CAAC,CAAC,GAAyB,EAAE,EAAE;YAClC,gBAAgB,CAAC,GAAG,CAAC,CAAC;YACtB,QAAQ,EAAE,CAAC;QACb,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;YACtB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IAEF,OAAO,EAAC,IAAI,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,aAAa,EAAC,CAAC;AACjI,CAAC,CAAA;AAjCY,QAAA,eAAe,mBAiC3B"}
@@ -10,17 +10,20 @@ const cc_store_1 = __importDefault(require("@webex/cc-store"));
10
10
  const mobx_react_1 = require("mobx-react");
11
11
  const station_login_presentational_1 = __importDefault(require("./station-login.presentational"));
12
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 });
13
+ const StationLogin = (0, mobx_react_1.observer)(({ onLogin, onLogout }) => {
14
+ const { cc, teams, loginOptions } = cc_store_1.default;
15
+ const result = (0, helper_1.useStationLogin)({ cc, onLogin, onLogout });
16
+ const props = Object.assign(Object.assign({}, result), { teams,
17
+ loginOptions });
20
18
  return react_1.default.createElement(station_login_presentational_1.default, Object.assign({}, props));
21
19
  });
22
20
  exports.StationLogin = StationLogin;
23
- const WebStationLogin = (0, react_to_web_component_1.default)(StationLogin);
21
+ const WebStationLogin = (0, react_to_web_component_1.default)(StationLogin, {
22
+ props: {
23
+ onLogin: "function",
24
+ onLogout: "function"
25
+ }
26
+ });
24
27
  exports.WebStationLogin = WebStationLogin;
25
28
  if (!customElements.get('widget-cc-station-login')) {
26
29
  customElements.define('widget-cc-station-login', WebStationLogin);
@@ -1 +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"}
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;AAG1C,MAAM,YAAY,GAA+C,IAAA,qBAAQ,EAAC,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAC,EAAE,EAAE;IAChG,MAAM,EAAC,EAAE,EAAE,KAAK,EAAE,YAAY,EAAC,GAAG,kBAAK,CAAC;IACxC,MAAM,MAAM,GAAG,IAAA,wBAAe,EAAC,EAAC,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAC,CAAC,CAAC;IAExD,MAAM,KAAK,mCACN,MAAM,KACT,KAAK;QACL,YAAY,GACb,CAAC;IACF,OAAO,8BAAC,sCAA0B,oBAAK,KAAK,EAAI,CAAC;AACnD,CAAC,CAAC,CAAC;AAaK,oCAAY;AAXpB,MAAM,eAAe,GAAG,IAAA,gCAAI,EAAC,YAAY,EAAE;IACzC,KAAK,EAAE;QACL,OAAO,EAAE,UAAU;QACnB,QAAQ,EAAE,UAAU;KACrB;CACF,CAAC,CAAC;AAMmB,0CAAe;AAJrC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,yBAAyB,CAAC,EAAE,CAAC;IACnD,cAAc,CAAC,MAAM,CAAC,yBAAyB,EAAE,eAAe,CAAC,CAAC;AACpE,CAAC"}
@@ -1,16 +1,142 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
4
24
  };
5
25
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
26
+ const react_1 = __importStar(require("react"));
7
27
  const StationLoginPresentational = (props) => {
28
+ const { name, teams, loginOptions, login, logout, setDeviceType, setDialNumber, setTeam } = props; // TODO: Use the loginSuccess, loginFailure, logoutSuccess props returned fromthe API response via helper file to reflect UI changes
29
+ (0, react_1.useEffect)(() => {
30
+ const teamsDropdown = document.getElementById('teamsDropdown');
31
+ const agentLogin = document.querySelector('#LoginOption');
32
+ const dialNumber = document.querySelector('#dialNumber');
33
+ if (teamsDropdown) {
34
+ teamsDropdown.innerHTML = '';
35
+ if (teams) {
36
+ teams.forEach((team) => {
37
+ const option = document.createElement('option');
38
+ option.value = team.id;
39
+ option.text = team.name;
40
+ teamsDropdown.add(option);
41
+ });
42
+ setTeam(teamsDropdown.value);
43
+ dialNumber.value = '';
44
+ dialNumber.disabled = true;
45
+ }
46
+ }
47
+ if (loginOptions.length > 0) {
48
+ loginOptions.forEach((options) => {
49
+ const option = document.createElement('option');
50
+ option.text = options;
51
+ option.value = options;
52
+ agentLogin.add(option);
53
+ });
54
+ }
55
+ }, [teams, loginOptions]);
56
+ const selectLoginOption = (event) => {
57
+ const dialNumber = document.querySelector('#dialNumber');
58
+ const deviceType = event.target.value;
59
+ setDeviceType(deviceType);
60
+ if (deviceType === 'AGENT_DN' || deviceType === 'EXTENSION') {
61
+ dialNumber.disabled = false;
62
+ }
63
+ else {
64
+ dialNumber.disabled = true;
65
+ }
66
+ };
67
+ function updateDN() {
68
+ const dialNumber = document.querySelector('#dialNumber');
69
+ setDialNumber(dialNumber.value);
70
+ }
71
+ const styles = {
72
+ box: {
73
+ backgroundColor: '#ffffff',
74
+ borderRadius: '8px',
75
+ boxShadow: '0 2px 4px rgba(0, 0, 0, 0.1)',
76
+ padding: '20px',
77
+ maxWidth: '800px',
78
+ margin: '0 auto'
79
+ },
80
+ sectionBox: {
81
+ padding: '10px',
82
+ border: '1px solid #ddd',
83
+ borderRadius: '8px'
84
+ },
85
+ fieldset: {
86
+ border: '1px solid #ccc',
87
+ borderRadius: '5px',
88
+ padding: '10px',
89
+ marginBottom: '20px'
90
+ },
91
+ legendBox: {
92
+ fontWeight: 'bold',
93
+ color: '#0052bf'
94
+ },
95
+ btn: {
96
+ padding: '10px 20px',
97
+ backgroundColor: '#0052bf',
98
+ color: 'white',
99
+ border: 'none',
100
+ borderRadius: '4px',
101
+ cursor: 'pointer',
102
+ transition: 'background-color 0.3s',
103
+ marginRight: '8px'
104
+ },
105
+ select: {
106
+ width: '100%',
107
+ padding: '8px',
108
+ marginTop: '8px',
109
+ marginBottom: '12px',
110
+ border: '1px solid #ccc',
111
+ borderRadius: '4px'
112
+ },
113
+ input: {
114
+ width: '97%',
115
+ padding: '8px',
116
+ marginTop: '8px',
117
+ marginBottom: '12px',
118
+ border: '1px solid #ccc',
119
+ borderRadius: '4px'
120
+ }
121
+ };
8
122
  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")));
123
+ react_1.default.createElement("h1", { "data-testid": "station-login-heading" }, name),
124
+ react_1.default.createElement("div", { style: styles.box },
125
+ react_1.default.createElement("section", { style: styles.sectionBox },
126
+ react_1.default.createElement("fieldset", { style: styles.fieldset },
127
+ react_1.default.createElement("legend", { style: styles.legendBox }, "Agent"),
128
+ react_1.default.createElement("div", { style: { display: 'flex', flexDirection: 'column', flexGrow: 1 } },
129
+ react_1.default.createElement("div", { style: { display: 'flex', gap: '1rem' } },
130
+ react_1.default.createElement("fieldset", { style: { border: '1px solid #ccc', borderRadius: '5px', padding: '10px', marginBottom: '20px', flex: 0.69 } },
131
+ react_1.default.createElement("legend", { style: styles.legendBox }, "Select Team"),
132
+ react_1.default.createElement("select", { id: "teamsDropdown", style: styles.select }, "Teams")),
133
+ react_1.default.createElement("fieldset", { style: styles.fieldset },
134
+ react_1.default.createElement("legend", { style: styles.legendBox }, "Agent Login"),
135
+ react_1.default.createElement("select", { name: "LoginOption", id: "LoginOption", style: styles.select, onChange: selectLoginOption },
136
+ react_1.default.createElement("option", { value: "", selected: true, hidden: true }, "Choose Agent Login Option...")),
137
+ react_1.default.createElement("input", { style: styles.input, id: "dialNumber", name: "dialNumber", placeholder: "Extension/Dial Number", type: "text", onInput: updateDN }),
138
+ react_1.default.createElement("button", { id: "AgentLogin", style: styles.btn, onClick: login }, "Login"),
139
+ react_1.default.createElement("button", { id: "logoutAgent", style: styles.btn, onClick: logout }, "Logout")))))))));
14
140
  };
15
141
  exports.default = StationLoginPresentational;
16
142
  //# sourceMappingURL=station-login.presentational.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"station-login.presentational.js","sourceRoot":"","sources":["../../src/station-login/station-login.presentational.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAuC;AAGvC,MAAM,0BAA0B,GAA6D,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,KAAK,EAAE,MAAM,CAAC,MAAM,YAAgB,CACtD;4BACX,4CAAU,KAAK,EAAE,MAAM,CAAC,QAAQ;gCAC9B,0CAAQ,KAAK,EAAE,MAAM,CAAC,SAAS,kBAAsB;gCACrD,0CAAQ,IAAI,EAAC,aAAa,EAAC,EAAE,EAAC,aAAa,EAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,iBAAiB;oCAC3F,0CAAQ,KAAK,EAAC,EAAE,EAAC,QAAQ,QAAC,MAAM,yCAAsC,CAC/D;gCACT,yCAAO,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,EAAE,EAAC,YAAY,EAAC,IAAI,EAAC,YAAY,EAAC,WAAW,EAAC,uBAAuB,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAE,QAAQ,GAAI;gCACnI,0CAAQ,EAAE,EAAC,YAAY,EAAC,KAAK,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,YAAgB;gCACzE,0CAAQ,EAAE,EAAC,aAAa,EAAC,KAAK,EAAE,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,aAAiB,CACnE,CACP,CACF,CACG,CACH,CACN,CAAG,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,0BAA0B,CAAC"}
@@ -1,3 +1,12 @@
1
- export declare const useStationLogin: () => {
1
+ import { UseStationLoginProps } from "./station-login/station-login.types";
2
+ export declare const useStationLogin: (props: UseStationLoginProps) => {
2
3
  name: string;
4
+ setDeviceType: import("react").Dispatch<import("react").SetStateAction<string>>;
5
+ setDialNumber: import("react").Dispatch<import("react").SetStateAction<string>>;
6
+ setTeam: import("react").Dispatch<import("react").SetStateAction<string>>;
7
+ login: () => void;
8
+ logout: () => void;
9
+ loginSuccess: StationLoginSuccess;
10
+ loginFailure: Error;
11
+ logoutSuccess: StationLogoutSuccess;
3
12
  };
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
- declare const StationLogin: React.FunctionComponent;
2
+ import { StationLoginProps } from './station-login.types';
3
+ declare const StationLogin: React.FunctionComponent<StationLoginProps>;
3
4
  declare const WebStationLogin: CustomElementConstructor;
4
5
  export { StationLogin, WebStationLogin };
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { IStationLoginProps } from './station-login.types';
3
- declare const StationLoginPresentational: React.FunctionComponent<IStationLoginProps>;
2
+ import { StationLoginPresentationalProps } from './station-login.types';
3
+ declare const StationLoginPresentational: React.FunctionComponent<StationLoginPresentationalProps>;
4
4
  export default StationLoginPresentational;
@@ -1,26 +1,65 @@
1
+ import { IContactCenter, StationLoginSuccess, StationLogoutSuccess, Team } from '@webex/plugin-cc';
1
2
  /**
2
3
  * Interface representing the properties for the Station Login component.
3
4
  */
4
5
  export interface IStationLoginProps {
5
6
  /**
6
7
  * The name of the station.
7
- *
8
8
  */
9
9
  name: string;
10
10
  /**
11
- * The current login state of the station.
11
+ * Webex instance.
12
12
  */
13
- loginState: any;
13
+ cc: IContactCenter;
14
14
  /**
15
- * Function to set the login state of the station.
15
+ * Array of the team IDs that agent belongs to
16
16
  */
17
- setLoginState: any;
17
+ teams: Team[];
18
18
  /**
19
- * The Customer Care SDK instance.
19
+ * Station login options available for the agent
20
+ */
21
+ loginOptions: string[];
22
+ /**
23
+ * Handler to initiate the agent login
24
+ */
25
+ login: () => void;
26
+ /**
27
+ * Handler for agent logout
28
+ */
29
+ logout: () => void;
30
+ /**
31
+ * Response data received on agent login success
32
+ */
33
+ loginSuccess?: StationLoginSuccess;
34
+ /**
35
+ * Error received on agent login failure
36
+ */
37
+ loginFailure?: Error;
38
+ /**
39
+ * Response data received on agent login success
40
+ */
41
+ logoutSuccess?: StationLogoutSuccess;
42
+ /**
43
+ * Callback function to be invoked once the agent login is successful
44
+ */
45
+ onLogin: () => void;
46
+ /**
47
+ * Callback function to be invoked once the agent login is successful
48
+ */
49
+ onLogout: () => void;
50
+ /**
51
+ * Handler to set device type
52
+ */
53
+ setDeviceType: (deviceType: string) => void;
54
+ /**
55
+ * Handler to set the entered dial number
20
56
  */
21
- ccSdk: any;
57
+ setDialNumber: (dn: string) => void;
22
58
  /**
23
- * Indicates whether the station is available.
59
+ * Handler to set the selected agent team
24
60
  */
25
- isAvailable: any;
61
+ setTeam: (team: string) => void;
26
62
  }
63
+ export type StationLoginPresentationalProps = Pick<IStationLoginProps, 'name' | 'teams' | 'loginOptions' | 'login' | 'logout' | 'loginSuccess' | 'loginFailure' | 'logoutSuccess' | 'setDeviceType' | 'setDialNumber' | 'setTeam'>;
64
+ export type UseStationLoginProps = Pick<IStationLoginProps, 'cc' | 'onLogin' | 'onLogout'>;
65
+ export type StationLoginProps = Pick<IStationLoginProps, 'onLogin' | 'onLogout'>;
package/package.json CHANGED
@@ -1,33 +1,33 @@
1
1
  {
2
2
  "name": "@webex/cc-station-login",
3
3
  "description": "Webex Contact Center Widgets: Station Login",
4
- "version": "1.28.0-alpha.11",
4
+ "version": "1.28.0-ccwidgets.2",
5
5
  "main": "dist/index.js",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
+ "files": [
10
+ "dist/",
11
+ "package.json"
12
+ ],
9
13
  "scripts": {
10
14
  "build": "yarn run -T tsc",
11
15
  "build:src": "webpack && yarn run build",
12
16
  "build:watch": "webpack --watch",
13
- "test:unit": "jest",
14
- "release": "semantic-release"
17
+ "test:unit": "jest"
15
18
  },
16
19
  "dependencies": {
17
20
  "@r2wc/react-to-web-component": "2.0.3",
18
- "@webex/cc-store": "1.0.1-0",
21
+ "@webex/cc-store": "1.28.0-ccwidgets.2",
19
22
  "mobx-react": "9.1.1",
20
23
  "react": "18.3.1",
21
- "react-dom": "18.3.1",
22
- "typescript": "5.6.3"
24
+ "react-dom": "18.3.1"
23
25
  },
24
26
  "devDependencies": {
25
27
  "@babel/core": "7.25.2",
26
28
  "@babel/preset-env": "7.25.4",
27
29
  "@babel/preset-react": "7.24.7",
28
30
  "@babel/preset-typescript": "7.25.9",
29
- "@semantic-release/changelog": "^6.0.3",
30
- "@semantic-release/git": "^10.0.1",
31
31
  "@testing-library/dom": "10.4.0",
32
32
  "@testing-library/jest-dom": "6.6.2",
33
33
  "@testing-library/react": "16.0.1",
@@ -38,8 +38,8 @@
38
38
  "file-loader": "6.2.0",
39
39
  "jest": "29.7.0",
40
40
  "jest-environment-jsdom": "29.7.0",
41
- "semantic-release": "^24.2.0",
42
41
  "ts-loader": "9.5.1",
42
+ "typescript": "5.6.3",
43
43
  "webpack": "5.94.0",
44
44
  "webpack-cli": "5.1.4",
45
45
  "webpack-merge": "6.0.1"
@@ -51,5 +51,5 @@
51
51
  "**/tests/**/*.tsx"
52
52
  ]
53
53
  },
54
- "stableVersion": "1.0.0"
54
+ "stableVersion": "1.28.0-ccwidgets.1"
55
55
  }
package/.babelrc.js DELETED
@@ -1,3 +0,0 @@
1
- const baseConfig = require('../../../.babelrc');
2
-
3
- module.exports = baseConfig;
package/CHANGELOG.md DELETED
@@ -1,6 +0,0 @@
1
- # [@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)
2
-
3
-
4
- ### Bug Fixes
5
-
6
- * **cc-widgets:** remove-dry-run ([#268](https://github.com/webex/widgets/issues/268)) ([4e2038c](https://github.com/webex/widgets/commit/4e2038c216cb915a1233667e259be619b92212b1))
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/helper.ts DELETED
@@ -1,6 +0,0 @@
1
- /*
2
- * StationLogin helper
3
- */
4
- export const useStationLogin = () => {
5
- return {name: 'StationLogin'};
6
- };
package/src/index.ts DELETED
@@ -1,3 +0,0 @@
1
- import {StationLogin, WebStationLogin} from './station-login';
2
-
3
- export {StationLogin, WebStationLogin};
@@ -1,29 +0,0 @@
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};
@@ -1,15 +0,0 @@
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;
@@ -1,30 +0,0 @@
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 DELETED
@@ -1,8 +0,0 @@
1
- import {useStationLogin} from '../src/helper';
2
-
3
- describe('Station login helpers', () => {
4
- it('returns the correct component name', () => {
5
- const result = useStationLogin();
6
- expect(result.name).toBe('StationLogin');
7
- });
8
- });
@@ -1,21 +0,0 @@
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
- });
@@ -1,21 +0,0 @@
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 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
- });