From f5f703d265cc47f72ff9db3b89cdc69c82952901 Mon Sep 17 00:00:00 2001 From: Mike Hoefer Date: Tue, 20 Feb 2018 11:53:52 -0800 Subject: [PATCH] New baseline --- .gitignore | 3 +- client/js/activities/ActivityCard.js | 63 - client/js/activities/ActivityTimeline.js | 99 - client/js/activities/ActivityTypePickList.js | 23 - client/js/app.js | 38 +- client/js/auth/AuthorizeOrg.js | 18 + client/js/auth/AuthorizeWindow.js | 30 + client/js/brokers/BrokerCard.js | 68 - client/js/brokers/BrokerForm.js | 103 - client/js/brokers/BrokerHome.js | 67 - client/js/brokers/BrokerList.js | 31 - client/js/brokers/BrokerRecord.js | 53 - client/js/contacts/ContactForm.js | 103 - client/js/contacts/ContactHome.js | 68 - client/js/contacts/ContactList.js | 30 - client/js/contacts/ContactLookup.js | 32 - client/js/contacts/ContactQuickFind.js | 32 - client/js/contacts/ContactRecord.js | 52 - client/js/contacts/ContactView.js | 137 - client/js/contacts/NewContactWindow.js | 77 - .../NewPackageOrgWindow.js} | 29 +- client/js/packageorgs/PackageOrgForm.js | 72 + client/js/packageorgs/PackageOrgHome.js | 73 + client/js/packageorgs/PackageOrgList.js | 32 + client/js/packageorgs/PackageOrgRecord.js | 50 + .../PackageOrgView.js} | 41 +- client/js/packages/PackageView.js | 6 +- .../js/packageversions/PackageVersionCard.js | 2 - client/js/properties/NewPropertyWindow.js | 96 - client/js/properties/PropertyCard.js | 59 - client/js/properties/PropertyForm.js | 127 - client/js/properties/PropertyHome.js | 89 - client/js/properties/PropertyList.js | 30 - client/js/properties/PropertyQuickFind.js | 32 - client/js/properties/PropertyRecord.js | 51 - client/js/properties/PropertyView.js | 166 - client/js/services/ActivityService.js | 19 - client/js/services/ActivityTypeService.js | 5 - client/js/services/AuthService.js | 13 + client/js/services/BrokerService.js | 17 - client/js/services/ContactService.js | 15 - client/js/services/PackageOrgService.js | 15 + client/js/services/PropertyService.js | 17 - crypt.js | 85 + initsb.sql | 47 +- package.json | 3 + server.js | 59 +- server/activities.js | 60 - server/activitytypes.js | 13 - server/auth.js | 73 + server/brokers.js | 78 - server/contacts.js | 72 - server/package_orgs.js | 93 + server/properties.js | 86 - www/build/js/app.bundle.js | 11419 +--------------- www/build/js/app.bundle.js.map | 2 +- 56 files changed, 1064 insertions(+), 13209 deletions(-) delete mode 100644 client/js/activities/ActivityCard.js delete mode 100644 client/js/activities/ActivityTimeline.js delete mode 100644 client/js/activities/ActivityTypePickList.js create mode 100644 client/js/auth/AuthorizeOrg.js create mode 100644 client/js/auth/AuthorizeWindow.js delete mode 100644 client/js/brokers/BrokerCard.js delete mode 100644 client/js/brokers/BrokerForm.js delete mode 100644 client/js/brokers/BrokerHome.js delete mode 100644 client/js/brokers/BrokerList.js delete mode 100644 client/js/brokers/BrokerRecord.js delete mode 100644 client/js/contacts/ContactForm.js delete mode 100644 client/js/contacts/ContactHome.js delete mode 100644 client/js/contacts/ContactList.js delete mode 100644 client/js/contacts/ContactLookup.js delete mode 100644 client/js/contacts/ContactQuickFind.js delete mode 100644 client/js/contacts/ContactRecord.js delete mode 100644 client/js/contacts/ContactView.js delete mode 100644 client/js/contacts/NewContactWindow.js rename client/js/{brokers/NewBrokerWindow.js => packageorgs/NewPackageOrgWindow.js} (83%) create mode 100644 client/js/packageorgs/PackageOrgForm.js create mode 100644 client/js/packageorgs/PackageOrgHome.js create mode 100644 client/js/packageorgs/PackageOrgList.js create mode 100644 client/js/packageorgs/PackageOrgRecord.js rename client/js/{brokers/BrokerView.js => packageorgs/PackageOrgView.js} (58%) delete mode 100644 client/js/properties/NewPropertyWindow.js delete mode 100644 client/js/properties/PropertyCard.js delete mode 100644 client/js/properties/PropertyForm.js delete mode 100644 client/js/properties/PropertyHome.js delete mode 100644 client/js/properties/PropertyList.js delete mode 100644 client/js/properties/PropertyQuickFind.js delete mode 100644 client/js/properties/PropertyRecord.js delete mode 100644 client/js/properties/PropertyView.js delete mode 100644 client/js/services/ActivityService.js delete mode 100644 client/js/services/ActivityTypeService.js create mode 100644 client/js/services/AuthService.js delete mode 100644 client/js/services/BrokerService.js delete mode 100644 client/js/services/ContactService.js create mode 100644 client/js/services/PackageOrgService.js delete mode 100644 client/js/services/PropertyService.js create mode 100644 crypt.js delete mode 100644 server/activities.js delete mode 100644 server/activitytypes.js create mode 100644 server/auth.js delete mode 100644 server/brokers.js delete mode 100644 server/contacts.js create mode 100644 server/package_orgs.js delete mode 100644 server/properties.js diff --git a/.gitignore b/.gitignore index b76409fa..eb48cd7f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ npm-debug.log node_modules .idea/ .env -*.iml \ No newline at end of file +*.iml +temp.* \ No newline at end of file diff --git a/client/js/activities/ActivityCard.js b/client/js/activities/ActivityCard.js deleted file mode 100644 index bcc62e03..00000000 --- a/client/js/activities/ActivityCard.js +++ /dev/null @@ -1,63 +0,0 @@ -import React from 'react'; - -import * as activityService from '../services/ActivityService'; - -import DataGrid from "../components/DataGrid"; -import {Icon, ButtonIcon} from "../components/Icons"; - -export default React.createClass({ - - contactLinkHandler(activity) { - window.location.hash = "#contact/" + activity.contact_id; - }, - - propertyLinkHandler(activity) { - window.location.hash = "#property/" + activity.property_id; - }, - - actionHandler(data, value, label) { - if (label === "Delete") { - this.props.onDelete(data); - } - }, - - render() { - - return ( -
-
-
-
- -
-
-

Activities

-
-
-
-
- - -
-
-
- -
- -
-
- {this.props.showContact ?
: ''} - {this.props.showProperty ?
: ''} -
- -
- - -
- ); - } - -}); \ No newline at end of file diff --git a/client/js/activities/ActivityTimeline.js b/client/js/activities/ActivityTimeline.js deleted file mode 100644 index b0e6703e..00000000 --- a/client/js/activities/ActivityTimeline.js +++ /dev/null @@ -1,99 +0,0 @@ -import React from 'react'; -import moment from 'moment'; - -import * as activityService from '../services/ActivityService'; - -import {Icon, ButtonIcon} from "../components/Icons"; - -let getActivityTheme = (activityName) => { - if (activityName === "Listed") { - return "event" - } else if (activityName === "Open House") { - return "event"; - } else if (activityName === "Inquiry") { - return "email"; - } else if (activityName === "Offer") { - return "email"; - } else if (activityName === "Price Reduction") { - return "task"; - } -}; - -let ActivityListItem = React.createClass({ - - render() { - return ( -
  • - Email -
    -
    -
    -
    - -
    -
    -
    -

    {this.props.activity.activity_name}

    - {this.props.showContact && this.props.activity.contact_id ? - : ""} - {this.props.showProperty ? - : ""} -

    {this.props.activity.comment}

    -
    -
      -
    • -
      -
      Date:
      -
      {moment(this.props.activity.activity_date).format("MMMM Do YYYY")}
      -
      -
    • -
    • -
      -
      Price:
      -
      {parseFloat(this.props.activity.price).toLocaleString('en-US', { style: 'currency', currency: 'USD' })}
      -
      -
    • -
    -
    -
    -
    -
    -
    -
    -
  • - ); - } - -}); - -export default React.createClass({ - - render() { - let items = this.props.activities.map(activity => { - let theme = getActivityTheme(activity.activity_name) - return ( - - ); - }); - return ( - - ); - } - -}); \ No newline at end of file diff --git a/client/js/activities/ActivityTypePickList.js b/client/js/activities/ActivityTypePickList.js deleted file mode 100644 index 80b234cf..00000000 --- a/client/js/activities/ActivityTypePickList.js +++ /dev/null @@ -1,23 +0,0 @@ -import React from 'react'; - -import * as activityTypeService from '../services/ActivityTypeService'; - -import PickList from "../components/PickList"; - -export default React.createClass({ - - getInitialState() { - return {activityTypes: []}; - }, - - componentDidMount() { - activityTypeService.findAll().then(activityTypes => this.setState({activityTypes: activityTypes})); - }, - - render() { - return ( - - ); - } - -}); \ No newline at end of file diff --git a/client/js/app.js b/client/js/app.js index 1bdbecde..7858a95f 100644 --- a/client/js/app.js +++ b/client/js/app.js @@ -17,20 +17,10 @@ import PackageHome from './packages/PackageHome'; import PackageRecord from './packages/PackageRecord'; import PackageView from './packages/PackageView'; -import PropertyHome from './properties/PropertyHome'; -import PropertyRecord from './properties/PropertyRecord'; -import PropertyForm from './properties/PropertyForm'; -import PropertyView from './properties/PropertyView'; - -import ContactHome from './contacts/ContactHome'; -import ContactRecord from './contacts/ContactRecord'; -import ContactForm from './contacts/ContactForm'; -import ContactView from './contacts/ContactView'; - -import BrokerHome from './brokers/BrokerHome'; -import BrokerRecord from './brokers/BrokerRecord'; -import BrokerForm from './brokers/BrokerForm'; -import BrokerView from './brokers/BrokerView'; +import PackageOrgHome from './packageorgs/PackageOrgHome'; +import PackageOrgRecord from './packageorgs/PackageOrgRecord'; +import PackageOrgForm from './packageorgs/PackageOrgForm'; +import PackageOrgView from './packageorgs/PackageOrgView'; let App = React.createClass({ render: function () { @@ -41,6 +31,7 @@ let App = React.createClass({
  • Orgs
  • Licenses
  • Packages
  • +
  • Package Orgs
  • {this.props.children} @@ -64,21 +55,10 @@ render(( - - - - - - - - - - - - - - - + + + + diff --git a/client/js/auth/AuthorizeOrg.js b/client/js/auth/AuthorizeOrg.js new file mode 100644 index 00000000..43cf8c28 --- /dev/null +++ b/client/js/auth/AuthorizeOrg.js @@ -0,0 +1,18 @@ +import React from 'react'; +import * as authService from "../services/AuthService"; + +export default React.createClass({ + getInitialState() { + return { url: "" }; + }, + + componentDidMount() { + authService.oauthOrgURL().then(url => this.setState({url})); + }, + + render() { + return ( + Connect Org + ); + } +}); \ No newline at end of file diff --git a/client/js/auth/AuthorizeWindow.js b/client/js/auth/AuthorizeWindow.js new file mode 100644 index 00000000..22d3bcfa --- /dev/null +++ b/client/js/auth/AuthorizeWindow.js @@ -0,0 +1,30 @@ +import React from 'react'; + +export default class PortalWindow extends React.Component { + constructor(props) { + super(props); + // STEP 1: create a container
    + this.containerEl = document.createElement('div'); + this.externalWindow = null; + } + + render() { + return ( +
    + ); + } + + componentDidMount() { + // STEP 3: open a new browser window and store a reference to it + this.externalWindow = window.open(this.props.url, '', 'width=700,height=700,left=200,top=200'); + + // STEP 4: append the container
    (that has props.children appended to it) to the body of the new window + // this.externalWindow.document.body.appendChild(this.containerEl); + } + + componentWillUnmount() { + // STEP 5: This will fire when this.state.showWindowPortal in the parent component becomes false + // So we tidy up by closing the window + this.externalWindow.close(); + } +} \ No newline at end of file diff --git a/client/js/brokers/BrokerCard.js b/client/js/brokers/BrokerCard.js deleted file mode 100644 index c88c9a48..00000000 --- a/client/js/brokers/BrokerCard.js +++ /dev/null @@ -1,68 +0,0 @@ -import React from 'react'; - -import * as brokerService from '../services/BrokerService'; - -import DataGrid from "../components/DataGrid"; -import {Icon, ButtonIcon} from "../components/Icons"; - -export default React.createClass({ - - getInitialState() { - return {brokers: []}; - }, - - componentWillReceiveProps(props) { - brokerService.findByProperty(props.property_id).then(brokers => this.setState({brokers})); - }, - - linkHandler(broker) { - window.location.hash = "#broker/" + broker.broker_id; - }, - - newHandler() { - alert("Not yet implemented in this demo app"); - }, - - actionHandler(data, value, label) { - alert("Not yet implemented in this demo app"); - }, - - render() { - - return ( -
    -
    -
    -
    - -
    -
    -

    Brokers

    -
    -
    -
    -
    - - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    - - -
    - ); - } - -}); \ No newline at end of file diff --git a/client/js/brokers/BrokerForm.js b/client/js/brokers/BrokerForm.js deleted file mode 100644 index 7e1cbc35..00000000 --- a/client/js/brokers/BrokerForm.js +++ /dev/null @@ -1,103 +0,0 @@ -import React from 'react'; -import LinkedStateMixin from 'react-addons-linked-state-mixin'; - -export default React.createClass({ - - mixins: [LinkedStateMixin], - - getInitialState() { - let broker = this.props.broker; - return {...broker}; - }, - - componentWillReceiveProps(props) { - let broker = props.broker; - this.setState({...broker}); - }, - - save() { - this.props.saveHandler(this.state); - }, - - render() { - return ( -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - Address -
    -
    - -
    -
    - - - -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    - ); - } - -}); \ No newline at end of file diff --git a/client/js/brokers/BrokerHome.js b/client/js/brokers/BrokerHome.js deleted file mode 100644 index 7cc6189b..00000000 --- a/client/js/brokers/BrokerHome.js +++ /dev/null @@ -1,67 +0,0 @@ -import React from 'react'; - -import * as brokerService from '../services/BrokerService'; - -import {HomeHeader} from '../components/PageHeader'; -import BrokerList from './BrokerList'; -import NewBrokerWindow from './NewBrokerWindow'; - -export default React.createClass({ - - getInitialState() { - return {brokers: []}; - }, - - componentDidMount() { - brokerService.findAll().then(brokers => this.setState({brokers})); - }, - - sortHandler(sortOrder) { - brokerService.findAll(sortOrder).then(brokers => { - this.setState({sortOrder, brokers}) - }); - }, - - newHandler() { - this.setState({addingBroker: true}); - }, - - deleteHandler(data) { - brokerService.deleteItem(data.broker_id).then(() => { - brokerService.findAll(this.state.sort).then(brokers => this.setState({brokers})); - }); - }, - - editHandler(data) { - window.location.hash = "#broker/" + data.broker_id + "/edit"; - }, - - saveHandler(Broker) { - brokerService.createItem(Broker).then(() => { - brokerService.findAll().then(brokers => this.setState({addingBroker: false, brokers})); - }); - }, - - cancelHandler() { - this.setState({addingBroker: false}); - }, - - render() { - return ( -
    - - - {this.state.addingBroker ? : ""} -
    - ); - } -}); \ No newline at end of file diff --git a/client/js/brokers/BrokerList.js b/client/js/brokers/BrokerList.js deleted file mode 100644 index eefaf764..00000000 --- a/client/js/brokers/BrokerList.js +++ /dev/null @@ -1,31 +0,0 @@ -import React from 'react'; - -import DataGrid from '../components/DataGrid'; - -export default React.createClass({ - - linkHandler(broker) { - window.location.hash = "#broker/" + broker.broker_id; - }, - - actionHandler(data, value, label) { - if (label === "Delete") { - this.props.onDelete(data); - } else if (label === "Edit") { - this.props.onEdit(data); - } - }, - - render() { - return ( - -
    -
    -
    -
    -
    - - ); - } - -}); diff --git a/client/js/brokers/BrokerRecord.js b/client/js/brokers/BrokerRecord.js deleted file mode 100644 index b4b6c2d7..00000000 --- a/client/js/brokers/BrokerRecord.js +++ /dev/null @@ -1,53 +0,0 @@ -import React from 'react'; -import {Router} from 'react-router'; - -import * as brokerService from '../services/BrokerService'; - -import {RecordHeader, HeaderField} from '../components/PageHeader'; - -export default React.createClass({ - - getInitialState() { - return { broker: {} }; - }, - - componentDidMount() { - let brokerId = this.props.params.brokerId; - brokerService.findById(brokerId).then(broker => this.setState({broker})); - }, - - saveHandler(broker) { - brokerService.updateItem(broker); - }, - - editHandler() { - window.location.hash= '#broker/' + this.state.broker.broker_id + '/edit'; - }, - - deleteHandler() { - brokerService.deleteItem(this.state.broker.broker_id).then(() => { - window.location.hash = '#brokers'; - }); - }, - - cloneHandler() { - - }, - - render() { - return ( -
    - - - - - - {React.cloneElement(this.props.children, { broker: this.state.broker, saveHandler: this.saveHandler})} - -
    - ); - } -}); \ No newline at end of file diff --git a/client/js/contacts/ContactForm.js b/client/js/contacts/ContactForm.js deleted file mode 100644 index ff2ba5a1..00000000 --- a/client/js/contacts/ContactForm.js +++ /dev/null @@ -1,103 +0,0 @@ -import React from 'react'; -import LinkedStateMixin from 'react-addons-linked-state-mixin'; - -export default React.createClass({ - - mixins: [LinkedStateMixin], - - getInitialState() { - let contact = this.props.contact; - return {...contact}; - }, - - componentWillReceiveProps(props) { - let contact = props.contact; - this.setState({...contact}); - }, - - save() { - this.props.saveHandler(this.state); - }, - - render() { - return ( -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - Address -
    -
    - -
    -
    - - - -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    - ); - } - -}); \ No newline at end of file diff --git a/client/js/contacts/ContactHome.js b/client/js/contacts/ContactHome.js deleted file mode 100644 index 95ceebf1..00000000 --- a/client/js/contacts/ContactHome.js +++ /dev/null @@ -1,68 +0,0 @@ -import React from 'react'; - -import * as contactService from '../services/ContactService'; - -import {HomeHeader} from '../components/PageHeader'; - -import ContactList from './ContactList'; -import NewContactWindow from './NewContactWindow'; - -export default React.createClass({ - - getInitialState() { - return {contacts: []}; - }, - - componentDidMount() { - contactService.findAll().then(contacts => this.setState({contacts})); - }, - - sortHandler(sortOrder) { - contactService.findAll(sortOrder).then(contacts => { - this.setState({sortOrder, contacts}) - }); - }, - - newHandler() { - this.setState({addingContact: true}); - }, - - deleteHandler(data) { - contactService.deleteItem(data.contact_id).then(() => { - contactService.findAll(this.state.sort).then(contacts => this.setState({contacts})); - }); - }, - - editHandler(data) { - window.location.hash = "#contact/" + data.contact_id + "/edit"; - }, - - saveHandler(Contact) { - contactService.createItem(Contact).then(() => { - contactService.findAll().then(contacts => this.setState({addingContact: false, contacts})); - }); - }, - - cancelHandler() { - this.setState({addingContact: false}); - }, - - render() { - return ( -
    - - - {this.state.addingContact ? : ""} -
    - ); - } -}); \ No newline at end of file diff --git a/client/js/contacts/ContactList.js b/client/js/contacts/ContactList.js deleted file mode 100644 index 25177f1e..00000000 --- a/client/js/contacts/ContactList.js +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; - -import DataGrid from '../components/DataGrid'; - -export default React.createClass({ - - linkHandler(contact) { - window.location.hash = "#contact/" + contact.contact_id; - }, - - actionHandler(data, value, label) { - if (label === "Delete") { - this.props.onDelete(data); - } else if (label === "Edit") { - this.props.onEdit(data); - } - }, - - render() { - return ( - -
    -
    -
    -
    -
    - - ); - } -}); diff --git a/client/js/contacts/ContactLookup.js b/client/js/contacts/ContactLookup.js deleted file mode 100644 index d49e2a88..00000000 --- a/client/js/contacts/ContactLookup.js +++ /dev/null @@ -1,32 +0,0 @@ -import React from 'react'; - -import * as contactService from '../services/ContactService'; - -import Lookup from '../components/Lookup'; - -export default React.createClass({ - - getInitialState() { - return { - searchKey: undefined, - items: [] - }; - }, - - searchKeyChangeHandler(key) { - contactService.findByName(key).then(items => this.setState({searchKey: key, items: items})); - }, - - render() { - return ( - - ); - } - -}); \ No newline at end of file diff --git a/client/js/contacts/ContactQuickFind.js b/client/js/contacts/ContactQuickFind.js deleted file mode 100644 index c86638fb..00000000 --- a/client/js/contacts/ContactQuickFind.js +++ /dev/null @@ -1,32 +0,0 @@ -import React from 'react'; - -import QuickFind from '../components/QuickFind'; - -import * as contactService from '../services/ContactService'; - -export default React.createClass({ - - getInitialState() { - return { - searchKey: undefined, - list: [] - }; - }, - - searchKeyChangeHandler(key) { - contactService.findByName(key).then(list => this.setState({searchKey: key, list: list})); - }, - - render() { - return ( - - ); - } - -}); \ No newline at end of file diff --git a/client/js/contacts/ContactRecord.js b/client/js/contacts/ContactRecord.js deleted file mode 100644 index 4d126712..00000000 --- a/client/js/contacts/ContactRecord.js +++ /dev/null @@ -1,52 +0,0 @@ -import React from 'react'; -import {Router} from 'react-router'; - -import * as contactService from '../services/ContactService'; - -import {RecordHeader, HeaderField} from '../components/PageHeader'; - -export default React.createClass({ - - getInitialState() { - return { contact: {} }; - }, - - componentDidMount() { - let contactId = this.props.params.contactId; - contactService.findById(contactId).then(contact => this.setState({contact})); - }, - - saveHandler(contact) { - contactService.updateItem(contact); - }, - - editHandler() { - window.location.hash= '#contact/' + this.state.contact.contact_id + '/edit'; - }, - - deleteHandler() { - contactService.deleteItem(this.state.contact.contact_id).then(() => { - window.location.hash = '#contacts'; - }); - }, - - cloneHandler() { - - }, - - render() { - return ( -
    - - - - - - {React.cloneElement(this.props.children, { contact: this.state.contact, saveHandler: this.saveHandler})} -
    - ); - } -}); \ No newline at end of file diff --git a/client/js/contacts/ContactView.js b/client/js/contacts/ContactView.js deleted file mode 100644 index 47146244..00000000 --- a/client/js/contacts/ContactView.js +++ /dev/null @@ -1,137 +0,0 @@ -import React from 'react'; -import moment from 'moment'; - -import * as activityService from '../services/ActivityService'; - -import Tabs from '../components/Tabs'; - -import ActivityTimeline from './../activities/ActivityTimeline'; -import ActivityCard from './../activities/ActivityCard'; -import NewActivityWindow from './../activities/NewActivityWindow'; - -export default React.createClass({ - - getInitialState() { - return {activities: []}; - }, - - componentWillReceiveProps(props) { - this.loadActivities(props.contact.contact_id); - }, - - loadActivities(contactId) { - activityService.findByContact(contactId).then(activities => this.setState({activities})); - }, - - newActivityHandler() { - this.setState({addingActivity: true}) - }, - - deleteActivityHandler(activity) { - activityService.deleteItem(activity.activity_id).then(() => this.loadActivities(this.props.contact.contact_id)); - }, - - cancelActivityHandler() { - this.setState({addingActivity: false}); - }, - - saveActivityHandler(activity) { - activityService.createItem(activity).then(() => { - this.loadActivities(this.props.contact.contact_id); - this.setState({addingActivity: false}); - }); - }, - - render() { - - return ( - -
    - -
    - -
    - -
    - - portrait - -
    - -
    -
    -
    -

    Address

    -
    -
    -

    {this.props.contact.address}
    {this.props.contact.city} {this.props.contact.state} {this.props.contact.zip}

    -
    -
    -
    -
    -
    -
    -

    Occupation

    -
    -
    -

    {this.props.contact.occupation}

    -
    -
    -
    -
    -
    -
    -

    Member since

    -
    -
    -

    {moment(this.props.contact.member_since).format("MMMM Do YYYY")}

    -
    -
    -
    -
    -
    -
    -

    Lead Source

    -
    -
    -

    {this.props.contact.lead_source}

    -
    -
    -
    -
    -
    -
    -

    Category

    -
    -
    -

    {this.props.contact.category}

    -
    -
    -
    -
    -
    - -
    - -
    - -
    -
    - Not implemented in this demo -
    -
    -
    - -
    -
    - - -
    - {this.state.addingActivity ? : ""} -
    - ); - } - -}); \ No newline at end of file diff --git a/client/js/contacts/NewContactWindow.js b/client/js/contacts/NewContactWindow.js deleted file mode 100644 index 1273aa7b..00000000 --- a/client/js/contacts/NewContactWindow.js +++ /dev/null @@ -1,77 +0,0 @@ -import React from 'react'; -import LinkedStateMixin from 'react-addons-linked-state-mixin'; - -export default React.createClass({ - - mixins: [LinkedStateMixin], - - getInitialState() { - let contact = this.props.contact; - return {...contact}; - }, - - onSave() { - this.props.onSave(this.state); - }, - - render() { - return ( -
    -
    -
    -
    -

    New Contact

    - -
    -
    - -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    - ); - } - -}); \ No newline at end of file diff --git a/client/js/brokers/NewBrokerWindow.js b/client/js/packageorgs/NewPackageOrgWindow.js similarity index 83% rename from client/js/brokers/NewBrokerWindow.js rename to client/js/packageorgs/NewPackageOrgWindow.js index 37b78a0b..b0b87b49 100644 --- a/client/js/brokers/NewBrokerWindow.js +++ b/client/js/packageorgs/NewPackageOrgWindow.js @@ -6,8 +6,8 @@ export default React.createClass({ mixins: [LinkedStateMixin], getInitialState() { - let broker = this.props.broker; - return {...broker}; + let packageorg = this.props.packageorg; + return {...packageorg}; }, onSave() { @@ -20,7 +20,7 @@ export default React.createClass({
    -

    New Broker

    +

    Add Package Org

    -
    +
    ); } - }); \ No newline at end of file diff --git a/client/js/packageorgs/PackageOrgForm.js b/client/js/packageorgs/PackageOrgForm.js new file mode 100644 index 00000000..13d2e705 --- /dev/null +++ b/client/js/packageorgs/PackageOrgForm.js @@ -0,0 +1,72 @@ +import React from 'react'; +import LinkedStateMixin from 'react-addons-linked-state-mixin'; + +export default React.createClass({ + + mixins: [LinkedStateMixin], + + getInitialState() { + let packageorg = this.props.packageorg; + return {...packageorg}; + }, + + componentWillReceiveProps(props) { + let packageorg = props.packageorg; + this.setState({...packageorg}); + }, + + save() { + this.props.saveHandler(this.state); + }, + + render() { + return ( +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + +
    +
    +
    + ); + } + +}); \ No newline at end of file diff --git a/client/js/packageorgs/PackageOrgHome.js b/client/js/packageorgs/PackageOrgHome.js new file mode 100644 index 00000000..2e6efc5d --- /dev/null +++ b/client/js/packageorgs/PackageOrgHome.js @@ -0,0 +1,73 @@ +import React from 'react'; + +import * as packageOrgService from '../services/PackageOrgService'; + +import {HomeHeader} from '../components/PageHeader'; +import PackageOrgList from './PackageOrgList'; +// import AuthorizeWindow from '../auth/AuthorizeWindow'; +import * as authService from "../services/AuthService"; + +export default React.createClass({ + + getInitialState() { + return {packageorgs: []}; + }, + + componentDidMount() { + packageOrgService.findAll().then(packageorgs => this.setState({packageorgs})); + }, + + sortHandler(sortOrder) { + packageOrgService.findAll(sortOrder).then(packageorgs => { + this.setState({sortOrder, packageorgs}); + }); + }, + + newHandler() { + authService.oauthOrgURL().then(url => this.setState({addingPackageOrg: true, url})); + }, + + deleteHandler(data) { + packageOrgService.deleteItem(data.id).then(() => { + packageOrgService.findAll(this.state.sort).then(packageorgs => this.setState({packageorgs})); + }); + }, + + editHandler(data) { + window.location.hash = "#packageorg/" + data.id + "/edit"; + }, + + saveHandler(packageorg) { + packageOrgService.createItem(packageorg).then(() => { + packageOrgService.findAll().then(packageorgs => this.setState({addingPackageOrg: false, packageorgs})); + }); + }, + + cancelHandler() { + this.setState({addingPackageOrg: false}); + }, + + viewChangeHandler(value) { + this.setState({view: value}); + }, + + render() { + return ( +
    + + + {this.state.addingPackageOrg && window.open(this.props.url, '', 'width=700,height=700,left=200,top=200')} + {/*{this.state.addingPackageOrg && (
    Authorizing
    )}*/} +
    + ); + } +}); \ No newline at end of file diff --git a/client/js/packageorgs/PackageOrgList.js b/client/js/packageorgs/PackageOrgList.js new file mode 100644 index 00000000..a084bbd1 --- /dev/null +++ b/client/js/packageorgs/PackageOrgList.js @@ -0,0 +1,32 @@ +import React from 'react'; + +import DataGrid from '../components/DataGrid'; + +export default React.createClass({ + + linkHandler(packageorg) { + window.location.hash = "#packageorg/" + packageorg.id; + }, + + actionHandler(data, value, label) { + if (label === "Delete") { + this.props.onDelete(data); + } else if (label === "Edit") { + this.props.onEdit(data); + } + }, + + render() { + return ( + +
    +
    +
    +
    +
    +
    + + ); + } + +}); diff --git a/client/js/packageorgs/PackageOrgRecord.js b/client/js/packageorgs/PackageOrgRecord.js new file mode 100644 index 00000000..b6e619f4 --- /dev/null +++ b/client/js/packageorgs/PackageOrgRecord.js @@ -0,0 +1,50 @@ +import React from 'react'; +import {Router} from 'react-router'; + +import * as packageOrgService from '../services/PackageOrgService'; + +import {RecordHeader, HeaderField} from '../components/PageHeader'; + +export default React.createClass({ + + getInitialState() { + return { packageorg: {} }; + }, + + componentDidMount() { + let packageorgId = this.props.params.packageorgId; + packageOrgService.findById(packageorgId).then(packageorg => this.setState({packageorg})); + }, + + saveHandler(packageorg) { + packageOrgService.updateItem(packageorg); + }, + + editHandler() { + window.location.hash= '#packageorg/' + this.state.packageorg.id + '/edit'; + }, + + deleteHandler() { + packageOrgService.deleteItem(this.state.packageorg.id).then(() => { + window.location.hash = '#packageorgs'; + }); + }, + + cloneHandler() { + + }, + + render() { + return ( +
    + + + + + {React.cloneElement(this.props.children, { packageorg: this.state.packageorg, saveHandler: this.saveHandler})} +
    + ); + } +}); \ No newline at end of file diff --git a/client/js/brokers/BrokerView.js b/client/js/packageorgs/PackageOrgView.js similarity index 58% rename from client/js/brokers/BrokerView.js rename to client/js/packageorgs/PackageOrgView.js index 43bccac7..3ed53970 100644 --- a/client/js/brokers/BrokerView.js +++ b/client/js/packageorgs/PackageOrgView.js @@ -1,11 +1,11 @@ import React from 'react'; import moment from 'moment'; -import * as propertyService from '../services/PropertyService'; +import * as packageVersionService from '../services/PackageVersionService'; import Tabs from '../components/Tabs'; -import PropertyCard from './../properties/PropertyCard'; +import PackageVersionCard from './../packageversions/PackageVersionCard'; export default React.createClass({ @@ -14,55 +14,52 @@ export default React.createClass({ }, componentWillReceiveProps(props) { - propertyService.findByBroker(props.broker.broker_id).then(properties => this.setState({properties})); + packageVersionService.findByDevOrgId(props.packageorg.org_id).then(packageversions => this.setState({packageversions})); }, render() { return ( -
    -
    -
    - -
    - - portrait - +
    +
    +
    +

    Org ID

    +
    +
    +

    {this.props.packageorg.org_id}

    +
    +
    - -
    +
    -

    Address

    +

    Username

    -

    {this.props.broker.address}
    {this.props.broker.city}, {this.props.broker.state} {this.props.broker.zip}

    +

    {this.props.packageorg.username}

    -
    +
    -

    Title

    +

    Instance URL

    -

    {this.props.broker.title}

    +

    {this.props.packageorg.instance_url}

    -

    - +
    -
    ); } - }); \ No newline at end of file diff --git a/client/js/packages/PackageView.js b/client/js/packages/PackageView.js index 477b2adc..97b5f580 100644 --- a/client/js/packages/PackageView.js +++ b/client/js/packages/PackageView.js @@ -21,15 +21,13 @@ export default React.createClass({
    -
    - +
    +
    -
    ); } - }); \ No newline at end of file diff --git a/client/js/packageversions/PackageVersionCard.js b/client/js/packageversions/PackageVersionCard.js index 0d28c3f8..b014376d 100644 --- a/client/js/packageversions/PackageVersionCard.js +++ b/client/js/packageversions/PackageVersionCard.js @@ -1,7 +1,5 @@ import React from 'react'; -import * as packageVersionService from '../services/PackageVersionService'; - import DataGrid from "../components/DataGrid"; import {Icon, ButtonIcon} from "../components/Icons"; diff --git a/client/js/properties/NewPropertyWindow.js b/client/js/properties/NewPropertyWindow.js deleted file mode 100644 index eab860a6..00000000 --- a/client/js/properties/NewPropertyWindow.js +++ /dev/null @@ -1,96 +0,0 @@ -import React from 'react'; -import LinkedStateMixin from 'react-addons-linked-state-mixin'; - -export default React.createClass({ - - mixins: [LinkedStateMixin], - - getInitialState() { - return {}; - }, - - onSave() { - this.props.onSave(this.state); - }, - - render() { - return ( -
    -
    -
    -
    -

    New Property

    - -
    -
    - -
    -
    - Address -
    -
    - -
    -
    - - - -
    -
    -
    -
    - Size -
    -
    - - - -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    -
    - ); - } - -}); \ No newline at end of file diff --git a/client/js/properties/PropertyCard.js b/client/js/properties/PropertyCard.js deleted file mode 100644 index 67087759..00000000 --- a/client/js/properties/PropertyCard.js +++ /dev/null @@ -1,59 +0,0 @@ -import React from 'react'; - -import * as propertyService from '../services/PropertyService'; - -import DataGrid from "../components/DataGrid"; -import {Icon, ButtonIcon} from "../components/Icons"; - -export default React.createClass({ - - propertyLinkHandler(property) { - window.location.hash = "#property/" + property.property_id; - }, - - newHandler() { - alert("Not yet implemented in this demo app"); - }, - - actionHandler(data, value, label) { - alert("Not yet implemented in this demo app"); - }, - - render() { - - return ( -
    -
    -
    -
    - -
    -
    -

    Properties

    -
    -
    -
    -
    - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - - -
    - ); - } - -}); \ No newline at end of file diff --git a/client/js/properties/PropertyForm.js b/client/js/properties/PropertyForm.js deleted file mode 100644 index 2bfe4e19..00000000 --- a/client/js/properties/PropertyForm.js +++ /dev/null @@ -1,127 +0,0 @@ -import React from 'react'; -import LinkedStateMixin from 'react-addons-linked-state-mixin'; - -export default React.createClass({ - - mixins: [LinkedStateMixin], - - getInitialState() { - let property = this.props.property; - return {...property}; - }, - - componentWillReceiveProps(props) { - let property = props.property; - this.setState({...property}); - }, - - latitudeChange(event) { - this.setState({location: {x: parseFloat(event.target.value), y: this.state.location.y}}); - }, - - longitudeChange(event) { - this.setState({location: {x: this.state.location.x, y: parseFloat(event.target.value)}}); - }, - - save() { - this.props.saveHandler(this.state); - }, - - render() { - return ( -
    -
    -
    - Address -
    -
    - -
    -
    - - - -
    -
    -
    -
    - Location -
    -
    - - -
    -
    -
    -
    - Size -
    -
    - - - -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - -
    -
    - ); - } - -}); \ No newline at end of file diff --git a/client/js/properties/PropertyHome.js b/client/js/properties/PropertyHome.js deleted file mode 100644 index 7ad0a840..00000000 --- a/client/js/properties/PropertyHome.js +++ /dev/null @@ -1,89 +0,0 @@ -import React from 'react'; - -import * as propertyService from '../services/PropertyService'; - -import GoogleMaps from '../components/GoogleMaps'; -import {HomeHeader} from '../components/PageHeader'; - -import PropertyList from './PropertyList'; -import NewPropertyWindow from './NewPropertyWindow'; - -export default React.createClass({ - - getInitialState() { - return {view: "grid", sortOrder: "address", properties: []}; - }, - - componentDidMount() { - propertyService.findAll(this.state.sortOrder).then(properties => this.setState({properties})); - }, - - sortHandler(sortOrder) { - propertyService.findAll(sortOrder).then(properties => { - this.setState({sortOrder, properties}) - }); - }, - - deleteHandler(data) { - propertyService.deleteItem(data.property_id).then(() => { - propertyService.findAll(this.state.sort).then(properties => this.setState({properties})); - }); - }, - - editHandler(data) { - window.location.hash = "#property/" + data.property_id + "/edit"; - }, - - viewChangeHandler(value) { - this.setState({view: value}); - }, - - newHandler() { - this.setState({addingProperty: true}); - }, - - saveHandler(property) { - propertyService.createItem(property).then(() => { - propertyService.findAll(this.state.sort).then(properties => this.setState({addingProperty: false, properties})); - }); - }, - - cancelHandler() { - this.setState({addingProperty: false}); - }, - - render() { - let view; - if (this.state.view === "map") { - view = ; - } else if (this.state.view === "split") { - view =
    -
    - -
    -
    - -
    -
    ; - } else { - view = ; - } - return ( -
    - - {view} - {this.state.addingProperty ? : ""} -
    - ); - } - -}); \ No newline at end of file diff --git a/client/js/properties/PropertyList.js b/client/js/properties/PropertyList.js deleted file mode 100644 index d733c83d..00000000 --- a/client/js/properties/PropertyList.js +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; -import DataGrid from '../components/DataGrid'; - -export default React.createClass({ - - linkHandler(property) { - window.location.hash = "#property/" + property.property_id; - }, - - actionHandler(data, value, label) { - if (label === "Delete") { - this.props.onDelete(data); - } else if (label === "Edit") { - this.props.onEdit(data); - } - }, - - render() { - return ( - -
    -
    -
    -
    -
    - - ); - } - -}); \ No newline at end of file diff --git a/client/js/properties/PropertyQuickFind.js b/client/js/properties/PropertyQuickFind.js deleted file mode 100644 index e93273b2..00000000 --- a/client/js/properties/PropertyQuickFind.js +++ /dev/null @@ -1,32 +0,0 @@ -import React from 'react'; - -import * as propertyService from '../services/PropertyService'; - -import QuickFind from '../components/QuickFind'; - -export default React.createClass({ - - getInitialState() { - return { - searchKey: undefined, - list: [] - }; - }, - - searchKeyChangeHandler(key) { - propertyService.findByName(key).then(list => this.setState({searchKey: key, list: list})); - }, - - render() { - return ( - - ); - } - -}); \ No newline at end of file diff --git a/client/js/properties/PropertyRecord.js b/client/js/properties/PropertyRecord.js deleted file mode 100644 index 3af1b969..00000000 --- a/client/js/properties/PropertyRecord.js +++ /dev/null @@ -1,51 +0,0 @@ -import React from 'react'; -import {Router} from 'react-router'; - -import * as propertyService from '../services/PropertyService'; - -import {RecordHeader, HeaderField} from '../components/PageHeader'; - -export default React.createClass({ - - getInitialState() { - return { property: {} }; - }, - - componentDidMount() { - propertyService.findById(this.props.params.propertyId).then(property => this.setState({property})); - }, - - saveHandler(property) { - propertyService.updateItem(property).then(() => { - console.log('property saved'); - }); - }, - - editHandler() { - window.location.hash = '#property/' + this.state.property.property_id + '/edit'; - }, - - deleteHandler() { - propertyService.deleteItem(this.state.property.property_id).then(() => { - window.location.hash = '#'; - }); - }, - - render() { - // - return ( -
    - - - - - - - {React.cloneElement(this.props.children, { property: this.state.property, saveHandler: this.saveHandler})} -
    - ); - } -}); \ No newline at end of file diff --git a/client/js/properties/PropertyView.js b/client/js/properties/PropertyView.js deleted file mode 100644 index 7a1b739c..00000000 --- a/client/js/properties/PropertyView.js +++ /dev/null @@ -1,166 +0,0 @@ -import React from 'react'; - -import * as activityService from '../services/ActivityService'; - -import Tabs from '../components/Tabs'; -import GoogleMaps from '../components/GoogleMaps'; -import FileDropArea from '../components/FileDropArea'; - -import ActivityTimeline from './../activities/ActivityTimeline'; -import BrokerCard from './../brokers/BrokerCard'; -import ActivityCard from './../activities/ActivityCard'; -import NewActivityWindow from './../activities/NewActivityWindow'; - -export default React.createClass({ - - getInitialState() { - return {activities: []}; - }, - - componentWillReceiveProps(props) { - this.loadActivities(props.property.property_id); - }, - - loadActivities(propertyId) { - activityService.findByProperty(propertyId).then(activities => this.setState({activities})); - }, - - newActivityHandler() { - this.setState({addingActivity: true}); - }, - - deleteActivityHandler(activity) { - activityService.deleteItem(activity.activity_id).then(() => this.loadActivities(this.props.property.property_id)); - }, - - cancelActivityHandler() { - this.setState({addingActivity: false}); - }, - - saveActivityHandler(activity) { - activityService.createItem(activity).then(() => { - this.loadActivities(this.props.property.property_id); - this.setState({addingActivity: false}); - }); - }, - - render() { - - let title = { - fontSize: "24px", - fontWeight: "300", - padding: "12px 0 6px 0" - }; - - return ( - -
    - -
    - -
    - -
    - -

    {this.props.property.teaser}

    - {this.props.property.description} -
    - -
    -
    -
    -

    Sqft

    -
    -
    -

    {this.props.property.size}

    -
    -
    -
    - -
    -
    -
    -

    Bedrooms

    -
    -
    -

    {this.props.property.bedrooms}

    -
    -
    -
    - -
    -
    -
    -

    Bathrooms

    -
    -
    -

    {this.props.property.bathrooms}

    -
    -
    -
    - -
    -
    -
    -

    Garage

    -
    -
    -

    2 cars

    -
    -
    -
    - -
    -
    -
    -

    Finished Basement

    -
    -
    -

    Yes

    -
    -
    -
    - -
    -
    -
    -

    Heating

    -
    -
    -

    Gas

    -
    -
    -
    - -
    -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    -
    -
    - -
    -
    - - -
    - {this.state.addingActivity ? : ""} -
    - ); - } - -}); \ No newline at end of file diff --git a/client/js/services/ActivityService.js b/client/js/services/ActivityService.js deleted file mode 100644 index 315309cc..00000000 --- a/client/js/services/ActivityService.js +++ /dev/null @@ -1,19 +0,0 @@ -import * as h from './h'; - -let url = "/activities"; - -export let findAll = sort => h.get(url, {sort}); - -export let findByName = name => h.get(url, {name}); - -export let findByProperty = propertyId => h.get(url, {propertyId}); - -export let findByContact = contactId => h.get(url, {contactId}); - -export let findById = id => h.get(url + "/" + id); - -export let updateItem = property => h.put(url, property); - -export let createItem = property => h.post(url, property); - -export let deleteItem = id => h.del(url + "/" + id); \ No newline at end of file diff --git a/client/js/services/ActivityTypeService.js b/client/js/services/ActivityTypeService.js deleted file mode 100644 index fb68fbdc..00000000 --- a/client/js/services/ActivityTypeService.js +++ /dev/null @@ -1,5 +0,0 @@ -import * as h from './h'; - -let url = "/activitytypes"; - -export let findAll = sort => h.get(url, {sort}); \ No newline at end of file diff --git a/client/js/services/AuthService.js b/client/js/services/AuthService.js new file mode 100644 index 00000000..88369ee4 --- /dev/null +++ b/client/js/services/AuthService.js @@ -0,0 +1,13 @@ +import * as h from './h'; + +let baseurl = "/oauth2"; + +exports.oauthLoginURL = oauthLoginURL; +exports.oauthOrgURL = oauthOrgURL; +exports.oauthCallback = oauthCallback; + +export let oauthLoginURL = () => h.get(baseurl + "/loginurl"); + +export let oauthOrgURL = () => h.get(baseurl + "/orgurl"); + +export let oauthCallback = code => h.get(baseurl + "/callback", {code}); \ No newline at end of file diff --git a/client/js/services/BrokerService.js b/client/js/services/BrokerService.js deleted file mode 100644 index 066ca4e6..00000000 --- a/client/js/services/BrokerService.js +++ /dev/null @@ -1,17 +0,0 @@ -import * as h from './h'; - -let url = "/brokers"; - -export let findAll = sort => h.get(url, {sort}); - -export let findByProperty = propertyId => h.get(url, {propertyId}); - -export let findByName = name => h.get(url, {name}); - -export let findById = id => h.get(url + "/" + id); - -export let updateItem = property => h.put(url, property); - -export let createItem = property => h.post(url, property); - -export let deleteItem = id => h.del(url + "/" + id); \ No newline at end of file diff --git a/client/js/services/ContactService.js b/client/js/services/ContactService.js deleted file mode 100644 index 86ced2d4..00000000 --- a/client/js/services/ContactService.js +++ /dev/null @@ -1,15 +0,0 @@ -import * as h from './h'; - -let url = "/contacts"; - -export let findAll = sort => h.get(url, {sort}); - -export let findByName = name => h.get(url, {name}); - -export let findById = id => h.get(url + "/" + id); - -export let updateItem = property => h.put(url, property); - -export let createItem = property => h.post(url, property); - -export let deleteItem = id => h.del(url + "/" + id); \ No newline at end of file diff --git a/client/js/services/PackageOrgService.js b/client/js/services/PackageOrgService.js new file mode 100644 index 00000000..3f07c44d --- /dev/null +++ b/client/js/services/PackageOrgService.js @@ -0,0 +1,15 @@ +import * as h from './h'; + +let url = "/packageorgs"; + +export let findAll = sort => h.get(url, {sort}); + +export let findById = id => h.get(url + "/" + id); + +export let findByNamespace = namespace => h.get(url, {namespace}); + +export let updateItem = packageOrg => h.put(url, packageOrg); + +export let createItem = packageOrg => h.post(url, packageOrg); + +export let deleteItem = id => h.del(url + "/" + id); \ No newline at end of file diff --git a/client/js/services/PropertyService.js b/client/js/services/PropertyService.js deleted file mode 100644 index 76cb8211..00000000 --- a/client/js/services/PropertyService.js +++ /dev/null @@ -1,17 +0,0 @@ -import * as h from './h'; - -let url = "/properties"; - -export let findAll = sort => h.get(url, {sort}); - -export let findByName = name => h.get(url, {name}); - -export let findByBroker = brokerId => h.get(url, {brokerId}); - -export let findById = id => h.get(url + "/" + id); - -export let updateItem = property => h.put(url, property); - -export let createItem = property => h.post(url, property); - -export let deleteItem = id => h.del(url + "/" + id); \ No newline at end of file diff --git a/crypt.js b/crypt.js new file mode 100644 index 00000000..55d14b58 --- /dev/null +++ b/crypt.js @@ -0,0 +1,85 @@ +'use strict'; + +/* + crypt.js - wrapper for crypto + All taken from thenativeweb/crypto2 (because I couldn't get the full module to work) + */ + +const crypto = require('crypto'), + NodeRSA = require('node-rsa'), + {Readable} = require('stream'); + +const createKeyPair = async function () { + const key = new NodeRSA({b: 2048, e: 65537}, {environment: 'node', signingAlgorithm: 'sha256'}); + + const privateKey = key.exportKey(), + publicKey = key.exportKey('public'); + + return {privateKey, publicKey}; +}; + +const rsaEncrypt = async function (text, publicKey) { + const key = new NodeRSA(publicKey); + return key.encrypt(text, 'base64', 'utf8'); +}; + +const rsaDecrypt = async function (text, privateKey) { + const key = new NodeRSA(privateKey); + return key.decrypt(text, 'utf8'); +}; + +const passwordEncrypt = async function (text, password) { + const cipher = crypto.createCipher('aes-256-cbc', password); + return await processStream(cipher, text, {from: 'utf8', to: 'hex'}); +}; + +const passwordDecrypt = async function (text, password) { + const decipher = crypto.createDecipher('aes-256-cbc', password); + return await processStream(decipher, text, {from: 'hex', to: 'utf8'}); +}; + +const processStream = function (cipher, text, options) { + return new Promise((resolve, reject) => { + let result = ''; + + if (cipher instanceof Readable) { + cipher.setEncoding(options.to); + + cipher.on('readable', () => { + result += cipher.read() || ''; + }); + + cipher.once('end', () => { + cipher.removeAllListeners(); + resolve(result); + }); + } else { + cipher.once('finish', () => { + cipher.removeAllListeners(); + resolve(result); + }); + } + + cipher.once('error', err => { + cipher.removeAllListeners(); + reject(err); + }); + + try { + cipher.write(text, options.from); + cipher.end(); + } catch (ex) { + reject(ex); + } + }); +}; + +const crypt = { + createKeyPair, + rsaEncrypt, + rsaDecrypt, + passwordEncrypt, + passwordDecrypt +}; + +module.exports = crypt; diff --git a/initsb.sql b/initsb.sql index 19af53aa..36a24ae6 100644 --- a/initsb.sql +++ b/initsb.sql @@ -1,40 +1,15 @@ -DROP TABLE IF EXISTS org; -DROP TABLE IF EXISTS org_package; -DROP TABLE IF EXISTS packageevent; +DROP TABLE IF EXISTS package_org; -CREATE TABLE IF NOT EXISTS org ( +CREATE TABLE IF NOT EXISTS package_org ( id SERIAL PRIMARY KEY, - org_id TEXT + org_id TEXT, + name TEXT, + namespace TEXT, + instance_url TEXT, + username TEXT, + refresh_token TEXT, + access_token TEXT, + status TEXT ); -CREATE TABLE IF NOT EXISTS org_packageversion ( - id SERIAL PRIMARY KEY, - org_id TEXT, - pkg_version_id TEXT -); - -CREATE TABLE IF NOT EXISTS packageevent ( - event_id SERIAL PRIMARY KEY, - pkg_version_id TEXT -); - --- ALTER DATABASE postgres SET search_path TO public,steelbrick -CREATE OR REPLACE VIEW org AS - SELECT DISTINCT - l.sflma__subscriber_org_id__c AS org_id, - l.sflma__org_instance__c AS instance, - l.sflma__account__c AS account_id, - a.name AS account_name - FROM sflma__license__c l INNER JOIN account AS a ON l.sflma__account__c = a.sfid; - --- ALTER DATABASE postgres SET search_path TO public,steelbrick -CREATE OR REPLACE VIEW org_package AS - SELECT DISTINCT - l.sflma__subscriber_org_id__c AS org_id, - l.sflma__org_instance__c AS instance, - l.sflma__account__c AS account_id, - a.name AS account_name, - p.name AS package_name, - p.sfid AS package_id - FROM sflma__license__c l INNER JOIN account AS a ON l.sflma__account__c = a.sfid - INNER JOIN sflma__package__c AS p ON l.sflma__package__c = p.sfid; \ No newline at end of file +-- ALTER DATABASE postgres SET search_path TO public,steelbrick \ No newline at end of file diff --git a/package.json b/package.json index 90ba0427..9b712b86 100644 --- a/package.json +++ b/package.json @@ -16,9 +16,12 @@ "babel-plugin-transform-object-rest-spread": "^6.3.13", "body-parser": "^1.14.2", "compression": "^1.6.1", + "cookie-session": "^2.0.0-beta.3", "express": "^4.13.4", + "jsforce": "^1.8.0", "method-override": "^2.3.5", "moment": "^2.11.2", + "node-rsa": "^0.4.2", "path": "^0.12.7", "pg": "^4.4.4", "q": "^1.4.1" diff --git a/server.js b/server.js index 029300b1..f246fba7 100644 --- a/server.js +++ b/server.js @@ -1,26 +1,33 @@ -var express = require('express'), +const CLIENT_SECRET = process.env.CLIENT_SECRET; + +const express = require('express'), bodyParser = require('body-parser'), + cookieSession = require('cookie-session'), compression = require('compression'), orgs = require('./server/orgs'), packages = require('./server/packages'), - packageVersions = require('./server/packageVersions'), + packageorgs = require('./server/package_orgs'), + packageversions = require('./server/packageVersions'), licenses = require('./server/licenses'), - properties = require('./server/properties'), - contacts = require('./server/contacts'), - activities = require('./server/activities'), - brokers = require('./server/brokers'), - activityTypes = require('./server/activitytypes'), - sqlinit = require('./server/sqlinit'), + auth = require('./server/auth'), + // sqlinit = require('./server/sqlinit'), app = express(); -app.set('port', process.env.PORT || 5000); +app.set('port', process.env.PORT || 5000); +app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()); app.use(compression()); - app.use('/', express.static(__dirname + '/www')); +app.use(cookieSession({ + name: 'session', + maxAge: 60 * 60 * 1000 * 2, // 2 hours + keys: [CLIENT_SECRET]})); +app.get('/oauth2/callback', auth.oauthOrgCallback); +app.get('/oauth2/orgurl', auth.oauthOrgURL); + app.get('/orgs', orgs.findAll); app.get('/orgs/:id', orgs.findById); @@ -30,32 +37,14 @@ app.get('/licenses/:id', licenses.findById); app.get('/packages', packages.findAll); app.get('/packages/:id', packages.findById); -app.get('/packageversions', packageVersions.findAll); -app.get('/packageversions/:id', packageVersions.findById); - -app.get('/properties', properties.findAll); -app.get('/properties/:id', properties.findById); -app.post('/properties', properties.createItem); -app.put('/properties', properties.updateItem); -app.delete('/properties/:id', properties.deleteItem); - -app.get('/contacts', contacts.findAll); -app.get('/contacts/:id', contacts.findById); -app.post('/contacts', contacts.createItem); -app.put('/contacts', contacts.updateItem); -app.delete('/contacts/:id', contacts.deleteItem); - -app.get('/activities', activities.findAll); -app.post('/activities', activities.createItem); -app.delete('/activities/:id', activities.deleteItem); - -app.get('/activitytypes', activityTypes.findAll); +app.get('/packageversions', packageversions.findAll); +app.get('/packageversions/:id', packageversions.findById); -app.get('/brokers', brokers.findAll); -app.get('/brokers/:id', brokers.findById); -app.post('/brokers', brokers.createItem); -app.put('/brokers', brokers.updateItem); -app.delete('/brokers/:id', brokers.deleteItem); +app.get('/packageorgs', packageorgs.findAll); +app.get('/packageorgs/:id', packageorgs.findById); +app.post('/packageorgs', packageorgs.createItem); +app.put('/packageorgs', packageorgs.updateItem); +app.delete('/packageorgs/:id', packageorgs.deleteItem); app.listen(app.get('port'), function () { console.log('Express server listening on port ' + app.get('port')); diff --git a/server/activities.js b/server/activities.js deleted file mode 100644 index 2cb4d5db..00000000 --- a/server/activities.js +++ /dev/null @@ -1,60 +0,0 @@ -var db = require('./pghelper'); - -function findAll(req, res, next) { - - var propertyId = req.query.propertyId, - contactId = req.query.contactId, - whereParts = [], - values = []; - - if (propertyId) { - values.push(parseInt(propertyId)); - whereParts.push("activity.property_id = $" + values.length); - } - if (contactId) { - values.push(parseInt(contactId)); - whereParts.push("activity.contact_id = $" + values.length); - } - - var where = whereParts.length > 0 ? ("WHERE " + whereParts.join(" AND ")) : ""; - - db.query("SELECT activity_id, activity.property_id, property.address, activity.contact_id as contact_id, contact.first_name || ' ' || contact.last_name as contact, activity_type.name as activity_name, activity_date, activity.price, comment FROM activity " + - "INNER JOIN property on activity.property_id = property.property_id " + - "LEFT JOIN contact on activity.contact_id = contact.contact_id " + - "INNER JOIN activity_type on activity.activity_type_id = activity_type.activity_type_id " + - where + - "ORDER BY activity_date", values) - .then(function (activities) { - return res.send(JSON.stringify(activities)); - }) - .catch(next); - -}; - -function createItem(req, res, next) { - var activity = req.body; - db.query('INSERT INTO activity (property_id, contact_id, activity_type_id, activity_date, price, comment) VALUES ($1, $2, $3, $4, $5, $6)', - [activity.property_id, activity.contact_id, activity.activity_type_id, activity.activity_date, activity.price, activity.comment], true) - .then(function () { - return res.send({result: 'ok'}); - }) - .fail(function(err) { - return next(err); - }); -}; - -function deleteItem(req, res, next) { - var activityId = req.params.id; - db.query('DELETE FROM activity WHERE activity_id=$1', [activityId], true) - .then(function () { - return res.send({result: 'ok'}); - }) - .fail(function(err) { - return next(err); - }); - -}; - -exports.findAll = findAll; -exports.createItem = createItem; -exports.deleteItem = deleteItem; \ No newline at end of file diff --git a/server/activitytypes.js b/server/activitytypes.js deleted file mode 100644 index 997c55a3..00000000 --- a/server/activitytypes.js +++ /dev/null @@ -1,13 +0,0 @@ -var db = require('./pghelper'); - -function findAll(req, res, next) { - - db.query("SELECT activity_type_id, name FROM activity_type") - .then(function (types) { - return res.send(JSON.stringify(types)); - }) - .catch(next); - -}; - -exports.findAll = findAll; \ No newline at end of file diff --git a/server/auth.js b/server/auth.js new file mode 100644 index 00000000..66f17678 --- /dev/null +++ b/server/auth.js @@ -0,0 +1,73 @@ +'use strict'; + +const jsforce = require('jsforce'); +const package_orgs = require('./package_orgs'); + +const PORT = process.env.PORT || 5000; + +const LOGIN_URL = process.env.LOGIN_URL || 'https://steelbrick.my.salesforce.com'; +const CALLBACK_URL = (process.env.LOCAL_URL || 'http://localhost:' + PORT) + '/oauth2/callback'; + +const CLIENT_ID = process.env.CLIENT_ID; +const CLIENT_SECRET = process.env.CLIENT_SECRET; + + +function oauthLoginURL(req, res, next) { + try { + res.json(buildURL('api id web')); + } catch (e) { + next(e); + } +} + +function oauthOrgURL(req, res, next) { + try { + res.json(buildURL('api id web refresh_token')); + } catch (e) { + next(e); + } +} + +function buildURL(scope) { + let conn = buildConnection(); + return conn.oauth2.getAuthorizationUrl({scope: scope} + "&prompt=login"); +} + +function oauthOrgCallback(req, res, next) { + let conn = buildConnection(); + conn.authorize(req.query.code, function (err, userInfo) { + if (err) { + return next(err); + } + + package_orgs.createPackageOrg(userInfo.organizationId, "", "", conn.instanceUrl, "", conn.refreshToken, conn.accessToken); + console.log(JSON.stringify(userInfo)); + return res.send(""); + }); +} + +function isAuth(req, res) { + if (req.session.accessToken == null) { + res.send('not authorized: Just do it.'); + return false; + } + return true; +} + +function buildConnection(accessToken, refreshToken) { + return new jsforce.Connection({ + oauth2: { + clientId: CLIENT_ID, + clientSecret: CLIENT_SECRET, + redirectUri: CALLBACK_URL + }, + instanceUrl: LOGIN_URL, + accessToken: accessToken, + refreshToken: refreshToken + } + ); +} + +exports.oauthLoginURL = oauthLoginURL; +exports.oauthOrgURL = oauthOrgURL; +exports.oauthOrgCallback = oauthOrgCallback; diff --git a/server/brokers.js b/server/brokers.js deleted file mode 100644 index 068d3fec..00000000 --- a/server/brokers.js +++ /dev/null @@ -1,78 +0,0 @@ -var db = require('./pghelper'); - -function findAll(req, res, next) { - - var propertyId = req.query.propertyId, - promise; - - if (propertyId) { - promise = db.query("SELECT b.broker_id, b.first_name, b.last_name, b.first_name || ' ' || b.last_name as name, b.title, b.office_phone, b.mobile_phone, b.email FROM property_broker as pb " + - "INNER JOIN broker AS b on pb.broker_id = b.broker_id " + - "WHERE pb.property_id = $1 ORDER BY b.first_name", [propertyId]); - } else { - var name = req.query.name; - var sort = req.query.sort || "first_name"; - whereClause = name ? "WHERE first_name || last_name ~* $1" : ""; - promise = db.query("SELECT broker_id, first_name, last_name, first_name || ' ' || last_name as name, title, office_phone, mobile_phone, email FROM broker " + whereClause + " ORDER BY " + sort, name ? [name] : []); - } - promise.then(function (brokers) { - return res.send(JSON.stringify(brokers)); - }) - .catch(next); -}; - -function findById(req, res, next) { - var id = req.params.id; - - var sql = "SELECT broker_id, first_name, last_name, address, city, state, zip, title, office_phone, mobile_phone, email, pic FROM broker WHERE broker_id = $1"; - - db.query(sql, [id]) - .then(function (broker) { - return res.json(broker[0]); - }) - .catch(next); -}; - -function createItem(req, res, next) { - var broker = req.body; - db.query('INSERT INTO broker (first_name, last_name, office_phone, mobile_phone, email) VALUES ($1, $2, $3, $4, $5)', - [broker.first_name, broker.last_name, broker.office_phone, broker.mobile_phone, broker.email], true) - .then(function () { - return res.send({result: 'ok'}); - }) - .fail(function(err) { - return next(err); - }); - -}; - -function updateItem(req, res, next) { - var broker = req.body; - db.query('UPDATE broker SET first_name=$1, last_name=$2, address=$3, city=$4, state=$5, zip=$6, office_phone=$7, mobile_phone=$8, email=$9, title=$10, pic=$11 WHERE broker_id=$12', - [broker.first_name, broker.last_name, broker.address, broker.city, broker.state, broker.zip, broker.office_phone, broker.mobile_phone, broker.email, broker.title, broker.pic, broker.broker_id], true) - .then(function () { - return res.send({result: 'ok'}); - }) - .fail(function(err) { - return next(err); - }); - -}; - -function deleteItem(req, res, next) { - var brokerId = req.params.id; - db.query('DELETE FROM broker WHERE broker_id=$1', [brokerId], true) - .then(function () { - return res.send({result: 'ok'}); - }) - .fail(function(err) { - return next(err); - }); - -}; - -exports.findAll = findAll; -exports.findById = findById; -exports.createItem = createItem; -exports.updateItem = updateItem; -exports.deleteItem = deleteItem; diff --git a/server/contacts.js b/server/contacts.js deleted file mode 100644 index fc866b95..00000000 --- a/server/contacts.js +++ /dev/null @@ -1,72 +0,0 @@ -var db = require('./pghelper'); - -function findAll(req, res, next) { - - var name = req.query.name; - var sort = req.query.sort || "first_name"; - - var whereClause = name ? "WHERE first_name || last_name ~* $1" : ""; - - db.query("SELECT contact_id, first_name, last_name, first_name || ' ' || last_name as name, home_phone, mobile_phone, email FROM contact " + whereClause + " ORDER BY " + sort , name ? [name] : []) - .then(function (contacts) { - return res.send(JSON.stringify(contacts)); - }) - .catch(next); - -}; - -function findById(req, res, next) { - var id = req.params.id; - - var sql = "SELECT contact_id, first_name, last_name, address, city, state, zip, occupation, home_phone, mobile_phone, email, lead_source, category, member_since, notes, pic FROM contact WHERE contact_id = $1"; - - db.query(sql, [id]) - .then(function (contact) { - return res.json(contact[0]); - }) - .catch(next); -}; - -function createItem(req, res, next) { - var contact = req.body; - db.query('INSERT INTO contact (first_name, last_name, home_phone, mobile_phone, email) VALUES ($1, $2, $3, $4, $5)', - [contact.first_name, contact.last_name, contact.home_phone, contact.mobile_phone, contact.email], true) - .then(function () { - return res.send({result: 'ok'}); - }) - .fail(function(err) { - return next(err); - }); - -}; - -function updateItem(req, res, next) { - var contact = req.body; - db.query('UPDATE contact SET first_name=$1, last_name=$2, address=$3, city=$4, state=$5, zip=$6, home_phone=$7, mobile_phone=$8, email=$9, occupation=$10, pic=$11 WHERE contact_id=$12', - [contact.first_name, contact.last_name, contact.address, contact.city, contact.state, contact.zip, contact.home_phone, contact.mobile_phone, contact.email, contact.occupation, contact.pic, contact.contact_id], true) - .then(function () { - return res.send({result: 'ok'}); - }) - .fail(function(err) { - return next(err); - }); - -}; - -function deleteItem(req, res, next) { - var contactId = req.params.id; - db.query('DELETE FROM contact WHERE contact_id=$1', [contactId], true) - .then(function () { - return res.send({result: 'ok'}); - }) - .fail(function(err) { - return next(err); - }); - -}; - -exports.findAll = findAll; -exports.findById = findById; -exports.createItem = createItem; -exports.updateItem = updateItem; -exports.deleteItem = deleteItem; \ No newline at end of file diff --git a/server/package_orgs.js b/server/package_orgs.js new file mode 100644 index 00000000..bc345909 --- /dev/null +++ b/server/package_orgs.js @@ -0,0 +1,93 @@ +const db = require('./pghelper'); + +const STATUS = { + Pending: "Pending", + Connected: "Connected", + Disconnected: "Disconnected", + Invalid: "Invalid" +}; + +const SELECT_ALL = + " SELECT id, name, namespace, org_id, instance_url, refresh_token, access_token, username, status " + + "FROM package_org"; + +async function findAll(req, res, next) { + let sort = " ORDER BY " + (req.query.sort || "name"); + try { + let recs = await db.query(SELECT_ALL + sort, []); + return res.send(JSON.stringify(recs)); + } catch (err) { + next(err); + } +} + +async function findById(req, res, next) { + let id = req.params.id; + let where = " WHERE id = $1"; + + try { + let recs = await db.query(SELECT_ALL + where, [id]); + return res.json(recs[0]); + } catch (err) { + next(err); + } +} + +async function findByNamespace(req, res, next) { + let ns = req.params.namespace; + let where = " WHERE namespace = $1"; + + try { + let recs = await db.query(SELECT_ALL + where, [ns]); + return res.json(recs[0]); + } catch (err) { + next(err); + } +} + + +async function createItem(req, res, next) { + let packageorg = req.body; + try { + await createPackageOrg(packageorg.org_id, packageorg.name, packageorg.namespace, packageorg.instance_url, packageorg.username, packageorg.refresh_token, packageorg.access_token); + return res.send({result: 'ok'}); + } catch (err) { + return next(err); + } +} + +async function createPackageOrg(org_id, name, namespace, instance_url, username, refresh_token, access_token) { + await db.query('INSERT INTO package_org (org_id, name, namespace, instance_url, username, refresh_token, access_token, status) ' + + 'VALUES ($1, $2, $3, $4, $5, $6, $7, $8)', + [org_id, name, namespace, instance_url, username, refresh_token, access_token, STATUS.Pending], true); +} + +async function updateItem(req, res, next) { + let po = req.body; + try { + await db.query('UPDATE package_org SET org_id=$1, name=$2, namespace=$3, instance_url=$4, ' + + 'username=$5, refresh_token=$6, access_token=$7 WHERE id=$8', + [po.org_id, po.name, po.namespace, po.instance_url, po.username, po.refresh_token, po.access_token, po.id], true); + return res.send({result: 'ok'}); + } catch (err) { + return next(err); + } +} + +async function deleteItem(req, res, next) { + let id = req.params.id; + try { + await db.query('DELETE FROM package_org WHERE id=$1', [id], true); + return res.send({result: 'ok'}); + } catch (err) { + return next(err); + } +} + +exports.findAll = findAll; +exports.findById = findById; +exports.findByNamespace = findByNamespace; +exports.createItem = createItem; +exports.createPackageOrg = createPackageOrg; +exports.updateItem = updateItem; +exports.deleteItem = deleteItem; diff --git a/server/properties.js b/server/properties.js deleted file mode 100644 index 4ba4d700..00000000 --- a/server/properties.js +++ /dev/null @@ -1,86 +0,0 @@ -var db = require('./pghelper'); - -function findAll(req, res, next) { - - var brokerId = req.query.brokerId, - promise; - - if (brokerId) { - promise = db.query("SELECT pb.property_id, p.address, p.city, p.bedrooms, p.bathrooms, p.price, p.location, p.pic FROM property_broker as pb " + - "INNER JOIN property AS p on pb.property_id = p.property_id " + - "INNER JOIN broker AS b on pb.broker_id = b.broker_id " + - "WHERE pb.broker_id = $1 ORDER BY p.address", [brokerId]); - } else { - var sort = req.query.sort || "price"; - var name = req.query.name; - var params = []; - var whereClause = ""; - if (name) { - whereClause = "WHERE address || city ~* $1"; - params.push(name); - } - promise = db.query("SELECT property_id, address, city, bedrooms, bathrooms, price, location, pic FROM property " + whereClause + " ORDER BY " + sort, params); - } - promise.then(function (properties) { - return res.send(JSON.stringify(properties)); - }) - .catch(next); - -}; - - -function findById(req, res, next) { - var id = req.params.id; - - var sql = "SELECT property_id, address, city, zip, pic, state, teaser, description, size, bedrooms, bathrooms, price, location FROM property WHERE property_id = $1"; - - db.query(sql, [id]) - .then(function (property) { - return res.json(property[0]); - }) - .catch(next); -}; - -function createItem(req, res, next) { - var property = req.body; - db.query('INSERT INTO property (address, city, state, zip, teaser, description, size, bedrooms, bathrooms, price) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)', - [property.address, property.city, property.state, property.zip, property.teaser, property.description, property.size, property.bedrooms, property.bathrooms, property.price], true) - .then(function () { - return res.send({result: 'ok'}); - }) - .fail(function(err) { - return next(err); - }); - -}; - -function updateItem(req, res, next) { - var property = req.body; - db.query('UPDATE property SET address=$1, city=$2, state=$3, zip=$4, pic=$5, teaser=$6, description=$7, size=$8, bedrooms=$9, bathrooms=$10, price=$11, location=POINT($12, $13) WHERE property_id=$14', - [property.address, property.city, property.state, property.zip, property.pic, property.teaser, property.description, property.size, property.bedrooms, property.bathrooms, property.price, property.location.x, property.location.y, property.property_id], true) - .then(function () { - return res.send({result: 'ok'}); - }) - .fail(function(err) { - return next(err); - }); - -}; - -function deleteItem(req, res, next) { - var propertyId = req.params.id; - db.query('DELETE FROM property WHERE property_id=$1', [propertyId], true) - .then(function () { - return res.send({result: 'ok'}); - }) - .fail(function(err) { - return next(err); - }); - -}; - -exports.findAll = findAll; -exports.findById = findById; -exports.createItem = createItem; -exports.updateItem = updateItem; -exports.deleteItem = deleteItem; \ No newline at end of file diff --git a/www/build/js/app.bundle.js b/www/build/js/app.bundle.js index ab7a8cc3..e8831987 100644 --- a/www/build/js/app.bundle.js +++ b/www/build/js/app.bundle.js @@ -92,53 +92,21 @@ var _PackageView2 = _interopRequireDefault(_PackageView); - var _PropertyHome = __webpack_require__(352); + var _PackageOrgHome = __webpack_require__(352); - var _PropertyHome2 = _interopRequireDefault(_PropertyHome); + var _PackageOrgHome2 = _interopRequireDefault(_PackageOrgHome); - var _PropertyRecord = __webpack_require__(360); + var _PackageOrgRecord = __webpack_require__(357); - var _PropertyRecord2 = _interopRequireDefault(_PropertyRecord); + var _PackageOrgRecord2 = _interopRequireDefault(_PackageOrgRecord); - var _PropertyForm = __webpack_require__(361); + var _PackageOrgForm = __webpack_require__(358); - var _PropertyForm2 = _interopRequireDefault(_PropertyForm); + var _PackageOrgForm2 = _interopRequireDefault(_PackageOrgForm); - var _PropertyView = __webpack_require__(362); + var _PackageOrgView = __webpack_require__(363); - var _PropertyView2 = _interopRequireDefault(_PropertyView); - - var _ContactHome = __webpack_require__(418); - - var _ContactHome2 = _interopRequireDefault(_ContactHome); - - var _ContactRecord = __webpack_require__(421); - - var _ContactRecord2 = _interopRequireDefault(_ContactRecord); - - var _ContactForm = __webpack_require__(422); - - var _ContactForm2 = _interopRequireDefault(_ContactForm); - - var _ContactView = __webpack_require__(423); - - var _ContactView2 = _interopRequireDefault(_ContactView); - - var _BrokerHome = __webpack_require__(424); - - var _BrokerHome2 = _interopRequireDefault(_BrokerHome); - - var _BrokerRecord = __webpack_require__(427); - - var _BrokerRecord2 = _interopRequireDefault(_BrokerRecord); - - var _BrokerForm = __webpack_require__(428); - - var _BrokerForm2 = _interopRequireDefault(_BrokerForm); - - var _BrokerView = __webpack_require__(429); - - var _BrokerView2 = _interopRequireDefault(_BrokerView); + var _PackageOrgView2 = _interopRequireDefault(_PackageOrgView); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -184,6 +152,16 @@ _react2.default.createElement(_Icons.Icon, { name: 'thanks', theme: null }), 'Packages' ) + ), + _react2.default.createElement( + 'li', + { className: 'slds-list__item' }, + _react2.default.createElement( + _reactRouter.Link, + { to: '/packageorgs' }, + _react2.default.createElement(_Icons.Icon, { name: 'people', theme: null }), + 'Package Orgs' + ) ) ) ), @@ -216,26 +194,12 @@ { path: 'package', component: _PackageRecord2.default }, _react2.default.createElement(_reactRouter.Route, { path: ':packageId', component: _PackageView2.default }) ), - _react2.default.createElement(_reactRouter.Route, { path: 'properties', component: _PropertyHome2.default }), - _react2.default.createElement( - _reactRouter.Route, - { path: 'property', component: _PropertyRecord2.default }, - _react2.default.createElement(_reactRouter.Route, { path: ':propertyId', component: _PropertyView2.default }), - _react2.default.createElement(_reactRouter.Route, { path: ':propertyId/edit', component: _PropertyForm2.default }) - ), - _react2.default.createElement(_reactRouter.Route, { path: 'contacts', component: _ContactHome2.default }), + _react2.default.createElement(_reactRouter.Route, { path: 'packageorgs', component: _PackageOrgHome2.default }), _react2.default.createElement( _reactRouter.Route, - { path: 'contact', component: _ContactRecord2.default }, - _react2.default.createElement(_reactRouter.Route, { path: ':contactId', component: _ContactView2.default }), - _react2.default.createElement(_reactRouter.Route, { path: ':contactId/edit', component: _ContactForm2.default }) - ), - _react2.default.createElement(_reactRouter.Route, { path: 'brokers', component: _BrokerHome2.default }), - _react2.default.createElement( - _reactRouter.Route, - { path: 'broker', component: _BrokerRecord2.default }, - _react2.default.createElement(_reactRouter.Route, { path: ':brokerId', component: _BrokerView2.default }), - _react2.default.createElement(_reactRouter.Route, { path: ':brokerId/edit', component: _BrokerForm2.default }) + { path: 'packageorg', component: _PackageOrgRecord2.default }, + _react2.default.createElement(_reactRouter.Route, { path: ':orgId', component: _PackageOrgView2.default }), + _react2.default.createElement(_reactRouter.Route, { path: ':orgId/edit', component: _PackageOrgForm2.default }) ), _react2.default.createElement(_reactRouter.IndexRoute, { component: _OrgHome2.default }) ) @@ -42721,7 +42685,8 @@ _react2.default.createElement( 'div', { className: 'slds-col--padded slds-size--1-of-1' }, - _react2.default.createElement(_PackageVersionCard2.default, { packageId: this.props.pkg.id, packageVersions: this.state.packageVersions }) + _react2.default.createElement('br', null), + _react2.default.createElement(_PackageVersionCard2.default, { packageVersions: this.state.packageVersions }) ) ) ) @@ -42733,7 +42698,7 @@ /* 350 */ /***/ (function(module, exports, __webpack_require__) { - 'use strict'; + "use strict"; Object.defineProperty(exports, "__esModule", { value: true @@ -42743,22 +42708,16 @@ var _react2 = _interopRequireDefault(_react); - var _PackageVersionService = __webpack_require__(351); - - var packageVersionService = _interopRequireWildcard(_PackageVersionService); - var _DataGrid = __webpack_require__(214); var _DataGrid2 = _interopRequireDefault(_DataGrid); var _Icons = __webpack_require__(206); - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = _react2.default.createClass({ - displayName: 'PackageVersionCard', + displayName: "PackageVersionCard", getInitialState: function getInitialState() { return { packageVersions: [] }; }, @@ -42767,68 +42726,68 @@ }, render: function render() { return _react2.default.createElement( - 'div', - { className: 'slds-card' }, + "div", + { className: "slds-card" }, _react2.default.createElement( - 'header', - { className: 'slds-card__header slds-grid' }, + "header", + { className: "slds-card__header slds-grid" }, _react2.default.createElement( - 'div', - { className: 'slds-media slds-media--center slds-has-flexi-truncate' }, + "div", + { className: "slds-media slds-media--center slds-has-flexi-truncate" }, _react2.default.createElement( - 'div', - { className: 'slds-media__figure' }, - _react2.default.createElement(_Icons.Icon, { name: 'groups', size: 'small' }) + "div", + { className: "slds-media__figure" }, + _react2.default.createElement(_Icons.Icon, { name: "groups", size: "small" }) ), _react2.default.createElement( - 'div', - { className: 'slds-media__body' }, + "div", + { className: "slds-media__body" }, _react2.default.createElement( - 'h3', - { className: 'slds-text-heading--small slds-truncate' }, - 'Package Versions' + "h3", + { className: "slds-text-heading--small slds-truncate" }, + "Package Versions" ) ) ), _react2.default.createElement( - 'div', - { className: 'slds-no-flex' }, + "div", + { className: "slds-no-flex" }, _react2.default.createElement( - 'div', - { className: 'slds-button-group' }, + "div", + { className: "slds-button-group" }, _react2.default.createElement( - 'button', - { className: 'slds-button slds-button--icon-border-filled' }, - _react2.default.createElement(_Icons.ButtonIcon, { name: 'down' }), + "button", + { className: "slds-button slds-button--icon-border-filled" }, + _react2.default.createElement(_Icons.ButtonIcon, { name: "down" }), _react2.default.createElement( - 'span', - { className: 'slds-assistive-text' }, - 'Show More' + "span", + { className: "slds-assistive-text" }, + "Show More" ) ) ) ) ), _react2.default.createElement( - 'section', - { className: 'slds-card__body' }, + "section", + { className: "slds-card__body" }, _react2.default.createElement( _DataGrid2.default, { data: this.props.packageVersions, onSort: this.props.onSort, onAction: this.actionHandler }, - _react2.default.createElement('div', { header: 'Name', field: 'name', sortable: 'true' }), - _react2.default.createElement('div', { header: 'Version ID', field: 'version_id' }), - _react2.default.createElement('div', { header: 'Version Number', sortable: 'true', field: 'version_number' }), - _react2.default.createElement('div', { header: 'Release Date', sortable: 'true', field: 'release_date' }), - _react2.default.createElement('div', { header: 'Status', sortable: 'true', field: 'status' }) + _react2.default.createElement("div", { header: "Name", field: "name", sortable: "true" }), + _react2.default.createElement("div", { header: "Version ID", field: "version_id" }), + _react2.default.createElement("div", { header: "Version Number", sortable: "true", field: "version_number" }), + _react2.default.createElement("div", { header: "Release Date", sortable: "true", field: "release_date" }), + _react2.default.createElement("div", { header: "Status", sortable: "true", field: "status" }) ) ), _react2.default.createElement( - 'footer', - { className: 'slds-card__footer' }, + "footer", + { className: "slds-card__footer" }, _react2.default.createElement( - 'a', - { href: '#' }, - 'View All' + "a", + { href: "#" }, + "View All" ) ) ); @@ -42880,114 +42839,105 @@ var _react2 = _interopRequireDefault(_react); - var _PropertyService = __webpack_require__(353); + var _PackageOrgService = __webpack_require__(353); - var propertyService = _interopRequireWildcard(_PropertyService); + var packageOrgService = _interopRequireWildcard(_PackageOrgService); - var _GoogleMaps = __webpack_require__(210); + var _PageHeader = __webpack_require__(211); - var _GoogleMaps2 = _interopRequireDefault(_GoogleMaps); + var _PackageOrgList = __webpack_require__(354); - var _PageHeader = __webpack_require__(211); + var _PackageOrgList2 = _interopRequireDefault(_PackageOrgList); - var _PropertyList = __webpack_require__(354); + var _AuthorizeWindow = __webpack_require__(355); - var _PropertyList2 = _interopRequireDefault(_PropertyList); + var _AuthorizeWindow2 = _interopRequireDefault(_AuthorizeWindow); - var _NewPropertyWindow = __webpack_require__(355); + var _AuthService = __webpack_require__(356); - var _NewPropertyWindow2 = _interopRequireDefault(_NewPropertyWindow); + var authService = _interopRequireWildcard(_AuthService); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = _react2.default.createClass({ - displayName: 'PropertyHome', + displayName: 'PackageOrgHome', getInitialState: function getInitialState() { - return { view: "grid", sortOrder: "address", properties: [] }; + return { packageorgs: [] }; }, componentDidMount: function componentDidMount() { var _this = this; - propertyService.findAll(this.state.sortOrder).then(function (properties) { - return _this.setState({ properties: properties }); + packageOrgService.findAll().then(function (packageorgs) { + return _this.setState({ packageorgs: packageorgs }); }); }, sortHandler: function sortHandler(sortOrder) { var _this2 = this; - propertyService.findAll(sortOrder).then(function (properties) { - _this2.setState({ sortOrder: sortOrder, properties: properties }); + packageOrgService.findAll(sortOrder).then(function (packageorgs) { + _this2.setState({ sortOrder: sortOrder, packageorgs: packageorgs }); }); }, - deleteHandler: function deleteHandler(data) { + newHandler: function newHandler() { var _this3 = this; - propertyService.deleteItem(data.property_id).then(function () { - propertyService.findAll(_this3.state.sort).then(function (properties) { - return _this3.setState({ properties: properties }); + authService.oauthOrgURL().then(function (url) { + return _this3.setState({ addingPackageOrg: true, url: url }); + }); + }, + deleteHandler: function deleteHandler(data) { + var _this4 = this; + + packageOrgService.deleteItem(data.id).then(function () { + packageOrgService.findAll(_this4.state.sort).then(function (packageorgs) { + return _this4.setState({ packageorgs: packageorgs }); }); }); }, editHandler: function editHandler(data) { - window.location.hash = "#property/" + data.property_id + "/edit"; - }, - viewChangeHandler: function viewChangeHandler(value) { - this.setState({ view: value }); - }, - newHandler: function newHandler() { - this.setState({ addingProperty: true }); + window.location.hash = "#packageorg/" + data.id + "/edit"; }, - saveHandler: function saveHandler(property) { - var _this4 = this; + saveHandler: function saveHandler(packageorg) { + var _this5 = this; - propertyService.createItem(property).then(function () { - propertyService.findAll(_this4.state.sort).then(function (properties) { - return _this4.setState({ addingProperty: false, properties: properties }); + packageOrgService.createItem(packageorg).then(function () { + packageOrgService.findAll().then(function (packageorgs) { + return _this5.setState({ addingPackageOrg: false, packageorgs: packageorgs }); }); }); }, cancelHandler: function cancelHandler() { - this.setState({ addingProperty: false }); + this.setState({ addingPackageOrg: false }); + }, + viewChangeHandler: function viewChangeHandler(value) { + this.setState({ view: value }); }, render: function render() { - var view = void 0; - if (this.state.view === "map") { - view = _react2.default.createElement(_GoogleMaps2.default, { data: this.state.properties }); - } else if (this.state.view === "split") { - view = _react2.default.createElement( - 'div', - { className: 'slds-grid slds-wrap' }, - _react2.default.createElement( - 'div', - { className: 'slds-col slds-size--1-of-1 slds-large-size--2-of-3' }, - _react2.default.createElement(_PropertyList2.default, { properties: this.state.properties, onSortChange: this.sortChangeHandler, onDelete: this.deleteHandler, onEdit: this.editHandler }) - ), - _react2.default.createElement( - 'div', - { className: 'slds-col--padded slds-size--1-of-1 slds-large-size--1-of-3' }, - _react2.default.createElement(_GoogleMaps2.default, { data: this.state.properties }) - ) - ); - } else { - view = _react2.default.createElement(_PropertyList2.default, { properties: this.state.properties, onSort: this.sortHandler, onDelete: this.deleteHandler, onEdit: this.editHandler }); - } return _react2.default.createElement( 'div', null, - _react2.default.createElement(_PageHeader.HomeHeader, { type: 'properties', - title: 'My Properties', - newLabel: 'New Property', - actions: [{ value: "new", label: "New Property" }], - itemCount: this.state.properties.length, - viewOptions: [{ value: "table", label: "Table", icon: "table" }, { value: "map", label: "Map", icon: "location" }, { value: "split", label: "Split", icon: "layout" }], - sortOptions: [{ value: "address", label: "Address" }, { value: "city", label: "City" }, { value: "price", label: "Price" }], + _react2.default.createElement(_PageHeader.HomeHeader, { type: 'package orgs', + title: 'Package Orgs', + newLabel: 'Add Package Org', + actions: [{ value: "new", label: "Add Package Org" }], + itemCount: this.state.packageorgs.length, + viewOptions: [{ value: "table", label: "Table", icon: "table" }, { value: "tiles", label: "Tiles", icon: "location" }], + sortOptions: [{ value: "name", label: "Name" }, { value: "namespace", label: "Namespace" }], onNew: this.newHandler, onSort: this.sortHandler, onViewChange: this.viewChangeHandler }), - view, - this.state.addingProperty ? _react2.default.createElement(_NewPropertyWindow2.default, { onSave: this.saveHandler, onCancel: this.cancelHandler }) : "" + _react2.default.createElement(_PackageOrgList2.default, { packageorgs: this.state.packageorgs, onSort: this.sortHandler, onDelete: this.deleteHandler, onEdit: this.editHandler }), + this.state.addingPackageOrg && _react2.default.createElement( + _AuthorizeWindow2.default, + { url: this.state.url }, + _react2.default.createElement( + 'div', + null, + 'Authorizing' + ) + ) ); } }); @@ -43001,7 +42951,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); - exports.deleteItem = exports.createItem = exports.updateItem = exports.findById = exports.findByBroker = exports.findByName = exports.findAll = undefined; + exports.deleteItem = exports.createItem = exports.updateItem = exports.findByNamespace = exports.findById = exports.findAll = undefined; var _h = __webpack_require__(209); @@ -43009,30 +42959,26 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - var url = "/properties"; + var url = "/packageorgs"; var findAll = exports.findAll = function findAll(sort) { return h.get(url, { sort: sort }); }; - var findByName = exports.findByName = function findByName(name) { - return h.get(url, { name: name }); - }; - - var findByBroker = exports.findByBroker = function findByBroker(brokerId) { - return h.get(url, { brokerId: brokerId }); - }; - var findById = exports.findById = function findById(id) { return h.get(url + "/" + id); }; - var updateItem = exports.updateItem = function updateItem(property) { - return h.put(url, property); + var findByNamespace = exports.findByNamespace = function findByNamespace(namespace) { + return h.get(url, { namespace: namespace }); }; - var createItem = exports.createItem = function createItem(property) { - return h.post(url, property); + var updateItem = exports.updateItem = function updateItem(packageOrg) { + return h.put(url, packageOrg); + }; + + var createItem = exports.createItem = function createItem(packageOrg) { + return h.post(url, packageOrg); }; var deleteItem = exports.deleteItem = function deleteItem(id) { @@ -43060,9 +43006,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = _react2.default.createClass({ - displayName: 'PropertyList', - linkHandler: function linkHandler(property) { - window.location.hash = "#property/" + property.property_id; + displayName: 'PackageOrgList', + linkHandler: function linkHandler(packageorg) { + window.location.hash = "#packageorg/" + packageorg.id; }, actionHandler: function actionHandler(data, value, label) { if (label === "Delete") { @@ -43074,12 +43020,13 @@ render: function render() { return _react2.default.createElement( _DataGrid2.default, - { data: this.props.properties, keyField: 'propertyId', onSort: this.props.onSort, onAction: this.actionHandler }, - _react2.default.createElement('div', { header: 'Address', field: 'address', sortable: true, onLink: this.linkHandler }), - _react2.default.createElement('div', { header: 'City', field: 'city', sortable: true }), - _react2.default.createElement('div', { header: 'Bedrooms', field: 'bedrooms', textAlign: 'center' }), - _react2.default.createElement('div', { header: 'Bathrooms', field: 'bathrooms', textAlign: 'center' }), - _react2.default.createElement('div', { header: 'Price', field: 'price', sortable: true, textAlign: 'right', format: 'currency' }) + { data: this.props.packageorgs, onSort: this.props.onSort, onAction: this.actionHandler }, + _react2.default.createElement('div', { header: 'Name', field: 'name', sortable: 'true', onLink: this.linkHandler }), + _react2.default.createElement('div', { header: 'Namespace', field: 'namespace', sortable: 'true', onLink: this.linkHandler }), + _react2.default.createElement('div', { header: 'Org ID', field: 'org_id' }), + _react2.default.createElement('div', { header: 'Username', field: 'username' }), + _react2.default.createElement('div', { header: 'Instance URL', field: 'instance_url' }), + _react2.default.createElement('div', { header: 'Status', field: 'status' }) ); } }); @@ -43094,218 +43041,323 @@ value: true }); + var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); + var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); - var _reactAddonsLinkedStateMixin = __webpack_require__(356); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var PortalWindow = function (_React$Component) { + _inherits(PortalWindow, _React$Component); + + function PortalWindow(props) { + _classCallCheck(this, PortalWindow); + + // STEP 1: create a container
    + var _this = _possibleConstructorReturn(this, (PortalWindow.__proto__ || Object.getPrototypeOf(PortalWindow)).call(this, props)); + + _this.containerEl = document.createElement('div'); + _this.externalWindow = null; + return _this; + } + + _createClass(PortalWindow, [{ + key: 'render', + value: function render() { + return _react2.default.createElement('div', null); + } + }, { + key: 'componentDidMount', + value: function componentDidMount() { + // STEP 3: open a new browser window and store a reference to it + this.externalWindow = window.open(this.props.url, '', 'width=700,height=700,left=200,top=200'); + + // STEP 4: append the container
    (that has props.children appended to it) to the body of the new window + // this.externalWindow.document.body.appendChild(this.containerEl); + } + }, { + key: 'componentWillUnmount', + value: function componentWillUnmount() { + // STEP 5: This will fire when this.state.showWindowPortal in the parent component becomes false + // So we tidy up by closing the window + this.externalWindow.close(); + } + }]); + + return PortalWindow; + }(_react2.default.Component); + + exports.default = PortalWindow; + +/***/ }), +/* 356 */ +/***/ (function(module, exports, __webpack_require__) { + + "use strict"; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + exports.oauthCallback = exports.oauthOrgURL = exports.oauthLoginURL = undefined; + + var _h = __webpack_require__(209); + + var h = _interopRequireWildcard(_h); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + var baseurl = "/oauth2"; + + exports.oauthLoginURL = oauthLoginURL; + exports.oauthOrgURL = oauthOrgURL; + exports.oauthCallback = oauthCallback; + + var oauthLoginURL = exports.oauthLoginURL = function oauthLoginURL() { + return h.get(baseurl + "/loginurl"); + }; + + var oauthOrgURL = exports.oauthOrgURL = function oauthOrgURL() { + return h.get(baseurl + "/orgurl"); + }; + + var oauthCallback = exports.oauthCallback = function oauthCallback(code) { + return h.get(baseurl + "/callback", { code: code }); + }; + +/***/ }), +/* 357 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _react = __webpack_require__(1); + + var _react2 = _interopRequireDefault(_react); + + var _reactRouter = __webpack_require__(159); + + var _PackageOrgService = __webpack_require__(353); + + var packageOrgService = _interopRequireWildcard(_PackageOrgService); + + var _PageHeader = __webpack_require__(211); + + function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.default = _react2.default.createClass({ + displayName: 'PackageOrgRecord', + getInitialState: function getInitialState() { + return { packageorg: {} }; + }, + componentDidMount: function componentDidMount() { + var _this = this; + + var packageorgId = this.props.params.packageorgId; + packageOrgService.findById(packageorgId).then(function (packageorg) { + return _this.setState({ packageorg: packageorg }); + }); + }, + saveHandler: function saveHandler(packageorg) { + packageOrgService.updateItem(packageorg); + }, + editHandler: function editHandler() { + window.location.hash = '#packageorg/' + this.state.packageorg.id + '/edit'; + }, + deleteHandler: function deleteHandler() { + packageOrgService.deleteItem(this.state.packageorg.id).then(function () { + window.location.hash = '#packageorgs'; + }); + }, + cloneHandler: function cloneHandler() {}, + render: function render() { + return _react2.default.createElement( + 'div', + null, + _react2.default.createElement( + _PageHeader.RecordHeader, + { type: 'Package Org', icon: 'people', title: this.state.packageorg.name, + onEdit: this.editHandler, + onDelete: this.deleteHandler }, + _react2.default.createElement(_PageHeader.HeaderField, { label: 'Namespace', value: this.state.packageorg.namespace }), + _react2.default.createElement(_PageHeader.HeaderField, { label: 'Status', value: this.state.packageorg.status }) + ), + _react2.default.cloneElement(this.props.children, { packageorg: this.state.packageorg, saveHandler: this.saveHandler }) + ); + } + }); + +/***/ }), +/* 358 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + Object.defineProperty(exports, "__esModule", { + value: true + }); + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + var _react = __webpack_require__(1); + + var _react2 = _interopRequireDefault(_react); + + var _reactAddonsLinkedStateMixin = __webpack_require__(359); var _reactAddonsLinkedStateMixin2 = _interopRequireDefault(_reactAddonsLinkedStateMixin); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = _react2.default.createClass({ - displayName: 'NewPropertyWindow', + displayName: 'PackageOrgForm', mixins: [_reactAddonsLinkedStateMixin2.default], getInitialState: function getInitialState() { - return {}; + var packageorg = this.props.packageorg; + return _extends({}, packageorg); }, - onSave: function onSave() { - this.props.onSave(this.state); + componentWillReceiveProps: function componentWillReceiveProps(props) { + var packageorg = props.packageorg; + this.setState(_extends({}, packageorg)); + }, + save: function save() { + this.props.saveHandler(this.state); }, render: function render() { return _react2.default.createElement( 'div', - null, + { className: 'slds-form--stacked slds-grid slds-wrap slds-m-top--large' }, _react2.default.createElement( 'div', - { 'aria-hidden': 'false', role: 'dialog', className: 'slds-modal slds-fade-in-open' }, + { className: 'slds-col--padded slds-size--1-of-1 slds-medium-size--1-of-2' }, + _react2.default.createElement( + 'div', + { className: 'slds-form-element' }, + _react2.default.createElement( + 'label', + { className: 'slds-form-element__label', htmlFor: 'name' }, + 'Name' + ), + _react2.default.createElement( + 'div', + { className: 'slds-form-element__control' }, + _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('name') }) + ) + ), _react2.default.createElement( 'div', - { className: 'slds-modal__container' }, + { className: 'slds-form--stacked' }, _react2.default.createElement( 'div', - { className: 'slds-modal__header' }, + { className: 'slds-form-element' }, _react2.default.createElement( - 'h2', - { className: 'slds-text-heading--medium' }, - 'New Property' + 'label', + { className: 'slds-form-element__label', htmlFor: 'name' }, + 'Name' ), _react2.default.createElement( - 'button', - { className: 'slds-button slds-modal__close' }, - _react2.default.createElement('svg', { 'aria-hidden': 'true', className: 'slds-button__icon slds-button__icon--inverse slds-button__icon--large' }), - _react2.default.createElement( - 'span', - { className: 'slds-assistive-text' }, - 'Close' - ) + 'div', + { className: 'slds-form-element__control' }, + _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('name') }) ) ), _react2.default.createElement( 'div', - { className: 'slds-modal__content' }, + { className: 'slds-form-element' }, + _react2.default.createElement( + 'label', + { className: 'slds-form-element__label', htmlFor: 'username' }, + 'Username' + ), _react2.default.createElement( 'div', - { className: 'slds-form--stacked' }, - _react2.default.createElement( - 'fieldset', - { className: 'slds-form--compound slds-m-bottom--medium' }, - _react2.default.createElement( - 'legend', - { className: 'slds-form-element__label' }, - 'Address' - ), - _react2.default.createElement( - 'div', - { className: 'form-element__group' }, - _react2.default.createElement( - 'div', - { className: 'slds-form-element__row' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--1-of-1' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'Street' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('address') }) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element__row' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--2-of-4' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'City' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('city') }) - ), - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--1-of-4' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'State' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('state') }) - ), - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--1-of-4' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'ZIP Code' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('zip') }) - ) - ) - ) - ), - _react2.default.createElement( - 'fieldset', - { className: 'slds-form--compound slds-m-bottom--medium' }, - _react2.default.createElement( - 'legend', - { className: 'slds-form-element__label' }, - 'Size' - ), - _react2.default.createElement( - 'div', - { className: 'form-element__group' }, - _react2.default.createElement( - 'div', - { className: 'slds-form-element__row' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--1-of-3' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'Sqft' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('size') }) - ), - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--1-of-3' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'Bedrooms' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('bedrooms') }) - ), - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--1-of-3' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'Bathrooms' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('bathrooms') }) - ) - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__label', htmlFor: 'sample1' }, - 'Asking Price' - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element__control' }, - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('price') }) - ) - ) + { className: 'slds-form-element__control' }, + _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('username') }) + ) + ), + _react2.default.createElement( + 'div', + { className: 'slds-form-element' }, + _react2.default.createElement( + 'label', + { className: 'slds-form-element__label', htmlFor: 'org_id' }, + 'Org ID' + ), + _react2.default.createElement( + 'div', + { className: 'slds-form-element__control' }, + _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('org_id') }) + ) + ), + _react2.default.createElement( + 'div', + { className: 'slds-form-element' }, + _react2.default.createElement( + 'label', + { className: 'slds-form-element__label', htmlFor: 'namespace' }, + 'Namespace' + ), + _react2.default.createElement( + 'div', + { className: 'slds-form-element__control' }, + _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('namespace') }) ) ), _react2.default.createElement( 'div', - { className: 'slds-modal__footer' }, + { className: 'slds-form-element' }, _react2.default.createElement( - 'button', - { className: 'slds-button slds-button--neutral', onClick: this.props.onCancel }, - 'Cancel' + 'label', + { className: 'slds-form-element__label', htmlFor: 'instance_url' }, + 'Instance URL' ), _react2.default.createElement( - 'button', - { className: 'slds-button slds-button--neutral slds-button--brand', onClick: this.onSave }, - 'Save' + 'div', + { className: 'slds-form-element__control' }, + _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('instance_url') }) ) ) + ), + _react2.default.createElement( + 'div', + { className: 'slds-col--padded slds-m-top--medium slds-size--1-of-1' }, + _react2.default.createElement( + 'button', + { className: 'slds-button slds-button--brand', onClick: this.save }, + 'Save' + ) ) - ), - _react2.default.createElement('div', { className: 'slds-modal-backdrop slds-modal-backdrop--open' }) + ) ); } }); /***/ }), -/* 356 */ +/* 359 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; - module.exports = __webpack_require__(357); + module.exports = __webpack_require__(360); /***/ }), -/* 357 */ +/* 360 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43322,8 +43374,8 @@ 'use strict'; - var ReactLink = __webpack_require__(358); - var ReactStateSetters = __webpack_require__(359); + var ReactLink = __webpack_require__(361); + var ReactStateSetters = __webpack_require__(362); /** * A simple mixin around ReactLink.forState(). @@ -43346,7 +43398,7 @@ module.exports = LinkedStateMixin; /***/ }), -/* 358 */ +/* 361 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -43420,7 +43472,7 @@ module.exports = ReactLink; /***/ }), -/* 359 */ +/* 362 */ /***/ (function(module, exports) { /** @@ -43529,79 +43581,7 @@ module.exports = ReactStateSetters; /***/ }), -/* 360 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - var _reactRouter = __webpack_require__(159); - - var _PropertyService = __webpack_require__(353); - - var propertyService = _interopRequireWildcard(_PropertyService); - - var _PageHeader = __webpack_require__(211); - - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _react2.default.createClass({ - displayName: 'PropertyRecord', - getInitialState: function getInitialState() { - return { property: {} }; - }, - componentDidMount: function componentDidMount() { - var _this = this; - - propertyService.findById(this.props.params.propertyId).then(function (property) { - return _this.setState({ property: property }); - }); - }, - saveHandler: function saveHandler(property) { - propertyService.updateItem(property).then(function () { - console.log('property saved'); - }); - }, - editHandler: function editHandler() { - window.location.hash = '#property/' + this.state.property.property_id + '/edit'; - }, - deleteHandler: function deleteHandler() { - propertyService.deleteItem(this.state.property.property_id).then(function () { - window.location.hash = '#'; - }); - }, - render: function render() { - // - return _react2.default.createElement( - 'div', - null, - _react2.default.createElement( - _PageHeader.RecordHeader, - { type: 'Property', icon: 'account', title: this.state.property.address, - onEdit: this.editHandler, - onDelete: this.deleteHandler, - onClone: this.cloneHandler }, - _react2.default.createElement(_PageHeader.HeaderField, { label: 'City', value: this.state.property.city }), - _react2.default.createElement(_PageHeader.HeaderField, { label: 'Type', value: 'Single Family' }), - _react2.default.createElement(_PageHeader.HeaderField, { label: 'Date Listed', value: 'Aug 1st 2015' }), - _react2.default.createElement(_PageHeader.HeaderField, { label: 'Asking Price', value: this.state.property.price, format: 'currency' }) - ), - _react2.default.cloneElement(this.props.children, { property: this.state.property, saveHandler: this.saveHandler }) - ); - } - }); - -/***/ }), -/* 361 */ +/* 363 */ /***/ (function(module, exports, __webpack_require__) { 'use strict'; @@ -43610,462 +43590,56 @@ value: true }); - var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; - var _react = __webpack_require__(1); var _react2 = _interopRequireDefault(_react); - var _reactAddonsLinkedStateMixin = __webpack_require__(356); - - var _reactAddonsLinkedStateMixin2 = _interopRequireDefault(_reactAddonsLinkedStateMixin); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _react2.default.createClass({ - displayName: 'PropertyForm', - - - mixins: [_reactAddonsLinkedStateMixin2.default], - - getInitialState: function getInitialState() { - var property = this.props.property; - return _extends({}, property); - }, - componentWillReceiveProps: function componentWillReceiveProps(props) { - var property = props.property; - this.setState(_extends({}, property)); - }, - latitudeChange: function latitudeChange(event) { - this.setState({ location: { x: parseFloat(event.target.value), y: this.state.location.y } }); - }, - longitudeChange: function longitudeChange(event) { - this.setState({ location: { x: this.state.location.x, y: parseFloat(event.target.value) } }); - }, - save: function save() { - this.props.saveHandler(this.state); - }, - render: function render() { - return _react2.default.createElement( - 'div', - { className: 'slds-form--stacked slds-grid slds-wrap slds-m-top--large' }, - _react2.default.createElement( - 'div', - { className: 'slds-col--padded slds-size--1-of-1 slds-medium-size--1-of-2' }, - _react2.default.createElement( - 'fieldset', - { className: 'slds-form--compound slds-m-bottom--medium' }, - _react2.default.createElement( - 'legend', - { className: 'slds-form-element__label' }, - 'Address' - ), - _react2.default.createElement( - 'div', - { className: 'form-element__group' }, - _react2.default.createElement( - 'div', - { className: 'slds-form-element__row' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--1-of-1' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'Street' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('address') }) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element__row' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--2-of-4' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'City' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('city') }) - ), - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--1-of-4' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'State' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('state') }) - ), - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--1-of-4' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'ZIP Code' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('zip') }) - ) - ) - ) - ), - _react2.default.createElement( - 'fieldset', - { className: 'slds-form--compound slds-m-bottom--small' }, - _react2.default.createElement( - 'legend', - { className: 'slds-form-element__label' }, - 'Location' - ), - _react2.default.createElement( - 'div', - { className: 'form-element__group' }, - _react2.default.createElement( - 'div', - { className: 'slds-form-element__row' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--1-of-2' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'Latitude' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', value: this.state.location ? this.state.location.x : "", onChange: this.latitudeChange }) - ), - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--1-of-2' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'Longitude' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', value: this.state.location ? this.state.location.y : "", onChange: this.longitudeChange }) - ) - ) - ) - ), - _react2.default.createElement( - 'fieldset', - { className: 'slds-form--compound slds-m-bottom--small' }, - _react2.default.createElement( - 'legend', - { className: 'slds-form-element__label' }, - 'Size' - ), - _react2.default.createElement( - 'div', - { className: 'form-element__group' }, - _react2.default.createElement( - 'div', - { className: 'slds-form-element__row' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--1-of-3' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'Sqft' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('size') }) - ), - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--1-of-3' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'Bedrooms' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('bedrooms') }) - ), - _react2.default.createElement( - 'label', - { className: 'slds-form-element__control slds-size--1-of-3' }, - _react2.default.createElement( - 'small', - { className: 'slds-form-element__helper' }, - 'Bathrooms' - ), - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('bathrooms') }) - ) - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__label', htmlFor: 'sample1' }, - 'Asking Price' - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element__control' }, - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('price') }) - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-col--padded slds-size--1-of-1 slds-medium-size--1-of-2' }, - _react2.default.createElement( - 'div', - { className: 'slds-form-element' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__label', htmlFor: 'sample1' }, - 'Teaser' - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element__control' }, - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('teaser') }) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__label', htmlFor: 'sample2' }, - 'Description' - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element__control' }, - _react2.default.createElement('textarea', { id: 'description', rows: '6', className: 'slds-textarea', valueLink: this.linkState('description') }) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__label', htmlFor: 'sample1' }, - 'Picture URL' - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element__control' }, - _react2.default.createElement('input', { className: 'slds-input', type: 'text', valueLink: this.linkState('pic') }) - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-col--padded slds-m-top--medium slds-size--1-of-1' }, - _react2.default.createElement( - 'button', - { className: 'slds-button slds-button--brand', onClick: this.save }, - 'Save' - ) - ) - ); - } - }); - -/***/ }), -/* 362 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(1); + var _moment = __webpack_require__(215); - var _react2 = _interopRequireDefault(_react); + var _moment2 = _interopRequireDefault(_moment); - var _ActivityService = __webpack_require__(363); + var _PackageVersionService = __webpack_require__(351); - var activityService = _interopRequireWildcard(_ActivityService); + var packageVersionService = _interopRequireWildcard(_PackageVersionService); var _Tabs = __webpack_require__(339); var _Tabs2 = _interopRequireDefault(_Tabs); - var _GoogleMaps = __webpack_require__(210); - - var _GoogleMaps2 = _interopRequireDefault(_GoogleMaps); - - var _FileDropArea = __webpack_require__(364); - - var _FileDropArea2 = _interopRequireDefault(_FileDropArea); - - var _ActivityTimeline = __webpack_require__(365); - - var _ActivityTimeline2 = _interopRequireDefault(_ActivityTimeline); - - var _BrokerCard = __webpack_require__(366); - - var _BrokerCard2 = _interopRequireDefault(_BrokerCard); - - var _ActivityCard = __webpack_require__(368); - - var _ActivityCard2 = _interopRequireDefault(_ActivityCard); - - var _NewActivityWindow = __webpack_require__(369); + var _PackageVersionCard = __webpack_require__(350); - var _NewActivityWindow2 = _interopRequireDefault(_NewActivityWindow); + var _PackageVersionCard2 = _interopRequireDefault(_PackageVersionCard); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = _react2.default.createClass({ - displayName: 'PropertyView', + displayName: 'PackageOrgView', getInitialState: function getInitialState() { - return { activities: [] }; + return { properties: [] }; }, componentWillReceiveProps: function componentWillReceiveProps(props) { - this.loadActivities(props.property.property_id); - }, - loadActivities: function loadActivities(propertyId) { var _this = this; - activityService.findByProperty(propertyId).then(function (activities) { - return _this.setState({ activities: activities }); - }); - }, - newActivityHandler: function newActivityHandler() { - this.setState({ addingActivity: true }); - }, - deleteActivityHandler: function deleteActivityHandler(activity) { - var _this2 = this; - - activityService.deleteItem(activity.activity_id).then(function () { - return _this2.loadActivities(_this2.props.property.property_id); - }); - }, - cancelActivityHandler: function cancelActivityHandler() { - this.setState({ addingActivity: false }); - }, - saveActivityHandler: function saveActivityHandler(activity) { - var _this3 = this; - - activityService.createItem(activity).then(function () { - _this3.loadActivities(_this3.props.property.property_id); - _this3.setState({ addingActivity: false }); + packageVersionService.findByDevOrgId(props.packageorg.org_id).then(function (packageversions) { + return _this.setState({ packageversions: packageversions }); }); }, render: function render() { - var title = { - fontSize: "24px", - fontWeight: "300", - padding: "12px 0 6px 0" - }; - return _react2.default.createElement( 'div', { className: 'slds-form--stacked slds-grid slds-wrap slds-m-top' }, _react2.default.createElement( 'div', - { className: 'slds-col--padded slds-size--1-of-1 slds-medium-size--1-of-2' }, + { className: 'slds-col--padded slds-size--1-of-1' }, _react2.default.createElement( 'div', { className: 'slds-grid slds-wrap slds-m-top--large' }, _react2.default.createElement( 'div', - { className: 'slds-col--padded slds-size--1-of-1' }, - _react2.default.createElement('img', { src: this.props.property.pic }), - _react2.default.createElement( - 'h1', - { style: title }, - this.props.property.teaser - ), - this.props.property.description - ), - _react2.default.createElement( - 'div', - { className: 'slds-col--padded slds-size--1-of-2 slds-medium-size--1-of-3 slds-m-top--medium' }, - _react2.default.createElement( - 'dl', - { className: 'page-header--rec-home__detail-item' }, - _react2.default.createElement( - 'dt', - null, - _react2.default.createElement( - 'p', - { className: 'slds-text-heading--label slds-truncate', title: 'Field 1' }, - 'Sqft' - ) - ), - _react2.default.createElement( - 'dd', - null, - _react2.default.createElement( - 'p', - { className: 'slds-text-body--regular slds-truncate', title: '' }, - this.props.property.size - ) - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-col--padded slds-size--1-of-2 slds-medium-size--1-of-3 slds-m-top--medium' }, - _react2.default.createElement( - 'dl', - { className: 'page-header--rec-home__detail-item' }, - _react2.default.createElement( - 'dt', - null, - _react2.default.createElement( - 'p', - { className: 'slds-text-heading--label slds-truncate', title: 'Field 1' }, - 'Bedrooms' - ) - ), - _react2.default.createElement( - 'dd', - null, - _react2.default.createElement( - 'p', - { className: 'slds-text-body--regular slds-truncate', title: '' }, - this.props.property.bedrooms - ) - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-col--padded slds-size--1-of-2 slds-medium-size--1-of-3 slds-m-top--medium' }, - _react2.default.createElement( - 'dl', - { className: 'page-header--rec-home__detail-item' }, - _react2.default.createElement( - 'dt', - null, - _react2.default.createElement( - 'p', - { className: 'slds-text-heading--label slds-truncate', title: 'Field 1' }, - 'Bathrooms' - ) - ), - _react2.default.createElement( - 'dd', - null, - _react2.default.createElement( - 'p', - { className: 'slds-text-body--regular slds-truncate', title: '' }, - this.props.property.bathrooms - ) - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-col--padded slds-size--1-of-2 slds-medium-size--1-of-3 slds-m-top--medium' }, + { className: 'slds-col--padded slds-size--1-of-3 slds-m-top--medium' }, _react2.default.createElement( 'dl', { className: 'page-header--rec-home__detail-item' }, @@ -44074,8 +43648,8 @@ null, _react2.default.createElement( 'p', - { className: 'slds-text-heading--label slds-truncate', title: 'Field 1' }, - 'Garage' + { className: 'slds-text-heading--label slds-truncate', title: 'Org ID' }, + 'Org ID' ) ), _react2.default.createElement( @@ -44084,14 +43658,14 @@ _react2.default.createElement( 'p', { className: 'slds-text-body--regular slds-truncate', title: '' }, - '2 cars' + this.props.packageorg.org_id ) ) ) ), _react2.default.createElement( 'div', - { className: 'slds-col--padded slds-size--1-of-2 slds-medium-size--1-of-3 slds-m-top--medium' }, + { className: 'slds-col--padded slds-size--1-of-3 slds-m-top--medium' }, _react2.default.createElement( 'dl', { className: 'page-header--rec-home__detail-item' }, @@ -44100,8 +43674,8 @@ null, _react2.default.createElement( 'p', - { className: 'slds-text-heading--label slds-truncate', title: 'Field 1' }, - 'Finished Basement ' + { className: 'slds-text-heading--label slds-truncate', title: 'Username' }, + 'Username' ) ), _react2.default.createElement( @@ -44110,14 +43684,14 @@ _react2.default.createElement( 'p', { className: 'slds-text-body--regular slds-truncate', title: '' }, - 'Yes' + this.props.packageorg.username ) ) ) ), _react2.default.createElement( 'div', - { className: 'slds-col--padded slds-size--1-of-2 slds-medium-size--1-of-3 slds-m-top--medium' }, + { className: 'slds-col--padded slds-size--1-of-3 slds-m-top--medium' }, _react2.default.createElement( 'dl', { className: 'page-header--rec-home__detail-item' }, @@ -44126,8 +43700,8 @@ null, _react2.default.createElement( 'p', - { className: 'slds-text-heading--label slds-truncate', title: 'Field 1' }, - 'Heating' + { className: 'slds-text-heading--label slds-truncate', title: 'Instance URL' }, + 'Instance URL' ) ), _react2.default.createElement( @@ -44136,34 +43710,10 @@ _react2.default.createElement( 'p', { className: 'slds-text-body--regular slds-truncate', title: '' }, - 'Gas' + this.props.packageorg.instance_url ) ) ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-col--padded slds-size--1-of-1' }, - _react2.default.createElement('br', null), - _react2.default.createElement(_GoogleMaps2.default, { data: this.props.property, height: '250px' }) - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-col--padded slds-size--1-of-1 slds-medium-size--1-of-2' }, - _react2.default.createElement( - _Tabs2.default, - null, - _react2.default.createElement( - 'div', - { label: 'Activities' }, - _react2.default.createElement(_ActivityTimeline2.default, { propertyId: this.props.property.property_id, activities: this.state.activities, showContact: true, showProperty: false }) - ), - _react2.default.createElement( - 'div', - { label: 'Gallery' }, - _react2.default.createElement(_FileDropArea2.default, null) ) ) ), @@ -44171,10126 +43721,7 @@ 'div', { className: 'slds-col--padded slds-size--1-of-1' }, _react2.default.createElement('br', null), - _react2.default.createElement(_ActivityCard2.default, { propertyId: this.props.property.property_id, activities: this.state.activities, showContact: true, showProperty: false, - onNew: this.newActivityHandler, - onDelete: this.deleteActivityHandler }), - _react2.default.createElement(_BrokerCard2.default, { propertyId: this.props.property.property_id }) - ), - this.state.addingActivity ? _react2.default.createElement(_NewActivityWindow2.default, { onSave: this.saveActivityHandler, onCancel: this.cancelActivityHandler, propertyId: this.props.property.property_id, price: this.props.property.price }) : "" - ); - } - }); - -/***/ }), -/* 363 */ -/***/ (function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.deleteItem = exports.createItem = exports.updateItem = exports.findById = exports.findByContact = exports.findByProperty = exports.findByName = exports.findAll = undefined; - - var _h = __webpack_require__(209); - - var h = _interopRequireWildcard(_h); - - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - var url = "/activities"; - - var findAll = exports.findAll = function findAll(sort) { - return h.get(url, { sort: sort }); - }; - - var findByName = exports.findByName = function findByName(name) { - return h.get(url, { name: name }); - }; - - var findByProperty = exports.findByProperty = function findByProperty(propertyId) { - return h.get(url, { propertyId: propertyId }); - }; - - var findByContact = exports.findByContact = function findByContact(contactId) { - return h.get(url, { contactId: contactId }); - }; - - var findById = exports.findById = function findById(id) { - return h.get(url + "/" + id); - }; - - var updateItem = exports.updateItem = function updateItem(property) { - return h.put(url, property); - }; - - var createItem = exports.createItem = function createItem(property) { - return h.post(url, property); - }; - - var deleteItem = exports.deleteItem = function deleteItem(id) { - return h.del(url + "/" + id); - }; - -/***/ }), -/* 364 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _react2.default.createClass({ - displayName: 'FileDropArea', - getInitialState: function getInitialState() { - return { pictures: [] }; - }, - dragOverHandler: function dragOverHandler(event) { - event.preventDefault(); - }, - dropHandler: function dropHandler(event) { - var _this = this; - - event.stopPropagation(); - event.preventDefault(); - event.dataTransfer.dropEffect = 'copy'; - var files = event.dataTransfer.files; - - var _loop = function _loop(i) { - var reader = new FileReader(); - reader.onloadend = function () { - var pictures = _this.state.pictures; - pictures.push(reader.result); - _this.setState({ pictures: pictures }); - }; - reader.readAsDataURL(files[i]); - }; - - for (var i = 0; i < files.length; i++) { - _loop(i); - } - }, - render: function render() { - var imgs = this.state.pictures.map(function (picture) { - return _react2.default.createElement('img', { src: picture, style: { padding: "4px 0" } }); - }); - return _react2.default.createElement( - 'div', - { onDragOver: this.dragOverHandler, onDrop: this.dropHandler, style: { width: "100%", minHeight: "300px" } }, - 'Drag images in this area to add them to the gallery', - imgs - ); - } - }); - -/***/ }), -/* 365 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - var _moment = __webpack_require__(215); - - var _moment2 = _interopRequireDefault(_moment); - - var _ActivityService = __webpack_require__(363); - - var activityService = _interopRequireWildcard(_ActivityService); - - var _Icons = __webpack_require__(206); - - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var getActivityTheme = function getActivityTheme(activityName) { - if (activityName === "Listed") { - return "event"; - } else if (activityName === "Open House") { - return "event"; - } else if (activityName === "Inquiry") { - return "email"; - } else if (activityName === "Offer") { - return "email"; - } else if (activityName === "Price Reduction") { - return "task"; - } - }; - - var ActivityListItem = _react2.default.createClass({ - displayName: 'ActivityListItem', - render: function render() { - return _react2.default.createElement( - 'li', - { className: 'slds-timeline__item' }, - _react2.default.createElement( - 'span', - { className: 'slds-assistive-text' }, - 'Email' - ), - _react2.default.createElement( - 'div', - { className: 'slds-media slds-media--reverse' }, - _react2.default.createElement( - 'div', - { className: 'slds-media__body' }, - _react2.default.createElement( - 'div', - { className: "slds-media slds-media--timeline slds-timeline__media--" + this.props.theme }, - _react2.default.createElement( - 'div', - { className: 'slds-media__figure' }, - _react2.default.createElement(_Icons.Icon, { name: this.props.theme }) - ), - _react2.default.createElement( - 'div', - { className: 'slds-media__body' }, - _react2.default.createElement( - 'div', - { className: 'slds-tile' }, - _react2.default.createElement( - 'p', - { className: 'tile__title slds-truncate' }, - this.props.activity.activity_name - ), - this.props.showContact && this.props.activity.contact_id ? _react2.default.createElement( - 'ul', - { className: 'slds-list--horizontal slds-text-body--medium' }, - _react2.default.createElement( - 'li', - { className: 'slds-list__item' }, - _react2.default.createElement( - 'dl', - { className: 'slds-dl--inline' }, - _react2.default.createElement( - 'dt', - { className: 'slds-dl--inline__label' }, - 'From:' - ), - _react2.default.createElement( - 'dd', - { className: 'slds-dl--inline__detail' }, - _react2.default.createElement( - 'a', - { href: '#contact/' + this.props.activity.contact_id }, - this.props.activity.contact - ) - ) - ) - ) - ) : "", - this.props.showProperty ? _react2.default.createElement( - 'ul', - { className: 'slds-list--horizontal slds-text-body--medium' }, - _react2.default.createElement( - 'li', - { className: 'slds-list__item' }, - _react2.default.createElement( - 'dl', - { className: 'slds-dl--inline' }, - _react2.default.createElement( - 'dt', - { className: 'slds-dl--inline__label' }, - 'Property:' - ), - _react2.default.createElement( - 'dd', - { className: 'slds-dl--inline__detail' }, - _react2.default.createElement( - 'a', - { href: '#property/' + this.props.activity.property_id }, - this.props.activity.address - ) - ) - ) - ) - ) : "", - _react2.default.createElement( - 'p', - { className: 'slds-truncate slds-text-body--small' }, - this.props.activity.comment - ), - _react2.default.createElement( - 'div', - { className: 'tile__detail' }, - _react2.default.createElement( - 'ul', - { className: 'slds-list--horizontal slds-text-body--small' }, - _react2.default.createElement( - 'li', - { className: 'slds-list__item slds-m-right--large' }, - _react2.default.createElement( - 'dl', - { className: 'slds-dl--inline' }, - _react2.default.createElement( - 'dt', - { className: 'slds-dl--inline__label' }, - 'Date:' - ), - _react2.default.createElement( - 'dd', - { className: 'slds-dl--inline__detail' }, - (0, _moment2.default)(this.props.activity.activity_date).format("MMMM Do YYYY") - ) - ) - ), - _react2.default.createElement( - 'li', - { className: 'slds-list__item slds-m-right--large' }, - _react2.default.createElement( - 'dl', - { className: 'slds-dl--inline' }, - _react2.default.createElement( - 'dt', - { className: 'slds-dl--inline__label' }, - 'Price:' - ), - _react2.default.createElement( - 'dd', - { className: 'slds-dl--inline__detail' }, - parseFloat(this.props.activity.price).toLocaleString('en-US', { style: 'currency', currency: 'USD' }) - ) - ) - ) - ) - ) - ) - ) - ) - ) - ) - ); - } - }); - - exports.default = _react2.default.createClass({ - displayName: 'ActivityTimeline', - render: function render() { - var _this = this; - - var items = this.props.activities.map(function (activity) { - var theme = getActivityTheme(activity.activity_name); - return _react2.default.createElement(ActivityListItem, { key: activity.activity_id, activity: activity, theme: theme, showContact: _this.props.showContact, showProperty: _this.props.showProperty }); - }); - return _react2.default.createElement( - 'ul', - { className: 'slds-timeline' }, - items - ); - } - }); - -/***/ }), -/* 366 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - var _BrokerService = __webpack_require__(367); - - var brokerService = _interopRequireWildcard(_BrokerService); - - var _DataGrid = __webpack_require__(214); - - var _DataGrid2 = _interopRequireDefault(_DataGrid); - - var _Icons = __webpack_require__(206); - - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _react2.default.createClass({ - displayName: 'BrokerCard', - getInitialState: function getInitialState() { - return { brokers: [] }; - }, - componentWillReceiveProps: function componentWillReceiveProps(props) { - var _this = this; - - brokerService.findByProperty(props.property_id).then(function (brokers) { - return _this.setState({ brokers: brokers }); - }); - }, - linkHandler: function linkHandler(broker) { - window.location.hash = "#broker/" + broker.broker_id; - }, - newHandler: function newHandler() { - alert("Not yet implemented in this demo app"); - }, - actionHandler: function actionHandler(data, value, label) { - alert("Not yet implemented in this demo app"); - }, - render: function render() { - - return _react2.default.createElement( - 'div', - { className: 'slds-card' }, - _react2.default.createElement( - 'header', - { className: 'slds-card__header slds-grid' }, - _react2.default.createElement( - 'div', - { className: 'slds-media slds-media--center slds-has-flexi-truncate' }, - _react2.default.createElement( - 'div', - { className: 'slds-media__figure' }, - _react2.default.createElement(_Icons.Icon, { name: 'groups', size: 'small' }) - ), - _react2.default.createElement( - 'div', - { className: 'slds-media__body' }, - _react2.default.createElement( - 'h3', - { className: 'slds-text-heading--small slds-truncate' }, - 'Brokers' - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-no-flex' }, - _react2.default.createElement( - 'div', - { className: 'slds-button-group' }, - _react2.default.createElement( - 'button', - { className: 'slds-button slds-button--neutral slds-button--small', onClick: this.newHandler }, - 'New' - ), - _react2.default.createElement( - 'button', - { className: 'slds-button slds-button--icon-border-filled' }, - _react2.default.createElement(_Icons.ButtonIcon, { name: 'down' }), - _react2.default.createElement( - 'span', - { className: 'slds-assistive-text' }, - 'Show More' - ) - ) - ) - ) - ), - _react2.default.createElement( - 'section', - { className: 'slds-card__body' }, - _react2.default.createElement( - _DataGrid2.default, - { data: this.state.brokers, onAction: this.actionHandler }, - _react2.default.createElement('div', { header: 'Name', field: 'name', onLink: this.linkHandler }), - _react2.default.createElement('div', { header: 'Title', field: 'title' }), - _react2.default.createElement('div', { header: 'Mobile Phone', field: 'mobile_phone' }), - _react2.default.createElement('div', { header: 'Office Phone', field: 'office_phone' }) - ) - ), - _react2.default.createElement( - 'footer', - { className: 'slds-card__footer' }, - _react2.default.createElement( - 'a', - { href: '#' }, - 'View All' - ) - ) - ); - } - }); - -/***/ }), -/* 367 */ -/***/ (function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.deleteItem = exports.createItem = exports.updateItem = exports.findById = exports.findByName = exports.findByProperty = exports.findAll = undefined; - - var _h = __webpack_require__(209); - - var h = _interopRequireWildcard(_h); - - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - var url = "/brokers"; - - var findAll = exports.findAll = function findAll(sort) { - return h.get(url, { sort: sort }); - }; - - var findByProperty = exports.findByProperty = function findByProperty(propertyId) { - return h.get(url, { propertyId: propertyId }); - }; - - var findByName = exports.findByName = function findByName(name) { - return h.get(url, { name: name }); - }; - - var findById = exports.findById = function findById(id) { - return h.get(url + "/" + id); - }; - - var updateItem = exports.updateItem = function updateItem(property) { - return h.put(url, property); - }; - - var createItem = exports.createItem = function createItem(property) { - return h.post(url, property); - }; - - var deleteItem = exports.deleteItem = function deleteItem(id) { - return h.del(url + "/" + id); - }; - -/***/ }), -/* 368 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - var _ActivityService = __webpack_require__(363); - - var activityService = _interopRequireWildcard(_ActivityService); - - var _DataGrid = __webpack_require__(214); - - var _DataGrid2 = _interopRequireDefault(_DataGrid); - - var _Icons = __webpack_require__(206); - - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _react2.default.createClass({ - displayName: 'ActivityCard', - contactLinkHandler: function contactLinkHandler(activity) { - window.location.hash = "#contact/" + activity.contact_id; - }, - propertyLinkHandler: function propertyLinkHandler(activity) { - window.location.hash = "#property/" + activity.property_id; - }, - actionHandler: function actionHandler(data, value, label) { - if (label === "Delete") { - this.props.onDelete(data); - } - }, - render: function render() { - - return _react2.default.createElement( - 'div', - { className: 'slds-card' }, - _react2.default.createElement( - 'header', - { className: 'slds-card__header slds-grid' }, - _react2.default.createElement( - 'div', - { className: 'slds-media slds-media--center slds-has-flexi-truncate' }, - _react2.default.createElement( - 'div', - { className: 'slds-media__figure' }, - _react2.default.createElement(_Icons.Icon, { name: 'feed', size: 'small' }) - ), - _react2.default.createElement( - 'div', - { className: 'slds-media__body' }, - _react2.default.createElement( - 'h3', - { className: 'slds-text-heading--small slds-truncate' }, - 'Activities' - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-no-flex' }, - _react2.default.createElement( - 'div', - { className: 'slds-button-group' }, - _react2.default.createElement( - 'button', - { className: 'slds-button slds-button--neutral slds-button--small', onClick: this.props.onNew }, - 'New' - ), - _react2.default.createElement( - 'button', - { className: 'slds-button slds-button--icon-border-filled' }, - _react2.default.createElement(_Icons.ButtonIcon, { name: 'down' }), - _react2.default.createElement( - 'span', - { className: 'slds-assistive-text' }, - 'Show More' - ) - ) - ) - ) - ), - _react2.default.createElement( - 'section', - { className: 'slds-card__body' }, - _react2.default.createElement( - _DataGrid2.default, - { data: this.props.activities, onAction: this.actionHandler }, - _react2.default.createElement('div', { header: 'Type', field: 'activity_name', sortable: true }), - _react2.default.createElement('div', { header: 'Date', field: 'activity_date', sortable: true, format: 'date' }), - this.props.showContact ? _react2.default.createElement('div', { header: 'Contact', field: 'contact', onLink: this.contactLinkHandler }) : '', - this.props.showProperty ? _react2.default.createElement('div', { header: 'Property', field: 'address', onLink: this.propertyLinkHandler }) : '', - _react2.default.createElement('div', { header: 'Price', field: 'price', sortable: true, format: 'currency' }) - ) - ), - _react2.default.createElement( - 'footer', - { className: 'slds-card__footer' }, - _react2.default.createElement( - 'a', - { href: '#' }, - 'View All' - ) - ) - ); - } - }); - -/***/ }), -/* 369 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - var _ActivityTypePickList = __webpack_require__(370); - - var _ActivityTypePickList2 = _interopRequireDefault(_ActivityTypePickList); - - var _PropertyQuickFind = __webpack_require__(373); - - var _PropertyQuickFind2 = _interopRequireDefault(_PropertyQuickFind); - - var _ContactQuickFind = __webpack_require__(375); - - var _ContactQuickFind2 = _interopRequireDefault(_ContactQuickFind); - - var _Icons = __webpack_require__(206); - - var _SLDSDateInput = __webpack_require__(377); - - var _SLDSDateInput2 = _interopRequireDefault(_SLDSDateInput); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _react2.default.createClass({ - displayName: 'NewActivityWindow', - getInitialState: function getInitialState() { - return { property_id: this.props.propertyId, contact_id: this.props.contactId, price: this.props.price, activity_type_id: undefined, activity_date: new Date(), comment: "" }; - }, - propertyChange: function propertyChange(data, label) { - this.setState({ property_id: data }); - }, - contactChange: function contactChange(data, label) { - this.setState({ contact_id: data }); - }, - activityTypeChange: function activityTypeChange(value, label) { - this.setState({ activity_type_id: value }); - }, - activityDateChange: function activityDateChange(event) { - this.setState({ activity_date: event.target.value }); - }, - priceChange: function priceChange(event) { - this.setState({ price: event.target.value }); - }, - commentChange: function commentChange(event) { - this.setState({ comment: event.target.value }); - }, - onSave: function onSave() { - this.props.onSave(this.state); - }, - render: function render() { - return _react2.default.createElement( - 'div', - null, - _react2.default.createElement( - 'div', - { 'aria-hidden': 'false', role: 'dialog', className: 'slds-modal slds-fade-in-open' }, - _react2.default.createElement( - 'div', - { className: 'slds-modal__container' }, - _react2.default.createElement( - 'div', - { className: 'slds-modal__header' }, - _react2.default.createElement( - 'h2', - { className: 'slds-text-heading--medium' }, - 'New Activity' - ), - _react2.default.createElement( - 'button', - { className: 'slds-button slds-modal__close' }, - _react2.default.createElement('svg', { 'aria-hidden': 'true', className: 'slds-button__icon slds-button__icon--inverse slds-button__icon--large' }), - _react2.default.createElement( - 'span', - { className: 'slds-assistive-text' }, - 'Close' - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-modal__content' }, - _react2.default.createElement( - 'div', - { className: 'slds-form--stacked' }, - this.props.propertyId ? "" : _react2.default.createElement( - 'div', - { className: 'slds-form-element' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__label', htmlFor: 'sample1' }, - 'Property' - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element__control' }, - _react2.default.createElement(_PropertyQuickFind2.default, { onChange: this.propertyChange }) - ) - ), - this.props.contactId ? "" : _react2.default.createElement( - 'div', - { className: 'slds-form-element' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__label', htmlFor: 'sample1' }, - 'Contact' - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element__control' }, - _react2.default.createElement(_ContactQuickFind2.default, { onChange: this.contactChange }) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__label', htmlFor: 'sample1' }, - 'Type' - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element__control' }, - _react2.default.createElement(_ActivityTypePickList2.default, { onChange: this.activityTypeChange }) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__label', htmlFor: 'sample1' }, - 'Date' - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element__control' }, - _react2.default.createElement(_SLDSDateInput2.default, null) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__label', htmlFor: 'sample1' }, - 'Price' - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element__control' }, - _react2.default.createElement('input', { className: 'slds-input', type: 'text', value: this.state.price, onChange: this.priceChange }) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__label', htmlFor: 'sample2' }, - 'Comment' - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element__control' }, - _react2.default.createElement('textarea', { id: 'description', className: 'slds-textarea', value: this.state.comment, onChange: this.commentChange }) - ) - ) - ) - ), - _react2.default.createElement( - 'div', - { className: 'slds-modal__footer' }, - _react2.default.createElement( - 'button', - { className: 'slds-button slds-button--neutral', onClick: this.props.onCancel }, - 'Cancel' - ), - _react2.default.createElement( - 'button', - { className: 'slds-button slds-button--neutral slds-button--brand', onClick: this.onSave }, - 'Save' - ) - ) - ) - ), - _react2.default.createElement('div', { className: 'slds-modal-backdrop slds-modal-backdrop--open' }), - _react2.default.createElement('br', null), - _react2.default.createElement('br', null) - ); - } - }); - -/***/ }), -/* 370 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - var _ActivityTypeService = __webpack_require__(371); - - var activityTypeService = _interopRequireWildcard(_ActivityTypeService); - - var _PickList = __webpack_require__(372); - - var _PickList2 = _interopRequireDefault(_PickList); - - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _react2.default.createClass({ - displayName: 'ActivityTypePickList', - getInitialState: function getInitialState() { - return { activityTypes: [] }; - }, - componentDidMount: function componentDidMount() { - var _this = this; - - activityTypeService.findAll().then(function (activityTypes) { - return _this.setState({ activityTypes: activityTypes }); - }); - }, - render: function render() { - return _react2.default.createElement(_PickList2.default, { valueField: 'activity_type_id', labelField: 'name', label: 'Select an activity...', items: this.state.activityTypes, onChange: this.props.onChange }); - } - }); - -/***/ }), -/* 371 */ -/***/ (function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.findAll = undefined; - - var _h = __webpack_require__(209); - - var h = _interopRequireWildcard(_h); - - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - var url = "/activitytypes"; - - var findAll = exports.findAll = function findAll(sort) { - return h.get(url, { sort: sort }); - }; - -/***/ }), -/* 372 */ -/***/ (function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - var _Icons = __webpack_require__(206); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var ListItem = _react2.default.createClass({ - displayName: "ListItem", - clickHandler: function clickHandler() { - this.props.onSelect(this.props.data, this.props.label); - }, - render: function render() { - return _react2.default.createElement( - "li", - { className: "slds-dropdown__item slds-has-icon--left", role: "menuitem option", tabIndex: "-1" }, - _react2.default.createElement( - "a", - { tabIndex: "-1", className: "slds-truncate", onMouseDown: this.clickHandler }, - this.props.label - ) - ); - } - }); - - var Dropdown = _react2.default.createClass({ - displayName: "Dropdown", - render: function render() { - var _this = this; - - var items = this.props.items.map(function (item) { - return _react2.default.createElement(ListItem, { data: item[_this.props.valueField], label: item[_this.props.labelField], onSelect: _this.props.onChange }); - }); - return _react2.default.createElement( - "div", - { className: "slds-dropdown slds-dropdown--left slds-dropdown--small slds-dropdown--menu", style: { display: this.props.isOpen ? "inherit" : "none" } }, - _react2.default.createElement( - "ul", - { className: "slds-dropdown__list", role: "menu" }, - items - ) - ); - } - }); - - exports.default = _react2.default.createClass({ - displayName: "PickList", - getInitialState: function getInitialState() { - return { - value: undefined, - label: this.props.label || 'Select an option', - isOpen: false - }; - }, - focusHandler: function focusHandler() { - this.setState({ isOpen: true }); - }, - blurHandler: function blurHandler(value, label) { - this.setState({ isOpen: false }); - }, - changeHandler: function changeHandler(value, label) { - this.setState({ value: value, label: label, isOpen: false }); - this.props.onChange(value, label); - }, - render: function render() { - return _react2.default.createElement( - "div", - { "aria-expanded": "true", className: "slds-picklist", onFocus: this.focusHandler, onBlur: this.blurHandler }, - _react2.default.createElement( - "button", - { className: "slds-button slds-button--neutral slds-picklist__label", "aria-haspopup": "true" }, - _react2.default.createElement( - "span", - { className: "slds-truncate" }, - this.state.label - ), - _react2.default.createElement(_Icons.Icon, { category: "utility", name: "down" }) - ), - _react2.default.createElement(Dropdown, { onChange: this.changeHandler, valueField: this.props.valueField, labelField: this.props.labelField, items: this.props.items, isOpen: this.state.isOpen }) - ); - } - }); - -/***/ }), -/* 373 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - var _PropertyService = __webpack_require__(353); - - var propertyService = _interopRequireWildcard(_PropertyService); - - var _QuickFind = __webpack_require__(374); - - var _QuickFind2 = _interopRequireDefault(_QuickFind); - - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _react2.default.createClass({ - displayName: 'PropertyQuickFind', - getInitialState: function getInitialState() { - return { - searchKey: undefined, - list: [] - }; - }, - searchKeyChangeHandler: function searchKeyChangeHandler(key) { - var _this = this; - - propertyService.findByName(key).then(function (list) { - return _this.setState({ searchKey: key, list: list }); - }); - }, - render: function render() { - return _react2.default.createElement(_QuickFind2.default, { label: 'Select a property...', - searchKey: this.state.searchKey, - valueField: 'property_id', - labelField: 'address', - list: this.state.list, - onSearchKeyChange: this.searchKeyChangeHandler, - onChange: this.props.onChange }); - } - }); - -/***/ }), -/* 374 */ -/***/ (function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - var _Icons = __webpack_require__(206); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - var ListItem = _react2.default.createClass({ - displayName: "ListItem", - clickHandler: function clickHandler(event) { - this.props.onSelect(this.props.value, this.props.label); - event.preventDefault(); - }, - render: function render() { - return _react2.default.createElement( - "li", - { className: "slds-dropdown__item slds-has-icon--left slds-dropdown__item has-icon--left", role: "menuitem option", tabIndex: "0" }, - _react2.default.createElement( - "a", - { href: "#", tabIndex: "-1", className: "slds-truncate", onClick: this.clickHandler }, - this.props.label - ) - ); - } - }); - - var Dropdown = _react2.default.createClass({ - displayName: "Dropdown", - searchKeyChangeHandler: function searchKeyChangeHandler(e) { - this.props.onSearchKeyChange(e.target.value); - }, - render: function render() { - var _this = this; - - var items = this.props.list.map(function (item) { - return _react2.default.createElement(ListItem, { value: item[_this.props.valueField], - label: item[_this.props.labelField], - onSelect: _this.props.onChange }); - }); - return _react2.default.createElement( - "div", - { className: "slds-dropdown slds-dropdown--left slds-dropdown--small slds-dropdown--menu", style: { display: this.props.isOpen ? "inherit" : "none" } }, - _react2.default.createElement( - "div", - { className: "slds-dropdown__header" }, - _react2.default.createElement( - "div", - { placeholder: "Find in list...", className: "slds-input-has-icon slds-input-has-icon--left slds-m-bottom--x-small" }, - _react2.default.createElement(_Icons.InputIcon, { name: "search" }), - _react2.default.createElement( - "label", - { className: "slds-assistive-text", htmlFor: "input__filter" }, - "Search..." - ), - _react2.default.createElement("input", { id: "input__filter", className: "slds-input", type: "text", placeholder: "Search...", onChange: this.searchKeyChangeHandler }) - ) - ), - _react2.default.createElement( - "ul", - { className: "slds-dropdown__list", role: "menu" }, - items - ) - ); - } - }); - - exports.default = _react2.default.createClass({ - displayName: "QuickFind", - getInitialState: function getInitialState() { - return { - value: undefined, - label: this.props.label || 'Select an option', - isOpen: false - }; - }, - focusHandler: function focusHandler() { - this.setState({ isOpen: true }); - }, - blurHandler: function blurHandler(value, label) { - this.setState({ isOpen: false }); - }, - changeHandler: function changeHandler(value, label) { - this.setState({ value: value, label: label, isOpen: false }); - this.props.onChange(value, label); - }, - render: function render() { - return _react2.default.createElement( - "div", - { "aria-expanded": "true", className: "slds-picklist slds-picklist--quickfind", onFocus: this.focusHandler, onBlur: this.blurHandler }, - _react2.default.createElement( - "button", - { className: "slds-button slds-button--neutral slds-picklist__label", "aria-haspopup": "true" }, - _react2.default.createElement( - "span", - { className: "slds-truncate" }, - this.state.label - ), - _react2.default.createElement(_Icons.Icon, { category: "utility", name: "down" }) - ), - _react2.default.createElement(Dropdown, { valueField: this.props.valueField, - labelField: this.props.labelField, - list: this.props.list, - isOpen: this.state.isOpen, - onSearchKeyChange: this.props.onSearchKeyChange, - onChange: this.changeHandler }) - ); - } - }); - -/***/ }), -/* 375 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - var _QuickFind = __webpack_require__(374); - - var _QuickFind2 = _interopRequireDefault(_QuickFind); - - var _ContactService = __webpack_require__(376); - - var contactService = _interopRequireWildcard(_ContactService); - - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - exports.default = _react2.default.createClass({ - displayName: 'ContactQuickFind', - getInitialState: function getInitialState() { - return { - searchKey: undefined, - list: [] - }; - }, - searchKeyChangeHandler: function searchKeyChangeHandler(key) { - var _this = this; - - contactService.findByName(key).then(function (list) { - return _this.setState({ searchKey: key, list: list }); - }); - }, - render: function render() { - return _react2.default.createElement(_QuickFind2.default, { label: 'Select a contact...', - searchKey: this.state.searchKey, - valueField: 'contact_id', - labelField: 'name', - list: this.state.list, - onSearchKeyChange: this.searchKeyChangeHandler, - onChange: this.props.onChange }); - } - }); - -/***/ }), -/* 376 */ -/***/ (function(module, exports, __webpack_require__) { - - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.deleteItem = exports.createItem = exports.updateItem = exports.findById = exports.findByName = exports.findAll = undefined; - - var _h = __webpack_require__(209); - - var h = _interopRequireWildcard(_h); - - function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - - var url = "/contacts"; - - var findAll = exports.findAll = function findAll(sort) { - return h.get(url, { sort: sort }); - }; - - var findByName = exports.findByName = function findByName(name) { - return h.get(url, { name: name }); - }; - - var findById = exports.findById = function findById(id) { - return h.get(url + "/" + id); - }; - - var updateItem = exports.updateItem = function updateItem(property) { - return h.put(url, property); - }; - - var createItem = exports.createItem = function createItem(property) { - return h.post(url, property); - }; - - var deleteItem = exports.deleteItem = function deleteItem(id) { - return h.del(url + "/" + id); - }; - -/***/ }), -/* 377 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - var _SLDSPopover = __webpack_require__(378); - - var _SLDSPopover2 = _interopRequireDefault(_SLDSPopover); - - var _index = __webpack_require__(412); - - var _index2 = _interopRequireDefault(_index); - - var _moment = __webpack_require__(215); - - var _moment2 = _interopRequireDefault(_moment); - - var _Icons = __webpack_require__(206); - - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - - module.exports = _react2.default.createClass({ - displayName: 'exports', - getDefaultProps: function getDefaultProps() { - return { - string: '', - selected: null, - placeholder: 'Pick a Date', - format: 'MM/DD/YYYY', - onDateChange: function onDateChange(moment) { - console.log('onDateChage should be defined'); - } - }; - }, - getInitialState: function getInitialState() { - return { - isOpen: false, - selected: this.props.selected, - string: this.props.selected ? this.props.selected.format(this.props.format) : null - }; - }, - handleChange: function handleChange(moment) { - this.setState({ - selected: moment, - isOpen: false, - string: moment.format(this.props.format) - }); - if (this.props.onDateChange) { - this.props.onDateChange(moment); - } - }, - handleClose: function handleClose() { - this.setState({ isOpen: false }); - }, - handleClick: function handleClick() { - this.setState({ isOpen: true }); - }, - handleFocus: function handleFocus() { - this.setState({ isOpen: true }); - }, - popover: function popover() { - if (this.state && this.state.isOpen) { - return _react2.default.createElement( - _SLDSPopover2.default, - { targetElement: this.refs.date, onClose: this.handleClose }, - _react2.default.createElement(_index2.default, { - onChange: this.handleChange, - selected: this.state.selected, - month: this.state.selected ? this.state.selected : (0, _moment2.default)() }) - ); - } - return _react2.default.createElement('span', null); - }, - handleInputChange: function handleInputChange() { - var string = this.refs.date.getDOMNode().value; - if ((0, _moment2.default)().isValid(string)) { - var selected = (0, _moment2.default)(string, this.props.format); - this.setState({ - selected: selected, - string: string - }); - if (this.props.onDateChage) { - this.props.onDateChange(selected); - } - } else { - this.setState({ - selected: null, - string: string - }); - } - }, - render: function render() { - return _react2.default.createElement( - 'div', - { className: 'slds-form-element' }, - _react2.default.createElement( - 'label', - { className: 'slds-form-element__label', htmlFor: 'date' }, - this.props.label - ), - _react2.default.createElement( - 'div', - { className: 'slds-form-element__control' }, - _react2.default.createElement( - 'div', - { className: 'slds-input-has-icon slds-input-has-icon--right' }, - _react2.default.createElement(_Icons.InputIcon, { name: 'event' }), - _react2.default.createElement('input', { - name: 'date', - ref: 'date', - className: 'slds-input', - type: 'text', - placeholder: this.props.placeholder, - value: this.state.selected ? this.state.string : '', - onChange: this.handleInputChange, - onClick: this.handleClick, - onFocus: this.handleFocus }) - ) - ), - this.popover() - ); - } - }); - -/***/ }), -/* 378 */ -/***/ (function(module, exports, __webpack_require__) { - - "use strict"; - - var _reactMotion = __webpack_require__(379); - - var React = __webpack_require__(1); - var ReactDOM = __webpack_require__(158); - var TetherDrop = __webpack_require__(409); - var ReactCSSTransitionGroup = ReactDOM.CSSTransitionGroup; - - - //require('./index.css'); - - module.exports = React.createClass({ - - displayName: "SLDSPopover", - - mixins: [__webpack_require__(411)], - - handleClickOutside: function handleClickOutside(e) { - if (this.props.onClose) { - this.props.onClose(); - } - }, - - propTypes: { - attachment: React.PropTypes.string, - targetAttachment: React.PropTypes.string, - targetOffset: React.PropTypes.string - }, - - getDefaultProps: function getDefaultProps() { - return { - attachment: "top left", - targetAttachment: "bottom left", - targetOffset: "-30px 0" - }; - }, - - componentWillMount: function componentWillMount() { - - var popoverContainer = document.createElement("span"); - popoverContainer.className = "datepicker__container"; - - this._popoverElement = popoverContainer; - - document.querySelector("body").appendChild(this._popoverElement); - }, - - componentDidMount: function componentDidMount() { - this.renderPopover(); - }, - - componentDidUpdate: function componentDidUpdate() { - this.renderPopover(); - }, - - handleClick: function handleClick(event) { - event.preventDefault(); - event.stopPropagation(); - }, - - popoverComp: function popoverComp() { - var _this = this; - - var className = this.props.className; - return React.createElement( - "div", - { className: className, - onClick: this.handleClick, - onMousedown: this.handleClick, - onMouseup: this.handleClick }, - React.createElement( - "div", - { className: "slds-dropdown", - style: { - transform: 'none', - marginTop: '0.25rem', - marginBottom: '0.35rem' - - } }, - React.createElement( - _reactMotion.Spring, - { - defaultValue: { val: 0 }, - endValue: { val: 1, config: [70, 10] } }, - function (currentVal) { - var style = { opacity: currentVal.val }; - return React.createElement( - "div", - { style: style }, - _this.props.children - ); - } - ) - ) - ); - }, - - beforeClose: function beforeClose() {}, - - dropOptions: function dropOptions() { - var target = this.props.targetElement ? this.props.targetElement.getDOMNode() : this.getDOMNode().parentNode; - return { - target: target, - content: this._popoverElement, - classes: 'drop-theme-arrows', - position: 'bottom left', - openOn: 'always', - beforeClose: this.beforeClose, - constrainToWindow: true, - constrainToScrollParent: false - }; - }, - - renderPopover: function renderPopover() { - - React.render(this.popoverComp(), this._popoverElement); - - if (this._popoverElement && this._popoverElement.parentNode && this._popoverElement.parentNode.parentNode && this._popoverElement.parentNode.parentNode.className && this._popoverElement.parentNode.parentNode.className.indexOf('drop ') > -1) { - this._popoverElement.parentNode.parentNode.style.zIndex = 10001; - } - - if (this.drop != null) { - if (this.drop.setOptions) { - this.drop.setOptions(this.dropOptions()); - } - } else if (window && document) { - this.drop = new TetherDrop(this.dropOptions()); - } - }, - - componentWillUnmount: function componentWillUnmount() { - - this.drop.destroy(); - React.unmountComponentAtNode(this._popoverElement); - if (this._popoverElement.parentNode) { - this._popoverElement.parentNode.removeChild(this._popoverElement); - } - if (this.props.onClose) { - this.props.onClose(); - } - }, - - render: function render() { - return React.createElement("span", null); - } - }); - -/***/ }), -/* 379 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - function _interopRequire(obj) { - return obj && obj.__esModule ? obj['default'] : obj; - } - - var _Motion = __webpack_require__(380); - - exports.Motion = _interopRequire(_Motion); - - var _StaggeredMotion = __webpack_require__(403); - - exports.StaggeredMotion = _interopRequire(_StaggeredMotion); - - var _TransitionMotion = __webpack_require__(404); - - exports.TransitionMotion = _interopRequire(_TransitionMotion); - - var _spring = __webpack_require__(406); - - exports.spring = _interopRequire(_spring); - - var _presets = __webpack_require__(407); - - exports.presets = _interopRequire(_presets); - - var _stripStyle = __webpack_require__(382); - - exports.stripStyle = _interopRequire(_stripStyle); - - // deprecated, dummy warning function - - var _reorderKeys = __webpack_require__(408); - - exports.reorderKeys = _interopRequire(_reorderKeys); - -/***/ }), -/* 380 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i];for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - }return target; - }; - - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { 'default': obj }; - } - - var _mapToZero = __webpack_require__(381); - - var _mapToZero2 = _interopRequireDefault(_mapToZero); - - var _stripStyle = __webpack_require__(382); - - var _stripStyle2 = _interopRequireDefault(_stripStyle); - - var _stepper3 = __webpack_require__(383); - - var _stepper4 = _interopRequireDefault(_stepper3); - - var _performanceNow = __webpack_require__(384); - - var _performanceNow2 = _interopRequireDefault(_performanceNow); - - var _raf = __webpack_require__(385); - - var _raf2 = _interopRequireDefault(_raf); - - var _shouldStopAnimation = __webpack_require__(387); - - var _shouldStopAnimation2 = _interopRequireDefault(_shouldStopAnimation); - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - var _propTypes = __webpack_require__(388); - - var _propTypes2 = _interopRequireDefault(_propTypes); - - var _createReactClass = __webpack_require__(397); - - var _createReactClass2 = _interopRequireDefault(_createReactClass); - - var msPerFrame = 1000 / 60; - - var Motion = _createReactClass2['default']({ - propTypes: { - // TOOD: warn against putting a config in here - defaultStyle: _propTypes2['default'].objectOf(_propTypes2['default'].number), - style: _propTypes2['default'].objectOf(_propTypes2['default'].oneOfType([_propTypes2['default'].number, _propTypes2['default'].object])).isRequired, - children: _propTypes2['default'].func.isRequired, - onRest: _propTypes2['default'].func - }, - - getInitialState: function getInitialState() { - var _props = this.props; - var defaultStyle = _props.defaultStyle; - var style = _props.style; - - var currentStyle = defaultStyle || _stripStyle2['default'](style); - var currentVelocity = _mapToZero2['default'](currentStyle); - return { - currentStyle: currentStyle, - currentVelocity: currentVelocity, - lastIdealStyle: currentStyle, - lastIdealVelocity: currentVelocity - }; - }, - - wasAnimating: false, - animationID: null, - prevTime: 0, - accumulatedTime: 0, - // it's possible that currentStyle's value is stale: if props is immediately - // changed from 0 to 400 to spring(0) again, the async currentStyle is still - // at 0 (didn't have time to tick and interpolate even once). If we naively - // compare currentStyle with destVal it'll be 0 === 0 (no animation, stop). - // In reality currentStyle should be 400 - unreadPropStyle: null, - // after checking for unreadPropStyle != null, we manually go set the - // non-interpolating values (those that are a number, without a spring - // config) - clearUnreadPropStyle: function clearUnreadPropStyle(destStyle) { - var dirty = false; - var _state = this.state; - var currentStyle = _state.currentStyle; - var currentVelocity = _state.currentVelocity; - var lastIdealStyle = _state.lastIdealStyle; - var lastIdealVelocity = _state.lastIdealVelocity; - - for (var key in destStyle) { - if (!Object.prototype.hasOwnProperty.call(destStyle, key)) { - continue; - } - - var styleValue = destStyle[key]; - if (typeof styleValue === 'number') { - if (!dirty) { - dirty = true; - currentStyle = _extends({}, currentStyle); - currentVelocity = _extends({}, currentVelocity); - lastIdealStyle = _extends({}, lastIdealStyle); - lastIdealVelocity = _extends({}, lastIdealVelocity); - } - - currentStyle[key] = styleValue; - currentVelocity[key] = 0; - lastIdealStyle[key] = styleValue; - lastIdealVelocity[key] = 0; - } - } - - if (dirty) { - this.setState({ currentStyle: currentStyle, currentVelocity: currentVelocity, lastIdealStyle: lastIdealStyle, lastIdealVelocity: lastIdealVelocity }); - } - }, - - startAnimationIfNecessary: function startAnimationIfNecessary() { - var _this = this; - - // TODO: when config is {a: 10} and dest is {a: 10} do we raf once and - // call cb? No, otherwise accidental parent rerender causes cb trigger - this.animationID = _raf2['default'](function (timestamp) { - // check if we need to animate in the first place - var propsStyle = _this.props.style; - if (_shouldStopAnimation2['default'](_this.state.currentStyle, propsStyle, _this.state.currentVelocity)) { - if (_this.wasAnimating && _this.props.onRest) { - _this.props.onRest(); - } - - // no need to cancel animationID here; shouldn't have any in flight - _this.animationID = null; - _this.wasAnimating = false; - _this.accumulatedTime = 0; - return; - } - - _this.wasAnimating = true; - - var currentTime = timestamp || _performanceNow2['default'](); - var timeDelta = currentTime - _this.prevTime; - _this.prevTime = currentTime; - _this.accumulatedTime = _this.accumulatedTime + timeDelta; - // more than 10 frames? prolly switched browser tab. Restart - if (_this.accumulatedTime > msPerFrame * 10) { - _this.accumulatedTime = 0; - } - - if (_this.accumulatedTime === 0) { - // no need to cancel animationID here; shouldn't have any in flight - _this.animationID = null; - _this.startAnimationIfNecessary(); - return; - } - - var currentFrameCompletion = (_this.accumulatedTime - Math.floor(_this.accumulatedTime / msPerFrame) * msPerFrame) / msPerFrame; - var framesToCatchUp = Math.floor(_this.accumulatedTime / msPerFrame); - - var newLastIdealStyle = {}; - var newLastIdealVelocity = {}; - var newCurrentStyle = {}; - var newCurrentVelocity = {}; - - for (var key in propsStyle) { - if (!Object.prototype.hasOwnProperty.call(propsStyle, key)) { - continue; - } - - var styleValue = propsStyle[key]; - if (typeof styleValue === 'number') { - newCurrentStyle[key] = styleValue; - newCurrentVelocity[key] = 0; - newLastIdealStyle[key] = styleValue; - newLastIdealVelocity[key] = 0; - } else { - var newLastIdealStyleValue = _this.state.lastIdealStyle[key]; - var newLastIdealVelocityValue = _this.state.lastIdealVelocity[key]; - for (var i = 0; i < framesToCatchUp; i++) { - var _stepper = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision); - - newLastIdealStyleValue = _stepper[0]; - newLastIdealVelocityValue = _stepper[1]; - } - - var _stepper2 = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision); - - var nextIdealX = _stepper2[0]; - var nextIdealV = _stepper2[1]; - - newCurrentStyle[key] = newLastIdealStyleValue + (nextIdealX - newLastIdealStyleValue) * currentFrameCompletion; - newCurrentVelocity[key] = newLastIdealVelocityValue + (nextIdealV - newLastIdealVelocityValue) * currentFrameCompletion; - newLastIdealStyle[key] = newLastIdealStyleValue; - newLastIdealVelocity[key] = newLastIdealVelocityValue; - } - } - - _this.animationID = null; - // the amount we're looped over above - _this.accumulatedTime -= framesToCatchUp * msPerFrame; - - _this.setState({ - currentStyle: newCurrentStyle, - currentVelocity: newCurrentVelocity, - lastIdealStyle: newLastIdealStyle, - lastIdealVelocity: newLastIdealVelocity - }); - - _this.unreadPropStyle = null; - - _this.startAnimationIfNecessary(); - }); - }, - - componentDidMount: function componentDidMount() { - this.prevTime = _performanceNow2['default'](); - this.startAnimationIfNecessary(); - }, - - componentWillReceiveProps: function componentWillReceiveProps(props) { - if (this.unreadPropStyle != null) { - // previous props haven't had the chance to be set yet; set them here - this.clearUnreadPropStyle(this.unreadPropStyle); - } - - this.unreadPropStyle = props.style; - if (this.animationID == null) { - this.prevTime = _performanceNow2['default'](); - this.startAnimationIfNecessary(); - } - }, - - componentWillUnmount: function componentWillUnmount() { - if (this.animationID != null) { - _raf2['default'].cancel(this.animationID); - this.animationID = null; - } - }, - - render: function render() { - var renderedChildren = this.props.children(this.state.currentStyle); - return renderedChildren && _react2['default'].Children.only(renderedChildren); - } - }); - - exports['default'] = Motion; - module.exports = exports['default']; - -/***/ }), -/* 381 */ -/***/ (function(module, exports) { - - - - // currently used to initiate the velocity style object to 0 - 'use strict'; - - exports.__esModule = true; - exports['default'] = mapToZero; - - function mapToZero(obj) { - var ret = {}; - for (var key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - ret[key] = 0; - } - } - return ret; - } - - module.exports = exports['default']; - -/***/ }), -/* 382 */ -/***/ (function(module, exports) { - - - // turn {x: {val: 1, stiffness: 1, damping: 2}, y: 2} generated by - // `{x: spring(1, {stiffness: 1, damping: 2}), y: 2}` into {x: 1, y: 2} - - 'use strict'; - - exports.__esModule = true; - exports['default'] = stripStyle; - - function stripStyle(style) { - var ret = {}; - for (var key in style) { - if (!Object.prototype.hasOwnProperty.call(style, key)) { - continue; - } - ret[key] = typeof style[key] === 'number' ? style[key] : style[key].val; - } - return ret; - } - - module.exports = exports['default']; - -/***/ }), -/* 383 */ -/***/ (function(module, exports) { - - - - // stepper is used a lot. Saves allocation to return the same array wrapper. - // This is fine and danger-free against mutations because the callsite - // immediately destructures it and gets the numbers inside without passing the - "use strict"; - - exports.__esModule = true; - exports["default"] = stepper; - - var reusedTuple = [0, 0]; - - function stepper(secondPerFrame, x, v, destX, k, b, precision) { - // Spring stiffness, in kg / s^2 - - // for animations, destX is really spring length (spring at rest). initial - // position is considered as the stretched/compressed position of a spring - var Fspring = -k * (x - destX); - - // Damping, in kg / s - var Fdamper = -b * v; - - // usually we put mass here, but for animation purposes, specifying mass is a - // bit redundant. you could simply adjust k and b accordingly - // let a = (Fspring + Fdamper) / mass; - var a = Fspring + Fdamper; - - var newV = v + a * secondPerFrame; - var newX = x + newV * secondPerFrame; - - if (Math.abs(newV) < precision && Math.abs(newX - destX) < precision) { - reusedTuple[0] = destX; - reusedTuple[1] = 0; - return reusedTuple; - } - - reusedTuple[0] = newX; - reusedTuple[1] = newV; - return reusedTuple; - } - - module.exports = exports["default"]; - // array reference around. - -/***/ }), -/* 384 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {"use strict"; - - // Generated by CoffeeScript 1.7.1 - (function () { - var getNanoSeconds, hrtime, loadTime; - - if (typeof performance !== "undefined" && performance !== null && performance.now) { - module.exports = function () { - return performance.now(); - }; - } else if (typeof process !== "undefined" && process !== null && process.hrtime) { - module.exports = function () { - return (getNanoSeconds() - loadTime) / 1e6; - }; - hrtime = process.hrtime; - getNanoSeconds = function getNanoSeconds() { - var hr; - hr = hrtime(); - return hr[0] * 1e9 + hr[1]; - }; - loadTime = getNanoSeconds(); - } else if (Date.now) { - module.exports = function () { - return Date.now() - loadTime; - }; - loadTime = Date.now(); - } else { - module.exports = function () { - return new Date().getTime() - loadTime; - }; - loadTime = new Date().getTime(); - } - }).call(undefined); - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) - -/***/ }), -/* 385 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; - - var now = __webpack_require__(386), - root = typeof window === 'undefined' ? global : window, - vendors = ['moz', 'webkit'], - suffix = 'AnimationFrame', - raf = root['request' + suffix], - caf = root['cancel' + suffix] || root['cancelRequest' + suffix]; - - for (var i = 0; !raf && i < vendors.length; i++) { - raf = root[vendors[i] + 'Request' + suffix]; - caf = root[vendors[i] + 'Cancel' + suffix] || root[vendors[i] + 'CancelRequest' + suffix]; - } - - // Some versions of FF have rAF but not cAF - if (!raf || !caf) { - var last = 0, - id = 0, - queue = [], - frameDuration = 1000 / 60; - - raf = function raf(callback) { - if (queue.length === 0) { - var _now = now(), - next = Math.max(0, frameDuration - (_now - last)); - last = next + _now; - setTimeout(function () { - var cp = queue.slice(0); - // Clear queue here to prevent - // callbacks from appending listeners - // to the current frame's queue - queue.length = 0; - for (var i = 0; i < cp.length; i++) { - if (!cp[i].cancelled) { - try { - cp[i].callback(last); - } catch (e) { - setTimeout(function () { - throw e; - }, 0); - } - } - } - }, Math.round(next)); - } - queue.push({ - handle: ++id, - callback: callback, - cancelled: false - }); - return id; - }; - - caf = function caf(handle) { - for (var i = 0; i < queue.length; i++) { - if (queue[i].handle === handle) { - queue[i].cancelled = true; - } - } - }; - } - - module.exports = function (fn) { - // Wrap in a new function to prevent - // `cancel` potentially being assigned - // to the native rAF function - return raf.call(root, fn); - }; - module.exports.cancel = function () { - caf.apply(root, arguments); - }; - module.exports.polyfill = function (object) { - if (!object) { - object = root; - } - object.requestAnimationFrame = raf; - object.cancelAnimationFrame = caf; - }; - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) - -/***/ }), -/* 386 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {"use strict"; - - // Generated by CoffeeScript 1.12.2 - (function () { - var getNanoSeconds, hrtime, loadTime, moduleLoadTime, nodeLoadTime, upTime; - - if (typeof performance !== "undefined" && performance !== null && performance.now) { - module.exports = function () { - return performance.now(); - }; - } else if (typeof process !== "undefined" && process !== null && process.hrtime) { - module.exports = function () { - return (getNanoSeconds() - nodeLoadTime) / 1e6; - }; - hrtime = process.hrtime; - getNanoSeconds = function getNanoSeconds() { - var hr; - hr = hrtime(); - return hr[0] * 1e9 + hr[1]; - }; - moduleLoadTime = getNanoSeconds(); - upTime = process.uptime() * 1e9; - nodeLoadTime = moduleLoadTime - upTime; - } else if (Date.now) { - module.exports = function () { - return Date.now() - loadTime; - }; - loadTime = Date.now(); - } else { - module.exports = function () { - return new Date().getTime() - loadTime; - }; - loadTime = new Date().getTime(); - } - }).call(undefined); - - //# sourceMappingURL=performance-now.js.map - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) - -/***/ }), -/* 387 */ -/***/ (function(module, exports) { - - - - // usage assumption: currentStyle values have already been rendered but it says - // nothing of whether currentStyle is stale (see unreadPropStyle) - 'use strict'; - - exports.__esModule = true; - exports['default'] = shouldStopAnimation; - - function shouldStopAnimation(currentStyle, style, currentVelocity) { - for (var key in style) { - if (!Object.prototype.hasOwnProperty.call(style, key)) { - continue; - } - - if (currentVelocity[key] !== 0) { - return false; - } - - var styleValue = typeof style[key] === 'number' ? style[key] : style[key].val; - // stepper will have already taken care of rounding precision errors, so - // won't have such thing as 0.9999 !=== 1 - if (currentStyle[key] !== styleValue) { - return false; - } - } - - return true; - } - - module.exports = exports['default']; - -/***/ }), -/* 388 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {'use strict'; - - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - - /** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - if (process.env.NODE_ENV !== 'production') { - var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element') || 0xeac7; - - var isValidElement = function isValidElement(object) { - return (typeof object === 'undefined' ? 'undefined' : _typeof(object)) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; - }; - - // By explicitly using `prop-types` you are opting into new development behavior. - // http://fb.me/prop-types-in-prod - var throwOnDirectAccess = true; - module.exports = __webpack_require__(389)(isValidElement, throwOnDirectAccess); - } else { - // By explicitly using `prop-types` you are opting into new production behavior. - // http://fb.me/prop-types-in-prod - module.exports = __webpack_require__(396)(); - } - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) - -/***/ }), -/* 389 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - 'use strict'; - - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - - var emptyFunction = __webpack_require__(390); - var invariant = __webpack_require__(391); - var warning = __webpack_require__(392); - var assign = __webpack_require__(393); - - var ReactPropTypesSecret = __webpack_require__(394); - var checkPropTypes = __webpack_require__(395); - - module.exports = function (isValidElement, throwOnDirectAccess) { - /* global Symbol */ - var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; - var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. - - /** - * Returns the iterator method function contained on the iterable object. - * - * Be sure to invoke the function with the iterable as context: - * - * var iteratorFn = getIteratorFn(myIterable); - * if (iteratorFn) { - * var iterator = iteratorFn.call(myIterable); - * ... - * } - * - * @param {?object} maybeIterable - * @return {?function} - */ - function getIteratorFn(maybeIterable) { - var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); - if (typeof iteratorFn === 'function') { - return iteratorFn; - } - } - - /** - * Collection of methods that allow declaration and validation of props that are - * supplied to React components. Example usage: - * - * var Props = require('ReactPropTypes'); - * var MyArticle = React.createClass({ - * propTypes: { - * // An optional string prop named "description". - * description: Props.string, - * - * // A required enum prop named "category". - * category: Props.oneOf(['News','Photos']).isRequired, - * - * // A prop named "dialog" that requires an instance of Dialog. - * dialog: Props.instanceOf(Dialog).isRequired - * }, - * render: function() { ... } - * }); - * - * A more formal specification of how these methods are used: - * - * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) - * decl := ReactPropTypes.{type}(.isRequired)? - * - * Each and every declaration produces a function with the same signature. This - * allows the creation of custom validation functions. For example: - * - * var MyLink = React.createClass({ - * propTypes: { - * // An optional string or URI prop named "href". - * href: function(props, propName, componentName) { - * var propValue = props[propName]; - * if (propValue != null && typeof propValue !== 'string' && - * !(propValue instanceof URI)) { - * return new Error( - * 'Expected a string or an URI for ' + propName + ' in ' + - * componentName - * ); - * } - * } - * }, - * render: function() {...} - * }); - * - * @internal - */ - - var ANONYMOUS = '<>'; - - // Important! - // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. - var ReactPropTypes = { - array: createPrimitiveTypeChecker('array'), - bool: createPrimitiveTypeChecker('boolean'), - func: createPrimitiveTypeChecker('function'), - number: createPrimitiveTypeChecker('number'), - object: createPrimitiveTypeChecker('object'), - string: createPrimitiveTypeChecker('string'), - symbol: createPrimitiveTypeChecker('symbol'), - - any: createAnyTypeChecker(), - arrayOf: createArrayOfTypeChecker, - element: createElementTypeChecker(), - instanceOf: createInstanceTypeChecker, - node: createNodeChecker(), - objectOf: createObjectOfTypeChecker, - oneOf: createEnumTypeChecker, - oneOfType: createUnionTypeChecker, - shape: createShapeTypeChecker, - exact: createStrictShapeTypeChecker - }; - - /** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ - /*eslint-disable no-self-compare*/ - function is(x, y) { - // SameValue algorithm - if (x === y) { - // Steps 1-5, 7-10 - // Steps 6.b-6.e: +0 != -0 - return x !== 0 || 1 / x === 1 / y; - } else { - // Step 6.a: NaN == NaN - return x !== x && y !== y; - } - } - /*eslint-enable no-self-compare*/ - - /** - * We use an Error-like object for backward compatibility as people may call - * PropTypes directly and inspect their output. However, we don't use real - * Errors anymore. We don't inspect their stack anyway, and creating them - * is prohibitively expensive if they are created too often, such as what - * happens in oneOfType() for any type before the one that matched. - */ - function PropTypeError(message) { - this.message = message; - this.stack = ''; - } - // Make `instanceof Error` still work for returned errors. - PropTypeError.prototype = Error.prototype; - - function createChainableTypeChecker(validate) { - if (process.env.NODE_ENV !== 'production') { - var manualPropTypeCallCache = {}; - var manualPropTypeWarningCount = 0; - } - function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { - componentName = componentName || ANONYMOUS; - propFullName = propFullName || propName; - - if (secret !== ReactPropTypesSecret) { - if (throwOnDirectAccess) { - // New behavior only for users of `prop-types` package - invariant(false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types'); - } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { - // Old behavior for people using React.PropTypes - var cacheKey = componentName + ':' + propName; - if (!manualPropTypeCallCache[cacheKey] && - // Avoid spamming the console because they are often not actionable except for lib authors - manualPropTypeWarningCount < 3) { - warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName); - manualPropTypeCallCache[cacheKey] = true; - manualPropTypeWarningCount++; - } - } - } - if (props[propName] == null) { - if (isRequired) { - if (props[propName] === null) { - return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); - } - return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); - } - return null; - } else { - return validate(props, propName, componentName, location, propFullName); - } - } - - var chainedCheckType = checkType.bind(null, false); - chainedCheckType.isRequired = checkType.bind(null, true); - - return chainedCheckType; - } - - function createPrimitiveTypeChecker(expectedType) { - function validate(props, propName, componentName, location, propFullName, secret) { - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== expectedType) { - // `propValue` being instance of, say, date/regexp, pass the 'object' - // check, but we can offer a more precise error message here rather than - // 'of type `object`'. - var preciseType = getPreciseType(propValue); - - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); - } - return null; - } - return createChainableTypeChecker(validate); - } - - function createAnyTypeChecker() { - return createChainableTypeChecker(emptyFunction.thatReturnsNull); - } - - function createArrayOfTypeChecker(typeChecker) { - function validate(props, propName, componentName, location, propFullName) { - if (typeof typeChecker !== 'function') { - return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); - } - var propValue = props[propName]; - if (!Array.isArray(propValue)) { - var propType = getPropType(propValue); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); - } - for (var i = 0; i < propValue.length; i++) { - var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); - if (error instanceof Error) { - return error; - } - } - return null; - } - return createChainableTypeChecker(validate); - } - - function createElementTypeChecker() { - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - if (!isValidElement(propValue)) { - var propType = getPropType(propValue); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); - } - return null; - } - return createChainableTypeChecker(validate); - } - - function createInstanceTypeChecker(expectedClass) { - function validate(props, propName, componentName, location, propFullName) { - if (!(props[propName] instanceof expectedClass)) { - var expectedClassName = expectedClass.name || ANONYMOUS; - var actualClassName = getClassName(props[propName]); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); - } - return null; - } - return createChainableTypeChecker(validate); - } - - function createEnumTypeChecker(expectedValues) { - if (!Array.isArray(expectedValues)) { - process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; - return emptyFunction.thatReturnsNull; - } - - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - for (var i = 0; i < expectedValues.length; i++) { - if (is(propValue, expectedValues[i])) { - return null; - } - } - - var valuesString = JSON.stringify(expectedValues); - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); - } - return createChainableTypeChecker(validate); - } - - function createObjectOfTypeChecker(typeChecker) { - function validate(props, propName, componentName, location, propFullName) { - if (typeof typeChecker !== 'function') { - return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); - } - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== 'object') { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); - } - for (var key in propValue) { - if (propValue.hasOwnProperty(key)) { - var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); - if (error instanceof Error) { - return error; - } - } - } - return null; - } - return createChainableTypeChecker(validate); - } - - function createUnionTypeChecker(arrayOfTypeCheckers) { - if (!Array.isArray(arrayOfTypeCheckers)) { - process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; - return emptyFunction.thatReturnsNull; - } - - for (var i = 0; i < arrayOfTypeCheckers.length; i++) { - var checker = arrayOfTypeCheckers[i]; - if (typeof checker !== 'function') { - warning(false, 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 'received %s at index %s.', getPostfixForTypeWarning(checker), i); - return emptyFunction.thatReturnsNull; - } - } - - function validate(props, propName, componentName, location, propFullName) { - for (var i = 0; i < arrayOfTypeCheckers.length; i++) { - var checker = arrayOfTypeCheckers[i]; - if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { - return null; - } - } - - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); - } - return createChainableTypeChecker(validate); - } - - function createNodeChecker() { - function validate(props, propName, componentName, location, propFullName) { - if (!isNode(props[propName])) { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); - } - return null; - } - return createChainableTypeChecker(validate); - } - - function createShapeTypeChecker(shapeTypes) { - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== 'object') { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); - } - for (var key in shapeTypes) { - var checker = shapeTypes[key]; - if (!checker) { - continue; - } - var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); - if (error) { - return error; - } - } - return null; - } - return createChainableTypeChecker(validate); - } - - function createStrictShapeTypeChecker(shapeTypes) { - function validate(props, propName, componentName, location, propFullName) { - var propValue = props[propName]; - var propType = getPropType(propValue); - if (propType !== 'object') { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); - } - // We need to check all keys in case some are required but missing from - // props. - var allKeys = assign({}, props[propName], shapeTypes); - for (var key in allKeys) { - var checker = shapeTypes[key]; - if (!checker) { - return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')); - } - var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); - if (error) { - return error; - } - } - return null; - } - - return createChainableTypeChecker(validate); - } - - function isNode(propValue) { - switch (typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue)) { - case 'number': - case 'string': - case 'undefined': - return true; - case 'boolean': - return !propValue; - case 'object': - if (Array.isArray(propValue)) { - return propValue.every(isNode); - } - if (propValue === null || isValidElement(propValue)) { - return true; - } - - var iteratorFn = getIteratorFn(propValue); - if (iteratorFn) { - var iterator = iteratorFn.call(propValue); - var step; - if (iteratorFn !== propValue.entries) { - while (!(step = iterator.next()).done) { - if (!isNode(step.value)) { - return false; - } - } - } else { - // Iterator will provide entry [k,v] tuples rather than values. - while (!(step = iterator.next()).done) { - var entry = step.value; - if (entry) { - if (!isNode(entry[1])) { - return false; - } - } - } - } - } else { - return false; - } - - return true; - default: - return false; - } - } - - function isSymbol(propType, propValue) { - // Native Symbol. - if (propType === 'symbol') { - return true; - } - - // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' - if (propValue['@@toStringTag'] === 'Symbol') { - return true; - } - - // Fallback for non-spec compliant Symbols which are polyfilled. - if (typeof Symbol === 'function' && propValue instanceof Symbol) { - return true; - } - - return false; - } - - // Equivalent of `typeof` but with special handling for array and regexp. - function getPropType(propValue) { - var propType = typeof propValue === 'undefined' ? 'undefined' : _typeof(propValue); - if (Array.isArray(propValue)) { - return 'array'; - } - if (propValue instanceof RegExp) { - // Old webkits (at least until Android 4.0) return 'function' rather than - // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ - // passes PropTypes.object. - return 'object'; - } - if (isSymbol(propType, propValue)) { - return 'symbol'; - } - return propType; - } - - // This handles more types than `getPropType`. Only used for error messages. - // See `createPrimitiveTypeChecker`. - function getPreciseType(propValue) { - if (typeof propValue === 'undefined' || propValue === null) { - return '' + propValue; - } - var propType = getPropType(propValue); - if (propType === 'object') { - if (propValue instanceof Date) { - return 'date'; - } else if (propValue instanceof RegExp) { - return 'regexp'; - } - } - return propType; - } - - // Returns a string that is postfixed to a warning about an invalid type. - // For example, "undefined" or "of type array" - function getPostfixForTypeWarning(value) { - var type = getPreciseType(value); - switch (type) { - case 'array': - case 'object': - return 'an ' + type; - case 'boolean': - case 'date': - case 'regexp': - return 'a ' + type; - default: - return type; - } - } - - // Returns class name of the object, if any. - function getClassName(propValue) { - if (!propValue.constructor || !propValue.constructor.name) { - return ANONYMOUS; - } - return propValue.constructor.name; - } - - ReactPropTypes.checkPropTypes = checkPropTypes; - ReactPropTypes.PropTypes = ReactPropTypes; - - return ReactPropTypes; - }; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) - -/***/ }), -/* 390 */ -/***/ (function(module, exports) { - - "use strict"; - - /** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ - - function makeEmptyFunction(arg) { - return function () { - return arg; - }; - } - - /** - * This function accepts and discards inputs; it has no side effects. This is - * primarily useful idiomatically for overridable function endpoints which - * always need to be callable, since JS lacks a null-call idiom ala Cocoa. - */ - var emptyFunction = function emptyFunction() {}; - - emptyFunction.thatReturns = makeEmptyFunction; - emptyFunction.thatReturnsFalse = makeEmptyFunction(false); - emptyFunction.thatReturnsTrue = makeEmptyFunction(true); - emptyFunction.thatReturnsNull = makeEmptyFunction(null); - emptyFunction.thatReturnsThis = function () { - return this; - }; - emptyFunction.thatReturnsArgument = function (arg) { - return arg; - }; - - module.exports = emptyFunction; - -/***/ }), -/* 391 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - - 'use strict'; - - /** - * Use invariant() to assert state which your program assumes to be true. - * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. - * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. - */ - - var validateFormat = function validateFormat(format) {}; - - if (process.env.NODE_ENV !== 'production') { - validateFormat = function validateFormat(format) { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); - } - }; - } - - function invariant(condition, format, a, b, c, d, e, f) { - validateFormat(format); - - if (!condition) { - var error; - if (format === undefined) { - error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error(format.replace(/%s/g, function () { - return args[argIndex++]; - })); - error.name = 'Invariant Violation'; - } - - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; - } - } - - module.exports = invariant; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) - -/***/ }), -/* 392 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - - 'use strict'; - - var emptyFunction = __webpack_require__(390); - - /** - * Similar to invariant but only logs a warning if the condition is not met. - * This can be used to log issues in development environments in critical - * paths. Removing the logging code for production environments will keep the - * same logic and follow the same code paths. - */ - - var warning = emptyFunction; - - if (process.env.NODE_ENV !== 'production') { - var printWarning = function printWarning(format) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - var argIndex = 0; - var message = 'Warning: ' + format.replace(/%s/g, function () { - return args[argIndex++]; - }); - if (typeof console !== 'undefined') { - console.error(message); - } - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - throw new Error(message); - } catch (x) {} - }; - - warning = function warning(condition, format) { - if (format === undefined) { - throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); - } - - if (format.indexOf('Failed Composite propType: ') === 0) { - return; // Ignore CompositeComponent proptype check. - } - - if (!condition) { - for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { - args[_key2 - 2] = arguments[_key2]; - } - - printWarning.apply(undefined, [format].concat(args)); - } - }; - } - - module.exports = warning; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) - -/***/ }), -/* 393 */ -/***/ (function(module, exports) { - - /* - object-assign - (c) Sindre Sorhus - @license MIT - */ - - 'use strict'; - /* eslint-disable no-unused-vars */ - - var getOwnPropertySymbols = Object.getOwnPropertySymbols; - var hasOwnProperty = Object.prototype.hasOwnProperty; - var propIsEnumerable = Object.prototype.propertyIsEnumerable; - - function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } - - return Object(val); - } - - function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } - - // Detect buggy property enumeration order in older V8 versions. - - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers - test1[5] = 'de'; - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test2 = {}; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); - if (order2.join('') !== '0123456789') { - return false; - } - - // https://bugs.chromium.org/p/v8/issues/detail?id=3056 - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); - if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { - return false; - } - - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } - } - - module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; - - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); - - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } - - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } - - return to; - }; - -/***/ }), -/* 394 */ -/***/ (function(module, exports) { - - /** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - 'use strict'; - - var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; - - module.exports = ReactPropTypesSecret; - -/***/ }), -/* 395 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - 'use strict'; - - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - - if (process.env.NODE_ENV !== 'production') { - var invariant = __webpack_require__(391); - var warning = __webpack_require__(392); - var ReactPropTypesSecret = __webpack_require__(394); - var loggedTypeFailures = {}; - } - - /** - * Assert that the values match with the type specs. - * Error messages are memorized and will only be shown once. - * - * @param {object} typeSpecs Map of name to a ReactPropType - * @param {object} values Runtime values that need to be type-checked - * @param {string} location e.g. "prop", "context", "child context" - * @param {string} componentName Name of the component for error messages. - * @param {?Function} getStack Returns the component stack. - * @private - */ - function checkPropTypes(typeSpecs, values, location, componentName, getStack) { - if (process.env.NODE_ENV !== 'production') { - for (var typeSpecName in typeSpecs) { - if (typeSpecs.hasOwnProperty(typeSpecName)) { - var error; - // Prop type validation may throw. In case they do, we don't want to - // fail the render phase where it didn't fail before. So we log it. - // After these have been cleaned up, we'll let them throw. - try { - // This is intentionally an invariant that gets caught. It's the same - // behavior as without this statement except with a better message. - invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, _typeof(typeSpecs[typeSpecName])); - error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); - } catch (ex) { - error = ex; - } - warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error === 'undefined' ? 'undefined' : _typeof(error)); - if (error instanceof Error && !(error.message in loggedTypeFailures)) { - // Only monitor this failure once because there tends to be a lot of the - // same error. - loggedTypeFailures[error.message] = true; - - var stack = getStack ? getStack() : ''; - - warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); - } - } - } - } - } - - module.exports = checkPropTypes; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) - -/***/ }), -/* 396 */ -/***/ (function(module, exports, __webpack_require__) { - - /** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - 'use strict'; - - var emptyFunction = __webpack_require__(390); - var invariant = __webpack_require__(391); - var ReactPropTypesSecret = __webpack_require__(394); - - module.exports = function () { - function shim(props, propName, componentName, location, propFullName, secret) { - if (secret === ReactPropTypesSecret) { - // It is still safe when called from React. - return; - } - invariant(false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types'); - }; - shim.isRequired = shim; - function getShim() { - return shim; - }; - // Important! - // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. - var ReactPropTypes = { - array: shim, - bool: shim, - func: shim, - number: shim, - object: shim, - string: shim, - symbol: shim, - - any: shim, - arrayOf: getShim, - element: shim, - instanceOf: getShim, - node: shim, - objectOf: getShim, - oneOf: getShim, - oneOfType: getShim, - shape: getShim, - exact: getShim - }; - - ReactPropTypes.checkPropTypes = emptyFunction; - ReactPropTypes.PropTypes = ReactPropTypes; - - return ReactPropTypes; - }; - -/***/ }), -/* 397 */ -/***/ (function(module, exports, __webpack_require__) { - - /** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - - 'use strict'; - - var React = __webpack_require__(1); - var factory = __webpack_require__(398); - - if (typeof React === 'undefined') { - throw Error('create-react-class could not find the React object. If you are using script tags, ' + 'make sure that React is being loaded before create-react-class.'); - } - - // Hack to grab NoopUpdateQueue from isomorphic React - var ReactNoopUpdateQueue = new React.Component().updater; - - module.exports = factory(React.Component, React.isValidElement, ReactNoopUpdateQueue); - -/***/ }), -/* 398 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - - 'use strict'; - - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - - var _assign = __webpack_require__(393); - - var emptyObject = __webpack_require__(399); - var _invariant = __webpack_require__(400); - - if (process.env.NODE_ENV !== 'production') { - var warning = __webpack_require__(401); - } - - var MIXINS_KEY = 'mixins'; - - // Helper function to allow the creation of anonymous functions which do not - // have .name set to the name of the variable being assigned to. - function identity(fn) { - return fn; - } - - var ReactPropTypeLocationNames; - if (process.env.NODE_ENV !== 'production') { - ReactPropTypeLocationNames = { - prop: 'prop', - context: 'context', - childContext: 'child context' - }; - } else { - ReactPropTypeLocationNames = {}; - } - - function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) { - /** - * Policies that describe methods in `ReactClassInterface`. - */ - - var injectedMixins = []; - - /** - * Composite components are higher-level components that compose other composite - * or host components. - * - * To create a new type of `ReactClass`, pass a specification of - * your new class to `React.createClass`. The only requirement of your class - * specification is that you implement a `render` method. - * - * var MyComponent = React.createClass({ - * render: function() { - * return
    Hello World
    ; - * } - * }); - * - * The class specification supports a specific protocol of methods that have - * special meaning (e.g. `render`). See `ReactClassInterface` for - * more the comprehensive protocol. Any other properties and methods in the - * class specification will be available on the prototype. - * - * @interface ReactClassInterface - * @internal - */ - var ReactClassInterface = { - /** - * An array of Mixin objects to include when defining your component. - * - * @type {array} - * @optional - */ - mixins: 'DEFINE_MANY', - - /** - * An object containing properties and methods that should be defined on - * the component's constructor instead of its prototype (static methods). - * - * @type {object} - * @optional - */ - statics: 'DEFINE_MANY', - - /** - * Definition of prop types for this component. - * - * @type {object} - * @optional - */ - propTypes: 'DEFINE_MANY', - - /** - * Definition of context types for this component. - * - * @type {object} - * @optional - */ - contextTypes: 'DEFINE_MANY', - - /** - * Definition of context types this component sets for its children. - * - * @type {object} - * @optional - */ - childContextTypes: 'DEFINE_MANY', - - // ==== Definition methods ==== - - /** - * Invoked when the component is mounted. Values in the mapping will be set on - * `this.props` if that prop is not specified (i.e. using an `in` check). - * - * This method is invoked before `getInitialState` and therefore cannot rely - * on `this.state` or use `this.setState`. - * - * @return {object} - * @optional - */ - getDefaultProps: 'DEFINE_MANY_MERGED', - - /** - * Invoked once before the component is mounted. The return value will be used - * as the initial value of `this.state`. - * - * getInitialState: function() { - * return { - * isOn: false, - * fooBaz: new BazFoo() - * } - * } - * - * @return {object} - * @optional - */ - getInitialState: 'DEFINE_MANY_MERGED', - - /** - * @return {object} - * @optional - */ - getChildContext: 'DEFINE_MANY_MERGED', - - /** - * Uses props from `this.props` and state from `this.state` to render the - * structure of the component. - * - * No guarantees are made about when or how often this method is invoked, so - * it must not have side effects. - * - * render: function() { - * var name = this.props.name; - * return
    Hello, {name}!
    ; - * } - * - * @return {ReactComponent} - * @required - */ - render: 'DEFINE_ONCE', - - // ==== Delegate methods ==== - - /** - * Invoked when the component is initially created and about to be mounted. - * This may have side effects, but any external subscriptions or data created - * by this method must be cleaned up in `componentWillUnmount`. - * - * @optional - */ - componentWillMount: 'DEFINE_MANY', - - /** - * Invoked when the component has been mounted and has a DOM representation. - * However, there is no guarantee that the DOM node is in the document. - * - * Use this as an opportunity to operate on the DOM when the component has - * been mounted (initialized and rendered) for the first time. - * - * @param {DOMElement} rootNode DOM element representing the component. - * @optional - */ - componentDidMount: 'DEFINE_MANY', - - /** - * Invoked before the component receives new props. - * - * Use this as an opportunity to react to a prop transition by updating the - * state using `this.setState`. Current props are accessed via `this.props`. - * - * componentWillReceiveProps: function(nextProps, nextContext) { - * this.setState({ - * likesIncreasing: nextProps.likeCount > this.props.likeCount - * }); - * } - * - * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop - * transition may cause a state change, but the opposite is not true. If you - * need it, you are probably looking for `componentWillUpdate`. - * - * @param {object} nextProps - * @optional - */ - componentWillReceiveProps: 'DEFINE_MANY', - - /** - * Invoked while deciding if the component should be updated as a result of - * receiving new props, state and/or context. - * - * Use this as an opportunity to `return false` when you're certain that the - * transition to the new props/state/context will not require a component - * update. - * - * shouldComponentUpdate: function(nextProps, nextState, nextContext) { - * return !equal(nextProps, this.props) || - * !equal(nextState, this.state) || - * !equal(nextContext, this.context); - * } - * - * @param {object} nextProps - * @param {?object} nextState - * @param {?object} nextContext - * @return {boolean} True if the component should update. - * @optional - */ - shouldComponentUpdate: 'DEFINE_ONCE', - - /** - * Invoked when the component is about to update due to a transition from - * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` - * and `nextContext`. - * - * Use this as an opportunity to perform preparation before an update occurs. - * - * NOTE: You **cannot** use `this.setState()` in this method. - * - * @param {object} nextProps - * @param {?object} nextState - * @param {?object} nextContext - * @param {ReactReconcileTransaction} transaction - * @optional - */ - componentWillUpdate: 'DEFINE_MANY', - - /** - * Invoked when the component's DOM representation has been updated. - * - * Use this as an opportunity to operate on the DOM when the component has - * been updated. - * - * @param {object} prevProps - * @param {?object} prevState - * @param {?object} prevContext - * @param {DOMElement} rootNode DOM element representing the component. - * @optional - */ - componentDidUpdate: 'DEFINE_MANY', - - /** - * Invoked when the component is about to be removed from its parent and have - * its DOM representation destroyed. - * - * Use this as an opportunity to deallocate any external resources. - * - * NOTE: There is no `componentDidUnmount` since your component will have been - * destroyed by that point. - * - * @optional - */ - componentWillUnmount: 'DEFINE_MANY', - - /** - * Replacement for (deprecated) `componentWillMount`. - * - * @optional - */ - UNSAFE_componentWillMount: 'DEFINE_MANY', - - /** - * Replacement for (deprecated) `componentWillReceiveProps`. - * - * @optional - */ - UNSAFE_componentWillReceiveProps: 'DEFINE_MANY', - - /** - * Replacement for (deprecated) `componentWillUpdate`. - * - * @optional - */ - UNSAFE_componentWillUpdate: 'DEFINE_MANY', - - // ==== Advanced methods ==== - - /** - * Updates the component's currently mounted DOM representation. - * - * By default, this implements React's rendering and reconciliation algorithm. - * Sophisticated clients may wish to override this. - * - * @param {ReactReconcileTransaction} transaction - * @internal - * @overridable - */ - updateComponent: 'OVERRIDE_BASE' - }; - - /** - * Similar to ReactClassInterface but for static methods. - */ - var ReactClassStaticInterface = { - /** - * This method is invoked after a component is instantiated and when it - * receives new props. Return an object to update state in response to - * prop changes. Return null to indicate no change to state. - * - * If an object is returned, its keys will be merged into the existing state. - * - * @return {object || null} - * @optional - */ - getDerivedStateFromProps: 'DEFINE_MANY_MERGED' - }; - - /** - * Mapping from class specification keys to special processing functions. - * - * Although these are declared like instance properties in the specification - * when defining classes using `React.createClass`, they are actually static - * and are accessible on the constructor instead of the prototype. Despite - * being static, they must be defined outside of the "statics" key under - * which all other static methods are defined. - */ - var RESERVED_SPEC_KEYS = { - displayName: function displayName(Constructor, _displayName) { - Constructor.displayName = _displayName; - }, - mixins: function mixins(Constructor, _mixins) { - if (_mixins) { - for (var i = 0; i < _mixins.length; i++) { - mixSpecIntoComponent(Constructor, _mixins[i]); - } - } - }, - childContextTypes: function childContextTypes(Constructor, _childContextTypes) { - if (process.env.NODE_ENV !== 'production') { - validateTypeDef(Constructor, _childContextTypes, 'childContext'); - } - Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, _childContextTypes); - }, - contextTypes: function contextTypes(Constructor, _contextTypes) { - if (process.env.NODE_ENV !== 'production') { - validateTypeDef(Constructor, _contextTypes, 'context'); - } - Constructor.contextTypes = _assign({}, Constructor.contextTypes, _contextTypes); - }, - /** - * Special case getDefaultProps which should move into statics but requires - * automatic merging. - */ - getDefaultProps: function getDefaultProps(Constructor, _getDefaultProps) { - if (Constructor.getDefaultProps) { - Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, _getDefaultProps); - } else { - Constructor.getDefaultProps = _getDefaultProps; - } - }, - propTypes: function propTypes(Constructor, _propTypes) { - if (process.env.NODE_ENV !== 'production') { - validateTypeDef(Constructor, _propTypes, 'prop'); - } - Constructor.propTypes = _assign({}, Constructor.propTypes, _propTypes); - }, - statics: function statics(Constructor, _statics) { - mixStaticSpecIntoComponent(Constructor, _statics); - }, - autobind: function autobind() {} - }; - - function validateTypeDef(Constructor, typeDef, location) { - for (var propName in typeDef) { - if (typeDef.hasOwnProperty(propName)) { - // use a warning instead of an _invariant so components - // don't show up in prod but only in __DEV__ - if (process.env.NODE_ENV !== 'production') { - warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName); - } - } - } - } - - function validateMethodOverride(isAlreadyDefined, name) { - var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; - - // Disallow overriding of base class methods unless explicitly allowed. - if (ReactClassMixin.hasOwnProperty(name)) { - _invariant(specPolicy === 'OVERRIDE_BASE', 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name); - } - - // Disallow defining methods more than once unless explicitly allowed. - if (isAlreadyDefined) { - _invariant(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED', 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name); - } - } - - /** - * Mixin helper which handles policy validation and reserved - * specification keys when building React classes. - */ - function mixSpecIntoComponent(Constructor, spec) { - if (!spec) { - if (process.env.NODE_ENV !== 'production') { - var typeofSpec = typeof spec === 'undefined' ? 'undefined' : _typeof(spec); - var isMixinValid = typeofSpec === 'object' && spec !== null; - - if (process.env.NODE_ENV !== 'production') { - warning(isMixinValid, "%s: You're attempting to include a mixin that is either null " + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec); - } - } - - return; - } - - _invariant(typeof spec !== 'function', "ReactClass: You're attempting to " + 'use a component class or function as a mixin. Instead, just use a ' + 'regular object.'); - _invariant(!isValidElement(spec), "ReactClass: You're attempting to " + 'use a component as a mixin. Instead, just use a regular object.'); - - var proto = Constructor.prototype; - var autoBindPairs = proto.__reactAutoBindPairs; - - // By handling mixins before any other properties, we ensure the same - // chaining order is applied to methods with DEFINE_MANY policy, whether - // mixins are listed before or after these methods in the spec. - if (spec.hasOwnProperty(MIXINS_KEY)) { - RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); - } - - for (var name in spec) { - if (!spec.hasOwnProperty(name)) { - continue; - } - - if (name === MIXINS_KEY) { - // We have already handled mixins in a special case above. - continue; - } - - var property = spec[name]; - var isAlreadyDefined = proto.hasOwnProperty(name); - validateMethodOverride(isAlreadyDefined, name); - - if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { - RESERVED_SPEC_KEYS[name](Constructor, property); - } else { - // Setup methods on prototype: - // The following member methods should not be automatically bound: - // 1. Expected ReactClass methods (in the "interface"). - // 2. Overridden methods (that were mixed in). - var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); - var isFunction = typeof property === 'function'; - var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; - - if (shouldAutoBind) { - autoBindPairs.push(name, property); - proto[name] = property; - } else { - if (isAlreadyDefined) { - var specPolicy = ReactClassInterface[name]; - - // These cases should already be caught by validateMethodOverride. - _invariant(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY'), 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name); - - // For methods which are defined more than once, call the existing - // methods before calling the new property, merging if appropriate. - if (specPolicy === 'DEFINE_MANY_MERGED') { - proto[name] = createMergedResultFunction(proto[name], property); - } else if (specPolicy === 'DEFINE_MANY') { - proto[name] = createChainedFunction(proto[name], property); - } - } else { - proto[name] = property; - if (process.env.NODE_ENV !== 'production') { - // Add verbose displayName to the function, which helps when looking - // at profiling tools. - if (typeof property === 'function' && spec.displayName) { - proto[name].displayName = spec.displayName + '_' + name; - } - } - } - } - } - } - } - - function mixStaticSpecIntoComponent(Constructor, statics) { - if (!statics) { - return; - } - - for (var name in statics) { - var property = statics[name]; - if (!statics.hasOwnProperty(name)) { - continue; - } - - var isReserved = name in RESERVED_SPEC_KEYS; - _invariant(!isReserved, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name); - - var isAlreadyDefined = name in Constructor; - if (isAlreadyDefined) { - var specPolicy = ReactClassStaticInterface.hasOwnProperty(name) ? ReactClassStaticInterface[name] : null; - - _invariant(specPolicy === 'DEFINE_MANY_MERGED', 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name); - - Constructor[name] = createMergedResultFunction(Constructor[name], property); - - return; - } - - Constructor[name] = property; - } - } - - /** - * Merge two objects, but throw if both contain the same key. - * - * @param {object} one The first object, which is mutated. - * @param {object} two The second object - * @return {object} one after it has been mutated to contain everything in two. - */ - function mergeIntoWithNoDuplicateKeys(one, two) { - _invariant(one && two && (typeof one === 'undefined' ? 'undefined' : _typeof(one)) === 'object' && (typeof two === 'undefined' ? 'undefined' : _typeof(two)) === 'object', 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.'); - - for (var key in two) { - if (two.hasOwnProperty(key)) { - _invariant(one[key] === undefined, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key); - one[key] = two[key]; - } - } - return one; - } - - /** - * Creates a function that invokes two functions and merges their return values. - * - * @param {function} one Function to invoke first. - * @param {function} two Function to invoke second. - * @return {function} Function that invokes the two argument functions. - * @private - */ - function createMergedResultFunction(one, two) { - return function mergedResult() { - var a = one.apply(this, arguments); - var b = two.apply(this, arguments); - if (a == null) { - return b; - } else if (b == null) { - return a; - } - var c = {}; - mergeIntoWithNoDuplicateKeys(c, a); - mergeIntoWithNoDuplicateKeys(c, b); - return c; - }; - } - - /** - * Creates a function that invokes two functions and ignores their return vales. - * - * @param {function} one Function to invoke first. - * @param {function} two Function to invoke second. - * @return {function} Function that invokes the two argument functions. - * @private - */ - function createChainedFunction(one, two) { - return function chainedFunction() { - one.apply(this, arguments); - two.apply(this, arguments); - }; - } - - /** - * Binds a method to the component. - * - * @param {object} component Component whose method is going to be bound. - * @param {function} method Method to be bound. - * @return {function} The bound method. - */ - function bindAutoBindMethod(component, method) { - var boundMethod = method.bind(component); - if (process.env.NODE_ENV !== 'production') { - boundMethod.__reactBoundContext = component; - boundMethod.__reactBoundMethod = method; - boundMethod.__reactBoundArguments = null; - var componentName = component.constructor.displayName; - var _bind = boundMethod.bind; - boundMethod.bind = function (newThis) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - // User is trying to bind() an autobound method; we effectively will - // ignore the value of "this" that the user is trying to use, so - // let's warn. - if (newThis !== component && newThis !== null) { - if (process.env.NODE_ENV !== 'production') { - warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName); - } - } else if (!args.length) { - if (process.env.NODE_ENV !== 'production') { - warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName); - } - return boundMethod; - } - var reboundMethod = _bind.apply(boundMethod, arguments); - reboundMethod.__reactBoundContext = component; - reboundMethod.__reactBoundMethod = method; - reboundMethod.__reactBoundArguments = args; - return reboundMethod; - }; - } - return boundMethod; - } - - /** - * Binds all auto-bound methods in a component. - * - * @param {object} component Component whose method is going to be bound. - */ - function bindAutoBindMethods(component) { - var pairs = component.__reactAutoBindPairs; - for (var i = 0; i < pairs.length; i += 2) { - var autoBindKey = pairs[i]; - var method = pairs[i + 1]; - component[autoBindKey] = bindAutoBindMethod(component, method); - } - } - - var IsMountedPreMixin = { - componentDidMount: function componentDidMount() { - this.__isMounted = true; - } - }; - - var IsMountedPostMixin = { - componentWillUnmount: function componentWillUnmount() { - this.__isMounted = false; - } - }; - - /** - * Add more to the ReactClass base class. These are all legacy features and - * therefore not already part of the modern ReactComponent. - */ - var ReactClassMixin = { - /** - * TODO: This will be deprecated because state should always keep a consistent - * type signature and the only use case for this, is to avoid that. - */ - replaceState: function replaceState(newState, callback) { - this.updater.enqueueReplaceState(this, newState, callback); - }, - - /** - * Checks whether or not this composite component is mounted. - * @return {boolean} True if mounted, false otherwise. - * @protected - * @final - */ - isMounted: function isMounted() { - if (process.env.NODE_ENV !== 'production') { - warning(this.__didWarnIsMounted, '%s: isMounted is deprecated. Instead, make sure to clean up ' + 'subscriptions and pending requests in componentWillUnmount to ' + 'prevent memory leaks.', this.constructor && this.constructor.displayName || this.name || 'Component'); - this.__didWarnIsMounted = true; - } - return !!this.__isMounted; - } - }; - - var ReactClassComponent = function ReactClassComponent() {}; - _assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); - - /** - * Creates a composite component class given a class specification. - * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass - * - * @param {object} spec Class specification (which must define `render`). - * @return {function} Component constructor function. - * @public - */ - function createClass(spec) { - // To keep our warnings more understandable, we'll use a little hack here to - // ensure that Constructor.name !== 'Constructor'. This makes sure we don't - // unnecessarily identify a class without displayName as 'Constructor'. - var Constructor = identity(function (props, context, updater) { - // This constructor gets overridden by mocks. The argument is used - // by mocks to assert on what gets mounted. - - if (process.env.NODE_ENV !== 'production') { - warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory'); - } - - // Wire up auto-binding - if (this.__reactAutoBindPairs.length) { - bindAutoBindMethods(this); - } - - this.props = props; - this.context = context; - this.refs = emptyObject; - this.updater = updater || ReactNoopUpdateQueue; - - this.state = null; - - // ReactClasses doesn't have constructors. Instead, they use the - // getInitialState and componentWillMount methods for initialization. - - var initialState = this.getInitialState ? this.getInitialState() : null; - if (process.env.NODE_ENV !== 'production') { - // We allow auto-mocks to proceed as if they're returning null. - if (initialState === undefined && this.getInitialState._isMockFunction) { - // This is probably bad practice. Consider warning here and - // deprecating this convenience. - initialState = null; - } - } - _invariant((typeof initialState === 'undefined' ? 'undefined' : _typeof(initialState)) === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent'); - - this.state = initialState; - }); - Constructor.prototype = new ReactClassComponent(); - Constructor.prototype.constructor = Constructor; - Constructor.prototype.__reactAutoBindPairs = []; - - injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); - - mixSpecIntoComponent(Constructor, IsMountedPreMixin); - mixSpecIntoComponent(Constructor, spec); - mixSpecIntoComponent(Constructor, IsMountedPostMixin); - - // Initialize the defaultProps property after all mixins have been merged. - if (Constructor.getDefaultProps) { - Constructor.defaultProps = Constructor.getDefaultProps(); - } - - if (process.env.NODE_ENV !== 'production') { - // This is a tag to indicate that the use of these method names is ok, - // since it's used with createClass. If it's not, then it's likely a - // mistake so we'll warn you to use the static property, property - // initializer or constructor respectively. - if (Constructor.getDefaultProps) { - Constructor.getDefaultProps.isReactClassApproved = {}; - } - if (Constructor.prototype.getInitialState) { - Constructor.prototype.getInitialState.isReactClassApproved = {}; - } - } - - _invariant(Constructor.prototype.render, 'createClass(...): Class specification must implement a `render` method.'); - - if (process.env.NODE_ENV !== 'production') { - warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component'); - warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component'); - warning(!Constructor.prototype.UNSAFE_componentWillRecieveProps, '%s has a method called UNSAFE_componentWillRecieveProps(). ' + 'Did you mean UNSAFE_componentWillReceiveProps()?', spec.displayName || 'A component'); - } - - // Reduce time spent doing lookups by setting these on the prototype. - for (var methodName in ReactClassInterface) { - if (!Constructor.prototype[methodName]) { - Constructor.prototype[methodName] = null; - } - } - - return Constructor; - } - - return createClass; - } - - module.exports = factory; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) - -/***/ }), -/* 399 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - - 'use strict'; - - var emptyObject = {}; - - if (process.env.NODE_ENV !== 'production') { - Object.freeze(emptyObject); - } - - module.exports = emptyObject; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) - -/***/ }), -/* 400 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - - 'use strict'; - - /** - * Use invariant() to assert state which your program assumes to be true. - * - * Provide sprintf-style format (only %s is supported) and arguments - * to provide information about what broke and what you were - * expecting. - * - * The invariant message will be stripped in production, but the invariant - * will remain to ensure logic does not differ in production. - */ - - var validateFormat = function validateFormat(format) {}; - - if (process.env.NODE_ENV !== 'production') { - validateFormat = function validateFormat(format) { - if (format === undefined) { - throw new Error('invariant requires an error message argument'); - } - }; - } - - function invariant(condition, format, a, b, c, d, e, f) { - validateFormat(format); - - if (!condition) { - var error; - if (format === undefined) { - error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); - } else { - var args = [a, b, c, d, e, f]; - var argIndex = 0; - error = new Error(format.replace(/%s/g, function () { - return args[argIndex++]; - })); - error.name = 'Invariant Violation'; - } - - error.framesToPop = 1; // we don't care about invariant's own frame - throw error; - } - } - - module.exports = invariant; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) - -/***/ }), -/* 401 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {/** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - - 'use strict'; - - var emptyFunction = __webpack_require__(402); - - /** - * Similar to invariant but only logs a warning if the condition is not met. - * This can be used to log issues in development environments in critical - * paths. Removing the logging code for production environments will keep the - * same logic and follow the same code paths. - */ - - var warning = emptyFunction; - - if (process.env.NODE_ENV !== 'production') { - var printWarning = function printWarning(format) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - var argIndex = 0; - var message = 'Warning: ' + format.replace(/%s/g, function () { - return args[argIndex++]; - }); - if (typeof console !== 'undefined') { - console.error(message); - } - try { - // --- Welcome to debugging React --- - // This error was thrown as a convenience so that you can use this stack - // to find the callsite that caused this warning to fire. - throw new Error(message); - } catch (x) {} - }; - - warning = function warning(condition, format) { - if (format === undefined) { - throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); - } - - if (format.indexOf('Failed Composite propType: ') === 0) { - return; // Ignore CompositeComponent proptype check. - } - - if (!condition) { - for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { - args[_key2 - 2] = arguments[_key2]; - } - - printWarning.apply(undefined, [format].concat(args)); - } - }; - } - - module.exports = warning; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) - -/***/ }), -/* 402 */ -/***/ (function(module, exports) { - - "use strict"; - - /** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ - - function makeEmptyFunction(arg) { - return function () { - return arg; - }; - } - - /** - * This function accepts and discards inputs; it has no side effects. This is - * primarily useful idiomatically for overridable function endpoints which - * always need to be callable, since JS lacks a null-call idiom ala Cocoa. - */ - var emptyFunction = function emptyFunction() {}; - - emptyFunction.thatReturns = makeEmptyFunction; - emptyFunction.thatReturnsFalse = makeEmptyFunction(false); - emptyFunction.thatReturnsTrue = makeEmptyFunction(true); - emptyFunction.thatReturnsNull = makeEmptyFunction(null); - emptyFunction.thatReturnsThis = function () { - return this; - }; - emptyFunction.thatReturnsArgument = function (arg) { - return arg; - }; - - module.exports = emptyFunction; - -/***/ }), -/* 403 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i];for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - }return target; - }; - - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { 'default': obj }; - } - - var _mapToZero = __webpack_require__(381); - - var _mapToZero2 = _interopRequireDefault(_mapToZero); - - var _stripStyle = __webpack_require__(382); - - var _stripStyle2 = _interopRequireDefault(_stripStyle); - - var _stepper3 = __webpack_require__(383); - - var _stepper4 = _interopRequireDefault(_stepper3); - - var _performanceNow = __webpack_require__(384); - - var _performanceNow2 = _interopRequireDefault(_performanceNow); - - var _raf = __webpack_require__(385); - - var _raf2 = _interopRequireDefault(_raf); - - var _shouldStopAnimation = __webpack_require__(387); - - var _shouldStopAnimation2 = _interopRequireDefault(_shouldStopAnimation); - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - var _propTypes = __webpack_require__(388); - - var _propTypes2 = _interopRequireDefault(_propTypes); - - var _createReactClass = __webpack_require__(397); - - var _createReactClass2 = _interopRequireDefault(_createReactClass); - - var msPerFrame = 1000 / 60; - - function shouldStopAnimationAll(currentStyles, styles, currentVelocities) { - for (var i = 0; i < currentStyles.length; i++) { - if (!_shouldStopAnimation2['default'](currentStyles[i], styles[i], currentVelocities[i])) { - return false; - } - } - return true; - } - - var StaggeredMotion = _createReactClass2['default']({ - propTypes: { - // TOOD: warn against putting a config in here - defaultStyles: _propTypes2['default'].arrayOf(_propTypes2['default'].objectOf(_propTypes2['default'].number)), - styles: _propTypes2['default'].func.isRequired, - children: _propTypes2['default'].func.isRequired - }, - - getInitialState: function getInitialState() { - var _props = this.props; - var defaultStyles = _props.defaultStyles; - var styles = _props.styles; - - var currentStyles = defaultStyles || styles().map(_stripStyle2['default']); - var currentVelocities = currentStyles.map(function (currentStyle) { - return _mapToZero2['default'](currentStyle); - }); - return { - currentStyles: currentStyles, - currentVelocities: currentVelocities, - lastIdealStyles: currentStyles, - lastIdealVelocities: currentVelocities - }; - }, - - animationID: null, - prevTime: 0, - accumulatedTime: 0, - // it's possible that currentStyle's value is stale: if props is immediately - // changed from 0 to 400 to spring(0) again, the async currentStyle is still - // at 0 (didn't have time to tick and interpolate even once). If we naively - // compare currentStyle with destVal it'll be 0 === 0 (no animation, stop). - // In reality currentStyle should be 400 - unreadPropStyles: null, - // after checking for unreadPropStyles != null, we manually go set the - // non-interpolating values (those that are a number, without a spring - // config) - clearUnreadPropStyle: function clearUnreadPropStyle(unreadPropStyles) { - var _state = this.state; - var currentStyles = _state.currentStyles; - var currentVelocities = _state.currentVelocities; - var lastIdealStyles = _state.lastIdealStyles; - var lastIdealVelocities = _state.lastIdealVelocities; - - var someDirty = false; - for (var i = 0; i < unreadPropStyles.length; i++) { - var unreadPropStyle = unreadPropStyles[i]; - var dirty = false; - - for (var key in unreadPropStyle) { - if (!Object.prototype.hasOwnProperty.call(unreadPropStyle, key)) { - continue; - } - - var styleValue = unreadPropStyle[key]; - if (typeof styleValue === 'number') { - if (!dirty) { - dirty = true; - someDirty = true; - currentStyles[i] = _extends({}, currentStyles[i]); - currentVelocities[i] = _extends({}, currentVelocities[i]); - lastIdealStyles[i] = _extends({}, lastIdealStyles[i]); - lastIdealVelocities[i] = _extends({}, lastIdealVelocities[i]); - } - currentStyles[i][key] = styleValue; - currentVelocities[i][key] = 0; - lastIdealStyles[i][key] = styleValue; - lastIdealVelocities[i][key] = 0; - } - } - } - - if (someDirty) { - this.setState({ currentStyles: currentStyles, currentVelocities: currentVelocities, lastIdealStyles: lastIdealStyles, lastIdealVelocities: lastIdealVelocities }); - } - }, - - startAnimationIfNecessary: function startAnimationIfNecessary() { - var _this = this; - - // TODO: when config is {a: 10} and dest is {a: 10} do we raf once and - // call cb? No, otherwise accidental parent rerender causes cb trigger - this.animationID = _raf2['default'](function (timestamp) { - var destStyles = _this.props.styles(_this.state.lastIdealStyles); - - // check if we need to animate in the first place - if (shouldStopAnimationAll(_this.state.currentStyles, destStyles, _this.state.currentVelocities)) { - // no need to cancel animationID here; shouldn't have any in flight - _this.animationID = null; - _this.accumulatedTime = 0; - return; - } - - var currentTime = timestamp || _performanceNow2['default'](); - var timeDelta = currentTime - _this.prevTime; - _this.prevTime = currentTime; - _this.accumulatedTime = _this.accumulatedTime + timeDelta; - // more than 10 frames? prolly switched browser tab. Restart - if (_this.accumulatedTime > msPerFrame * 10) { - _this.accumulatedTime = 0; - } - - if (_this.accumulatedTime === 0) { - // no need to cancel animationID here; shouldn't have any in flight - _this.animationID = null; - _this.startAnimationIfNecessary(); - return; - } - - var currentFrameCompletion = (_this.accumulatedTime - Math.floor(_this.accumulatedTime / msPerFrame) * msPerFrame) / msPerFrame; - var framesToCatchUp = Math.floor(_this.accumulatedTime / msPerFrame); - - var newLastIdealStyles = []; - var newLastIdealVelocities = []; - var newCurrentStyles = []; - var newCurrentVelocities = []; - - for (var i = 0; i < destStyles.length; i++) { - var destStyle = destStyles[i]; - var newCurrentStyle = {}; - var newCurrentVelocity = {}; - var newLastIdealStyle = {}; - var newLastIdealVelocity = {}; - - for (var key in destStyle) { - if (!Object.prototype.hasOwnProperty.call(destStyle, key)) { - continue; - } - - var styleValue = destStyle[key]; - if (typeof styleValue === 'number') { - newCurrentStyle[key] = styleValue; - newCurrentVelocity[key] = 0; - newLastIdealStyle[key] = styleValue; - newLastIdealVelocity[key] = 0; - } else { - var newLastIdealStyleValue = _this.state.lastIdealStyles[i][key]; - var newLastIdealVelocityValue = _this.state.lastIdealVelocities[i][key]; - for (var j = 0; j < framesToCatchUp; j++) { - var _stepper = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision); - - newLastIdealStyleValue = _stepper[0]; - newLastIdealVelocityValue = _stepper[1]; - } - - var _stepper2 = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision); - - var nextIdealX = _stepper2[0]; - var nextIdealV = _stepper2[1]; - - newCurrentStyle[key] = newLastIdealStyleValue + (nextIdealX - newLastIdealStyleValue) * currentFrameCompletion; - newCurrentVelocity[key] = newLastIdealVelocityValue + (nextIdealV - newLastIdealVelocityValue) * currentFrameCompletion; - newLastIdealStyle[key] = newLastIdealStyleValue; - newLastIdealVelocity[key] = newLastIdealVelocityValue; - } - } - - newCurrentStyles[i] = newCurrentStyle; - newCurrentVelocities[i] = newCurrentVelocity; - newLastIdealStyles[i] = newLastIdealStyle; - newLastIdealVelocities[i] = newLastIdealVelocity; - } - - _this.animationID = null; - // the amount we're looped over above - _this.accumulatedTime -= framesToCatchUp * msPerFrame; - - _this.setState({ - currentStyles: newCurrentStyles, - currentVelocities: newCurrentVelocities, - lastIdealStyles: newLastIdealStyles, - lastIdealVelocities: newLastIdealVelocities - }); - - _this.unreadPropStyles = null; - - _this.startAnimationIfNecessary(); - }); - }, - - componentDidMount: function componentDidMount() { - this.prevTime = _performanceNow2['default'](); - this.startAnimationIfNecessary(); - }, - - componentWillReceiveProps: function componentWillReceiveProps(props) { - if (this.unreadPropStyles != null) { - // previous props haven't had the chance to be set yet; set them here - this.clearUnreadPropStyle(this.unreadPropStyles); - } - - this.unreadPropStyles = props.styles(this.state.lastIdealStyles); - if (this.animationID == null) { - this.prevTime = _performanceNow2['default'](); - this.startAnimationIfNecessary(); - } - }, - - componentWillUnmount: function componentWillUnmount() { - if (this.animationID != null) { - _raf2['default'].cancel(this.animationID); - this.animationID = null; - } - }, - - render: function render() { - var renderedChildren = this.props.children(this.state.currentStyles); - return renderedChildren && _react2['default'].Children.only(renderedChildren); - } - }); - - exports['default'] = StaggeredMotion; - module.exports = exports['default']; - -/***/ }), -/* 404 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i];for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - }return target; - }; - - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { 'default': obj }; - } - - var _mapToZero = __webpack_require__(381); - - var _mapToZero2 = _interopRequireDefault(_mapToZero); - - var _stripStyle = __webpack_require__(382); - - var _stripStyle2 = _interopRequireDefault(_stripStyle); - - var _stepper3 = __webpack_require__(383); - - var _stepper4 = _interopRequireDefault(_stepper3); - - var _mergeDiff = __webpack_require__(405); - - var _mergeDiff2 = _interopRequireDefault(_mergeDiff); - - var _performanceNow = __webpack_require__(384); - - var _performanceNow2 = _interopRequireDefault(_performanceNow); - - var _raf = __webpack_require__(385); - - var _raf2 = _interopRequireDefault(_raf); - - var _shouldStopAnimation = __webpack_require__(387); - - var _shouldStopAnimation2 = _interopRequireDefault(_shouldStopAnimation); - - var _react = __webpack_require__(1); - - var _react2 = _interopRequireDefault(_react); - - var _propTypes = __webpack_require__(388); - - var _propTypes2 = _interopRequireDefault(_propTypes); - - var _createReactClass = __webpack_require__(397); - - var _createReactClass2 = _interopRequireDefault(_createReactClass); - - var msPerFrame = 1000 / 60; - - // the children function & (potential) styles function asks as param an - // Array, where each TransitionPlainStyle is of the format - // {key: string, data?: any, style: PlainStyle}. However, the way we keep - // internal states doesn't contain such a data structure (check the state and - // TransitionMotionState). So when children function and others ask for such - // data we need to generate them on the fly by combining mergedPropsStyles and - // currentStyles/lastIdealStyles - function rehydrateStyles(mergedPropsStyles, unreadPropStyles, plainStyles) { - // Copy the value to a `const` so that Flow understands that the const won't - // change and will be non-nullable in the callback below. - var cUnreadPropStyles = unreadPropStyles; - if (cUnreadPropStyles == null) { - return mergedPropsStyles.map(function (mergedPropsStyle, i) { - return { - key: mergedPropsStyle.key, - data: mergedPropsStyle.data, - style: plainStyles[i] - }; - }); - } - return mergedPropsStyles.map(function (mergedPropsStyle, i) { - for (var j = 0; j < cUnreadPropStyles.length; j++) { - if (cUnreadPropStyles[j].key === mergedPropsStyle.key) { - return { - key: cUnreadPropStyles[j].key, - data: cUnreadPropStyles[j].data, - style: plainStyles[i] - }; - } - } - return { key: mergedPropsStyle.key, data: mergedPropsStyle.data, style: plainStyles[i] }; - }); - } - - function shouldStopAnimationAll(currentStyles, destStyles, currentVelocities, mergedPropsStyles) { - if (mergedPropsStyles.length !== destStyles.length) { - return false; - } - - for (var i = 0; i < mergedPropsStyles.length; i++) { - if (mergedPropsStyles[i].key !== destStyles[i].key) { - return false; - } - } - - // we have the invariant that mergedPropsStyles and - // currentStyles/currentVelocities/last* are synced in terms of cells, see - // mergeAndSync comment for more info - for (var i = 0; i < mergedPropsStyles.length; i++) { - if (!_shouldStopAnimation2['default'](currentStyles[i], destStyles[i].style, currentVelocities[i])) { - return false; - } - } - - return true; - } - - // core key merging logic - - // things to do: say previously merged style is {a, b}, dest style (prop) is {b, - // c}, previous current (interpolating) style is {a, b} - // **invariant**: current[i] corresponds to merged[i] in terms of key - - // steps: - // turn merged style into {a?, b, c} - // add c, value of c is destStyles.c - // maybe remove a, aka call willLeave(a), then merged is either {b, c} or {a, b, c} - // turn current (interpolating) style from {a, b} into {a?, b, c} - // maybe remove a - // certainly add c, value of c is willEnter(c) - // loop over merged and construct new current - // dest doesn't change, that's owner's - function mergeAndSync(willEnter, willLeave, didLeave, oldMergedPropsStyles, destStyles, oldCurrentStyles, oldCurrentVelocities, oldLastIdealStyles, oldLastIdealVelocities) { - var newMergedPropsStyles = _mergeDiff2['default'](oldMergedPropsStyles, destStyles, function (oldIndex, oldMergedPropsStyle) { - var leavingStyle = willLeave(oldMergedPropsStyle); - if (leavingStyle == null) { - didLeave({ key: oldMergedPropsStyle.key, data: oldMergedPropsStyle.data }); - return null; - } - if (_shouldStopAnimation2['default'](oldCurrentStyles[oldIndex], leavingStyle, oldCurrentVelocities[oldIndex])) { - didLeave({ key: oldMergedPropsStyle.key, data: oldMergedPropsStyle.data }); - return null; - } - return { key: oldMergedPropsStyle.key, data: oldMergedPropsStyle.data, style: leavingStyle }; - }); - - var newCurrentStyles = []; - var newCurrentVelocities = []; - var newLastIdealStyles = []; - var newLastIdealVelocities = []; - for (var i = 0; i < newMergedPropsStyles.length; i++) { - var newMergedPropsStyleCell = newMergedPropsStyles[i]; - var foundOldIndex = null; - for (var j = 0; j < oldMergedPropsStyles.length; j++) { - if (oldMergedPropsStyles[j].key === newMergedPropsStyleCell.key) { - foundOldIndex = j; - break; - } - } - // TODO: key search code - if (foundOldIndex == null) { - var plainStyle = willEnter(newMergedPropsStyleCell); - newCurrentStyles[i] = plainStyle; - newLastIdealStyles[i] = plainStyle; - - var velocity = _mapToZero2['default'](newMergedPropsStyleCell.style); - newCurrentVelocities[i] = velocity; - newLastIdealVelocities[i] = velocity; - } else { - newCurrentStyles[i] = oldCurrentStyles[foundOldIndex]; - newLastIdealStyles[i] = oldLastIdealStyles[foundOldIndex]; - newCurrentVelocities[i] = oldCurrentVelocities[foundOldIndex]; - newLastIdealVelocities[i] = oldLastIdealVelocities[foundOldIndex]; - } - } - - return [newMergedPropsStyles, newCurrentStyles, newCurrentVelocities, newLastIdealStyles, newLastIdealVelocities]; - } - - var TransitionMotion = _createReactClass2['default']({ - propTypes: { - defaultStyles: _propTypes2['default'].arrayOf(_propTypes2['default'].shape({ - key: _propTypes2['default'].string.isRequired, - data: _propTypes2['default'].any, - style: _propTypes2['default'].objectOf(_propTypes2['default'].number).isRequired - })), - styles: _propTypes2['default'].oneOfType([_propTypes2['default'].func, _propTypes2['default'].arrayOf(_propTypes2['default'].shape({ - key: _propTypes2['default'].string.isRequired, - data: _propTypes2['default'].any, - style: _propTypes2['default'].objectOf(_propTypes2['default'].oneOfType([_propTypes2['default'].number, _propTypes2['default'].object])).isRequired - }))]).isRequired, - children: _propTypes2['default'].func.isRequired, - willEnter: _propTypes2['default'].func, - willLeave: _propTypes2['default'].func, - didLeave: _propTypes2['default'].func - }, - - getDefaultProps: function getDefaultProps() { - return { - willEnter: function willEnter(styleThatEntered) { - return _stripStyle2['default'](styleThatEntered.style); - }, - // recall: returning null makes the current unmounting TransitionStyle - // disappear immediately - willLeave: function willLeave() { - return null; - }, - didLeave: function didLeave() {} - }; - }, - - getInitialState: function getInitialState() { - var _props = this.props; - var defaultStyles = _props.defaultStyles; - var styles = _props.styles; - var willEnter = _props.willEnter; - var willLeave = _props.willLeave; - var didLeave = _props.didLeave; - - var destStyles = typeof styles === 'function' ? styles(defaultStyles) : styles; - - // this is special. for the first time around, we don't have a comparison - // between last (no last) and current merged props. we'll compute last so: - // say default is {a, b} and styles (dest style) is {b, c}, we'll - // fabricate last as {a, b} - var oldMergedPropsStyles = undefined; - if (defaultStyles == null) { - oldMergedPropsStyles = destStyles; - } else { - oldMergedPropsStyles = defaultStyles.map(function (defaultStyleCell) { - // TODO: key search code - for (var i = 0; i < destStyles.length; i++) { - if (destStyles[i].key === defaultStyleCell.key) { - return destStyles[i]; - } - } - return defaultStyleCell; - }); - } - var oldCurrentStyles = defaultStyles == null ? destStyles.map(function (s) { - return _stripStyle2['default'](s.style); - }) : defaultStyles.map(function (s) { - return _stripStyle2['default'](s.style); - }); - var oldCurrentVelocities = defaultStyles == null ? destStyles.map(function (s) { - return _mapToZero2['default'](s.style); - }) : defaultStyles.map(function (s) { - return _mapToZero2['default'](s.style); - }); - - var _mergeAndSync = mergeAndSync( - // Because this is an old-style createReactClass component, Flow doesn't - // understand that the willEnter and willLeave props have default values - // and will always be present. - willEnter, willLeave, didLeave, oldMergedPropsStyles, destStyles, oldCurrentStyles, oldCurrentVelocities, oldCurrentStyles, // oldLastIdealStyles really - oldCurrentVelocities); - - var mergedPropsStyles = _mergeAndSync[0]; - var currentStyles = _mergeAndSync[1]; - var currentVelocities = _mergeAndSync[2]; - var lastIdealStyles = _mergeAndSync[3]; - var lastIdealVelocities = _mergeAndSync[4]; - // oldLastIdealVelocities really - - return { - currentStyles: currentStyles, - currentVelocities: currentVelocities, - lastIdealStyles: lastIdealStyles, - lastIdealVelocities: lastIdealVelocities, - mergedPropsStyles: mergedPropsStyles - }; - }, - - unmounting: false, - animationID: null, - prevTime: 0, - accumulatedTime: 0, - // it's possible that currentStyle's value is stale: if props is immediately - // changed from 0 to 400 to spring(0) again, the async currentStyle is still - // at 0 (didn't have time to tick and interpolate even once). If we naively - // compare currentStyle with destVal it'll be 0 === 0 (no animation, stop). - // In reality currentStyle should be 400 - unreadPropStyles: null, - // after checking for unreadPropStyles != null, we manually go set the - // non-interpolating values (those that are a number, without a spring - // config) - clearUnreadPropStyle: function clearUnreadPropStyle(unreadPropStyles) { - var _mergeAndSync2 = mergeAndSync(this.props.willEnter, this.props.willLeave, this.props.didLeave, this.state.mergedPropsStyles, unreadPropStyles, this.state.currentStyles, this.state.currentVelocities, this.state.lastIdealStyles, this.state.lastIdealVelocities); - - var mergedPropsStyles = _mergeAndSync2[0]; - var currentStyles = _mergeAndSync2[1]; - var currentVelocities = _mergeAndSync2[2]; - var lastIdealStyles = _mergeAndSync2[3]; - var lastIdealVelocities = _mergeAndSync2[4]; - - for (var i = 0; i < unreadPropStyles.length; i++) { - var unreadPropStyle = unreadPropStyles[i].style; - var dirty = false; - - for (var key in unreadPropStyle) { - if (!Object.prototype.hasOwnProperty.call(unreadPropStyle, key)) { - continue; - } - - var styleValue = unreadPropStyle[key]; - if (typeof styleValue === 'number') { - if (!dirty) { - dirty = true; - currentStyles[i] = _extends({}, currentStyles[i]); - currentVelocities[i] = _extends({}, currentVelocities[i]); - lastIdealStyles[i] = _extends({}, lastIdealStyles[i]); - lastIdealVelocities[i] = _extends({}, lastIdealVelocities[i]); - mergedPropsStyles[i] = { - key: mergedPropsStyles[i].key, - data: mergedPropsStyles[i].data, - style: _extends({}, mergedPropsStyles[i].style) - }; - } - currentStyles[i][key] = styleValue; - currentVelocities[i][key] = 0; - lastIdealStyles[i][key] = styleValue; - lastIdealVelocities[i][key] = 0; - mergedPropsStyles[i].style[key] = styleValue; - } - } - } - - // unlike the other 2 components, we can't detect staleness and optionally - // opt out of setState here. each style object's data might contain new - // stuff we're not/cannot compare - this.setState({ - currentStyles: currentStyles, - currentVelocities: currentVelocities, - mergedPropsStyles: mergedPropsStyles, - lastIdealStyles: lastIdealStyles, - lastIdealVelocities: lastIdealVelocities - }); - }, - - startAnimationIfNecessary: function startAnimationIfNecessary() { - var _this = this; - - if (this.unmounting) { - return; - } - - // TODO: when config is {a: 10} and dest is {a: 10} do we raf once and - // call cb? No, otherwise accidental parent rerender causes cb trigger - this.animationID = _raf2['default'](function (timestamp) { - // https://github.com/chenglou/react-motion/pull/420 - // > if execution passes the conditional if (this.unmounting), then - // executes async defaultRaf and after that component unmounts and after - // that the callback of defaultRaf is called, then setState will be called - // on unmounted component. - if (_this.unmounting) { - return; - } - - var propStyles = _this.props.styles; - var destStyles = typeof propStyles === 'function' ? propStyles(rehydrateStyles(_this.state.mergedPropsStyles, _this.unreadPropStyles, _this.state.lastIdealStyles)) : propStyles; - - // check if we need to animate in the first place - if (shouldStopAnimationAll(_this.state.currentStyles, destStyles, _this.state.currentVelocities, _this.state.mergedPropsStyles)) { - // no need to cancel animationID here; shouldn't have any in flight - _this.animationID = null; - _this.accumulatedTime = 0; - return; - } - - var currentTime = timestamp || _performanceNow2['default'](); - var timeDelta = currentTime - _this.prevTime; - _this.prevTime = currentTime; - _this.accumulatedTime = _this.accumulatedTime + timeDelta; - // more than 10 frames? prolly switched browser tab. Restart - if (_this.accumulatedTime > msPerFrame * 10) { - _this.accumulatedTime = 0; - } - - if (_this.accumulatedTime === 0) { - // no need to cancel animationID here; shouldn't have any in flight - _this.animationID = null; - _this.startAnimationIfNecessary(); - return; - } - - var currentFrameCompletion = (_this.accumulatedTime - Math.floor(_this.accumulatedTime / msPerFrame) * msPerFrame) / msPerFrame; - var framesToCatchUp = Math.floor(_this.accumulatedTime / msPerFrame); - - var _mergeAndSync3 = mergeAndSync(_this.props.willEnter, _this.props.willLeave, _this.props.didLeave, _this.state.mergedPropsStyles, destStyles, _this.state.currentStyles, _this.state.currentVelocities, _this.state.lastIdealStyles, _this.state.lastIdealVelocities); - - var newMergedPropsStyles = _mergeAndSync3[0]; - var newCurrentStyles = _mergeAndSync3[1]; - var newCurrentVelocities = _mergeAndSync3[2]; - var newLastIdealStyles = _mergeAndSync3[3]; - var newLastIdealVelocities = _mergeAndSync3[4]; - - for (var i = 0; i < newMergedPropsStyles.length; i++) { - var newMergedPropsStyle = newMergedPropsStyles[i].style; - var newCurrentStyle = {}; - var newCurrentVelocity = {}; - var newLastIdealStyle = {}; - var newLastIdealVelocity = {}; - - for (var key in newMergedPropsStyle) { - if (!Object.prototype.hasOwnProperty.call(newMergedPropsStyle, key)) { - continue; - } - - var styleValue = newMergedPropsStyle[key]; - if (typeof styleValue === 'number') { - newCurrentStyle[key] = styleValue; - newCurrentVelocity[key] = 0; - newLastIdealStyle[key] = styleValue; - newLastIdealVelocity[key] = 0; - } else { - var newLastIdealStyleValue = newLastIdealStyles[i][key]; - var newLastIdealVelocityValue = newLastIdealVelocities[i][key]; - for (var j = 0; j < framesToCatchUp; j++) { - var _stepper = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision); - - newLastIdealStyleValue = _stepper[0]; - newLastIdealVelocityValue = _stepper[1]; - } - - var _stepper2 = _stepper4['default'](msPerFrame / 1000, newLastIdealStyleValue, newLastIdealVelocityValue, styleValue.val, styleValue.stiffness, styleValue.damping, styleValue.precision); - - var nextIdealX = _stepper2[0]; - var nextIdealV = _stepper2[1]; - - newCurrentStyle[key] = newLastIdealStyleValue + (nextIdealX - newLastIdealStyleValue) * currentFrameCompletion; - newCurrentVelocity[key] = newLastIdealVelocityValue + (nextIdealV - newLastIdealVelocityValue) * currentFrameCompletion; - newLastIdealStyle[key] = newLastIdealStyleValue; - newLastIdealVelocity[key] = newLastIdealVelocityValue; - } - } - - newLastIdealStyles[i] = newLastIdealStyle; - newLastIdealVelocities[i] = newLastIdealVelocity; - newCurrentStyles[i] = newCurrentStyle; - newCurrentVelocities[i] = newCurrentVelocity; - } - - _this.animationID = null; - // the amount we're looped over above - _this.accumulatedTime -= framesToCatchUp * msPerFrame; - - _this.setState({ - currentStyles: newCurrentStyles, - currentVelocities: newCurrentVelocities, - lastIdealStyles: newLastIdealStyles, - lastIdealVelocities: newLastIdealVelocities, - mergedPropsStyles: newMergedPropsStyles - }); - - _this.unreadPropStyles = null; - - _this.startAnimationIfNecessary(); - }); - }, - - componentDidMount: function componentDidMount() { - this.prevTime = _performanceNow2['default'](); - this.startAnimationIfNecessary(); - }, - - componentWillReceiveProps: function componentWillReceiveProps(props) { - if (this.unreadPropStyles) { - // previous props haven't had the chance to be set yet; set them here - this.clearUnreadPropStyle(this.unreadPropStyles); - } - - var styles = props.styles; - if (typeof styles === 'function') { - this.unreadPropStyles = styles(rehydrateStyles(this.state.mergedPropsStyles, this.unreadPropStyles, this.state.lastIdealStyles)); - } else { - this.unreadPropStyles = styles; - } - - if (this.animationID == null) { - this.prevTime = _performanceNow2['default'](); - this.startAnimationIfNecessary(); - } - }, - - componentWillUnmount: function componentWillUnmount() { - this.unmounting = true; - if (this.animationID != null) { - _raf2['default'].cancel(this.animationID); - this.animationID = null; - } - }, - - render: function render() { - var hydratedStyles = rehydrateStyles(this.state.mergedPropsStyles, this.unreadPropStyles, this.state.currentStyles); - var renderedChildren = this.props.children(hydratedStyles); - return renderedChildren && _react2['default'].Children.only(renderedChildren); - } - }); - - exports['default'] = TransitionMotion; - module.exports = exports['default']; - - // list of styles, each containing interpolating values. Part of what's passed - // to children function. Notice that this is - // Array, without the wrapper that is {key: ..., - // data: ... style: ActualInterpolatingStyleObject}. Only mergedPropsStyles - // contains the key & data info (so that we only have a single source of truth - // for these, and to save space). Check the comment for `rehydrateStyles` to - // see how we regenerate the entirety of what's passed to children function - - // the array that keeps track of currently rendered stuff! Including stuff - // that you've unmounted but that's still animating. This is where it lives - -/***/ }), -/* 405 */ -/***/ (function(module, exports) { - - - - // core keys merging algorithm. If previous render's keys are [a, b], and the - // next render's [c, b, d], what's the final merged keys and ordering? - - // - c and a must both be before b - // - b before d - // - ordering between a and c ambiguous - - // this reduces to merging two partially ordered lists (e.g. lists where not - // every item has a definite ordering, like comparing a and c above). For the - // ambiguous ordering we deterministically choose to place the next render's - // item after the previous'; so c after a - - // this is called a topological sorting. Except the existing algorithms don't - // work well with js bc of the amount of allocation, and isn't optimized for our - // current use-case bc the runtime is linear in terms of edges (see wiki for - // meaning), which is huge when two lists have many common elements - 'use strict'; - - exports.__esModule = true; - exports['default'] = mergeDiff; - - function mergeDiff(prev, next, onRemove) { - // bookkeeping for easier access of a key's index below. This is 2 allocations + - // potentially triggering chrome hash map mode for objs (so it might be faster - - var prevKeyIndex = {}; - for (var i = 0; i < prev.length; i++) { - prevKeyIndex[prev[i].key] = i; - } - var nextKeyIndex = {}; - for (var i = 0; i < next.length; i++) { - nextKeyIndex[next[i].key] = i; - } - - // first, an overly elaborate way of merging prev and next, eliminating - // duplicates (in terms of keys). If there's dupe, keep the item in next). - // This way of writing it saves allocations - var ret = []; - for (var i = 0; i < next.length; i++) { - ret[i] = next[i]; - } - for (var i = 0; i < prev.length; i++) { - if (!Object.prototype.hasOwnProperty.call(nextKeyIndex, prev[i].key)) { - // this is called my TM's `mergeAndSync`, which calls willLeave. We don't - // merge in keys that the user desires to kill - var fill = onRemove(i, prev[i]); - if (fill != null) { - ret.push(fill); - } - } - } - - // now all the items all present. Core sorting logic to have the right order - return ret.sort(function (a, b) { - var nextOrderA = nextKeyIndex[a.key]; - var nextOrderB = nextKeyIndex[b.key]; - var prevOrderA = prevKeyIndex[a.key]; - var prevOrderB = prevKeyIndex[b.key]; - - if (nextOrderA != null && nextOrderB != null) { - // both keys in next - return nextKeyIndex[a.key] - nextKeyIndex[b.key]; - } else if (prevOrderA != null && prevOrderB != null) { - // both keys in prev - return prevKeyIndex[a.key] - prevKeyIndex[b.key]; - } else if (nextOrderA != null) { - // key a in next, key b in prev - - // how to determine the order between a and b? We find a "pivot" (term - // abuse), a key present in both prev and next, that is sandwiched between - // a and b. In the context of our above example, if we're comparing a and - // d, b's (the only) pivot - for (var i = 0; i < next.length; i++) { - var pivot = next[i].key; - if (!Object.prototype.hasOwnProperty.call(prevKeyIndex, pivot)) { - continue; - } - - if (nextOrderA < nextKeyIndex[pivot] && prevOrderB > prevKeyIndex[pivot]) { - return -1; - } else if (nextOrderA > nextKeyIndex[pivot] && prevOrderB < prevKeyIndex[pivot]) { - return 1; - } - } - // pluggable. default to: next bigger than prev - return 1; - } - // prevOrderA, nextOrderB - for (var i = 0; i < next.length; i++) { - var pivot = next[i].key; - if (!Object.prototype.hasOwnProperty.call(prevKeyIndex, pivot)) { - continue; - } - if (nextOrderB < nextKeyIndex[pivot] && prevOrderA > prevKeyIndex[pivot]) { - return 1; - } else if (nextOrderB > nextKeyIndex[pivot] && prevOrderA < prevKeyIndex[pivot]) { - return -1; - } - } - // pluggable. default to: next bigger than prev - return -1; - }); - } - - module.exports = exports['default']; - // to loop through and find a key's index each time), but I no longer care - -/***/ }), -/* 406 */ -/***/ (function(module, exports, __webpack_require__) { - - 'use strict'; - - exports.__esModule = true; - - var _extends = Object.assign || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i];for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - }return target; - }; - - exports['default'] = spring; - - function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { 'default': obj }; - } - - var _presets = __webpack_require__(407); - - var _presets2 = _interopRequireDefault(_presets); - - var defaultConfig = _extends({}, _presets2['default'].noWobble, { - precision: 0.01 - }); - - function spring(val, config) { - return _extends({}, defaultConfig, config, { val: val }); - } - - module.exports = exports['default']; - -/***/ }), -/* 407 */ -/***/ (function(module, exports) { - - "use strict"; - - exports.__esModule = true; - exports["default"] = { - noWobble: { stiffness: 170, damping: 26 }, // the default, if nothing provided - gentle: { stiffness: 120, damping: 14 }, - wobbly: { stiffness: 180, damping: 12 }, - stiff: { stiffness: 210, damping: 20 } - }; - module.exports = exports["default"]; - -/***/ }), -/* 408 */ -/***/ (function(module, exports, __webpack_require__) { - - /* WEBPACK VAR INJECTION */(function(process) {'use strict'; - - exports.__esModule = true; - exports['default'] = reorderKeys; - - var hasWarned = false; - - function reorderKeys() { - if (process.env.NODE_ENV === 'development') { - if (!hasWarned) { - hasWarned = true; - console.error('`reorderKeys` has been removed, since it is no longer needed for TransitionMotion\'s new styles array API.'); - } - } - } - - module.exports = exports['default']; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4))) - -/***/ }), -/* 409 */ -/***/ (function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict'; - - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - - /*! tether-drop 1.4.1 */ - - (function (root, factory) { - if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(410)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') { - module.exports = factory(require('tether')); - } else { - root.Drop = factory(root.Tether); - } - })(undefined, function (Tether) { - - /* global Tether */ - 'use strict'; - - var _bind = Function.prototype.bind; - - var _slicedToArray = function () { - function sliceIterator(arr, i) { - var _arr = [];var _n = true;var _d = false;var _e = undefined;try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value);if (i && _arr.length === i) break; - } - } catch (err) { - _d = true;_e = err; - } finally { - try { - if (!_n && _i['return']) _i['return'](); - } finally { - if (_d) throw _e; - } - }return _arr; - }return function (arr, i) { - if (Array.isArray(arr)) { - return arr; - } else if (Symbol.iterator in Object(arr)) { - return sliceIterator(arr, i); - } else { - throw new TypeError('Invalid attempt to destructure non-iterable instance'); - } - }; - }(); - - var _createClass = function () { - function defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor); - } - }return function (Constructor, protoProps, staticProps) { - if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor; - }; - }(); - - var _get = function get(_x2, _x3, _x4) { - var _again = true;_function: while (_again) { - var object = _x2, - property = _x3, - receiver = _x4;_again = false;if (object === null) object = Function.prototype;var desc = Object.getOwnPropertyDescriptor(object, property);if (desc === undefined) { - var parent = Object.getPrototypeOf(object);if (parent === null) { - return undefined; - } else { - _x2 = parent;_x3 = property;_x4 = receiver;_again = true;desc = parent = undefined;continue _function; - } - } else if ('value' in desc) { - return desc.value; - } else { - var getter = desc.get;if (getter === undefined) { - return undefined; - }return getter.call(receiver); - } - } - }; - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError('Cannot call a class as a function'); - } - } - - function _inherits(subClass, superClass) { - if (typeof superClass !== 'function' && superClass !== null) { - throw new TypeError('Super expression must either be null or a function, not ' + (typeof superClass === 'undefined' ? 'undefined' : _typeof(superClass))); - }subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; - } - - var _Tether$Utils = Tether.Utils; - var extend = _Tether$Utils.extend; - var addClass = _Tether$Utils.addClass; - var removeClass = _Tether$Utils.removeClass; - var hasClass = _Tether$Utils.hasClass; - var Evented = _Tether$Utils.Evented; - - function sortAttach(str) { - var _str$split = str.split(' '); - - var _str$split2 = _slicedToArray(_str$split, 2); - - var first = _str$split2[0]; - var second = _str$split2[1]; - - if (['left', 'right'].indexOf(first) >= 0) { - var _ref = [second, first]; - first = _ref[0]; - second = _ref[1]; - } - return [first, second].join(' '); - } - - function removeFromArray(arr, item) { - var index = undefined; - var results = []; - while ((index = arr.indexOf(item)) !== -1) { - results.push(arr.splice(index, 1)); - } - return results; - } - - var clickEvents = ['click']; - if ('ontouchstart' in document.documentElement) { - clickEvents.push('touchstart'); - } - - var transitionEndEvents = { - 'WebkitTransition': 'webkitTransitionEnd', - 'MozTransition': 'transitionend', - 'OTransition': 'otransitionend', - 'transition': 'transitionend' - }; - - var transitionEndEvent = ''; - for (var _name in transitionEndEvents) { - if ({}.hasOwnProperty.call(transitionEndEvents, _name)) { - var tempEl = document.createElement('p'); - if (typeof tempEl.style[_name] !== 'undefined') { - transitionEndEvent = transitionEndEvents[_name]; - } - } - } - - var MIRROR_ATTACH = { - left: 'right', - right: 'left', - top: 'bottom', - bottom: 'top', - middle: 'middle', - center: 'center' - }; - - var allDrops = {}; - - // Drop can be included in external libraries. Calling createContext gives you a fresh - // copy of drop which won't interact with other copies on the page (beyond calling the document events). - - function createContext() { - var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; - - var drop = function drop() { - for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; - } - - return new (_bind.apply(DropInstance, [null].concat(args)))(); - }; - - extend(drop, { - createContext: createContext, - drops: [], - defaults: {} - }); - - var defaultOptions = { - classPrefix: 'drop', - defaults: { - position: 'bottom left', - openOn: 'click', - beforeClose: null, - constrainToScrollParent: true, - constrainToWindow: true, - classes: '', - remove: false, - openDelay: 0, - closeDelay: 50, - // inherited from openDelay and closeDelay if not explicitly defined - focusDelay: null, - blurDelay: null, - hoverOpenDelay: null, - hoverCloseDelay: null, - tetherOptions: {} - } - }; - - extend(drop, defaultOptions, options); - extend(drop.defaults, defaultOptions.defaults, options.defaults); - - if (typeof allDrops[drop.classPrefix] === 'undefined') { - allDrops[drop.classPrefix] = []; - } - - drop.updateBodyClasses = function () { - // There is only one body, so despite the context concept, we still iterate through all - // drops which share our classPrefix. - - var anyOpen = false; - var drops = allDrops[drop.classPrefix]; - var len = drops.length; - for (var i = 0; i < len; ++i) { - if (drops[i].isOpened()) { - anyOpen = true; - break; - } - } - - if (anyOpen) { - addClass(document.body, drop.classPrefix + '-open'); - } else { - removeClass(document.body, drop.classPrefix + '-open'); - } - }; - - var DropInstance = function (_Evented) { - _inherits(DropInstance, _Evented); - - function DropInstance(opts) { - _classCallCheck(this, DropInstance); - - _get(Object.getPrototypeOf(DropInstance.prototype), 'constructor', this).call(this); - this.options = extend({}, drop.defaults, opts); - this.target = this.options.target; - - if (typeof this.target === 'undefined') { - throw new Error('Drop Error: You must provide a target.'); - } - - var dataPrefix = 'data-' + drop.classPrefix; - - var contentAttr = this.target.getAttribute(dataPrefix); - if (contentAttr && this.options.content == null) { - this.options.content = contentAttr; - } - - var attrsOverride = ['position', 'openOn']; - for (var i = 0; i < attrsOverride.length; ++i) { - - var override = this.target.getAttribute(dataPrefix + '-' + attrsOverride[i]); - if (override && this.options[attrsOverride[i]] == null) { - this.options[attrsOverride[i]] = override; - } - } - - if (this.options.classes && this.options.addTargetClasses !== false) { - addClass(this.target, this.options.classes); - } - - drop.drops.push(this); - allDrops[drop.classPrefix].push(this); - - this._boundEvents = []; - this.bindMethods(); - this.setupElements(); - this.setupEvents(); - this.setupTether(); - } - - _createClass(DropInstance, [{ - key: '_on', - value: function _on(element, event, handler) { - this._boundEvents.push({ element: element, event: event, handler: handler }); - element.addEventListener(event, handler); - } - }, { - key: 'bindMethods', - value: function bindMethods() { - this.transitionEndHandler = this._transitionEndHandler.bind(this); - } - }, { - key: 'setupElements', - value: function setupElements() { - var _this = this; - - this.drop = document.createElement('div'); - addClass(this.drop, drop.classPrefix); - - if (this.options.classes) { - addClass(this.drop, this.options.classes); - } - - this.content = document.createElement('div'); - addClass(this.content, drop.classPrefix + '-content'); - - if (typeof this.options.content === 'function') { - var generateAndSetContent = function generateAndSetContent() { - // content function might return a string or an element - var contentElementOrHTML = _this.options.content.call(_this, _this); - - if (typeof contentElementOrHTML === 'string') { - _this.content.innerHTML = contentElementOrHTML; - } else if ((typeof contentElementOrHTML === 'undefined' ? 'undefined' : _typeof(contentElementOrHTML)) === 'object') { - _this.content.innerHTML = ''; - _this.content.appendChild(contentElementOrHTML); - } else { - throw new Error('Drop Error: Content function should return a string or HTMLElement.'); - } - }; - - generateAndSetContent(); - this.on('open', generateAndSetContent.bind(this)); - } else if (_typeof(this.options.content) === 'object') { - this.content.appendChild(this.options.content); - } else { - this.content.innerHTML = this.options.content; - } - - this.drop.appendChild(this.content); - } - }, { - key: 'setupTether', - value: function setupTether() { - // Tether expects two attachment points, one in the target element, one in the - // drop. We use a single one, and use the order as well, to allow us to put - // the drop on either side of any of the four corners. This magic converts between - // the two: - var dropAttach = this.options.position.split(' '); - dropAttach[0] = MIRROR_ATTACH[dropAttach[0]]; - dropAttach = dropAttach.join(' '); - - var constraints = []; - if (this.options.constrainToScrollParent) { - constraints.push({ - to: 'scrollParent', - pin: 'top, bottom', - attachment: 'together none' - }); - } else { - // To get 'out of bounds' classes - constraints.push({ - to: 'scrollParent' - }); - } - - if (this.options.constrainToWindow !== false) { - constraints.push({ - to: 'window', - attachment: 'together' - }); - } else { - // To get 'out of bounds' classes - constraints.push({ - to: 'window' - }); - } - - var opts = { - element: this.drop, - target: this.target, - attachment: sortAttach(dropAttach), - targetAttachment: sortAttach(this.options.position), - classPrefix: drop.classPrefix, - offset: '0 0', - targetOffset: '0 0', - enabled: false, - constraints: constraints, - addTargetClasses: this.options.addTargetClasses - }; - - if (this.options.tetherOptions !== false) { - this.tether = new Tether(extend({}, opts, this.options.tetherOptions)); - } - } - }, { - key: 'setupEvents', - value: function setupEvents() { - var _this2 = this; - - if (!this.options.openOn) { - return; - } - - if (this.options.openOn === 'always') { - setTimeout(this.open.bind(this)); - return; - } - - var events = this.options.openOn.split(' '); - - if (events.indexOf('click') >= 0) { - var openHandler = function openHandler(event) { - _this2.toggle(event); - event.preventDefault(); - }; - - var closeHandler = function closeHandler(event) { - if (!_this2.isOpened()) { - return; - } - - // Clicking inside dropdown - if (event.target === _this2.drop || _this2.drop.contains(event.target)) { - return; - } - - // Clicking target - if (event.target === _this2.target || _this2.target.contains(event.target)) { - return; - } - - _this2.close(event); - }; - - for (var i = 0; i < clickEvents.length; ++i) { - var clickEvent = clickEvents[i]; - this._on(this.target, clickEvent, openHandler); - this._on(document, clickEvent, closeHandler); - } - } - - var inTimeout = null; - var outTimeout = null; - - var inHandler = function inHandler(event) { - if (outTimeout !== null) { - clearTimeout(outTimeout); - } else { - inTimeout = setTimeout(function () { - _this2.open(event); - inTimeout = null; - }, (event.type === 'focus' ? _this2.options.focusDelay : _this2.options.hoverOpenDelay) || _this2.options.openDelay); - } - }; - - var outHandler = function outHandler(event) { - if (inTimeout !== null) { - clearTimeout(inTimeout); - } else { - outTimeout = setTimeout(function () { - _this2.close(event); - outTimeout = null; - }, (event.type === 'blur' ? _this2.options.blurDelay : _this2.options.hoverCloseDelay) || _this2.options.closeDelay); - } - }; - - if (events.indexOf('hover') >= 0) { - this._on(this.target, 'mouseover', inHandler); - this._on(this.drop, 'mouseover', inHandler); - this._on(this.target, 'mouseout', outHandler); - this._on(this.drop, 'mouseout', outHandler); - } - - if (events.indexOf('focus') >= 0) { - this._on(this.target, 'focus', inHandler); - this._on(this.drop, 'focus', inHandler); - this._on(this.target, 'blur', outHandler); - this._on(this.drop, 'blur', outHandler); - } - } - }, { - key: 'isOpened', - value: function isOpened() { - if (this.drop) { - return hasClass(this.drop, drop.classPrefix + '-open'); - } - } - }, { - key: 'toggle', - value: function toggle(event) { - if (this.isOpened()) { - this.close(event); - } else { - this.open(event); - } - } - }, { - key: 'open', - value: function open(event) { - var _this3 = this; - - /* eslint no-unused-vars: 0 */ - if (this.isOpened()) { - return; - } - - if (!this.drop.parentNode) { - document.body.appendChild(this.drop); - } - - if (typeof this.tether !== 'undefined') { - this.tether.enable(); - } - - addClass(this.drop, drop.classPrefix + '-open'); - addClass(this.drop, drop.classPrefix + '-open-transitionend'); - - setTimeout(function () { - if (_this3.drop) { - addClass(_this3.drop, drop.classPrefix + '-after-open'); - } - }); - - if (typeof this.tether !== 'undefined') { - this.tether.position(); - } - - this.trigger('open'); - - drop.updateBodyClasses(); - } - }, { - key: '_transitionEndHandler', - value: function _transitionEndHandler(e) { - if (e.target !== e.currentTarget) { - return; - } - - if (!hasClass(this.drop, drop.classPrefix + '-open')) { - removeClass(this.drop, drop.classPrefix + '-open-transitionend'); - } - this.drop.removeEventListener(transitionEndEvent, this.transitionEndHandler); - } - }, { - key: 'beforeCloseHandler', - value: function beforeCloseHandler(event) { - var shouldClose = true; - - if (!this.isClosing && typeof this.options.beforeClose === 'function') { - this.isClosing = true; - shouldClose = this.options.beforeClose(event, this) !== false; - } - - this.isClosing = false; - - return shouldClose; - } - }, { - key: 'close', - value: function close(event) { - if (!this.isOpened()) { - return; - } - - if (!this.beforeCloseHandler(event)) { - return; - } - - removeClass(this.drop, drop.classPrefix + '-open'); - removeClass(this.drop, drop.classPrefix + '-after-open'); - - this.drop.addEventListener(transitionEndEvent, this.transitionEndHandler); - - this.trigger('close'); - - if (typeof this.tether !== 'undefined') { - this.tether.disable(); - } - - drop.updateBodyClasses(); - - if (this.options.remove) { - this.remove(event); - } - } - }, { - key: 'remove', - value: function remove(event) { - this.close(event); - if (this.drop.parentNode) { - this.drop.parentNode.removeChild(this.drop); - } - } - }, { - key: 'position', - value: function position() { - if (this.isOpened() && typeof this.tether !== 'undefined') { - this.tether.position(); - } - } - }, { - key: 'destroy', - value: function destroy() { - this.remove(); - - if (typeof this.tether !== 'undefined') { - this.tether.destroy(); - } - - for (var i = 0; i < this._boundEvents.length; ++i) { - var _boundEvents$i = this._boundEvents[i]; - var element = _boundEvents$i.element; - var _event = _boundEvents$i.event; - var handler = _boundEvents$i.handler; - - element.removeEventListener(_event, handler); - } - - this._boundEvents = []; - - this.tether = null; - this.drop = null; - this.content = null; - this.target = null; - - removeFromArray(allDrops[drop.classPrefix], this); - removeFromArray(drop.drops, this); - } - }]); - - return DropInstance; - }(Evented); - - return drop; - } - - var Drop = createContext(); - - document.addEventListener('DOMContentLoaded', function () { - Drop.updateBodyClasses(); - }); - return Drop; - }); - -/***/ }), -/* 410 */ -/***/ (function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict'; - - var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; - - /*! tether 1.4.3 */ - - (function (root, factory) { - if (true) { - !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') { - module.exports = factory(require, exports, module); - } else { - root.Tether = factory(); - } - })(undefined, function (require, exports, module) { - - 'use strict'; - - var _createClass = function () { - function defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ('value' in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor); - } - }return function (Constructor, protoProps, staticProps) { - if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor; - }; - }(); - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError('Cannot call a class as a function'); - } - } - - var TetherBase = undefined; - if (typeof TetherBase === 'undefined') { - TetherBase = { modules: [] }; - } - - var zeroElement = null; - - // Same as native getBoundingClientRect, except it takes into account parent offsets - // if the element lies within a nested document ( or