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AK,4BACH,OAAA+B,EAAAA,EAAA,GAAYtB,GAAUkD,EAAOhC,OAC/B,QACE,OAAOlB,EAEb,CAEO,SAASoB,EAAOF,GACrB,MAAO,CAAEiC,KAAM,4BAA6BjC,MAAAA,EAC9C,C","sources":["webpack://app/./app/javascript/util/locales/helpers.js","webpack://app/./app/javascript/util/TranslationsLoader.js","webpack://app/./app/javascript/components/ComponentWrapper.js","webpack://app/./app/javascript/components/CurrencyAmount.js","webpack://app/./app/javascript/components/Thermometer.js","webpack://app/./app/javascript/plugins/donations_thermometer/index.tsx","webpack://app/./app/javascript/plugins/plugin.ts","webpack://app/./app/javascript/state/thermometer/index.js"],"sourcesContent":["// Converts translations from Rails format to ReactIntl format.\nimport flatten from 'flat';\nimport mapValues from 'lodash/mapValues';\nimport reduce from 'lodash/reduce';\nimport isPlainObject from 'lodash/reduce';\n\nexport function transform(translations) {\n return mapValues(flatten(translations), replaceInterpolations);\n}\n\nexport function replaceInterpolations(value) {\n if (typeof value === 'string') return value.replace(/%{(\\w+)}/g, '{$1}');\n return value;\n}\n","// champaign-i18n is an external (aliases to window.I18n)\n// see config/webpack/custom.js to see where it's aliased\nimport flatten from 'flat';\nimport I18n from 'champaign-i18n';\nimport { mapValues } from 'lodash';\nimport { replaceInterpolations } from './locales/helpers';\n\nconst translations = mapValues(I18n.translations, tree =>\n mapValues(flatten(tree), replaceInterpolations)\n);\n\nexport default function loadTranslations(locale) {\n if (!translations[locale]) {\n throw new Error(`Unsuported locale: ${locale}`);\n }\n return translations[locale];\n}\n","/* */\nimport React, { Component } from 'react';\nimport { Provider } from 'react-redux';\nimport { IntlProvider, addLocaleData } from 'react-intl';\nimport enLocaleData from 'react-intl/locale-data/en';\nimport deLocaleData from 'react-intl/locale-data/de';\nimport frLocaleData from 'react-intl/locale-data/fr';\nimport esLocaleData from 'react-intl/locale-data/es';\nimport ptLocaleData from 'react-intl/locale-data/pt';\nimport nlLocaleData from 'react-intl/locale-data/nl';\nimport arLocaleData from 'react-intl/locale-data/ar';\nimport loadTranslations from '../util/TranslationsLoader';\n\nfunction WrapInStore(options) {\n if (options.store) {\n return {options.children};\n }\n return options.children;\n}\n\nexport default class ComponentWrapper extends Component {\n render() {\n return (\n \n \n
{this.props.children}
\n
\n \n );\n }\n}\n\naddLocaleData([\n ...enLocaleData,\n ...deLocaleData,\n ...frLocaleData,\n ...esLocaleData,\n ...ptLocaleData,\n ...nlLocaleData,\n ...arLocaleData,\n]);\n","import React from 'react';\nimport { FormattedNumber } from 'react-intl';\n\nconst CONFIG = {\n style: 'currency',\n minimumFractionDigits: 0,\n maximumFractionDigits: 0,\n};\n\nexport default function CurrencyAmount(props) {\n const { currency, amount } = props;\n switch (currency) {\n case 'USD':\n case 'NZD':\n case 'CAD':\n case 'MXN':\n case 'BRL':\n case 'ARS':\n case 'AUD':\n return (\n \n {'$'}\n \n \n );\n case 'EUR':\n return (\n \n \n {'€'}\n \n );\n default:\n return ;\n }\n}\n","import React from 'react';\nimport { connect } from 'react-redux';\nimport { FormattedMessage } from 'react-intl';\nimport { isEmpty, min } from 'lodash';\nimport CurrencyAmount from './CurrencyAmount';\nimport './Thermometer.scss';\n\nexport function Thermometer(props) {\n // Only render if active\n if (isEmpty(props) || !props.active) return null;\n const currency = props.currency;\n const goal = props.goals[currency];\n\n // Prevent overflow when donations > goal.\n const donations = min([\n props.total_donations[currency],\n props.goals[currency],\n ]);\n\n const percentage = Math.round((donations / goal) * 100);\n\n if (goal === 0) return null;\n\n return (\n
\n
\n
\n \n
\n \n \n \n
\n
\n \n
\n \n \n \n
\n
\n
\n \n
\n
\n );\n}\n\nconst mapStateToProps = state => {\n const data = state.donationsThermometer;\n const currency = state.fundraiser.currency;\n if (isEmpty(data)) return {};\n return {\n active: data.active,\n currency,\n total_donations: data.totalDonations,\n goals: data.goals,\n offset: data.offset,\n title: data.title,\n };\n};\n\nexport default connect(mapStateToProps)(Thermometer);\n","import * as React from 'react';\nimport { render } from 'react-dom';\nimport ComponentWrapper from '../../components/ComponentWrapper';\nimport {\n default as ConnectedThermometer,\n Thermometer,\n} from '../../components/Thermometer';\nimport { update } from '../../state/thermometer';\nimport { IDonationsThermometerPluginConfig } from '../../window';\nimport Plugin, { IPluginOptions } from '../plugin';\n\ninterface IDonationsThermometerOptions\n extends IPluginOptions {\n props?: any;\n component?: any;\n}\nexport default class DonationsThermometer extends Plugin<\n IDonationsThermometerPluginConfig\n> {\n public props?: any;\n public component?: any;\n public customRenderer: (instance: DonationsThermometer) => any;\n\n constructor(options: IDonationsThermometerOptions) {\n super(options);\n if (!options.el) {\n throw new Error(\n 'Donations Thermometer must be initialised with an element and a store.'\n );\n }\n\n if (!options.store && !options.props) {\n throw new Error(\n 'Donations Thermometer must be initialised with either a redux store, or props'\n );\n }\n this.el = options.el;\n if (options.props) {\n this.props = options.props;\n }\n if (options.store) {\n this.store = options.store;\n }\n\n if (options.component) {\n this.component = options.component;\n }\n\n this.render();\n }\n\n get state() {\n if (!this.store) {\n return null;\n }\n return this.store.getState().donationsThermometer;\n }\n\n set state(attrs) {\n if (!this.store) {\n throw new Error(\n `Can't set state on this thermometer. Check that you initialised it with a (redux) store`\n );\n }\n this.store.dispatch(update(attrs));\n }\n\n public renderWithComponent() {\n return render(\n \n \n ,\n this.el\n );\n }\n\n /**\n * Updates the thermometer's props when not connected to a store.\n * @param {Props} props\n */\n public updateProps(props) {\n if (!this.props) {\n throw new Error(\n `Can't set props on this thermometer. Check that you correctly initialised it with props.`\n );\n }\n\n if (!props) {\n throw new Error(`Can't set props to null or undefined.`);\n }\n\n this.props = { ...this.props, ...props };\n this.render();\n }\n\n /**\n * Updates the redux store state associated with the donations thermometer.\n * @param {State} attrs\n */\n public updateStore(attrs) {\n if (!this.store) {\n throw new Error(\n `Can't update the store on this thermometer. Check that you initialised it with a (redux) store`\n );\n }\n\n if (!attrs) {\n throw new Error(`Can't update the store with null or undefined.`);\n }\n\n this.store.dispatch(update(attrs));\n }\n\n public renderWithProps() {\n return render(\n \n \n ,\n this.el\n );\n }\n\n public renderWithStore() {\n return render(\n \n \n ,\n this.el\n );\n }\n\n // Renders a component with props or with the redux store.\n // Props will always take precedence if present.\n public render() {\n if (this.component) {\n return this.renderWithComponent();\n }\n\n if (this.props) {\n return this.renderWithProps();\n }\n if (this.store) {\n return this.renderWithStore();\n }\n }\n}\n\nexport const init = options => {\n options.el =\n options.el ||\n document.getElementById(`chmp-inline-thermometer__${options.config.ref}`);\n\n if (!options.el) {\n return;\n }\n\n return new DonationsThermometer({\n config: options.config,\n customRenderer: options.customRenderer,\n el: options.el,\n eventEmitter: options.eventEmitter,\n namespace: 'donationsthermometer',\n store: options.store,\n });\n};\n","import * as EventEmitter from 'eventemitter3';\nimport { unmountComponentAtNode } from 'react-dom';\nimport { Store } from 'redux';\nimport { IAppState } from '../types';\n\nexport interface IPluginConfig {\n id: number;\n active: boolean;\n page_id: number;\n ref: string;\n created_at?: string;\n updated_at?: string;\n}\n\nexport interface IPluginOptions {\n config: T;\n customRenderer?: (instance: any) => any | undefined;\n el: HTMLElement;\n eventEmitter?: any;\n namespace?: string;\n store?: Store;\n}\n\n// Plugin is the base class from which other\n// plugins inherit. It implements an EventEmitter\n// with some basic lifecycle methods;\nexport default class Plugin\n implements IPluginOptions {\n public el: HTMLElement;\n public namespace: string;\n public config: T;\n public events: EventEmitter;\n public customRenderer: (instance: any) => any | undefined;\n public store?: Store;\n\n constructor(options: IPluginOptions) {\n this.config = options.config;\n this.el = options.el;\n this.events = options.eventEmitter || new EventEmitter.EventEmitter();\n this.namespace = options.namespace || '';\n this.store = options.store;\n if (options.customRenderer) {\n this.customRenderer = options.customRenderer;\n }\n }\n\n public emit(eventName: string, data?: any) {\n this.events.emit(this.privateEventName(eventName), data);\n this.events.emit(`${this.namespace}:${eventName}`, data);\n }\n\n public on(eventName: string, listener: EventEmitter.ListenerFn, ctx: any) {\n return this.events.on(this.privateEventName(eventName), listener, ctx);\n }\n\n public listeners(eventName: string) {\n return this.events.listeners(this.privateEventName(eventName));\n }\n\n public update(options: Partial>) {\n if (options.namespace) {\n this.namespace = options.namespace;\n }\n if (options.el) {\n this.el = options.el;\n }\n if (options.config) {\n Object.assign(this.config, options.config);\n }\n this.emit('updated');\n }\n\n get renderer() {\n return this.customRenderer;\n }\n\n set renderer(customRenderer: (instance: any) => any) {\n this.customRenderer = customRenderer;\n\n if (this['render']) {\n unmountComponentAtNode(this.el);\n this['render']();\n }\n }\n\n private privateEventName(eventName: string) {\n return `${this.namespace}:${this.config.ref}:${eventName}`;\n }\n}\n","import { isEmpty, mapValues } from 'lodash';\n\nconst defaults = {};\n\nexport default function reducer(state = defaults, action) {\n switch (action.type) {\n case '@@chmp:initialize':\n return getStateFromChampaign(action.payload);\n case '@@chmp:thermometer:update':\n return { ...state, ...action.attrs };\n default:\n return state;\n }\n}\n\nexport function update(attrs) {\n return { type: '@@chmp:thermometer:update', attrs };\n}\n\nfunction getStateFromChampaign(chmp) {\n const data = chmp.personalization.donationsThermometer;\n if (isEmpty(data)) return {};\n return {\n active: data.active,\n offset: data.offset,\n title: data.title,\n goals: data.goals,\n remainingAmounts: data.remaining_amounts,\n totalDonations: data.total_donations,\n };\n}\n"],"names":["replaceInterpolations","value","replace","translations","mapValues","I18n","tree","flatten","loadTranslations","locale","Error","concat","WrapInStore","options","store","React","Provider","children","ComponentWrapper","_Component","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","key","IntlProvider","this","props","messages","className","Component","addLocaleData","_toConsumableArray","enLocaleData","deLocaleData","frLocaleData","esLocaleData","ptLocaleData","nlLocaleData","arLocaleData","CONFIG","style","minimumFractionDigits","maximumFractionDigits","CurrencyAmount","currency","amount","pointerEvents","FormattedNumber","Object","assign","Thermometer","isEmpty","active","goal","goals","donations","min","total_donations","percentage","Math","round","FormattedMessage","id","defaultMessage","width","connect","state","data","donationsThermometer","fundraiser","totalDonations","offset","title","DonationsThermometer","_Plugin","_this","call","component","customRenderer","el","render","get","getState","set","attrs","dispatch","update","window","_objectSpread","ConnectedThermometer","renderWithComponent","renderWithProps","renderWithStore","Plugin","init","document","getElementById","config","ref","eventEmitter","namespace","events","EventEmitter","eventName","emit","privateEventName","listener","ctx","on","listeners","unmountComponentAtNode","defaults","reducer","chmp","length","undefined","action","type","payload","personalization","remainingAmounts","remaining_amounts"],"sourceRoot":""}