@pega/cosmos-react-social 4.0.0-dev.20.0 → 4.0.0-dev.21.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.
@@ -21,6 +21,12 @@ export interface SuggestedReplyPickerProps {
21
21
  ref?: Ref<HTMLDivElement>;
22
22
  /** Suggested replies */
23
23
  replies?: SuggestedReply[];
24
+ /** Id of the current reply */
25
+ currentReplyId?: SuggestedReply['id'];
26
+ /** Fired when user clicks on left or right buttons
27
+ * @param id Id of the new reply
28
+ */
29
+ onReplyChange: (id: SuggestedReply['id']) => void;
24
30
  /** Current state of the panel */
25
31
  collapsed: boolean;
26
32
  /** Callback for expand or collapse click */
@@ -1 +1 @@
1
- {"version":3,"file":"SuggestedReplyPicker.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/SuggestedReplyPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAmB,GAAG,EAAY,MAAM,OAAO,CAAC;AAGtF,OAAO,EAQL,YAAY,EAMb,MAAM,yBAAyB,CAAC;AAQjC,eAAO,MAAM,0BAA0B,yGAAe,CAAC;AACvD,eAAO,MAAM,2BAA2B,yGAAe,CAAC;AACxD,eAAO,MAAM,WAAW,yGAAe,CAAC;AACxC,eAAO,MAAM,mBAAmB,yGAAe,CAAC;AAChD,eAAO,MAAM,kBAAkB,yGAAe,CAAC;AAI/C,eAAO,MAAM,wBAAwB;;SAqBpC,CAAC;AAoCF,MAAM,WAAW,cAAc;IAC7B,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,yBAAyB;IACzB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,wBAAwB;IACxB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B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E,cAAc,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAClD,iCAAiC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,4CAA4C;IAC5C,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,gEAAgE;IAChE,QAAQ,EAAE,CAAC,cAAc,EAAE,cAAc,KAAK,IAAI,CAAC;IACnD,yCAAyC;IACzC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,QAAA,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,yBAAyB,GAAG,YAAY,CA4KnF,CAAC;AAEJ,eAAe,oBAAoB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useState } from 'react';
2
+ import { forwardRef, useEffect } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { Flex, Icon, registerIcon, Button, Text, useI18n, defaultThemeProp, useLiveLog, ExpandCollapse, Alert, useDirection, EmptyState } from '@pega/cosmos-react-core';
5
5
  import * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';
@@ -59,34 +59,32 @@ const StyledSuggestedReplyContainer = styled.div(props => {
59
59
  });
60
60
  StyledSuggestedReplyContainer.defaultProps = defaultThemeProp;
61
61
  const SuggestedReplyPicker = forwardRef((props, ref) => {
62
- const { replies = [], collapsed, onExpandCollapse, showNotification, onSelect, ...restProps } = props;
62
+ const { replies = [], collapsed, onExpandCollapse, showNotification, onSelect, currentReplyId, onReplyChange, ...restProps } = props;
63
63
  const { announcePolite } = useLiveLog();
64
- const [currentReply, setCurrentReply] = useState(replies[0] ?? null);
65
64
  const t = useI18n();
66
65
  const { rtl, ltr } = useDirection();
67
- // Making the suggested replies left/right button cyclic and SR to announce on change
66
+ // Allows suggested replies to cycle
68
67
  const onSuggestedReplyChange = (mode) => {
69
- setCurrentReply(prevReply => {
70
- if (prevReply) {
71
- const prevReplyIndex = replies.indexOf(prevReply);
72
- const totalReplies = replies.length;
73
- if (totalReplies > 0) {
74
- let replyIndex = mode === 'prev' ? prevReplyIndex - 1 : prevReplyIndex + 1;
75
- replyIndex = (replyIndex + totalReplies) % totalReplies;
76
- announcePolite({
77
- message: `${t('suggested_replies_current_of_total', [
78
- replyIndex + 1,
79
- replies.length
80
- ])},
81
- ${t('confidence_percentage', [replies[replyIndex].confidence])},${replies[replyIndex]?.message}`,
82
- type: 'acknowledgement'
83
- });
84
- return replies[replyIndex];
85
- }
86
- }
87
- return null;
88
- });
68
+ const currentReplyIndex = replies.findIndex(reply => reply.id === currentReplyId);
69
+ let newReplyIndex = mode === 'prev' ? currentReplyIndex - 1 : currentReplyIndex + 1;
70
+ newReplyIndex = (newReplyIndex + replies.length) % replies.length;
71
+ onReplyChange(replies[newReplyIndex].id);
89
72
  };
73
+ // SR announcement when current reply changes
74
+ useEffect(() => {
75
+ if (!replies || replies.length === 0 || !currentReplyId) {
76
+ return;
77
+ }
78
+ const currentReplyIndex = replies.findIndex(reply => reply.id === currentReplyId);
79
+ announcePolite({
80
+ message: `${t('suggested_replies_current_of_total', [
81
+ currentReplyIndex + 1,
82
+ replies.length
83
+ ])},
84
+ ${t('confidence_percentage', [replies[currentReplyIndex]?.confidence])},${replies[currentReplyIndex]?.message}`,
85
+ type: 'acknowledgement'
86
+ });
87
+ }, [currentReplyId]);
90
88
  return (_jsxs(StyledSuggestedReplyContainer, { ref: ref, ...restProps, children: [_jsx(Flex, { as: StyledSuggestedReplyHeader, container: {
91
89
  justify: 'between',
92
90
  alignContent: 'center'
@@ -96,24 +94,24 @@ const SuggestedReplyPicker = forwardRef((props, ref) => {
96
94
  }, children: [ltr && (_jsx(Button, { variant: 'simple', label: collapsed ? t('expand') : t('collapse'), "aria-label": t(collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'), icon: true, onClick: onExpandCollapse, children: _jsx(Icon, { name: 'caret-down', suggestedReplyCollapsed: collapsed, as: StyledSuggestedReplyIcon }) })), _jsxs(Flex, { container: { gap: 0.5 }, children: [_jsx(Text, { variant: 'h3', children: t('suggested_replies') }), collapsed && showNotification && _jsx(Alert, { variant: 'urgent' })] }), rtl && (_jsx(Button, { variant: 'simple', label: collapsed ? t('expand') : t('collapse'), "aria-label": t(collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'), icon: true, onClick: onExpandCollapse, children: _jsx(Icon, { name: 'caret-down', suggestedReplyCollapsed: collapsed, as: StyledSuggestedReplyIcon }) }))] }) }), _jsx(ExpandCollapse, { dimension: 'height', collapsed: collapsed, nullWhenCollapsed: true, children: _jsxs(Flex, { container: {
97
95
  direction: 'column',
98
96
  gap: 1
99
- }, as: StyledSuggestedReplyContent, children: [currentReply && replies.length ? (_jsx(Flex, { container: true, as: StyledReply, children: currentReply.message })) : (_jsx(EmptyState, {})), _jsxs(Flex, { container: {
97
+ }, as: StyledSuggestedReplyContent, children: [currentReplyId && replies.length ? (_jsx(Flex, { container: true, as: StyledReply, children: replies.find(reply => reply.id === currentReplyId)?.message })) : (_jsx(EmptyState, {})), _jsxs(Flex, { container: {
100
98
  justify: 'center'
101
- }, as: StyledRepliesAction, children: [replies.length > 1 && (_jsx(Button, { icon: true, "aria-label": t('prev_suggested_reply'), variant: 'simple', disabled: currentReply === null || replies.length <= 1, onClick: () => {
99
+ }, as: StyledRepliesAction, children: [replies.length > 1 && (_jsx(Button, { icon: true, "aria-label": t('prev_suggested_reply'), variant: 'simple', disabled: currentReplyId === undefined || replies.length <= 1, onClick: () => {
102
100
  onSuggestedReplyChange('prev');
103
- }, children: _jsx(Icon, { name: 'caret-left' }) })), _jsx(Button, { disabled: currentReply === null, onClick: () => {
104
- if (currentReply) {
105
- onSelect(currentReply);
106
- }
107
- }, "aria-label": replies.length > 0 && currentReply
101
+ }, children: _jsx(Icon, { name: 'caret-left' }) })), _jsx(Button, { disabled: currentReplyId === undefined || !replies || replies.length === 0, onClick: () => {
102
+ const selectedReply = replies.find(reply => reply.id === currentReplyId);
103
+ if (selectedReply)
104
+ onSelect(selectedReply);
105
+ }, "aria-label": replies.length > 0 && currentReplyId
108
106
  ? t('use_current_template', [
109
- replies.length > 0 && currentReply
110
- ? replies.indexOf(currentReply) + 1
107
+ replies.length > 0 && currentReplyId
108
+ ? replies.findIndex(reply => reply.id === currentReplyId) + 1
111
109
  : 0,
112
110
  replies.length
113
111
  ])
114
112
  : '', children: t('use') }), replies.length > 1 && (_jsx(Button, { icon: true, "aria-label": t('next_suggested_reply'), variant: 'simple', onClick: () => {
115
113
  onSuggestedReplyChange('next');
116
- }, disabled: currentReply === null || replies.length <= 1, children: _jsx(Icon, { name: 'caret-right' }) }))] })] }) })] }));
114
+ }, disabled: currentReplyId === undefined || replies.length <= 1, children: _jsx(Icon, { name: 'caret-right' }) }))] })] }) })] }));
117
115
  });
118
116
  export default SuggestedReplyPicker;
119
117
  //# sourceMappingURL=SuggestedReplyPicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SuggestedReplyPicker.js","sourceRoot":"","sources":["../../../src/components/Chat/SuggestedReplyPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,IAAI,EACJ,OAAO,EACP,gBAAgB,EAEhB,UAAU,EACV,cAAc,EACd,KAAK,EACL,YAAY,EACZ,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAC1F,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AACrG,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAElF,YAAY,CAAC,SAAS,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;AAEvD,MAAM,CAAC,MAAM,0B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useState } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Icon,\n registerIcon,\n Button,\n Text,\n useI18n,\n defaultThemeProp,\n ForwardProps,\n useLiveLog,\n ExpandCollapse,\n Alert,\n useDirection,\n EmptyState\n} from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';\nimport { StyledAlert } from '@pega/cosmos-react-core/lib/components/Badges/Alert';\n\nregisterIcon(timesIcon, caretLeftIcon, caretRightIcon);\n\nexport const StyledSuggestedReplyHeader = styled.div``;\nexport const StyledSuggestedReplyContent = styled.div``;\nexport const StyledReply = styled.div``;\nexport const StyledRepliesAction = styled.div``;\nexport const StyledNotification = styled.div``;\nconst maxNumOfLines = 5;\nconst minNumOfLines = 2;\n\nexport const StyledSuggestedReplyIcon = styled.svg<{ suggestedReplyCollapsed?: boolean }>(\n ({ suggestedReplyCollapsed, theme }) => {\n const { rtl } = useDirection();\n const {\n base: {\n animation: {\n speed,\n timing: { ease }\n }\n }\n } = theme;\n return css`\n transition-property: transform;\n transition-duration: ${speed};\n transition-timing-function: ${ease};\n ${suggestedReplyCollapsed &&\n css`\n transform: rotateZ(${rtl ? '0deg' : '-90deg'});\n `}\n `;\n }\n);\n\nStyledSuggestedReplyIcon.defaultProps = defaultThemeProp;\n\nconst StyledSuggestedReplyContainer = styled.div(props => {\n const { theme } = props;\n return css`\n border-top: 0.0625rem solid ${theme.base.palette['border-line']};\n background-color: ${theme.base.palette['primary-background']};\n\n > ${StyledSuggestedReplyHeader} {\n padding: ${theme.base.spacing};\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n\n ${StyledAlert} {\n position: relative;\n inset-block-start: calc(-0.25 * ${theme.base.spacing});\n inset-inline-start: calc(-0.5 * ${theme.base.spacing});\n }\n\n ${StyledSuggestedReplyContent} {\n padding: calc(2 * ${theme.base.spacing});\n position: relative;\n\n > ${StyledReply} {\n overflow-y: auto;\n max-height: calc(2.5 * ${theme.base.spacing} * ${maxNumOfLines});\n min-height: calc(2.5 * ${theme.base.spacing} * ${minNumOfLines});\n }\n }\n `;\n});\n\nStyledSuggestedReplyContainer.defaultProps = defaultThemeProp;\n\nexport interface SuggestedReply {\n /** Id for this suggested reply */\n id: string;\n /** Suggested reply message */\n message: string;\n /** Confidence of this suggested reply */\n confidence: number;\n}\n\nexport interface SuggestedReplyPickerProps {\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Suggested replies */\n replies?: SuggestedReply[];\n /** Current state of the panel */\n collapsed: boolean;\n /** Callback for expand or collapse click */\n onExpandCollapse: () => void;\n /** Callback for the event when a suggested reply is selected */\n onSelect: (suggestedReply: SuggestedReply) => void;\n /** Show notification on picker header */\n showNotification?: boolean;\n}\n\nconst SuggestedReplyPicker: FunctionComponent<SuggestedReplyPickerProps & ForwardProps> =\n forwardRef(\n (props: PropsWithoutRef<SuggestedReplyPickerProps>, ref: SuggestedReplyPickerProps['ref']) => {\n const {\n replies = [],\n collapsed,\n onExpandCollapse,\n showNotification,\n onSelect,\n ...restProps\n } = props;\n const { announcePolite } = useLiveLog();\n const [currentReply, setCurrentReply] = useState<SuggestedReply | null>(replies[0] ?? null);\n const t = useI18n();\n const { rtl, ltr } = useDirection();\n\n // Making the suggested replies left/right button cyclic and SR to announce on change\n const onSuggestedReplyChange = (mode: 'prev' | 'next') => {\n setCurrentReply(prevReply => {\n if (prevReply) {\n const prevReplyIndex = replies.indexOf(prevReply);\n const totalReplies = replies.length;\n if (totalReplies > 0) {\n let replyIndex = mode === 'prev' ? prevReplyIndex - 1 : prevReplyIndex + 1;\n replyIndex = (replyIndex + totalReplies) % totalReplies;\n\n announcePolite({\n message: `${t('suggested_replies_current_of_total', [\n replyIndex + 1,\n replies.length\n ])},\n ${t('confidence_percentage', [replies[replyIndex].confidence])},${\n replies[replyIndex]?.message\n }`,\n type: 'acknowledgement'\n });\n return replies[replyIndex];\n }\n }\n return null;\n });\n };\n\n return (\n <StyledSuggestedReplyContainer ref={ref} {...restProps}>\n <Flex\n as={StyledSuggestedReplyHeader}\n container={{\n justify: 'between',\n alignContent: 'center'\n }}\n >\n <Flex\n container={{\n alignItems: 'center',\n gap: 1\n }}\n >\n {ltr && (\n <Button\n variant='simple'\n label={collapsed ? t('expand') : t('collapse')}\n aria-label={t(\n collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'\n )}\n icon\n onClick={onExpandCollapse}\n >\n <Icon\n name='caret-down'\n suggestedReplyCollapsed={collapsed}\n as={StyledSuggestedReplyIcon}\n />\n </Button>\n )}\n\n <Flex container={{ gap: 0.5 }}>\n <Text variant='h3'>{t('suggested_replies')}</Text>\n {collapsed && showNotification && <Alert variant='urgent' />}\n </Flex>\n\n {rtl && (\n <Button\n variant='simple'\n label={collapsed ? t('expand') : t('collapse')}\n aria-label={t(\n collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'\n )}\n icon\n onClick={onExpandCollapse}\n >\n <Icon\n name='caret-down'\n suggestedReplyCollapsed={collapsed}\n as={StyledSuggestedReplyIcon}\n />\n </Button>\n )}\n </Flex>\n </Flex>\n <ExpandCollapse dimension='height' collapsed={collapsed} nullWhenCollapsed>\n <Flex\n container={{\n direction: 'column',\n gap: 1\n }}\n as={StyledSuggestedReplyContent}\n >\n {currentReply && replies.length ? (\n <Flex container as={StyledReply}>\n {currentReply.message}\n </Flex>\n ) : (\n <EmptyState />\n )}\n <Flex\n container={{\n justify: 'center'\n }}\n as={StyledRepliesAction}\n >\n {replies.length > 1 && (\n <Button\n icon\n aria-label={t('prev_suggested_reply')}\n variant='simple'\n disabled={currentReply === null || replies.length <= 1}\n onClick={() => {\n onSuggestedReplyChange('prev');\n }}\n >\n <Icon name='caret-left' />\n </Button>\n )}\n <Button\n disabled={currentReply === null}\n onClick={() => {\n if (currentReply) {\n onSelect(currentReply);\n }\n }}\n aria-label={\n replies.length > 0 && currentReply\n ? t('use_current_template', [\n replies.length > 0 && currentReply\n ? replies.indexOf(currentReply) + 1\n : 0,\n replies.length\n ])\n : ''\n }\n >\n {t('use')}\n </Button>\n {replies.length > 1 && (\n <Button\n icon\n aria-label={t('next_suggested_reply')}\n variant='simple'\n onClick={() => {\n onSuggestedReplyChange('next');\n }}\n disabled={currentReply === null || replies.length <= 1}\n >\n <Icon name='caret-right' />\n </Button>\n )}\n </Flex>\n </Flex>\n </ExpandCollapse>\n </StyledSuggestedReplyContainer>\n );\n }\n );\n\nexport default SuggestedReplyPicker;\n"]}
1
+ {"version":3,"file":"SuggestedReplyPicker.js","sourceRoot":"","sources":["../../../src/components/Chat/SuggestedReplyPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAA2C,SAAS,EAAE,MAAM,OAAO,CAAC;AACvF,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,IAAI,EACJ,OAAO,EACP,gBAAgB,EAEhB,UAAU,EACV,cAAc,EACd,KAAK,EACL,YAAY,EACZ,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAC1F,OAAO,KAAK,aAAa,MAAM,mEAAmE,CAAC;AACnG,OAAO,KAAK,cAAc,MAAM,oEAAoE,CAAC;AACrG,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAElF,YAAY,CAAC,SAAS,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;AAEvD,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AACvD,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AACxD,MAAM,CAAC,MAAM,WAAW,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EAAE,cAAc,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,YAE7D,KAAC,IAAI,IAAC,IAAI,EAAC,aAAa,GAAG,GACpB,CACV,IACI,IACF,GACQ,IACa,CACjC,CAAC;AACJ,CAAC,CACF,CAAC;AAEJ,eAAe,oBAAoB,CAAC","sourcesContent":["import { forwardRef, FunctionComponent, PropsWithoutRef, Ref, useEffect } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Flex,\n Icon,\n registerIcon,\n Button,\n Text,\n useI18n,\n defaultThemeProp,\n ForwardProps,\n useLiveLog,\n ExpandCollapse,\n Alert,\n useDirection,\n EmptyState\n} from '@pega/cosmos-react-core';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-right.icon';\nimport { StyledAlert } from '@pega/cosmos-react-core/lib/components/Badges/Alert';\n\nregisterIcon(timesIcon, caretLeftIcon, caretRightIcon);\n\nexport const StyledSuggestedReplyHeader = styled.div``;\nexport const StyledSuggestedReplyContent = styled.div``;\nexport const StyledReply = styled.div``;\nexport const StyledRepliesAction = styled.div``;\nexport const StyledNotification = styled.div``;\nconst maxNumOfLines = 5;\nconst minNumOfLines = 2;\n\nexport const StyledSuggestedReplyIcon = styled.svg<{ suggestedReplyCollapsed?: boolean }>(\n ({ suggestedReplyCollapsed, theme }) => {\n const { rtl } = useDirection();\n const {\n base: {\n animation: {\n speed,\n timing: { ease }\n }\n }\n } = theme;\n return css`\n transition-property: transform;\n transition-duration: ${speed};\n transition-timing-function: ${ease};\n ${suggestedReplyCollapsed &&\n css`\n transform: rotateZ(${rtl ? '0deg' : '-90deg'});\n `}\n `;\n }\n);\n\nStyledSuggestedReplyIcon.defaultProps = defaultThemeProp;\n\nconst StyledSuggestedReplyContainer = styled.div(props => {\n const { theme } = props;\n return css`\n border-top: 0.0625rem solid ${theme.base.palette['border-line']};\n background-color: ${theme.base.palette['primary-background']};\n\n > ${StyledSuggestedReplyHeader} {\n padding: ${theme.base.spacing};\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n }\n\n ${StyledAlert} {\n position: relative;\n inset-block-start: calc(-0.25 * ${theme.base.spacing});\n inset-inline-start: calc(-0.5 * ${theme.base.spacing});\n }\n\n ${StyledSuggestedReplyContent} {\n padding: calc(2 * ${theme.base.spacing});\n position: relative;\n\n > ${StyledReply} {\n overflow-y: auto;\n max-height: calc(2.5 * ${theme.base.spacing} * ${maxNumOfLines});\n min-height: calc(2.5 * ${theme.base.spacing} * ${minNumOfLines});\n }\n }\n `;\n});\n\nStyledSuggestedReplyContainer.defaultProps = defaultThemeProp;\n\nexport interface SuggestedReply {\n /** Id for this suggested reply */\n id: string;\n /** Suggested reply message */\n message: string;\n /** Confidence of this suggested reply */\n confidence: number;\n}\n\nexport interface SuggestedReplyPickerProps {\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Suggested replies */\n replies?: SuggestedReply[];\n /** Id of the current reply */\n currentReplyId?: SuggestedReply['id'];\n /** Fired when user clicks on left or right buttons\n * @param id Id of the new reply\n */\n onReplyChange: (id: SuggestedReply['id']) => void;\n /** Current state of the panel */\n collapsed: boolean;\n /** Callback for expand or collapse click */\n onExpandCollapse: () => void;\n /** Callback for the event when a suggested reply is selected */\n onSelect: (suggestedReply: SuggestedReply) => void;\n /** Show notification on picker header */\n showNotification?: boolean;\n}\n\nconst SuggestedReplyPicker: FunctionComponent<SuggestedReplyPickerProps & ForwardProps> =\n forwardRef(\n (props: PropsWithoutRef<SuggestedReplyPickerProps>, ref: SuggestedReplyPickerProps['ref']) => {\n const {\n replies = [],\n collapsed,\n onExpandCollapse,\n showNotification,\n onSelect,\n currentReplyId,\n onReplyChange,\n ...restProps\n } = props;\n const { announcePolite } = useLiveLog();\n const t = useI18n();\n const { rtl, ltr } = useDirection();\n\n // Allows suggested replies to cycle\n const onSuggestedReplyChange = (mode: 'prev' | 'next') => {\n const currentReplyIndex = replies.findIndex(reply => reply.id === currentReplyId);\n let newReplyIndex = mode === 'prev' ? currentReplyIndex - 1 : currentReplyIndex + 1;\n newReplyIndex = (newReplyIndex + replies.length) % replies.length;\n onReplyChange(replies[newReplyIndex].id);\n };\n\n // SR announcement when current reply changes\n useEffect(() => {\n if (!replies || replies.length === 0 || !currentReplyId) {\n return;\n }\n const currentReplyIndex = replies.findIndex(reply => reply.id === currentReplyId);\n announcePolite({\n message: `${t('suggested_replies_current_of_total', [\n currentReplyIndex + 1,\n replies.length\n ])},\n ${t('confidence_percentage', [replies[currentReplyIndex]?.confidence])},${\n replies[currentReplyIndex]?.message\n }`,\n type: 'acknowledgement'\n });\n }, [currentReplyId]);\n\n return (\n <StyledSuggestedReplyContainer ref={ref} {...restProps}>\n <Flex\n as={StyledSuggestedReplyHeader}\n container={{\n justify: 'between',\n alignContent: 'center'\n }}\n >\n <Flex\n container={{\n alignItems: 'center',\n gap: 1\n }}\n >\n {ltr && (\n <Button\n variant='simple'\n label={collapsed ? t('expand') : t('collapse')}\n aria-label={t(\n collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'\n )}\n icon\n onClick={onExpandCollapse}\n >\n <Icon\n name='caret-down'\n suggestedReplyCollapsed={collapsed}\n as={StyledSuggestedReplyIcon}\n />\n </Button>\n )}\n\n <Flex container={{ gap: 0.5 }}>\n <Text variant='h3'>{t('suggested_replies')}</Text>\n {collapsed && showNotification && <Alert variant='urgent' />}\n </Flex>\n\n {rtl && (\n <Button\n variant='simple'\n label={collapsed ? t('expand') : t('collapse')}\n aria-label={t(\n collapsed ? 'expand_suggested_replies' : 'collapse_suggested_replies'\n )}\n icon\n onClick={onExpandCollapse}\n >\n <Icon\n name='caret-down'\n suggestedReplyCollapsed={collapsed}\n as={StyledSuggestedReplyIcon}\n />\n </Button>\n )}\n </Flex>\n </Flex>\n <ExpandCollapse dimension='height' collapsed={collapsed} nullWhenCollapsed>\n <Flex\n container={{\n direction: 'column',\n gap: 1\n }}\n as={StyledSuggestedReplyContent}\n >\n {currentReplyId && replies.length ? (\n <Flex container as={StyledReply}>\n {replies.find(reply => reply.id === currentReplyId)?.message}\n </Flex>\n ) : (\n <EmptyState />\n )}\n <Flex\n container={{\n justify: 'center'\n }}\n as={StyledRepliesAction}\n >\n {replies.length > 1 && (\n <Button\n icon\n aria-label={t('prev_suggested_reply')}\n variant='simple'\n disabled={currentReplyId === undefined || replies.length <= 1}\n onClick={() => {\n onSuggestedReplyChange('prev');\n }}\n >\n <Icon name='caret-left' />\n </Button>\n )}\n <Button\n disabled={currentReplyId === undefined || !replies || replies.length === 0}\n onClick={() => {\n const selectedReply = replies.find(reply => reply.id === currentReplyId);\n if (selectedReply) onSelect(selectedReply);\n }}\n aria-label={\n replies.length > 0 && currentReplyId\n ? t('use_current_template', [\n replies.length > 0 && currentReplyId\n ? replies.findIndex(reply => reply.id === currentReplyId) + 1\n : 0,\n replies.length\n ])\n : ''\n }\n >\n {t('use')}\n </Button>\n {replies.length > 1 && (\n <Button\n icon\n aria-label={t('next_suggested_reply')}\n variant='simple'\n onClick={() => {\n onSuggestedReplyChange('next');\n }}\n disabled={currentReplyId === undefined || replies.length <= 1}\n >\n <Icon name='caret-right' />\n </Button>\n )}\n </Flex>\n </Flex>\n </ExpandCollapse>\n </StyledSuggestedReplyContainer>\n );\n }\n );\n\nexport default SuggestedReplyPicker;\n"]}
@@ -1,9 +1,13 @@
1
- export { default, ChatProps } from './Chat';
2
- export { default as ChatHeader, ChatHeaderProps } from './ChatHeader';
1
+ export { default } from './Chat';
2
+ export type { ChatProps } from './Chat';
3
+ export { default as ChatHeader } from './ChatHeader';
4
+ export type { ChatHeaderProps } from './ChatHeader';
3
5
  export { default as ChatBody, NewMessageSeparatorId } from './ChatBody';
4
- export { default as ChatComposer, ChatComposerProps, ChatComposerImperativeHandleProps } from './ChatComposer';
5
- export { default as SuggestedReplyPicker, SuggestedReplyPickerProps, SuggestedReply } from './SuggestedReplyPicker';
6
- export { AttachmentItemProps, ChatSettingsPanelProps, MediaPageLinks, MessageProps, MessageHeaderProps, ChatBodyProps, ChatBodyListItemProps, ChatBodyHandleValue, TypeIndicatorProps, SystemMessageProps } from './Chat.types';
6
+ export { default as ChatComposer } from './ChatComposer';
7
+ export type { ChatComposerProps, ChatComposerImperativeHandleProps } from './ChatComposer';
8
+ export { default as SuggestedReplyPicker } from './SuggestedReplyPicker';
9
+ export type { SuggestedReplyPickerProps, SuggestedReply } from './SuggestedReplyPicker';
10
+ export type { AttachmentItemProps, ChatSettingsPanelProps, MediaPageLinks, MessageProps, MessageHeaderProps, ChatBodyProps, ChatBodyListItemProps, ChatBodyHandleValue, TypeIndicatorProps, SystemMessageProps } from './Chat.types';
7
11
  export { default as Message } from './Message';
8
12
  export { default as SystemMessage } from './SystemMessage';
9
13
  export { default as TypeIndicator } from './TypeIndicator';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EACL,OAAO,IAAI,YAAY,EACvB,iBAAiB,EACjB,iCAAiC,EAClC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,OAAO,IAAI,oBAAoB,EAC/B,yBAAyB,EACzB,cAAc,EACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAC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C3D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAa,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAmB,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EACL,OAAO,IAAI,YAAY,EAGxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,OAAO,IAAI,oBAAoB,EAGhC,MAAM,wBAAwB,CAAC;AAahC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["export { default, ChatProps } from './Chat';\nexport { default as ChatHeader, ChatHeaderProps } from './ChatHeader';\nexport { default as ChatBody, NewMessageSeparatorId } from './ChatBody';\nexport {\n default as ChatComposer,\n ChatComposerProps,\n ChatComposerImperativeHandleProps\n} from './ChatComposer';\nexport {\n default as SuggestedReplyPicker,\n SuggestedReplyPickerProps,\n SuggestedReply\n} from './SuggestedReplyPicker';\nexport {\n AttachmentItemProps,\n ChatSettingsPanelProps,\n MediaPageLinks,\n MessageProps,\n MessageHeaderProps,\n ChatBodyProps,\n ChatBodyListItemProps,\n ChatBodyHandleValue,\n TypeIndicatorProps,\n SystemMessageProps\n} from './Chat.types';\nexport { default as Message } from './Message';\nexport { default as SystemMessage } from './SystemMessage';\nexport { default as TypeIndicator } from './TypeIndicator';\nexport { default as ChatSettingsPanel } from './ChatSettingsPanel';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Chat/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAczE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["export { default } from './Chat';\nexport type { ChatProps } from './Chat';\nexport { default as ChatHeader } from './ChatHeader';\nexport type { ChatHeaderProps } from './ChatHeader';\nexport { default as ChatBody, NewMessageSeparatorId } from './ChatBody';\nexport { default as ChatComposer } from './ChatComposer';\nexport type { ChatComposerProps, ChatComposerImperativeHandleProps } from './ChatComposer';\nexport { default as SuggestedReplyPicker } from './SuggestedReplyPicker';\nexport type { SuggestedReplyPickerProps, SuggestedReply } from './SuggestedReplyPicker';\nexport type {\n AttachmentItemProps,\n ChatSettingsPanelProps,\n MediaPageLinks,\n MessageProps,\n MessageHeaderProps,\n ChatBodyProps,\n ChatBodyListItemProps,\n ChatBodyHandleValue,\n TypeIndicatorProps,\n SystemMessageProps\n} from './Chat.types';\nexport { default as Message } from './Message';\nexport { default as SystemMessage } from './SystemMessage';\nexport { default as TypeIndicator } from './TypeIndicator';\nexport { default as ChatSettingsPanel } from './ChatSettingsPanel';\n"]}
@@ -1,5 +1,5 @@
1
1
  export { default } from './Email';
2
- export { EmailUser, EmailProps, EmailComposerProps, EmailConversationProps, EmailShellProps, EntityListProps, EmailManagerProps, EmailTemplate, EmailSummaryListProps, EmailSummaryItemProps, EmailCaseViewProps, EmailNotificationPanelProps } from './Email.types';
2
+ export type { EmailUser, EmailProps, EmailComposerProps, EmailConversationProps, EmailShellProps, EntityListProps, EmailManagerProps, EmailTemplate, EmailSummaryListProps, EmailSummaryItemProps, EmailCaseViewProps, EmailNotificationPanelProps } from './Email.types';
3
3
  export { default as EmailConversation } from './EmailConversation';
4
4
  export { default as EmailShell } from './EmailShell';
5
5
  export { default as EmailComposer } from './EmailComposer';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Email/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EACL,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,2BAA2B,IAAI,wBAAwB,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Email/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,YAAY,EACV,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,2BAA2B,IAAI,wBAAwB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Email/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAelC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,2BAA2B,IAAI,wBAAwB,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { default } from './Email';\nexport {\n EmailUser,\n EmailProps,\n EmailComposerProps,\n EmailConversationProps,\n EmailShellProps,\n EntityListProps,\n EmailManagerProps,\n EmailTemplate,\n EmailSummaryListProps,\n EmailSummaryItemProps,\n EmailCaseViewProps,\n EmailNotificationPanelProps\n} from './Email.types';\nexport { default as EmailConversation } from './EmailConversation';\nexport { default as EmailShell } from './EmailShell';\nexport { default as EmailComposer } from './EmailComposer';\nexport { default as EmailSummaryItem } from './EmailSummaryItem';\nexport { default as EmailSummaryList } from './EmailSummaryList';\nexport { default as EntityList } from './EntityList';\nexport { default as EmailManager } from './EmailManager';\nexport { default as EmailCaseView } from './EmailCaseView';\nexport { default as EmailNotificationPanel } from './EmailNotificationPanel';\nexport { StyledEmailNotificationList as AppshellEmailSummaryList } from './Email.styles';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Email/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAelC,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,2BAA2B,IAAI,wBAAwB,EAAE,MAAM,gBAAgB,CAAC","sourcesContent":["export { default } from './Email';\nexport type {\n EmailUser,\n EmailProps,\n EmailComposerProps,\n EmailConversationProps,\n EmailShellProps,\n EntityListProps,\n EmailManagerProps,\n EmailTemplate,\n EmailSummaryListProps,\n EmailSummaryItemProps,\n EmailCaseViewProps,\n EmailNotificationPanelProps\n} from './Email.types';\nexport { default as EmailConversation } from './EmailConversation';\nexport { default as EmailShell } from './EmailShell';\nexport { default as EmailComposer } from './EmailComposer';\nexport { default as EmailSummaryItem } from './EmailSummaryItem';\nexport { default as EmailSummaryList } from './EmailSummaryList';\nexport { default as EntityList } from './EntityList';\nexport { default as EmailManager } from './EmailManager';\nexport { default as EmailCaseView } from './EmailCaseView';\nexport { default as EmailNotificationPanel } from './EmailNotificationPanel';\nexport { StyledEmailNotificationList as AppshellEmailSummaryList } from './Email.styles';\n"]}
@@ -1,10 +1,13 @@
1
- export { default, Filter } from './Feed';
1
+ export { default } from './Feed';
2
+ export type { Filter } from './Feed';
2
3
  export { default as FeedPost } from './FeedPost';
3
- export { FeedPostProps } from './FeedPost.types';
4
- export { default as FeedReplyInput, FeedReplyInputProps } from './FeedReplyInput';
4
+ export type { FeedPostProps } from './FeedPost.types';
5
+ export { default as FeedReplyInput } from './FeedReplyInput';
6
+ export type { FeedReplyInputProps } from './FeedReplyInput';
5
7
  export { default as FeedReply } from './FeedReply';
6
- export { FeedReplyProps } from './FeedReply.types';
7
- export { default as FeedNewPost, FeedNewPostProps } from './FeedNewPost';
8
- export { RecipientOption } from './FeedNewPostTypeMenu';
9
- export { AttachedFiles } from './FeedAttachments';
8
+ export type { FeedReplyProps } from './FeedReply.types';
9
+ export { default as FeedNewPost } from './FeedNewPost';
10
+ export type { FeedNewPostProps } from './FeedNewPost';
11
+ export type { RecipientOption } from './FeedNewPostTypeMenu';
12
+ export type { AttachedFiles } from './FeedAttachments';
10
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Feed/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AACjC,YAAY,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Feed/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,QAAQ,CAAC;AACzC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAuB,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAoB,MAAM,eAAe,CAAC","sourcesContent":["export { default, Filter } from './Feed';\nexport { default as FeedPost } from './FeedPost';\nexport { FeedPostProps } from './FeedPost.types';\nexport { default as FeedReplyInput, FeedReplyInputProps } from './FeedReplyInput';\nexport { default as FeedReply } from './FeedReply';\nexport { FeedReplyProps } from './FeedReply.types';\nexport { default as FeedNewPost, FeedNewPostProps } from './FeedNewPost';\nexport { RecipientOption } from './FeedNewPostTypeMenu';\nexport { AttachedFiles } from './FeedAttachments';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Feed/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { default } from './Feed';\nexport type { Filter } from './Feed';\nexport { default as FeedPost } from './FeedPost';\nexport type { FeedPostProps } from './FeedPost.types';\nexport { default as FeedReplyInput } from './FeedReplyInput';\nexport type { FeedReplyInputProps } from './FeedReplyInput';\nexport { default as FeedReply } from './FeedReply';\nexport type { FeedReplyProps } from './FeedReply.types';\nexport { default as FeedNewPost } from './FeedNewPost';\nexport type { FeedNewPostProps } from './FeedNewPost';\nexport type { RecipientOption } from './FeedNewPostTypeMenu';\nexport type { AttachedFiles } from './FeedAttachments';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-social",
3
- "version": "4.0.0-dev.20.0",
3
+ "version": "4.0.0-dev.21.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/pegasystems/cosmos-react.git",
@@ -23,9 +23,9 @@
23
23
  "build": "tsc -b"
24
24
  },
25
25
  "dependencies": {
26
- "@pega/cosmos-react-core": "4.0.0-dev.20.0",
27
- "@pega/cosmos-react-rte": "4.0.0-dev.20.0",
28
- "@pega/cosmos-react-work": "4.0.0-dev.20.0",
26
+ "@pega/cosmos-react-core": "4.0.0-dev.21.0",
27
+ "@pega/cosmos-react-rte": "4.0.0-dev.21.0",
28
+ "@pega/cosmos-react-work": "4.0.0-dev.21.0",
29
29
  "@types/parse5": "^6.0.0",
30
30
  "@types/react": "^16.14.24 || ^17.0.38",
31
31
  "@types/react-dom": "^16.9.14 || ^17.0.11",
@@ -37,14 +37,12 @@
37
37
  "styled-components": "^5.2.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@storybook/addon-a11y": "^6.4.19",
41
- "@storybook/addon-actions": "^6.4.19",
42
- "@storybook/addon-storysource": "^6.4.19",
43
- "@storybook/addon-toolbars": "^6.4.19",
44
- "@storybook/addons": "^6.4.19",
45
- "@storybook/react": "^6.4.19",
46
- "@storybook/testing-react": "^1.2.4",
47
- "@storybook/theming": "^6.4.19",
40
+ "@storybook/addon-a11y": "^7.0.24",
41
+ "@storybook/addon-actions": "^7.0.24",
42
+ "@storybook/addon-storysource": "^7.0.24",
43
+ "@storybook/addon-toolbars": "^7.0.24",
44
+ "@storybook/react": "^7.0.24",
45
+ "@storybook/theming": "^7.0.24",
48
46
  "@testing-library/react": "^12.1.3",
49
47
  "@testing-library/user-event": "^13.5.0",
50
48
  "typescript": "~5.0.2"