From d8cb03525f0ba56bc59fef9b3384acabb4624763 Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Fri, 5 Mar 2021 21:47:38 -0800 Subject: [PATCH] chore: add post message event for sending cookie to rn widget (#1860) --- app/javascript/widget/App.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/javascript/widget/App.vue b/app/javascript/widget/App.vue index 1d860e76c..82e3ce591 100755 --- a/app/javascript/widget/App.vue +++ b/app/javascript/widget/App.vue @@ -59,6 +59,16 @@ export default { this.fetchAvailableAgents(websiteToken); this.setLocale(getLocale(window.location.search)); } + // Pass cookie to react native widget + if (window.ReactNativeWebView) { + this.registerListeners(); + window.ReactNativeWebView.postMessage( + JSON.stringify({ + type: 'auth-token', + value: window.authToken, + }) + ); + } this.$store.dispatch('conversationAttributes/get'); this.setWidgetColor(window.chatwootWebChannel); this.registerUnreadEvents();