@harvard-lts/mirador-citation-plugin 0.0.6 → 0.0.9

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 (2) hide show
  1. package/dist/es/index.js +74 -218
  2. package/package.json +1 -1
package/dist/es/index.js CHANGED
@@ -34,9 +34,6 @@ import LayersIcon from '@material-ui/icons/LayersSharp';
34
34
  import SearchIcon from '@material-ui/icons/SearchSharp';
35
35
  import CanvasIndexIcon from 'mirador/dist/es/src/components/icons/CanvasIndexIcon';
36
36
 
37
- function _OverloadYield(e, d) {
38
- this.v = e, this.k = d;
39
- }
40
37
  function _assertThisInitialized(e) {
41
38
  if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
42
39
  return e;
@@ -229,45 +226,6 @@ function _regenerator() {
229
226
  };
230
227
  })();
231
228
  }
232
- function _regeneratorAsync(n, e, r, t, o) {
233
- var a = _regeneratorAsyncGen(n, e, r, t, o);
234
- return a.next().then(function (n) {
235
- return n.done ? n.value : a.next();
236
- });
237
- }
238
- function _regeneratorAsyncGen(r, e, t, o, n) {
239
- return new _regeneratorAsyncIterator(_regenerator().w(r, e, t, o), n || Promise);
240
- }
241
- function _regeneratorAsyncIterator(t, e) {
242
- function n(r, o, i, f) {
243
- try {
244
- var c = t[r](o),
245
- u = c.value;
246
- return u instanceof _OverloadYield ? e.resolve(u.v).then(function (t) {
247
- n("next", t, i, f);
248
- }, function (t) {
249
- n("throw", t, i, f);
250
- }) : e.resolve(u).then(function (t) {
251
- c.value = t, i(c);
252
- }, function (t) {
253
- return n("throw", t, i, f);
254
- });
255
- } catch (t) {
256
- f(t);
257
- }
258
- }
259
- var r;
260
- this.next || (_regeneratorDefine(_regeneratorAsyncIterator.prototype), _regeneratorDefine(_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
261
- return this;
262
- })), _regeneratorDefine(this, "_invoke", function (t, o, i) {
263
- function f() {
264
- return new e(function (e, r) {
265
- n(t, i, e, r);
266
- });
267
- }
268
- return r = r ? r.then(f, f) : f();
269
- }, !0);
270
- }
271
229
  function _regeneratorDefine(e, r, n, t) {
272
230
  var i = Object.defineProperty;
273
231
  try {
@@ -289,32 +247,6 @@ function _regeneratorDefine(e, r, n, t) {
289
247
  }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
290
248
  }, _regeneratorDefine(e, r, n, t);
291
249
  }
292
- function _regeneratorKeys(e) {
293
- var n = Object(e),
294
- r = [];
295
- for (var t in n) r.unshift(t);
296
- return function e() {
297
- for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e;
298
- return e.done = !0, e;
299
- };
300
- }
301
- function _regeneratorValues(e) {
302
- if (null != e) {
303
- var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
304
- r = 0;
305
- if (t) return t.call(e);
306
- if ("function" == typeof e.next) return e;
307
- if (!isNaN(e.length)) return {
308
- next: function () {
309
- return e && r >= e.length && (e = void 0), {
310
- value: e && e[r++],
311
- done: !e
312
- };
313
- }
314
- };
315
- }
316
- throw new TypeError(typeof e + " is not iterable");
317
- }
318
250
  function _setPrototypeOf(t, e) {
319
251
  return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
320
252
  return t.__proto__ = e, t;
@@ -334,74 +266,6 @@ function _toPropertyKey(t) {
334
266
  var i = _toPrimitive(t, "string");
335
267
  return "symbol" == typeof i ? i : i + "";
336
268
  }
337
- function _regeneratorRuntime() {
338
-
339
- var r = _regenerator(),
340
- e = r.m(_regeneratorRuntime),
341
- t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
342
- function n(r) {
343
- var e = "function" == typeof r && r.constructor;
344
- return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
345
- }
346
- var o = {
347
- throw: 1,
348
- return: 2,
349
- break: 3,
350
- continue: 3
351
- };
352
- function a(r) {
353
- var e, t;
354
- return function (n) {
355
- e || (e = {
356
- stop: function () {
357
- return t(n.a, 2);
358
- },
359
- catch: function () {
360
- return n.v;
361
- },
362
- abrupt: function (r, e) {
363
- return t(n.a, o[r], e);
364
- },
365
- delegateYield: function (r, o, a) {
366
- return e.resultName = o, t(n.d, _regeneratorValues(r), a);
367
- },
368
- finish: function (r) {
369
- return t(n.f, r);
370
- }
371
- }, t = function (r, t, o) {
372
- n.p = e.prev, n.n = e.next;
373
- try {
374
- return r(t, o);
375
- } finally {
376
- e.next = n.n;
377
- }
378
- }), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
379
- try {
380
- return r.call(this, e);
381
- } finally {
382
- n.p = e.prev, n.n = e.next;
383
- }
384
- };
385
- }
386
- return (_regeneratorRuntime = function () {
387
- return {
388
- wrap: function (e, t, n, o) {
389
- return r.w(a(e), t, n, o && o.reverse());
390
- },
391
- isGeneratorFunction: n,
392
- mark: r.m,
393
- awrap: function (r, e) {
394
- return new _OverloadYield(r, e);
395
- },
396
- AsyncIterator: _regeneratorAsyncIterator,
397
- async: function (r, e, t, o, u) {
398
- return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u);
399
- },
400
- keys: _regeneratorKeys,
401
- values: _regeneratorValues
402
- };
403
- })();
404
- }
405
269
 
406
270
  /**
407
271
  */
@@ -469,11 +333,11 @@ var CitationSidePanel = /*#__PURE__*/function (_Component) {
469
333
  return _createClass(CitationSidePanel, [{
470
334
  key: "componentDidMount",
471
335
  value: function () {
472
- var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
336
+ var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
473
337
  var _this2 = this;
474
338
  var _this$state, manifestId, citationAPI, body;
475
- return _regeneratorRuntime().wrap(function _callee$(_context) {
476
- while (1) switch (_context.prev = _context.next) {
339
+ return _regenerator().w(function (_context) {
340
+ while (1) switch (_context.n) {
477
341
  case 0:
478
342
  _this$state = this.state, manifestId = _this$state.manifestId, citationAPI = _this$state.citationAPI, _this$state.manifestTitle;
479
343
  body = {
@@ -502,9 +366,8 @@ var CitationSidePanel = /*#__PURE__*/function (_Component) {
502
366
  error: error.message
503
367
  });
504
368
  });
505
- case 3:
506
- case "end":
507
- return _context.stop();
369
+ case 1:
370
+ return _context.a(2);
508
371
  }
509
372
  }, _callee, this);
510
373
  }));
@@ -647,16 +510,16 @@ var CitationButton = /*#__PURE__*/function (_Component) {
647
510
  _classCallCheck(this, CitationButton);
648
511
  _this = _callSuper(this, CitationButton, [props]);
649
512
  _defineProperty(_this, "fetchCitationData", /*#__PURE__*/function () {
650
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(manifestId, citationAPI) {
651
- var body, response, citationData;
652
- return _regeneratorRuntime().wrap(function _callee$(_context) {
653
- while (1) switch (_context.prev = _context.next) {
513
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(manifestId, citationAPI) {
514
+ var body, response, citationData, _t;
515
+ return _regenerator().w(function (_context) {
516
+ while (1) switch (_context.p = _context.n) {
654
517
  case 0:
655
518
  body = {
656
519
  "manifest_id": manifestId
657
520
  };
658
- _context.prev = 1;
659
- _context.next = 4;
521
+ _context.p = 1;
522
+ _context.n = 2;
660
523
  return fetch(citationAPI, {
661
524
  method: 'post',
662
525
  body: JSON.stringify(body),
@@ -664,37 +527,36 @@ var CitationButton = /*#__PURE__*/function (_Component) {
664
527
  'Content-Type': 'application/json'
665
528
  }
666
529
  });
667
- case 4:
668
- response = _context.sent;
530
+ case 2:
531
+ response = _context.v;
669
532
  if (response.ok) {
670
- _context.next = 7;
533
+ _context.n = 3;
671
534
  break;
672
535
  }
673
536
  throw new Error('Network response was not ok');
674
- case 7:
675
- _context.next = 9;
537
+ case 3:
538
+ _context.n = 4;
676
539
  return response.json();
677
- case 9:
678
- citationData = _context.sent;
540
+ case 4:
541
+ citationData = _context.v;
679
542
  _this.setState({
680
543
  citationData: citationData,
681
544
  loading: false
682
545
  });
683
- _context.next = 17;
546
+ _context.n = 6;
684
547
  break;
685
- case 13:
686
- _context.prev = 13;
687
- _context.t0 = _context["catch"](1);
688
- console.error('There was a problem receiving the citation:', _context.t0);
548
+ case 5:
549
+ _context.p = 5;
550
+ _t = _context.v;
551
+ console.error('There was a problem receiving the citation:', _t);
689
552
  _this.setState({
690
553
  loading: false,
691
- error: _context.t0.message
554
+ error: _t.message
692
555
  });
693
- case 17:
694
- case "end":
695
- return _context.stop();
556
+ case 6:
557
+ return _context.a(2);
696
558
  }
697
- }, _callee, null, [[1, 13]]);
559
+ }, _callee, null, [[1, 5]]);
698
560
  }));
699
561
  return function (_x, _x2) {
700
562
  return _ref.apply(this, arguments);
@@ -718,10 +580,10 @@ var CitationButton = /*#__PURE__*/function (_Component) {
718
580
  return _createClass(CitationButton, [{
719
581
  key: "componentDidMount",
720
582
  value: function () {
721
- var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
583
+ var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
722
584
  var _this$state, manifestId, citationAPI;
723
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
724
- while (1) switch (_context2.prev = _context2.next) {
585
+ return _regenerator().w(function (_context2) {
586
+ while (1) switch (_context2.n) {
725
587
  case 0:
726
588
  _this$state = this.state, manifestId = _this$state.manifestId, citationAPI = _this$state.citationAPI, _this$state.manifestTitle; // Only fetch if we have the required data
727
589
  if (manifestId && citationAPI) {
@@ -732,9 +594,8 @@ var CitationButton = /*#__PURE__*/function (_Component) {
732
594
  citationAPI: citationAPI
733
595
  });
734
596
  }
735
- case 2:
736
- case "end":
737
- return _context2.stop();
597
+ case 1:
598
+ return _context2.a(2);
738
599
  }
739
600
  }, _callee2, this);
740
601
  }));
@@ -746,10 +607,10 @@ var CitationButton = /*#__PURE__*/function (_Component) {
746
607
  }, {
747
608
  key: "componentDidUpdate",
748
609
  value: function () {
749
- var _componentDidUpdate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(prevProps, prevState) {
610
+ var _componentDidUpdate = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(prevProps, prevState) {
750
611
  var _this$props2, newManifestId, newCitationAPI, newManifestTitle, prevManifestId, prevCitationAPI, _this$state2, manifestId, citationAPI;
751
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
752
- while (1) switch (_context3.prev = _context3.next) {
612
+ return _regenerator().w(function (_context3) {
613
+ while (1) switch (_context3.n) {
753
614
  case 0:
754
615
  // Check if props changed and update state accordingly
755
616
  _this$props2 = this.props, newManifestId = _this$props2.manifestId, newCitationAPI = _this$props2.citationAPI, newManifestTitle = _this$props2.manifestTitle;
@@ -767,9 +628,8 @@ var CitationButton = /*#__PURE__*/function (_Component) {
767
628
  if ((manifestId !== prevManifestId || citationAPI !== prevCitationAPI) && manifestId && citationAPI) {
768
629
  this.fetchCitationData(manifestId, citationAPI);
769
630
  }
770
- case 5:
771
- case "end":
772
- return _context3.stop();
631
+ case 1:
632
+ return _context3.a(2);
773
633
  }
774
634
  }, _callee3, this);
775
635
  }));
@@ -898,11 +758,11 @@ var RelatedLinksSidePanel = /*#__PURE__*/function (_Component) {
898
758
  return _createClass(RelatedLinksSidePanel, [{
899
759
  key: "componentDidMount",
900
760
  value: function () {
901
- var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
761
+ var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
902
762
  var _this2 = this;
903
763
  var _this$state, manifestId, citationAPI, body;
904
- return _regeneratorRuntime().wrap(function _callee$(_context) {
905
- while (1) switch (_context.prev = _context.next) {
764
+ return _regenerator().w(function (_context) {
765
+ while (1) switch (_context.n) {
906
766
  case 0:
907
767
  _this$state = this.state, manifestId = _this$state.manifestId, citationAPI = _this$state.citationAPI, _this$state.manifestTitle;
908
768
  body = {
@@ -931,9 +791,8 @@ var RelatedLinksSidePanel = /*#__PURE__*/function (_Component) {
931
791
  error: error.message
932
792
  });
933
793
  });
934
- case 3:
935
- case "end":
936
- return _context.stop();
794
+ case 1:
795
+ return _context.a(2);
937
796
  }
938
797
  }, _callee, this);
939
798
  }));
@@ -1072,16 +931,16 @@ var RelatedLinksButton = /*#__PURE__*/function (_Component) {
1072
931
  _classCallCheck(this, RelatedLinksButton);
1073
932
  _this = _callSuper(this, RelatedLinksButton, [props]);
1074
933
  _defineProperty(_this, "fetchRelatedLinksData", /*#__PURE__*/function () {
1075
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(manifestId, citationAPI) {
1076
- var body, response, citationData;
1077
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1078
- while (1) switch (_context.prev = _context.next) {
934
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(manifestId, citationAPI) {
935
+ var body, response, citationData, _t;
936
+ return _regenerator().w(function (_context) {
937
+ while (1) switch (_context.p = _context.n) {
1079
938
  case 0:
1080
939
  body = {
1081
940
  "manifest_id": manifestId
1082
941
  };
1083
- _context.prev = 1;
1084
- _context.next = 4;
942
+ _context.p = 1;
943
+ _context.n = 2;
1085
944
  return fetch(citationAPI, {
1086
945
  method: 'post',
1087
946
  body: JSON.stringify(body),
@@ -1089,37 +948,36 @@ var RelatedLinksButton = /*#__PURE__*/function (_Component) {
1089
948
  'Content-Type': 'application/json'
1090
949
  }
1091
950
  });
1092
- case 4:
1093
- response = _context.sent;
951
+ case 2:
952
+ response = _context.v;
1094
953
  if (response.ok) {
1095
- _context.next = 7;
954
+ _context.n = 3;
1096
955
  break;
1097
956
  }
1098
957
  throw new Error('Network response was not ok');
1099
- case 7:
1100
- _context.next = 9;
958
+ case 3:
959
+ _context.n = 4;
1101
960
  return response.json();
1102
- case 9:
1103
- citationData = _context.sent;
961
+ case 4:
962
+ citationData = _context.v;
1104
963
  _this.setState({
1105
964
  citationData: citationData,
1106
965
  loading: false
1107
966
  });
1108
- _context.next = 17;
967
+ _context.n = 6;
1109
968
  break;
1110
- case 13:
1111
- _context.prev = 13;
1112
- _context.t0 = _context["catch"](1);
1113
- console.error('There was a problem receiving the related links:', _context.t0);
969
+ case 5:
970
+ _context.p = 5;
971
+ _t = _context.v;
972
+ console.error('There was a problem receiving the related links:', _t);
1114
973
  _this.setState({
1115
974
  loading: false,
1116
- error: _context.t0.message
975
+ error: _t.message
1117
976
  });
1118
- case 17:
1119
- case "end":
1120
- return _context.stop();
977
+ case 6:
978
+ return _context.a(2);
1121
979
  }
1122
- }, _callee, null, [[1, 13]]);
980
+ }, _callee, null, [[1, 5]]);
1123
981
  }));
1124
982
  return function (_x, _x2) {
1125
983
  return _ref.apply(this, arguments);
@@ -1143,10 +1001,10 @@ var RelatedLinksButton = /*#__PURE__*/function (_Component) {
1143
1001
  return _createClass(RelatedLinksButton, [{
1144
1002
  key: "componentDidMount",
1145
1003
  value: function () {
1146
- var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
1004
+ var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
1147
1005
  var _this$state, manifestId, citationAPI;
1148
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1149
- while (1) switch (_context2.prev = _context2.next) {
1006
+ return _regenerator().w(function (_context2) {
1007
+ while (1) switch (_context2.n) {
1150
1008
  case 0:
1151
1009
  _this$state = this.state, manifestId = _this$state.manifestId, citationAPI = _this$state.citationAPI, _this$state.manifestTitle; // Only fetch if we have the required data
1152
1010
  if (manifestId && citationAPI) {
@@ -1157,9 +1015,8 @@ var RelatedLinksButton = /*#__PURE__*/function (_Component) {
1157
1015
  citationAPI: citationAPI
1158
1016
  });
1159
1017
  }
1160
- case 2:
1161
- case "end":
1162
- return _context2.stop();
1018
+ case 1:
1019
+ return _context2.a(2);
1163
1020
  }
1164
1021
  }, _callee2, this);
1165
1022
  }));
@@ -1171,10 +1028,10 @@ var RelatedLinksButton = /*#__PURE__*/function (_Component) {
1171
1028
  }, {
1172
1029
  key: "componentDidUpdate",
1173
1030
  value: function () {
1174
- var _componentDidUpdate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(prevProps, prevState) {
1031
+ var _componentDidUpdate = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(prevProps, prevState) {
1175
1032
  var _this$props2, newManifestId, newCitationAPI, newManifestTitle, prevManifestId, prevCitationAPI, _this$state2, manifestId, citationAPI;
1176
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1177
- while (1) switch (_context3.prev = _context3.next) {
1033
+ return _regenerator().w(function (_context3) {
1034
+ while (1) switch (_context3.n) {
1178
1035
  case 0:
1179
1036
  // Check if props changed and update state accordingly
1180
1037
  _this$props2 = this.props, newManifestId = _this$props2.manifestId, newCitationAPI = _this$props2.citationAPI, newManifestTitle = _this$props2.manifestTitle;
@@ -1192,9 +1049,8 @@ var RelatedLinksButton = /*#__PURE__*/function (_Component) {
1192
1049
  if ((manifestId !== prevManifestId || citationAPI !== prevCitationAPI) && manifestId && citationAPI) {
1193
1050
  this.fetchRelatedLinksData(manifestId, citationAPI);
1194
1051
  }
1195
- case 5:
1196
- case "end":
1197
- return _context3.stop();
1052
+ case 1:
1053
+ return _context3.a(2);
1198
1054
  }
1199
1055
  }, _callee3, this);
1200
1056
  }));
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "keywords": [
6
6
  "react-component"
7
7
  ],
8
- "version": "0.0.6",
8
+ "version": "0.0.9",
9
9
  "description": "A Mirador 3 plugin for displaying Harvard-specific citations.",
10
10
  "module": "dist/es/index.js",
11
11
  "files": [