-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[NEW][ENTERPRISE] Support for custom Livechat registration form fields #17581
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
Merged
sampaiodiego
merged 15 commits into
develop
from
omnichannel/support-custom-fields-livechat-registration-forms
May 21, 2020
Merged
Changes from 11 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6c9c5c7
Start sharing livechat custom fields to widget.
renatobecker 5ce0a07
Merge branch 'develop' into omnichannel/support-custom-fields-livecha…
renatobecker 65f2f2b
Merge branch 'develop' into omnichannel/support-custom-fields-livecha…
renatobecker 34b7e3d
Share custom fields with the scope = visitor.
renatobecker 92b595b
Merge branch 'develop' into omnichannel/support-custom-fields-livecha…
renatobecker 455b6bf
Add setting description.
renatobecker f6c46a3
Improve the appearance of custom fields in the Omnichannel Room Info …
renatobecker 48ceed9
Merge branch 'develop' into omnichannel/support-custom-fields-livecha…
renatobecker 16bb9f6
Add regular expression to validate comma-separated list.
renatobecker df96ff6
Merge branch 'develop' into omnichannel/support-custom-fields-livecha…
renatobecker 6fa6ba1
Fix conflicts.
renatobecker 6351525
Merge branch 'develop' into omnichannel/support-custom-fields-livecha…
renatobecker 6dee2f5
Fix review suggestions.
renatobecker 2498620
Merge branch 'omnichannel/support-custom-fields-livechat-registration…
renatobecker 7f685ba
Merge branch 'develop' into omnichannel/support-custom-fields-livecha…
ggazzo 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
22 changes: 22 additions & 0 deletions
22
app/livechat/client/views/app/tabbar/visitorEditCustomField.html
This file contains hidden or 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,22 @@ | ||
| <template name="visitorEditCustomField"> | ||
| <div class="rc-input rc-form-group rc-form-group--small"> | ||
| <label class="rc-input__label"> | ||
| <div class="rc-input__title">{{label}}</div> | ||
| {{#if $eq type 'select'}} | ||
| <div class="rc-select"> | ||
| <select name="{{name}}" class="rc-select__element" data-visitorLivechatData="{{$eq scope 'visitor'}}" data-roomLivechatData="{{$eq scope 'room'}}" disabled="{{disabled}}"> | ||
| <option value=""></option> | ||
| {{#each optionsList}} | ||
| <option value="{{.}}" selected="{{selectedField . ..}}">{{.}}</option> | ||
| {{/each}} | ||
| </select> | ||
| {{> icon block="rc-select__arrow" icon="arrow-down" }} | ||
| </div> | ||
| {{else}} | ||
| <div class="rc-input__wrapper"> | ||
| <input class="rc-input__element" type="text" name="{{name}}" autocomplete="off" data-visitorLivechatData="{{$eq scope 'visitor'}}" data-roomLivechatData="{{$eq scope 'room'}}" disabled="{{disabled}}" value="{{value}}"> | ||
| </div> | ||
| {{/if}} | ||
| </label> | ||
| </div> | ||
| </template> |
21 changes: 21 additions & 0 deletions
21
app/livechat/client/views/app/tabbar/visitorEditCustomField.js
This file contains hidden or 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,21 @@ | ||
| import { Template } from 'meteor/templating'; | ||
|
|
||
| import './visitorEditCustomField.html'; | ||
|
|
||
| Template.visitorEditCustomField.helpers({ | ||
| optionsList() { | ||
| if (!this.options) { | ||
| return []; | ||
| } | ||
|
|
||
| return this.options.split(','); | ||
| }, | ||
| selectedField(current) { | ||
| const { fieldData: { value } } = Template.instance(); | ||
|
renatobecker marked this conversation as resolved.
Outdated
|
||
| return value.trim() === current.trim(); | ||
| }, | ||
| }); | ||
|
|
||
| Template.visitorEditCustomField.onCreated(function() { | ||
| this.fieldData = Template.currentData() || {}; | ||
|
renatobecker marked this conversation as resolved.
Outdated
|
||
| }); | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
42 changes: 42 additions & 0 deletions
42
...echat-enterprise/client/views/app/customTemplates/livechatCustomFieldsAdditionalForm.html
This file contains hidden or 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,42 @@ | ||
| <template name="livechatCustomFieldsAdditionalForm"> | ||
| <div class="input-line"> | ||
| <label>{{_ "Required"}}</label> | ||
| <div> | ||
| <select name="required" class="rc-input__element additional-field"> | ||
| <option value="false" selected="{{$eq customField.required false}}">{{_ "No"}}</option> | ||
| <option value="true" selected="{{$eq customField.required true}}">{{_ "Yes"}}</option> | ||
| </select> | ||
| </div> | ||
| </div> | ||
| <div class="input-line"> | ||
| <label>{{_ "Type"}}</label> | ||
| <div> | ||
| <select name="type" class="rc-input__element additional-field"> | ||
| <option value="input" selected="{{$eq customField.type 'input'}}">{{_ "Input"}}</option> | ||
| <option value="select" selected="{{$eq customField.type 'select'}}">{{_ "Select"}}</option> | ||
| </select> | ||
| </div> | ||
| </div> | ||
| <div class="input-line"> | ||
| <label>{{_ "Default_value"}}</label> | ||
| <div> | ||
| <input type="text" class="rc-input__element additional-field" name="defaultValue" value="{{customField.defaultValue}}" placeholder="{{_ "Default_value"}}" /> | ||
| </div> | ||
| </div> | ||
| <div class="input-line"> | ||
| <label>{{_ "Options"}}</label> | ||
| <div> | ||
| <input type="text" class="rc-input__element additional-field" name="options" disabled="{{$neq customField.type 'select'}}" value="{{customField.options}}" placeholder="{{_ "Livechat_custom_fields_options_placeholder"}}" /> | ||
| </div> | ||
| </div> | ||
| <div class="input-line"> | ||
| <label>{{_ "Public"}}</label> | ||
| <div> | ||
| <select name="public" class="rc-input__element additional-field" disabled="{{$eq customField.visibility 'hidden'}}"> | ||
| <option value="false" selected="{{$eq customField.public false}}">{{_ "No"}}</option> | ||
| <option value="true" selected="{{$eq customField.public true}}">{{_ "Yes"}}</option> | ||
| </select> | ||
| </div> | ||
| <div class="settings-description secondary-font-color">{{{_ "Livechat_custom_fields_public_description"}}}</div> | ||
| </div> | ||
| </template> |
37 changes: 37 additions & 0 deletions
37
...ivechat-enterprise/client/views/app/customTemplates/livechatCustomFieldsAdditionalForm.js
This file contains hidden or 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,37 @@ | ||
| import { ReactiveVar } from 'meteor/reactive-var'; | ||
| import { Template } from 'meteor/templating'; | ||
| import toastr from 'toastr'; | ||
|
|
||
| import './livechatCustomFieldsAdditionalForm.html'; | ||
| import { t } from '../../../../../../../app/utils/client'; | ||
|
|
||
| Template.livechatCustomFieldsAdditionalForm.helpers({ | ||
| customField() { | ||
| return Template.instance().customField.get(); | ||
| }, | ||
| }); | ||
|
|
||
| Template.livechatCustomFieldsAdditionalForm.onCreated(function() { | ||
| this.customField = new ReactiveVar({}); | ||
|
|
||
| this.autorun(() => { | ||
| // To make this template reactive we expect a ReactiveVar through the data property, | ||
| // because the parent form may not be rerender, only the dynamic template data | ||
| this.customField.set({ ...this.data.get() }); | ||
| }); | ||
| }); | ||
|
|
||
| Template.livechatCustomFieldsAdditionalForm.events({ | ||
| 'change .additional-field'(e, instance) { | ||
| const { target: { name, value } } = e; | ||
| instance.customField.set({ ...instance.customField.get(), [name]: value }); | ||
| }, | ||
|
|
||
| 'blur [name="options"]'(e) { | ||
| const { currentTarget: { value } } = e; | ||
| if (value.trim() !== '' && !/^([a-zA-Z0-9-_ ]+)(,\s*[a-zA-Z0-9-_ ]+)*$/i.test(value)) { | ||
| toastr.error(t('error-invalid-value')); | ||
| e.currentTarget.focus(); | ||
| } | ||
| }, | ||
| }); |
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.
Uh oh!
There was an error while loading. Please reload this page.