feat: Add a popout option on webwidget (#1174)
* feat: Add a popout option on webwidget
This commit is contained in:
parent
ce13efd273
commit
45cd949c40
17 changed files with 347 additions and 127 deletions
|
@ -1,4 +1,5 @@
|
|||
import Vue from 'vue';
|
||||
|
||||
export const buildSearchParamsWithLocale = search => {
|
||||
const locale = Vue.config.lang;
|
||||
if (search) {
|
||||
|
@ -8,3 +9,23 @@ export const buildSearchParamsWithLocale = search => {
|
|||
}
|
||||
return search;
|
||||
};
|
||||
|
||||
export const getLocale = (search = '') => {
|
||||
const searchParamKeyValuePairs = search.split('&');
|
||||
return searchParamKeyValuePairs.reduce((acc, keyValuePair) => {
|
||||
const [key, value] = keyValuePair.split('=');
|
||||
if (key === 'locale') {
|
||||
return value;
|
||||
}
|
||||
return acc;
|
||||
}, undefined);
|
||||
};
|
||||
|
||||
export const buildPopoutURL = ({
|
||||
origin,
|
||||
conversationCookie,
|
||||
websiteToken,
|
||||
locale,
|
||||
}) => {
|
||||
return `${origin}/widget?cw_conversation=${conversationCookie}&website_token=${websiteToken}&locale=${locale}`;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue