From b19af2216418dafebceb6eb48e00544035c080bb Mon Sep 17 00:00:00 2001 From: Martin Verzilli Date: Fri, 23 Nov 2018 18:10:11 -0300 Subject: [PATCH 01/15] Add Intercom --- Gemfile | 1 + Gemfile.lock | 5 +- README.md | 7 ++ app/controllers/home_controller.rb | 7 ++ app/controllers/sessions_controller.rb | 8 ++ config/initializers/intercom.rb | 114 +++++++++++++++++++++++++ config/routes.rb | 2 +- 7 files changed, 142 insertions(+), 2 deletions(-) create mode 100644 app/controllers/sessions_controller.rb create mode 100644 config/initializers/intercom.rb diff --git a/Gemfile b/Gemfile index 6318563..31536d1 100644 --- a/Gemfile +++ b/Gemfile @@ -43,6 +43,7 @@ gem 'guid' gem 'instedd-bootstrap', github: "instedd/instedd-bootstrap", branch: 'master' gem 'hub_client', github: 'instedd/ruby-hub_client', branch: 'master' gem 'instedd_telemetry', github: 'instedd/telemetry_rails', branch: 'master' +gem 'intercom-rails' group :assets do gem 'sass-rails', '~> 3.2.3' diff --git a/Gemfile.lock b/Gemfile.lock index 8af01df..636c275 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -194,6 +194,8 @@ GEM httpclient (2.5.3.3) i18n (0.6.11) ice_cube (0.11.0) + intercom-rails (0.4.0) + activesupport (> 3.0) journey (1.0.4) jquery-rails (3.0.4) railties (>= 3.0, < 5.0) @@ -377,6 +379,7 @@ DEPENDENCIES instedd-bootstrap! instedd-pigeon! instedd_telemetry! + intercom-rails jquery-rails listings machinist @@ -406,4 +409,4 @@ DEPENDENCIES underscore-rails BUNDLED WITH - 1.10.6 + 1.11.2 diff --git a/README.md b/README.md index 263c9a9..e152c08 100644 --- a/README.md +++ b/README.md @@ -71,3 +71,10 @@ root@web_1 $ rake powered by capistrano. `$ HOSTS= cap deploy`. Configuration files are symlinked in a shared path. check `symlink_configs` task. + +## Intercom + +mBuilder supports Intercom as its CRM platform. To load the Intercom chat widget, simply start mBuilder with the env variable `INTERCOM_APP_ID` set to your Intercom app id (https://www.intercom.com/help/faqs-and-troubleshooting/getting-set-up/where-can-i-find-my-workspace-id-app-id). +mBuilder will forward any conversation with a logged user identifying them through their email address. Anonymous, unlogged users will also be able to communicate. +If you don't want to use Intercom, you can simply omit `INTERCOM_APP_ID` or set it to `''`. +To test the feature in development, add the `INTERCOM_APP_ID` variable and its value to the `environment` object inside the `web` service in `docker-compose.yml`. \ No newline at end of file diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index fe1b0f9..0f0e26a 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,7 +1,14 @@ class HomeController < ApplicationController + after_filter :intercom_shutdown, :only => [:index] + def index end def test end + + protected + def intercom_shutdown + IntercomRails::ShutdownHelper.intercom_shutdown(session, cookies, request.domain) + end end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb new file mode 100644 index 0000000..7798d40 --- /dev/null +++ b/app/controllers/sessions_controller.rb @@ -0,0 +1,8 @@ +class SessionsController < Devise::SessionsController + after_filter :prepare_intercom_shutdown, :only => [:destroy] + + protected + def prepare_intercom_shutdown + IntercomRails::ShutdownHelper.prepare_intercom_shutdown(session) + end +end diff --git a/config/initializers/intercom.rb b/config/initializers/intercom.rb new file mode 100644 index 0000000..aa99c53 --- /dev/null +++ b/config/initializers/intercom.rb @@ -0,0 +1,114 @@ +IntercomRails.config do |config| + # == Intercom app_id + # + config.app_id = ENV["INTERCOM_APP_ID"] || "v922phcl" + + # == Intercom session_duration + # + # config.session_duration = 300000 + # == Intercom secret key + # This is required to enable Identity Verification, you can find it on your Setup + # guide in the "Identity Verification" step. + # + # config.api_secret = "..." + + # == Enabled Environments + # Which environments is auto inclusion of the Javascript enabled for + # + config.enabled_environments = ["development", "production"] + + # == Current user method/variable + # The method/variable that contains the logged in user in your controllers. + # If it is `current_user` or `@user`, then you can ignore this + # + # config.user.current = Proc.new { current_user } + # config.user.current = [Proc.new { current_user }] + + # == Include for logged out Users + # If set to true, include the Intercom messenger on all pages, regardless of whether + # The user model class (set below) is present. + config.include_for_logged_out_users = true + + # == User model class + # The class which defines your user model + # + # config.user.model = Proc.new { User } + + # == Lead/custom attributes for non-signed up users + # Pass additional attributes to for potential leads or + # non-signed up users as an an array. + # Any attribute contained in config.user.lead_attributes can be used + # as custom attribute in the application. + # config.user.lead_attributes = %w(ref_data utm_source) + + # == Exclude users + # A Proc that given a user returns true if the user should be excluded + # from imports and Javascript inclusion, false otherwise. + # + # config.user.exclude_if = Proc.new { |user| user.deleted? } + + # == User Custom Data + # A hash of additional data you wish to send about your users. + # You can provide either a method name which will be sent to the current + # user object, or a Proc which will be passed the current user. + # + # config.user.custom_data = { + # :plan => Proc.new { |current_user| current_user.plan.name }, + # :favorite_color => :favorite_color + # } + + # == Current company method/variable + # The method/variable that contains the current company for the current user, + # in your controllers. 'Companies' are generic groupings of users, so this + # could be a company, app or group. + # + # config.company.current = Proc.new { current_company } + # + # Or if you are using devise you can just use the following config + # + # config.company.current = Proc.new { current_user.company } + + # == Exclude company + # A Proc that given a company returns true if the company should be excluded + # from imports and Javascript inclusion, false otherwise. + # + # config.company.exclude_if = Proc.new { |app| app.subdomain == 'demo' } + + # == Company Custom Data + # A hash of additional data you wish to send about a company. + # This works the same as User custom data above. + # + # config.company.custom_data = { + # :number_of_messages => Proc.new { |app| app.messages.count }, + # :is_interesting => :is_interesting? + # } + + # == Company Plan name + # This is the name of the plan a company is currently paying (or not paying) for. + # e.g. Messaging, Free, Pro, etc. + # + # config.company.plan = Proc.new { |current_company| current_company.plan.name } + + # == Company Monthly Spend + # This is the amount the company spends each month on your app. If your company + # has a plan, it will set the 'total value' of that plan appropriately. + # + # config.company.monthly_spend = Proc.new { |current_company| current_company.plan.price } + # config.company.monthly_spend = Proc.new { |current_company| (current_company.plan.price - current_company.subscription.discount) } + + # == Custom Style + # By default, Intercom will add a button that opens the messenger to + # the page. If you'd like to use your own link to open the messenger, + # uncomment this line and clicks on any element with id 'Intercom' will + # open the messenger. + # + # config.inbox.style = :custom + # + # If you'd like to use your own link activator CSS selector + # uncomment this line and clicks on any element that matches the query will + # open the messenger + # config.inbox.custom_activator = '.intercom' + # + # If you'd like to hide default launcher button uncomment this line + # config.hide_default_launcher = true +end diff --git a/config/routes.rb b/config/routes.rb index 92a1b5e..50001a3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,7 +3,7 @@ get "logs/index" - devise_for :users, controllers: {omniauth_callbacks: 'omniauth_callbacks'} + devise_for :users, controllers: {omniauth_callbacks: 'omniauth_callbacks', sessions: 'sessions'} guisso_for :user resources :applications do From 2c60e330aebb7b9412ab9bc50261eb7f23f3c525 Mon Sep 17 00:00:00 2001 From: Martin Verzilli Date: Fri, 23 Nov 2018 18:14:43 -0300 Subject: [PATCH 02/15] Change Ruby version --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 7fa1d1e..227cea2 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.0.0-p353 +2.0.0 From 163938809e806a0e53542a3cba16853153985b97 Mon Sep 17 00:00:00 2001 From: Martin Verzilli Date: Mon, 26 Nov 2018 15:18:55 -0300 Subject: [PATCH 03/15] Try xenial in Travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a6bd9b7..5058e81 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +dist: xenial language: ruby cache: bundler services: From 3a45e06ede5747966dd3edfb8d63c56eb21ccf67 Mon Sep 17 00:00:00 2001 From: Martin Verzilli Date: Mon, 26 Nov 2018 15:38:40 -0300 Subject: [PATCH 04/15] Move travis CI to docker --- .travis.yml | 21 +++++++++++++++------ docker-compose.ci.yml | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 docker-compose.ci.yml diff --git a/.travis.yml b/.travis.yml index 5058e81..8dc9cdb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,21 @@ -dist: xenial language: ruby -cache: bundler +cache: + - bundler + directories: + - ~/cache services: - - elasticsearch -before_script: - - bundle exec rake db:setup + - docker +before_install: + - docker-compose --version + - mv docker-compose.ci.yml docker-compose.override.yml + - docker-compose pull + - docker-compose run --rm --no-deps web bundle install + - docker-compose up -d db + - docker-compose run --rm web rake db:setup script: - - bundle exec rspec + - docker-compose run --rm web bundle exec rspec notifications: slack: secure: L7ysz/oWaFNMmSFmJN4z2iRqyDX2zmT8sqvsukKTNMyl9ENqbZFPyvC53ICMa2DLtP/X/XX1tzfHEqg9hZ2On2hju/Ohn9DG+RRjCm5Cu+05rpkliZO98gfVo1pTAfA4vn3HXsSHHRL5tmjUx7+YxbbF3YugJ2M0TUqFxI/1yiM= + + diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml new file mode 100644 index 0000000..d1117cc --- /dev/null +++ b/docker-compose.ci.yml @@ -0,0 +1,41 @@ +version: '2.0' + +services: + db: + image: mysql:5.6 + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: 'yes' + volumes: + - db:/var/lib/mysql + + elasticsearch: + image: elasticsearch:2.3 + command: elasticsearch -Des.network.host=0.0.0.0 + volumes: + - elastic:/usr/share/elasticsearch/data + + web: &rails + image: instedd/nginx-rails:2.0 + environment: + RAILS_ENV: + ELASTICSEARCH_URL: 'http://elasticsearch:9200' + DATABASE_HOST: 'db' + volumes: + - .:/app + - bundle:/usr/local/bundle + depends_on: + - db + - elasticsearch + command: 'rails server' + ports: + - 3000:3000 + + jobs_work: + <<: *rails + command: 'rake jobs:work' + ports: [] + +volumes: + db: + bundle: + elastic: From 50af476f65b17b9203a80d5ac1735ee6d7068fe1 Mon Sep 17 00:00:00 2001 From: Martin Verzilli Date: Mon, 26 Nov 2018 15:45:13 -0300 Subject: [PATCH 05/15] Remove bundler from Travis cache --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8dc9cdb..7c69d46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: ruby cache: - - bundler directories: - ~/cache services: From 7ad1dea8f81939ee812ef3b76a349121043d0479 Mon Sep 17 00:00:00 2001 From: Martin Verzilli Date: Mon, 26 Nov 2018 16:50:24 -0300 Subject: [PATCH 06/15] WIP use docker on travis --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7c69d46..b66b0a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,8 @@ before_install: - mv docker-compose.ci.yml docker-compose.override.yml - docker-compose pull - docker-compose run --rm --no-deps web bundle install - - docker-compose up -d db - - docker-compose run --rm web rake db:setup + - docker-compose up -d db elasticsearch + - docker-compose run --rm --no-deps web rake db:setup script: - docker-compose run --rm web bundle exec rspec notifications: From f19d7359b3463111ebf9a7bca642a3b4d474af96 Mon Sep 17 00:00:00 2001 From: Martin Verzilli Date: Mon, 26 Nov 2018 16:55:59 -0300 Subject: [PATCH 07/15] Setup test db on docker/travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b66b0a3..38190bc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ before_install: - docker-compose run --rm --no-deps web bundle install - docker-compose up -d db elasticsearch - docker-compose run --rm --no-deps web rake db:setup + - docker-compose run --rm --no-deps web rake db:test:prepare script: - docker-compose run --rm web bundle exec rspec notifications: From cbfa54236b2f97947069294ab78a82ee7bf02234 Mon Sep 17 00:00:00 2001 From: Martin Verzilli Date: Mon, 26 Nov 2018 17:13:12 -0300 Subject: [PATCH 08/15] WIP --- docker-compose.ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-compose.ci.yml b/docker-compose.ci.yml index d1117cc..dc12ecb 100644 --- a/docker-compose.ci.yml +++ b/docker-compose.ci.yml @@ -21,8 +21,7 @@ services: ELASTICSEARCH_URL: 'http://elasticsearch:9200' DATABASE_HOST: 'db' volumes: - - .:/app - - bundle:/usr/local/bundle + - ~/cache/bundle:/usr/local/bundle depends_on: - db - elasticsearch From 317e5f592445319fa4747f730c9895aeb1fb3b30 Mon Sep 17 00:00:00 2001 From: Martin Verzilli Date: Mon, 26 Nov 2018 17:42:50 -0300 Subject: [PATCH 09/15] Pin ruby version --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 227cea2..7fa1d1e 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.0.0 +2.0.0-p353 From 839de3dbbf080581312f21ee9a6aee79c2cf4bc9 Mon Sep 17 00:00:00 2001 From: Martin Verzilli Date: Wed, 28 Nov 2018 18:13:43 -0300 Subject: [PATCH 10/15] Remove language: ruby from travs.yaml --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 38190bc..86b7387 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -language: ruby cache: directories: - ~/cache From 67ae86a13d38c6089b4d54998274e0933ccf8312 Mon Sep 17 00:00:00 2001 From: Martin Verzilli Date: Wed, 28 Nov 2018 18:21:09 -0300 Subject: [PATCH 11/15] WIP --- config/initializers/intercom.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/intercom.rb b/config/initializers/intercom.rb index aa99c53..1241094 100644 --- a/config/initializers/intercom.rb +++ b/config/initializers/intercom.rb @@ -23,7 +23,7 @@ # # config.user.current = Proc.new { current_user } # config.user.current = [Proc.new { current_user }] - + # # == Include for logged out Users # If set to true, include the Intercom messenger on all pages, regardless of whether # The user model class (set below) is present. From d57a4d1e7a529cda1bc6ed3c3610ec6f9bf5fff4 Mon Sep 17 00:00:00 2001 From: Martin Verzilli Date: Wed, 28 Nov 2018 18:27:47 -0300 Subject: [PATCH 12/15] WIP --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 7fa1d1e..359a5b9 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.0.0-p353 +2.0.0 \ No newline at end of file From 0b0ae77a1745e1074e2669bb5d7e0a1e4003d772 Mon Sep 17 00:00:00 2001 From: pmallol Date: Thu, 6 Dec 2018 16:22:29 -0300 Subject: [PATCH 13/15] Use user email as user id --- config/initializers/intercom.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/config/initializers/intercom.rb b/config/initializers/intercom.rb index 1241094..d24c580 100644 --- a/config/initializers/intercom.rb +++ b/config/initializers/intercom.rb @@ -21,8 +21,8 @@ # The method/variable that contains the logged in user in your controllers. # If it is `current_user` or `@user`, then you can ignore this # - # config.user.current = Proc.new { current_user } # config.user.current = [Proc.new { current_user }] + config.user.current = Proc.new { current_user } # # == Include for logged out Users # If set to true, include the Intercom messenger on all pages, regardless of whether @@ -56,6 +56,9 @@ # :plan => Proc.new { |current_user| current_user.plan.name }, # :favorite_color => :favorite_color # } + config.user.custom_data = { + :user_id => Proc.new { |user| user.email } + } # == Current company method/variable # The method/variable that contains the current company for the current user, From 73a3a357ad76ed4c9fc8869834c201bf64bb74f7 Mon Sep 17 00:00:00 2001 From: pmallol Date: Thu, 6 Dec 2018 16:22:37 -0300 Subject: [PATCH 14/15] Update README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index e152c08..3584e75 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,9 @@ Configuration files are symlinked in a shared path. check `symlink_configs` task ## Intercom mBuilder supports Intercom as its CRM platform. To load the Intercom chat widget, simply start mBuilder with the env variable `INTERCOM_APP_ID` set to your Intercom app id (https://www.intercom.com/help/faqs-and-troubleshooting/getting-set-up/where-can-i-find-my-workspace-id-app-id). + mBuilder will forward any conversation with a logged user identifying them through their email address. Anonymous, unlogged users will also be able to communicate. + If you don't want to use Intercom, you can simply omit `INTERCOM_APP_ID` or set it to `''`. + To test the feature in development, add the `INTERCOM_APP_ID` variable and its value to the `environment` object inside the `web` service in `docker-compose.yml`. \ No newline at end of file From 6649ce8fc2ec27e89b99a8d2876c826fc4d437cb Mon Sep 17 00:00:00 2001 From: pmallol Date: Fri, 7 Dec 2018 12:26:21 -0300 Subject: [PATCH 15/15] Apply Intercom configuration when there's an Intercom app_id --- config/initializers/intercom.rb | 208 ++++++++++++++++---------------- 1 file changed, 105 insertions(+), 103 deletions(-) diff --git a/config/initializers/intercom.rb b/config/initializers/intercom.rb index d24c580..f4e13d0 100644 --- a/config/initializers/intercom.rb +++ b/config/initializers/intercom.rb @@ -1,117 +1,119 @@ -IntercomRails.config do |config| - # == Intercom app_id - # - config.app_id = ENV["INTERCOM_APP_ID"] || "v922phcl" +if ENV["INTERCOM_APP_ID"] + IntercomRails.config do |config| + # == Intercom app_id + # + config.app_id = ENV["INTERCOM_APP_ID"] - # == Intercom session_duration - # - # config.session_duration = 300000 - # == Intercom secret key - # This is required to enable Identity Verification, you can find it on your Setup - # guide in the "Identity Verification" step. - # - # config.api_secret = "..." + # == Intercom session_duration + # + # config.session_duration = 300000 + # == Intercom secret key + # This is required to enable Identity Verification, you can find it on your Setup + # guide in the "Identity Verification" step. + # + # config.api_secret = "..." - # == Enabled Environments - # Which environments is auto inclusion of the Javascript enabled for - # - config.enabled_environments = ["development", "production"] + # == Enabled Environments + # Which environments is auto inclusion of the Javascript enabled for + # + config.enabled_environments = ["development", "production"] - # == Current user method/variable - # The method/variable that contains the logged in user in your controllers. - # If it is `current_user` or `@user`, then you can ignore this - # - # config.user.current = [Proc.new { current_user }] - config.user.current = Proc.new { current_user } - # - # == Include for logged out Users - # If set to true, include the Intercom messenger on all pages, regardless of whether - # The user model class (set below) is present. - config.include_for_logged_out_users = true + # == Current user method/variable + # The method/variable that contains the logged in user in your controllers. + # If it is `current_user` or `@user`, then you can ignore this + # + # config.user.current = [Proc.new { current_user }] + config.user.current = Proc.new { current_user } + # + # == Include for logged out Users + # If set to true, include the Intercom messenger on all pages, regardless of whether + # The user model class (set below) is present. + config.include_for_logged_out_users = true - # == User model class - # The class which defines your user model - # - # config.user.model = Proc.new { User } + # == User model class + # The class which defines your user model + # + # config.user.model = Proc.new { User } - # == Lead/custom attributes for non-signed up users - # Pass additional attributes to for potential leads or - # non-signed up users as an an array. - # Any attribute contained in config.user.lead_attributes can be used - # as custom attribute in the application. - # config.user.lead_attributes = %w(ref_data utm_source) + # == Lead/custom attributes for non-signed up users + # Pass additional attributes to for potential leads or + # non-signed up users as an an array. + # Any attribute contained in config.user.lead_attributes can be used + # as custom attribute in the application. + # config.user.lead_attributes = %w(ref_data utm_source) - # == Exclude users - # A Proc that given a user returns true if the user should be excluded - # from imports and Javascript inclusion, false otherwise. - # - # config.user.exclude_if = Proc.new { |user| user.deleted? } + # == Exclude users + # A Proc that given a user returns true if the user should be excluded + # from imports and Javascript inclusion, false otherwise. + # + # config.user.exclude_if = Proc.new { |user| user.deleted? } - # == User Custom Data - # A hash of additional data you wish to send about your users. - # You can provide either a method name which will be sent to the current - # user object, or a Proc which will be passed the current user. - # - # config.user.custom_data = { - # :plan => Proc.new { |current_user| current_user.plan.name }, - # :favorite_color => :favorite_color - # } - config.user.custom_data = { - :user_id => Proc.new { |user| user.email } - } + # == User Custom Data + # A hash of additional data you wish to send about your users. + # You can provide either a method name which will be sent to the current + # user object, or a Proc which will be passed the current user. + # + # config.user.custom_data = { + # :plan => Proc.new { |current_user| current_user.plan.name }, + # :favorite_color => :favorite_color + # } + config.user.custom_data = { + :user_id => Proc.new { |user| user.email } + } - # == Current company method/variable - # The method/variable that contains the current company for the current user, - # in your controllers. 'Companies' are generic groupings of users, so this - # could be a company, app or group. - # - # config.company.current = Proc.new { current_company } - # - # Or if you are using devise you can just use the following config - # - # config.company.current = Proc.new { current_user.company } + # == Current company method/variable + # The method/variable that contains the current company for the current user, + # in your controllers. 'Companies' are generic groupings of users, so this + # could be a company, app or group. + # + # config.company.current = Proc.new { current_company } + # + # Or if you are using devise you can just use the following config + # + # config.company.current = Proc.new { current_user.company } - # == Exclude company - # A Proc that given a company returns true if the company should be excluded - # from imports and Javascript inclusion, false otherwise. - # - # config.company.exclude_if = Proc.new { |app| app.subdomain == 'demo' } + # == Exclude company + # A Proc that given a company returns true if the company should be excluded + # from imports and Javascript inclusion, false otherwise. + # + # config.company.exclude_if = Proc.new { |app| app.subdomain == 'demo' } - # == Company Custom Data - # A hash of additional data you wish to send about a company. - # This works the same as User custom data above. - # - # config.company.custom_data = { - # :number_of_messages => Proc.new { |app| app.messages.count }, - # :is_interesting => :is_interesting? - # } + # == Company Custom Data + # A hash of additional data you wish to send about a company. + # This works the same as User custom data above. + # + # config.company.custom_data = { + # :number_of_messages => Proc.new { |app| app.messages.count }, + # :is_interesting => :is_interesting? + # } - # == Company Plan name - # This is the name of the plan a company is currently paying (or not paying) for. - # e.g. Messaging, Free, Pro, etc. - # - # config.company.plan = Proc.new { |current_company| current_company.plan.name } + # == Company Plan name + # This is the name of the plan a company is currently paying (or not paying) for. + # e.g. Messaging, Free, Pro, etc. + # + # config.company.plan = Proc.new { |current_company| current_company.plan.name } - # == Company Monthly Spend - # This is the amount the company spends each month on your app. If your company - # has a plan, it will set the 'total value' of that plan appropriately. - # - # config.company.monthly_spend = Proc.new { |current_company| current_company.plan.price } - # config.company.monthly_spend = Proc.new { |current_company| (current_company.plan.price - current_company.subscription.discount) } + # == Company Monthly Spend + # This is the amount the company spends each month on your app. If your company + # has a plan, it will set the 'total value' of that plan appropriately. + # + # config.company.monthly_spend = Proc.new { |current_company| current_company.plan.price } + # config.company.monthly_spend = Proc.new { |current_company| (current_company.plan.price - current_company.subscription.discount) } - # == Custom Style - # By default, Intercom will add a button that opens the messenger to - # the page. If you'd like to use your own link to open the messenger, - # uncomment this line and clicks on any element with id 'Intercom' will - # open the messenger. - # - # config.inbox.style = :custom - # - # If you'd like to use your own link activator CSS selector - # uncomment this line and clicks on any element that matches the query will - # open the messenger - # config.inbox.custom_activator = '.intercom' - # - # If you'd like to hide default launcher button uncomment this line - # config.hide_default_launcher = true + # == Custom Style + # By default, Intercom will add a button that opens the messenger to + # the page. If you'd like to use your own link to open the messenger, + # uncomment this line and clicks on any element with id 'Intercom' will + # open the messenger. + # + # config.inbox.style = :custom + # + # If you'd like to use your own link activator CSS selector + # uncomment this line and clicks on any element that matches the query will + # open the messenger + # config.inbox.custom_activator = '.intercom' + # + # If you'd like to hide default launcher button uncomment this line + # config.hide_default_launcher = true + end end