import proxy from '../../../libs/http-common'
import { linkPreviewURL } from '../../../services/api'
const getDefaultCommonSharingVideo = () => {
return {
name: '',
title: '',
mime_type: '',
link: '',
duration: '00:00:00.00',
size: 0,
thumbnail: '',
thumbnails_suggestions: [],
converted_video: '',
converted_link: '',
converted_mime_type: '',
converted_size: 0
}
}
const getDefaultCommonSelection = () => {
return {
message: '',
title: '',
description: '',
image: [],
video: getDefaultCommonSharingVideo(),
url: '',
image_suggestions: [],
mentions: []
}
}
const getDefaultCommonPreview = () => {
return {
facebook_url: '',
twitter_url: '',
linkedin_url: '',
pinterest_url: '',
tumblr_url: '',
instagram_url: '',
source_url: '',
website: ''
}
}
export default{
state: {
status: false,
preview_cancelled: false,
selection: { ...getDefaultCommonSelection(), ...getDefaultCommonPreview() }
},
getters: {
getCommonBox: state => {
return state
}
},
actions: {
},
mutations: {
SET_COMMON_BOX_MESSAGE (state, value) {
state.selection.message = value
},
SET_COMMON_BOX_PREVIEW (state, preview) {
if (preview.title) {
state.selection = Object.assign(state.selection, preview)
} else {
state.selection = Object.assign(state.selection, getDefaultCommonPreview())
}
console.log('CommonBoxPreview Selection', state.selection)
},
SET_COMMON_BOX_PREVIEW_CANCELLED (state, value) {
state.preview_cancelled = value
state.selection = Object.assign(state.selection, { ...getDefaultCommonPreview(), ...{ title: '', description: '', url: '' } })
},
SET_COMMON_BOX_PREVIEW_IMAGE (state, value) {
state.selection.image = value
},
SET_COMMON_BOX_URL (state, value) {
state.selection.url = value
}
}
}