Skip to content
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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Conversation

ESW1234
Copy link
Owner

@ESW1234 ESW1234 commented Aug 14, 2023

No description provided.

@@ -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}
Copy link
Owner Author

@ESW1234 ESW1234 Aug 14, 2023

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() {
Copy link
Owner Author

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}>
Copy link
Owner Author

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() {
Copy link
Owner Author

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;
Copy link
Owner Author

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.

Copy link

@ngalinski-salesforce ngalinski-salesforce left a 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).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Adds values to fields of type choiceList (dropdown).
* Adds values to choiceList (dropdown) fields.

}

/**
* Returns prechat form fields sorted by their display order.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants