Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions intercom_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 9.4.19

* Bump `intercom_flutter_web` to `1.1.11`

## 9.4.18

* Bump Intercom iOS SDK version to [19.3.4](https://github.com/intercom/intercom-ios/releases/tag/19.3.4)
Expand Down
4 changes: 2 additions & 2 deletions intercom_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: intercom_flutter
description: Flutter plugin for Intercom integration. Provides in-app messaging
and help-center Intercom services
version: 9.4.18
version: 9.4.19
homepage: https://github.com/v3rm0n/intercom_flutter

dependencies:
Expand All @@ -10,7 +10,7 @@ dependencies:
flutter_web_plugins:
sdk: flutter
intercom_flutter_platform_interface: ^2.0.6
intercom_flutter_web: ^1.1.10
intercom_flutter_web: ^1.1.11

dev_dependencies:
flutter_test:
Expand Down
5 changes: 5 additions & 0 deletions intercom_flutter_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.1.11

* JSON-encode `intercomSettings` before injecting the Intercom script to avoid invalid JavaScript
syntax. Fixes [#582](https://github.com/v3rm0n/intercom_flutter/issues/582)

## 1.1.10

* Implemented method `setThemeMode`.
Expand Down
2 changes: 1 addition & 1 deletion intercom_flutter_web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ This package is already included as part of the `intercom_flutter` package depen

But if you want to use this package as alone, add the dependency `intercom_flutter_web`.
You don't need to add Intercom script in the index.html file, it will be automatically injected.
But you can pre-define some Intercom settings, if you want (optional).
But you can pre-define some Intercom settings, if you want (optional), such as `api_base`, `hide_default_launcher`, etc.
```html
<script>
window.intercomSettings = {
Expand Down
3 changes: 2 additions & 1 deletion intercom_flutter_web/lib/intercom_flutter_web.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:convert';
import 'dart:js_interop';
import 'dart:js_interop_unsafe';

Expand Down Expand Up @@ -52,7 +53,7 @@ class IntercomFlutterWeb extends IntercomFlutterPlatform {
web.HTMLScriptElement script =
web.document.createElement("script") as web.HTMLScriptElement;
script.text = """
window.intercomSettings = ${updateIntercomSettings('app_id', "'$appId'")};
window.intercomSettings = ${jsonEncode(updateIntercomSettings('app_id', appId))};
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/' + '$appId';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s, x);};if(document.readyState==='complete'){l();}else if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
""";
if (web.document.body != null) {
Expand Down
2 changes: 1 addition & 1 deletion intercom_flutter_web/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: intercom_flutter_web
description: Web platform implementation of intercom_flutter
version: 1.1.10
version: 1.1.11
homepage: https://github.com/v3rm0n/intercom_flutter

flutter:
Expand Down
Loading