-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: vica integration #982
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
33ac3ac
add vica props
adriangohjw 550e30e
add vica to siteprops
adriangohjw bf1578b
add vica stylesheet and widget component
adriangohjw 4608ab5
add vica to skeleton
adriangohjw 25eee45
override app-font-family + add comments
adriangohjw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import type { ScriptComponentType } from "~/types" | ||
|
||
// NOTE: not all props will be used even if we passed them in | ||
// as we will override some of them with Isomer's configuration e.g. font-family | ||
// Nevertheless, keeping them here for reference | ||
interface VicaWidgetProps { | ||
// UI Theme | ||
"app-id": string | ||
"app-name": string | ||
"app-icon"?: string | ||
"app-subtitle"?: string // configuration disabled (according to docs) | ||
"app-welcome-message"?: string | ||
"app-font-family"?: string | ||
"app-base-font-size"?: string | ||
// General Color | ||
"app-color"?: string | ||
"app-foreground-color1"?: string | ||
"app-background-color2"?: string | ||
"app-foreground-color2"?: string | ||
"app-canvas-background-color"?: string | ||
"app-button-border-color"?: string | ||
"app-quick-reply-button-background-color"?: string | ||
// Autocomplete | ||
"app-enable-auto-complete"?: boolean | ||
"app-auto-complete-background-color"?: string | ||
"app-auto-complete-foreground-color"?: string | ||
"app-auto-complete-hover-color"?: string | ||
"app-auto-complete-divider-color"?: string | ||
// Recommendations | ||
"app-enable-recommendations"?: boolean | ||
"app-recommendations-background-color"?: string | ||
"app-recommendations-foreground-color"?: string | ||
"app-recommendations-hover-color"?: string | ||
// UI Behaviours | ||
"app-orchestrator-timeout"?: number | ||
"app-alternate-copy-vault"?: string | ||
"app-auto-launch"?: boolean | ||
"app-launched-animation-iteration"?: number | ||
"app-disable-csat"?: boolean | ||
// Chatbot Behaviours | ||
"app-quick-launch-event"?: string | ||
"app-quick-launch-event-force-trigger"?: boolean | ||
"app-bot-response-trigger-event"?: string | ||
"app-environment-override"?: string | ||
"app-translation-languages"?: string | ||
"app-enable-hide-translation"?: boolean | ||
} | ||
|
||
export interface VicaProps extends VicaWidgetProps { | ||
ScriptComponent?: ScriptComponentType | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
packages/components/src/templates/next/components/internal/Vica/Vica.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import type { VicaProps } from "~/interfaces" | ||
|
||
export const VicaStylesheet = () => { | ||
return ( | ||
<> | ||
<link | ||
href="https://webchat.vica.gov.sg/static/css/chat.css" | ||
referrerPolicy="origin" | ||
rel="stylesheet" | ||
/> | ||
</> | ||
) | ||
} | ||
|
||
export const VicaWidget = ({ | ||
ScriptComponent = "script", | ||
...props | ||
}: VicaProps) => { | ||
return ( | ||
<> | ||
<ScriptComponent | ||
async | ||
type="text/javascript" | ||
src="https://webchat.vica.gov.sg/static/js/chat.js" | ||
referrerPolicy="origin" | ||
// 'lazyOnload' is recommended by Next.js for chat widgets | ||
// Reference: https://nextjs.org/docs/pages/api-reference/components/script#lazyonload | ||
strategy="lazyOnload" | ||
/> | ||
<div | ||
id="webchat" | ||
{...props} | ||
app-font-family="Inter, system-ui, sans-serif" | ||
// NOTE: Clarifying with VICA regarding color scheme | ||
// Once confirmed, will override with site's color scheme for consistency | ||
/> | ||
</> | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
packages/components/src/templates/next/components/internal/Vica/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./Vica" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abit confused - how will we override? i'm assuming the compiled css will have
font-family
but how will vica pick it upThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can override directly in
isomer/packages/components/src/templates/next/components/internal/Vica/Vica.tsx
Lines 30 to 36 in 25eee45
once VICA got back to me, we also ideally want to use the site's
color
to prefill this. For now the only props we know we will override what's passed in is font family