feat: update tool-chain to latest (#7975)
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
@@ -21,20 +21,19 @@ export const getters = {
|
||||
getUIFlags($state) {
|
||||
return $state.uiFlags;
|
||||
},
|
||||
isFeatureEnabledonAccount: ($state, _, __, rootGetters) => (
|
||||
id,
|
||||
featureName
|
||||
) => {
|
||||
// If a user is SuperAdmin and has access to the account, then they would see all the available features
|
||||
const isUserASuperAdmin = rootGetters.getCurrentUser?.type === 'SuperAdmin';
|
||||
if (isUserASuperAdmin) {
|
||||
return true;
|
||||
}
|
||||
isFeatureEnabledonAccount:
|
||||
($state, _, __, rootGetters) => (id, featureName) => {
|
||||
// If a user is SuperAdmin and has access to the account, then they would see all the available features
|
||||
const isUserASuperAdmin =
|
||||
rootGetters.getCurrentUser?.type === 'SuperAdmin';
|
||||
if (isUserASuperAdmin) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const { features = {} } =
|
||||
$state.records.find(record => record.id === Number(id)) || {};
|
||||
return features[featureName] || false;
|
||||
},
|
||||
const { features = {} } =
|
||||
$state.records.find(record => record.id === Number(id)) || {};
|
||||
return features[featureName] || false;
|
||||
},
|
||||
};
|
||||
|
||||
export const actions = {
|
||||
|
||||
@@ -24,14 +24,8 @@ export const actions = {
|
||||
commit(types.default.SET_CONTACT_CONVERSATIONS_UI_FLAG, {
|
||||
isCreating: true,
|
||||
});
|
||||
const {
|
||||
inboxId,
|
||||
message,
|
||||
contactId,
|
||||
sourceId,
|
||||
mailSubject,
|
||||
assigneeId,
|
||||
} = params;
|
||||
const { inboxId, message, contactId, sourceId, mailSubject, assigneeId } =
|
||||
params;
|
||||
try {
|
||||
const { data } = await ConversationApi.create({
|
||||
inbox_id: inboxId,
|
||||
|
||||
@@ -16,10 +16,8 @@ const buildContactFormData = contactParams => {
|
||||
formData.append(key, contactProperties[key]);
|
||||
}
|
||||
});
|
||||
const {
|
||||
social_profiles,
|
||||
...additionalAttributesProperties
|
||||
} = additional_attributes;
|
||||
const { social_profiles, ...additionalAttributesProperties } =
|
||||
additional_attributes;
|
||||
Object.keys(additionalAttributesProperties).forEach(key => {
|
||||
formData.append(
|
||||
`additional_attributes[${key}]`,
|
||||
|
||||
@@ -28,9 +28,8 @@ export const actions = {
|
||||
});
|
||||
|
||||
try {
|
||||
const response = await ConversationInboxApi.fetchParticipants(
|
||||
conversationId
|
||||
);
|
||||
const response =
|
||||
await ConversationInboxApi.fetchParticipants(conversationId);
|
||||
commit(types.SET_CONVERSATION_PARTICIPANTS, {
|
||||
conversationId,
|
||||
data: response.data,
|
||||
|
||||
@@ -27,9 +27,8 @@ export const actions = {
|
||||
get: async function getCustomViews({ commit }, filterType) {
|
||||
commit(types.SET_CUSTOM_VIEW_UI_FLAG, { isFetching: true });
|
||||
try {
|
||||
const response = await CustomViewsAPI.getCustomViewsByFilterType(
|
||||
filterType
|
||||
);
|
||||
const response =
|
||||
await CustomViewsAPI.getCustomViewsByFilterType(filterType);
|
||||
commit(types.SET_CUSTOM_VIEW, response.data);
|
||||
} catch (error) {
|
||||
// Ignore error
|
||||
|
||||
@@ -5,12 +5,14 @@ export const getters = {
|
||||
return { isFetching: false, isUpdating: false, isDeleting: false };
|
||||
},
|
||||
isFetching: state => state.uiFlags.isFetching,
|
||||
articleById: (...getterArguments) => articleId => {
|
||||
const [state] = getterArguments;
|
||||
const article = state.articles.byId[articleId];
|
||||
if (!article) return undefined;
|
||||
return article;
|
||||
},
|
||||
articleById:
|
||||
(...getterArguments) =>
|
||||
articleId => {
|
||||
const [state] = getterArguments;
|
||||
const article = state.articles.byId[articleId];
|
||||
if (!article) return undefined;
|
||||
return article;
|
||||
},
|
||||
allArticles: (...getterArguments) => {
|
||||
const [state, _getters] = getterArguments;
|
||||
const articles = state.articles.allIds
|
||||
@@ -20,12 +22,14 @@ export const getters = {
|
||||
.filter(article => article !== undefined);
|
||||
return articles;
|
||||
},
|
||||
articleStatus: (...getterArguments) => articleId => {
|
||||
const [state] = getterArguments;
|
||||
const article = state.articles.byId[articleId];
|
||||
if (!article) return undefined;
|
||||
return article.status;
|
||||
},
|
||||
articleStatus:
|
||||
(...getterArguments) =>
|
||||
articleId => {
|
||||
const [state] = getterArguments;
|
||||
const article = state.articles.byId[articleId];
|
||||
if (!article) return undefined;
|
||||
return article.status;
|
||||
},
|
||||
getMeta: state => {
|
||||
return state.meta;
|
||||
},
|
||||
|
||||
@@ -108,7 +108,7 @@ describe('#mutations', () => {
|
||||
expect(state.articles.byId).toEqual({});
|
||||
expect(state.articles.uiFlags).toEqual({
|
||||
byId: {
|
||||
'1': { isFetching: false, isUpdating: true, isDeleting: false },
|
||||
1: { isFetching: false, isUpdating: true, isDeleting: false },
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,12 +5,14 @@ export const getters = {
|
||||
return { isFetching: false, isUpdating: false, isDeleting: false };
|
||||
},
|
||||
isFetching: state => state.uiFlags.isFetching,
|
||||
categoryById: (...getterArguments) => categoryId => {
|
||||
const [state] = getterArguments;
|
||||
const category = state.categories.byId[categoryId];
|
||||
if (!category) return undefined;
|
||||
return category;
|
||||
},
|
||||
categoryById:
|
||||
(...getterArguments) =>
|
||||
categoryId => {
|
||||
const [state] = getterArguments;
|
||||
const category = state.categories.byId[categoryId];
|
||||
if (!category) return undefined;
|
||||
return category;
|
||||
},
|
||||
allCategories: (...getterArguments) => {
|
||||
const [state, _getters] = getterArguments;
|
||||
const categories = state.categories.allIds.map(id => {
|
||||
@@ -18,13 +20,15 @@ export const getters = {
|
||||
});
|
||||
return categories;
|
||||
},
|
||||
categoriesByLocaleCode: (...getterArguments) => localeCode => {
|
||||
const [state, _getters] = getterArguments;
|
||||
const categories = state.categories.allIds.map(id => {
|
||||
return _getters.categoryById(id);
|
||||
});
|
||||
return categories.filter(category => category.locale === localeCode);
|
||||
},
|
||||
categoriesByLocaleCode:
|
||||
(...getterArguments) =>
|
||||
localeCode => {
|
||||
const [state, _getters] = getterArguments;
|
||||
const categories = state.categories.allIds.map(id => {
|
||||
return _getters.categoryById(id);
|
||||
});
|
||||
return categories.filter(category => category.locale === localeCode);
|
||||
},
|
||||
getMeta: state => {
|
||||
return state.meta;
|
||||
},
|
||||
|
||||
@@ -6,12 +6,14 @@ export const getters = {
|
||||
},
|
||||
|
||||
isFetchingPortals: state => state.uiFlags.isFetching,
|
||||
portalBySlug: (...getterArguments) => portalId => {
|
||||
const [state] = getterArguments;
|
||||
const portal = state.portals.byId[portalId];
|
||||
portalBySlug:
|
||||
(...getterArguments) =>
|
||||
portalId => {
|
||||
const [state] = getterArguments;
|
||||
const portal = state.portals.byId[portalId];
|
||||
|
||||
return portal;
|
||||
},
|
||||
return portal;
|
||||
},
|
||||
allPortals: (...getterArguments) => {
|
||||
const [state, _getters] = getterArguments;
|
||||
const portals = state.portals.allIds.map(id => {
|
||||
|
||||
@@ -76,10 +76,8 @@ export const getters = {
|
||||
},
|
||||
getNewConversationInboxes($state) {
|
||||
return $state.records.filter(inbox => {
|
||||
const {
|
||||
channel_type: channelType,
|
||||
phone_number: phoneNumber = '',
|
||||
} = inbox;
|
||||
const { channel_type: channelType, phone_number: phoneNumber = '' } =
|
||||
inbox;
|
||||
|
||||
const isEmailChannel = channelType === INBOX_TYPES.EMAIL;
|
||||
const isSmsChannel =
|
||||
|
||||
@@ -80,7 +80,7 @@ describe('#mutations', () => {
|
||||
],
|
||||
};
|
||||
|
||||
mutations[types.default.UPDATE_AGENTS_PRESENCE](state, { '1': 'busy' });
|
||||
mutations[types.default.UPDATE_AGENTS_PRESENCE](state, { 1: 'busy' });
|
||||
expect(state.records).toEqual([
|
||||
{
|
||||
id: 1,
|
||||
|
||||
Reference in New Issue
Block a user