Skip to content

Commit c319657

Browse files
authored
fix(cc-samples): add loader on init and expand CAD (#487)
1 parent acd51be commit c319657

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

widgets-samples/cc/samples-cc-react-app/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>CC Widgets in React</title>
6+
<title>Contact Center Widgets in a React App</title>
77
</head>
88
<body>
99
<div id="root"></div>

widgets-samples/cc/samples-cc-react-app/src/App.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,23 @@ const onTaskDeclined = (task,reason) => {
350350
});
351351
};
352352

353+
const formatWidgetName = (widget: string) => {
354+
switch (widget) {
355+
case 'callControlCAD':
356+
return 'Call Controls with Call Associated Data (CAD)';
357+
default:
358+
return widget.charAt(0).toUpperCase() + widget.slice(1).replace(/([A-Z])/g, ' $1');
359+
}
360+
};
361+
353362
return (
354363
<div className="app mds-typography">
355364
<ThemeProvider
356365
themeclass={currentTheme === 'LIGHT' ? 'mds-theme-stable-lightWebex' : 'mds-theme-stable-darkWebex'}
357366
>
358367
<IconProvider iconSet="momentum-icons">
359368
<div className="webexTheme">
360-
<h1>Contact Center widgets in a react app</h1>
369+
<h1>Contact Center Widgets in a React app</h1>
361370
{showLoader && (
362371
<div className="profile-loader-overlay">
363372
<div className="profile-loader-spinner" aria-label="Loading" />
@@ -451,7 +460,7 @@ const onTaskDeclined = (task,reason) => {
451460
data-testid={`samples:widget-${widget}`}
452461
/>
453462
&nbsp;
454-
{widget.charAt(0).toUpperCase() + widget.slice(1).replace(/([A-Z])/g, ' $1')}&nbsp;
463+
{formatWidgetName(widget)}&nbsp;
455464
{widget === 'outdialCall' && (
456465
<span style={{display: 'inline-flex', alignItems: 'center'}}>
457466
<PopoverNext
@@ -567,8 +576,10 @@ const onTaskDeclined = (task,reason) => {
567576
<Button
568577
disabled={accessToken.trim() === ''}
569578
onClick={() => {
579+
setShowLoader(true);
570580
store.init({webexConfig, access_token: accessToken}).then(() => {
571581
setIsSdkReady(true);
582+
setShowLoader(false);
572583
});
573584
}}
574585
data-testid="samples:init-widgets-button"
@@ -707,7 +718,7 @@ const onTaskDeclined = (task,reason) => {
707718
<div className="box">
708719
<section className="section-box">
709720
<fieldset className="fieldset">
710-
<legend className="legend-box">Call Control CAD</legend>
721+
<legend className="legend-box">Call Control with Call Associated Data (CAD)</legend>
711722
<CallControlCAD
712723
onHoldResume={onHoldResume}
713724
onEnd={onEnd}

0 commit comments

Comments
 (0)