-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Financial-Times/spoor_impl
Spoor impl
- Loading branch information
Showing
7 changed files
with
143 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,61 @@ | ||
'use strict'; | ||
|
||
import { broadcast } from 'n-ui-foundations'; | ||
//import tracking from 'o-tracking'; | ||
|
||
import getUserStatus from './get-user-status'; | ||
import { init as initDataStore } from './data-store'; | ||
import { init as initDownloadModal } from './modal-download'; | ||
import { TRACKING } from './config'; | ||
|
||
function init (flags, user) { | ||
if (user) { | ||
_init(flags, user); | ||
} | ||
else { | ||
getUserStatus().then(user => { | ||
_init(flags, user); | ||
}); | ||
} | ||
} | ||
|
||
function init (flags) { | ||
if (typeof window.republishingInitData !== 'function') { | ||
window.republishingInitData = function () {}; | ||
function _init (flags, user) { | ||
if (!location.pathname.includes('/contract')) { | ||
if (typeof window.republishingInitData !== 'function') { | ||
window.republishingInitData = function () {}; | ||
} | ||
|
||
initDataStore(flags, window.republishingInitData()); | ||
|
||
initDownloadModal(flags, user); | ||
} | ||
|
||
initDataStore(flags, window.republishingInitData()); | ||
track(flags, user); | ||
} | ||
|
||
function track (flags, user) { | ||
const config = JSON.parse(JSON.stringify(TRACKING.DATA)); | ||
config.context.contractID = user.contract_id; | ||
config.context.appVersion = user.app.version; | ||
|
||
// broadcast('oTracking.page', config); | ||
broadcast('oTracking.page', { | ||
app: TRACKING.DATA.context.app, | ||
appVersion: user.app.version, | ||
contractID: user.contract_id | ||
}); | ||
|
||
initDownloadModal(flags); | ||
// tracking.init({ | ||
// server: TRACKING.URI | ||
// }); | ||
// | ||
// tracking.page({ | ||
// app: `${TRACKING.DATA.context.app}.simple`, | ||
// appVersion: user.app.version, | ||
// contractID: user.contract_id | ||
// }, () => {}); | ||
// | ||
// tracking.page(config, () => {}); | ||
} | ||
|
||
export { init }; | ||
export { init, track }; |