@pega/cosmos-react-cs 2.0.0-dev.9.4 → 2.0.0-rc.4

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.
Files changed (153) hide show
  1. package/lib/components/Article/Article.d.ts +2 -2
  2. package/lib/components/Article/Article.d.ts.map +1 -1
  3. package/lib/components/Article/Article.js +2 -10
  4. package/lib/components/Article/Article.js.map +1 -1
  5. package/lib/components/Article/ArticleFooter.d.ts.map +1 -1
  6. package/lib/components/Article/ArticleFooter.js +3 -4
  7. package/lib/components/Article/ArticleFooter.js.map +1 -1
  8. package/lib/components/Article/ArticleSkeleton.js +4 -4
  9. package/lib/components/Article/ArticleSkeleton.js.map +1 -1
  10. package/lib/components/ArticleList/ArticleList.d.ts.map +1 -1
  11. package/lib/components/ArticleList/ArticleList.js +2 -5
  12. package/lib/components/ArticleList/ArticleList.js.map +1 -1
  13. package/lib/components/ArticleList/ArticleListHeader.js +3 -8
  14. package/lib/components/ArticleList/ArticleListHeader.js.map +1 -1
  15. package/lib/components/ArticleList/ArticleSummary.js +1 -3
  16. package/lib/components/ArticleList/ArticleSummary.js.map +1 -1
  17. package/lib/components/ArticleList/SummarySkeleton.js +2 -7
  18. package/lib/components/ArticleList/SummarySkeleton.js.map +1 -1
  19. package/lib/components/CSCaseView/CSCaseView.js +1 -2
  20. package/lib/components/CSCaseView/CSCaseView.js.map +1 -1
  21. package/lib/components/CallControlPanel/Call.d.ts +6 -0
  22. package/lib/components/CallControlPanel/Call.d.ts.map +1 -0
  23. package/lib/components/CallControlPanel/Call.js +142 -0
  24. package/lib/components/CallControlPanel/Call.js.map +1 -0
  25. package/lib/components/CallControlPanel/CallControlPanel.d.ts +6 -0
  26. package/lib/components/CallControlPanel/CallControlPanel.d.ts.map +1 -0
  27. package/lib/components/CallControlPanel/CallControlPanel.js +68 -0
  28. package/lib/components/CallControlPanel/CallControlPanel.js.map +1 -0
  29. package/lib/components/CallControlPanel/CallControlPanel.styles.d.ts +15 -0
  30. package/lib/components/CallControlPanel/CallControlPanel.styles.d.ts.map +1 -0
  31. package/lib/components/CallControlPanel/CallControlPanel.styles.js +118 -0
  32. package/lib/components/CallControlPanel/CallControlPanel.styles.js.map +1 -0
  33. package/lib/components/CallControlPanel/CallControlPanel.types.d.ts +112 -0
  34. package/lib/components/CallControlPanel/CallControlPanel.types.d.ts.map +1 -0
  35. package/lib/components/CallControlPanel/CallControlPanel.types.js +2 -0
  36. package/lib/components/CallControlPanel/CallControlPanel.types.js.map +1 -0
  37. package/lib/components/CallControlPanel/CallControlPanelIcon.d.ts +19 -0
  38. package/lib/components/CallControlPanel/CallControlPanelIcon.d.ts.map +1 -0
  39. package/lib/components/CallControlPanel/CallControlPanelIcon.js +74 -0
  40. package/lib/components/CallControlPanel/CallControlPanelIcon.js.map +1 -0
  41. package/lib/components/CallControlPanel/CallTransfer.d.ts +19 -0
  42. package/lib/components/CallControlPanel/CallTransfer.d.ts.map +1 -0
  43. package/lib/components/CallControlPanel/CallTransfer.js +121 -0
  44. package/lib/components/CallControlPanel/CallTransfer.js.map +1 -0
  45. package/lib/components/CallControlPanel/CalleePicker.d.ts +20 -0
  46. package/lib/components/CallControlPanel/CalleePicker.d.ts.map +1 -0
  47. package/lib/components/CallControlPanel/CalleePicker.js +61 -0
  48. package/lib/components/CallControlPanel/CalleePicker.js.map +1 -0
  49. package/lib/components/CallControlPanel/ContactsList.d.ts +23 -0
  50. package/lib/components/CallControlPanel/ContactsList.d.ts.map +1 -0
  51. package/lib/components/CallControlPanel/ContactsList.js +88 -0
  52. package/lib/components/CallControlPanel/ContactsList.js.map +1 -0
  53. package/lib/components/CallControlPanel/DTMFKeypad.d.ts +11 -0
  54. package/lib/components/CallControlPanel/DTMFKeypad.d.ts.map +1 -0
  55. package/lib/components/CallControlPanel/DTMFKeypad.js +23 -0
  56. package/lib/components/CallControlPanel/DTMFKeypad.js.map +1 -0
  57. package/lib/components/CallControlPanel/StopWatch.d.ts +9 -0
  58. package/lib/components/CallControlPanel/StopWatch.d.ts.map +1 -0
  59. package/lib/components/CallControlPanel/StopWatch.js +28 -0
  60. package/lib/components/CallControlPanel/StopWatch.js.map +1 -0
  61. package/lib/components/CallControlPanel/index.d.ts +5 -0
  62. package/lib/components/CallControlPanel/index.d.ts.map +1 -0
  63. package/lib/components/CallControlPanel/index.js +4 -0
  64. package/lib/components/CallControlPanel/index.js.map +1 -0
  65. package/lib/components/CallControlPanel/utils.d.ts +7 -0
  66. package/lib/components/CallControlPanel/utils.d.ts.map +1 -0
  67. package/lib/components/CallControlPanel/utils.js +35 -0
  68. package/lib/components/CallControlPanel/utils.js.map +1 -0
  69. package/lib/components/DialPad/DialPad.d.ts +16 -0
  70. package/lib/components/DialPad/DialPad.d.ts.map +1 -0
  71. package/lib/components/DialPad/DialPad.js +33 -0
  72. package/lib/components/DialPad/DialPad.js.map +1 -0
  73. package/lib/components/DialPad/DialPad.types.d.ts +33 -0
  74. package/lib/components/DialPad/DialPad.types.d.ts.map +1 -0
  75. package/lib/components/DialPad/DialPad.types.js +2 -0
  76. package/lib/components/DialPad/DialPad.types.js.map +1 -0
  77. package/lib/components/DialPad/DialPadKeyboard.d.ts +12 -0
  78. package/lib/components/DialPad/DialPadKeyboard.d.ts.map +1 -0
  79. package/lib/components/DialPad/DialPadKeyboard.js +87 -0
  80. package/lib/components/DialPad/DialPadKeyboard.js.map +1 -0
  81. package/lib/components/DialPad/DialPadKeyboard.styles.d.ts +5 -0
  82. package/lib/components/DialPad/DialPadKeyboard.styles.d.ts.map +1 -0
  83. package/lib/components/DialPad/DialPadKeyboard.styles.js +76 -0
  84. package/lib/components/DialPad/DialPadKeyboard.styles.js.map +1 -0
  85. package/lib/components/DialPad/KeyboardNavigation.d.ts +6 -0
  86. package/lib/components/DialPad/KeyboardNavigation.d.ts.map +1 -0
  87. package/lib/components/DialPad/KeyboardNavigation.js +156 -0
  88. package/lib/components/DialPad/KeyboardNavigation.js.map +1 -0
  89. package/lib/components/DialPad/index.d.ts +3 -0
  90. package/lib/components/DialPad/index.d.ts.map +1 -0
  91. package/lib/components/DialPad/index.js +2 -0
  92. package/lib/components/DialPad/index.js.map +1 -0
  93. package/lib/components/DialPad/utils.d.ts +4 -0
  94. package/lib/components/DialPad/utils.d.ts.map +1 -0
  95. package/lib/components/DialPad/utils.js +7 -0
  96. package/lib/components/DialPad/utils.js.map +1 -0
  97. package/lib/components/IntelligentGuidance/IntelligentGuidance.d.ts.map +1 -1
  98. package/lib/components/IntelligentGuidance/IntelligentGuidance.js +19 -15
  99. package/lib/components/IntelligentGuidance/IntelligentGuidance.js.map +1 -1
  100. package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts +1 -0
  101. package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.d.ts.map +1 -1
  102. package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js +2 -2
  103. package/lib/components/IntelligentGuidance/IntelligentGuidance.styles.js.map +1 -1
  104. package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts +2 -2
  105. package/lib/components/IntelligentGuidance/IntelligentGuidance.types.d.ts.map +1 -1
  106. package/lib/components/IntelligentGuidance/IntelligentGuidance.types.js.map +1 -1
  107. package/lib/components/InteractionNotification/InteractionNotification.d.ts +2 -2
  108. package/lib/components/InteractionNotification/InteractionNotification.d.ts.map +1 -1
  109. package/lib/components/InteractionNotification/InteractionNotification.js +2 -6
  110. package/lib/components/InteractionNotification/InteractionNotification.js.map +1 -1
  111. package/lib/components/InteractionTimer/InteractionTimer.d.ts +4 -6
  112. package/lib/components/InteractionTimer/InteractionTimer.d.ts.map +1 -1
  113. package/lib/components/InteractionTimer/InteractionTimer.js +11 -8
  114. package/lib/components/InteractionTimer/InteractionTimer.js.map +1 -1
  115. package/lib/components/InteractionTimer/index.d.ts +1 -1
  116. package/lib/components/InteractionTimer/index.d.ts.map +1 -1
  117. package/lib/components/InteractionTimer/index.js.map +1 -1
  118. package/lib/components/TaskManager/Picker/Picker.d.ts.map +1 -1
  119. package/lib/components/TaskManager/Picker/Picker.js +136 -43
  120. package/lib/components/TaskManager/Picker/Picker.js.map +1 -1
  121. package/lib/components/TaskManager/Picker/Picker.types.d.ts +11 -2
  122. package/lib/components/TaskManager/Picker/Picker.types.d.ts.map +1 -1
  123. package/lib/components/TaskManager/Picker/Picker.types.js.map +1 -1
  124. package/lib/components/TaskManager/TaskManager.context.d.ts +1 -0
  125. package/lib/components/TaskManager/TaskManager.context.d.ts.map +1 -1
  126. package/lib/components/TaskManager/TaskManager.d.ts.map +1 -1
  127. package/lib/components/TaskManager/TaskManager.js +49 -63
  128. package/lib/components/TaskManager/TaskManager.js.map +1 -1
  129. package/lib/components/TaskManager/TaskManager.styles.d.ts +15 -20
  130. package/lib/components/TaskManager/TaskManager.styles.d.ts.map +1 -1
  131. package/lib/components/TaskManager/TaskManager.styles.js +173 -166
  132. package/lib/components/TaskManager/TaskManager.styles.js.map +1 -1
  133. package/lib/components/TaskManager/TaskManager.types.d.ts +14 -8
  134. package/lib/components/TaskManager/TaskManager.types.d.ts.map +1 -1
  135. package/lib/components/TaskManager/TaskManager.types.js.map +1 -1
  136. package/lib/components/TaskManager/TaskManagerTabs.d.ts +6 -0
  137. package/lib/components/TaskManager/TaskManagerTabs.d.ts.map +1 -0
  138. package/lib/components/TaskManager/TaskManagerTabs.js +159 -0
  139. package/lib/components/TaskManager/TaskManagerTabs.js.map +1 -0
  140. package/lib/components/TaskManager/TaskView.js +1 -3
  141. package/lib/components/TaskManager/TaskView.js.map +1 -1
  142. package/lib/components/TaskManager/index.d.ts +1 -1
  143. package/lib/components/TaskManager/index.d.ts.map +1 -1
  144. package/lib/components/TaskManager/index.js.map +1 -1
  145. package/lib/index.d.ts +5 -0
  146. package/lib/index.d.ts.map +1 -1
  147. package/lib/index.js +5 -0
  148. package/lib/index.js.map +1 -1
  149. package/package.json +12 -12
  150. package/lib/components/TaskManager/TaskDrawer.d.ts +0 -6
  151. package/lib/components/TaskManager/TaskDrawer.d.ts.map +0 -1
  152. package/lib/components/TaskManager/TaskDrawer.js +0 -78
  153. package/lib/components/TaskManager/TaskDrawer.js.map +0 -1
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,68 @@
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
@@ -0,0 +1 @@
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,EAEV,kBAAkB,EAClB,YAAY,EACb,MAAM,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;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"]}
@@ -0,0 +1,15 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,118 @@
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
@@ -0,0 +1 @@
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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ProgressBar,\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"]}
@@ -0,0 +1,112 @@
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
@@ -0,0 +1 @@
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,MA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AyD;IACzD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,+CAA+C;IAC/C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,cAAc,EAAE,CAAC,KAAK,EAAE,4BAA4B,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IACpE;;;OAGG;IACH,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB;;;OAGG;IACH,SAAS,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,oCAAoC;IACpC,YAAY,EAAE,OAAO,EAAE,CAAC;IACxB,kEAAkE;IAClE,gBAAgB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACnE,uCAAuC;IACvC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=CallControlPanel.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CallControlPanel.types.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallControlPanel.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ReactNode, Ref } from 'react';\n\nimport { BaseProps, NoChildrenProp } from '@pega/cosmos-react-core';\n\nexport type Contact = {\n /** Contact phone number */\n phoneNumber: string;\n /** Contact name */\n primary: string;\n /** Additional contact information */\n secondary: string;\n /** Determines if contact is favorite */\n favorite: boolean;\n};\n\nexport interface CallParticipant {\n /** Caller id. */\n id: string;\n /** Caller's name. */\n name: string;\n /** Additional caller's info. */\n info?: string;\n /** Callback fired when the user ends the call. */\n onEndCall?: (id: CallProps['id'], participantId: CallParticipant['id']) => void;\n}\n\nexport interface TransferReasonOption {\n readonly id: string;\n readonly label: string;\n}\n\nexport type TransferData = {\n reason: TransferReasonOption['id'];\n comments: string;\n interaction: boolean;\n phoneNumber: string;\n};\n\nexport interface CallProps {\n /** Call identifier. */\n id: string;\n /** Timestamp when the call has begun. */\n startedAt: number | Date;\n /** Timestamp when the call has been put on hold. */\n onHoldSince?: number | Date;\n /** SLA configuration timeups. Array of numbers of seconds after which the particular SLA level\n * time is up.\n */\n slaConfig?: number[];\n /** Call participants. */\n participants: CallParticipant[];\n /** The flag whether the mic is muted on this call. */\n muted?: boolean;\n /** Callback fired when 'pause' icon has been clicked. */\n onPauseToggle: (id: CallProps['id']) => void;\n /** Callback fired when 'mute' icon has been clicked. */\n onMuteToggle: (id: CallProps['id']) => void;\n /** Callback fired when 'Consult' action has been clicked. */\n onConsultAction?: (id: CallProps['id'], phoneNumber: string) => void;\n /** Callback fired when 'Conference' action has been clicked. */\n onConferenceAction?: (id: CallProps['id'], phoneNumber: string) => void;\n /** Callback fired when 'Merge call' action has been chosen. */\n onMergeCall?: (id: CallProps['id']) => void;\n /** Callback fired for every dial pad key press. */\n onDTMFPress?: (id: CallProps['id'], key: string) => void;\n /** Callback fired when 'Transfer' action has been clicked. */\n onTransferAction?: (id: CallProps['id'], transferData: TransferData) => void;\n /**\n * Transfer reason options\n */\n transferOptions: Readonly<TransferReasonOption[]>;\n}\n\nexport type UserAvailabilityStatus = 'offline' | 'available' | 'busy' | 'away' | 'not_available';\n\nexport interface UserAvailabilityStatusOption {\n readonly id: string;\n readonly label: string;\n readonly status: UserAvailabilityStatus;\n}\n\nexport interface CallControlPanelProps extends BaseProps, NoChildrenProp {\n /** The heading rendered. */\n heading: string;\n /**\n * User availability statuses.\n */\n statusOptions: Readonly<UserAvailabilityStatusOption[]>;\n /** User current status. */\n status: UserAvailabilityStatusOption['id'];\n /** Timestamp since the user is in the current status. */\n inStatusSince: number | Date;\n /** If true, the component will be draggable */\n draggable?: boolean;\n /**\n * Region for messages: errors, notifications, etc.\n */\n message?: ReactNode;\n /**\n * Callback fired when user changes their status.\n * @param value new chosen status.\n */\n onStatusChange: (value: UserAvailabilityStatusOption['id']) => void;\n /**\n * List of current calls. Having two or more not declared as \"on hold\" (onHoldSince defined) means there's\n * a conference call.\n */\n calls: CallProps[];\n /**\n * Callback fired on new call made by the user.\n * @param phoneNumber the number chosen.\n */\n onAddCall: (phoneNumber: string) => void;\n /** An array of contacts objects. */\n contactsList: Contact[];\n /** Callback fired on adding/removing contact to/from favorites */\n onFavoriteToggle: (phoneNumber: string, favorite: boolean) => void;\n /** Reference to the root component. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
@@ -0,0 +1,19 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { DefaultTheme } from 'styled-components';
3
+ import { ForwardProps, NoChildrenProp } from '@pega/cosmos-react-core';
4
+ import type { UserAvailabilityStatus } from './CallControlPanel.types';
5
+ interface CallControlPanelIconProps extends NoChildrenProp {
6
+ status?: UserAvailabilityStatus;
7
+ label: string;
8
+ panelVisible: boolean;
9
+ }
10
+ interface UserStatusIconProps extends Pick<CallControlPanelIconProps, 'status'> {
11
+ variant: 'icon' | 'dot';
12
+ }
13
+ export declare const StyledCallControlPanelIcon: import("styled-components").StyledComponent<"div", DefaultTheme, {
14
+ userStatus: UserAvailabilityStatus;
15
+ }, never>;
16
+ export declare const UserStatusIcon: FunctionComponent<UserStatusIconProps>;
17
+ declare const CallControlPanelIcon: FunctionComponent<CallControlPanelIconProps & ForwardProps>;
18
+ export default CallControlPanelIcon;
19
+ //# sourceMappingURL=CallControlPanelIcon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CallControlPanelIcon.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallControlPanelIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAQ,MAAM,OAAO,CAAC;AAChD,OAAe,EAAO,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EAEL,YAAY,EAGZ,cAAc,EAKf,MAAM,yBAAyB,CAAC;AAKjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAOvE,UAAU,yBAA0B,SAAQ,cAAc;IACxD,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,mBAAoB,SAAQ,IAAI,CAAC,yBAAyB,EAAE,QAAQ,CAAC;IAC7E,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;CACzB;AA2DD,eAAO,MAAM,0BAA0B;gBAzCW,sBAAsB;SAmDvE,CAAC;AAIF,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,CA6BjE,CAAC;AAEF,QAAA,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,yBAAyB,GAAG,YAAY,CAkBrF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import styled, { css } from 'styled-components';
4
+ import { readableColor } from 'polished';
5
+ import { defaultThemeProp, Icon, registerIcon, StyledAvatar, StyledIcon, useTheme } from '@pega/cosmos-react-core';
6
+ import * as headsetIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/headset.icon';
7
+ import * as eyeOffSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/eye-off-solid.icon';
8
+ registerIcon(headsetIcon, eyeOffSolidIcon);
9
+ const colorMapping = {
10
+ offline: 'slate-light',
11
+ available: 'green-light',
12
+ busy: 'red-medium',
13
+ away: 'orange-light',
14
+ not_available: 'slate-light'
15
+ };
16
+ const iconMapping = {
17
+ offline: 'times',
18
+ available: undefined,
19
+ busy: 'minus',
20
+ away: 'clock',
21
+ not_available: 'reset'
22
+ };
23
+ const StyledStatusIcon = styled.div(({ theme: { base: { colors } }, userStatus }) => {
24
+ const [colorName, colorVariant] = colorMapping[userStatus].split('-', 2);
25
+ const bgColor = colors[colorName][colorVariant];
26
+ const fgColor = readableColor(bgColor);
27
+ return css `
28
+ background-color: ${bgColor};
29
+ color: ${fgColor};
30
+ `;
31
+ });
32
+ StyledStatusIcon.defaultProps = defaultThemeProp;
33
+ const StyledUserStatusIcon = styled(StyledStatusIcon) `
34
+ position: absolute;
35
+ inset-block-start: -0.25rem;
36
+ inset-inline-end: -0.25rem;
37
+ z-index: 1;
38
+ width: 0.875rem;
39
+ height: 0.875rem;
40
+ border-radius: 50%;
41
+ border: 0.0625rem solid black;
42
+
43
+ ${StyledIcon} {
44
+ display: block;
45
+ width: 100%;
46
+ margin: 0 auto;
47
+ }
48
+ `;
49
+ StyledUserStatusIcon.defaultProps = defaultThemeProp;
50
+ export const StyledCallControlPanelIcon = styled(StyledStatusIcon) `
51
+ > ${StyledIcon}:nth-child(3) {
52
+ position: absolute;
53
+ inset-block-end: -0.25rem;
54
+ inset-inline-end: -0.25rem;
55
+ z-index: 1;
56
+ width: 0.875rem;
57
+ height: 0.875rem;
58
+ fill: ${p => p.theme.base.colors.gray.medium};
59
+ }
60
+ `;
61
+ StyledCallControlPanelIcon.defaultProps = defaultThemeProp;
62
+ export const UserStatusIcon = memo(({ status = 'offline', variant }) => {
63
+ const { base: { colors } } = useTheme();
64
+ const [colorName, colorVariant] = colorMapping[status].split('-', 2);
65
+ const bgColor = colors[colorName][colorVariant];
66
+ const iconName = iconMapping[status];
67
+ return variant === 'dot' ? (_jsx("svg", { role: 'img', "aria-hidden": true, height: '1rem', width: '1rem', viewBox: '0 0 10 10', xmlns: 'http://www.w3.org/2000/svg', children: _jsx("circle", { cx: '50%', cy: '50%', r: '50%', fill: bgColor }, void 0) }, void 0)) : (_jsx(StyledStatusIcon, { as: StyledUserStatusIcon, userStatus: status, children: iconName && _jsx(Icon, { name: iconName }, void 0) }, void 0));
68
+ });
69
+ const CallControlPanelIcon = memo(({ status = 'offline', label, panelVisible, ...restProps }) => {
70
+ const iconName = iconMapping[status];
71
+ return (_jsxs(StyledCallControlPanelIcon, { as: StyledAvatar, ...restProps, size: 'm', userStatus: status, "aria-label": label, children: [_jsx(Icon, { name: 'headset' }, void 0), iconName && _jsx(UserStatusIcon, { variant: 'icon', status: status }, void 0), !panelVisible && _jsx(Icon, { name: 'eye-off-solid' }, void 0)] }, void 0));
72
+ });
73
+ export default CallControlPanelIcon;
74
+ //# sourceMappingURL=CallControlPanelIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CallControlPanelIcon.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallControlPanelIcon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,IAAI,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAgB,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,gBAAgB,EAEhB,IAAI,EACJ,YAAY,EAGZ,YAAY,EACZ,UAAU,EACV,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,WAAW,MAAM,gEAAgE,CAAC;AAC9F,OAAO,KAAK,eAAe,MAAM,sEAAsE,CAAC;AAIxG,YAAY,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;AAe3C,MAAM,YAAY,GAAyE;IACzF,OAAO,EAAE,aAAa;IACtB,SAAS,EAAE,aAAa;IACxB,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,cAAc;IACpB,aAAa,EAAE,aAAa;CAC7B,CAAC;AAEF,MAAM,WAAW,GAA0D;IACzE,OAAO,EAAE,OAAO;IAChB,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,aAAa,EAAE,OAAO;CACvB,CAAC;AAEF,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CACjC,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,MAAM,EAAE,EACjB,EACD,UAAU,EACX,EAAE,EAAE;IACH,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,YAAY,CAAC,UAA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MAAM,EAAC,MAAM,EACb,KAAK,EAAC,MAAM,EACZ,OAAO,EAAC,WAAW,EACnB,KAAK,EAAC,4BAA4B,YAElC,iBAAQ,EAAE,EAAC,KAAK,EAAC,EAAE,EAAC,KAAK,EAAC,CAAC,EAAC,KAAK,EAAC,IAAI,EAAE,OAAO,WAAI,WAC/C,CACP,CAAC,CAAC,CAAC,CACF,KAAC,gBAAgB,IAAC,EAAE,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,YAC3D,QAAQ,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,QAAQ,WAAI,WACpB,CACpB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,oBAAoB,GAAgE,IAAI,CAC5F,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,SAAS,EAAE,EAAE,EAAE;IAC5D,MAAM,QAAQ,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IAErC,OAAO,CACL,MAAC,0BAA0B,IACzB,EAAE,EAAE,YAAY,KACZ,SAAS,EACb,IAAI,EAAC,GAAG,EACR,UAAU,EAAE,MAAM,gBACN,KAAK,aAEjB,KAAC,IAAI,IAAC,IAAI,EAAC,SAAS,WAAG,EACtB,QAAQ,IAAI,KAAC,cAAc,IAAC,OAAO,EAAC,MAAM,EAAC,MAAM,EAAE,MAAM,WAAI,EAC7D,CAAC,YAAY,IAAI,KAAC,IAAI,IAAC,IAAI,EAAC,eAAe,WAAG,YACpB,CAC9B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,oBAAoB,CAAC","sourcesContent":["import { FunctionComponent, memo } from 'react';\nimport styled, { css, DefaultTheme } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport {\n defaultThemeProp,\n ForwardProps,\n Icon,\n registerIcon,\n NoChildrenProp,\n OmitStrict,\n StyledAvatar,\n StyledIcon,\n useTheme\n} from '@pega/cosmos-react-core';\nimport { IconNames } from '@pega/cosmos-react-core/lib/components/Icon/iconNames';\nimport * as headsetIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/headset.icon';\nimport * as eyeOffSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/eye-off-solid.icon';\n\nimport type { UserAvailabilityStatus } from './CallControlPanel.types';\n\nregisterIcon(headsetIcon, eyeOffSolidIcon);\n\ntype ThemeColor = keyof OmitStrict<DefaultTheme['base']['colors'], 'white' | 'black'>;\ntype ThemeColorVariant = 'extra-light' | 'light' | 'medium' | 'dark' | 'extra-dark';\n\ninterface CallControlPanelIconProps extends NoChildrenProp {\n status?: UserAvailabilityStatus;\n label: string;\n panelVisible: boolean;\n}\n\ninterface UserStatusIconProps extends Pick<CallControlPanelIconProps, 'status'> {\n variant: 'icon' | 'dot';\n}\n\nconst colorMapping: Record<UserAvailabilityStatus, `${ThemeColor}-${ThemeColorVariant}`> = {\n offline: 'slate-light',\n available: 'green-light',\n busy: 'red-medium',\n away: 'orange-light',\n not_available: 'slate-light'\n};\n\nconst iconMapping: Record<UserAvailabilityStatus, IconNames | undefined> = {\n offline: 'times',\n available: undefined,\n busy: 'minus',\n away: 'clock',\n not_available: 'reset'\n};\n\nconst StyledStatusIcon = styled.div<{ userStatus: UserAvailabilityStatus }>(\n ({\n theme: {\n base: { colors }\n },\n userStatus\n }) => {\n const [colorName, colorVariant] = colorMapping[userStatus].split('-', 2) as [\n ThemeColor,\n ThemeColorVariant\n ];\n const bgColor = colors[colorName][colorVariant];\n const fgColor = readableColor(bgColor);\n return css`\n background-color: ${bgColor};\n color: ${fgColor};\n `;\n }\n);\n\nStyledStatusIcon.defaultProps = defaultThemeProp;\n\nconst StyledUserStatusIcon = styled(StyledStatusIcon)`\n position: absolute;\n inset-block-start: -0.25rem;\n inset-inline-end: -0.25rem;\n z-index: 1;\n width: 0.875rem;\n height: 0.875rem;\n border-radius: 50%;\n border: 0.0625rem solid black;\n\n ${StyledIcon} {\n display: block;\n width: 100%;\n margin: 0 auto;\n }\n`;\n\nStyledUserStatusIcon.defaultProps = defaultThemeProp;\n\nexport const StyledCallControlPanelIcon = styled(StyledStatusIcon)`\n > ${StyledIcon}:nth-child(3) {\n position: absolute;\n inset-block-end: -0.25rem;\n inset-inline-end: -0.25rem;\n z-index: 1;\n width: 0.875rem;\n height: 0.875rem;\n fill: ${p => p.theme.base.colors.gray.medium};\n }\n`;\n\nStyledCallControlPanelIcon.defaultProps = defaultThemeProp;\n\nexport const UserStatusIcon: FunctionComponent<UserStatusIconProps> = memo(\n ({ status = 'offline', variant }) => {\n const {\n base: { colors }\n } = useTheme();\n const [colorName, colorVariant] = colorMapping[status].split('-', 2) as [\n ThemeColor,\n ThemeColorVariant\n ];\n const bgColor = colors[colorName][colorVariant];\n const iconName = iconMapping[status];\n\n return variant === 'dot' ? (\n <svg\n role='img'\n aria-hidden\n height='1rem'\n width='1rem'\n viewBox='0 0 10 10'\n xmlns='http://www.w3.org/2000/svg'\n >\n <circle cx='50%' cy='50%' r='50%' fill={bgColor} />\n </svg>\n ) : (\n <StyledStatusIcon as={StyledUserStatusIcon} userStatus={status}>\n {iconName && <Icon name={iconName} />}\n </StyledStatusIcon>\n );\n }\n);\n\nconst CallControlPanelIcon: FunctionComponent<CallControlPanelIconProps & ForwardProps> = memo(\n ({ status = 'offline', label, panelVisible, ...restProps }) => {\n const iconName = iconMapping[status];\n\n return (\n <StyledCallControlPanelIcon\n as={StyledAvatar}\n {...restProps}\n size='m'\n userStatus={status}\n aria-label={label}\n >\n <Icon name='headset' />\n {iconName && <UserStatusIcon variant='icon' status={status} />}\n {!panelVisible && <Icon name='eye-off-solid' />}\n </StyledCallControlPanelIcon>\n );\n }\n);\n\nexport default CallControlPanelIcon;\n"]}
@@ -0,0 +1,19 @@
1
+ import { FunctionComponent, Ref } from 'react';
2
+ import { ForwardProps } from '@pega/cosmos-react-core';
3
+ import type { TransferReasonOption, TransferData } from './CallControlPanel.types';
4
+ export interface CallTransferProps {
5
+ /**
6
+ * Callback fired on new call made by the user.
7
+ * @param phoneNumber the number chosen.
8
+ */
9
+ onTransferCall: (transferParam: TransferData) => void;
10
+ /** Callback fired on clicking close button. */
11
+ onClose?: () => void;
12
+ transferOptions: Readonly<TransferReasonOption[]>;
13
+ /** Reference to the root component. */
14
+ ref?: Ref<HTMLDivElement>;
15
+ }
16
+ export declare const StyledTransfer: import("styled-components").StyledComponent<FunctionComponent<import("@pega/cosmos-react-core").CardProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
17
+ declare const CallTransfer: FunctionComponent<CallTransferProps & ForwardProps>;
18
+ export default CallTransfer;
19
+ //# sourceMappingURL=CallTransfer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CallTransfer.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallTransfer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAEjB,GAAG,EAIJ,MAAM,OAAO,CAAC;AAGf,OAAO,EASL,YAAY,EAYb,MAAM,yBAAyB,CAAC;AAMjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKnF,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,cAAc,EAAE,CAAC,aAAa,EAAE,YAAY,KAAK,IAAI,CAAC;IACtD,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,eAAe,EAAE,QAAQ,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAClD,uCAAuC;IACvC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,cAAc,iLAc1B,CAAC;AAIF,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAmMrE,CAAC;AAEF,eAAe,YAAY,CAAC"}