@pega/cosmos-react-cs 2.1.5 → 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 +0,0 @@
|
|
|
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"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,74 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAGtE,CAAC;IACF,MAAM,OAAO,GAAG,MAAM,CAAC,SAA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,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"]}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useContext, forwardRef, useState, useMemo } from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Button, CardContent, CardHeader, Flex, Icon, registerIcon, Text, Card, defaultThemeProp, useI18n, RadioButtonGroup, RadioButton, TextArea, ComboBox, menuHelpers, CardFooter, useUID } from '@pega/cosmos-react-core';
|
|
5
|
-
import { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';
|
|
6
|
-
import { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';
|
|
7
|
-
import { StyledCardFooter } from '@pega/cosmos-react-core/lib/components/Card/CardFooter';
|
|
8
|
-
import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
|
|
9
|
-
import { ContactsContext } from './CalleePicker';
|
|
10
|
-
registerIcon(timesIcon);
|
|
11
|
-
export const StyledTransfer = styled(Card)(({ theme: { base: { spacing }, components: { card } } }) => {
|
|
12
|
-
return css `
|
|
13
|
-
${StyledCardHeader}, ${StyledCardContent}, ${StyledCardFooter} {
|
|
14
|
-
padding: calc(1.25 * ${spacing}) calc(${card.padding} * 2);
|
|
15
|
-
}
|
|
16
|
-
min-width: 28rem;
|
|
17
|
-
`;
|
|
18
|
-
});
|
|
19
|
-
StyledTransfer.defaultProps = defaultThemeProp;
|
|
20
|
-
const CallTransfer = forwardRef(({ onClose, onTransferCall, transferOptions }, ref) => {
|
|
21
|
-
const t = useI18n();
|
|
22
|
-
const { contacts } = useContext(ContactsContext);
|
|
23
|
-
const reasonsList = transferOptions.map(({ id, label }) => {
|
|
24
|
-
return {
|
|
25
|
-
id,
|
|
26
|
-
primary: label
|
|
27
|
-
};
|
|
28
|
-
});
|
|
29
|
-
const [reasons, setReasons] = useState(() => {
|
|
30
|
-
return menuHelpers.mapTree([...reasonsList], item => ({
|
|
31
|
-
...item,
|
|
32
|
-
selected: item.items ? undefined : !!item.selected
|
|
33
|
-
}));
|
|
34
|
-
});
|
|
35
|
-
const selectedReason = useMemo(() => menuHelpers.getSelected(reasons)[0], [reasons]);
|
|
36
|
-
const contactList = contacts.map(item => {
|
|
37
|
-
return {
|
|
38
|
-
id: item.phoneNumber,
|
|
39
|
-
primary: item.primary
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
const [itemsContacts, setItemsContacts] = useState(() => {
|
|
43
|
-
return menuHelpers.mapTree([...contactList], item => ({
|
|
44
|
-
...item,
|
|
45
|
-
selected: item.items ? undefined : !!item.selected
|
|
46
|
-
}));
|
|
47
|
-
});
|
|
48
|
-
const selectedContact = useMemo(() => menuHelpers.getSelected(itemsContacts)[0], [itemsContacts]);
|
|
49
|
-
const [filterValue, setFilterValue] = useState('');
|
|
50
|
-
const clearSelection = () => {
|
|
51
|
-
setItemsContacts(cur => menuHelpers.mapTree(cur, item => {
|
|
52
|
-
return {
|
|
53
|
-
...item,
|
|
54
|
-
selected: false
|
|
55
|
-
};
|
|
56
|
-
}));
|
|
57
|
-
};
|
|
58
|
-
const escapeChars = /[.*+\-?^${}()|[\]\\]/g;
|
|
59
|
-
const getFilterRegex = (inputValue) => {
|
|
60
|
-
return new RegExp(`^${inputValue.replace(escapeChars, '\\$&')}`, 'i');
|
|
61
|
-
};
|
|
62
|
-
const filterRegex = useMemo(() => getFilterRegex(filterValue), [filterValue]);
|
|
63
|
-
const itemsToRender = useMemo(() => {
|
|
64
|
-
const newItems = filterValue
|
|
65
|
-
? menuHelpers.flatten(itemsContacts).filter(({ primary }) => {
|
|
66
|
-
return filterRegex.test(primary);
|
|
67
|
-
})
|
|
68
|
-
: itemsContacts;
|
|
69
|
-
return menuHelpers.mapTree(newItems, item => ({
|
|
70
|
-
...item,
|
|
71
|
-
selected: item.items ? undefined : !!item.selected
|
|
72
|
-
}));
|
|
73
|
-
}, [filterValue, itemsContacts]);
|
|
74
|
-
const selectItem = (id) => {
|
|
75
|
-
setFilterValue('');
|
|
76
|
-
setItemsContacts(cur => menuHelpers.selectItem(cur, id, 'single-select'));
|
|
77
|
-
};
|
|
78
|
-
const [comments, setComments] = useState('');
|
|
79
|
-
const [interaction, setInteraction] = useState(true);
|
|
80
|
-
return (_jsxs(StyledTransfer, { ref: ref, children: [_jsx(CardHeader, { actions: _jsx(Button, { icon: true, variant: 'simple', "aria-label": t('close'), onClick: onClose, children: _jsx(Icon, { name: 'times' }, void 0) }, void 0), children: _jsx(Flex, { container: { alignItems: 'center', itemGap: 1 }, children: _jsx(Text, { variant: 'h3', children: t('call_panel_transfer_call_heading') }, void 0) }, void 0) }, void 0), _jsxs(CardContent, { container: { itemGap: 1, justify: 'start' }, children: [_jsxs(RadioButtonGroup, { name: t('call_panel_transfer_call_option_label'), children: [_jsx(RadioButton, { label: t('call_panel_transfer_call_and_interaction_option'), id: useUID(), defaultChecked: true, onChange: () => setInteraction(true) }, void 0), _jsx(RadioButton, { label: t('call_panel_transfer_call_only_option'), id: useUID(), onChange: () => setInteraction(false) }, void 0)] }, void 0), _jsx(ComboBox, { label: t('call_panel_transfer_reason_label'), required: true, selected: selectedReason
|
|
81
|
-
? {
|
|
82
|
-
items: {
|
|
83
|
-
id: selectedReason.id,
|
|
84
|
-
text: selectedReason.primary
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
: undefined, menu: {
|
|
88
|
-
items: reasons,
|
|
89
|
-
onItemClick: id => {
|
|
90
|
-
setReasons(cur => menuHelpers.selectItem(cur, id, 'single-select'));
|
|
91
|
-
}
|
|
92
|
-
} }, void 0), _jsx(TextArea, { name: 'comments', required: true, label: t('call_panel_transfer_comments_label'), displayCharCount: true, maxLength: 300, value: comments, onChange: (e) => setComments(e.target.value) }, void 0), _jsx(ComboBox, { label: t('call_panel_transfer_to_label'), required: true, selected: selectedContact
|
|
93
|
-
? {
|
|
94
|
-
items: {
|
|
95
|
-
id: selectedContact.id,
|
|
96
|
-
text: selectedContact.primary
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
: undefined, value: filterValue, onChange: (e) => {
|
|
100
|
-
if (!e.target.value)
|
|
101
|
-
clearSelection();
|
|
102
|
-
setFilterValue(e.target.value);
|
|
103
|
-
}, onBlur: () => {
|
|
104
|
-
setFilterValue('');
|
|
105
|
-
}, menu: {
|
|
106
|
-
items: itemsToRender,
|
|
107
|
-
onItemClick: selectItem,
|
|
108
|
-
accent: filterRegex,
|
|
109
|
-
emptyText: t('no_items')
|
|
110
|
-
} }, void 0)] }, void 0), _jsx(CardFooter, { alignItems: 'right', justify: 'end', children: _jsx(Button, { variant: 'primary', disabled: !(selectedReason && selectedContact && comments !== ''), onClick: () => {
|
|
111
|
-
const transferParam = {
|
|
112
|
-
reason: selectedReason.id,
|
|
113
|
-
comments,
|
|
114
|
-
interaction,
|
|
115
|
-
phoneNumber: selectedContact.id
|
|
116
|
-
};
|
|
117
|
-
onTransferCall(transferParam);
|
|
118
|
-
}, children: t('call_panel_transfer_button_label') }, void 0) }, void 0)] }, void 0));
|
|
119
|
-
});
|
|
120
|
-
export default CallTransfer;
|
|
121
|
-
//# sourceMappingURL=CallTransfer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CallTransfer.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallTransfer.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,UAAU,EAIV,QAAQ,EACR,OAAO,EAER,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,IAAI,EAEJ,gBAAgB,EAChB,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,QAAQ,EAER,WAAW,EAEX,UAAU,EACV,MAAM,EACP,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAC1F,OAAO,EA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,KAAC,UAAU,IAAC,UAAU,EAAC,OAAO,EAAC,OAAO,EAAC,KAAK,YAC1C,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,QAAQ,EAAE,CAAC,CAAC,cAAc,IAAI,eAAe,IAAI,QAAQ,KAAK,EAAE,CAAC,EACjE,OAAO,EAAE,GAAG,EAAE;wBACZ,MAAM,aAAa,GAAG;4BACpB,MAAM,EAAE,cAAc,CAAC,EAAE;4BACzB,QAAQ;4BACR,WAAW;4BACX,WAAW,EAAE,eAAe,CAAC,EAAE;yBAChC,CAAC;wBACF,cAAc,CAAC,aAAa,CAAC,CAAC;oBAChC,CAAC,YAEA,CAAC,CAAC,kCAAkC,CAAC,WAC/B,WACE,YACE,CAClB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n useContext,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useState,\n useMemo,\n ChangeEvent\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n CardContent,\n CardHeader,\n Flex,\n Icon,\n registerIcon,\n Text,\n Card,\n ForwardProps,\n defaultThemeProp,\n useI18n,\n RadioButtonGroup,\n RadioButton,\n TextArea,\n ComboBox,\n MenuProps,\n menuHelpers,\n MenuItemProps,\n CardFooter,\n useUID\n} from '@pega/cosmos-react-core';\nimport { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport { StyledCardFooter } from '@pega/cosmos-react-core/lib/components/Card/CardFooter';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nimport type { TransferReasonOption, TransferData } from './CallControlPanel.types';\nimport { ContactsContext } from './CalleePicker';\n\nregisterIcon(timesIcon);\n\nexport interface CallTransferProps {\n /**\n * Callback fired on new call made by the user.\n * @param phoneNumber the number chosen.\n */\n onTransferCall: (transferParam: TransferData) => void;\n /** Callback fired on clicking close button. */\n onClose?: () => void;\n\n transferOptions: Readonly<TransferReasonOption[]>;\n /** Reference to the root component. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledTransfer = styled(Card)(\n ({\n theme: {\n base: { spacing },\n components: { card }\n }\n }) => {\n return css`\n ${StyledCardHeader}, ${StyledCardContent}, ${StyledCardFooter} {\n padding: calc(1.25 * ${spacing}) calc(${card.padding} * 2);\n }\n min-width: 28rem;\n `;\n }\n);\n\nStyledTransfer.defaultProps = defaultThemeProp;\n\nconst CallTransfer: FunctionComponent<CallTransferProps & ForwardProps> = forwardRef(\n (\n { onClose, onTransferCall, transferOptions }: PropsWithoutRef<CallTransferProps>,\n ref: CallTransferProps['ref']\n ) => {\n const t = useI18n();\n const { contacts } = useContext(ContactsContext);\n\n const reasonsList = transferOptions.map(({ id, label }) => {\n return {\n id,\n primary: label\n };\n });\n\n const [reasons, setReasons] = useState<MenuProps['items']>((): MenuProps['items'] => {\n return menuHelpers.mapTree([...reasonsList], item => ({\n ...item,\n selected: item.items ? undefined : !!item.selected\n }));\n });\n\n const selectedReason = useMemo(() => menuHelpers.getSelected(reasons)[0], [reasons]);\n\n const contactList = contacts.map(item => {\n return {\n id: item.phoneNumber,\n primary: item.primary\n };\n });\n\n const [itemsContacts, setItemsContacts] = useState<MenuProps['items']>(\n (): MenuProps['items'] => {\n return menuHelpers.mapTree([...contactList], item => ({\n ...item,\n selected: item.items ? undefined : !!item.selected\n }));\n }\n );\n\n const selectedContact = useMemo(\n () => menuHelpers.getSelected(itemsContacts)[0],\n [itemsContacts]\n );\n\n const [filterValue, setFilterValue] = useState('');\n\n const clearSelection = () => {\n setItemsContacts(cur =>\n menuHelpers.mapTree(cur, item => {\n return {\n ...item,\n selected: false\n };\n })\n );\n };\n\n const escapeChars = /[.*+\\-?^${}()|[\\]\\\\]/g;\n const getFilterRegex = (inputValue: string) => {\n return new RegExp(`^${inputValue.replace(escapeChars, '\\\\$&')}`, 'i');\n };\n\n const filterRegex = useMemo(() => getFilterRegex(filterValue), [filterValue]);\n\n const itemsToRender = useMemo(() => {\n const newItems = filterValue\n ? menuHelpers.flatten(itemsContacts).filter(({ primary }: MenuItemProps) => {\n return filterRegex.test(primary);\n })\n : itemsContacts;\n\n return menuHelpers.mapTree(newItems, item => ({\n ...item,\n selected: item.items ? undefined : !!item.selected\n }));\n }, [filterValue, itemsContacts]);\n\n const selectItem = (id: MenuItemProps['id']) => {\n setFilterValue('');\n setItemsContacts(cur => menuHelpers.selectItem(cur, id, 'single-select'));\n };\n\n const [comments, setComments] = useState('');\n\n const [interaction, setInteraction] = useState(true);\n\n return (\n <StyledTransfer ref={ref}>\n <CardHeader\n actions={\n <Button icon variant='simple' aria-label={t('close')} onClick={onClose}>\n <Icon name='times' />\n </Button>\n }\n >\n <Flex container={{ alignItems: 'center', itemGap: 1 }}>\n <Text variant='h3'>{t('call_panel_transfer_call_heading')}</Text>\n </Flex>\n </CardHeader>\n <CardContent container={{ itemGap: 1, justify: 'start' }}>\n <RadioButtonGroup name={t('call_panel_transfer_call_option_label')}>\n <RadioButton\n label={t('call_panel_transfer_call_and_interaction_option')}\n id={useUID()}\n defaultChecked\n onChange={() => setInteraction(true)}\n />\n <RadioButton\n label={t('call_panel_transfer_call_only_option')}\n id={useUID()}\n onChange={() => setInteraction(false)}\n />\n </RadioButtonGroup>\n\n <ComboBox\n label={t('call_panel_transfer_reason_label')}\n required\n selected={\n selectedReason\n ? {\n items: {\n id: selectedReason.id,\n text: selectedReason.primary\n }\n }\n : undefined\n }\n menu={{\n items: reasons,\n onItemClick: id => {\n setReasons(cur => menuHelpers.selectItem(cur, id, 'single-select'));\n }\n }}\n />\n\n <TextArea\n name='comments'\n required\n label={t('call_panel_transfer_comments_label')}\n displayCharCount\n maxLength={300}\n value={comments}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) => setComments(e.target.value)}\n />\n\n <ComboBox\n label={t('call_panel_transfer_to_label')}\n required\n selected={\n selectedContact\n ? {\n items: {\n id: selectedContact.id,\n text: selectedContact.primary\n }\n }\n : undefined\n }\n value={filterValue}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n if (!e.target.value) clearSelection();\n setFilterValue(e.target.value);\n }}\n onBlur={() => {\n setFilterValue('');\n }}\n menu={{\n items: itemsToRender,\n onItemClick: selectItem,\n accent: filterRegex,\n emptyText: t('no_items')\n }}\n />\n </CardContent>\n <CardFooter alignItems='right' justify='end'>\n <Button\n variant='primary'\n disabled={!(selectedReason && selectedContact && comments !== '')}\n onClick={() => {\n const transferParam = {\n reason: selectedReason.id,\n comments,\n interaction,\n phoneNumber: selectedContact.id\n };\n onTransferCall(transferParam);\n }}\n >\n {t('call_panel_transfer_button_label')}\n </Button>\n </CardFooter>\n </StyledTransfer>\n );\n }\n);\n\nexport default CallTransfer;\n"]}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent, Ref } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import { ContactsListProps } from './ContactsList';
|
|
4
|
-
export interface CalleePickerProps {
|
|
5
|
-
/** Heading for the new call. */
|
|
6
|
-
heading: string;
|
|
7
|
-
/**
|
|
8
|
-
* Callback fired on new call made by the user.
|
|
9
|
-
* @param phoneNumber the number chosen.
|
|
10
|
-
*/
|
|
11
|
-
onCall: (phoneNumber: string) => void;
|
|
12
|
-
/** Callback fired on clicking close button. */
|
|
13
|
-
onClose?: () => void;
|
|
14
|
-
/** Reference to the root component. */
|
|
15
|
-
ref?: Ref<HTMLDivElement>;
|
|
16
|
-
}
|
|
17
|
-
export declare const ContactsContext: import("react").Context<Pick<ContactsListProps, "onFavoriteToggle" | "contacts">>;
|
|
18
|
-
declare const CalleePicker: FunctionComponent<CalleePickerProps & ForwardProps>;
|
|
19
|
-
export default CalleePicker;
|
|
20
|
-
//# sourceMappingURL=CalleePicker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CalleePicker.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CalleePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAEjB,GAAG,EAIJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAWL,YAAY,EAGb,MAAM,yBAAyB,CAAC;AAQjC,OAAqB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIjE,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,uCAAuC;IACvC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,eAAe,mFAK1B,CAAC;AAgBH,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAsErE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useContext, forwardRef, useEffect, useRef, useState } from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Button, CardContent, CardHeader, Flex, Icon, registerIcon, Text, TabPanel, Tabs, Card, defaultThemeProp, useI18n } from '@pega/cosmos-react-core';
|
|
5
|
-
import { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';
|
|
6
|
-
import { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';
|
|
7
|
-
import { StyledTabPanel } from '@pega/cosmos-react-core/lib/components/Tabs/TabPanel';
|
|
8
|
-
import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
|
|
9
|
-
import DialPad from '../DialPad/DialPad';
|
|
10
|
-
import ContactsList from './ContactsList';
|
|
11
|
-
registerIcon(timesIcon);
|
|
12
|
-
export const ContactsContext = createContext({
|
|
13
|
-
contacts: [],
|
|
14
|
-
onFavoriteToggle: () => { }
|
|
15
|
-
});
|
|
16
|
-
const StyledCalleePicker = styled(Card)(({ theme }) => {
|
|
17
|
-
return css `
|
|
18
|
-
${StyledCardHeader}, ${StyledCardContent} {
|
|
19
|
-
padding: calc(1.25 * ${theme.base.spacing}) calc(${theme.components.card.padding} * 2);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
${StyledTabPanel} {
|
|
23
|
-
height: 24rem;
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
26
|
-
});
|
|
27
|
-
StyledCalleePicker.defaultProps = defaultThemeProp;
|
|
28
|
-
const CalleePicker = forwardRef(({ heading, onClose, onCall }, ref) => {
|
|
29
|
-
const t = useI18n();
|
|
30
|
-
const [currentTab, setCurrentTab] = useState('all');
|
|
31
|
-
const tabsRef = useRef(null);
|
|
32
|
-
const { contacts, onFavoriteToggle } = useContext(ContactsContext);
|
|
33
|
-
const favorites = contacts.filter(item => item.favorite);
|
|
34
|
-
const handleTabChange = (id) => {
|
|
35
|
-
setCurrentTab(id);
|
|
36
|
-
};
|
|
37
|
-
const tabsHeaders = [
|
|
38
|
-
{ id: 'all', name: t('call_panel_contacts_list_heading'), count: contacts.length },
|
|
39
|
-
{
|
|
40
|
-
id: 'favorites',
|
|
41
|
-
name: t('call_panel_contacts_favorites_heading'),
|
|
42
|
-
count: contacts.filter(item => item.favorite).length
|
|
43
|
-
},
|
|
44
|
-
{ id: 'dial-pad', name: t('call_panel_contacts_dial_pad_heading') }
|
|
45
|
-
];
|
|
46
|
-
const tabContent = (tabId) => {
|
|
47
|
-
if (tabId === 'dial-pad')
|
|
48
|
-
return _jsx(DialPad, { onCallButtonClick: onCall, mode: 'default' }, void 0);
|
|
49
|
-
return (_jsx(ContactsList, { contacts: tabId === 'favorites' ? favorites : contacts, onFavoriteToggle: onFavoriteToggle, action: {
|
|
50
|
-
label: t('call_panel_contacts_call_button_label'),
|
|
51
|
-
icon: 'phone-solid',
|
|
52
|
-
callback: onCall
|
|
53
|
-
} }, void 0));
|
|
54
|
-
};
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
tabsRef.current?.firstChild.focus();
|
|
57
|
-
}, []);
|
|
58
|
-
return (_jsxs(StyledCalleePicker, { ref: ref, children: [_jsx(CardHeader, { actions: _jsx(Button, { icon: true, variant: 'simple', "aria-label": t('close'), onClick: onClose, children: _jsx(Icon, { name: 'times' }, void 0) }, void 0), children: _jsx(Flex, { container: { alignItems: 'center', itemGap: 1 }, children: _jsx(Text, { variant: 'h3', children: heading }, void 0) }, void 0) }, void 0), _jsxs(CardContent, { container: { itemGap: 2 }, children: [_jsx(Tabs, { ref: tabsRef, tabs: tabsHeaders, type: 'horizontal', onTabClick: handleTabChange, currentTabId: currentTab }, void 0), _jsx(TabPanel, { tabId: currentTab, children: tabContent(currentTab) }, void 0)] }, void 0)] }, void 0));
|
|
59
|
-
});
|
|
60
|
-
export default CalleePicker;
|
|
61
|
-
//# sourceMappingURL=CalleePicker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CalleePicker.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CalleePicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,UAAU,EACV,UAAU,EAIV,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,WAAW,EACX,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,IAAI,EAEJ,gBAAgB,EAChB,OAAO,EACR,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAC1F,OAAO,EAAE,iBAA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,CAAC,EAAE,OAAO,EAAE,OAAO,YACpE,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,WAAG,WACd,YAGX,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,YACnD,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,OAAO,WAAQ,WAC9B,WACI,EACb,MAAC,WAAW,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,aACpC,KAAC,IAAI,IACH,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,WAAW,EACjB,IAAI,EAAC,YAAY,EACjB,UAAU,EAAE,eAAe,EAC3B,YAAY,EAAE,UAAU,WACxB,EACF,KAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,YAAG,UAAU,CAAC,UAAU,CAAC,WAAY,YACpD,YACK,CACtB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n createContext,\n useContext,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useEffect,\n useRef,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n CardContent,\n CardHeader,\n Flex,\n Icon,\n registerIcon,\n Text,\n TabPanel,\n Tabs,\n Card,\n ForwardProps,\n defaultThemeProp,\n useI18n\n} from '@pega/cosmos-react-core';\nimport { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport { StyledTabPanel } from '@pega/cosmos-react-core/lib/components/Tabs/TabPanel';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nimport DialPad from '../DialPad/DialPad';\n\nimport ContactsList, { ContactsListProps } from './ContactsList';\n\nregisterIcon(timesIcon);\n\nexport interface CalleePickerProps {\n /** Heading for the new call. */\n heading: string;\n /**\n * Callback fired on new call made by the user.\n * @param phoneNumber the number chosen.\n */\n onCall: (phoneNumber: string) => void;\n /** Callback fired on clicking close button. */\n onClose?: () => void;\n /** Reference to the root component. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const ContactsContext = createContext<\n Pick<ContactsListProps, 'contacts' | 'onFavoriteToggle'>\n>({\n contacts: [],\n onFavoriteToggle: () => {}\n});\n\nconst StyledCalleePicker = styled(Card)(({ theme }) => {\n return css`\n ${StyledCardHeader}, ${StyledCardContent} {\n padding: calc(1.25 * ${theme.base.spacing}) calc(${theme.components.card.padding} * 2);\n }\n\n ${StyledTabPanel} {\n height: 24rem;\n }\n `;\n});\n\nStyledCalleePicker.defaultProps = defaultThemeProp;\n\nconst CalleePicker: FunctionComponent<CalleePickerProps & ForwardProps> = forwardRef(\n (\n { heading, onClose, onCall }: PropsWithoutRef<CalleePickerProps>,\n ref: CalleePickerProps['ref']\n ) => {\n const t = useI18n();\n const [currentTab, setCurrentTab] = useState('all');\n const tabsRef = useRef<HTMLElement>(null);\n const { contacts, onFavoriteToggle } = useContext(ContactsContext);\n const favorites = contacts.filter(item => item.favorite);\n\n const handleTabChange = (id: string) => {\n setCurrentTab(id);\n };\n\n const tabsHeaders = [\n { id: 'all', name: t('call_panel_contacts_list_heading'), count: contacts.length },\n {\n id: 'favorites',\n name: t('call_panel_contacts_favorites_heading'),\n count: contacts.filter(item => item.favorite).length\n },\n { id: 'dial-pad', name: t('call_panel_contacts_dial_pad_heading') }\n ];\n\n const tabContent = (tabId: string) => {\n if (tabId === 'dial-pad') return <DialPad onCallButtonClick={onCall} mode='default' />;\n return (\n <ContactsList\n contacts={tabId === 'favorites' ? favorites : contacts}\n onFavoriteToggle={onFavoriteToggle}\n action={{\n label: t('call_panel_contacts_call_button_label'),\n icon: 'phone-solid',\n callback: onCall\n }}\n />\n );\n };\n\n useEffect(() => {\n (tabsRef.current?.firstChild as HTMLButtonElement).focus();\n }, []);\n\n return (\n <StyledCalleePicker ref={ref}>\n <CardHeader\n actions={\n <Button icon variant='simple' aria-label={t('close')} onClick={onClose}>\n <Icon name='times' />\n </Button>\n }\n >\n <Flex container={{ alignItems: 'center', itemGap: 1 }}>\n <Text variant='h3'>{heading}</Text>\n </Flex>\n </CardHeader>\n <CardContent container={{ itemGap: 2 }}>\n <Tabs\n ref={tabsRef}\n tabs={tabsHeaders}\n type='horizontal'\n onTabClick={handleTabChange}\n currentTabId={currentTab}\n />\n <TabPanel tabId={currentTab}>{tabContent(currentTab)}</TabPanel>\n </CardContent>\n </StyledCalleePicker>\n );\n }\n);\n\nexport default CalleePicker;\n"]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent, Ref } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import type { Contact } from './CallControlPanel.types';
|
|
4
|
-
export interface ContactsListProps {
|
|
5
|
-
/** An array of contacts objects. */
|
|
6
|
-
contacts: Contact[];
|
|
7
|
-
/**
|
|
8
|
-
* Primary action the user may select.
|
|
9
|
-
* @param phoneNumber the number chosen.
|
|
10
|
-
*/
|
|
11
|
-
action: {
|
|
12
|
-
label: string;
|
|
13
|
-
icon: string;
|
|
14
|
-
callback: (phoneNumber: string) => void;
|
|
15
|
-
};
|
|
16
|
-
/** Callback fired on adding/removing contact to/from favorites */
|
|
17
|
-
onFavoriteToggle: (phoneNumber: string, favorites: boolean) => void;
|
|
18
|
-
/** Reference to the root component. */
|
|
19
|
-
ref?: Ref<HTMLDivElement>;
|
|
20
|
-
}
|
|
21
|
-
declare const ContactsList: FunctionComponent<ContactsListProps & ForwardProps>;
|
|
22
|
-
export default ContactsList;
|
|
23
|
-
//# sourceMappingURL=ContactsList.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContactsList.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/ContactsList.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAGjB,GAAG,EAGJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAGL,YAAY,EAab,MAAM,yBAAyB,CAAC;AAKjC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAIxD,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB;;;OAGG;IACH,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;KACzC,CAAC;IACF,kEAAkE;IAClE,gBAAgB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACpE,uCAAuC;IACvC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAoCD,QAAA,MAAM,YAAY,EAAE,iBAAiB,CAAC,iBAAiB,GAAG,YAAY,CAkFrE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useCallback, useState } from 'react';
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Button, defaultThemeProp, Icon, registerIcon, Text, StyledGrid, useI18n, ViewAll, StyledSummaryItemActions, StyledPrimary, StyledSecondary, useArrows, useConsolidatedRef, StyledCard } from '@pega/cosmos-react-core';
|
|
5
|
-
import { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';
|
|
6
|
-
import * as starIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/star.icon';
|
|
7
|
-
import * as starSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/star-solid.icon';
|
|
8
|
-
registerIcon(starIcon, starSolidIcon);
|
|
9
|
-
const StyledContactsList = styled.div(({ theme: { base } }) => {
|
|
10
|
-
return css `
|
|
11
|
-
display: flex;
|
|
12
|
-
flex-flow: column;
|
|
13
|
-
height: 100%;
|
|
14
|
-
overflow-y: auto;
|
|
15
|
-
overflow-x: hidden;
|
|
16
|
-
|
|
17
|
-
${StyledCard} {
|
|
18
|
-
margin: 0 calc(${base.spacing} * -2);
|
|
19
|
-
padding: 0 calc(${base.spacing} * 2);
|
|
20
|
-
|
|
21
|
-
> ${StyledCardContent} {
|
|
22
|
-
padding: 0;
|
|
23
|
-
gap: 0;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
li${StyledGrid} {
|
|
28
|
-
border-bottom: 0.0625rem solid ${base.palette['border-line']};
|
|
29
|
-
padding: 0;
|
|
30
|
-
> ${StyledPrimary}, > ${StyledSecondary} {
|
|
31
|
-
align-self: center;
|
|
32
|
-
font-weight: ${base['font-weight'].normal};
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
${StyledSummaryItemActions} {
|
|
36
|
-
color: ${base.palette.interactive};
|
|
37
|
-
}
|
|
38
|
-
`;
|
|
39
|
-
});
|
|
40
|
-
StyledContactsList.defaultProps = defaultThemeProp;
|
|
41
|
-
const ContactsList = forwardRef(({ contacts: items, action, onFavoriteToggle }, ref) => {
|
|
42
|
-
const t = useI18n();
|
|
43
|
-
const [searchText, setSearchText] = useState('');
|
|
44
|
-
const containerRef = useConsolidatedRef(ref);
|
|
45
|
-
const onSearchChange = useCallback((value) => {
|
|
46
|
-
setSearchText(value.trim());
|
|
47
|
-
}, []);
|
|
48
|
-
const favoriteButton = useCallback((phoneNumber, favorite) => (_jsx(Button, { variant: 'simple', icon: true, onClick: (e) => {
|
|
49
|
-
e.stopPropagation();
|
|
50
|
-
onFavoriteToggle(phoneNumber, favorite);
|
|
51
|
-
}, "aria-label": favorite
|
|
52
|
-
? t('call_panel_contacts_add_to_favorites')
|
|
53
|
-
: t('call_panel_contacts_remove_from_favorites'), children: _jsx(Icon, { name: favorite ? 'star-solid' : 'star' }, void 0) }, void 0)), [onFavoriteToggle]);
|
|
54
|
-
const createList = (list) => {
|
|
55
|
-
return list.map(item => {
|
|
56
|
-
return {
|
|
57
|
-
id: item.phoneNumber,
|
|
58
|
-
primary: item.primary,
|
|
59
|
-
secondary: _jsx(Text, { variant: 'secondary', children: item.secondary }, void 0),
|
|
60
|
-
visual: favoriteButton(item.phoneNumber, item.favorite),
|
|
61
|
-
actions: [
|
|
62
|
-
{
|
|
63
|
-
text: action.label,
|
|
64
|
-
id: 'primary',
|
|
65
|
-
icon: action.icon
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
onClick: () => {
|
|
69
|
-
action.callback(item.phoneNumber);
|
|
70
|
-
},
|
|
71
|
-
container: {
|
|
72
|
-
areas: '"visual primary secondary actions"',
|
|
73
|
-
cols: 'auto minmax(0, 2fr) minmax(0, 2fr) auto'
|
|
74
|
-
},
|
|
75
|
-
tabIndex: 0
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
useArrows(containerRef, { selector: ':scope ul > li' });
|
|
80
|
-
return (_jsx(ViewAll, { as: StyledContactsList, ref: containerRef, items: searchText
|
|
81
|
-
? createList(items.filter(({ primary, secondary }) => {
|
|
82
|
-
return (primary.toLowerCase().includes(searchText.toLowerCase()) ||
|
|
83
|
-
secondary.toLowerCase().includes(searchText.toLowerCase()));
|
|
84
|
-
}))
|
|
85
|
-
: createList(items), searchInputProps: { onSearchChange } }, void 0));
|
|
86
|
-
});
|
|
87
|
-
export default ContactsList;
|
|
88
|
-
//# sourceMappingURL=ContactsList.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ContactsList.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/ContactsList.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAKV,WAAW,EACX,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,gBAAgB,EAEhB,IAAI,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oCAAoC;oBAC3C,IAAI,EAAE,yCAAyC;iBAChD;gBACD,QAAQ,EAAE,CAAC;aACZ,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,SAAS,CAAC,YAAY,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAExD,OAAO,CACL,KAAC,OAAO,IACN,EAAE,EAAE,kBAAkB,EACtB,GAAG,EAAE,YAAY,EACjB,KAAK,EACH,UAAU;YACR,CAAC,CAAC,UAAU,CACR,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE;gBACtC,OAAO,CACL,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;oBACxD,SAAS,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAC3D,CAAC;YACJ,CAAC,CAAC,CACH;YACH,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,EAEvB,gBAAgB,EAAE,EAAE,cAAc,EAAE,WACpC,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n MouseEvent,\n PropsWithoutRef,\n Ref,\n useCallback,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n defaultThemeProp,\n ForwardProps,\n Icon,\n registerIcon,\n Text,\n StyledGrid,\n useI18n,\n ViewAll,\n StyledSummaryItemActions,\n StyledPrimary,\n StyledSecondary,\n useArrows,\n useConsolidatedRef,\n StyledCard\n} from '@pega/cosmos-react-core';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport * as starIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/star.icon';\nimport * as starSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/star-solid.icon';\n\nimport type { Contact } from './CallControlPanel.types';\n\nregisterIcon(starIcon, starSolidIcon);\n\nexport interface ContactsListProps {\n /** An array of contacts objects. */\n contacts: Contact[];\n /**\n * Primary action the user may select.\n * @param phoneNumber the number chosen.\n */\n action: {\n label: string;\n icon: string;\n callback: (phoneNumber: string) => void;\n };\n /** Callback fired on adding/removing contact to/from favorites */\n onFavoriteToggle: (phoneNumber: string, favorites: boolean) => void;\n /** Reference to the root component. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledContactsList = styled.div(({ theme: { base } }) => {\n return css`\n display: flex;\n flex-flow: column;\n height: 100%;\n overflow-y: auto;\n overflow-x: hidden;\n\n ${StyledCard} {\n margin: 0 calc(${base.spacing} * -2);\n padding: 0 calc(${base.spacing} * 2);\n\n > ${StyledCardContent} {\n padding: 0;\n gap: 0;\n }\n }\n\n li${StyledGrid} {\n border-bottom: 0.0625rem solid ${base.palette['border-line']};\n padding: 0;\n > ${StyledPrimary}, > ${StyledSecondary} {\n align-self: center;\n font-weight: ${base['font-weight'].normal};\n }\n }\n ${StyledSummaryItemActions} {\n color: ${base.palette.interactive};\n }\n `;\n});\n\nStyledContactsList.defaultProps = defaultThemeProp;\n\nconst ContactsList: FunctionComponent<ContactsListProps & ForwardProps> = forwardRef(\n (\n { contacts: items, action, onFavoriteToggle }: PropsWithoutRef<ContactsListProps>,\n ref: ContactsListProps['ref']\n ) => {\n const t = useI18n();\n const [searchText, setSearchText] = useState('');\n const containerRef = useConsolidatedRef(ref);\n\n const onSearchChange = useCallback((value: string) => {\n setSearchText(value.trim());\n }, []);\n\n const favoriteButton = useCallback(\n (phoneNumber: string, favorite: boolean) => (\n <Button\n variant='simple'\n icon\n onClick={(e: MouseEvent) => {\n e.stopPropagation();\n onFavoriteToggle(phoneNumber, favorite);\n }}\n aria-label={\n favorite\n ? t('call_panel_contacts_add_to_favorites')\n : t('call_panel_contacts_remove_from_favorites')\n }\n >\n <Icon name={favorite ? 'star-solid' : 'star'} />\n </Button>\n ),\n [onFavoriteToggle]\n );\n\n const createList = (list: Contact[]) => {\n return list.map(item => {\n return {\n id: item.phoneNumber,\n primary: item.primary,\n secondary: <Text variant='secondary'>{item.secondary}</Text>,\n visual: favoriteButton(item.phoneNumber, item.favorite),\n actions: [\n {\n text: action.label,\n id: 'primary',\n icon: action.icon\n }\n ],\n onClick: () => {\n action.callback(item.phoneNumber);\n },\n container: {\n areas: '\"visual primary secondary actions\"',\n cols: 'auto minmax(0, 2fr) minmax(0, 2fr) auto'\n },\n tabIndex: 0\n };\n });\n };\n\n useArrows(containerRef, { selector: ':scope ul > li' });\n\n return (\n <ViewAll\n as={StyledContactsList}\n ref={containerRef}\n items={\n searchText\n ? createList(\n items.filter(({ primary, secondary }) => {\n return (\n primary.toLowerCase().includes(searchText.toLowerCase()) ||\n secondary.toLowerCase().includes(searchText.toLowerCase())\n );\n })\n )\n : createList(items)\n }\n searchInputProps={{ onSearchChange }}\n />\n );\n }\n);\n\nexport default ContactsList;\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { OmitStrict } from '@pega/cosmos-react-core';
|
|
3
|
-
import { DialPadProps } from '../DialPad/DialPad';
|
|
4
|
-
export declare const StyledDTMFKeypad: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").CardProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
5
|
-
export interface DTMFKeypadProps extends OmitStrict<DialPadProps, 'mode'> {
|
|
6
|
-
/** Callback fired on clicking close button. */
|
|
7
|
-
onClose?: () => void;
|
|
8
|
-
}
|
|
9
|
-
declare const DTMFKeypad: FC<DTMFKeypadProps>;
|
|
10
|
-
export default DTMFKeypad;
|
|
11
|
-
//# sourceMappingURL=DTMFKeypad.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DTMFKeypad.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/DTMFKeypad.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAG3B,OAAO,EAWL,UAAU,EACX,MAAM,yBAAyB,CAAC;AAKjC,OAAgB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAI3D,eAAO,MAAM,gBAAgB,mOAc5B,CAAC;AAIF,MAAM,WAAW,eAAgB,SAAQ,UAAU,CAAC,YAAY,EAAE,MAAM,CAAC;IACvE,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAqBnC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import styled, { css } from 'styled-components';
|
|
3
|
-
import { Card, CardHeader, Button, Icon, registerIcon, Flex, Text, useI18n, CardContent, defaultThemeProp } from '@pega/cosmos-react-core';
|
|
4
|
-
import { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';
|
|
5
|
-
import { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';
|
|
6
|
-
import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
|
|
7
|
-
import DialPad from '../DialPad/DialPad';
|
|
8
|
-
registerIcon(timesIcon);
|
|
9
|
-
export const StyledDTMFKeypad = styled(Card)(({ theme: { base: { spacing }, components: { card } } }) => {
|
|
10
|
-
return css `
|
|
11
|
-
min-width: 15rem;
|
|
12
|
-
${StyledCardHeader}, ${StyledCardContent} {
|
|
13
|
-
padding: calc(1.25 * ${spacing}) calc(${card.padding} * 2);
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
16
|
-
});
|
|
17
|
-
StyledDTMFKeypad.defaultProps = defaultThemeProp;
|
|
18
|
-
const DTMFKeypad = ({ onClose, onDialButtonClick }) => {
|
|
19
|
-
const t = useI18n();
|
|
20
|
-
return (_jsxs(StyledDTMFKeypad, { children: [_jsx(CardHeader, { actions: _jsx(Button, { icon: true, variant: 'simple', "aria-label": t('close'), onClick: onClose, children: _jsx(Icon, { name: 'times' }, void 0) }, void 0), children: _jsx(Flex, { container: { alignItems: 'center', itemGap: 1 }, children: _jsx(Text, { variant: 'h3', children: t('call_panel_send_dtmf_heading') }, void 0) }, void 0) }, void 0), _jsx(CardContent, { container: { itemGap: 1, justify: 'start' }, children: _jsx(DialPad, { onDialButtonClick: onDialButtonClick, mode: 'DTMF' }, void 0) }, void 0)] }, void 0));
|
|
21
|
-
};
|
|
22
|
-
export default DTMFKeypad;
|
|
23
|
-
//# sourceMappingURL=DTMFKeypad.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DTMFKeypad.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/DTMFKeypad.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,UAAU,EACV,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,WAAW,EACX,gBAAgB,EAEjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAC1F,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAE1F,OAAO,OAAyB,MAAM,oBAAoB,CAAC;AAE3D,YAAY,CAAC,SAAS,CAAC,CAAC;AAExB,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,CAC1C,CAAC,EACC,KAAK,EAAE,EACL,IAAI,EAAE,EAAE,OAAO,EAAE,EACjB,UAAU,EAAE,EAAE,IAAI,EAAE,EACrB,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;;QAEN,gBAAgB,KAAK,iBAAiB;+BACf,OAAO,UAAU,IAAI,CAAC,OAAO;;KAEvD,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAOjD,MAAM,UAAU,GAAwB,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,EAAE;IACzE,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,OAAO,CACL,MAAC,gBAAgB,eACf,KAAC,UAAU,IACT,OAAO,EACL,KAAC,MAAM,IAAC,IAAI,QAAC,OAAO,EAAC,QAAQ,gBAAa,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,YACpE,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,WAAG,WACd,YAGX,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,YACnD,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,CAAC,CAAC,8BAA8B,CAAC,WAAQ,WACxD,WACI,EACb,KAAC,WAAW,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,YACtD,KAAC,OAAO,IAAC,iBAAiB,EAAE,iBAAiB,EAAE,IAAI,EAAC,MAAM,WAAG,WACjD,YACG,CACpB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import { FC } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Card,\n CardHeader,\n Button,\n Icon,\n registerIcon,\n Flex,\n Text,\n useI18n,\n CardContent,\n defaultThemeProp,\n OmitStrict\n} from '@pega/cosmos-react-core';\nimport { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\nimport { StyledCardContent } from '@pega/cosmos-react-core/lib/components/Card/CardContent';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nimport DialPad, { DialPadProps } from '../DialPad/DialPad';\n\nregisterIcon(timesIcon);\n\nexport const StyledDTMFKeypad = styled(Card)(\n ({\n theme: {\n base: { spacing },\n components: { card }\n }\n }) => {\n return css`\n min-width: 15rem;\n ${StyledCardHeader}, ${StyledCardContent} {\n padding: calc(1.25 * ${spacing}) calc(${card.padding} * 2);\n }\n `;\n }\n);\n\nStyledDTMFKeypad.defaultProps = defaultThemeProp;\n\nexport interface DTMFKeypadProps extends OmitStrict<DialPadProps, 'mode'> {\n /** Callback fired on clicking close button. */\n onClose?: () => void;\n}\n\nconst DTMFKeypad: FC<DTMFKeypadProps> = ({ onClose, onDialButtonClick }) => {\n const t = useI18n();\n\n return (\n <StyledDTMFKeypad>\n <CardHeader\n actions={\n <Button icon variant='simple' aria-label={t('close')} onClick={onClose}>\n <Icon name='times' />\n </Button>\n }\n >\n <Flex container={{ alignItems: 'center', itemGap: 1 }}>\n <Text variant='h3'>{t('call_panel_send_dtmf_heading')}</Text>\n </Flex>\n </CardHeader>\n <CardContent container={{ itemGap: 1, justify: 'start' }}>\n <DialPad onDialButtonClick={onDialButtonClick} mode='DTMF' />\n </CardContent>\n </StyledDTMFKeypad>\n );\n};\n\nexport default DTMFKeypad;\n"]}
|