feat: Add chatwoot:error sdk event (#3998)

This commit is contained in:
Muhsin Keloth
2022-02-21 09:40:11 +05:30
committed by GitHub
parent 3b015d4dd8
commit 7ba24b90c4
12 changed files with 59 additions and 29 deletions

View File

@@ -2,17 +2,12 @@ import Cookies from 'js-cookie';
import { IFrameHelper } from '../sdk/IFrameHelper';
import { getBubbleView } from '../sdk/bubbleHelpers';
import md5 from 'md5';
import { getUserCookieName } from '../sdk/cookieHelpers';
const REQUIRED_USER_KEYS = ['avatar_url', 'email', 'name'];
const ALLOWED_USER_ATTRIBUTES = [...REQUIRED_USER_KEYS, 'identifier_hash'];
export const getUserCookieName = () => {
const SET_USER_COOKIE_PREFIX = 'cw_user_';
const { websiteToken: websiteIdentifier } = window.$chatwoot;
return `${SET_USER_COOKIE_PREFIX}${websiteIdentifier}`;
};
export const getUserString = ({ identifier = '', user }) => {
const userStringWithSortedKeys = ALLOWED_USER_ATTRIBUTES.reduce(
(acc, key) => `${acc}${key}${user[key] || ''}`,