forked from github/cinny
Fixes complaints of null contentDocument in iframe
This commit is contained in:
@@ -218,8 +218,8 @@ export function CallProvider({ children }: CallProviderProps) {
|
|||||||
} else if (activeClientWidget) {
|
} else if (activeClientWidget) {
|
||||||
logger.debug('3 Hangup');
|
logger.debug('3 Hangup');
|
||||||
const iframeDoc =
|
const iframeDoc =
|
||||||
activeClientWidget?.iframe.contentDocument ||
|
activeClientWidget?.iframe?.contentDocument ||
|
||||||
activeClientWidget?.iframe.contentWindow.document;
|
activeClientWidget?.iframe?.contentWindow.document;
|
||||||
const button = iframeDoc.querySelector('[data-testid="incall_leave"]');
|
const button = iframeDoc.querySelector('[data-testid="incall_leave"]');
|
||||||
button.click();
|
button.click();
|
||||||
}
|
}
|
||||||
@@ -311,8 +311,8 @@ export function CallProvider({ children }: CallProviderProps) {
|
|||||||
setActiveCallRoomIdState(viewedCallRoomId);
|
setActiveCallRoomIdState(viewedCallRoomId);
|
||||||
setIsCallActive(true);
|
setIsCallActive(true);
|
||||||
const iframeDoc =
|
const iframeDoc =
|
||||||
viewedClientWidget?.iframe.contentDocument ||
|
viewedClientWidget?.iframe?.contentDocument ||
|
||||||
viewedClientWidget?.iframe.contentWindow.document;
|
viewedClientWidget?.iframe?.contentWindow.document;
|
||||||
const observer = new MutationObserver(() => {
|
const observer = new MutationObserver(() => {
|
||||||
const button = iframeDoc.querySelector('[data-testid="incall_leave"]');
|
const button = iframeDoc.querySelector('[data-testid="incall_leave"]');
|
||||||
if (button) {
|
if (button) {
|
||||||
@@ -328,8 +328,8 @@ export function CallProvider({ children }: CallProviderProps) {
|
|||||||
if (ev.detail.widgetId === activeClientWidgetApi?.widget.id) {
|
if (ev.detail.widgetId === activeClientWidgetApi?.widget.id) {
|
||||||
activeClientWidgetApi?.transport.reply(ev.detail, {});
|
activeClientWidgetApi?.transport.reply(ev.detail, {});
|
||||||
const iframeDoc =
|
const iframeDoc =
|
||||||
activeClientWidget?.iframe.contentDocument ||
|
activeClientWidget?.iframe?.contentDocument ||
|
||||||
activeClientWidget?.iframe.contentWindow.document;
|
activeClientWidget?.iframe?.contentWindow.document;
|
||||||
const observer = new MutationObserver(() => {
|
const observer = new MutationObserver(() => {
|
||||||
const button = iframeDoc.querySelector('[data-testid="incall_leave"]');
|
const button = iframeDoc.querySelector('[data-testid="incall_leave"]');
|
||||||
if (button) {
|
if (button) {
|
||||||
@@ -406,8 +406,8 @@ export function CallProvider({ children }: CallProviderProps) {
|
|||||||
viewedClientWidget,
|
viewedClientWidget,
|
||||||
setViewedCallRoomId,
|
setViewedCallRoomId,
|
||||||
lastViewedRoomDuringCall,
|
lastViewedRoomDuringCall,
|
||||||
activeClientWidget?.iframe.contentDocument,
|
activeClientWidget?.iframe?.contentDocument,
|
||||||
activeClientWidget?.iframe.contentWindow.document,
|
activeClientWidget?.iframe?.contentWindow?.document,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const sendWidgetAction = useCallback(
|
const sendWidgetAction = useCallback(
|
||||||
|
|||||||
Reference in New Issue
Block a user