@pega/cosmos-react-cs 2.1.3 → 2.1.6
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/package.json +3 -3
- package/lib/components/Article/Article.d.ts +0 -32
- package/lib/components/Article/Article.d.ts.map +0 -1
- package/lib/components/Article/Article.js +0 -51
- package/lib/components/Article/Article.js.map +0 -1
- package/lib/components/Article/ArticleFooter.d.ts +0 -19
- package/lib/components/Article/ArticleFooter.d.ts.map +0 -1
- package/lib/components/Article/ArticleFooter.js +0 -40
- package/lib/components/Article/ArticleFooter.js.map +0 -1
- package/lib/components/Article/ArticleSkeleton.d.ts +0 -8
- package/lib/components/Article/ArticleSkeleton.d.ts.map +0 -1
- package/lib/components/Article/ArticleSkeleton.js +0 -15
- package/lib/components/Article/ArticleSkeleton.js.map +0 -1
- package/lib/components/Article/index.d.ts +0 -6
- package/lib/components/Article/index.d.ts.map +0 -1
- package/lib/components/Article/index.js +0 -3
- package/lib/components/Article/index.js.map +0 -1
- package/lib/components/ArticleList/ArticleList.d.ts +0 -17
- package/lib/components/ArticleList/ArticleList.d.ts.map +0 -1
- package/lib/components/ArticleList/ArticleList.js +0 -65
- package/lib/components/ArticleList/ArticleList.js.map +0 -1
- package/lib/components/ArticleList/ArticleListHeader.d.ts +0 -20
- package/lib/components/ArticleList/ArticleListHeader.d.ts.map +0 -1
- package/lib/components/ArticleList/ArticleListHeader.js +0 -68
- package/lib/components/ArticleList/ArticleListHeader.js.map +0 -1
- package/lib/components/ArticleList/ArticleSummary.d.ts +0 -14
- package/lib/components/ArticleList/ArticleSummary.d.ts.map +0 -1
- package/lib/components/ArticleList/ArticleSummary.js +0 -30
- package/lib/components/ArticleList/ArticleSummary.js.map +0 -1
- package/lib/components/ArticleList/SummarySkeleton.d.ts +0 -7
- package/lib/components/ArticleList/SummarySkeleton.d.ts.map +0 -1
- package/lib/components/ArticleList/SummarySkeleton.js +0 -9
- package/lib/components/ArticleList/SummarySkeleton.js.map +0 -1
- package/lib/components/ArticleList/index.d.ts +0 -7
- package/lib/components/ArticleList/index.d.ts.map +0 -1
- package/lib/components/ArticleList/index.js +0 -4
- package/lib/components/ArticleList/index.js.map +0 -1
- package/lib/components/CSCaseView/CSCaseView.d.ts +0 -9
- package/lib/components/CSCaseView/CSCaseView.d.ts.map +0 -1
- package/lib/components/CSCaseView/CSCaseView.js +0 -16
- package/lib/components/CSCaseView/CSCaseView.js.map +0 -1
- package/lib/components/CSCaseView/index.d.ts +0 -3
- package/lib/components/CSCaseView/index.d.ts.map +0 -1
- package/lib/components/CSCaseView/index.js +0 -2
- package/lib/components/CSCaseView/index.js.map +0 -1
- package/lib/components/CallControlPanel/Call.d.ts +0 -6
- package/lib/components/CallControlPanel/Call.d.ts.map +0 -1
- package/lib/components/CallControlPanel/Call.js +0 -142
- package/lib/components/CallControlPanel/Call.js.map +0 -1
- package/lib/components/CallControlPanel/CallControlPanel.d.ts +0 -6
- package/lib/components/CallControlPanel/CallControlPanel.d.ts.map +0 -1
- package/lib/components/CallControlPanel/CallControlPanel.js +0 -68
- package/lib/components/CallControlPanel/CallControlPanel.js.map +0 -1
- package/lib/components/CallControlPanel/CallControlPanel.styles.d.ts +0 -15
- package/lib/components/CallControlPanel/CallControlPanel.styles.d.ts.map +0 -1
- package/lib/components/CallControlPanel/CallControlPanel.styles.js +0 -118
- package/lib/components/CallControlPanel/CallControlPanel.styles.js.map +0 -1
- package/lib/components/CallControlPanel/CallControlPanel.types.d.ts +0 -112
- package/lib/components/CallControlPanel/CallControlPanel.types.d.ts.map +0 -1
- package/lib/components/CallControlPanel/CallControlPanel.types.js +0 -2
- package/lib/components/CallControlPanel/CallControlPanel.types.js.map +0 -1
- package/lib/components/CallControlPanel/CallControlPanelIcon.d.ts +0 -19
- package/lib/components/CallControlPanel/CallControlPanelIcon.d.ts.map +0 -1
- package/lib/components/CallControlPanel/CallControlPanelIcon.js +0 -74
- package/lib/components/CallControlPanel/CallControlPanelIcon.js.map +0 -1
- package/lib/components/CallControlPanel/CallTransfer.d.ts +0 -19
- package/lib/components/CallControlPanel/CallTransfer.d.ts.map +0 -1
- package/lib/components/CallControlPanel/CallTransfer.js +0 -121
- package/lib/components/CallControlPanel/CallTransfer.js.map +0 -1
- package/lib/components/CallControlPanel/CalleePicker.d.ts +0 -20
- package/lib/components/CallControlPanel/CalleePicker.d.ts.map +0 -1
- package/lib/components/CallControlPanel/CalleePicker.js +0 -61
- package/lib/components/CallControlPanel/CalleePicker.js.map +0 -1
- package/lib/components/CallControlPanel/ContactsList.d.ts +0 -23
- package/lib/components/CallControlPanel/ContactsList.d.ts.map +0 -1
- package/lib/components/CallControlPanel/ContactsList.js +0 -88
- package/lib/components/CallControlPanel/ContactsList.js.map +0 -1
- package/lib/components/CallControlPanel/DTMFKeypad.d.ts +0 -11
- package/lib/components/CallControlPanel/DTMFKeypad.d.ts.map +0 -1
- package/lib/components/CallControlPanel/DTMFKeypad.js +0 -23
- package/lib/components/CallControlPanel/DTMFKeypad.js.map +0 -1
- package/lib/components/CallControlPanel/StopWatch.d.ts +0 -9
- package/lib/components/CallControlPanel/StopWatch.d.ts.map +0 -1
- package/lib/components/CallControlPanel/StopWatch.js +0 -28
- package/lib/components/CallControlPanel/StopWatch.js.map +0 -1
- package/lib/components/CallControlPanel/index.d.ts +0 -5
- package/lib/components/CallControlPanel/index.d.ts.map +0 -1
- package/lib/components/CallControlPanel/index.js +0 -4
- package/lib/components/CallControlPanel/index.js.map +0 -1
- package/lib/components/CallControlPanel/utils.d.ts +0 -7
- package/lib/components/CallControlPanel/utils.d.ts.map +0 -1
- package/lib/components/CallControlPanel/utils.js +0 -35
- package/lib/components/CallControlPanel/utils.js.map +0 -1
- package/lib/components/DialPad/DialPad.d.ts +0 -16
- package/lib/components/DialPad/DialPad.d.ts.map +0 -1
- package/lib/components/DialPad/DialPad.js +0 -33
- package/lib/components/DialPad/DialPad.js.map +0 -1
- package/lib/components/DialPad/DialPad.types.d.ts +0 -33
- package/lib/components/DialPad/DialPad.types.d.ts.map +0 -1
- package/lib/components/DialPad/DialPad.types.js +0 -2
- package/lib/components/DialPad/DialPad.types.js.map +0 -1
- package/lib/components/DialPad/DialPadKeyboard.d.ts +0 -12
- package/lib/components/DialPad/DialPadKeyboard.d.ts.map +0 -1
- package/lib/components/DialPad/DialPadKeyboard.js +0 -87
- package/lib/components/DialPad/DialPadKeyboard.js.map +0 -1
- package/lib/components/DialPad/DialPadKeyboard.styles.d.ts +0 -5
- package/lib/components/DialPad/DialPadKeyboard.styles.d.ts.map +0 -1
- package/lib/components/DialPad/DialPadKeyboard.styles.js +0 -76
- package/lib/components/DialPad/DialPadKeyboard.styles.js.map +0 -1
- package/lib/components/DialPad/KeyboardNavigation.d.ts +0 -6
- package/lib/components/DialPad/KeyboardNavigation.d.ts.map +0 -1
- package/lib/components/DialPad/KeyboardNavigation.js +0 -156
- package/lib/components/DialPad/KeyboardNavigation.js.map +0 -1
- package/lib/components/DialPad/index.d.ts +0 -3
- package/lib/components/DialPad/index.d.ts.map +0 -1
- package/lib/components/DialPad/index.js +0 -2
- package/lib/components/DialPad/index.js.map +0 -1
- package/lib/components/DialPad/utils.d.ts +0 -4
- package/lib/components/DialPad/utils.d.ts.map +0 -1
- package/lib/components/DialPad/utils.js +0 -7
- package/lib/components/DialPad/utils.js.map +0 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts +0 -6
- package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts.map +0 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js +0 -75
- package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +0 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts +0 -9
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts.map +0 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js +0 -142
- package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js.map +0 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts +0 -31
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts.map +0 -1
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.js +0 -2
- package/lib/components/IntelligentGuidance/IntelligentGuidance.types.js.map +0 -1
- package/lib/components/IntelligentGuidance/index.d.ts +0 -3
- package/lib/components/IntelligentGuidance/index.d.ts.map +0 -1
- package/lib/components/IntelligentGuidance/index.js +0 -2
- package/lib/components/IntelligentGuidance/index.js.map +0 -1
- package/lib/components/InteractionNotification/InteractionNotification.d.ts +0 -26
- package/lib/components/InteractionNotification/InteractionNotification.d.ts.map +0 -1
- package/lib/components/InteractionNotification/InteractionNotification.js +0 -78
- package/lib/components/InteractionNotification/InteractionNotification.js.map +0 -1
- package/lib/components/InteractionNotification/index.d.ts +0 -2
- package/lib/components/InteractionNotification/index.d.ts.map +0 -1
- package/lib/components/InteractionNotification/index.js +0 -2
- package/lib/components/InteractionNotification/index.js.map +0 -1
- package/lib/components/InteractionTimer/InteractionTimer.d.ts +0 -29
- package/lib/components/InteractionTimer/InteractionTimer.d.ts.map +0 -1
- package/lib/components/InteractionTimer/InteractionTimer.js +0 -72
- package/lib/components/InteractionTimer/InteractionTimer.js.map +0 -1
- package/lib/components/InteractionTimer/index.d.ts +0 -2
- package/lib/components/InteractionTimer/index.d.ts.map +0 -1
- package/lib/components/InteractionTimer/index.js +0 -2
- package/lib/components/InteractionTimer/index.js.map +0 -1
- package/lib/components/TaskManager/Picker/Picker.d.ts +0 -6
- package/lib/components/TaskManager/Picker/Picker.d.ts.map +0 -1
- package/lib/components/TaskManager/Picker/Picker.js +0 -171
- package/lib/components/TaskManager/Picker/Picker.js.map +0 -1
- package/lib/components/TaskManager/Picker/Picker.types.d.ts +0 -27
- package/lib/components/TaskManager/Picker/Picker.types.d.ts.map +0 -1
- package/lib/components/TaskManager/Picker/Picker.types.js +0 -2
- package/lib/components/TaskManager/Picker/Picker.types.js.map +0 -1
- package/lib/components/TaskManager/TaskManager.context.d.ts +0 -5
- package/lib/components/TaskManager/TaskManager.context.d.ts.map +0 -1
- package/lib/components/TaskManager/TaskManager.context.js +0 -3
- package/lib/components/TaskManager/TaskManager.context.js.map +0 -1
- package/lib/components/TaskManager/TaskManager.d.ts +0 -6
- package/lib/components/TaskManager/TaskManager.d.ts.map +0 -1
- package/lib/components/TaskManager/TaskManager.js +0 -76
- package/lib/components/TaskManager/TaskManager.js.map +0 -1
- package/lib/components/TaskManager/TaskManager.styles.d.ts +0 -20
- package/lib/components/TaskManager/TaskManager.styles.d.ts.map +0 -1
- package/lib/components/TaskManager/TaskManager.styles.js +0 -232
- package/lib/components/TaskManager/TaskManager.styles.js.map +0 -1
- package/lib/components/TaskManager/TaskManager.types.d.ts +0 -74
- package/lib/components/TaskManager/TaskManager.types.d.ts.map +0 -1
- package/lib/components/TaskManager/TaskManager.types.js +0 -2
- package/lib/components/TaskManager/TaskManager.types.js.map +0 -1
- package/lib/components/TaskManager/TaskManagerTabs.d.ts +0 -6
- package/lib/components/TaskManager/TaskManagerTabs.d.ts.map +0 -1
- package/lib/components/TaskManager/TaskManagerTabs.js +0 -159
- package/lib/components/TaskManager/TaskManagerTabs.js.map +0 -1
- package/lib/components/TaskManager/TaskView.d.ts +0 -6
- package/lib/components/TaskManager/TaskView.d.ts.map +0 -1
- package/lib/components/TaskManager/TaskView.js +0 -10
- package/lib/components/TaskManager/TaskView.js.map +0 -1
- package/lib/components/TaskManager/index.d.ts +0 -5
- package/lib/components/TaskManager/index.d.ts.map +0 -1
- package/lib/components/TaskManager/index.js +0 -4
- package/lib/components/TaskManager/index.js.map +0 -1
- package/lib/index.d.ts +0 -18
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -19
- package/lib/index.js.map +0 -1
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { CaseView, StyledSummaryRegion } from '@pega/cosmos-react-work';
|
|
5
|
-
const StyledCSCaseView = styled(CaseView)(({ theme }) => {
|
|
6
|
-
return css `
|
|
7
|
-
${StyledSummaryRegion} {
|
|
8
|
-
padding-block-end: calc(${theme.base.spacing} + 3rem);
|
|
9
|
-
}
|
|
10
|
-
`;
|
|
11
|
-
});
|
|
12
|
-
const CSCaseView = forwardRef(({ intelligentGuidance, ...restProps }, ref) => {
|
|
13
|
-
return (_jsxs(_Fragment, { children: [_jsx(StyledCSCaseView, { ...restProps, ref: ref }, void 0), intelligentGuidance] }, void 0));
|
|
14
|
-
});
|
|
15
|
-
export default CSCaseView;
|
|
16
|
-
//# sourceMappingURL=CSCaseView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CSCaseView.js","sourceRoot":"","sources":["../../../src/components/CSCaseView/CSCaseView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,UAAU,EAAwB,MAAM,OAAO,CAAC;AAC7D,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAE,QAAQ,EAAiB,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAMvF,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACtD,OAAO,GAAG,CAAA;MACN,mBAAmB;gCACO,KAAK,CAAC,IAAI,CAAC,OAAO;;GAE/C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAuC,UAAU,CAC/D,CACE,EAAE,mBAAmB,EAAE,GAAG,SAAS,EAAoC,EACvE,GAAwB,EACxB,EAAE;IACF,OAAO,CACL,8BACE,KAAC,gBAAgB,OAAK,SAAS,EAAE,GAAG,EAAE,GAAG,WAAI,EAC5C,mBAAmB,YACnB,CACJ,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { FC, forwardRef, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { ForwardProps } from '@pega/cosmos-react-core';\nimport { CaseView, CaseViewProps, StyledSummaryRegion } from '@pega/cosmos-react-work';\n\nexport interface CSCaseViewProps extends CaseViewProps {\n intelligentGuidance?: JSX.Element;\n}\n\nconst StyledCSCaseView = styled(CaseView)(({ theme }) => {\n return css`\n ${StyledSummaryRegion} {\n padding-block-end: calc(${theme.base.spacing} + 3rem);\n }\n `;\n});\n\nconst CSCaseView: FC<CSCaseViewProps & ForwardProps> = forwardRef(\n (\n { intelligentGuidance, ...restProps }: PropsWithoutRef<CSCaseViewProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <>\n <StyledCSCaseView {...restProps} ref={ref} />\n {intelligentGuidance}\n </>\n );\n }\n);\n\nexport default CSCaseView;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CSCaseView/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CSCaseView/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export { default } from './CSCaseView';\nexport { CSCaseViewProps } from './CSCaseView';\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import { CallProps } from './CallControlPanel.types';
|
|
4
|
-
declare const Call: FunctionComponent<CallProps & ForwardProps>;
|
|
5
|
-
export default Call;
|
|
6
|
-
//# sourceMappingURL=Call.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Call.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/Call.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA2D,MAAM,OAAO,CAAC;AAEnG,OAAO,EAKL,YAAY,EAUb,MAAM,yBAAyB,CAAC;AAcjC,OAAO,EAAmB,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAiBtE,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,SAAS,GAAG,YAAY,CAyQrD,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
-
import { Actions, Button, Flex, Icon, registerIcon, Popover, Status, SummaryItem, Text, useElement, useI18n, useOuterEvent } from '@pega/cosmos-react-core';
|
|
4
|
-
import * as arrowUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/arrow-up.icon';
|
|
5
|
-
import * as micSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/mic-solid.icon';
|
|
6
|
-
import * as micOffSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/mic-off-solid.icon';
|
|
7
|
-
import * as playSoldIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/play-solid.icon';
|
|
8
|
-
import * as pauseSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/pause-solid.icon';
|
|
9
|
-
import * as phoneSplitSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/phone-split-solid.icon';
|
|
10
|
-
import * as phoneHangupSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/phone-hangup-solid.icon';
|
|
11
|
-
import { StyledHoldInfo, StyledProgressContainer, StyledSLAProgress } from './CallControlPanel.styles';
|
|
12
|
-
import CalleePicker from './CalleePicker';
|
|
13
|
-
import CallTransfer from './CallTransfer';
|
|
14
|
-
import DTMFKeypad from './DTMFKeypad';
|
|
15
|
-
import StopWatch from './StopWatch';
|
|
16
|
-
import { calculateSla } from './utils';
|
|
17
|
-
registerIcon(arrowUpIcon, micSolidIcon, micOffSolidIcon, playSoldIcon, pauseSolidIcon, phoneSplitSolidIcon, phoneHangupSolidIcon);
|
|
18
|
-
const Call = ({ id: callId, startedAt, onHoldSince, slaConfig, participants, onPauseToggle, muted, onMuteToggle, onDTMFPress, onConsultAction, onConferenceAction, onTransferAction, onMergeCall, transferOptions }) => {
|
|
19
|
-
const t = useI18n();
|
|
20
|
-
const moreActionsButtonRef = useRef(null);
|
|
21
|
-
const inCallSince = startedAt instanceof Date ? startedAt.getUTCMilliseconds() : startedAt;
|
|
22
|
-
const [popoverEl, setPopoverRef] = useElement();
|
|
23
|
-
const [slaLevel, setSlaLevel] = useState(undefined);
|
|
24
|
-
const [showConsultPopover, setShowConsultPopover] = useState(false);
|
|
25
|
-
const [showConferencePopover, setShowConferencePopover] = useState(false);
|
|
26
|
-
const [showTransferPopover, setShowTransferPopover] = useState(false);
|
|
27
|
-
const [showSendDTMF, setShowSendDTMF] = useState(false);
|
|
28
|
-
const { slaTimeout, slaDuration } = calculateSla(Date.now() - inCallSince, slaConfig);
|
|
29
|
-
const appendConferenceAction = (actionItems) => {
|
|
30
|
-
actionItems.splice(1, 0, {
|
|
31
|
-
id: 'conference',
|
|
32
|
-
text: t('call_panel_conference_call_menu_item'),
|
|
33
|
-
onClick: () => setShowConferencePopover(true)
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
const calculateCurrentSlaLevel = () => {
|
|
37
|
-
const { currentSlaLevel } = calculateSla(Date.now() - inCallSince, slaConfig);
|
|
38
|
-
setSlaLevel(currentSlaLevel);
|
|
39
|
-
};
|
|
40
|
-
const getActionItems = (item) => {
|
|
41
|
-
const actionItems = [
|
|
42
|
-
{
|
|
43
|
-
id: 'consult',
|
|
44
|
-
text: t('call_panel_consult_call_menu_item'),
|
|
45
|
-
onClick: () => setShowConsultPopover(true)
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
id: 'transfer',
|
|
49
|
-
text: t('call_panel_transfer_call_menu_item'),
|
|
50
|
-
onClick: () => setShowTransferPopover(true)
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
id: 'dtmf',
|
|
54
|
-
text: t('call_panel_send_dtmf_menu_item'),
|
|
55
|
-
onClick: () => setShowSendDTMF(true)
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
id: 'hang_up',
|
|
59
|
-
text: t('call_panel_hangup_call_menu_item'),
|
|
60
|
-
disabled: !item.onEndCall,
|
|
61
|
-
onClick: () => {
|
|
62
|
-
if (item.onEndCall)
|
|
63
|
-
item.onEndCall(callId, item.id);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
];
|
|
67
|
-
if (onConferenceAction) {
|
|
68
|
-
appendConferenceAction(actionItems);
|
|
69
|
-
}
|
|
70
|
-
return actionItems;
|
|
71
|
-
};
|
|
72
|
-
useLayoutEffect(() => {
|
|
73
|
-
calculateCurrentSlaLevel();
|
|
74
|
-
const slaDurationInMillis = slaDuration && slaDuration * 1000;
|
|
75
|
-
const timer = setTimeout(() => {
|
|
76
|
-
calculateCurrentSlaLevel();
|
|
77
|
-
}, slaDurationInMillis);
|
|
78
|
-
return () => clearTimeout(timer);
|
|
79
|
-
}, [inCallSince, slaLevel]);
|
|
80
|
-
useOuterEvent('mousedown', [popoverEl], () => {
|
|
81
|
-
setShowConsultPopover(false);
|
|
82
|
-
setShowTransferPopover(false);
|
|
83
|
-
setShowConferencePopover(false);
|
|
84
|
-
setShowSendDTMF(false);
|
|
85
|
-
});
|
|
86
|
-
const onKeyDown = ({ key }) => {
|
|
87
|
-
if (key === 'Escape') {
|
|
88
|
-
setShowConsultPopover(false);
|
|
89
|
-
setShowTransferPopover(false);
|
|
90
|
-
setShowConferencePopover(false);
|
|
91
|
-
setShowSendDTMF(false);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
useEffect(() => {
|
|
95
|
-
document.addEventListener('keydown', onKeyDown);
|
|
96
|
-
return () => {
|
|
97
|
-
document.removeEventListener('keydown', onKeyDown);
|
|
98
|
-
};
|
|
99
|
-
}, [popoverEl]);
|
|
100
|
-
let popoverContent = null;
|
|
101
|
-
if (showConsultPopover) {
|
|
102
|
-
popoverContent = (_jsx(CalleePicker, { heading: t('call_panel_consult_with_heading'), onClose: () => setShowConsultPopover(false), onCall: phoneNumber => {
|
|
103
|
-
onConsultAction?.(callId, phoneNumber);
|
|
104
|
-
setShowConsultPopover(false);
|
|
105
|
-
} }, void 0));
|
|
106
|
-
}
|
|
107
|
-
else if (showConferencePopover) {
|
|
108
|
-
popoverContent = (_jsx(CalleePicker, { heading: t('call_panel_conference_heading'), onClose: () => setShowConferencePopover(false), onCall: phoneNumber => {
|
|
109
|
-
onConferenceAction?.(callId, phoneNumber);
|
|
110
|
-
setShowConferencePopover(false);
|
|
111
|
-
} }, void 0));
|
|
112
|
-
}
|
|
113
|
-
else if (showTransferPopover) {
|
|
114
|
-
popoverContent = (_jsx(CallTransfer, { onClose: () => setShowTransferPopover(false), onTransferCall: transferData => {
|
|
115
|
-
onTransferAction?.(callId, transferData);
|
|
116
|
-
setShowTransferPopover(false);
|
|
117
|
-
}, transferOptions: transferOptions }, void 0));
|
|
118
|
-
}
|
|
119
|
-
else if (showSendDTMF) {
|
|
120
|
-
popoverContent = (_jsx(DTMFKeypad, { onClose: () => setShowSendDTMF(false), onDialButtonClick: (key) => onDTMFPress?.(callId, String.fromCharCode(key)) }, void 0));
|
|
121
|
-
}
|
|
122
|
-
return (_jsxs(StyledProgressContainer, { children: [_jsx(StyledSLAProgress, { determinate: true, placement: 'local', slaDuration: slaDuration, slaLevel: slaLevel }, void 0), participants.map((item, index) => {
|
|
123
|
-
return (_jsx(SummaryItem, { container: index === 0
|
|
124
|
-
? {
|
|
125
|
-
areas: '"primary secondary actions"',
|
|
126
|
-
cols: 'auto minmax(0, 2fr) auto'
|
|
127
|
-
}
|
|
128
|
-
: {
|
|
129
|
-
areas: '"visual primary secondary actions"',
|
|
130
|
-
cols: 'auto auto minmax(0, 2fr) auto'
|
|
131
|
-
}, overflowStrategy: 'ellipsis', visual: index !== 0 && _jsx(Icon, { name: 'arrow-up' }, void 0), primary: item.name, secondary: item.info && _jsx(Text, { variant: 'secondary', children: item.info }, void 0), actions: _jsxs(Flex, { container: { wrap: 'nowrap' }, children: [slaConfig && index === 0 && (_jsx(Flex, { container: { alignItems: 'center' }, children: _jsx(StopWatch, { startTime: startedAt, timeout: slaTimeout }, void 0) }, void 0)), index === 0 && (_jsxs(_Fragment, { children: [_jsx(Button, { icon: true, variant: 'simple', disabled: onHoldSince !== undefined, onClick: () => onMuteToggle(callId), label: t(muted ? 'call_panel_unmute_mic_menu_item' : 'call_panel_mute_mic_menu_item'), children: _jsx(Icon, { name: muted ? 'mic-solid' : 'mic-off-solid' }, void 0) }, void 0), _jsx(Button, { icon: true, variant: 'simple', onClick: () => onPauseToggle(callId), label: t(onHoldSince !== undefined
|
|
132
|
-
? 'call_panel_resume_call_menu_item'
|
|
133
|
-
: 'call_panel_pause_call_menu_item'), children: _jsx(Icon, { name: onHoldSince !== undefined ? 'play-solid' : 'pause-solid' }, void 0) }, void 0)] }, void 0)), index === 0 && slaConfig && (_jsx(Actions, { ref: moreActionsButtonRef, items: getActionItems(item) }, void 0)), onMergeCall && (_jsx(Button, { icon: true, variant: 'simple', onClick: () => onMergeCall(callId), label: t('call_panel_merge_call_menu_item'), children: _jsx(Icon, { name: 'phone-split-solid' }, void 0) }, 'merge')), (!slaConfig || index !== 0) && (_jsx(Button, { icon: true, variant: 'simple', onClick: () => {
|
|
134
|
-
if (item.onEndCall)
|
|
135
|
-
item.onEndCall(callId, item.id);
|
|
136
|
-
}, label: t('call_panel_hangup_call_menu_item'), children: _jsx(Icon, { name: 'phone-hangup-solid' }, void 0) }, 'hang_up'))] }, void 0) }, item.id));
|
|
137
|
-
}), onHoldSince !== undefined && (_jsx(Status, { as: StyledHoldInfo, variant: 'pending', children: t('call_panel_call_on_hold', [
|
|
138
|
-
_jsx(StopWatch, { startTime: onHoldSince }, void 0)
|
|
139
|
-
]) }, void 0)), _jsx(Popover, { target: moreActionsButtonRef.current, ref: setPopoverRef, placement: 'top-end', show: showConsultPopover || showTransferPopover || showSendDTMF || showConferencePopover, children: popoverContent }, void 0)] }, void 0));
|
|
140
|
-
};
|
|
141
|
-
export default Call;
|
|
142
|
-
//# sourceMappingURL=Call.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Call.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/Call.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAgC,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnG,OAAO,EAEL,OAAO,EACP,MAAM,EACN,IAAI,EAEJ,IAAI,EACJ,YAAY,EACZ,OAAO,EACP,MAAM,EACN,WAAW,EACX,IAAI,EACJ,UAAU,EACV,OAAO,EACP,aAAa,EACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,WAAW,MAAM,iEAAiE,CAAC;AAC/F,OAAO,KAAK,YAAY,MAAM,kEAAkE,CAAC;AACjG,OAAO,KAAK,eAAe,MAAM,sEAAsE,CAAC;AACxG,OAAO,KAAK,YAAY,MAAM,mEAAmE,CAAC;AAClG,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AACrG,OAAO,KAAK,mBAAmB,MAAM,0EAA0E,CAAC;AAChH,OAAO,KAAK,oBAAoB,MAAM,2EAA2E,CAAC;AAElH,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAO,SAAS,MAA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,kCAAkC,CAAC,YAE5C,KAAC,IAAI,IAAC,IAAI,EAAC,oBAAoB,WAAG,IAN9B,SAAS,CAON,CACV,YACI,IAhEJ,IAAI,CAAC,EAAE,CAkEZ,CACH,CAAC;YACJ,CAAC,CAAC,EACD,WAAW,KAAK,SAAS,IAAI,CAC5B,KAAC,MAAM,IAAC,EAAE,EAAE,cAAc,EAAE,OAAO,EAAC,SAAS,YAEzC,CAAC,CAAC,yBAAyB,EAAE;oBAC3B,KAAC,SAAS,IAAC,SAAS,EAAE,WAAW,WAAI;iBACtC,CAAsB,WAElB,CACV,EAED,KAAC,OAAO,IACN,MAAM,EAAE,oBAAoB,CAAC,OAAO,EACpC,GAAG,EAAE,aAAa,EAClB,SAAS,EAAC,SAAS,EACnB,IAAI,EAAE,kBAAkB,IAAI,mBAAmB,IAAI,YAAY,IAAI,qBAAqB,YAEvF,cAAc,WACP,YACc,CAC3B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC","sourcesContent":["import { FunctionComponent, ReactNode, useEffect, useLayoutEffect, useRef, useState } from 'react';\n\nimport {\n Action,\n Actions,\n Button,\n Flex,\n ForwardProps,\n Icon,\n registerIcon,\n Popover,\n Status,\n SummaryItem,\n Text,\n useElement,\n useI18n,\n useOuterEvent\n} from '@pega/cosmos-react-core';\nimport * as arrowUpIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/arrow-up.icon';\nimport * as micSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/mic-solid.icon';\nimport * as micOffSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/mic-off-solid.icon';\nimport * as playSoldIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/play-solid.icon';\nimport * as pauseSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/pause-solid.icon';\nimport * as phoneSplitSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/phone-split-solid.icon';\nimport * as phoneHangupSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/phone-hangup-solid.icon';\n\nimport {\n StyledHoldInfo,\n StyledProgressContainer,\n StyledSLAProgress\n} from './CallControlPanel.styles';\nimport { CallParticipant, CallProps } from './CallControlPanel.types';\nimport CalleePicker from './CalleePicker';\nimport CallTransfer from './CallTransfer';\nimport DTMFKeypad from './DTMFKeypad';\nimport StopWatch from './StopWatch';\nimport { calculateSla } from './utils';\n\nregisterIcon(\n arrowUpIcon,\n micSolidIcon,\n micOffSolidIcon,\n playSoldIcon,\n pauseSolidIcon,\n phoneSplitSolidIcon,\n phoneHangupSolidIcon\n);\n\nconst Call: FunctionComponent<CallProps & ForwardProps> = ({\n id: callId,\n startedAt,\n onHoldSince,\n slaConfig,\n participants,\n onPauseToggle,\n muted,\n onMuteToggle,\n onDTMFPress,\n onConsultAction,\n onConferenceAction,\n onTransferAction,\n onMergeCall,\n transferOptions\n}: CallProps & ForwardProps) => {\n const t = useI18n();\n const moreActionsButtonRef = useRef<HTMLButtonElement>(null);\n const inCallSince = startedAt instanceof Date ? startedAt.getUTCMilliseconds() : startedAt;\n const [popoverEl, setPopoverRef] = useElement<HTMLElement>();\n const [slaLevel, setSlaLevel] = useState<number | undefined>(undefined);\n const [showConsultPopover, setShowConsultPopover] = useState(false);\n const [showConferencePopover, setShowConferencePopover] = useState(false);\n const [showTransferPopover, setShowTransferPopover] = useState(false);\n const [showSendDTMF, setShowSendDTMF] = useState(false);\n const { slaTimeout, slaDuration } = calculateSla(Date.now() - inCallSince, slaConfig);\n\n const appendConferenceAction = (actionItems: Action[]) => {\n actionItems.splice(1, 0, {\n id: 'conference',\n text: t('call_panel_conference_call_menu_item'),\n onClick: () => setShowConferencePopover(true)\n });\n };\n\n const calculateCurrentSlaLevel = (): void => {\n const { currentSlaLevel } = calculateSla(Date.now() - inCallSince, slaConfig);\n setSlaLevel(currentSlaLevel);\n };\n\n const getActionItems = (item: CallParticipant): Action[] => {\n const actionItems = [\n {\n id: 'consult',\n text: t('call_panel_consult_call_menu_item'),\n onClick: () => setShowConsultPopover(true)\n },\n\n {\n id: 'transfer',\n text: t('call_panel_transfer_call_menu_item'),\n onClick: () => setShowTransferPopover(true)\n },\n {\n id: 'dtmf',\n text: t('call_panel_send_dtmf_menu_item'),\n onClick: () => setShowSendDTMF(true)\n },\n {\n id: 'hang_up',\n text: t('call_panel_hangup_call_menu_item'),\n disabled: !item.onEndCall,\n onClick: () => {\n if (item.onEndCall) item.onEndCall(callId, item.id);\n }\n }\n ];\n if (onConferenceAction) {\n appendConferenceAction(actionItems);\n }\n return actionItems;\n };\n\n useLayoutEffect(() => {\n calculateCurrentSlaLevel();\n const slaDurationInMillis = slaDuration && slaDuration * 1000;\n\n const timer = setTimeout(() => {\n calculateCurrentSlaLevel();\n }, slaDurationInMillis);\n\n return () => clearTimeout(timer);\n }, [inCallSince, slaLevel]);\n\n useOuterEvent('mousedown', [popoverEl], () => {\n setShowConsultPopover(false);\n setShowTransferPopover(false);\n setShowConferencePopover(false);\n setShowSendDTMF(false);\n });\n\n const onKeyDown = ({ key }: KeyboardEvent) => {\n if (key === 'Escape') {\n setShowConsultPopover(false);\n setShowTransferPopover(false);\n setShowConferencePopover(false);\n setShowSendDTMF(false);\n }\n };\n\n useEffect(() => {\n document.addEventListener('keydown', onKeyDown);\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n };\n }, [popoverEl]);\n\n let popoverContent: ReactNode = null;\n if (showConsultPopover) {\n popoverContent = (\n <CalleePicker\n heading={t('call_panel_consult_with_heading')}\n onClose={() => setShowConsultPopover(false)}\n onCall={phoneNumber => {\n onConsultAction?.(callId, phoneNumber);\n setShowConsultPopover(false);\n }}\n />\n );\n } else if (showConferencePopover) {\n popoverContent = (\n <CalleePicker\n heading={t('call_panel_conference_heading')}\n onClose={() => setShowConferencePopover(false)}\n onCall={phoneNumber => {\n onConferenceAction?.(callId, phoneNumber);\n setShowConferencePopover(false);\n }}\n />\n );\n } else if (showTransferPopover) {\n popoverContent = (\n <CallTransfer\n onClose={() => setShowTransferPopover(false)}\n onTransferCall={transferData => {\n onTransferAction?.(callId, transferData);\n setShowTransferPopover(false);\n }}\n transferOptions={transferOptions}\n />\n );\n } else if (showSendDTMF) {\n popoverContent = (\n <DTMFKeypad\n onClose={() => setShowSendDTMF(false)}\n onDialButtonClick={(key: number) => onDTMFPress?.(callId, String.fromCharCode(key))}\n />\n );\n }\n\n return (\n <StyledProgressContainer>\n <StyledSLAProgress\n determinate\n placement='local'\n slaDuration={slaDuration}\n slaLevel={slaLevel}\n />\n {participants.map((item, index) => {\n return (\n <SummaryItem\n container={\n index === 0\n ? {\n areas: '\"primary secondary actions\"',\n cols: 'auto minmax(0, 2fr) auto'\n }\n : {\n areas: '\"visual primary secondary actions\"',\n cols: 'auto auto minmax(0, 2fr) auto'\n }\n }\n overflowStrategy='ellipsis'\n visual={index !== 0 && <Icon name='arrow-up' />}\n primary={item.name}\n secondary={item.info && <Text variant='secondary'>{item.info}</Text>}\n key={item.id}\n actions={\n <Flex container={{ wrap: 'nowrap' }}>\n {slaConfig && index === 0 && (\n <Flex container={{ alignItems: 'center' }}>\n <StopWatch startTime={startedAt} timeout={slaTimeout} />\n </Flex>\n )}\n {index === 0 && (\n <>\n <Button\n icon\n variant='simple'\n disabled={onHoldSince !== undefined}\n onClick={() => onMuteToggle(callId)}\n label={t(\n muted ? 'call_panel_unmute_mic_menu_item' : 'call_panel_mute_mic_menu_item'\n )}\n >\n <Icon name={muted ? 'mic-solid' : 'mic-off-solid'} />\n </Button>\n <Button\n icon\n variant='simple'\n onClick={() => onPauseToggle(callId)}\n label={t(\n onHoldSince !== undefined\n ? 'call_panel_resume_call_menu_item'\n : 'call_panel_pause_call_menu_item'\n )}\n >\n <Icon name={onHoldSince !== undefined ? 'play-solid' : 'pause-solid'} />\n </Button>\n </>\n )}\n {index === 0 && slaConfig && (\n <Actions ref={moreActionsButtonRef} items={getActionItems(item)} />\n )}\n\n {onMergeCall && (\n <Button\n icon\n variant='simple'\n key='merge'\n onClick={() => onMergeCall(callId)}\n label={t('call_panel_merge_call_menu_item')}\n >\n <Icon name='phone-split-solid' />\n </Button>\n )}\n\n {(!slaConfig || index !== 0) && (\n <Button\n icon\n variant='simple'\n key='hang_up'\n onClick={() => {\n if (item.onEndCall) item.onEndCall(callId, item.id);\n }}\n label={t('call_panel_hangup_call_menu_item')}\n >\n <Icon name='phone-hangup-solid' />\n </Button>\n )}\n </Flex>\n }\n />\n );\n })}\n {onHoldSince !== undefined && (\n <Status as={StyledHoldInfo} variant='pending'>\n {\n t('call_panel_call_on_hold', [\n <StopWatch startTime={onHoldSince} />\n ]) as unknown as string\n }\n </Status>\n )}\n\n <Popover\n target={moreActionsButtonRef.current}\n ref={setPopoverRef}\n placement='top-end'\n show={showConsultPopover || showTransferPopover || showSendDTMF || showConferencePopover}\n >\n {popoverContent}\n </Popover>\n </StyledProgressContainer>\n );\n};\n\nexport default Call;\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import type { CallControlPanelProps } from './CallControlPanel.types';
|
|
4
|
-
declare const CallControlPanel: FunctionComponent<CallControlPanelProps & ForwardProps>;
|
|
5
|
-
export default CallControlPanel;
|
|
6
|
-
//# sourceMappingURL=CallControlPanel.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CallControlPanel.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallControlPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAEf,OAAO,EAaL,YAAY,EAGb,MAAM,yBAAyB,CAAC;AAMjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAatE,QAAA,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,qBAAqB,GAAG,YAAY,CAgJ7E,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { CardHeader, CardContent, Button, useI18n, Icon, registerIcon, Flex, ComboBox, Text, Popover, useOuterEvent, useElement, useConsolidatedRef, useDraggable } from '@pega/cosmos-react-core';
|
|
4
|
-
import * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';
|
|
5
|
-
import * as phoneSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/phone-solid.icon';
|
|
6
|
-
import * as plusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/plus.icon';
|
|
7
|
-
import CalleePicker, { ContactsContext } from './CalleePicker';
|
|
8
|
-
import Call from './Call';
|
|
9
|
-
import StopWatch from './StopWatch';
|
|
10
|
-
import { StyledCallControlPanel, StyledStatusRow } from './CallControlPanel.styles';
|
|
11
|
-
import { UserStatusIcon } from './CallControlPanelIcon';
|
|
12
|
-
registerIcon(plusIcon, caretDownIcon, phoneSolidIcon);
|
|
13
|
-
const resetPopoverToDefaultPosition = (containerRef) => {
|
|
14
|
-
if (containerRef && containerRef.current)
|
|
15
|
-
containerRef.current.style.transform = 'translate(0px, 0px)';
|
|
16
|
-
};
|
|
17
|
-
const CallControlPanel = forwardRef(({ heading, status, statusOptions, onStatusChange, inStatusSince, message, draggable = false, calls, onAddCall, contactsList, onFavoriteToggle, ...restProps }, ref) => {
|
|
18
|
-
const t = useI18n();
|
|
19
|
-
const addButtonRef = useRef(null);
|
|
20
|
-
const [showPopover, setShowPopover] = useState(false);
|
|
21
|
-
const [collapsed, setCollapsed] = useState(false);
|
|
22
|
-
const containerRef = useConsolidatedRef(ref);
|
|
23
|
-
const [popoverEl, setPopoverRef] = useElement();
|
|
24
|
-
const dragRef = useRef(null);
|
|
25
|
-
useDraggable(containerRef, dragRef);
|
|
26
|
-
const actionItems = useMemo(() => {
|
|
27
|
-
return statusOptions.map(({ id, label }) => {
|
|
28
|
-
return { id, primary: label, selected: id === status };
|
|
29
|
-
});
|
|
30
|
-
}, [status, statusOptions]);
|
|
31
|
-
useOuterEvent('mousedown', [popoverEl], () => {
|
|
32
|
-
setShowPopover(false);
|
|
33
|
-
});
|
|
34
|
-
const onKeyDown = ({ key }) => {
|
|
35
|
-
if (key === 'Escape')
|
|
36
|
-
setShowPopover(false);
|
|
37
|
-
};
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
document.addEventListener('keydown', onKeyDown);
|
|
40
|
-
return () => {
|
|
41
|
-
document.removeEventListener('keydown', onKeyDown);
|
|
42
|
-
};
|
|
43
|
-
}, [popoverEl]);
|
|
44
|
-
const headerHeight = containerRef.current?.querySelector('header')?.offsetHeight || 0;
|
|
45
|
-
const selectedStatusOption = statusOptions.find(s => s.id === status);
|
|
46
|
-
return (_jsx(ContactsContext.Provider, { value: {
|
|
47
|
-
contacts: contactsList,
|
|
48
|
-
onFavoriteToggle
|
|
49
|
-
}, children: _jsxs(StyledCallControlPanel, { ref: containerRef, ...restProps, isCollapsed: collapsed, isDraggable: draggable, style: { '--headerHeight': `${headerHeight}px` }, children: [_jsx(CardHeader, { ref: !collapsed && draggable ? dragRef : undefined, actions: _jsxs(_Fragment, { children: [_jsx(Button, { icon: true, variant: 'simple', "aria-label": t('call_panel_make_new_call'), ref: addButtonRef, onClick: () => {
|
|
50
|
-
setShowPopover(true);
|
|
51
|
-
}, children: _jsx(Icon, { name: 'plus' }, void 0) }, 'new-call'), _jsx(Button, { icon: true, variant: 'simple', "aria-label": t(collapsed ? 'call_panel_expand' : 'call_panel_collapse'), onClick: () => {
|
|
52
|
-
resetPopoverToDefaultPosition(containerRef);
|
|
53
|
-
setCollapsed(state => !state);
|
|
54
|
-
}, children: _jsx(Icon, { name: 'caret-down' }, void 0) }, 'expand-collapse')] }, void 0), children: _jsxs(Flex, { container: { alignItems: 'center', itemGap: 1 }, children: [_jsx(Icon, { name: 'phone-solid' }, void 0), _jsx(Text, { variant: 'h3', children: heading }, void 0)] }, void 0) }, void 0), _jsxs(CardContent, { container: { itemGap: 2 }, children: [_jsxs(Flex, { as: StyledStatusRow, container: { alignItems: 'start', itemGap: 1 }, children: [_jsx(UserStatusIcon, { variant: 'dot', status: selectedStatusOption?.status }, void 0), _jsx(Flex, { item: { grow: 1 }, children: _jsx(ComboBox, { label: t('call_panel_agent_status'), labelHidden: true, selected: {
|
|
55
|
-
items: {
|
|
56
|
-
id: status,
|
|
57
|
-
text: selectedStatusOption?.label || ''
|
|
58
|
-
}
|
|
59
|
-
}, menu: {
|
|
60
|
-
items: actionItems,
|
|
61
|
-
onItemClick: id => onStatusChange(id)
|
|
62
|
-
}, info: message }, void 0) }, void 0), _jsx(StopWatch, { startTime: inStatusSince }, void 0)] }, void 0), calls.map(callProps => (_jsx(Call, { ...callProps }, callProps.id)))] }, void 0), showPopover && (_jsx(Popover, { target: addButtonRef.current, ref: setPopoverRef, placement: 'top-end', children: _jsx(CalleePicker, { heading: t('call_panel_new_call_heading'), onClose: () => setShowPopover(false), onCall: phoneNumber => {
|
|
63
|
-
onAddCall(phoneNumber);
|
|
64
|
-
setShowPopover(false);
|
|
65
|
-
} }, void 0) }, void 0))] }, void 0) }, void 0));
|
|
66
|
-
});
|
|
67
|
-
export default CallControlPanel;
|
|
68
|
-
//# sourceMappingURL=CallControlPanel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CallControlPanel.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallControlPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAIV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,UAAU,EACV,WAAW,EACX,MAAM,EACN,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,aAAa,EACb,UAAU,EAE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,WACM,CACX,YACsB,WACA,CAC5B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import {\n CSSProperties,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n RefObject,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\n\nimport {\n CardHeader,\n CardContent,\n Button,\n useI18n,\n Icon,\n registerIcon,\n Flex,\n ComboBox,\n Text,\n Popover,\n useOuterEvent,\n useElement,\n ForwardProps,\n useConsolidatedRef,\n useDraggable\n} from '@pega/cosmos-react-core';\nimport * as caretDownIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-down.icon';\nimport * as phoneSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/phone-solid.icon';\nimport * as plusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/plus.icon';\n\nimport CalleePicker, { ContactsContext } from './CalleePicker';\nimport type { CallControlPanelProps } from './CallControlPanel.types';\nimport Call from './Call';\nimport StopWatch from './StopWatch';\nimport { StyledCallControlPanel, StyledStatusRow } from './CallControlPanel.styles';\nimport { UserStatusIcon } from './CallControlPanelIcon';\n\nregisterIcon(plusIcon, caretDownIcon, phoneSolidIcon);\n\nconst resetPopoverToDefaultPosition = (containerRef: RefObject<HTMLDivElement>): void => {\n if (containerRef && containerRef.current)\n containerRef.current.style.transform = 'translate(0px, 0px)';\n};\n\nconst CallControlPanel: FunctionComponent<CallControlPanelProps & ForwardProps> = forwardRef(\n (\n {\n heading,\n status,\n statusOptions,\n onStatusChange,\n inStatusSince,\n message,\n draggable = false,\n calls,\n onAddCall,\n contactsList,\n onFavoriteToggle,\n ...restProps\n }: PropsWithoutRef<CallControlPanelProps>,\n ref: CallControlPanelProps['ref']\n ) => {\n const t = useI18n();\n const addButtonRef = useRef<HTMLButtonElement>(null);\n const [showPopover, setShowPopover] = useState(false);\n const [collapsed, setCollapsed] = useState(false);\n const containerRef = useConsolidatedRef(ref);\n const [popoverEl, setPopoverRef] = useElement<HTMLElement>();\n const dragRef = useRef<HTMLDivElement>(null);\n useDraggable(containerRef, dragRef);\n\n const actionItems = useMemo(() => {\n return statusOptions.map(({ id, label }) => {\n return { id, primary: label, selected: id === status };\n });\n }, [status, statusOptions]);\n\n useOuterEvent('mousedown', [popoverEl], () => {\n setShowPopover(false);\n });\n\n const onKeyDown = ({ key }: KeyboardEvent) => {\n if (key === 'Escape') setShowPopover(false);\n };\n\n useEffect(() => {\n document.addEventListener('keydown', onKeyDown);\n return () => {\n document.removeEventListener('keydown', onKeyDown);\n };\n }, [popoverEl]);\n\n const headerHeight = containerRef.current?.querySelector('header')?.offsetHeight || 0;\n\n const selectedStatusOption = statusOptions.find(s => s.id === status);\n\n return (\n <ContactsContext.Provider\n value={{\n contacts: contactsList,\n onFavoriteToggle\n }}\n >\n <StyledCallControlPanel\n ref={containerRef}\n {...restProps}\n isCollapsed={collapsed}\n isDraggable={draggable}\n style={{ '--headerHeight': `${headerHeight}px` } as CSSProperties}\n >\n <CardHeader\n ref={!collapsed && draggable ? dragRef : undefined}\n actions={\n <>\n <Button\n icon\n variant='simple'\n key='new-call'\n aria-label={t('call_panel_make_new_call')}\n ref={addButtonRef}\n onClick={() => {\n setShowPopover(true);\n }}\n >\n <Icon name='plus' />\n </Button>\n <Button\n icon\n variant='simple'\n key='expand-collapse'\n aria-label={t(collapsed ? 'call_panel_expand' : 'call_panel_collapse')}\n onClick={() => {\n resetPopoverToDefaultPosition(containerRef);\n setCollapsed(state => !state);\n }}\n >\n <Icon name='caret-down' />\n </Button>\n </>\n }\n >\n <Flex container={{ alignItems: 'center', itemGap: 1 }}>\n <Icon name='phone-solid' />\n <Text variant='h3'>{heading}</Text>\n </Flex>\n </CardHeader>\n <CardContent container={{ itemGap: 2 }}>\n <Flex as={StyledStatusRow} container={{ alignItems: 'start', itemGap: 1 }}>\n <UserStatusIcon variant='dot' status={selectedStatusOption?.status} />\n <Flex item={{ grow: 1 }}>\n <ComboBox\n label={t('call_panel_agent_status')}\n labelHidden\n selected={{\n items: {\n id: status,\n text: selectedStatusOption?.label || ''\n }\n }}\n menu={{\n items: actionItems,\n onItemClick: id => onStatusChange(id)\n }}\n info={message}\n />\n </Flex>\n <StopWatch startTime={inStatusSince} />\n </Flex>\n {calls.map(callProps => (\n <Call key={callProps.id} {...callProps} />\n ))}\n </CardContent>\n {showPopover && (\n <Popover target={addButtonRef.current} ref={setPopoverRef} placement='top-end'>\n <CalleePicker\n heading={t('call_panel_new_call_heading')}\n onClose={() => setShowPopover(false)}\n onCall={phoneNumber => {\n onAddCall(phoneNumber);\n setShowPopover(false);\n }}\n />\n </Popover>\n )}\n </StyledCallControlPanel>\n </ContactsContext.Provider>\n );\n }\n);\n\nexport default CallControlPanel;\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ProgressProps } from '@pega/cosmos-react-core';
|
|
2
|
-
export declare const StyledProgressContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
3
|
-
export declare const StyledHoldInfo: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, import("@pega/cosmos-react-core").StatusProps, never>;
|
|
4
|
-
export declare const StyledStatusRow: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
-
export declare const StyledSLAProgress: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, ProgressProps & {
|
|
6
|
-
determinate: boolean;
|
|
7
|
-
} & {
|
|
8
|
-
slaDuration?: number | undefined;
|
|
9
|
-
slaLevel?: number | undefined;
|
|
10
|
-
}, never>;
|
|
11
|
-
export declare const StyledCallControlPanel: import("styled-components").StyledComponent<"article", import("styled-components").DefaultTheme, Partial<import("@pega/cosmos-react-core").CardProps> & {
|
|
12
|
-
isCollapsed: boolean;
|
|
13
|
-
isDraggable?: boolean | undefined;
|
|
14
|
-
}, never>;
|
|
15
|
-
//# sourceMappingURL=CallControlPanel.styles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CallControlPanel.styles.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallControlPanel.styles.ts"],"names":[],"mappings":"AAEA,OAAO,EAQL,aAAa,EAKd,MAAM,yBAAyB,CAAC;AAMjC,eAAO,MAAM,uBAAuB,yGAoCnC,CAAC;AAIF,eAAO,MAAM,cAAc,qJAI1B,CAAC;AAIF,eAAO,MAAM,eAAe,yGAiB3B,CAAC;AAIF,eAAO,MAAM,iBAAiB;;;;;SAwC5B,CAAC;AAIH,eAAO,MAAM,sBAAsB;iBACpB,OAAO;;SA6BpB,CAAC"}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components';
|
|
2
|
-
import { defaultThemeProp, StyledBackdrop, StyledButton, StyledFlex, StyledProgressBar, StyledSummaryItemActions, StyledVisual, StyledSummaryItem, StyledCard, StyledPrimary, StyledSecondary } from '@pega/cosmos-react-core';
|
|
3
|
-
import { StyledStatus } from '@pega/cosmos-react-core/lib/components/Badges/Status';
|
|
4
|
-
import { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';
|
|
5
|
-
import { StyledStopWatch } from './StopWatch';
|
|
6
|
-
export const StyledProgressContainer = styled.div(({ theme: { base: { spacing }, components: { card } } }) => {
|
|
7
|
-
return css `
|
|
8
|
-
position: relative;
|
|
9
|
-
> ${StyledBackdrop} {
|
|
10
|
-
z-index: 0;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
${StyledSummaryItemActions} ${StyledFlex} + ${StyledButton} {
|
|
14
|
-
margin-inline-start: ${spacing};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
> ${StyledSummaryItem} {
|
|
18
|
-
box-sizing: content-box;
|
|
19
|
-
position: relative;
|
|
20
|
-
height: 2rem;
|
|
21
|
-
padding: 0 1rem;
|
|
22
|
-
border-top: 0;
|
|
23
|
-
> ${StyledVisual} {
|
|
24
|
-
transform: rotate(50deg);
|
|
25
|
-
}
|
|
26
|
-
> ${StyledPrimary}, > ${StyledSecondary} {
|
|
27
|
-
align-self: center;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
> ${StyledSummaryItem} ~ ${StyledSummaryItem} {
|
|
32
|
-
border-top: 0.125rem solid ${card.background};
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
35
|
-
});
|
|
36
|
-
StyledProgressContainer.defaultProps = defaultThemeProp;
|
|
37
|
-
export const StyledHoldInfo = styled(StyledStatus) `
|
|
38
|
-
position: absolute;
|
|
39
|
-
top: 0;
|
|
40
|
-
transform: translateY(-50%);
|
|
41
|
-
`;
|
|
42
|
-
StyledHoldInfo.defaultProps = defaultThemeProp;
|
|
43
|
-
export const StyledStatusRow = styled.div(({ theme: { components: { input: { height } } } }) => {
|
|
44
|
-
return css `
|
|
45
|
-
> * {
|
|
46
|
-
min-height: ${height};
|
|
47
|
-
}
|
|
48
|
-
> ${StyledStopWatch} {
|
|
49
|
-
line-height: ${height};
|
|
50
|
-
}
|
|
51
|
-
`;
|
|
52
|
-
});
|
|
53
|
-
StyledStatusRow.defaultProps = defaultThemeProp;
|
|
54
|
-
export const StyledSLAProgress = styled(StyledProgressBar)(({ theme, slaDuration = 0, slaLevel }) => {
|
|
55
|
-
const { base: { colors } } = theme;
|
|
56
|
-
const { bgColor = colors.red['extra-light'], fgColor = colors.red.light } = slaLevel !== undefined
|
|
57
|
-
? [
|
|
58
|
-
{ bgColor: colors.green['extra-light'], fgColor: colors.green.light },
|
|
59
|
-
{ bgColor: colors.orange['extra-light'], fgColor: colors.orange.light },
|
|
60
|
-
{ bgColor: colors.red['extra-light'], fgColor: colors.red.light }
|
|
61
|
-
][slaLevel]
|
|
62
|
-
: { bgColor: colors.slate.light, fgColor: colors.slate.light };
|
|
63
|
-
return css `
|
|
64
|
-
position: absolute;
|
|
65
|
-
width: 100%;
|
|
66
|
-
height: 100%;
|
|
67
|
-
background-color: ${bgColor};
|
|
68
|
-
border-radius: calc(0.5 * ${theme.base['border-radius']});
|
|
69
|
-
|
|
70
|
-
/* Fancy way to restart the animation by changing it's name. */
|
|
71
|
-
@keyframes FillIn-${slaLevel} {
|
|
72
|
-
0% {
|
|
73
|
-
transform: translateX(-100%);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
100% {
|
|
77
|
-
transform: translateX(0);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
&::before {
|
|
82
|
-
background-color: ${fgColor};
|
|
83
|
-
border-radius: 0;
|
|
84
|
-
animation: FillIn-${slaLevel} ${slaDuration}s linear;
|
|
85
|
-
}
|
|
86
|
-
`;
|
|
87
|
-
});
|
|
88
|
-
StyledSLAProgress.defaultProps = defaultThemeProp;
|
|
89
|
-
export const StyledCallControlPanel = styled(StyledCard)(({ theme, isCollapsed, isDraggable }) => {
|
|
90
|
-
return css `
|
|
91
|
-
position: fixed;
|
|
92
|
-
z-index: ${theme.base['z-index'].modal};
|
|
93
|
-
width: 25rem;
|
|
94
|
-
inset-inline-end: calc(2 * ${theme.base.spacing});
|
|
95
|
-
bottom: calc(2 * ${theme.base.spacing});
|
|
96
|
-
box-shadow: ${theme.base.shadow.high};
|
|
97
|
-
${isCollapsed &&
|
|
98
|
-
css `
|
|
99
|
-
transform: translateY(
|
|
100
|
-
calc(100% - var(--headerHeight) + calc(2 * ${theme.base.spacing}))
|
|
101
|
-
) !important;
|
|
102
|
-
`}
|
|
103
|
-
${StyledCardHeader} {
|
|
104
|
-
${!isCollapsed &&
|
|
105
|
-
isDraggable &&
|
|
106
|
-
css `
|
|
107
|
-
cursor: all-scroll;
|
|
108
|
-
`}
|
|
109
|
-
}
|
|
110
|
-
${StyledCardHeader} ${StyledButton}:last-child {
|
|
111
|
-
transition: transform calc(2 * ${theme.base.animation.speed})
|
|
112
|
-
${theme.base.animation.timing.ease};
|
|
113
|
-
transform: ${isCollapsed ? 'rotate(-180deg)' : 'rotate(0)'};
|
|
114
|
-
}
|
|
115
|
-
`;
|
|
116
|
-
});
|
|
117
|
-
StyledCallControlPanel.defaultProps = defaultThemeProp;
|
|
118
|
-
//# sourceMappingURL=CallControlPanel.styles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CallControlPanel.styles.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallControlPanel.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,wBAAwB,EACxB,YAAY,EAEZ,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,eAAe,EAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,sDAAsD,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAE1F,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAC/C,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,OAAO,EAAE,EACjB,UAAU,EAAE,EAAE,IAAI,EAAE,EACrB,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;;UAEJ,cAAc;;;;QAIhB,wBAAwB,IAAI,UAAU,MAAM,YAAY;+BACjC,OAAO;;;UAG5B,iBAAiB;;;;;;YAMf,YAAY;;;YAGZ,aAAa,OAAO,eAAe;;;;;UAKrC,iBAAiB,MAAM,iBAAiB;qCACb,IAAI,CAAC,UAAU;;KAE/C,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,uBAAuB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAExD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;;;;CAIjD,CAAC;AAEF,cAAc,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE/C,MAA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AAI,CAAC,eAAe,CAAC;;;wBAGnC,QAAQ;;;;;;;;;;;0BAWN,OAAO;;0BAEP,QAAQ,IAAI,WAAW;;GAE9C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,UAAU,CAAC,CAGrD,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE;IACzC,OAAO,GAAG,CAAA;;eAEG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,KAAK;;iCAET,KAAK,CAAC,IAAI,CAAC,OAAO;uBAC5B,KAAK,CAAC,IAAI,CAAC,OAAO;kBACvB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;MAClC,WAAW;QACb,GAAG,CAAA;;qDAE8C,KAAK,CAAC,IAAI,CAAC,OAAO;;KAElE;MACC,gBAAgB;QACd,CAAC,WAAW;QACd,WAAW;QACX,GAAG,CAAA;;OAEF;;MAED,gBAAgB,IAAI,YAAY;uCACC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK;UACvD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI;mBACvB,WAAW,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,WAAW;;GAE7D,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\n\nimport {\n defaultThemeProp,\n StyledBackdrop,\n StyledButton,\n StyledFlex,\n StyledProgressBar,\n StyledSummaryItemActions,\n StyledVisual,\n ProgressProps,\n StyledSummaryItem,\n StyledCard,\n StyledPrimary,\n StyledSecondary\n} from '@pega/cosmos-react-core';\nimport { StyledStatus } from '@pega/cosmos-react-core/lib/components/Badges/Status';\nimport { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\n\nimport { StyledStopWatch } from './StopWatch';\n\nexport const StyledProgressContainer = styled.div(\n ({\n theme: {\n base: { spacing },\n components: { card }\n }\n }) => {\n return css`\n position: relative;\n > ${StyledBackdrop} {\n z-index: 0;\n }\n\n ${StyledSummaryItemActions} ${StyledFlex} + ${StyledButton} {\n margin-inline-start: ${spacing};\n }\n\n > ${StyledSummaryItem} {\n box-sizing: content-box;\n position: relative;\n height: 2rem;\n padding: 0 1rem;\n border-top: 0;\n > ${StyledVisual} {\n transform: rotate(50deg);\n }\n > ${StyledPrimary}, > ${StyledSecondary} {\n align-self: center;\n }\n }\n\n > ${StyledSummaryItem} ~ ${StyledSummaryItem} {\n border-top: 0.125rem solid ${card.background};\n }\n `;\n }\n);\n\nStyledProgressContainer.defaultProps = defaultThemeProp;\n\nexport const StyledHoldInfo = styled(StyledStatus)`\n position: absolute;\n top: 0;\n transform: translateY(-50%);\n`;\n\nStyledHoldInfo.defaultProps = defaultThemeProp;\n\nexport const StyledStatusRow = styled.div(\n ({\n theme: {\n components: {\n input: { height }\n }\n }\n }) => {\n return css`\n > * {\n min-height: ${height};\n }\n > ${StyledStopWatch} {\n line-height: ${height};\n }\n `;\n }\n);\n\nStyledStatusRow.defaultProps = defaultThemeProp;\n\nexport const StyledSLAProgress = styled(StyledProgressBar)<\n ProgressProps & { slaDuration?: number; slaLevel?: number }\n>(({ theme, slaDuration = 0, slaLevel }) => {\n const {\n base: { colors }\n } = theme;\n\n const { bgColor = colors.red['extra-light'], fgColor = colors.red.light } =\n slaLevel !== undefined\n ? [\n { bgColor: colors.green['extra-light'], fgColor: colors.green.light },\n { bgColor: colors.orange['extra-light'], fgColor: colors.orange.light },\n { bgColor: colors.red['extra-light'], fgColor: colors.red.light }\n ][slaLevel]\n : { bgColor: colors.slate.light, fgColor: colors.slate.light };\n\n return css`\n position: absolute;\n width: 100%;\n height: 100%;\n background-color: ${bgColor};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n\n /* Fancy way to restart the animation by changing it's name. */\n @keyframes FillIn-${slaLevel} {\n 0% {\n transform: translateX(-100%);\n }\n\n 100% {\n transform: translateX(0);\n }\n }\n\n &::before {\n background-color: ${fgColor};\n border-radius: 0;\n animation: FillIn-${slaLevel} ${slaDuration}s linear;\n }\n `;\n});\n\nStyledSLAProgress.defaultProps = defaultThemeProp;\n\nexport const StyledCallControlPanel = styled(StyledCard)<{\n isCollapsed: boolean;\n isDraggable?: boolean;\n}>(({ theme, isCollapsed, isDraggable }) => {\n return css`\n position: fixed;\n z-index: ${theme.base['z-index'].modal};\n width: 25rem;\n inset-inline-end: calc(2 * ${theme.base.spacing});\n bottom: calc(2 * ${theme.base.spacing});\n box-shadow: ${theme.base.shadow.high};\n ${isCollapsed &&\n css`\n transform: translateY(\n calc(100% - var(--headerHeight) + calc(2 * ${theme.base.spacing}))\n ) !important;\n `}\n ${StyledCardHeader} {\n ${!isCollapsed &&\n isDraggable &&\n css`\n cursor: all-scroll;\n `}\n }\n ${StyledCardHeader} ${StyledButton}:last-child {\n transition: transform calc(2 * ${theme.base.animation.speed})\n ${theme.base.animation.timing.ease};\n transform: ${isCollapsed ? 'rotate(-180deg)' : 'rotate(0)'};\n }\n `;\n});\n\nStyledCallControlPanel.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { ReactNode, Ref } from 'react';
|
|
2
|
-
import { BaseProps, NoChildrenProp } from '@pega/cosmos-react-core';
|
|
3
|
-
export declare type Contact = {
|
|
4
|
-
/** Contact phone number */
|
|
5
|
-
phoneNumber: string;
|
|
6
|
-
/** Contact name */
|
|
7
|
-
primary: string;
|
|
8
|
-
/** Additional contact information */
|
|
9
|
-
secondary: string;
|
|
10
|
-
/** Determines if contact is favorite */
|
|
11
|
-
favorite: boolean;
|
|
12
|
-
};
|
|
13
|
-
export interface CallParticipant {
|
|
14
|
-
/** Caller id. */
|
|
15
|
-
id: string;
|
|
16
|
-
/** Caller's name. */
|
|
17
|
-
name: string;
|
|
18
|
-
/** Additional caller's info. */
|
|
19
|
-
info?: string;
|
|
20
|
-
/** Callback fired when the user ends the call. */
|
|
21
|
-
onEndCall?: (id: CallProps['id'], participantId: CallParticipant['id']) => void;
|
|
22
|
-
}
|
|
23
|
-
export interface TransferReasonOption {
|
|
24
|
-
readonly id: string;
|
|
25
|
-
readonly label: string;
|
|
26
|
-
}
|
|
27
|
-
export declare type TransferData = {
|
|
28
|
-
reason: TransferReasonOption['id'];
|
|
29
|
-
comments: string;
|
|
30
|
-
interaction: boolean;
|
|
31
|
-
phoneNumber: string;
|
|
32
|
-
};
|
|
33
|
-
export interface CallProps {
|
|
34
|
-
/** Call identifier. */
|
|
35
|
-
id: string;
|
|
36
|
-
/** Timestamp when the call has begun. */
|
|
37
|
-
startedAt: number | Date;
|
|
38
|
-
/** Timestamp when the call has been put on hold. */
|
|
39
|
-
onHoldSince?: number | Date;
|
|
40
|
-
/** SLA configuration timeups. Array of numbers of seconds after which the particular SLA level
|
|
41
|
-
* time is up.
|
|
42
|
-
*/
|
|
43
|
-
slaConfig?: number[];
|
|
44
|
-
/** Call participants. */
|
|
45
|
-
participants: CallParticipant[];
|
|
46
|
-
/** The flag whether the mic is muted on this call. */
|
|
47
|
-
muted?: boolean;
|
|
48
|
-
/** Callback fired when 'pause' icon has been clicked. */
|
|
49
|
-
onPauseToggle: (id: CallProps['id']) => void;
|
|
50
|
-
/** Callback fired when 'mute' icon has been clicked. */
|
|
51
|
-
onMuteToggle: (id: CallProps['id']) => void;
|
|
52
|
-
/** Callback fired when 'Consult' action has been clicked. */
|
|
53
|
-
onConsultAction?: (id: CallProps['id'], phoneNumber: string) => void;
|
|
54
|
-
/** Callback fired when 'Conference' action has been clicked. */
|
|
55
|
-
onConferenceAction?: (id: CallProps['id'], phoneNumber: string) => void;
|
|
56
|
-
/** Callback fired when 'Merge call' action has been chosen. */
|
|
57
|
-
onMergeCall?: (id: CallProps['id']) => void;
|
|
58
|
-
/** Callback fired for every dial pad key press. */
|
|
59
|
-
onDTMFPress?: (id: CallProps['id'], key: string) => void;
|
|
60
|
-
/** Callback fired when 'Transfer' action has been clicked. */
|
|
61
|
-
onTransferAction?: (id: CallProps['id'], transferData: TransferData) => void;
|
|
62
|
-
/**
|
|
63
|
-
* Transfer reason options
|
|
64
|
-
*/
|
|
65
|
-
transferOptions: Readonly<TransferReasonOption[]>;
|
|
66
|
-
}
|
|
67
|
-
export declare type UserAvailabilityStatus = 'offline' | 'available' | 'busy' | 'away' | 'not_available';
|
|
68
|
-
export interface UserAvailabilityStatusOption {
|
|
69
|
-
readonly id: string;
|
|
70
|
-
readonly label: string;
|
|
71
|
-
readonly status: UserAvailabilityStatus;
|
|
72
|
-
}
|
|
73
|
-
export interface CallControlPanelProps extends BaseProps, NoChildrenProp {
|
|
74
|
-
/** The heading rendered. */
|
|
75
|
-
heading: string;
|
|
76
|
-
/**
|
|
77
|
-
* User availability statuses.
|
|
78
|
-
*/
|
|
79
|
-
statusOptions: Readonly<UserAvailabilityStatusOption[]>;
|
|
80
|
-
/** User current status. */
|
|
81
|
-
status: UserAvailabilityStatusOption['id'];
|
|
82
|
-
/** Timestamp since the user is in the current status. */
|
|
83
|
-
inStatusSince: number | Date;
|
|
84
|
-
/** If true, the component will be draggable */
|
|
85
|
-
draggable?: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Region for messages: errors, notifications, etc.
|
|
88
|
-
*/
|
|
89
|
-
message?: ReactNode;
|
|
90
|
-
/**
|
|
91
|
-
* Callback fired when user changes their status.
|
|
92
|
-
* @param value new chosen status.
|
|
93
|
-
*/
|
|
94
|
-
onStatusChange: (value: UserAvailabilityStatusOption['id']) => void;
|
|
95
|
-
/**
|
|
96
|
-
* List of current calls. Having two or more not declared as "on hold" (onHoldSince defined) means there's
|
|
97
|
-
* a conference call.
|
|
98
|
-
*/
|
|
99
|
-
calls: CallProps[];
|
|
100
|
-
/**
|
|
101
|
-
* Callback fired on new call made by the user.
|
|
102
|
-
* @param phoneNumber the number chosen.
|
|
103
|
-
*/
|
|
104
|
-
onAddCall: (phoneNumber: string) => void;
|
|
105
|
-
/** An array of contacts objects. */
|
|
106
|
-
contactsList: Contact[];
|
|
107
|
-
/** Callback fired on adding/removing contact to/from favorites */
|
|
108
|
-
onFavoriteToggle: (phoneNumber: string, favorite: boolean) => void;
|
|
109
|
-
/** Reference to the root component. */
|
|
110
|
-
ref?: Ref<HTMLDivElement>;
|
|
111
|
-
}
|
|
112
|
-
//# sourceMappingURL=CallControlPanel.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CallControlPanel.types.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallControlPanel.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEpE,oBAAY,OAAO,GAAG;IACpB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,iBAAiB;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;CACjF;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,oBAAY,YAA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