@cu-mkp/editioncrafter 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/dist/cjs/src/action/CommentActions.js +20 -0
  2. package/dist/cjs/src/action/DiplomaticActions.js +19 -0
  3. package/dist/cjs/src/action/DocumentActions.js +188 -0
  4. package/dist/cjs/src/action/GlossaryActions.js +20 -0
  5. package/dist/cjs/src/action/initialState/commentInitialState.js +13 -0
  6. package/dist/cjs/src/action/initialState/diplomaticInitialState.js +10 -0
  7. package/dist/cjs/src/action/initialState/documentInitialState.js +17 -0
  8. package/dist/cjs/src/action/initialState/glossaryInitialState.js +13 -0
  9. package/dist/cjs/src/action/rootReducer.js +30 -0
  10. package/dist/cjs/src/component/AlphabetLinks.js +76 -0
  11. package/dist/cjs/src/component/CustomizedTooltops.js +173 -0
  12. package/dist/cjs/src/component/DiploMatic.js +90 -0
  13. package/dist/cjs/src/component/DocumentView.js +427 -0
  14. package/dist/cjs/src/component/EditorComment.js +124 -0
  15. package/dist/cjs/src/component/ErrorBoundary.js +71 -0
  16. package/dist/cjs/src/component/FigureImage.js +82 -0
  17. package/dist/cjs/src/component/GlossaryView.js +166 -0
  18. package/dist/cjs/src/component/HelpPopper.js +83 -0
  19. package/dist/cjs/src/component/ImageGridView.js +193 -0
  20. package/dist/cjs/src/component/ImageView.js +125 -0
  21. package/dist/cjs/src/component/ImageZoomControl.js +67 -0
  22. package/dist/cjs/src/component/JumpToFolio.js +103 -0
  23. package/dist/cjs/src/component/Navigation.js +266 -0
  24. package/dist/cjs/src/component/Pagination.js +81 -0
  25. package/dist/cjs/src/component/RouteListener.js +66 -0
  26. package/dist/cjs/src/component/SeaDragonComponent.js +51 -0
  27. package/dist/cjs/src/component/SinglePaneView.js +46 -0
  28. package/dist/cjs/src/component/SplitPaneView.js +164 -0
  29. package/dist/cjs/src/component/TranscriptionView.js +147 -0
  30. package/dist/cjs/src/component/XMLView.js +154 -0
  31. package/dist/cjs/src/globals.d.ts +1 -0
  32. package/dist/cjs/src/hocs/withRouter.js +29 -0
  33. package/dist/cjs/src/icons/ByIcon.js +27 -0
  34. package/dist/cjs/src/icons/CcIcon.js +27 -0
  35. package/dist/cjs/src/icons/NcIcon.js +27 -0
  36. package/dist/cjs/src/icons/SaIcon.js +27 -0
  37. package/dist/cjs/src/icons/SideMenuIconLeft.js +49 -0
  38. package/dist/cjs/src/icons/SideMenuIconRight.js +49 -0
  39. package/dist/cjs/src/index.js +34 -0
  40. package/dist/cjs/src/lib/copyObject.js +11 -0
  41. package/dist/cjs/src/lib/registerServiceWorker.js +95 -0
  42. package/dist/cjs/src/model/DocumentHelper.js +17 -0
  43. package/dist/cjs/src/model/Folio.js +92 -0
  44. package/dist/cjs/src/model/ReduxStore.js +110 -0
  45. package/dist/cjs/src/model/folioLayout.js +416 -0
  46. package/dist/cjs/src/polyfills.js +212 -0
  47. package/dist/cjs/src/saga/RouteListenerSaga.js +198 -0
  48. package/dist/cjs/src/saga/rootSaga.js +23 -0
  49. package/dist/cjs/src/scss/_CETEIcean.scss +914 -0
  50. package/dist/cjs/src/scss/_base.scss +187 -0
  51. package/dist/cjs/src/scss/_diplomatic.scss +332 -0
  52. package/dist/cjs/src/scss/_globalNavigation.scss +34 -0
  53. package/dist/cjs/src/scss/_glossary.scss +105 -0
  54. package/dist/cjs/src/scss/_imageGridView.scss +60 -0
  55. package/dist/cjs/src/scss/_imageView.scss +16 -0
  56. package/dist/cjs/src/scss/_imageZoomControl.scss +51 -0
  57. package/dist/cjs/src/scss/_jumpbox.scss +42 -0
  58. package/dist/cjs/src/scss/_navigation.scss +135 -0
  59. package/dist/cjs/src/scss/_pagination.scss +36 -0
  60. package/dist/cjs/src/scss/_spinner.scss +60 -0
  61. package/dist/cjs/src/scss/_splitPaneView.scss +35 -0
  62. package/dist/cjs/src/scss/_thumbnails.scss +17 -0
  63. package/dist/cjs/src/scss/_transcriptView.scss +178 -0
  64. package/dist/cjs/src/scss/_watermark.scss +19 -0
  65. package/dist/cjs/src/scss/_xmlView.scss +25 -0
  66. package/dist/cjs/src/scss/editioncrafter.scss +109 -0
  67. package/dist/editioncrafter.css +2462 -0
  68. package/dist/editioncrafter.css.map +1 -0
  69. package/dist/editioncrafter.min.js +3 -0
  70. package/dist/editioncrafter.min.js.LICENSE.txt +125 -0
  71. package/dist/editioncrafter.min.js.map +1 -0
  72. package/dist/es/src/action/CommentActions.js +13 -0
  73. package/dist/es/src/action/DiplomaticActions.js +12 -0
  74. package/dist/es/src/action/DocumentActions.js +181 -0
  75. package/dist/es/src/action/GlossaryActions.js +13 -0
  76. package/dist/es/src/action/initialState/commentInitialState.js +7 -0
  77. package/dist/es/src/action/initialState/diplomaticInitialState.js +3 -0
  78. package/dist/es/src/action/initialState/documentInitialState.js +11 -0
  79. package/dist/es/src/action/initialState/glossaryInitialState.js +7 -0
  80. package/dist/es/src/action/rootReducer.js +23 -0
  81. package/dist/es/src/component/AlphabetLinks.js +67 -0
  82. package/dist/es/src/component/CustomizedTooltops.js +165 -0
  83. package/dist/es/src/component/DiploMatic.js +80 -0
  84. package/dist/es/src/component/DocumentView.js +417 -0
  85. package/dist/es/src/component/EditorComment.js +114 -0
  86. package/dist/es/src/component/ErrorBoundary.js +63 -0
  87. package/dist/es/src/component/FigureImage.js +74 -0
  88. package/dist/es/src/component/GlossaryView.js +156 -0
  89. package/dist/es/src/component/HelpPopper.js +75 -0
  90. package/dist/es/src/component/ImageGridView.js +185 -0
  91. package/dist/es/src/component/ImageView.js +115 -0
  92. package/dist/es/src/component/ImageZoomControl.js +60 -0
  93. package/dist/es/src/component/JumpToFolio.js +95 -0
  94. package/dist/es/src/component/Navigation.js +256 -0
  95. package/dist/es/src/component/Pagination.js +73 -0
  96. package/dist/es/src/component/RouteListener.js +58 -0
  97. package/dist/es/src/component/SeaDragonComponent.js +42 -0
  98. package/dist/es/src/component/SinglePaneView.js +37 -0
  99. package/dist/es/src/component/SplitPaneView.js +155 -0
  100. package/dist/es/src/component/TranscriptionView.js +137 -0
  101. package/dist/es/src/component/XMLView.js +144 -0
  102. package/dist/es/src/globals.d.ts +1 -0
  103. package/dist/es/src/hocs/withRouter.js +22 -0
  104. package/dist/es/src/icons/ByIcon.js +18 -0
  105. package/dist/es/src/icons/CcIcon.js +18 -0
  106. package/dist/es/src/icons/NcIcon.js +18 -0
  107. package/dist/es/src/icons/SaIcon.js +18 -0
  108. package/dist/es/src/icons/SideMenuIconLeft.js +40 -0
  109. package/dist/es/src/icons/SideMenuIconRight.js +40 -0
  110. package/dist/es/src/index.js +27 -0
  111. package/dist/es/src/lib/copyObject.js +4 -0
  112. package/dist/es/src/lib/registerServiceWorker.js +88 -0
  113. package/dist/es/src/model/DocumentHelper.js +10 -0
  114. package/dist/es/src/model/Folio.js +85 -0
  115. package/dist/es/src/model/ReduxStore.js +101 -0
  116. package/dist/es/src/model/folioLayout.js +407 -0
  117. package/dist/es/src/polyfills.js +216 -0
  118. package/dist/es/src/saga/RouteListenerSaga.js +191 -0
  119. package/dist/es/src/saga/rootSaga.js +16 -0
  120. package/dist/es/src/scss/_CETEIcean.scss +914 -0
  121. package/dist/es/src/scss/_base.scss +187 -0
  122. package/dist/es/src/scss/_diplomatic.scss +332 -0
  123. package/dist/es/src/scss/_globalNavigation.scss +34 -0
  124. package/dist/es/src/scss/_glossary.scss +105 -0
  125. package/dist/es/src/scss/_imageGridView.scss +60 -0
  126. package/dist/es/src/scss/_imageView.scss +16 -0
  127. package/dist/es/src/scss/_imageZoomControl.scss +51 -0
  128. package/dist/es/src/scss/_jumpbox.scss +42 -0
  129. package/dist/es/src/scss/_navigation.scss +135 -0
  130. package/dist/es/src/scss/_pagination.scss +36 -0
  131. package/dist/es/src/scss/_spinner.scss +60 -0
  132. package/dist/es/src/scss/_splitPaneView.scss +35 -0
  133. package/dist/es/src/scss/_thumbnails.scss +17 -0
  134. package/dist/es/src/scss/_transcriptView.scss +178 -0
  135. package/dist/es/src/scss/_watermark.scss +19 -0
  136. package/dist/es/src/scss/_xmlView.scss +25 -0
  137. package/dist/es/src/scss/editioncrafter.scss +109 -0
  138. package/package.json +119 -0
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { createTheme, ThemeProvider } from '@material-ui/core/styles';
3
+ import DiploMatic from './component/DiploMatic';
4
+ import { createReduxStore } from './model/ReduxStore';
5
+
6
+ /**
7
+ * Default instantiation
8
+ */
9
+ var EditionCrafter = function EditionCrafter(props) {
10
+ var theme = createTheme({
11
+ palette: {
12
+ primary: {
13
+ main: '#792421'
14
+ },
15
+ secondary: {
16
+ main: '#EBE3DD'
17
+ }
18
+ }
19
+ });
20
+ return /*#__PURE__*/React.createElement(ThemeProvider, {
21
+ theme: theme
22
+ }, /*#__PURE__*/React.createElement(DiploMatic, {
23
+ config: props.config,
24
+ store: createReduxStore(props.config)
25
+ }));
26
+ };
27
+ export default EditionCrafter;
@@ -0,0 +1,4 @@
1
+ function copyObject(a) {
2
+ return JSON.parse(JSON.stringify(a));
3
+ }
4
+ export default copyObject;
@@ -0,0 +1,88 @@
1
+ // In production, we register a service worker to serve assets from local cache.
2
+
3
+ // This lets the app load faster on subsequent visits in production, and gives
4
+ // it offline capabilities. However, it also means that developers (and users)
5
+ // will only see deployed updates on the "N+1" visit to a page, since previously
6
+ // cached resources are updated in the background.
7
+
8
+ // To learn more about the benefits of this model, read https://goo.gl/KwvDNy.
9
+ // This link also includes instructions on opting out of this behavior.
10
+
11
+ var isLocalhost = Boolean(window.location.hostname === 'localhost'
12
+ // [::1] is the IPv6 localhost address.
13
+ || window.location.hostname === '[::1]'
14
+ // 127.0.0.1/8 is considered localhost for IPv4.
15
+ || window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));
16
+ export default function register() {
17
+ if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
18
+ // The URL constructor is available in all browsers that support SW.
19
+ var publicUrl = new URL(process.env.PUBLIC_URL, window.location);
20
+ if (publicUrl.origin !== window.location.origin) {
21
+ // Our service worker won't work if PUBLIC_URL is on a different origin
22
+ // from what our page is served on. This might happen if a CDN is used to
23
+ // serve assets; see https://github.com/facebookincubator/create-react-app/issues/2374
24
+ return;
25
+ }
26
+ window.addEventListener('load', function () {
27
+ var swUrl = "".concat(process.env.PUBLIC_URL, "/service-worker.js");
28
+ if (isLocalhost) {
29
+ // This is running on localhost. Lets check if a service worker still exists or not.
30
+ checkValidServiceWorker(swUrl);
31
+ } else {
32
+ // Is not local host. Just register service worker
33
+ registerValidSW(swUrl);
34
+ }
35
+ });
36
+ }
37
+ }
38
+ function registerValidSW(swUrl) {
39
+ navigator.serviceWorker.register(swUrl).then(function (registration) {
40
+ registration.onupdatefound = function () {
41
+ var installingWorker = registration.installing;
42
+ installingWorker.onstatechange = function () {
43
+ if (installingWorker.state === 'installed') {
44
+ if (navigator.serviceWorker.controller) {
45
+ // At this point, the old content will have been purged and
46
+ // the fresh content will have been added to the cache.
47
+ // It's the perfect time to display a "New content is
48
+ // available; please refresh." message in your web app.
49
+ console.log('New content is available; please refresh.');
50
+ } else {
51
+ // At this point, everything has been precached.
52
+ // It's the perfect time to display a
53
+ // "Content is cached for offline use." message.
54
+ console.log('Content is cached for offline use.');
55
+ }
56
+ }
57
+ };
58
+ };
59
+ })["catch"](function (error) {
60
+ console.error('Error during service worker registration:', error);
61
+ });
62
+ }
63
+ function checkValidServiceWorker(swUrl) {
64
+ // Check if the service worker can be found. If it can't reload the page.
65
+ fetch(swUrl).then(function (response) {
66
+ // Ensure service worker exists, and that we really are getting a JS file.
67
+ if (response.status === 404 || response.headers.get('content-type').indexOf('javascript') === -1) {
68
+ // No service worker found. Probably a different app. Reload the page.
69
+ navigator.serviceWorker.ready.then(function (registration) {
70
+ registration.unregister().then(function () {
71
+ window.location.reload();
72
+ });
73
+ });
74
+ } else {
75
+ // Service worker found. Proceed as normal.
76
+ registerValidSW(swUrl);
77
+ }
78
+ })["catch"](function () {
79
+ console.log('No internet connection found. App is running in offline mode.');
80
+ });
81
+ }
82
+ export function unregister() {
83
+ if ('serviceWorker' in navigator) {
84
+ navigator.serviceWorker.ready.then(function (registration) {
85
+ registration.unregister();
86
+ });
87
+ }
88
+ }
@@ -0,0 +1,10 @@
1
+ var DocumentHelper = {};
2
+ DocumentHelper.transcriptionTypeLabels = {
3
+ tc: 'Diplomatic (FR)',
4
+ tcn: 'Normalized (FR)',
5
+ tl: 'Translation (EN)',
6
+ f: 'Facsimile',
7
+ anno: 'Research Esssay',
8
+ glossary: 'Glossary'
9
+ };
10
+ export default DocumentHelper;
@@ -0,0 +1,85 @@
1
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
2
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
8
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
9
+ import OpenSeadragon from 'openseadragon';
10
+ import axios from 'axios';
11
+ import { layoutMargin3 } from './folioLayout';
12
+ export function loadFolio(folioData) {
13
+ if (folioData.loading) {
14
+ // promise to resolve this immediately
15
+ return new Promise(function (resolve) {
16
+ resolve(folioData);
17
+ });
18
+ }
19
+ folioData.loading = true;
20
+ var folio = _objectSpread({}, folioData);
21
+
22
+ // promise to load all the data for this folio
23
+ return new Promise(function (resolve, reject) {
24
+ var transcriptionTypes = Object.keys(folio.annotationURLs);
25
+ if (transcriptionTypes.length > 0) {
26
+ axios.get(folio.image_zoom_url).then(function (imageServerResponse) {
27
+ // Handle the image server response
28
+ folio.tileSource = new OpenSeadragon.IIIFTileSource(imageServerResponse.data);
29
+ var _iterator = _createForOfIteratorHelper(transcriptionTypes),
30
+ _step;
31
+ try {
32
+ var _loop = function _loop() {
33
+ var transcriptionType = _step.value;
34
+ var _folio$annotationURLs = folio.annotationURLs[transcriptionType],
35
+ htmlURL = _folio$annotationURLs.htmlURL,
36
+ xmlURL = _folio$annotationURLs.xmlURL;
37
+ if (!folio.transcription) folio.transcription = {};
38
+ folio.transcription[transcriptionType] = {};
39
+ axios.all([axios.get(htmlURL), axios.get(xmlURL)]).then(axios.spread(function (htmlResponse, xmlResponse) {
40
+ var transcription = parseTranscription(htmlResponse.data, xmlResponse.data);
41
+ if (!transcription) {
42
+ reject(new Error("Unable to load transcription: ".concat(htmlURL)));
43
+ } else {
44
+ folio.transcription[transcriptionType] = transcription;
45
+ folio.loading = false;
46
+ resolve(folio);
47
+ }
48
+ }))["catch"](function (error) {
49
+ folioData.loading = false;
50
+ reject(error);
51
+ });
52
+ };
53
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
54
+ _loop();
55
+ }
56
+ } catch (err) {
57
+ _iterator.e(err);
58
+ } finally {
59
+ _iterator.f();
60
+ }
61
+ })["catch"](function (error) {
62
+ folioData.loading = false;
63
+ reject(error);
64
+ });
65
+ } else {
66
+ // if there is no annotatation list, just load the image and provide a blank transcription
67
+ axios.get(folio.image_zoom_url).then(function (imageServerResponse) {
68
+ folio.tileSource = new OpenSeadragon.IIIFTileSource(imageServerResponse.data);
69
+ folio.loading = false;
70
+ resolve(folio);
71
+ })["catch"](function (error) {
72
+ folioData.loading = false;
73
+ reject(error);
74
+ });
75
+ }
76
+ });
77
+ }
78
+
79
+ // returns transcription or error message if unable to parse
80
+ function parseTranscription(html, xml) {
81
+ var transcriptionData = layoutMargin3(html);
82
+ return _objectSpread(_objectSpread({}, transcriptionData), {}, {
83
+ xml: xml
84
+ });
85
+ }
@@ -0,0 +1,101 @@
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
6
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
7
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
9
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
10
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
12
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
13
+ var _marked = /*#__PURE__*/_regeneratorRuntime().mark(putResolveAction);
14
+ import { createStore, applyMiddleware } from 'redux';
15
+ import createSagaMiddleware from 'redux-saga';
16
+ import { put } from 'redux-saga/effects';
17
+ import rootReducer from '../action/rootReducer';
18
+ import rootSaga from '../saga/rootSaga';
19
+
20
+ // Call this once to create a new redux store that is properly configured.
21
+ export function createReduxStore(config) {
22
+ var sagaMiddleware = createSagaMiddleware();
23
+ var store = createStore(rootReducer(config), window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(), applyMiddleware(sagaMiddleware));
24
+ sagaMiddleware.run(rootSaga);
25
+ return store;
26
+ }
27
+
28
+ // Dispatch the action with the given parameters.
29
+ export function dispatchAction(props, action) {
30
+ for (var _len = arguments.length, params = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
31
+ params[_key - 2] = arguments[_key];
32
+ }
33
+ props.dispatch({
34
+ type: action,
35
+ payload: {
36
+ params: params,
37
+ dispatcher: {
38
+ dispatch: props.dispatch
39
+ }
40
+ }
41
+ });
42
+ }
43
+
44
+ // Dispatch the action via Redux Saga.
45
+ export function putResolveAction(action) {
46
+ var _len2,
47
+ params,
48
+ _key2,
49
+ _args = arguments;
50
+ return _regeneratorRuntime().wrap(function putResolveAction$(_context) {
51
+ while (1) switch (_context.prev = _context.next) {
52
+ case 0:
53
+ for (_len2 = _args.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
54
+ params[_key2 - 1] = _args[_key2];
55
+ }
56
+ _context.next = 3;
57
+ return put({
58
+ type: action,
59
+ payload: {
60
+ params: params
61
+ }
62
+ });
63
+ case 3:
64
+ return _context.abrupt("return", _context.sent);
65
+ case 4:
66
+ case "end":
67
+ return _context.stop();
68
+ }
69
+ }, _marked);
70
+ }
71
+
72
+ // Take the action and call it with the current redux state.
73
+ function reducer(state, actionFn, action) {
74
+ var params = action.payload && action.payload.params ? action.payload.params : [];
75
+ return actionFn.apply(void 0, [state].concat(_toConsumableArray(params), [action.payload.dispatcher]));
76
+ }
77
+ function getActionFn(action, actionModule) {
78
+ var parts = action.split('.');
79
+ return actionModule[parts[1]];
80
+ }
81
+
82
+ // Create a reducer that only services actions in the action set.
83
+ export function createReducer(actionModuleName, actionModule, initialState) {
84
+ // get the function keys from the module itself
85
+ var actionNames = [];
86
+ for (var _i = 0, _Object$keys = Object.keys(actionModule); _i < _Object$keys.length; _i++) {
87
+ var action = _Object$keys[_i];
88
+ actionNames.push("".concat(actionModuleName, ".").concat(action));
89
+ }
90
+ function scopedReducer() {
91
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
92
+ var action = arguments.length > 1 ? arguments[1] : undefined;
93
+ var validActions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : actionNames;
94
+ var mod = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : actionModule;
95
+ if (validActions.includes(action.type)) {
96
+ return reducer(state, getActionFn(action.type, mod), action);
97
+ }
98
+ return _objectSpread({}, state);
99
+ }
100
+ return scopedReducer;
101
+ }