docbrown/app/javascript/packs/pack.js
Ben Halpern f2101410ea
[WIP] Improve article boosting abilities and insights (#237)
* Update email subjects split test

* Create alternate editor

* Add proof of concept to emails

* Add utm for internal nav

* Add ability to boost in DEV Digest

* Adjust articles.scss

* Adjust article_form.scss

* Remove unnecessary files

* Remove files from PR

* Adjust boosted email settings

* Conditionally include organization in additional box

* Modify schema.rb
2018-05-02 12:24:54 -04:00

33 lines
891 B
JavaScript

import { h, render } from 'preact';
import Onboarding from '../src/Onboarding';
import { getUserData } from '../src/utils/getUserData';
HTMLDocument.prototype.ready = new Promise(resolve => {
if (document.readyState !== 'loading') {
return resolve();
}
document.addEventListener('DOMContentLoaded', () => resolve());
});
function shouldShowOnboarding() {
return (
document.head.getElementsByTagName('meta')[2].content === 'true' &&
document.body.getAttribute('data-user') &&
document.body.getAttribute('data-user') !== 'undefined' &&
JSON.parse(document.body.getAttribute('data-user')).saw_onboarding === false
);
}
function renderPage() {
if (shouldShowOnboarding()) {
setTimeout(() => {
render(<Onboarding />, document.getElementById('top-bar'));
}, 500);
}
}
document.ready.then(
getUserData().then(() => {
renderPage();
}),
);