-
Notifications
You must be signed in to change notification settings - Fork 100
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
MIAW custom pre-chat example #155
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,12 @@ | |||
<template> | |||
<template class="slds-m-around_medium" for:each={fields} for:item="field"> | |||
<c-custom-prechat-form-field key={field.name} |
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.
created a separate component to render each formField, mainly to demonstrate how a customer can distinguish between a text field vs a dropdown (choiceList) field.
} | ||
} | ||
|
||
isValid() { |
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.
thinking of renaming this to isFormValid
@@ -0,0 +1,18 @@ | |||
<template> | |||
<template lwc:if={isTypeChoiceList}> |
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.
ChoiceLists can be rendered using lightning-combobox
while the rest of the fields can simply be lightning-input
with the appropriate value for type
attribute.
} | ||
|
||
@api | ||
reportValidity() { |
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.
required for validating each formField on Start Conversation click. A customer can choose their own way of validating the form but I just thought we can show them an example.
@@ -0,0 +1,13 @@ | |||
:host { | |||
display: flex; |
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.
just some basic styling here. planning to just add a note about configuration.branding
so that customers can consume the branding information from config as they seem fit.
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.
Please commit the code comment edits. Otherwise, this is good to go.
} | ||
|
||
/** | ||
* Adds values to fields of type choiceList (dropdown). |
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.
* Adds values to fields of type choiceList (dropdown). | |
* Adds values to choiceList (dropdown) fields. |
} | ||
|
||
/** | ||
* Returns prechat form fields sorted by their display order. |
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.
* Returns prechat form fields sorted by their display order. | |
* Returns pre-chat form fields sorted by their display order. |
} | ||
|
||
/** | ||
* Iterates over and reports validity for each form field. Returns true if all the fields are valid. |
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.
* Iterates over and reports validity for each form field. Returns true if all the fields are valid. | |
* Iterates over and validates each form field. Returns true if all the fields are valid. |
} | ||
|
||
/** | ||
* Gathers and submits prechat data to the app on start converation button click. |
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.
* Gathers and submits prechat data to the app on start converation button click. | |
* Gathers and submits pre-chat data to the app on start-conversation-button click. |
No description provided.