1.0.0 • Published 4 years ago

@coveops/case-context-trigger v1.0.0

Weekly downloads
23
License
Apache-2.0
Repository
-
Last release
4 years ago

CaseContextTrigger

The CaseContextTrigger component renders ONLY if a Trigger Rule has been added into the corresponding query pipeline. The Trigger Rule must be an Execute Rule that will call the following JavaScript Function:

CaseContextTrigger(notification_msg, case_number, case_subject)

image

Note: This Trigger Rule should ALWAYS be associated to a condition related to the current Context and you also do not want to see that notification if the query is not empty.

This component will allow you to execute CaseContextTrigger JavasScript Function from a Trigger Rule in your pipeline. When the Trigger Rule is being executed, depending on its current mode (Large or Small), this component renders a Banner (Large mode) or a Badge (Small mode) based on the infos passed to the JavaScript Function in order to notify the user that current query is using a certain context.

When caseNumber and/or caseSubject options are undefined, parameters case_number and case_subject that are passed to the CaseContextTrigger Function will be considered as Key value of the current Context Object which mean the Subject that will be displayed in the Banner will be the result of Contextcase_subject.

CaseContextTrigger (Large Mode)
image
CaseContextTrigger (Small Mode)
image

Getting Started

  1. Install the component into your project.
npm i @coveops/case-context-trigger
  1. Use the Component or extend it

Typescript:

import { CaseContextTrigger, ICaseContextTriggerOptions } from '@coveops/case-context-trigger';

Javascript

const CaseContextTrigger = require('@coveops/case-context-trigger').CaseContextTrigger;
  1. You can also expose the component alongside other components being built in your project.
export * from '@coveops/case-context-trigger'
  1. Include the component in your template as follows:

Add the following markup to your template:

<div class="CoveoCaseContextTrigger"></div>

Options

The following options can be configured:

OptionRequiredTypeDefaultNotes
notificationMsgNolocalized stringCaseContextTrigger_NotificationMsgSpecifies the notification message of the Case Context Banner.
enableNotificationMsgNobooleantrueSpecifies whether to display the notification message in the Case Context Banner when large mode is activated.
caseNumberNostringSpecifies the case Number that will be displayed in the Case Context Banner.
caseSubjectNostringSpecifies the case Subject / title that will be displayed in the Case Context Banner.
enableResponsiveModeNobooleantrueSpecifies whether to enable responsive mode for CaseContextTrigger

Extending

Extending the component can be done as follows:

import { CaseContextTrigger, ICaseContextTriggerOptions } from "@coveops/case-context-trigger";

export interface IExtendedCaseContextTriggerOptions extends ICaseContextTriggerOptions {}

export class ExtendedCaseContextTrigger extends CaseContextTrigger {}

Contribute

  1. Clone the project
  2. Copy .env.dist to .env and update the COVEO_ORG_ID and COVEO_TOKEN fields in the .env file to use your Coveo credentials and SERVER_PORT to configure the port of the sandbox - it will use 8080 by default.
  3. Build the code base: npm run build
  4. Serve the sandbox for live development npm run serve