From 1b3023ff1871dd98fd8f63162bb06db2c229e98c Mon Sep 17 00:00:00 2001 From: ekeren Date: Mon, 30 Jul 2018 08:46:48 +0300 Subject: [PATCH 1/8] fixing sound cloud client id --- client/src/constants/ApiConstants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/constants/ApiConstants.js b/client/src/constants/ApiConstants.js index 5f5dd453..5b0704fa 100644 --- a/client/src/constants/ApiConstants.js +++ b/client/src/constants/ApiConstants.js @@ -1,5 +1,5 @@ const API_HOSTNAME = '//api.soundcloud.com'; -export const CLIENT_ID = 'f4323c6f7c0cd73d2d786a2b1cdae80c'; +export const CLIENT_ID = '342b8a7af638944906dcdb46f9d56d98'; const constructUrl = url => `${API_HOSTNAME}${url}${url.indexOf('?') === -1 ? '?' : '&'}client_id=${CLIENT_ID}`; From 95b7480eff890f91ba597654ad8d75153fbe018d Mon Sep 17 00:00:00 2001 From: ekeren Date: Mon, 30 Jul 2018 10:03:19 +0300 Subject: [PATCH 2/8] adding Rollout SDK, and configuring flags --- client/src/components/Nav.jsx | 3 ++- client/src/components/Player.jsx | 7 +++++ client/src/components/User.jsx | 3 +++ client/src/components/UserFollowButton.jsx | 3 ++- client/src/constants/Flags.js | 30 ++++++++++++++++++++++ client/src/store/UserRepo.js | 9 +++++++ package.json | 1 + 7 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 client/src/constants/Flags.js create mode 100644 client/src/store/UserRepo.js diff --git a/client/src/components/Nav.jsx b/client/src/components/Nav.jsx index f2c5200c..1598f2ee 100644 --- a/client/src/components/Nav.jsx +++ b/client/src/components/Nav.jsx @@ -5,6 +5,7 @@ import NavSearch from '../components/NavSearch'; import NavSession from '../components/NavSession'; import NavUser from '../components/NavUser'; import { SONGS_PATH } from '../constants/RouterConstants'; +import Rox from 'rox-browser' const defaultProps = { navPlaylist: null, @@ -47,7 +48,7 @@ const Nav = ({
- +
+ { Flags.repeat.isEnabled() ?
+ : null } + { Flags.shuffle.isEnabled() ?
+ : null } + { Flags.history.isEnabled() ?
+ : null }
+ { Flags.followingView.isEnabled() ? + : null }
diff --git a/client/src/components/UserFollowButton.jsx b/client/src/components/UserFollowButton.jsx index 251dda26..e4dbc905 100644 --- a/client/src/components/UserFollowButton.jsx +++ b/client/src/components/UserFollowButton.jsx @@ -1,5 +1,6 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; +import Flags from '../constants/Flags' const propTypes = { id: PropTypes.number.isRequired, @@ -28,7 +29,7 @@ class UserFollowButton extends Component { role="button" tabIndex="0" > - {isFollowing ? 'Following' : 'Follow'} + {isFollowing ? 'Following' : Flags.startFollowingWord.getValue()}
); } diff --git a/client/src/constants/Flags.js b/client/src/constants/Flags.js new file mode 100644 index 00000000..c54027a1 --- /dev/null +++ b/client/src/constants/Flags.js @@ -0,0 +1,30 @@ +// import rox-browser from npm +import Rox from 'rox-browser' +import UserRepo from '../store/UserRepo' + +// define an exported object that contains the flags +const Flags = { + followingView: new Rox.Flag(), + history: new Rox.Flag(), + shuffle: new Rox.Flag(), + repeat: new Rox.Flag(), + startFollowingWord: new Rox.Variant('Follow', ['Follow', 'Start Following', 'Watch Him']) +}; + +// Register the flags object under the namespace "default" +Rox.register('default', Flags); +// setup the SDK with the production environment key of app soundredux - see https://app.rollout.io/app/5b5ea80aec73e3454653ecc4 +Rox.setup('5b5ea80aec73e3454653ecc7'); + +// For demo purposes we will etch the configuration from the server every 4 seoconds +setInterval( function(){ + Rox.fetch(); +}, 4000); + +// Dummy user state +Rox.setCustomStringProperty('plan', () => UserRepo.getUser().plan); +Rox.setCustomStringProperty('email', () => UserRepo.getUser().email); +Rox.setCustomNumberProperty('playlist_count', () => UserRepo.getUser().playlistCount); +Rox.setCustomStringProperty('soundcloud_id', () => UserRepo.getUser().id); + +export default Flags; diff --git a/client/src/store/UserRepo.js b/client/src/store/UserRepo.js new file mode 100644 index 00000000..3585fa5b --- /dev/null +++ b/client/src/store/UserRepo.js @@ -0,0 +1,9 @@ +const UserRepo = { + getUser: () => ({ + plan: "basic", + email: "eyal@rollout.io", + playlistCount: 20, + soundcloud_id: "abcd1234" + }) +}; +export default UserRepo; diff --git a/package.json b/package.json index 791b7ba0..64c887f3 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "redux": "^3.7.2", "redux-thunk": "^2.2.0", "reselect": "^3.0.1", + "rox-browser": "^3.2.3", "soundcloud": "^3.2.1" } } From 83719d0f14f7dbd52676c6183ce7bf776d129336 Mon Sep 17 00:00:00 2001 From: ekeren Date: Mon, 30 Jul 2018 10:35:45 +0300 Subject: [PATCH 3/8] allowing webpack to run on .amazonaws.com --- client/webpack.dev.config.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/webpack.dev.config.js b/client/webpack.dev.config.js index 36c58a5d..4d0ee115 100644 --- a/client/webpack.dev.config.js +++ b/client/webpack.dev.config.js @@ -51,6 +51,9 @@ module.exports = { ], devServer: { host: '0.0.0.0', + allowedHosts: [ + '.amazonaws.com' + ], hot: true, port: '8080', }, From d6740a406fef7741fcee0a6416af88e0b78b7da1 Mon Sep 17 00:00:00 2001 From: ekeren Date: Mon, 30 Jul 2018 10:46:35 +0300 Subject: [PATCH 4/8] allowing webpack to run on .rollout.io --- client/webpack.dev.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/webpack.dev.config.js b/client/webpack.dev.config.js index 4d0ee115..9be3277b 100644 --- a/client/webpack.dev.config.js +++ b/client/webpack.dev.config.js @@ -52,7 +52,8 @@ module.exports = { devServer: { host: '0.0.0.0', allowedHosts: [ - '.amazonaws.com' + '.amazonaws.com', + '.rollout.io' ], hot: true, port: '8080', From 6c0ea6e11603b359332039f87ee029cd31f80d0f Mon Sep 17 00:00:00 2001 From: EC2 Default User Date: Wed, 3 Oct 2018 09:54:08 +0000 Subject: [PATCH 5/8] adding segment to work with rollout impression handler and label --- client/public/index.html | 6 ++++++ client/src/components/User.jsx | 1 + client/src/components/UserFollowButton.jsx | 5 +++++ client/src/constants/Flags.js | 14 +++++++++++++- client/webpack.dev.config.js | 2 +- package.json | 2 +- 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/client/public/index.html b/client/public/index.html index 968b76f1..6b707df5 100644 --- a/client/public/index.html +++ b/client/public/index.html @@ -1,6 +1,12 @@ + diff --git a/client/src/components/User.jsx b/client/src/components/User.jsx index 1de29575..244fb30b 100644 --- a/client/src/components/User.jsx +++ b/client/src/components/User.jsx @@ -39,6 +39,7 @@ const propTypes = { class User extends Component { componentWillMount() { const { fetchUserIfNeeded, id, playlist, shouldFetchUser } = this.props; + analytics.track('User page reached', {id, playlist}); fetchUserIfNeeded(shouldFetchUser, id, playlist); } diff --git a/client/src/components/UserFollowButton.jsx b/client/src/components/UserFollowButton.jsx index e4dbc905..15ee85b2 100644 --- a/client/src/components/UserFollowButton.jsx +++ b/client/src/components/UserFollowButton.jsx @@ -16,6 +16,11 @@ class UserFollowButton extends Component { onClick() { const { id, isFollowing, toggleFollow } = this.props; + if (isFollowing) { + analytics.track('Stop Follow', {id}); + } else { + analytics.track('Start Follow', {id}); + } toggleFollow(id, !isFollowing); } diff --git a/client/src/constants/Flags.js b/client/src/constants/Flags.js index c54027a1..76a356da 100644 --- a/client/src/constants/Flags.js +++ b/client/src/constants/Flags.js @@ -13,8 +13,20 @@ const Flags = { // Register the flags object under the namespace "default" Rox.register('default', Flags); +const fakeUserID = "" + Math.random(); +Rox.setCustomStringProperty('rox.distinct_id', fakeUserID); +analytics.identify(fakeUserID, {}); // setup the SDK with the production environment key of app soundredux - see https://app.rollout.io/app/5b5ea80aec73e3454653ecc4 -Rox.setup('5b5ea80aec73e3454653ecc7'); +Rox.setup('5bb481ca21161732af3f5ecc', { + impressionHandler: (reporting, experiment) => { + if (experiment && experiment.labels.includes('segment')){ + let props = {}; + props[`rollout_${reporting.name}`] = reporting.value; + props[`rollout_${reporting.name}_labels`] = experiment.labels.join(','); + analytics.identify(fakeUserID, props); + } + } +}); // For demo purposes we will etch the configuration from the server every 4 seoconds setInterval( function(){ diff --git a/client/webpack.dev.config.js b/client/webpack.dev.config.js index 9be3277b..ed6049e9 100644 --- a/client/webpack.dev.config.js +++ b/client/webpack.dev.config.js @@ -56,6 +56,6 @@ module.exports = { '.rollout.io' ], hot: true, - port: '8080', + port: '80', }, }; diff --git a/package.json b/package.json index 64c887f3..8850ad9f 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "redux": "^3.7.2", "redux-thunk": "^2.2.0", "reselect": "^3.0.1", - "rox-browser": "^3.2.3", + "rox-browser": "^4.1.3", "soundcloud": "^3.2.1" } } From 6483de444809f184c8866ce306717d09efc38a99 Mon Sep 17 00:00:00 2001 From: ekeren Date: Thu, 4 Oct 2018 10:20:39 +0300 Subject: [PATCH 6/8] setting development (localhost) environment --- client/src/constants/Flags.js | 2 +- client/webpack.dev.config.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/constants/Flags.js b/client/src/constants/Flags.js index 76a356da..a7be5fbb 100644 --- a/client/src/constants/Flags.js +++ b/client/src/constants/Flags.js @@ -17,7 +17,7 @@ const fakeUserID = "" + Math.random(); Rox.setCustomStringProperty('rox.distinct_id', fakeUserID); analytics.identify(fakeUserID, {}); // setup the SDK with the production environment key of app soundredux - see https://app.rollout.io/app/5b5ea80aec73e3454653ecc4 -Rox.setup('5bb481ca21161732af3f5ecc', { +Rox.setup('5bb493fcbae7137e6c9dea86', { impressionHandler: (reporting, experiment) => { if (experiment && experiment.labels.includes('segment')){ let props = {}; diff --git a/client/webpack.dev.config.js b/client/webpack.dev.config.js index ed6049e9..9a24f592 100644 --- a/client/webpack.dev.config.js +++ b/client/webpack.dev.config.js @@ -53,9 +53,10 @@ module.exports = { host: '0.0.0.0', allowedHosts: [ '.amazonaws.com', + '127.0.0.1', '.rollout.io' ], hot: true, - port: '80', + port: '8083', }, }; From 8ba96352e309cfed6932944b7f944a5b6a19711d Mon Sep 17 00:00:00 2001 From: ekeren Date: Tue, 13 Aug 2019 13:41:01 -0700 Subject: [PATCH 7/8] setup for dwjw --- client/src/components/User.jsx | 1 + client/src/constants/Flags.js | 29 +++++++++-------------------- package.json | 2 +- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/client/src/components/User.jsx b/client/src/components/User.jsx index 244fb30b..3a3c864e 100644 --- a/client/src/components/User.jsx +++ b/client/src/components/User.jsx @@ -75,6 +75,7 @@ class User extends Component { return ; } + return (
diff --git a/client/src/constants/Flags.js b/client/src/constants/Flags.js index a7be5fbb..d6d0589f 100644 --- a/client/src/constants/Flags.js +++ b/client/src/constants/Flags.js @@ -1,5 +1,6 @@ // import rox-browser from npm -import Rox from 'rox-browser' + +import Rox from 'rox-browser' import UserRepo from '../store/UserRepo' // define an exported object that contains the flags @@ -8,35 +9,23 @@ const Flags = { history: new Rox.Flag(), shuffle: new Rox.Flag(), repeat: new Rox.Flag(), + jsonNba: new Rox.Variant('j1', ['j1', 'j2', 'j3']), startFollowingWord: new Rox.Variant('Follow', ['Follow', 'Start Following', 'Watch Him']) }; // Register the flags object under the namespace "default" Rox.register('default', Flags); -const fakeUserID = "" + Math.random(); -Rox.setCustomStringProperty('rox.distinct_id', fakeUserID); -analytics.identify(fakeUserID, {}); -// setup the SDK with the production environment key of app soundredux - see https://app.rollout.io/app/5b5ea80aec73e3454653ecc4 -Rox.setup('5bb493fcbae7137e6c9dea86', { - impressionHandler: (reporting, experiment) => { - if (experiment && experiment.labels.includes('segment')){ - let props = {}; - props[`rollout_${reporting.name}`] = reporting.value; - props[`rollout_${reporting.name}_labels`] = experiment.labels.join(','); - analytics.identify(fakeUserID, props); - } - } -}); -// For demo purposes we will etch the configuration from the server every 4 seoconds -setInterval( function(){ - Rox.fetch(); -}, 4000); -// Dummy user state +Rox.setup('5990c4a1eae09726fa0d6040', { + devModeSecret: "pFymEevjDCbXWoEZPDqrGT8v" +}); + Rox.setCustomStringProperty('plan', () => UserRepo.getUser().plan); Rox.setCustomStringProperty('email', () => UserRepo.getUser().email); Rox.setCustomNumberProperty('playlist_count', () => UserRepo.getUser().playlistCount); Rox.setCustomStringProperty('soundcloud_id', () => UserRepo.getUser().id); + +//; export default Flags; diff --git a/package.json b/package.json index 8850ad9f..8b6e3508 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "redux": "^3.7.2", "redux-thunk": "^2.2.0", "reselect": "^3.0.1", - "rox-browser": "^4.1.3", + "rox-browser": "^4.7.0", "soundcloud": "^3.2.1" } } From f8a4adc5208f33a4feba4fd152ef0a22cd8ae549 Mon Sep 17 00:00:00 2001 From: ekeren Date: Thu, 16 Apr 2020 00:12:09 +0300 Subject: [PATCH 8/8] self managed version --- client/src/constants/Flags.js | 18 +++++++++++++++--- package.json | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/client/src/constants/Flags.js b/client/src/constants/Flags.js index d6d0589f..7ac4fa49 100644 --- a/client/src/constants/Flags.js +++ b/client/src/constants/Flags.js @@ -17,9 +17,21 @@ const Flags = { Rox.register('default', Flags); -Rox.setup('5990c4a1eae09726fa0d6040', { - devModeSecret: "pFymEevjDCbXWoEZPDqrGT8v" -}); + const options = { + + selfManaged: { + serverURL: 'http://localhost:8557', + analyticsURL: 'http://localhost:8558' + } + } + + + // Setup the Rollout key + Rox.setup('5e977711c37225cea474c367', options); + +//Rox.setup('5990c4a1eae09726fa0d6040', { +// devModeSecret: "pFymEevjDCbXWoEZPDqrGT8v" +//}); Rox.setCustomStringProperty('plan', () => UserRepo.getUser().plan); Rox.setCustomStringProperty('email', () => UserRepo.getUser().email); diff --git a/package.json b/package.json index 8b6e3508..95f32cf9 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "redux": "^3.7.2", "redux-thunk": "^2.2.0", "reselect": "^3.0.1", - "rox-browser": "^4.7.0", + "rox-browser": "^4.9.5", "soundcloud": "^3.2.1" } }