Feature: Rich Message Types (#610)
Co-authored-by: Pranav Raj S <pranavrajs@gmail.com> Co-authored-by: Nithin David Thomas <webofnithin@gmail.com>
This commit is contained in:
@@ -188,7 +188,10 @@ export const mutations = {
|
||||
updateMessage($state, { id, content_attributes }) {
|
||||
$state.conversations[id] = {
|
||||
...$state.conversations[id],
|
||||
content_attributes,
|
||||
content_attributes: {
|
||||
...($state.conversations[id].content_attributes || {}),
|
||||
...content_attributes,
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
19
app/javascript/widget/store/modules/events.js
Normal file
19
app/javascript/widget/store/modules/events.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import events from 'widget/api/events';
|
||||
|
||||
const actions = {
|
||||
create: async (_, { name }) => {
|
||||
try {
|
||||
await events.create(name);
|
||||
} catch (error) {
|
||||
// Ignore error
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {},
|
||||
getters: {},
|
||||
actions,
|
||||
mutations: {},
|
||||
};
|
||||
@@ -1,4 +1,4 @@
|
||||
import MessageAPI from 'widget/api/message';
|
||||
import MessageAPI from '../../api/message';
|
||||
import { refreshActionCableConnector } from '../../helpers/actionCable';
|
||||
|
||||
const state = {
|
||||
@@ -12,19 +12,24 @@ const getters = {
|
||||
};
|
||||
|
||||
const actions = {
|
||||
updateContactAttributes: async ({ commit }, { email, messageId }) => {
|
||||
update: async ({ commit }, { email, messageId, submittedValues }) => {
|
||||
commit('toggleUpdateStatus', true);
|
||||
try {
|
||||
const {
|
||||
data: {
|
||||
contact: { pubsub_token: pubsubToken },
|
||||
},
|
||||
} = await MessageAPI.update({ email, messageId });
|
||||
data: { contact: { pubsub_token: pubsubToken } = {} },
|
||||
} = await MessageAPI.update({
|
||||
email,
|
||||
messageId,
|
||||
values: submittedValues,
|
||||
});
|
||||
commit(
|
||||
'conversation/updateMessage',
|
||||
{
|
||||
id: messageId,
|
||||
content_attributes: { submitted_email: email },
|
||||
content_attributes: {
|
||||
submitted_email: email,
|
||||
submitted_values: email ? null : submittedValues,
|
||||
},
|
||||
},
|
||||
{ root: true }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user