2020-02-02 11:42:05 +01:00
|
|
|
function generateSelectKitContent(content) {
|
|
|
|
return content.map(i => ({id: i, name: i}))
|
|
|
|
}
|
|
|
|
|
2020-03-21 18:30:11 +01:00
|
|
|
function generateName(id) {
|
|
|
|
return id.replace(/[_\-]+/g, ' ')
|
|
|
|
.toLowerCase()
|
|
|
|
.replace(/(^\w|\b\w)/g, (m) => m.toUpperCase())
|
|
|
|
}
|
|
|
|
|
|
|
|
const profileFields = [
|
|
|
|
'name',
|
|
|
|
'user_avatar',
|
|
|
|
'date_of_birth',
|
|
|
|
'title',
|
|
|
|
'locale',
|
|
|
|
'location',
|
|
|
|
'website',
|
|
|
|
'bio_raw',
|
|
|
|
'profile_background',
|
|
|
|
'card_background',
|
|
|
|
'theme_id'
|
|
|
|
];
|
|
|
|
|
|
|
|
const connectors = [
|
2020-03-22 07:47:56 +01:00
|
|
|
{
|
|
|
|
id: 'eq',
|
|
|
|
name: '='
|
|
|
|
},{
|
|
|
|
id: 'gt',
|
|
|
|
name: '>'
|
|
|
|
},{
|
|
|
|
id: 'lt',
|
|
|
|
name: '<'
|
|
|
|
},{
|
|
|
|
id: 'gte',
|
|
|
|
name: '>='
|
|
|
|
},{
|
|
|
|
id: 'lte',
|
|
|
|
name: '<='
|
|
|
|
}
|
2020-03-21 18:30:11 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
const actionTypes = [
|
|
|
|
'create_topic',
|
|
|
|
'update_profile',
|
|
|
|
'create_topic',
|
|
|
|
'update_profile',
|
|
|
|
'send_message',
|
|
|
|
'send_to_api',
|
|
|
|
'add_to_group',
|
|
|
|
'route_to',
|
|
|
|
'open_composer'
|
|
|
|
];
|
|
|
|
|
|
|
|
function newInput(options = {}) {
|
|
|
|
let params = {
|
|
|
|
pairs: Ember.A([newPair(options, 0)])
|
|
|
|
}
|
|
|
|
|
|
|
|
if (options.hasOutput) {
|
|
|
|
params['output'] = '';
|
|
|
|
params['output_type'] = 'text';
|
|
|
|
}
|
|
|
|
|
|
|
|
return Ember.Object.create(params);
|
|
|
|
}
|
|
|
|
|
|
|
|
function newPair(options = {}, index) {
|
|
|
|
let params = {
|
|
|
|
index,
|
|
|
|
key: '',
|
|
|
|
key_type: 'text',
|
|
|
|
value: '',
|
|
|
|
value_type: 'text',
|
2020-03-22 07:47:56 +01:00
|
|
|
connector: 'eq'
|
2020-03-21 18:30:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return Ember.Object.create(params);
|
|
|
|
}
|
|
|
|
|
|
|
|
export {
|
|
|
|
generateSelectKitContent,
|
|
|
|
profileFields,
|
|
|
|
actionTypes,
|
|
|
|
generateName,
|
|
|
|
connectors,
|
|
|
|
newInput,
|
|
|
|
newPair
|
|
|
|
};
|