@pega/cosmos-react-cs 3.0.0-dev.12.0 → 3.0.0-dev.13.0

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 (38) hide show
  1. package/lib/components/ArticleList/ArticleListHeader.js +1 -1
  2. package/lib/components/ArticleList/ArticleListHeader.js.map +1 -1
  3. package/lib/components/CallControlPanel/Call.d.ts +1 -1
  4. package/lib/components/CallControlPanel/Call.d.ts.map +1 -1
  5. package/lib/components/CallControlPanel/Call.js +76 -98
  6. package/lib/components/CallControlPanel/Call.js.map +1 -1
  7. package/lib/components/CallControlPanel/CallControlPanel.d.ts.map +1 -1
  8. package/lib/components/CallControlPanel/CallControlPanel.js +18 -31
  9. package/lib/components/CallControlPanel/CallControlPanel.js.map +1 -1
  10. package/lib/components/CallControlPanel/CallControlPanel.types.d.ts +22 -13
  11. package/lib/components/CallControlPanel/CallControlPanel.types.d.ts.map +1 -1
  12. package/lib/components/CallControlPanel/CallControlPanel.types.js.map +1 -1
  13. package/lib/components/CallControlPanel/CallControlPanelIcon.js +8 -8
  14. package/lib/components/CallControlPanel/CallControlPanelIcon.js.map +1 -1
  15. package/lib/components/CallControlPanel/CallHandoverForm.d.ts +19 -0
  16. package/lib/components/CallControlPanel/CallHandoverForm.d.ts.map +1 -0
  17. package/lib/components/CallControlPanel/CallHandoverForm.js +78 -0
  18. package/lib/components/CallControlPanel/CallHandoverForm.js.map +1 -0
  19. package/lib/components/CallControlPanel/ExternalCTI.d.ts.map +1 -1
  20. package/lib/components/CallControlPanel/ExternalCTI.js +1 -1
  21. package/lib/components/CallControlPanel/ExternalCTI.js.map +1 -1
  22. package/lib/components/CallControlPanel/FloatingPanel.d.ts +1 -1
  23. package/lib/components/CallControlPanel/FloatingPanel.d.ts.map +1 -1
  24. package/lib/components/CallControlPanel/FloatingPanel.js +2 -2
  25. package/lib/components/CallControlPanel/FloatingPanel.js.map +1 -1
  26. package/lib/components/CallControlPanel/index.d.ts +1 -2
  27. package/lib/components/CallControlPanel/index.d.ts.map +1 -1
  28. package/lib/components/CallControlPanel/index.js +0 -1
  29. package/lib/components/CallControlPanel/index.js.map +1 -1
  30. package/package.json +3 -3
  31. package/lib/components/CallControlPanel/CallTransfer.d.ts +0 -19
  32. package/lib/components/CallControlPanel/CallTransfer.d.ts.map +0 -1
  33. package/lib/components/CallControlPanel/CallTransfer.js +0 -121
  34. package/lib/components/CallControlPanel/CallTransfer.js.map +0 -1
  35. package/lib/components/CallControlPanel/DTMFKeypad.d.ts +0 -11
  36. package/lib/components/CallControlPanel/DTMFKeypad.d.ts.map +0 -1
  37. package/lib/components/CallControlPanel/DTMFKeypad.js +0 -23
  38. package/lib/components/CallControlPanel/DTMFKeypad.js.map +0 -1
@@ -1 +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"]}
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 interface 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 onHangUp?: (id: CallProps['id'], participantId: CallParticipant['id']) => void;\n}\n\nexport interface TransferReasonOption {\n id: string;\n label: string;\n}\n\nexport interface TransferData {\n /** Selected reason option identifier. */\n reason?: TransferReasonOption['id'];\n /** Transfer comments. */\n comments?: string;\n /** Flag determining where interaction should be transferred along the call. */\n interaction: boolean;\n /** Phone number to transfer the call to. */\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'], transferData: TransferData) => void;\n /** Callback fired when 'Conference' action has been clicked. */\n onConferenceAction?: (id: CallProps['id'], transferData: TransferData) => 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 /** Callback fired when 'Transfer' action has been clicked. */\n onHandOffCall?: (id: CallProps['id']) => void;\n /** Callback fired when the user ends the call. */\n onEndCall?: (id: CallProps['id']) => void;\n /**\n * Transfer reason options\n */\n transferOptions: Readonly<TransferReasonOption[]>;\n}\n\nexport type UserAvailabilityStatus = 'available' | 'unavailable' | 'busy' | 'after_work' | 'logout';\n\nexport interface UserAvailabilityStatusOption {\n readonly id: string;\n readonly label: string;\n readonly status: UserAvailabilityStatus;\n readonly disabled?: boolean;\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"]}
@@ -7,18 +7,18 @@ import * as headsetIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/
7
7
  import * as eyeOffSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/eye-off-solid.icon';
8
8
  registerIcon(headsetIcon, eyeOffSolidIcon);
9
9
  const colorMapping = {
10
- offline: 'slate-light',
10
+ unavailable: 'slate-light',
11
11
  available: 'green-light',
12
12
  busy: 'red-medium',
13
- away: 'orange-light',
14
- not_available: 'slate-light'
13
+ after_work: 'orange-light',
14
+ logout: 'slate-light'
15
15
  };
16
16
  const iconMapping = {
17
- offline: 'times',
17
+ unavailable: 'times',
18
18
  available: undefined,
19
19
  busy: 'minus',
20
- away: 'clock',
21
- not_available: 'reset'
20
+ after_work: 'clock',
21
+ logout: 'times'
22
22
  };
23
23
  const StyledStatusIcon = styled.div(({ theme: { base: { colors } }, userStatus }) => {
24
24
  const [colorName, colorVariant] = colorMapping[userStatus].split('-', 2);
@@ -59,14 +59,14 @@ export const StyledCallControlPanelIcon = styled(StyledStatusIcon) `
59
59
  }
60
60
  `;
61
61
  StyledCallControlPanelIcon.defaultProps = defaultThemeProp;
62
- export const UserStatusIcon = memo(({ status = 'offline', variant }) => {
62
+ export const UserStatusIcon = memo(({ status = 'logout', variant }) => {
63
63
  const { base: { colors } } = useTheme();
64
64
  const [colorName, colorVariant] = colorMapping[status].split('-', 2);
65
65
  const bgColor = colors[colorName][colorVariant];
66
66
  const iconName = iconMapping[status];
67
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 }) })) : (_jsx(StyledStatusIcon, { as: StyledUserStatusIcon, userStatus: status, children: iconName && _jsx(Icon, { name: iconName }) }));
68
68
  });
69
- const CallControlPanelIcon = memo(({ status = 'offline', label, panelVisible, ...restProps }) => {
69
+ const CallControlPanelIcon = memo(({ status = 'logout', label, panelVisible, ...restProps }) => {
70
70
  const iconName = iconMapping[status];
71
71
  return (_jsxs(StyledCallControlPanelIcon, { as: StyledAvatar, ...restProps, size: 'm', userStatus: status, "aria-label": label, children: [_jsx(Icon, { name: 'headset' }), iconName && _jsx(UserStatusIcon, { variant: 'icon', status: status }), !panelVisible && _jsx(Icon, { name: 'eye-off-solid' })] }));
72
72
  });
@@ -1 +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,UAAU,CAAC,CAAC,KAAK,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b,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,GAAI,GAC/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,GAAI,GACpB,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,GAAG,EACtB,QAAQ,IAAI,KAAC,cAAc,IAAC,OAAO,EAAC,MAAM,EAAC,MAAM,EAAE,MAAM,GAAI,EAC7D,CAAC,YAAY,IAAI,KAAC,IAAI,IAAC,IAAI,EAAC,eAAe,GAAG,IACpB,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
+ {"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,CAA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AAC;AAEF,MAAM,oBAAoB,GAAgE,IAAI,CAC5F,CAAC,EAAE,MAAM,GAAG,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,SAAS,EAAE,EAAE,EAAE;IAC3D,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,GAAG,EACtB,QAAQ,IAAI,KAAC,cAAc,IAAC,OAAO,EAAC,MAAM,EAAC,MAAM,EAAE,MAAM,GAAI,EAC7D,CAAC,YAAY,IAAI,KAAC,IAAI,IAAC,IAAI,EAAC,eAAe,GAAG,IACpB,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 unavailable: 'slate-light',\n available: 'green-light',\n busy: 'red-medium',\n after_work: 'orange-light',\n logout: 'slate-light'\n};\n\nconst iconMapping: Record<UserAvailabilityStatus, IconNames | undefined> = {\n unavailable: 'times',\n available: undefined,\n busy: 'minus',\n after_work: 'clock',\n logout: 'times'\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 = 'logout', 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 = 'logout', 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 type { TransferReasonOption, TransferData } from './CallControlPanel.types';
3
+ export interface CallHandoverFormProps {
4
+ /**
5
+ * Callback fired on handover submission.
6
+ * @param transferParam the transfer parameters.
7
+ */
8
+ onSubmit: (transferParam: TransferData) => void;
9
+ /** Callback fired on clicking Cancel button. */
10
+ onCancel: () => void;
11
+ /** Transfer reason options. */
12
+ transferOptions: Readonly<TransferReasonOption[]>;
13
+ /** Reference to the root component. */
14
+ ref?: Ref<HTMLDivElement>;
15
+ }
16
+ export declare const StyledCallHandoverForm: import("styled-components").StyledComponent<import("react").FC<import("@pega/cosmos-react-core").FormProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
17
+ declare const CallHandoverForm: FunctionComponent<CallHandoverFormProps>;
18
+ export default CallHandoverForm;
19
+ //# sourceMappingURL=CallHandoverForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CallHandoverForm.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallHandoverForm.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,GAAG,EAAkC,MAAM,OAAO,CAAC;AAmB3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAW,MAAM,0BAA0B,CAAC;AAK5F,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,QAAQ,EAAE,CAAC,aAAa,EAAE,YAAY,KAAK,IAAI,CAAC;IAChD,gDAAgD;IAChD,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,+BAA+B;IAC/B,eAAe,EAAE,QAAQ,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAClD,uCAAuC;IACvC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,sBAAsB,oNAElC,CAAC;AAIF,QAAA,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,qBAAqB,CAmI9D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,78 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useContext, useState, useMemo } from 'react';
3
+ import styled from 'styled-components';
4
+ import { Button, Icon, registerIcon, defaultThemeProp, useI18n, RadioButtonGroup, RadioButton, TextArea, ComboBox, Form, createStringMatcher } from '@pega/cosmos-react-core';
5
+ import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
6
+ import { ContactsContext } from './CalleePicker';
7
+ registerIcon(timesIcon);
8
+ export const StyledCallHandoverForm = styled(Form) `
9
+ min-width: 50ch;
10
+ `;
11
+ StyledCallHandoverForm.defaultProps = defaultThemeProp;
12
+ const CallHandoverForm = ({ onCancel: onClose, onSubmit: onTransferCall, transferOptions }) => {
13
+ const t = useI18n();
14
+ const { contacts } = useContext(ContactsContext);
15
+ const [selectedReason, setSelectedReason] = useState();
16
+ const [selectedContact, setSelectedContact] = useState();
17
+ const [filterValue, setFilterValue] = useState('');
18
+ const [comments, setComments] = useState('');
19
+ const [interaction, setInteraction] = useState(true);
20
+ const contactsToRender = useMemo(() => {
21
+ let items = contacts;
22
+ if (filterValue) {
23
+ const matcher = createStringMatcher(filterValue, 'boundary');
24
+ items = items.filter(item => matcher.test(item.primary) || matcher.test(item.phoneNumber));
25
+ }
26
+ return items.map(({ phoneNumber, primary, secondary, favorite }) => ({
27
+ id: phoneNumber,
28
+ primary,
29
+ secondary: [secondary],
30
+ visual: _jsx(Icon, { name: favorite ? 'star-solid' : 'star' }),
31
+ selected: phoneNumber === selectedContact?.phoneNumber
32
+ }));
33
+ }, [filterValue, selectedContact, contacts]);
34
+ const clearSelection = () => {
35
+ setSelectedContact(undefined);
36
+ };
37
+ return (_jsxs(Form, { as: StyledCallHandoverForm, actions: _jsxs(_Fragment, { children: [_jsx(Button, { variant: 'secondary', onClick: onClose, children: t('cancel') }), _jsx(Button, { variant: 'primary', disabled: !(selectedContact && (!interaction || (selectedReason && comments))), onClick: () => {
38
+ if (!selectedContact)
39
+ return;
40
+ onTransferCall({
41
+ reason: selectedReason?.id,
42
+ comments,
43
+ interaction,
44
+ phoneNumber: selectedContact.phoneNumber
45
+ });
46
+ }, children: t('submit') })] }), children: [_jsxs(RadioButtonGroup, { name: t('call_panel_handover_call_option_label'), children: [_jsx(RadioButton, { label: t('call_panel_handover_call_and_interaction_option'), defaultChecked: true, onChange: () => setInteraction(true) }), _jsx(RadioButton, { label: t('call_panel_handover_call_only_option'), onChange: () => setInteraction(false) })] }), _jsx(ComboBox, { label: t('call_panel_handover_reason_label'), required: interaction, disabled: !interaction, selected: {
47
+ items: selectedReason ? { id: selectedReason.id, text: selectedReason.label } : undefined
48
+ }, menu: {
49
+ items: transferOptions.map(({ id, label }) => ({
50
+ id,
51
+ primary: label,
52
+ selected: id === selectedReason?.id
53
+ })),
54
+ onItemClick: id => setSelectedReason(transferOptions.find(option => option.id === id))
55
+ } }), _jsx(TextArea, { name: 'comments', required: interaction, disabled: !interaction, label: t('call_panel_handover_comments_label'), displayCharCount: true, maxLength: 300, value: comments, onChange: (e) => setComments(e.target.value) }), _jsx(ComboBox, { label: t('call_panel_handover_to_label'), required: true, selected: selectedContact
56
+ ? {
57
+ items: {
58
+ id: selectedContact.phoneNumber,
59
+ text: selectedContact.primary
60
+ }
61
+ }
62
+ : undefined, value: filterValue, onChange: (e) => {
63
+ if (!e.target.value)
64
+ clearSelection();
65
+ setFilterValue(e.target.value);
66
+ }, onBlur: () => {
67
+ setFilterValue('');
68
+ }, menu: {
69
+ items: contactsToRender,
70
+ onItemClick: phoneNumber => {
71
+ setFilterValue('');
72
+ setSelectedContact(contacts.find(contact => contact.phoneNumber === phoneNumber));
73
+ },
74
+ emptyText: t('no_items')
75
+ } })] }));
76
+ };
77
+ export default CallHandoverForm;
78
+ //# sourceMappingURL=CallHandoverForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CallHandoverForm.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallHandoverForm.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA0B,QAAQ,EAAE,OAAO,EAAe,MAAM,OAAO,CAAC;AAC3F,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EACL,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,mBAAmB,EAEpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAG1F,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,YAAY,CAAC,SAAS,CAAC,CAAC;AAgBxB,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAEjD,CAAC;AAEF,sBAA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H,CAAC,CAAC,SAAS,EAEf,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,CAAC,CAAgC,EAAE,EAAE;oBAC7C,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK;wBAAE,cAAc,EAAE,CAAC;oBACtC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACjC,CAAC,EACD,MAAM,EAAE,GAAG,EAAE;oBACX,cAAc,CAAC,EAAE,CAAC,CAAC;gBACrB,CAAC,EACD,IAAI,EAAE;oBACJ,KAAK,EAAE,gBAAgB;oBACvB,WAAW,EAAE,WAAW,CAAC,EAAE;wBACzB,cAAc,CAAC,EAAE,CAAC,CAAC;wBACnB,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC;oBACpF,CAAC;oBACD,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC;iBACzB,GACD,IACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { useContext, FunctionComponent, Ref, useState, useMemo, ChangeEvent } from 'react';\nimport styled from 'styled-components';\n\nimport {\n Button,\n Icon,\n registerIcon,\n defaultThemeProp,\n useI18n,\n RadioButtonGroup,\n RadioButton,\n TextArea,\n ComboBox,\n Form,\n createStringMatcher,\n MenuProps\n} from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\n\nimport type { TransferReasonOption, TransferData, Contact } from './CallControlPanel.types';\nimport { ContactsContext } from './CalleePicker';\n\nregisterIcon(timesIcon);\n\nexport interface CallHandoverFormProps {\n /**\n * Callback fired on handover submission.\n * @param transferParam the transfer parameters.\n */\n onSubmit: (transferParam: TransferData) => void;\n /** Callback fired on clicking Cancel button. */\n onCancel: () => void;\n /** Transfer reason options. */\n transferOptions: Readonly<TransferReasonOption[]>;\n /** Reference to the root component. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledCallHandoverForm = styled(Form)`\n min-width: 50ch;\n`;\n\nStyledCallHandoverForm.defaultProps = defaultThemeProp;\n\nconst CallHandoverForm: FunctionComponent<CallHandoverFormProps> = ({\n onCancel: onClose,\n onSubmit: onTransferCall,\n transferOptions\n}: CallHandoverFormProps) => {\n const t = useI18n();\n const { contacts } = useContext(ContactsContext);\n const [selectedReason, setSelectedReason] = useState<TransferReasonOption>();\n const [selectedContact, setSelectedContact] = useState<Contact>();\n const [filterValue, setFilterValue] = useState('');\n const [comments, setComments] = useState('');\n const [interaction, setInteraction] = useState(true);\n\n const contactsToRender = useMemo<MenuProps['items']>(() => {\n let items = contacts;\n if (filterValue) {\n const matcher = createStringMatcher(filterValue, 'boundary');\n items = items.filter(item => matcher.test(item.primary) || matcher.test(item.phoneNumber));\n }\n\n return items.map(({ phoneNumber, primary, secondary, favorite }) => ({\n id: phoneNumber,\n primary,\n secondary: [secondary],\n visual: <Icon name={favorite ? 'star-solid' : 'star'} />,\n selected: phoneNumber === selectedContact?.phoneNumber\n }));\n }, [filterValue, selectedContact, contacts]);\n\n const clearSelection = () => {\n setSelectedContact(undefined);\n };\n\n return (\n <Form\n as={StyledCallHandoverForm}\n actions={\n <>\n <Button variant='secondary' onClick={onClose}>\n {t('cancel')}\n </Button>\n <Button\n variant='primary'\n disabled={!(selectedContact && (!interaction || (selectedReason && comments)))}\n onClick={() => {\n if (!selectedContact) return;\n onTransferCall({\n reason: selectedReason?.id,\n comments,\n interaction,\n phoneNumber: selectedContact.phoneNumber\n });\n }}\n >\n {t('submit')}\n </Button>\n </>\n }\n >\n <RadioButtonGroup name={t('call_panel_handover_call_option_label')}>\n <RadioButton\n label={t('call_panel_handover_call_and_interaction_option')}\n defaultChecked\n onChange={() => setInteraction(true)}\n />\n <RadioButton\n label={t('call_panel_handover_call_only_option')}\n onChange={() => setInteraction(false)}\n />\n </RadioButtonGroup>\n\n <ComboBox\n label={t('call_panel_handover_reason_label')}\n required={interaction}\n disabled={!interaction}\n selected={{\n items: selectedReason ? { id: selectedReason.id, text: selectedReason.label } : undefined\n }}\n menu={{\n items: transferOptions.map(({ id, label }) => ({\n id,\n primary: label,\n selected: id === selectedReason?.id\n })),\n onItemClick: id => setSelectedReason(transferOptions.find(option => option.id === id))\n }}\n />\n\n <TextArea\n name='comments'\n required={interaction}\n disabled={!interaction}\n label={t('call_panel_handover_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_handover_to_label')}\n required\n selected={\n selectedContact\n ? {\n items: {\n id: selectedContact.phoneNumber,\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: contactsToRender,\n onItemClick: phoneNumber => {\n setFilterValue('');\n setSelectedContact(contacts.find(contact => contact.phoneNumber === phoneNumber));\n },\n emptyText: t('no_items')\n }}\n />\n </Form>\n );\n};\n\nexport default CallHandoverForm;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalCTI.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/ExternalCTI.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAG3F,OAAO,EAAoB,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIzE,MAAM,WAAW,gBAAgB;IAC/B,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,IAAI,CAAC,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,kCAAkC;IAClC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAgCD,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CAyBnE,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"ExternalCTI.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/ExternalCTI.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,iBAAiB,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAG3F,OAAO,EAAoB,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIzE,MAAM,WAAW,gBAAgB;IAC/B,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,oCAAoC;IACpC,IAAI,CAAC,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,kCAAkC;IAClC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAgCD,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,GAAG,YAAY,CAqBnE,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -22,7 +22,7 @@ const StyledCTIContainer = styled.div `
22
22
  `;
23
23
  StyledCTIContainer.defaultProps = defaultThemeProp;
24
24
  const ExternalCTI = forwardRef(({ heading, draggable = false, size }, ref) => {
25
- return (_jsx(StyledExternalCTIPanel, { heading: heading, draggable: draggable, content: _jsx(StyledCTIContainer, { style: size
25
+ return (_jsx(StyledExternalCTIPanel, { heading: heading, draggable: draggable, children: _jsx(StyledCTIContainer, { style: size
26
26
  ? {
27
27
  '--cti-container-width': `${size.width}px`,
28
28
  '--cti-container-height': `${size.height}px`
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalCTI.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/ExternalCTI.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAiB,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC3F,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAgB,MAAM,yBAAyB,CAAC;AAEzE,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAgB5C,MAAM,sBAAsB,GAAG,MAAM,CAAC,aAAa,CAAC,CAClD,CAAC,EACC,KAAK,EAAE,EACL,UAAU,EAAE,EACV,IAAI,EAAE,EAAE,eAAe,EAAE,YAAY,EAAE,EACxC,EACF,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;;;;;mCAKqB,YAAY;iCACd,YAAY;;KAExC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEvD,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIpC,CAAC;AAEF,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEnD,MAAM,WAAW,GAAuD,UAAU,CAChF,CACE,EAAE,OAAO,EAAE,SAAS,GAAG,KAAK,EAAE,IAAI,EAAqC,EACvE,GAA4B,EAC5B,EAAE;IACF,OAAO,CACL,KAAC,sBAAsB,IACrB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,OAAO,EACL,KAAC,kBAAkB,IACjB,KAAK,EACH,IAAI;gBACF,CAAC,CAAE;oBACC,uBAAuB,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI;oBAC1C,wBAAwB,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI;iBAC3B;gBACrB,CAAC,CAAC,SAAS,EAEf,GAAG,EAAE,GAAG,GACR,GAEJ,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { CSSProperties, forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp, ForwardProps } from '@pega/cosmos-react-core';\n\nimport FloatingPanel from './FloatingPanel';\n\nexport interface ExternalCTIProps {\n /** The heading rendered. */\n heading: string;\n /** If true, the component will be draggable. */\n draggable?: boolean;\n /** Container element size in px. */\n size?: {\n width: number;\n height: number;\n };\n /** Reference to the container. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledExternalCTIPanel = styled(FloatingPanel)(\n ({\n theme: {\n components: {\n card: { 'border-radius': borderRadius }\n }\n }\n }) => {\n return css`\n width: auto;\n iframe {\n border: transparent;\n display: block;\n border-end-start-radius: ${borderRadius};\n border-end-end-radius: ${borderRadius};\n }\n `;\n }\n);\n\nStyledExternalCTIPanel.defaultProps = defaultThemeProp;\n\nconst StyledCTIContainer = styled.div`\n width: var(--cti-container-width, auto);\n height: var(--cti-container-height, auto);\n overflow-y: auto;\n`;\n\nStyledCTIContainer.defaultProps = defaultThemeProp;\n\nconst ExternalCTI: FunctionComponent<ExternalCTIProps & ForwardProps> = forwardRef(\n (\n { heading, draggable = false, size }: PropsWithoutRef<ExternalCTIProps>,\n ref: ExternalCTIProps['ref']\n ) => {\n return (\n <StyledExternalCTIPanel\n heading={heading}\n draggable={draggable}\n content={\n <StyledCTIContainer\n style={\n size\n ? ({\n '--cti-container-width': `${size.width}px`,\n '--cti-container-height': `${size.height}px`\n } as CSSProperties)\n : undefined\n }\n ref={ref}\n />\n }\n />\n );\n }\n);\n\nexport default ExternalCTI;\n"]}
1
+ {"version":3,"file":"ExternalCTI.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/ExternalCTI.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAiB,UAAU,EAA2C,MAAM,OAAO,CAAC;AAC3F,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAgB,MAAM,yBAAyB,CAAC;AAEzE,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAgB5C,MAAM,sBAAsB,GAAG,MAAM,CAAC,aAAa,CAAC,CAClD,CAAC,EACC,KAAK,EAAE,EACL,UAAU,EAAE,EACV,IAAI,EAAE,EAAE,eAAe,EAAE,YAAY,EAAE,EACxC,EACF,EACF,EAAE,EAAE;IACH,OAAO,GAAG,CAAA;;;;;mCAKqB,YAAY;iCACd,YAAY;;KAExC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEvD,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;CAIpC,CAAC;AAEF,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEnD,MAAM,WAAW,GAAuD,UAAU,CAChF,CACE,EAAE,OAAO,EAAE,SAAS,GAAG,KAAK,EAAE,IAAI,EAAqC,EACvE,GAA4B,EAC5B,EAAE;IACF,OAAO,CACL,KAAC,sBAAsB,IAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,YAC5D,KAAC,kBAAkB,IACjB,KAAK,EACH,IAAI;gBACF,CAAC,CAAE;oBACC,uBAAuB,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI;oBAC1C,wBAAwB,EAAE,GAAG,IAAI,CAAC,MAAM,IAAI;iBAC3B;gBACrB,CAAC,CAAC,SAAS,EAEf,GAAG,EAAE,GAAG,GACR,GACqB,CAC1B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { CSSProperties, forwardRef, FunctionComponent, PropsWithoutRef, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp, ForwardProps } from '@pega/cosmos-react-core';\n\nimport FloatingPanel from './FloatingPanel';\n\nexport interface ExternalCTIProps {\n /** The heading rendered. */\n heading: string;\n /** If true, the component will be draggable. */\n draggable?: boolean;\n /** Container element size in px. */\n size?: {\n width: number;\n height: number;\n };\n /** Reference to the container. */\n ref?: Ref<HTMLDivElement>;\n}\n\nconst StyledExternalCTIPanel = styled(FloatingPanel)(\n ({\n theme: {\n components: {\n card: { 'border-radius': borderRadius }\n }\n }\n }) => {\n return css`\n width: auto;\n iframe {\n border: transparent;\n display: block;\n border-end-start-radius: ${borderRadius};\n border-end-end-radius: ${borderRadius};\n }\n `;\n }\n);\n\nStyledExternalCTIPanel.defaultProps = defaultThemeProp;\n\nconst StyledCTIContainer = styled.div`\n width: var(--cti-container-width, auto);\n height: var(--cti-container-height, auto);\n overflow-y: auto;\n`;\n\nStyledCTIContainer.defaultProps = defaultThemeProp;\n\nconst ExternalCTI: FunctionComponent<ExternalCTIProps & ForwardProps> = forwardRef(\n (\n { heading, draggable = false, size }: PropsWithoutRef<ExternalCTIProps>,\n ref: ExternalCTIProps['ref']\n ) => {\n return (\n <StyledExternalCTIPanel heading={heading} draggable={draggable}>\n <StyledCTIContainer\n style={\n size\n ? ({\n '--cti-container-width': `${size.width}px`,\n '--cti-container-height': `${size.height}px`\n } as CSSProperties)\n : undefined\n }\n ref={ref}\n />\n </StyledExternalCTIPanel>\n );\n }\n);\n\nexport default ExternalCTI;\n"]}
@@ -16,7 +16,7 @@ export interface FloatingPanelProps {
16
16
  /** The heading rendered. */
17
17
  heading: string;
18
18
  /** Content of the panel */
19
- content: ReactNode;
19
+ children: ReactNode;
20
20
  /** Action button to be rendered in header */
21
21
  actions?: FloatingPanelActionProps[];
22
22
  /** If true, the component will be draggable */
@@ -1 +1 @@
1
- {"version":3,"file":"FloatingPanel.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/FloatingPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAEjB,SAAS,EACT,GAAG,EAKJ,MAAM,OAAO,CAAC;AAGf,OAAO,EAQL,YAAY,EAGZ,MAAM,EACN,SAAS,EAIV,MAAM,yBAAyB,CAAC;AAYjC,MAAM,WAAW,wBAAyB,SAAQ,YAAY;IAC5D,4EAA4E;IAC5E,EAAE,EAAE,MAAM,CAAC,IA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,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IAC9B,yCAAyC;IACzC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;CACzC;AAED,MAAM,WAAW,kBAAkB;IACjC,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACrC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uCAAuC;IACvC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB;iBACjB,OAAO;;SA8BpB,CAAC;AAIH,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAoEvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -41,7 +41,7 @@ export const StyledFloatingPanel = styled(StyledCard)(({ theme, isCollapsed, isD
41
41
  `;
42
42
  });
43
43
  StyledFloatingPanel.defaultProps = defaultThemeProp;
44
- const FloatingPanel = forwardRef(({ heading, actions = [], draggable, content: cardContent, ...restProps }, ref) => {
44
+ const FloatingPanel = forwardRef(({ heading, actions = [], draggable, children, ...restProps }, ref) => {
45
45
  const t = useI18n();
46
46
  const [collapsed, setCollapsed] = useState(false);
47
47
  const containerRef = useConsolidatedRef(ref);
@@ -57,7 +57,7 @@ const FloatingPanel = forwardRef(({ heading, actions = [], draggable, content: c
57
57
  _jsx(Icon, { name: icon })))), _jsx(Button, { icon: true, variant: 'simple', label: t(collapsed ? 'call_panel_expand' : 'call_panel_collapse'), onClick: () => {
58
58
  resetPopoverToDefaultPosition(containerRef);
59
59
  setCollapsed(state => !state);
60
- }, children: _jsx(Icon, { name: 'caret-down' }) }, 'expand-collapse')] }), children: _jsxs(Flex, { container: { alignItems: 'center', itemGap: 1 }, children: [_jsx(Icon, { name: 'phone-solid' }), _jsx(Text, { variant: 'h3', children: heading })] }) }), cardContent] }));
60
+ }, children: _jsx(Icon, { name: 'caret-down' }) }, 'expand-collapse')] }), children: _jsxs(Flex, { container: { alignItems: 'center', itemGap: 1 }, children: [_jsx(Icon, { name: 'phone-solid' }), _jsx(Text, { variant: 'h3', children: heading })] }) }), children] }));
61
61
  });
62
62
  export default FloatingPanel;
63
63
  //# sourceMappingURL=FloatingPanel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FloatingPanel.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/FloatingPanel.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAEL,UAAU,EAMV,eAAe,EACf,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,UAAU,EACV,MAAM,EACN,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,IAAI,EAEJ,kBAAkB,EAClB,YAAY,EAGZ,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAE1F,YAAY,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AAE5C,MAAM,6BAA6B,GAAG,CAAC,YAAuC,EAAQ,EAAE;IACtF,IAAI,YAAY,IAAI,YAAY,CAAC,OAAO;QACtC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,qBAAqB,CAAC;AACjE,CAAC,CAAC;AA4BF,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,UAAU,CAAC,CAGlD,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE;IACzC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OAAO,EAAE,CAAC,EAAE,aACnD,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,EAC3B,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,OAAO,GAAQ,IAC9B,GACI,EACZ,WAAW,IACP,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n CSSProperties,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n ReactNode,\n Ref,\n RefObject,\n useLayoutEffect,\n useRef,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n CardHeader,\n Button,\n useI18n,\n Icon,\n registerIcon,\n Flex,\n Text,\n ForwardProps,\n useConsolidatedRef,\n useDraggable,\n Action,\n IconNames,\n defaultThemeProp,\n StyledButton,\n StyledCard\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 { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\n\nregisterIcon(caretDownIcon, phoneSolidIcon);\n\nconst resetPopoverToDefaultPosition = (containerRef: RefObject<HTMLDivElement>): void => {\n if (containerRef && containerRef.current)\n containerRef.current.style.transform = 'translate(0px, 0px)';\n};\n\nexport interface FloatingPanelActionProps extends ForwardProps {\n /** A string to uniquely identify this Action within the onClick handler. */\n id: Action['id'];\n /** The text content of the Action. */\n text: Action['text'];\n /** Name of the icon from the cosmos set. */\n icon: IconNames;\n /** Determines if the Action will be disabled. */\n disabled?: Action['disabled'];\n /** Called when the Action is clicked. */\n onClick: NonNullable<Action['onClick']>;\n}\n\nexport interface FloatingPanelProps {\n /** The heading rendered. */\n heading: string;\n /** Content of the panel */\n content: ReactNode;\n /** Action button to be rendered in header */\n actions?: FloatingPanelActionProps[];\n /** If true, the component will be draggable */\n draggable?: boolean;\n /** Reference to the root component. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledFloatingPanel = styled(StyledCard)<{\n isCollapsed: boolean;\n isDraggable?: boolean;\n}>(({ theme, isCollapsed, isDraggable }) => {\n return css`\n max-height: calc(100% - 2rem);\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\nStyledFloatingPanel.defaultProps = defaultThemeProp;\n\nconst FloatingPanel: FunctionComponent<FloatingPanelProps & ForwardProps> = forwardRef(\n (\n {\n heading,\n actions = [],\n draggable,\n content: cardContent,\n ...restProps\n }: PropsWithoutRef<FloatingPanelProps>,\n ref: FloatingPanelProps['ref']\n ) => {\n const t = useI18n();\n const [collapsed, setCollapsed] = useState(false);\n const containerRef = useConsolidatedRef(ref);\n const dragRef = useRef<HTMLDivElement>(null);\n useDraggable(containerRef, dragRef, !collapsed && draggable);\n\n const [headerHeight, setHeaderHeight] = useState(0);\n\n useLayoutEffect(() => {\n if (containerRef.current) {\n setHeaderHeight(containerRef.current.querySelector('header')?.offsetHeight || 0);\n }\n }, [containerRef.current]);\n\n return (\n <Flex\n {...restProps}\n as={StyledFloatingPanel}\n container={{ direction: 'column' }}\n ref={containerRef}\n isCollapsed={collapsed}\n isDraggable={draggable}\n style={{ '--headerHeight': `${headerHeight}px` } as CSSProperties}\n >\n <CardHeader\n ref={dragRef}\n actions={\n <>\n {actions.map(({ id, icon, text, ...restAction }) => (\n <Button {...restAction} icon variant='simple' key={id} label={text}>\n <Icon name={icon} />\n </Button>\n ))}\n <Button\n icon\n variant='simple'\n key='expand-collapse'\n 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}\n </Flex>\n );\n }\n);\n\nexport default FloatingPanel;\n"]}
1
+ {"version":3,"file":"FloatingPanel.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/FloatingPanel.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAEL,UAAU,EAMV,eAAe,EACf,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,UAAU,EACV,MAAM,EACN,OAAO,EACP,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,IAAI,EAEJ,kBAAkB,EAClB,YAAY,EAGZ,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AACrG,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAE1F,YAAY,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AAE5C,MAAM,6BAA6B,GAAG,CAAC,YAAuC,EAAQ,EAAE;IACtF,IAAI,YAAY,IAAI,YAAY,CAAC,OAAO;QACtC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,qBAAqB,CAAC;AACjE,CAAC,CAAC;AA4BF,MAAM,CAAC,MAAM,mBAAmB,GAAG,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AAiB,CAQd,IACR,YAGL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,EAAE,aACnD,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,EAC3B,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,OAAO,GAAQ,IAC9B,GACI,EACZ,QAAQ,IACJ,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n CSSProperties,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n ReactNode,\n Ref,\n RefObject,\n useLayoutEffect,\n useRef,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n CardHeader,\n Button,\n useI18n,\n Icon,\n registerIcon,\n Flex,\n Text,\n ForwardProps,\n useConsolidatedRef,\n useDraggable,\n Action,\n IconNames,\n defaultThemeProp,\n StyledButton,\n StyledCard\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 { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\n\nregisterIcon(caretDownIcon, phoneSolidIcon);\n\nconst resetPopoverToDefaultPosition = (containerRef: RefObject<HTMLDivElement>): void => {\n if (containerRef && containerRef.current)\n containerRef.current.style.transform = 'translate(0px, 0px)';\n};\n\nexport interface FloatingPanelActionProps extends ForwardProps {\n /** A string to uniquely identify this Action within the onClick handler. */\n id: Action['id'];\n /** The text content of the Action. */\n text: Action['text'];\n /** Name of the icon from the cosmos set. */\n icon: IconNames;\n /** Determines if the Action will be disabled. */\n disabled?: Action['disabled'];\n /** Called when the Action is clicked. */\n onClick: NonNullable<Action['onClick']>;\n}\n\nexport interface FloatingPanelProps {\n /** The heading rendered. */\n heading: string;\n /** Content of the panel */\n children: ReactNode;\n /** Action button to be rendered in header */\n actions?: FloatingPanelActionProps[];\n /** If true, the component will be draggable */\n draggable?: boolean;\n /** Reference to the root component. */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledFloatingPanel = styled(StyledCard)<{\n isCollapsed: boolean;\n isDraggable?: boolean;\n}>(({ theme, isCollapsed, isDraggable }) => {\n return css`\n max-height: calc(100% - 2rem);\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\nStyledFloatingPanel.defaultProps = defaultThemeProp;\n\nconst FloatingPanel: FunctionComponent<FloatingPanelProps & ForwardProps> = forwardRef(\n (\n {\n heading,\n actions = [],\n draggable,\n children,\n ...restProps\n }: PropsWithoutRef<FloatingPanelProps>,\n ref: FloatingPanelProps['ref']\n ) => {\n const t = useI18n();\n const [collapsed, setCollapsed] = useState(false);\n const containerRef = useConsolidatedRef(ref);\n const dragRef = useRef<HTMLDivElement>(null);\n useDraggable(containerRef, dragRef, !collapsed && draggable);\n\n const [headerHeight, setHeaderHeight] = useState(0);\n\n useLayoutEffect(() => {\n if (containerRef.current) {\n setHeaderHeight(containerRef.current.querySelector('header')?.offsetHeight || 0);\n }\n }, [containerRef.current]);\n\n return (\n <Flex\n {...restProps}\n as={StyledFloatingPanel}\n container={{ direction: 'column' }}\n ref={containerRef}\n isCollapsed={collapsed}\n isDraggable={draggable}\n style={{ '--headerHeight': `${headerHeight}px` } as CSSProperties}\n >\n <CardHeader\n ref={dragRef}\n actions={\n <>\n {actions.map(({ id, icon, text, ...restAction }) => (\n <Button {...restAction} icon variant='simple' key={id} label={text}>\n <Icon name={icon} />\n </Button>\n ))}\n <Button\n icon\n variant='simple'\n key='expand-collapse'\n 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 {children}\n </Flex>\n );\n }\n);\n\nexport default FloatingPanel;\n"]}
@@ -1,6 +1,5 @@
1
1
  export { default } from './CallControlPanel';
2
- export { CallProps, CallControlPanelProps, UserAvailabilityStatusOption } from './CallControlPanel.types';
2
+ export { CallProps, CallParticipant, CallControlPanelProps, UserAvailabilityStatusOption, TransferData, TransferReasonOption } from './CallControlPanel.types';
3
3
  export { default as CallControlPanelIcon } from './CallControlPanelIcon';
4
- export { default as CalleePicker } from './CalleePicker';
5
4
  export { default as ExternalCTI } from './ExternalCTI';
6
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EACL,SAAS,EACT,qBAAqB,EACrB,4BAA4B,EAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EACL,SAAS,EACT,eAAe,EACf,qBAAqB,EACrB,4BAA4B,EAC5B,YAAY,EACZ,oBAAoB,EACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC"}
@@ -1,5 +1,4 @@
1
1
  export { default } from './CallControlPanel';
2
2
  export { default as CallControlPanelIcon } from './CallControlPanelIcon';
3
- export { default as CalleePicker } from './CalleePicker';
4
3
  export { default as ExternalCTI } from './ExternalCTI';
5
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAM7C,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { default } from './CallControlPanel';\nexport {\n CallProps,\n CallControlPanelProps,\n UserAvailabilityStatusOption\n} from './CallControlPanel.types';\nexport { default as CallControlPanelIcon } from './CallControlPanelIcon';\nexport { default as CalleePicker } from './CalleePicker';\nexport { default as ExternalCTI } from './ExternalCTI';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/CallControlPanel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAS7C,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { default } from './CallControlPanel';\nexport {\n CallProps,\n CallParticipant,\n CallControlPanelProps,\n UserAvailabilityStatusOption,\n TransferData,\n TransferReasonOption\n} from './CallControlPanel.types';\nexport { default as CallControlPanelIcon } from './CallControlPanelIcon';\nexport { default as ExternalCTI } from './ExternalCTI';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-cs",
3
- "version": "3.0.0-dev.12.0",
3
+ "version": "3.0.0-dev.13.0",
4
4
  "author": "Pegasystems",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -20,8 +20,8 @@
20
20
  "build": "tsc -b"
21
21
  },
22
22
  "dependencies": {
23
- "@pega/cosmos-react-core": "3.0.0-dev.12.0",
24
- "@pega/cosmos-react-dnd": "3.0.0-dev.12.0",
23
+ "@pega/cosmos-react-core": "3.0.0-dev.13.0",
24
+ "@pega/cosmos-react-dnd": "3.0.0-dev.13.0",
25
25
  "@types/react": "^16.14.24 || ^17.0.38",
26
26
  "@types/react-dom": "^16.9.14 || ^17.0.11",
27
27
  "@types/styled-components": "^5.1.7",
@@ -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' }) }), children: _jsx(Flex, { container: { alignItems: 'center', itemGap: 1 }, children: _jsx(Text, { variant: 'h3', children: t('call_panel_transfer_call_heading') }) }) }), _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) }), _jsx(RadioButton, { label: t('call_panel_transfer_call_only_option'), id: useUID(), onChange: () => setInteraction(false) })] }), _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
- } }), _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) }), _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
- } })] }), _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') }) })] }));
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,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAC1F,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAG1F,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,YAAY,CAAC,SAAS,CAAC,CAAC;AAgBxB,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AG;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,GAC/B,GACE,IACE,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"]}