The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/app/api/server/helpers/isWidget.ts

13 lines
383 B

import { parse } from 'cookie';
import { API } from '../api';
(API as any).helperMethods.set('isWidget', function _isWidget() {
// @ts-expect-error
const { headers } = this.request;
const { rc_room_type: roomType, rc_is_widget: isWidget } = parse(headers.cookie || '');
const isLivechatRoom = roomType && roomType === 'l';
return !!(isLivechatRoom && isWidget === 't');
});