1.2.2 • Published 3 years ago

@coveops/salesforce-community-result-link v1.2.2

Weekly downloads
24
License
Apache-2.0
Repository
-
Last release
3 years ago

Salesforce Community Result Link

SalesforceCommunityResultLink will change clickable URI logic to open Salesforce content (Knowledge, Chatter, ContentDocument, Collaboration Group,Idea & Case) in the context of a Salesforce Lightning Community

Disclaimer: This component was built by the community at large and is not an official Coveo JSUI Component. Use this component at your own risk.

Getting Started

  1. Install the component into your project.
npm i @coveops/salesforce-community-result-link
  1. Use the Component or extend it

Typescript:

import * as SalesforceCommunityResultLink from '@coveops/salesforce-community-result-link';

Javascript

const SalesforceCommunityResultLink = require('@coveops/salesforce-community-result-link');
  1. You can also expose the component alongside other components being built in your project.
export * as SalesforceCommunityResultLink from '@coveops/salesforce-community-result-link'
  1. Or for quick testing, you can add the script from unpkg
<script src="https://unpkg.com/@coveops/salesforce-community-result-link@latest/dist/index.min.js"></script>

Disclaimer: Unpkg should be used for testing but not for production.

  1. Include the component in your template as follows:

Add the following markup to your template:

<a class="CoveoSalesforceCommunityResultLink"></a>

Be sure to update the variables to have the relevant information.

Options

The following options can be configured:

OptionRequiredTypeDefaultNotes
useAsPrintableNobooleanfalseSpecifies whether to display link instead of title
enableLanguageNobooleanfalseWhether to enable Language in URL (ex: Knowledge Article)
enableUrlRewriterNobooleantrueWhether to enable url rewriting logic
hostNameNostringwindow.location.hostnameSpecifies the host name of your Salesforce Lightning Community
nameNostringSpecifies the name of your Salesforce Lightning Community
protocolNostringwindow.location.protocolSpecifies protocol for the clickable link
showIdeaDetailsNobooleantrueSoecifies if idea type will be shown as detail or not

Extending

Extending the component can be done as follows:

import { SalesforceCommunityResultLink, ISalesforceCommunityResultLinkOptions } from "@coveops/salesforce-community-result-link";

export interface IExtendedSalesforceCommunityResultLinkOptions extends ISalesforceCommunityResultLinkOptions {}

export class ExtendedSalesforceCommunityResultLink extends SalesforceCommunityResultLink {
    protected applyCommunityUrlRewriter():string {
        //some custom logic here
        return communityUrl;
    }
}

The following methods can be extended to provide additional functionalities or handle more complex use cases.

applyCommunityUrlRewriter

protected applyCommunityUrlRewriter():string

The applyCommunityUrlRewriter should change the clickable uri.

Contribute

  1. Clone the project
  2. Build the code base: npm run build
  3. Update the test organization ID and API Token and configure your port on the npm serve script in the package.json: --org-id <ORG_ID> --token <ORG_KEY> --port 8080
  4. Serve the sandbox for live development npm run serve