@pega/cosmos-react-cs 3.0.0-dev.12.0 → 3.0.0-dev.15.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 (41) 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 +19 -32
  9. package/lib/components/CallControlPanel/CallControlPanel.js.map +1 -1
  10. package/lib/components/CallControlPanel/CallControlPanel.types.d.ts +26 -14
  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.d.ts +0 -4
  14. package/lib/components/CallControlPanel/CallControlPanelIcon.d.ts.map +1 -1
  15. package/lib/components/CallControlPanel/CallControlPanelIcon.js +30 -25
  16. package/lib/components/CallControlPanel/CallControlPanelIcon.js.map +1 -1
  17. package/lib/components/CallControlPanel/CallHandoverForm.d.ts +19 -0
  18. package/lib/components/CallControlPanel/CallHandoverForm.d.ts.map +1 -0
  19. package/lib/components/CallControlPanel/CallHandoverForm.js +78 -0
  20. package/lib/components/CallControlPanel/CallHandoverForm.js.map +1 -0
  21. package/lib/components/CallControlPanel/ExternalCTI.d.ts +3 -0
  22. package/lib/components/CallControlPanel/ExternalCTI.d.ts.map +1 -1
  23. package/lib/components/CallControlPanel/ExternalCTI.js +2 -2
  24. package/lib/components/CallControlPanel/ExternalCTI.js.map +1 -1
  25. package/lib/components/CallControlPanel/FloatingPanel.d.ts +4 -1
  26. package/lib/components/CallControlPanel/FloatingPanel.d.ts.map +1 -1
  27. package/lib/components/CallControlPanel/FloatingPanel.js +12 -5
  28. package/lib/components/CallControlPanel/FloatingPanel.js.map +1 -1
  29. package/lib/components/CallControlPanel/index.d.ts +1 -2
  30. package/lib/components/CallControlPanel/index.d.ts.map +1 -1
  31. package/lib/components/CallControlPanel/index.js +0 -1
  32. package/lib/components/CallControlPanel/index.js.map +1 -1
  33. package/package.json +3 -3
  34. package/lib/components/CallControlPanel/CallTransfer.d.ts +0 -19
  35. package/lib/components/CallControlPanel/CallTransfer.d.ts.map +0 -1
  36. package/lib/components/CallControlPanel/CallTransfer.js +0 -121
  37. package/lib/components/CallControlPanel/CallTransfer.js.map +0 -1
  38. package/lib/components/CallControlPanel/DTMFKeypad.d.ts +0 -11
  39. package/lib/components/CallControlPanel/DTMFKeypad.d.ts.map +0 -1
  40. package/lib/components/CallControlPanel/DTMFKeypad.js +0 -23
  41. package/lib/components/CallControlPanel/DTMFKeypad.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CallControlPanel.types.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallControlPanel.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEpE,oBAAY,OAAO,GAAG;IACpB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,eAAe;IAC9B,iBAAiB;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,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AAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,oCAAoC;IACpC,YAAY,EAAE,OAAO,EAAE,CAAC;IACxB,kEAAkE;IAClE,gBAAgB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACnE,uCAAuC;IACvC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
1
+ {"version":3,"file":"CallControlPanel.types.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallControlPanel.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,MAAM,WAAW,OAAO;IACtB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,iBAAiB;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,aAAa,EAAE,eAAe,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;CAChF;AAED,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,MAAM,CAAC,EAAE,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AAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,oCAAoC;IACpC,YAAY,EAAE,OAAO,EAAE,CAAC;IACxB,kEAAkE;IAClE,gBAAgB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IACnE,qCAAqC;IACrC,OAAO,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACxC,uCAAuC;IACvC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
@@ -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 type { BaseProps, NoChildrenProp } from '@pega/cosmos-react-core';\n\nimport type { FloatingPanelProps } from './FloatingPanel';\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 /** Flag driving panel visibility. */\n visible?: FloatingPanelProps['visible'];\n /** Reference to the root component. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
@@ -1,5 +1,4 @@
1
1
  import { FunctionComponent } from 'react';
2
- import { DefaultTheme } from 'styled-components';
3
2
  import { ForwardProps, NoChildrenProp } from '@pega/cosmos-react-core';
4
3
  import type { UserAvailabilityStatus } from './CallControlPanel.types';
5
4
  interface CallControlPanelIconProps extends NoChildrenProp {
@@ -10,9 +9,6 @@ interface CallControlPanelIconProps extends NoChildrenProp {
10
9
  interface UserStatusIconProps extends Pick<CallControlPanelIconProps, 'status'> {
11
10
  variant: 'icon' | 'dot';
12
11
  }
13
- export declare const StyledCallControlPanelIcon: import("styled-components").StyledComponent<"div", DefaultTheme, {
14
- userStatus: UserAvailabilityStatus;
15
- }, never>;
16
12
  export declare const UserStatusIcon: FunctionComponent<UserStatusIconProps>;
17
13
  declare const CallControlPanelIcon: FunctionComponent<CallControlPanelIconProps & ForwardProps>;
18
14
  export default CallControlPanelIcon;
@@ -1 +1 @@
1
- {"version":3,"file":"CallControlPanelIcon.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallControlPanelIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAQ,MAAM,OAAO,CAAC;AAChD,OAAe,EAAO,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EAEL,YAAY,EAGZ,cAAc,EAKf,MAAM,yBAAyB,CAAC;AAKjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAOvE,UAAU,yBAA0B,SAAQ,cAAc;IACxD,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;CACvB;AAED,UAAU,mBAAoB,SAAQ,IAAI,CAAC,yBAAyB,EAAE,QAAQ,CAAC;IAC7E,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;CACzB;AA2DD,eAAO,MAAM,0BAA0B;gBAzCW,sBAAsB;SAmDvE,CAAC;AAIF,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,CA6BjE,CAAC;AAEF,QAAA,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,yBAAyB,GAAG,YAAY,CAkBrF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"CallControlPanelIcon.d.ts","sourceRoot":"","sources":["../../../src/components/CallControlPanel/CallControlPanelIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAQ,MAAM,OAAO,CAAC;AAIhD,OAAO,EAEL,YAAY,EAGZ,cAAc,EAMf,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;AAgFD,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,CA4BjE,CAAC;AAEF,QAAA,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,yBAAyB,GAAG,YAAY,CAWrF,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
@@ -2,23 +2,23 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { memo } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { readableColor } from 'polished';
5
- import { defaultThemeProp, Icon, registerIcon, StyledAvatar, StyledIcon, useTheme } from '@pega/cosmos-react-core';
5
+ import { defaultThemeProp, Icon, registerIcon, StyledAvatar, StyledIcon, useTheme, VisuallyHiddenText } from '@pega/cosmos-react-core';
6
6
  import * as headsetIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/headset.icon';
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);
@@ -31,12 +31,6 @@ const StyledStatusIcon = styled.div(({ theme: { base: { colors } }, userStatus }
31
31
  });
32
32
  StyledStatusIcon.defaultProps = defaultThemeProp;
33
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
34
  border-radius: 50%;
41
35
  border: 0.0625rem solid black;
42
36
 
@@ -47,28 +41,39 @@ const StyledUserStatusIcon = styled(StyledStatusIcon) `
47
41
  }
48
42
  `;
49
43
  StyledUserStatusIcon.defaultProps = defaultThemeProp;
50
- export const StyledCallControlPanelIcon = styled(StyledStatusIcon) `
51
- > ${StyledIcon}:nth-child(3) {
44
+ const StyledPanelVisibilityIcon = styled(Icon) `
45
+ width: 0.875rem;
46
+ height: 0.875rem;
47
+ fill: ${p => p.theme.base.colors.gray.medium};
48
+ `;
49
+ StyledPanelVisibilityIcon.defaultProps = defaultThemeProp;
50
+ const StyledCallControlPanelIcon = styled(StyledStatusIcon) `
51
+ ${StyledUserStatusIcon}, ${StyledPanelVisibilityIcon} {
52
52
  position: absolute;
53
- inset-block-end: -0.25rem;
54
- inset-inline-end: -0.25rem;
55
- z-index: 1;
56
53
  width: 0.875rem;
57
54
  height: 0.875rem;
58
- fill: ${p => p.theme.base.colors.gray.medium};
55
+ z-index: 1;
56
+ }
57
+
58
+ ${StyledUserStatusIcon} {
59
+ inset-block-start: -0.25rem;
60
+ inset-inline-end: -0.25rem;
61
+ }
62
+
63
+ ${StyledPanelVisibilityIcon} {
64
+ inset-block-end: -0.25rem;
65
+ inset-inline-end: -0.25rem;
59
66
  }
60
67
  `;
61
- StyledCallControlPanelIcon.defaultProps = defaultThemeProp;
62
- export const UserStatusIcon = memo(({ status = 'offline', variant }) => {
68
+ export const UserStatusIcon = memo(({ status = 'logout', variant }) => {
63
69
  const { base: { colors } } = useTheme();
64
70
  const [colorName, colorVariant] = colorMapping[status].split('-', 2);
65
71
  const bgColor = colors[colorName][colorVariant];
66
72
  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 }) })) : (_jsx(StyledStatusIcon, { as: StyledUserStatusIcon, userStatus: status, children: iconName && _jsx(Icon, { name: iconName }) }));
73
+ return variant === 'dot' ? (_jsx("svg", { role: 'presentation', 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(StyledUserStatusIcon, { userStatus: status, children: iconName && _jsx(Icon, { name: iconName }) }));
68
74
  });
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' }), iconName && _jsx(UserStatusIcon, { variant: 'icon', status: status }), !panelVisible && _jsx(Icon, { name: 'eye-off-solid' })] }));
75
+ const CallControlPanelIcon = memo(({ status = 'logout', label, panelVisible, ...restProps }) => {
76
+ return (_jsxs(StyledCallControlPanelIcon, { as: StyledAvatar, ...restProps, size: 'm', userStatus: status, children: [_jsx(Icon, { name: 'headset' }), status !== 'available' && _jsx(UserStatusIcon, { variant: 'icon', status: status }), !panelVisible && _jsx(StyledPanelVisibilityIcon, { name: 'eye-off-solid' }), _jsx(VisuallyHiddenText, { children: label })] }));
72
77
  });
73
78
  export default CallControlPanelIcon;
74
79
  //# sourceMappingURL=CallControlPanelIcon.js.map
@@ -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,E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OAAO,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CACzB,cACE,IAAI,EAAC,KAAK,uBAEV,MAAM,EAAC,MAAM,EACb,KAAK,EAAC,MAAM,EACZ,OAAO,EAAC,WAAW,EACnB,KAAK,EAAC,4BAA4B,YAElC,iBAAQ,EAAE,EAAC,KAAK,EAAC,EAAE,EAAC,KAAK,EAAC,CAAC,EAAC,KAAK,EAAC,IAAI,EAAE,OAAO,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,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,EAAE,OAAO,GAAI,GAC/C,CACP,CAAC,CAAC,CAAC,CACF,KAAC,oBAAoB,IAAC,UAAU,EAAE,MAAM,YACrC,QAAQ,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,QAAQ,GAAI,GAChB,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,oBAAoB,GAAgE,IAAI,CAC5F,CAAC,EAAE,MAAM,GAAG,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,SAAS,EAAE,EAAE,EAAE;IAC3D,OAAO,CACL,MAAC,0BAA0B,IAAC,EAAE,EAAE,YAAY,KAAM,SAAS,EAAE,IAAI,EAAC,GAAG,EAAC,UAAU,EAAE,MAAM,aACtF,KAAC,IAAI,IAAC,IAAI,EAAC,SAAS,GAAG,EACtB,MAAM,KAAK,WAAW,IAAI,KAAC,cAAc,IAAC,OAAO,EAAC,MAAM,EAAC,MAAM,EAAE,MAAM,GAAI,EAC3E,CAAC,YAAY,IAAI,KAAC,yBAAyB,IAAC,IAAI,EAAC,eAAe,GAAG,EACpE,KAAC,kBAAkB,cAAE,KAAK,GAAsB,IACrB,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 VisuallyHiddenText\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 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\nconst StyledPanelVisibilityIcon = styled(Icon)`\n width: 0.875rem;\n height: 0.875rem;\n fill: ${p => p.theme.base.colors.gray.medium};\n`;\n\nStyledPanelVisibilityIcon.defaultProps = defaultThemeProp;\n\nconst StyledCallControlPanelIcon = styled(StyledStatusIcon)`\n ${StyledUserStatusIcon}, ${StyledPanelVisibilityIcon} {\n position: absolute;\n width: 0.875rem;\n height: 0.875rem;\n z-index: 1;\n }\n\n ${StyledUserStatusIcon} {\n inset-block-start: -0.25rem;\n inset-inline-end: -0.25rem;\n }\n\n ${StyledPanelVisibilityIcon} {\n inset-block-end: -0.25rem;\n inset-inline-end: -0.25rem;\n }\n`;\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='presentation'\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 <StyledUserStatusIcon userStatus={status}>\n {iconName && <Icon name={iconName} />}\n </StyledUserStatusIcon>\n );\n }\n);\n\nconst CallControlPanelIcon: FunctionComponent<CallControlPanelIconProps & ForwardProps> = memo(\n ({ status = 'logout', label, panelVisible, ...restProps }) => {\n return (\n <StyledCallControlPanelIcon as={StyledAvatar} {...restProps} size='m' userStatus={status}>\n <Icon name='headset' />\n {status !== 'available' && <UserStatusIcon variant='icon' status={status} />}\n {!panelVisible && <StyledPanelVisibilityIcon name='eye-off-solid' />}\n <VisuallyHiddenText>{label}</VisuallyHiddenText>\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,CAkI9D,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(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,E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KAAK,CAAC,GAC9E,EAEF,KAAC,QAAQ,IACP,KAAK,EAAE,CAAC,CAAC,8BAA8B,CAAC,EACxC,QAAQ,QACR,QAAQ,EACN,eAAe;oBACb,CAAC,CAAC;wBACE,KAAK,EAAE;4BACL,EAAE,EAAE,eAAe,CAAC,WAAW;4BAC/B,IAAI,EAAE,eAAe,CAAC,OAAO;yBAC9B;qBACF;oBACH,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,IACqB,CAC1B,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 <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 </StyledCallHandoverForm>\n );\n};\n\nexport default CallHandoverForm;\n"]}
@@ -1,10 +1,13 @@
1
1
  import { FunctionComponent, Ref } from 'react';
2
2
  import { ForwardProps } from '@pega/cosmos-react-core';
3
+ import { FloatingPanelProps } from './FloatingPanel';
3
4
  export interface ExternalCTIProps {
4
5
  /** The heading rendered. */
5
6
  heading: string;
6
7
  /** If true, the component will be draggable. */
7
8
  draggable?: boolean;
9
+ /** If true, the component will be visible. */
10
+ visible?: FloatingPanelProps['visible'];
8
11
  /** Container element size in px. */
9
12
  size?: {
10
13
  width: number;
@@ -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;AAEzE,OAAsB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEpE,MAAM,WAAW,gBAAgB;IAC/B,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IACxC,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"}
@@ -21,8 +21,8 @@ const StyledCTIContainer = styled.div `
21
21
  overflow-y: auto;
22
22
  `;
23
23
  StyledCTIContainer.defaultProps = defaultThemeProp;
24
- const ExternalCTI = forwardRef(({ heading, draggable = false, size }, ref) => {
25
- return (_jsx(StyledExternalCTIPanel, { heading: heading, draggable: draggable, content: _jsx(StyledCTIContainer, { style: size
24
+ const ExternalCTI = forwardRef(({ heading, draggable = false, visible = true, size }, ref) => {
25
+ return (_jsx(StyledExternalCTIPanel, { heading: heading, draggable: draggable, visible: visible, 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,aAAqC,MAAM,iBAAiB,CAAC;AAkBpE,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,OAAO,GAAG,IAAI,EAAE,IAAI,EAAqC,EACvF,GAA4B,EAC5B,EAAE;IACF,OAAO,CACL,KAAC,sBAAsB,IAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,YAC9E,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, { FloatingPanelProps } 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 /** If true, the component will be visible. */\n visible?: FloatingPanelProps['visible'];\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, visible = true, size }: PropsWithoutRef<ExternalCTIProps>,\n ref: ExternalCTIProps['ref']\n ) => {\n return (\n <StyledExternalCTIPanel heading={heading} draggable={draggable} visible={visible}>\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,17 +16,20 @@ 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 */
23
23
  draggable?: boolean;
24
+ /** If true, the panel is visible. */
25
+ visible?: boolean;
24
26
  /** Reference to the root component. */
25
27
  ref?: Ref<HTMLDivElement>;
26
28
  }
27
29
  export declare const StyledFloatingPanel: import("styled-components").StyledComponent<"article", import("styled-components").DefaultTheme, Partial<import("@pega/cosmos-react-core").CardProps> & {
28
30
  isCollapsed: boolean;
29
31
  isDraggable?: boolean | undefined;
32
+ isVisible?: boolean | undefined;
30
33
  }, never>;
31
34
  declare const FloatingPanel: FunctionComponent<FloatingPanelProps & ForwardProps>;
32
35
  export default FloatingPanel;
@@ -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,MA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IACjD,QAAQ,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,qCAAqC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uCAAuC;IACvC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB;iBACjB,OAAO;;;SAsCpB,CAAC;AAIH,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAoEvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -11,7 +11,7 @@ const resetPopoverToDefaultPosition = (containerRef) => {
11
11
  if (containerRef && containerRef.current)
12
12
  containerRef.current.style.transform = 'translate(0px, 0px)';
13
13
  };
14
- export const StyledFloatingPanel = styled(StyledCard)(({ theme, isCollapsed, isDraggable }) => {
14
+ export const StyledFloatingPanel = styled(StyledCard)(({ theme, isCollapsed, isDraggable, isVisible = true }) => {
15
15
  return css `
16
16
  max-height: calc(100% - 2rem);
17
17
  position: fixed;
@@ -20,12 +20,19 @@ export const StyledFloatingPanel = styled(StyledCard)(({ theme, isCollapsed, isD
20
20
  inset-inline-end: calc(2 * ${theme.base.spacing});
21
21
  bottom: calc(2 * ${theme.base.spacing});
22
22
  box-shadow: ${theme.base.shadow.high};
23
+
24
+ ${!isVisible &&
25
+ css `
26
+ display: none;
27
+ `}
28
+
23
29
  ${isCollapsed &&
24
30
  css `
25
31
  transform: translateY(
26
32
  calc(100% - var(--headerHeight) + calc(2 * ${theme.base.spacing}))
27
33
  ) !important;
28
34
  `}
35
+
29
36
  ${StyledCardHeader} {
30
37
  ${!isCollapsed &&
31
38
  isDraggable &&
@@ -41,7 +48,7 @@ export const StyledFloatingPanel = styled(StyledCard)(({ theme, isCollapsed, isD
41
48
  `;
42
49
  });
43
50
  StyledFloatingPanel.defaultProps = defaultThemeProp;
44
- const FloatingPanel = forwardRef(({ heading, actions = [], draggable, content: cardContent, ...restProps }, ref) => {
51
+ const FloatingPanel = forwardRef(({ heading, actions = [], draggable, children, visible = true, ...restProps }, ref) => {
45
52
  const t = useI18n();
46
53
  const [collapsed, setCollapsed] = useState(false);
47
54
  const containerRef = useConsolidatedRef(ref);
@@ -52,12 +59,12 @@ const FloatingPanel = forwardRef(({ heading, actions = [], draggable, content: c
52
59
  if (containerRef.current) {
53
60
  setHeaderHeight(containerRef.current.querySelector('header')?.offsetHeight || 0);
54
61
  }
55
- }, [containerRef.current]);
56
- return (_jsxs(Flex, { ...restProps, as: StyledFloatingPanel, container: { direction: 'column' }, ref: containerRef, isCollapsed: collapsed, isDraggable: draggable, style: { '--headerHeight': `${headerHeight}px` }, children: [_jsx(CardHeader, { ref: dragRef, actions: _jsxs(_Fragment, { children: [actions.map(({ id, icon, text, ...restAction }) => (_createElement(Button, { ...restAction, icon: true, variant: 'simple', key: id, label: text },
62
+ }, [collapsed]);
63
+ return (_jsxs(StyledFloatingPanel, { ...restProps, ref: containerRef, isCollapsed: collapsed, isDraggable: draggable, isVisible: visible, style: { '--headerHeight': `${headerHeight}px` }, children: [_jsx(CardHeader, { ref: dragRef, actions: _jsxs(_Fragment, { children: [actions.map(({ id, icon, text, ...restAction }) => (_createElement(Button, { ...restAction, icon: true, variant: 'simple', key: id, label: text },
57
64
  _jsx(Icon, { name: icon })))), _jsx(Button, { icon: true, variant: 'simple', label: t(collapsed ? 'call_panel_expand' : 'call_panel_collapse'), onClick: () => {
58
65
  resetPopoverToDefaultPosition(containerRef);
59
66
  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] }));
67
+ }, 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
68
  });
62
69
  export default FloatingPanel;
63
70
  //# 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,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AAI,EAAC,YAAY,GAAG,IAPtB,iBAAiB,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,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,YAA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,CAAC,CAAC;gCAC5C,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;4BAChC,CAAC,YAED,KAAC,IAAI,IAAC,IAAI,EAAC,YAAY,GAAG,IAPtB,iBAAiB,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,IACW,CACvB,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 /** If true, the panel is visible. */\n visible?: 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 isVisible?: boolean;\n}>(({ theme, isCollapsed, isDraggable, isVisible = true }) => {\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\n ${!isVisible &&\n css`\n display: none;\n `}\n\n ${isCollapsed &&\n css`\n transform: translateY(\n calc(100% - var(--headerHeight) + calc(2 * ${theme.base.spacing}))\n ) !important;\n `}\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 visible = true,\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 }, [collapsed]);\n\n return (\n <StyledFloatingPanel\n {...restProps}\n ref={containerRef}\n isCollapsed={collapsed}\n isDraggable={draggable}\n isVisible={visible}\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 </StyledFloatingPanel>\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.15.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.15.0",
24
+ "@pega/cosmos-react-dnd": "3.0.0-dev.15.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