2018-05-22 19:31:43 +00:00
|
|
|
|
import QueryString from 'qs';
|
2018-08-14 00:06:50 +00:00
|
|
|
|
import classNames from 'classnames';
|
2018-04-12 20:21:21 +00:00
|
|
|
|
|
2018-07-09 21:29:13 +00:00
|
|
|
|
// This file provides helpers for the Style Guide, exposed at 'util' in the global scope
|
|
|
|
|
// via the 'context' option in react-styleguidist.
|
2018-04-03 22:56:12 +00:00
|
|
|
|
|
2018-07-09 21:29:13 +00:00
|
|
|
|
import { default as _ } from 'lodash';
|
2018-04-05 19:41:48 +00:00
|
|
|
|
export { ConversationContext } from './ConversationContext';
|
2018-04-03 22:56:12 +00:00
|
|
|
|
|
2018-08-14 00:06:50 +00:00
|
|
|
|
export { _, classNames };
|
2018-04-05 15:30:30 +00:00
|
|
|
|
|
|
|
|
|
// TypeScript wants two things when you import:
|
|
|
|
|
// 1) a normal typescript file
|
2018-04-05 19:39:34 +00:00
|
|
|
|
// 2) a javascript file with type definitions
|
2018-04-05 15:30:30 +00:00
|
|
|
|
// Anything else will raise an error, that it can't find the module. And so, we ignore...
|
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
2018-04-05 22:30:40 +00:00
|
|
|
|
import gif from '../../fixtures/giphy-GVNvOUpeYmI7e.gif';
|
2018-07-09 21:29:13 +00:00
|
|
|
|
// 320x240
|
2018-04-12 06:55:32 +00:00
|
|
|
|
const gifObjectUrl = makeObjectUrl(gif, 'image/gif');
|
2018-04-05 15:30:30 +00:00
|
|
|
|
// @ts-ignore
|
2018-04-05 22:30:40 +00:00
|
|
|
|
import mp3 from '../../fixtures/incompetech-com-Agnus-Dei-X.mp3';
|
2018-04-12 06:55:32 +00:00
|
|
|
|
const mp3ObjectUrl = makeObjectUrl(mp3, 'audio/mp3');
|
2018-04-05 15:30:30 +00:00
|
|
|
|
// @ts-ignore
|
2018-04-05 22:30:40 +00:00
|
|
|
|
import txt from '../../fixtures/lorem-ipsum.txt';
|
2018-04-12 06:55:32 +00:00
|
|
|
|
const txtObjectUrl = makeObjectUrl(txt, 'text/plain');
|
2018-04-05 15:30:30 +00:00
|
|
|
|
// @ts-ignore
|
2018-04-05 22:30:40 +00:00
|
|
|
|
import mp4 from '../../fixtures/pixabay-Soap-Bubble-7141.mp4';
|
2018-04-12 06:55:32 +00:00
|
|
|
|
const mp4ObjectUrl = makeObjectUrl(mp4, 'video/mp4');
|
2018-06-27 20:53:49 +00:00
|
|
|
|
// @ts-ignore
|
|
|
|
|
import png from '../../fixtures/freepngs-2cd43b_bed7d1327e88454487397574d87b64dc_mv2.png';
|
2018-07-09 21:29:13 +00:00
|
|
|
|
// 800×1200
|
2018-06-27 20:53:49 +00:00
|
|
|
|
const pngObjectUrl = makeObjectUrl(png, 'image/png');
|
2018-04-12 06:55:32 +00:00
|
|
|
|
|
2018-04-16 23:23:05 +00:00
|
|
|
|
// @ts-ignore
|
|
|
|
|
import landscapeGreen from '../../fixtures/1000x50-green.jpeg';
|
|
|
|
|
const landscapeGreenObjectUrl = makeObjectUrl(landscapeGreen, 'image/jpeg');
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
import landscapePurple from '../../fixtures/200x50-purple.png';
|
|
|
|
|
const landscapePurpleObjectUrl = makeObjectUrl(landscapePurple, 'image/png');
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
import portraitYellow from '../../fixtures/20x200-yellow.png';
|
|
|
|
|
const portraitYellowObjectUrl = makeObjectUrl(portraitYellow, 'image/png');
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
import landscapeRed from '../../fixtures/300x1-red.jpeg';
|
|
|
|
|
const landscapeRedObjectUrl = makeObjectUrl(landscapeRed, 'image/png');
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
import portraitTeal from '../../fixtures/50x1000-teal.jpeg';
|
|
|
|
|
const portraitTealObjectUrl = makeObjectUrl(portraitTeal, 'image/png');
|
|
|
|
|
|
2018-04-12 06:55:32 +00:00
|
|
|
|
function makeObjectUrl(data: ArrayBuffer, contentType: string): string {
|
|
|
|
|
const blob = new Blob([data], {
|
|
|
|
|
type: contentType,
|
|
|
|
|
});
|
2018-05-22 19:31:43 +00:00
|
|
|
|
|
2018-04-12 06:55:32 +00:00
|
|
|
|
return URL.createObjectURL(blob);
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-05 15:30:30 +00:00
|
|
|
|
export {
|
|
|
|
|
mp3,
|
2018-04-12 06:55:32 +00:00
|
|
|
|
mp3ObjectUrl,
|
2018-04-05 15:30:30 +00:00
|
|
|
|
gif,
|
2018-04-12 06:55:32 +00:00
|
|
|
|
gifObjectUrl,
|
2018-04-05 15:30:30 +00:00
|
|
|
|
mp4,
|
2018-04-12 06:55:32 +00:00
|
|
|
|
mp4ObjectUrl,
|
2018-06-27 20:53:49 +00:00
|
|
|
|
png,
|
|
|
|
|
pngObjectUrl,
|
2018-04-05 15:30:30 +00:00
|
|
|
|
txt,
|
2018-04-12 06:55:32 +00:00
|
|
|
|
txtObjectUrl,
|
2018-04-16 23:23:05 +00:00
|
|
|
|
landscapeGreen,
|
|
|
|
|
landscapeGreenObjectUrl,
|
|
|
|
|
landscapePurple,
|
|
|
|
|
landscapePurpleObjectUrl,
|
|
|
|
|
portraitYellow,
|
|
|
|
|
portraitYellowObjectUrl,
|
|
|
|
|
landscapeRed,
|
|
|
|
|
landscapeRedObjectUrl,
|
|
|
|
|
portraitTeal,
|
|
|
|
|
portraitTealObjectUrl,
|
2018-04-05 15:30:30 +00:00
|
|
|
|
};
|
|
|
|
|
|
2018-04-05 15:31:43 +00:00
|
|
|
|
const query = window.location.search.replace(/^\?/, '');
|
2018-05-22 19:31:43 +00:00
|
|
|
|
const urlOptions = QueryString.parse(query);
|
2018-06-25 23:57:06 +00:00
|
|
|
|
const theme = urlOptions.theme || 'light-theme';
|
2018-04-05 15:31:43 +00:00
|
|
|
|
const locale = urlOptions.locale || 'en';
|
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
2018-04-05 22:30:40 +00:00
|
|
|
|
import localeMessages from '../../_locales/en/messages.json';
|
2018-04-05 15:31:43 +00:00
|
|
|
|
|
|
|
|
|
// @ts-ignore
|
2018-04-05 22:30:40 +00:00
|
|
|
|
import { setup } from '../../js/modules/i18n';
|
2018-04-05 15:31:43 +00:00
|
|
|
|
const i18n = setup(locale, localeMessages);
|
|
|
|
|
|
2018-09-26 00:26:06 +00:00
|
|
|
|
export { theme, locale, i18n };
|
2018-04-03 22:56:12 +00:00
|
|
|
|
|
2018-04-12 06:55:32 +00:00
|
|
|
|
// Telling Lodash to relinquish _ for use by underscore
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
_.noConflict();
|