diff --git a/internal_packages/onboarding/lib/initial-packages-page.cjsx b/internal_packages/onboarding/lib/initial-packages-page.cjsx
index 54fe852a5..3de7179d9 100644
--- a/internal_packages/onboarding/lib/initial-packages-page.cjsx
+++ b/internal_packages/onboarding/lib/initial-packages-page.cjsx
@@ -35,7 +35,7 @@ class InitialPackagesPage extends React.Component
Explore plugins
Plugins lie at the heart of N1 and give it its powerful features.
- Want to enable a few example plugins now? They'll be installed to ~/.nylas
+ Want to enable a few example plugins now?
@@ -50,6 +50,7 @@ class InitialPackagesPage extends React.Component
}
+
diff --git a/internal_packages/onboarding/lib/initial-preferences-page.cjsx b/internal_packages/onboarding/lib/initial-preferences-page.cjsx
index c36428172..5aea176de 100644
--- a/internal_packages/onboarding/lib/initial-preferences-page.cjsx
+++ b/internal_packages/onboarding/lib/initial-preferences-page.cjsx
@@ -2,8 +2,8 @@ React = require 'react'
path = require 'path'
fs = require 'fs'
_ = require 'underscore'
-{RetinaImg, Flexbox, ConfigPropContainer} = require 'nylas-component-kit'
-{EdgehillAPI} = require 'nylas-exports'
+{RetinaImg, Flexbox, ConfigPropContainer, NewsletterSignup} = require 'nylas-component-kit'
+{EdgehillAPI, AccountStore} = require 'nylas-exports'
OnboardingActions = require './onboarding-actions'
# NOTE: Temporarily copied from preferences module
@@ -99,6 +99,9 @@ class InitialPreferencesOptions extends React.Component
{template}
}
+
+
+
@@ -108,11 +111,13 @@ class InitialPreferencesPage extends React.Component
@displayName: "InitialPreferencesPage"
render: =>
+ account = AccountStore.items()[0]
+
Welcome to N1
Let's set things up to your liking.
-
+
Looks Good!
diff --git a/internal_packages/preferences/lib/tabs/preferences-account-details.jsx b/internal_packages/preferences/lib/tabs/preferences-account-details.jsx
index 1c0a490dd..04f332a25 100644
--- a/internal_packages/preferences/lib/tabs/preferences-account-details.jsx
+++ b/internal_packages/preferences/lib/tabs/preferences-account-details.jsx
@@ -1,6 +1,6 @@
import _ from 'underscore';
import React, {Component, PropTypes} from 'react';
-import {EditableList} from 'nylas-component-kit';
+import {EditableList, NewsletterSignup} from 'nylas-component-kit';
import {RegExpUtils} from 'nylas-exports';
class PreferencesAccountDetails extends Component {
@@ -159,6 +159,10 @@ class PreferencesAccountDetails extends Component {
onDeleteItem={this._onAccountAliasRemoved} />
{this._renderDefaultAliasSelector(account)}
+
+
+
+
);
}
diff --git a/internal_packages/preferences/stylesheets/preferences-accounts.less b/internal_packages/preferences/stylesheets/preferences-accounts.less
index 314511355..e69a48fce 100644
--- a/internal_packages/preferences/stylesheets/preferences-accounts.less
+++ b/internal_packages/preferences/stylesheets/preferences-accounts.less
@@ -51,6 +51,11 @@
height: 140px;
}
+ .newsletter {
+ padding-top: @padding-base-vertical * 2;
+ input[type=checkbox] { margin: 0; position: relative; top: 0; }
+ }
+
&>h3 {
font-size: 1.2em;
&:first-child {
diff --git a/src/components/newsletter-signup.cjsx b/src/components/newsletter-signup.cjsx
new file mode 100644
index 000000000..cc5517148
--- /dev/null
+++ b/src/components/newsletter-signup.cjsx
@@ -0,0 +1,75 @@
+_ = require 'underscore'
+request = require 'request'
+React = require 'react'
+{Utils, EdgehillAPI} = require "nylas-exports"
+{RetinaImg, Flexbox} = require 'nylas-component-kit'
+
+class NewsletterSignup extends React.Component
+ @displayName: 'NewsletterSignup'
+ @propTypes:
+ name: React.PropTypes.string
+ emailAddress: React.PropTypes.string
+
+ constructor: (@props) ->
+ @state = {status: 'Pending'}
+
+ componentDidMount: =>
+ @_onGetStatus()
+
+ _onGetStatus: =>
+ @setState({status: 'Pending'})
+ EdgehillAPI.request
+ method: 'GET'
+ path: @_path()
+ success: (status) =>
+ if status is 'Never Subscribed'
+ @_onSubscribe()
+ else
+ @setState({status})
+ error: =>
+ @setState({status: "Error"})
+
+ _onSubscribe: =>
+ @setState({status: 'Pending'})
+ EdgehillAPI.request
+ method: 'POST'
+ path: @_path()
+ success: (status) =>
+ @setState({status})
+ error: =>
+ @setState({status: "Error"})
+
+ _onUnsubscribe: =>
+ @setState({status: 'Pending'})
+ EdgehillAPI.request
+ method: 'DELETE'
+ path: @_path()
+ success: (status) =>
+ @setState({status})
+ error: =>
+ @setState({status: "Error"})
+
+ _path: =>
+ "/newsletter-subscription/#{encodeURIComponent(@props.emailAddress)}?name=#{encodeURIComponent(@props.name)}"
+
+ render: =>
+
+
+ {@_renderControl()}
+
+
+ Notify me about new features and plugins via this email address.
+
+
+
+ _renderControl: ->
+ if @state.status is 'Pending'
+
+ else if @state.status is 'Error'
+ Retry
+ else if @state.status in ['Subscribed', 'Active']
+
+ else
+
+
+module.exports = NewsletterSignup
diff --git a/src/flux/edgehill-api.coffee b/src/flux/edgehill-api.coffee
index f2fc5f36d..c8bbd4f9c 100644
--- a/src/flux/edgehill-api.coffee
+++ b/src/flux/edgehill-api.coffee
@@ -32,14 +32,6 @@ class EdgehillAPI
options.url ?= "#{@APIRoot}#{options.path}" if options.path
options.body ?= {} unless options.formData
options.json = true
-
- auth = @_getCredentials()
- if not options.auth and auth
- options.auth =
- user: auth.username
- pass: auth.password
- sendImmediately: true
-
options.error ?= @_defaultErrorCallback
# This is to provide functional closure for the variable.
@@ -63,12 +55,6 @@ class EdgehillAPI
else
options.success(body) if options.success
- _getCredentials: ->
- NylasEnv.config.get('edgehill.credentials')
-
- _setCredentials: (credentials) ->
- NylasEnv.config.set('edgehill.credentials', credentials)
-
_defaultErrorCallback: (apiError) ->
console.error(apiError)
diff --git a/src/global/nylas-component-kit.coffee b/src/global/nylas-component-kit.coffee
index a9378b44d..79eac1d40 100644
--- a/src/global/nylas-component-kit.coffee
+++ b/src/global/nylas-component-kit.coffee
@@ -45,5 +45,6 @@ class NylasComponentKit
@loadFrom "GeneratedFieldset", "generated-form"
@load "ScenarioEditor", 'scenario-editor'
+ @load "NewsletterSignup", 'newsletter-signup'
module.exports = new NylasComponentKit()