Skip to content

Commit

Permalink
feat(atomic): user actions timeline component created (#4272)
Browse files Browse the repository at this point in the history
## [SFINT-5616](https://coveord.atlassian.net/browse/SFINT-5616)




### Atomic Insight User Actions Timeline component created.


- This component displays all the actions performed by a user around the
time they created a case. The actions are grouped into multiple
sessions, including the session during which the case was created,
the sessions preceding the case creation, and the sessions following the
case creation.

- The User actions timeline display the ticket creation session, 2
following sessions and 2 preceding sessions.

- E2E Playwright tests added to cover the logic of this component.




https://github.com/user-attachments/assets/06a8a8ad-095e-41f6-a056-ba5bf3e169b8


### Link to mockups:


https://www.figma.com/design/Jwu7iQEeG6en4vm4zN6Nav/Atomic-Insight-Panel?node-id=39-24173&node-type=FRAME&t=EX4rw364jAc2ZyZK-0





[SFINT-5616]:
https://coveord.atlassian.net/browse/SFINT-5616?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: GitHub Actions Bot <>
  • Loading branch information
mmitiche authored Sep 11, 2024
1 parent f83b610 commit 7c110bc
Show file tree
Hide file tree
Showing 23 changed files with 919 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ AtomicFrequentlyBoughtTogether,
AtomicGeneratedAnswer,
AtomicHtml,
AtomicIcon,
AtomicInsightUserActionsTimeline,
AtomicLayoutSection,
AtomicLoadMoreResults,
AtomicNoResults,
Expand Down Expand Up @@ -196,6 +197,7 @@ AtomicFrequentlyBoughtTogether,
AtomicGeneratedAnswer,
AtomicHtml,
AtomicIcon,
AtomicInsightUserActionsTimeline,
AtomicLayoutSection,
AtomicLoadMoreResults,
AtomicNoResults,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,28 @@ export class AtomicIcon {
export declare interface AtomicIcon extends Components.AtomicIcon {}


@ProxyCmp({
inputs: ['ticketCreationDateTime', 'userId']
})
@Component({
selector: 'atomic-insight-user-actions-timeline',
changeDetection: ChangeDetectionStrategy.OnPush,
template: '<ng-content></ng-content>',
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
inputs: ['ticketCreationDateTime', 'userId'],
})
export class AtomicInsightUserActionsTimeline {
protected el: HTMLElement;
constructor(c: ChangeDetectorRef, r: ElementRef, protected z: NgZone) {
c.detach();
this.el = r.nativeElement;
}
}


export declare interface AtomicInsightUserActionsTimeline extends Components.AtomicInsightUserActionsTimeline {}


@ProxyCmp({
inputs: ['maxWidth', 'minWidth', 'section']
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const AtomicCommerceSortDropdown = /*@__PURE__*/createReactComponent<JSX.
export const AtomicCommerceText = /*@__PURE__*/createReactComponent<JSX.AtomicCommerceText, HTMLAtomicCommerceTextElement>('atomic-commerce-text');
export const AtomicCommerceTimeframeFacet = /*@__PURE__*/createReactComponent<JSX.AtomicCommerceTimeframeFacet, HTMLAtomicCommerceTimeframeFacetElement>('atomic-commerce-timeframe-facet');
export const AtomicIcon = /*@__PURE__*/createReactComponent<JSX.AtomicIcon, HTMLAtomicIconElement>('atomic-icon');
export const AtomicInsightUserActionsTimeline = /*@__PURE__*/createReactComponent<JSX.AtomicInsightUserActionsTimeline, HTMLAtomicInsightUserActionsTimelineElement>('atomic-insight-user-actions-timeline');
export const AtomicLayoutSection = /*@__PURE__*/createReactComponent<JSX.AtomicLayoutSection, HTMLAtomicLayoutSectionElement>('atomic-layout-section');
export const AtomicNumericRange = /*@__PURE__*/createReactComponent<JSX.AtomicNumericRange, HTMLAtomicNumericRangeElement>('atomic-numeric-range');
export const AtomicProduct = /*@__PURE__*/createReactComponent<JSX.AtomicProduct, HTMLAtomicProductElement>('atomic-product');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const AtomicFrequentlyBoughtTogether = /*@__PURE__*/createReactComponent<
export const AtomicGeneratedAnswer = /*@__PURE__*/createReactComponent<JSX.AtomicGeneratedAnswer, HTMLAtomicGeneratedAnswerElement>('atomic-generated-answer');
export const AtomicHtml = /*@__PURE__*/createReactComponent<JSX.AtomicHtml, HTMLAtomicHtmlElement>('atomic-html');
export const AtomicIcon = /*@__PURE__*/createReactComponent<JSX.AtomicIcon, HTMLAtomicIconElement>('atomic-icon');
export const AtomicInsightUserActionsTimeline = /*@__PURE__*/createReactComponent<JSX.AtomicInsightUserActionsTimeline, HTMLAtomicInsightUserActionsTimelineElement>('atomic-insight-user-actions-timeline');
export const AtomicLayoutSection = /*@__PURE__*/createReactComponent<JSX.AtomicLayoutSection, HTMLAtomicLayoutSectionElement>('atomic-layout-section');
export const AtomicLoadMoreResults = /*@__PURE__*/createReactComponent<JSX.AtomicLoadMoreResults, HTMLAtomicLoadMoreResultsElement>('atomic-load-more-results');
export const AtomicNoResults = /*@__PURE__*/createReactComponent<JSX.AtomicNoResults, HTMLAtomicNoResultsElement>('atomic-no-results');
Expand Down
57 changes: 57 additions & 0 deletions packages/atomic/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,23 @@ export namespace Components {
*/
"userActions": Array<IUserAction>;
}
/**
* This component displays all the actions performed by a user around the time they created a case.
* The actions are grouped into multiple sessions, including the session during which the case was created,
* the sessions preceding the case creation and the sessions following the case creation.
* @component
* @example <AtomicInsightUserActionsTimeline userId={'123'} caseCreationDate={'2024-08-15T10:00:00Z'} />
*/
interface AtomicInsightUserActionsTimeline {
/**
* The date and time when the case was created. For example "2024-01-01T00:00:00Z"
*/
"ticketCreationDateTime": string;
/**
* The ID of the user whose actions are being displayed. For example in email format "[email protected]".
*/
"userId": string;
}
interface AtomicIpxBody {
"displayFooterSlot": boolean;
"isOpen"?: boolean;
Expand Down Expand Up @@ -4570,6 +4587,19 @@ declare global {
prototype: HTMLAtomicInsightUserActionsSessionElement;
new (): HTMLAtomicInsightUserActionsSessionElement;
};
/**
* This component displays all the actions performed by a user around the time they created a case.
* The actions are grouped into multiple sessions, including the session during which the case was created,
* the sessions preceding the case creation and the sessions following the case creation.
* @component
* @example <AtomicInsightUserActionsTimeline userId={'123'} caseCreationDate={'2024-08-15T10:00:00Z'} />
*/
interface HTMLAtomicInsightUserActionsTimelineElement extends Components.AtomicInsightUserActionsTimeline, HTMLStencilElement {
}
var HTMLAtomicInsightUserActionsTimelineElement: {
prototype: HTMLAtomicInsightUserActionsTimelineElement;
new (): HTMLAtomicInsightUserActionsTimelineElement;
};
interface HTMLAtomicIpxBodyElementEventMap {
"animationEnded": never;
}
Expand Down Expand Up @@ -5940,6 +5970,7 @@ declare global {
"atomic-insight-tabs": HTMLAtomicInsightTabsElement;
"atomic-insight-timeframe-facet": HTMLAtomicInsightTimeframeFacetElement;
"atomic-insight-user-actions-session": HTMLAtomicInsightUserActionsSessionElement;
"atomic-insight-user-actions-timeline": HTMLAtomicInsightUserActionsTimelineElement;
"atomic-ipx-body": HTMLAtomicIpxBodyElement;
"atomic-ipx-button": HTMLAtomicIpxButtonElement;
"atomic-ipx-embedded": HTMLAtomicIpxEmbeddedElement;
Expand Down Expand Up @@ -7546,6 +7577,23 @@ declare namespace LocalJSX {
*/
"userActions": Array<IUserAction>;
}
/**
* This component displays all the actions performed by a user around the time they created a case.
* The actions are grouped into multiple sessions, including the session during which the case was created,
* the sessions preceding the case creation and the sessions following the case creation.
* @component
* @example <AtomicInsightUserActionsTimeline userId={'123'} caseCreationDate={'2024-08-15T10:00:00Z'} />
*/
interface AtomicInsightUserActionsTimeline {
/**
* The date and time when the case was created. For example "2024-01-01T00:00:00Z"
*/
"ticketCreationDateTime": string;
/**
* The ID of the user whose actions are being displayed. For example in email format "[email protected]".
*/
"userId": string;
}
interface AtomicIpxBody {
"displayFooterSlot"?: boolean;
"isOpen"?: boolean;
Expand Down Expand Up @@ -9579,6 +9627,7 @@ declare namespace LocalJSX {
"atomic-insight-tabs": AtomicInsightTabs;
"atomic-insight-timeframe-facet": AtomicInsightTimeframeFacet;
"atomic-insight-user-actions-session": AtomicInsightUserActionsSession;
"atomic-insight-user-actions-timeline": AtomicInsightUserActionsTimeline;
"atomic-ipx-body": AtomicIpxBody;
"atomic-ipx-button": AtomicIpxButton;
"atomic-ipx-embedded": AtomicIpxEmbedded;
Expand Down Expand Up @@ -9980,6 +10029,14 @@ declare module "@stencil/core" {
* @example <atomic-insight-user-actions-session userActions={actions} startTimestamp={1723035731}></atomic-insight-user-actions-session>
*/
"atomic-insight-user-actions-session": LocalJSX.AtomicInsightUserActionsSession & JSXBase.HTMLAttributes<HTMLAtomicInsightUserActionsSessionElement>;
/**
* This component displays all the actions performed by a user around the time they created a case.
* The actions are grouped into multiple sessions, including the session during which the case was created,
* the sessions preceding the case creation and the sessions following the case creation.
* @component
* @example <AtomicInsightUserActionsTimeline userId={'123'} caseCreationDate={'2024-08-15T10:00:00Z'} />
*/
"atomic-insight-user-actions-timeline": LocalJSX.AtomicInsightUserActionsTimeline & JSXBase.HTMLAttributes<HTMLAtomicInsightUserActionsTimelineElement>;
"atomic-ipx-body": LocalJSX.AtomicIpxBody & JSXBase.HTMLAttributes<HTMLAtomicIpxBodyElement>;
"atomic-ipx-button": LocalJSX.AtomicIpxButton & JSXBase.HTMLAttributes<HTMLAtomicIpxButtonElement>;
"atomic-ipx-embedded": LocalJSX.AtomicIpxEmbedded & JSXBase.HTMLAttributes<HTMLAtomicIpxEmbeddedElement>;
Expand Down
1 change: 1 addition & 0 deletions packages/atomic/src/components/insight/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export {
InsightEngine,
InsightEngineConfiguration,
buildInsightEngine,
getSampleInsightEngineConfiguration,
ResultList as InsightResultList,
ResultListState as InsightResultListState,
buildResultList as buildInsightResultList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ export class AtomicInsightUserActionsSession {
count: this.userActionsAfterCaseCreation.length,
});
return (
<div class="flex items-center px-3 pb-3">
<div
data-testid="show-more-actions-button"
class="flex items-center px-3 pb-3"
>
<div class="flex justify-center pr-2">
<atomic-icon icon={ThreeDotsIcon} class="h-3 w-3"></atomic-icon>
</div>
Expand Down Expand Up @@ -139,8 +142,11 @@ export class AtomicInsightUserActionsSession {
<div>
{this.renderSessionStartDate()}

{this.areActionsAfterCaseCreationVisible &&
this.renderActions(this.userActionsAfterCaseCreation)}
{this.areActionsAfterCaseCreationVisible && (
<div data-testid="more-actions-section">
{this.renderActions(this.userActionsAfterCaseCreation)}
</div>
)}

{isShowMoreActionsButtonVisible && this.renderShowMoreActionsButton()}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const UserAction: FunctionalComponent<UserAction> = ({
case 'TICKET_CREATION':
return (
<div class="ticket-creation-action__text text-xs font-semibold">
a{bindings.i18n.t('ticket-created')}
{bindings.i18n.t('ticket-created')}
</div>
);
case 'CUSTOM':
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {parameters} from '@coveo/atomic/storybookUtils/common/common-meta-parameters';
import {renderComponent} from '@coveo/atomic/storybookUtils/common/render-component';
import type {Meta, StoryObj as Story} from '@storybook/web-components';
import {wrapInInsightInterface} from '../../../../../storybookUtils/insight/insight-interface-wrapper';

const {decorator, play} = wrapInInsightInterface();

const meta: Meta = {
component: 'atomic-insight-user-actions-timeline',
title: 'Atomic/Insight/UserActionsTimelines',
id: 'atomic-insight-user-actions-timeline',

render: renderComponent,
decorators: [decorator],
parameters,
play,
};

export default meta;

export const Default: Story = {
name: 'atomic-insight-user-actions-timeline',
play: async (context) => {
await play(context);
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import '../../../../global/global.pcss';

.separator {
height: 1px;
background-color: #e0e1dd;
}
Loading

0 comments on commit 7c110bc

Please sign in to comment.