feat: Custom fields in pre-chat form (#4189)

This commit is contained in:
Muhsin Keloth
2022-04-19 12:47:29 +05:30
committed by GitHub
parent 1ccd29140d
commit 26f23a6e21
25 changed files with 824 additions and 160 deletions

View File

@@ -16,6 +16,9 @@ export const getters = {
getUIFlags(_state) {
return _state.uiFlags;
},
getAttributes: _state => {
return _state.records;
},
getAttributesByModel: _state => attributeModel => {
return _state.records.filter(
record => record.attribute_model === attributeModel

View File

@@ -2,6 +2,26 @@ import { getters } from '../../attributes';
import attributesList from './fixtures';
describe('#getters', () => {
it('getAttributes', () => {
const state = { records: attributesList };
expect(getters.getAttributes(state)).toEqual([
{
attribute_display_name: 'Language',
attribute_display_type: 1,
attribute_description: 'The conversation language',
attribute_key: 'language',
attribute_model: 0,
},
{
attribute_display_name: 'Language one',
attribute_display_type: 2,
attribute_description: 'The conversation language one',
attribute_key: 'language_one',
attribute_model: 1,
},
]);
});
it('getAttributesByModel', () => {
const state = { records: attributesList };
expect(getters.getAttributesByModel(state)(1)).toEqual([