intercom-rails 0.3.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/README.md +5 -4
- data/lib/intercom-rails/shutdown_helper.rb +8 -5
- data/lib/intercom-rails/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 253fda3b6f83f376ead3c83360c0961be21060cab192d6d6ca49b0f3308fc607
|
4
|
+
data.tar.gz: 2cd892059becff0f29dc82d6aa9e85979ba2bb1da03feec6257972342e893169
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87baa5f81d73eac5cec417df64b1d3884e75e4fcb98a7397be636409479f12dab4b5ea6d601db335a6012820d05c503892c275014194cf763fa3ebcde9d4f687
|
7
|
+
data.tar.gz: bfa0536a645fa87c1af4720465aad50279c44b2edaaf245236a12efe9270406f9dd6d9ff6021f77df8d33b2b2156b788a243d5da59d326cf665fad5cf6a33b64
|
data/README.md
CHANGED
@@ -62,12 +62,13 @@ Feel free to mail us: team@intercom.io, if you're still having trouble.
|
|
62
62
|
## Configuration
|
63
63
|
|
64
64
|
### API Secret
|
65
|
-
If you want to use
|
65
|
+
It is possible to enable Identity Verification for the Intercom Messenger and you can find the documentation in how to [here](https://developers.intercom.com/docs/enable-secure-mode-on-your-web-product). If you want to use this feature, ensure you set your Identity Verification Secret as the API secret in `config/initializers/intercom.rb`:
|
66
66
|
|
67
67
|
```ruby
|
68
68
|
config.api_secret = '123456'
|
69
69
|
```
|
70
|
-
**Note: This example is just for the sake of simplicity, you should never include
|
70
|
+
**Note: This example is just for the sake of simplicity, you should never include this secret in source control. Instead, you should use the Rails [secret config](http://guides.rubyonrails.org/4_1_release_notes.html#config-secrets-yml) feature.**
|
71
|
+
|
71
72
|
### Shutdown
|
72
73
|
|
73
74
|
If you use Intercom Respond combined with another product like Engage, any user that uses a shared computer and browser with someone else will be able to see the most recently logged in user’s conversation history until the cookie expires.
|
@@ -115,7 +116,7 @@ class VisitorsController < ApplicationController
|
|
115
116
|
|
116
117
|
protected
|
117
118
|
def intercom_shutdown
|
118
|
-
IntercomRails::ShutdownHelper.intercom_shutdown(session, cookies)
|
119
|
+
IntercomRails::ShutdownHelper.intercom_shutdown(session, cookies, request.domain)
|
119
120
|
end
|
120
121
|
end
|
121
122
|
```
|
@@ -125,7 +126,7 @@ end
|
|
125
126
|
If you use another service than Devise or if you implemented your own authentication service, you can call the following method in a controller to shutdown Intercom on logout.
|
126
127
|
|
127
128
|
```ruby
|
128
|
-
IntercomRails::ShutdownHelper::intercom_shutdown_helper(cookies)
|
129
|
+
IntercomRails::ShutdownHelper::intercom_shutdown_helper(cookies, domain)
|
129
130
|
```
|
130
131
|
|
131
132
|
**Be aware that if you call this method before a 'redirect_to' (quite common on logout) it will have no impact** as it is impossible to update cookies when you use a redirection.
|
@@ -3,13 +3,16 @@ module IntercomRails
|
|
3
3
|
# This helper allows to erase cookies when a user log out of an application
|
4
4
|
# It is recommanded to call this function every time a user log out of your application
|
5
5
|
# Do not use before a redirect_to because it will not clear the cookies on a redirection
|
6
|
-
def self.intercom_shutdown_helper(cookies)
|
6
|
+
def self.intercom_shutdown_helper(cookies, domain = nil)
|
7
|
+
nil_session = { value: nil, expires: 1.day.ago }
|
8
|
+
nil_session = nil_session.merge(domain: domain) unless domain.nil? || domain == 'localhost'
|
9
|
+
|
7
10
|
if (cookies.is_a?(ActionDispatch::Cookies::CookieJar))
|
8
|
-
cookies["intercom-session-#{IntercomRails.config.app_id}"] =
|
11
|
+
cookies["intercom-session-#{IntercomRails.config.app_id}"] = nil_session
|
9
12
|
else
|
10
13
|
controller = cookies
|
11
14
|
Rails.logger.info("Warning: IntercomRails::ShutdownHelper.intercom_shutdown_helper takes an instance of ActionDispatch::Cookies::CookieJar as an argument since v0.2.34. Passing a controller is depreciated. See https://github.com/intercom/intercom-rails#shutdown for more details.")
|
12
|
-
controller.response.delete_cookie("intercom-session-#{IntercomRails.config.app_id}",
|
15
|
+
controller.response.delete_cookie("intercom-session-#{IntercomRails.config.app_id}", nil_session)
|
13
16
|
end
|
14
17
|
rescue
|
15
18
|
end
|
@@ -18,10 +21,10 @@ module IntercomRails
|
|
18
21
|
session[:perform_intercom_shutdown] = true
|
19
22
|
end
|
20
23
|
|
21
|
-
def self.intercom_shutdown(session, cookies)
|
24
|
+
def self.intercom_shutdown(session, cookies, domain = nil)
|
22
25
|
if session[:perform_intercom_shutdown]
|
23
26
|
session.delete(:perform_intercom_shutdown)
|
24
|
-
intercom_shutdown_helper(cookies)
|
27
|
+
intercom_shutdown_helper(cookies, domain)
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: intercom-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben McRedmond
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-05-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -203,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
203
|
version: '0'
|
204
204
|
requirements: []
|
205
205
|
rubyforge_project: intercom-rails
|
206
|
-
rubygems_version: 2.
|
206
|
+
rubygems_version: 2.7.4
|
207
207
|
signing_key:
|
208
208
|
specification_version: 4
|
209
209
|
summary: Rails helper for emitting javascript script tags for Intercom
|