{"version":3,"file":"product-info-ba206e8e.js","sources":["../../../client/src/javascripts/customer_pages/_utils/create-context-provider.js","../../../client/src/javascripts/customer_pages/_utils/favouritable-wrapper.jsx","../../../client/src/javascripts/entry_points/product-info.js"],"sourcesContent":["import React from 'react';\n\n// from https://stackoverflow.com/questions/38212174/is-it-possible-to-pass-context-into-a-component-instantiated-with-reactdom-rende\nfunction createContextProvider(context) {\n  class ContextProvider extends React.Component {\n    getChildContext() {\n      return context;\n    }\n\n    render() {\n      return this.props.children;\n    }\n  }\n\n  ContextProvider.childContextTypes = {};\n  Object.keys(context).forEach((key) => {\n    ContextProvider.childContextTypes[key] = React.PropTypes.any.isRequired;\n  });\n\n  return ContextProvider;\n}\n\nexport default createContextProvider;\n","'use strict';\n\n// Import Libraries\nimport React from 'react';\nimport { builderDispatch } from '../_utils/ui'\nimport Events              from '../_shelf-category/flux-events';\nimport Favouritable from './favouritable';\n\nexport default class FavouritableWrapper extends React.Component {\n  constructor(props) {\n    super(props);\n\n    this.state = {\n      favourited: this.props.favourited\n    };\n  }\n\n  componentDidMount() {\n    this.builderDispatchToken = builderDispatch.register(payload => {\n      switch(payload.type) {\n        case Events.FAVOURITED:\n          this.handleFavourited(payload.designCode);\n          break;\n        }\n    });\n  }\n\n  render() {\n    return (\n      <Favouritable designCode={this.props.designCode}\n                    favourited={this.state.favourited} />\n    );\n  }\n\n  handleFavourited(designCode) {\n    this.setState(state => {\n      return { favourited: !state.favourited };\n    });\n  }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport DeliveryOptions from '../customer_pages/_grouped-category/delivery-options';\nimport Pickup from '../customer_pages/_grouped-category/pickup';\nimport Shipping from '../customer_pages/_grouped-category/shipping';\nimport MobileFullScreen from 'Utils/mobile-full-screen';\nimport DeliveryCalculator from 'Utils/_delivery-options/calculator';\nimport DeliveryOptionsList from 'Utils/_delivery-options/delivery-options-list';\nimport createContextProvider from 'Utils/create-context-provider';\nimport FavouritableWrapper from 'Utils/favouritable-wrapper';\nimport ProductFlags from 'Utils/product-flags';\nimport setCanonicalUrl from 'Utils/tools/canonical-url';\n\n\n// Add Imported Modules to the windows so that they become available for the static page!\nwindow.DeliveryOptions = DeliveryOptions;\nwindow.DeliveryCalculator = DeliveryCalculator;\nwindow.DeliveryOptionsList = DeliveryOptionsList;\nwindow.Pickup = Pickup;\nwindow.Shipping = Shipping;\nwindow.MobileFullScreen = MobileFullScreen;\nwindow.createContextProvider = createContextProvider;\nwindow.FavouritableWrapper = FavouritableWrapper;\nwindow.ProductFlags = ProductFlags;\nwindow.setCanonicalUrl = setCanonicalUrl;\n\n// This is ESSENTIAL: otherwise there'll be console errors caused by:\n// having two React/ReactDOM libraries: one from the webpack bundle (although we're\n// specifying it as external) and one loaded from application.html.slim\nwindow.React = React;\nwindow.ReactDOM = ReactDOM;\n"],"names":["createContextProvider","context","ContextProvider","React","key","FavouritableWrapper","props","builderDispatch","payload","Events","Favouritable","designCode","state","DeliveryOptions","DeliveryCalculator","DeliveryOptionsList","Pickup","Shipping","MobileFullScreen","ProductFlags","setCanonicalUrl","ReactDOM"],"mappings":"+/BAGA,SAASA,EAAsBC,EAAS,CACtC,MAAMC,UAAwBC,EAAM,SAAU,CAC5C,iBAAkB,CAChB,OAAOF,CACR,CAED,QAAS,CACP,OAAO,KAAK,MAAM,QACnB,CACF,CAED,OAAAC,EAAgB,kBAAoB,GACpC,OAAO,KAAKD,CAAO,EAAE,QAASG,GAAQ,CACpCF,EAAgB,kBAAkBE,CAAG,EAAID,EAAM,UAAU,IAAI,UACjE,CAAG,EAEMD,CACT,CCZqB,MAAAG,UAA4BF,EAAM,SAAU,CAC/D,YAAYG,EAAO,CACjB,MAAMA,CAAK,EAEX,KAAK,MAAQ,CACX,WAAY,KAAK,MAAM,UAAA,CAE3B,CAEA,mBAAoB,CACb,KAAA,qBAAuBC,EAAgB,SAAoBC,GAAA,CAC9D,OAAOA,EAAQ,KAAM,CACnB,KAAKC,EAAO,WACL,KAAA,iBAAiBD,EAAQ,UAAU,EACxC,KACF,CAAA,CACH,CACH,CAEA,QAAS,CAEL,OAAAL,EAAA,cAACO,EAAA,CAAa,WAAY,KAAK,MAAM,WACvB,WAAY,KAAK,MAAM,UAAA,CAAA,CAEzC,CAEA,iBAAiBC,EAAY,CAC3B,KAAK,SAAkBC,IACd,CAAE,WAAY,CAACA,EAAM,UAAW,EACxC,CACH,CACF,CCxBA,OAAO,gBAAkBC,EACzB,OAAO,mBAAqBC,EAC5B,OAAO,oBAAsBC,EAC7B,OAAO,OAASC,EAChB,OAAO,SAAWC,EAClB,OAAO,iBAAmBC,EAC1B,OAAO,sBAAwBlB,EAC/B,OAAO,oBAAsBK,EAC7B,OAAO,aAAec,EACtB,OAAO,gBAAkBC,EAKzB,OAAO,MAAQjB,EACf,OAAO,SAAWkB"}