@harvard-lts/mirador-citation-plugin 0.0.3 → 0.0.5
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.
- package/dist/es/index.js +468 -379
- package/package.json +3 -3
package/dist/es/index.js
CHANGED
|
@@ -34,6 +34,9 @@ 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
|
+
}
|
|
37
40
|
function _assertThisInitialized(e) {
|
|
38
41
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
39
42
|
return e;
|
|
@@ -139,306 +142,178 @@ function _possibleConstructorReturn(t, e) {
|
|
|
139
142
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
140
143
|
return _assertThisInitialized(t);
|
|
141
144
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
145
|
+
function _regenerator() {
|
|
146
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
|
|
147
|
+
var e,
|
|
148
|
+
t,
|
|
149
|
+
r = "function" == typeof Symbol ? Symbol : {},
|
|
150
|
+
n = r.iterator || "@@iterator",
|
|
151
|
+
o = r.toStringTag || "@@toStringTag";
|
|
152
|
+
function i(r, n, o, i) {
|
|
153
|
+
var c = n && n.prototype instanceof Generator ? n : Generator,
|
|
154
|
+
u = Object.create(c.prototype);
|
|
155
|
+
return _regeneratorDefine(u, "_invoke", function (r, n, o) {
|
|
156
|
+
var i,
|
|
157
|
+
c,
|
|
158
|
+
u,
|
|
159
|
+
f = 0,
|
|
160
|
+
p = o || [],
|
|
161
|
+
y = !1,
|
|
162
|
+
G = {
|
|
163
|
+
p: 0,
|
|
164
|
+
n: 0,
|
|
165
|
+
v: e,
|
|
166
|
+
a: d,
|
|
167
|
+
f: d.bind(e, 4),
|
|
168
|
+
d: function (t, r) {
|
|
169
|
+
return i = t, c = 0, u = e, G.n = r, a;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
function d(r, n) {
|
|
173
|
+
for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
|
|
174
|
+
var o,
|
|
175
|
+
i = p[t],
|
|
176
|
+
d = G.p,
|
|
177
|
+
l = i[2];
|
|
178
|
+
r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
|
|
179
|
+
}
|
|
180
|
+
if (o || r > 1) return a;
|
|
181
|
+
throw y = !0, n;
|
|
182
|
+
}
|
|
183
|
+
return function (o, p, l) {
|
|
184
|
+
if (f > 1) throw TypeError("Generator is already running");
|
|
185
|
+
for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
|
|
186
|
+
i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
|
|
187
|
+
try {
|
|
188
|
+
if (f = 2, i) {
|
|
189
|
+
if (c || (o = "next"), t = i[o]) {
|
|
190
|
+
if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
|
|
191
|
+
if (!t.done) return t;
|
|
192
|
+
u = t.value, c < 2 && (c = 0);
|
|
193
|
+
} else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
|
|
194
|
+
i = e;
|
|
195
|
+
} else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
|
|
196
|
+
} catch (t) {
|
|
197
|
+
i = e, c = 1, u = t;
|
|
198
|
+
} finally {
|
|
199
|
+
f = 1;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
value: t,
|
|
204
|
+
done: y
|
|
205
|
+
};
|
|
190
206
|
};
|
|
191
|
-
}
|
|
207
|
+
}(r, o, i), !0), u;
|
|
192
208
|
}
|
|
193
|
-
|
|
194
|
-
var h = "suspendedStart",
|
|
195
|
-
l = "suspendedYield",
|
|
196
|
-
f = "executing",
|
|
197
|
-
s = "completed",
|
|
198
|
-
y = {};
|
|
209
|
+
var a = {};
|
|
199
210
|
function Generator() {}
|
|
200
211
|
function GeneratorFunction() {}
|
|
201
212
|
function GeneratorFunctionPrototype() {}
|
|
202
|
-
|
|
203
|
-
|
|
213
|
+
t = Object.getPrototypeOf;
|
|
214
|
+
var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
|
|
215
|
+
return this;
|
|
216
|
+
}), t),
|
|
217
|
+
u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
|
|
218
|
+
function f(e) {
|
|
219
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
|
|
220
|
+
}
|
|
221
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
|
|
204
222
|
return this;
|
|
223
|
+
}), _regeneratorDefine(u, "toString", function () {
|
|
224
|
+
return "[object Generator]";
|
|
225
|
+
}), (_regenerator = function () {
|
|
226
|
+
return {
|
|
227
|
+
w: i,
|
|
228
|
+
m: f
|
|
229
|
+
};
|
|
230
|
+
})();
|
|
231
|
+
}
|
|
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();
|
|
205
236
|
});
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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);
|
|
214
254
|
});
|
|
215
|
-
})
|
|
255
|
+
} catch (t) {
|
|
256
|
+
f(t);
|
|
257
|
+
}
|
|
216
258
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
}, function (t) {
|
|
226
|
-
invoke("throw", t, i, a);
|
|
227
|
-
}) : e.resolve(h).then(function (t) {
|
|
228
|
-
u.value = t, i(u);
|
|
229
|
-
}, function (t) {
|
|
230
|
-
return invoke("throw", t, i, a);
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
a(c.arg);
|
|
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
|
+
});
|
|
234
267
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
});
|
|
268
|
+
return r = r ? r.then(f, f) : f();
|
|
269
|
+
}, !0);
|
|
270
|
+
}
|
|
271
|
+
function _regeneratorDefine(e, r, n, t) {
|
|
272
|
+
var i = Object.defineProperty;
|
|
273
|
+
try {
|
|
274
|
+
i({}, "", {});
|
|
275
|
+
} catch (e) {
|
|
276
|
+
i = 0;
|
|
246
277
|
}
|
|
247
|
-
function
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
278
|
+
_regeneratorDefine = function (e, r, n, t) {
|
|
279
|
+
function o(r, n) {
|
|
280
|
+
_regeneratorDefine(e, r, function (e) {
|
|
281
|
+
return this._invoke(r, n, e);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
r ? i ? i(e, r, {
|
|
285
|
+
value: n,
|
|
286
|
+
enumerable: !t,
|
|
287
|
+
configurable: !t,
|
|
288
|
+
writable: !t
|
|
289
|
+
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
290
|
+
}, _regeneratorDefine(e, r, n, t);
|
|
291
|
+
}
|
|
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
|
|
256
312
|
};
|
|
257
313
|
}
|
|
258
|
-
for (n.method = i, n.arg = a;;) {
|
|
259
|
-
var c = n.delegate;
|
|
260
|
-
if (c) {
|
|
261
|
-
var u = maybeInvokeDelegate(c, n);
|
|
262
|
-
if (u) {
|
|
263
|
-
if (u === y) continue;
|
|
264
|
-
return u;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
268
|
-
if (o === h) throw o = s, n.arg;
|
|
269
|
-
n.dispatchException(n.arg);
|
|
270
|
-
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
271
|
-
o = f;
|
|
272
|
-
var p = tryCatch(e, r, n);
|
|
273
|
-
if ("normal" === p.type) {
|
|
274
|
-
if (o = n.done ? s : l, p.arg === y) continue;
|
|
275
|
-
return {
|
|
276
|
-
value: p.arg,
|
|
277
|
-
done: n.done
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
281
|
-
}
|
|
282
314
|
};
|
|
283
315
|
}
|
|
284
|
-
|
|
285
|
-
var n = r.method,
|
|
286
|
-
o = e.iterator[n];
|
|
287
|
-
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
288
|
-
var i = tryCatch(o, e.iterator, r.arg);
|
|
289
|
-
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
290
|
-
var a = i.arg;
|
|
291
|
-
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
292
|
-
}
|
|
293
|
-
function pushTryEntry(t) {
|
|
294
|
-
var e = {
|
|
295
|
-
tryLoc: t[0]
|
|
296
|
-
};
|
|
297
|
-
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
298
|
-
}
|
|
299
|
-
function resetTryEntry(t) {
|
|
300
|
-
var e = t.completion || {};
|
|
301
|
-
e.type = "normal", delete e.arg, t.completion = e;
|
|
302
|
-
}
|
|
303
|
-
function Context(t) {
|
|
304
|
-
this.tryEntries = [{
|
|
305
|
-
tryLoc: "root"
|
|
306
|
-
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
307
|
-
}
|
|
308
|
-
function values(e) {
|
|
309
|
-
if (e || "" === e) {
|
|
310
|
-
var r = e[a];
|
|
311
|
-
if (r) return r.call(e);
|
|
312
|
-
if ("function" == typeof e.next) return e;
|
|
313
|
-
if (!isNaN(e.length)) {
|
|
314
|
-
var o = -1,
|
|
315
|
-
i = function next() {
|
|
316
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
317
|
-
return next.value = t, next.done = !0, next;
|
|
318
|
-
};
|
|
319
|
-
return i.next = i;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
323
|
-
}
|
|
324
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
325
|
-
value: GeneratorFunctionPrototype,
|
|
326
|
-
configurable: !0
|
|
327
|
-
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
328
|
-
value: GeneratorFunction,
|
|
329
|
-
configurable: !0
|
|
330
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
331
|
-
var e = "function" == typeof t && t.constructor;
|
|
332
|
-
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
333
|
-
}, e.mark = function (t) {
|
|
334
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
335
|
-
}, e.awrap = function (t) {
|
|
336
|
-
return {
|
|
337
|
-
__await: t
|
|
338
|
-
};
|
|
339
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
340
|
-
return this;
|
|
341
|
-
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
342
|
-
void 0 === i && (i = Promise);
|
|
343
|
-
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
344
|
-
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
345
|
-
return t.done ? t.value : a.next();
|
|
346
|
-
});
|
|
347
|
-
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
348
|
-
return this;
|
|
349
|
-
}), define(g, "toString", function () {
|
|
350
|
-
return "[object Generator]";
|
|
351
|
-
}), e.keys = function (t) {
|
|
352
|
-
var e = Object(t),
|
|
353
|
-
r = [];
|
|
354
|
-
for (var n in e) r.push(n);
|
|
355
|
-
return r.reverse(), function next() {
|
|
356
|
-
for (; r.length;) {
|
|
357
|
-
var t = r.pop();
|
|
358
|
-
if (t in e) return next.value = t, next.done = !1, next;
|
|
359
|
-
}
|
|
360
|
-
return next.done = !0, next;
|
|
361
|
-
};
|
|
362
|
-
}, e.values = values, Context.prototype = {
|
|
363
|
-
constructor: Context,
|
|
364
|
-
reset: function (e) {
|
|
365
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
366
|
-
},
|
|
367
|
-
stop: function () {
|
|
368
|
-
this.done = !0;
|
|
369
|
-
var t = this.tryEntries[0].completion;
|
|
370
|
-
if ("throw" === t.type) throw t.arg;
|
|
371
|
-
return this.rval;
|
|
372
|
-
},
|
|
373
|
-
dispatchException: function (e) {
|
|
374
|
-
if (this.done) throw e;
|
|
375
|
-
var r = this;
|
|
376
|
-
function handle(n, o) {
|
|
377
|
-
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
378
|
-
}
|
|
379
|
-
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
380
|
-
var i = this.tryEntries[o],
|
|
381
|
-
a = i.completion;
|
|
382
|
-
if ("root" === i.tryLoc) return handle("end");
|
|
383
|
-
if (i.tryLoc <= this.prev) {
|
|
384
|
-
var c = n.call(i, "catchLoc"),
|
|
385
|
-
u = n.call(i, "finallyLoc");
|
|
386
|
-
if (c && u) {
|
|
387
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
388
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
389
|
-
} else if (c) {
|
|
390
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
391
|
-
} else {
|
|
392
|
-
if (!u) throw Error("try statement without catch or finally");
|
|
393
|
-
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
},
|
|
398
|
-
abrupt: function (t, e) {
|
|
399
|
-
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
400
|
-
var o = this.tryEntries[r];
|
|
401
|
-
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
402
|
-
var i = o;
|
|
403
|
-
break;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
407
|
-
var a = i ? i.completion : {};
|
|
408
|
-
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
409
|
-
},
|
|
410
|
-
complete: function (t, e) {
|
|
411
|
-
if ("throw" === t.type) throw t.arg;
|
|
412
|
-
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
413
|
-
},
|
|
414
|
-
finish: function (t) {
|
|
415
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
416
|
-
var r = this.tryEntries[e];
|
|
417
|
-
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
418
|
-
}
|
|
419
|
-
},
|
|
420
|
-
catch: function (t) {
|
|
421
|
-
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
422
|
-
var r = this.tryEntries[e];
|
|
423
|
-
if (r.tryLoc === t) {
|
|
424
|
-
var n = r.completion;
|
|
425
|
-
if ("throw" === n.type) {
|
|
426
|
-
var o = n.arg;
|
|
427
|
-
resetTryEntry(r);
|
|
428
|
-
}
|
|
429
|
-
return o;
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
throw Error("illegal catch attempt");
|
|
433
|
-
},
|
|
434
|
-
delegateYield: function (e, r, n) {
|
|
435
|
-
return this.delegate = {
|
|
436
|
-
iterator: values(e),
|
|
437
|
-
resultName: r,
|
|
438
|
-
nextLoc: n
|
|
439
|
-
}, "next" === this.method && (this.arg = t), y;
|
|
440
|
-
}
|
|
441
|
-
}, e;
|
|
316
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
442
317
|
}
|
|
443
318
|
function _setPrototypeOf(t, e) {
|
|
444
319
|
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
@@ -459,6 +334,74 @@ function _toPropertyKey(t) {
|
|
|
459
334
|
var i = _toPrimitive(t, "string");
|
|
460
335
|
return "symbol" == typeof i ? i : i + "";
|
|
461
336
|
}
|
|
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
|
+
}
|
|
462
405
|
|
|
463
406
|
/**
|
|
464
407
|
*/
|
|
@@ -703,75 +646,148 @@ var CitationButton = /*#__PURE__*/function (_Component) {
|
|
|
703
646
|
var _this;
|
|
704
647
|
_classCallCheck(this, CitationButton);
|
|
705
648
|
_this = _callSuper(this, CitationButton, [props]);
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
manifestTitle = _this$props.manifestTitle;
|
|
710
|
-
_this.state = {
|
|
711
|
-
manifestId: manifestId,
|
|
712
|
-
citationAPI: citationAPI,
|
|
713
|
-
manifestTitle: manifestTitle
|
|
714
|
-
};
|
|
715
|
-
return _this;
|
|
716
|
-
}
|
|
717
|
-
_inherits(CitationButton, _Component);
|
|
718
|
-
return _createClass(CitationButton, [{
|
|
719
|
-
key: "componentDidMount",
|
|
720
|
-
value: function () {
|
|
721
|
-
var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
722
|
-
var _this2 = this;
|
|
723
|
-
var _this$state, manifestId, citationAPI, body;
|
|
649
|
+
_defineProperty(_this, "fetchCitationData", /*#__PURE__*/function () {
|
|
650
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(manifestId, citationAPI) {
|
|
651
|
+
var body, response, citationData;
|
|
724
652
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
725
653
|
while (1) switch (_context.prev = _context.next) {
|
|
726
654
|
case 0:
|
|
727
|
-
_this$state = this.state, manifestId = _this$state.manifestId, citationAPI = _this$state.citationAPI, _this$state.manifestTitle;
|
|
728
655
|
body = {
|
|
729
656
|
"manifest_id": manifestId
|
|
730
657
|
};
|
|
731
|
-
|
|
658
|
+
_context.prev = 1;
|
|
659
|
+
_context.next = 4;
|
|
660
|
+
return fetch(citationAPI, {
|
|
732
661
|
method: 'post',
|
|
733
662
|
body: JSON.stringify(body),
|
|
734
663
|
headers: {
|
|
735
664
|
'Content-Type': 'application/json'
|
|
736
665
|
}
|
|
737
|
-
}).then(function (response) {
|
|
738
|
-
if (!response.ok) {
|
|
739
|
-
throw new Error('Network response was not ok');
|
|
740
|
-
}
|
|
741
|
-
return response.json();
|
|
742
|
-
}).then(function (citationData) {
|
|
743
|
-
_this2.setState({
|
|
744
|
-
citationData: citationData,
|
|
745
|
-
loading: false
|
|
746
|
-
});
|
|
747
|
-
})["catch"](function (error) {
|
|
748
|
-
console.error('There was a problem receiving the citation:', error);
|
|
749
|
-
_this2.setState({
|
|
750
|
-
loading: false,
|
|
751
|
-
error: error.message
|
|
752
|
-
});
|
|
753
666
|
});
|
|
754
|
-
case
|
|
667
|
+
case 4:
|
|
668
|
+
response = _context.sent;
|
|
669
|
+
if (response.ok) {
|
|
670
|
+
_context.next = 7;
|
|
671
|
+
break;
|
|
672
|
+
}
|
|
673
|
+
throw new Error('Network response was not ok');
|
|
674
|
+
case 7:
|
|
675
|
+
_context.next = 9;
|
|
676
|
+
return response.json();
|
|
677
|
+
case 9:
|
|
678
|
+
citationData = _context.sent;
|
|
679
|
+
_this.setState({
|
|
680
|
+
citationData: citationData,
|
|
681
|
+
loading: false
|
|
682
|
+
});
|
|
683
|
+
_context.next = 17;
|
|
684
|
+
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);
|
|
689
|
+
_this.setState({
|
|
690
|
+
loading: false,
|
|
691
|
+
error: _context.t0.message
|
|
692
|
+
});
|
|
693
|
+
case 17:
|
|
755
694
|
case "end":
|
|
756
695
|
return _context.stop();
|
|
757
696
|
}
|
|
758
|
-
}, _callee,
|
|
697
|
+
}, _callee, null, [[1, 13]]);
|
|
698
|
+
}));
|
|
699
|
+
return function (_x, _x2) {
|
|
700
|
+
return _ref.apply(this, arguments);
|
|
701
|
+
};
|
|
702
|
+
}());
|
|
703
|
+
var _this$props = _this.props,
|
|
704
|
+
_manifestId = _this$props.manifestId,
|
|
705
|
+
_citationAPI = _this$props.citationAPI,
|
|
706
|
+
manifestTitle = _this$props.manifestTitle;
|
|
707
|
+
_this.state = {
|
|
708
|
+
manifestId: _manifestId,
|
|
709
|
+
citationAPI: _citationAPI,
|
|
710
|
+
manifestTitle: manifestTitle,
|
|
711
|
+
citationData: null,
|
|
712
|
+
loading: true,
|
|
713
|
+
error: null
|
|
714
|
+
};
|
|
715
|
+
return _this;
|
|
716
|
+
}
|
|
717
|
+
_inherits(CitationButton, _Component);
|
|
718
|
+
return _createClass(CitationButton, [{
|
|
719
|
+
key: "componentDidMount",
|
|
720
|
+
value: function () {
|
|
721
|
+
var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
722
|
+
var _this$state, manifestId, citationAPI;
|
|
723
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
724
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
725
|
+
case 0:
|
|
726
|
+
_this$state = this.state, manifestId = _this$state.manifestId, citationAPI = _this$state.citationAPI, _this$state.manifestTitle; // Only fetch if we have the required data
|
|
727
|
+
if (manifestId && citationAPI) {
|
|
728
|
+
this.fetchCitationData(manifestId, citationAPI);
|
|
729
|
+
} else {
|
|
730
|
+
console.log('CitationButton: manifestId or citationAPI not available yet', {
|
|
731
|
+
manifestId: manifestId,
|
|
732
|
+
citationAPI: citationAPI
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
case 2:
|
|
736
|
+
case "end":
|
|
737
|
+
return _context2.stop();
|
|
738
|
+
}
|
|
739
|
+
}, _callee2, this);
|
|
759
740
|
}));
|
|
760
741
|
function componentDidMount() {
|
|
761
742
|
return _componentDidMount.apply(this, arguments);
|
|
762
743
|
}
|
|
763
744
|
return componentDidMount;
|
|
764
745
|
}()
|
|
746
|
+
}, {
|
|
747
|
+
key: "componentDidUpdate",
|
|
748
|
+
value: function () {
|
|
749
|
+
var _componentDidUpdate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(prevProps, prevState) {
|
|
750
|
+
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) {
|
|
753
|
+
case 0:
|
|
754
|
+
// Check if props changed and update state accordingly
|
|
755
|
+
_this$props2 = this.props, newManifestId = _this$props2.manifestId, newCitationAPI = _this$props2.citationAPI, newManifestTitle = _this$props2.manifestTitle;
|
|
756
|
+
prevManifestId = prevState.manifestId, prevCitationAPI = prevState.citationAPI; // Update state if props changed
|
|
757
|
+
if (newManifestId !== prevManifestId || newCitationAPI !== prevCitationAPI || newManifestTitle !== prevState.manifestTitle) {
|
|
758
|
+
this.setState({
|
|
759
|
+
manifestId: newManifestId,
|
|
760
|
+
citationAPI: newCitationAPI,
|
|
761
|
+
manifestTitle: newManifestTitle
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
// Check if manifestId or citationAPI became available and fetch data
|
|
766
|
+
_this$state2 = this.state, manifestId = _this$state2.manifestId, citationAPI = _this$state2.citationAPI;
|
|
767
|
+
if ((manifestId !== prevManifestId || citationAPI !== prevCitationAPI) && manifestId && citationAPI) {
|
|
768
|
+
this.fetchCitationData(manifestId, citationAPI);
|
|
769
|
+
}
|
|
770
|
+
case 5:
|
|
771
|
+
case "end":
|
|
772
|
+
return _context3.stop();
|
|
773
|
+
}
|
|
774
|
+
}, _callee3, this);
|
|
775
|
+
}));
|
|
776
|
+
function componentDidUpdate(_x3, _x4) {
|
|
777
|
+
return _componentDidUpdate.apply(this, arguments);
|
|
778
|
+
}
|
|
779
|
+
return componentDidUpdate;
|
|
780
|
+
}()
|
|
765
781
|
}, {
|
|
766
782
|
key: "render",
|
|
767
783
|
value: function render() {
|
|
768
|
-
var _this$
|
|
769
|
-
classes = _this$
|
|
770
|
-
windowId = _this$
|
|
771
|
-
var _this$
|
|
772
|
-
citationData = _this$
|
|
773
|
-
_this$
|
|
774
|
-
_this$
|
|
784
|
+
var _this$props3 = this.props,
|
|
785
|
+
classes = _this$props3.classes,
|
|
786
|
+
windowId = _this$props3.windowId;
|
|
787
|
+
var _this$state3 = this.state,
|
|
788
|
+
citationData = _this$state3.citationData;
|
|
789
|
+
_this$state3.loading;
|
|
790
|
+
_this$state3.error;
|
|
775
791
|
if (citationData) {
|
|
776
792
|
if (!citationData.error) {
|
|
777
793
|
return /*#__PURE__*/jsx("div", {
|
|
@@ -797,9 +813,9 @@ var CitationButton = /*#__PURE__*/function (_Component) {
|
|
|
797
813
|
}]);
|
|
798
814
|
}(Component);
|
|
799
815
|
CitationButton.value = 'CitationKey';
|
|
800
|
-
var mapStateToProps$3 = function mapStateToProps(state,
|
|
816
|
+
var mapStateToProps$3 = function mapStateToProps(state, _ref2) {
|
|
801
817
|
var _state$config$mirador;
|
|
802
|
-
var windowId =
|
|
818
|
+
var windowId = _ref2.windowId;
|
|
803
819
|
var manifestId = getManifestUrl(state, {
|
|
804
820
|
windowId: windowId
|
|
805
821
|
});
|
|
@@ -1055,75 +1071,148 @@ var RelatedLinksButton = /*#__PURE__*/function (_Component) {
|
|
|
1055
1071
|
var _this;
|
|
1056
1072
|
_classCallCheck(this, RelatedLinksButton);
|
|
1057
1073
|
_this = _callSuper(this, RelatedLinksButton, [props]);
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
manifestTitle = _this$props.manifestTitle;
|
|
1062
|
-
_this.state = {
|
|
1063
|
-
manifestId: manifestId,
|
|
1064
|
-
citationAPI: citationAPI,
|
|
1065
|
-
manifestTitle: manifestTitle
|
|
1066
|
-
};
|
|
1067
|
-
return _this;
|
|
1068
|
-
}
|
|
1069
|
-
_inherits(RelatedLinksButton, _Component);
|
|
1070
|
-
return _createClass(RelatedLinksButton, [{
|
|
1071
|
-
key: "componentDidMount",
|
|
1072
|
-
value: function () {
|
|
1073
|
-
var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1074
|
-
var _this2 = this;
|
|
1075
|
-
var _this$state, manifestId, citationAPI, body;
|
|
1074
|
+
_defineProperty(_this, "fetchRelatedLinksData", /*#__PURE__*/function () {
|
|
1075
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(manifestId, citationAPI) {
|
|
1076
|
+
var body, response, citationData;
|
|
1076
1077
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1077
1078
|
while (1) switch (_context.prev = _context.next) {
|
|
1078
1079
|
case 0:
|
|
1079
|
-
_this$state = this.state, manifestId = _this$state.manifestId, citationAPI = _this$state.citationAPI, _this$state.manifestTitle;
|
|
1080
1080
|
body = {
|
|
1081
1081
|
"manifest_id": manifestId
|
|
1082
1082
|
};
|
|
1083
|
-
|
|
1083
|
+
_context.prev = 1;
|
|
1084
|
+
_context.next = 4;
|
|
1085
|
+
return fetch(citationAPI, {
|
|
1084
1086
|
method: 'post',
|
|
1085
1087
|
body: JSON.stringify(body),
|
|
1086
1088
|
headers: {
|
|
1087
1089
|
'Content-Type': 'application/json'
|
|
1088
1090
|
}
|
|
1089
|
-
}).then(function (response) {
|
|
1090
|
-
if (!response.ok) {
|
|
1091
|
-
throw new Error('Network response was not ok');
|
|
1092
|
-
}
|
|
1093
|
-
return response.json();
|
|
1094
|
-
}).then(function (citationData) {
|
|
1095
|
-
_this2.setState({
|
|
1096
|
-
citationData: citationData,
|
|
1097
|
-
loading: false
|
|
1098
|
-
});
|
|
1099
|
-
})["catch"](function (error) {
|
|
1100
|
-
console.error('There was a problem receiving the citation:', error);
|
|
1101
|
-
_this2.setState({
|
|
1102
|
-
loading: false,
|
|
1103
|
-
error: error.message
|
|
1104
|
-
});
|
|
1105
1091
|
});
|
|
1106
|
-
case
|
|
1092
|
+
case 4:
|
|
1093
|
+
response = _context.sent;
|
|
1094
|
+
if (response.ok) {
|
|
1095
|
+
_context.next = 7;
|
|
1096
|
+
break;
|
|
1097
|
+
}
|
|
1098
|
+
throw new Error('Network response was not ok');
|
|
1099
|
+
case 7:
|
|
1100
|
+
_context.next = 9;
|
|
1101
|
+
return response.json();
|
|
1102
|
+
case 9:
|
|
1103
|
+
citationData = _context.sent;
|
|
1104
|
+
_this.setState({
|
|
1105
|
+
citationData: citationData,
|
|
1106
|
+
loading: false
|
|
1107
|
+
});
|
|
1108
|
+
_context.next = 17;
|
|
1109
|
+
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);
|
|
1114
|
+
_this.setState({
|
|
1115
|
+
loading: false,
|
|
1116
|
+
error: _context.t0.message
|
|
1117
|
+
});
|
|
1118
|
+
case 17:
|
|
1107
1119
|
case "end":
|
|
1108
1120
|
return _context.stop();
|
|
1109
1121
|
}
|
|
1110
|
-
}, _callee,
|
|
1122
|
+
}, _callee, null, [[1, 13]]);
|
|
1123
|
+
}));
|
|
1124
|
+
return function (_x, _x2) {
|
|
1125
|
+
return _ref.apply(this, arguments);
|
|
1126
|
+
};
|
|
1127
|
+
}());
|
|
1128
|
+
var _this$props = _this.props,
|
|
1129
|
+
_manifestId = _this$props.manifestId,
|
|
1130
|
+
_citationAPI = _this$props.citationAPI,
|
|
1131
|
+
manifestTitle = _this$props.manifestTitle;
|
|
1132
|
+
_this.state = {
|
|
1133
|
+
manifestId: _manifestId,
|
|
1134
|
+
citationAPI: _citationAPI,
|
|
1135
|
+
manifestTitle: manifestTitle,
|
|
1136
|
+
citationData: null,
|
|
1137
|
+
loading: true,
|
|
1138
|
+
error: null
|
|
1139
|
+
};
|
|
1140
|
+
return _this;
|
|
1141
|
+
}
|
|
1142
|
+
_inherits(RelatedLinksButton, _Component);
|
|
1143
|
+
return _createClass(RelatedLinksButton, [{
|
|
1144
|
+
key: "componentDidMount",
|
|
1145
|
+
value: function () {
|
|
1146
|
+
var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1147
|
+
var _this$state, manifestId, citationAPI;
|
|
1148
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1149
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1150
|
+
case 0:
|
|
1151
|
+
_this$state = this.state, manifestId = _this$state.manifestId, citationAPI = _this$state.citationAPI, _this$state.manifestTitle; // Only fetch if we have the required data
|
|
1152
|
+
if (manifestId && citationAPI) {
|
|
1153
|
+
this.fetchRelatedLinksData(manifestId, citationAPI);
|
|
1154
|
+
} else {
|
|
1155
|
+
console.log('RelatedLinksButton: manifestId or citationAPI not available yet', {
|
|
1156
|
+
manifestId: manifestId,
|
|
1157
|
+
citationAPI: citationAPI
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
case 2:
|
|
1161
|
+
case "end":
|
|
1162
|
+
return _context2.stop();
|
|
1163
|
+
}
|
|
1164
|
+
}, _callee2, this);
|
|
1111
1165
|
}));
|
|
1112
1166
|
function componentDidMount() {
|
|
1113
1167
|
return _componentDidMount.apply(this, arguments);
|
|
1114
1168
|
}
|
|
1115
1169
|
return componentDidMount;
|
|
1116
1170
|
}()
|
|
1171
|
+
}, {
|
|
1172
|
+
key: "componentDidUpdate",
|
|
1173
|
+
value: function () {
|
|
1174
|
+
var _componentDidUpdate = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(prevProps, prevState) {
|
|
1175
|
+
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) {
|
|
1178
|
+
case 0:
|
|
1179
|
+
// Check if props changed and update state accordingly
|
|
1180
|
+
_this$props2 = this.props, newManifestId = _this$props2.manifestId, newCitationAPI = _this$props2.citationAPI, newManifestTitle = _this$props2.manifestTitle;
|
|
1181
|
+
prevManifestId = prevState.manifestId, prevCitationAPI = prevState.citationAPI; // Update state if props changed
|
|
1182
|
+
if (newManifestId !== prevManifestId || newCitationAPI !== prevCitationAPI || newManifestTitle !== prevState.manifestTitle) {
|
|
1183
|
+
this.setState({
|
|
1184
|
+
manifestId: newManifestId,
|
|
1185
|
+
citationAPI: newCitationAPI,
|
|
1186
|
+
manifestTitle: newManifestTitle
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
|
|
1190
|
+
// Check if manifestId or citationAPI became available and fetch data
|
|
1191
|
+
_this$state2 = this.state, manifestId = _this$state2.manifestId, citationAPI = _this$state2.citationAPI;
|
|
1192
|
+
if ((manifestId !== prevManifestId || citationAPI !== prevCitationAPI) && manifestId && citationAPI) {
|
|
1193
|
+
this.fetchRelatedLinksData(manifestId, citationAPI);
|
|
1194
|
+
}
|
|
1195
|
+
case 5:
|
|
1196
|
+
case "end":
|
|
1197
|
+
return _context3.stop();
|
|
1198
|
+
}
|
|
1199
|
+
}, _callee3, this);
|
|
1200
|
+
}));
|
|
1201
|
+
function componentDidUpdate(_x3, _x4) {
|
|
1202
|
+
return _componentDidUpdate.apply(this, arguments);
|
|
1203
|
+
}
|
|
1204
|
+
return componentDidUpdate;
|
|
1205
|
+
}()
|
|
1117
1206
|
}, {
|
|
1118
1207
|
key: "render",
|
|
1119
1208
|
value: function render() {
|
|
1120
|
-
var _this$
|
|
1121
|
-
classes = _this$
|
|
1122
|
-
windowId = _this$
|
|
1123
|
-
var _this$
|
|
1124
|
-
citationData = _this$
|
|
1125
|
-
_this$
|
|
1126
|
-
_this$
|
|
1209
|
+
var _this$props3 = this.props,
|
|
1210
|
+
classes = _this$props3.classes,
|
|
1211
|
+
windowId = _this$props3.windowId;
|
|
1212
|
+
var _this$state3 = this.state,
|
|
1213
|
+
citationData = _this$state3.citationData;
|
|
1214
|
+
_this$state3.loading;
|
|
1215
|
+
_this$state3.error;
|
|
1127
1216
|
if (citationData) {
|
|
1128
1217
|
if (!citationData.error) {
|
|
1129
1218
|
return /*#__PURE__*/jsx("div", {
|
|
@@ -1149,9 +1238,9 @@ var RelatedLinksButton = /*#__PURE__*/function (_Component) {
|
|
|
1149
1238
|
}]);
|
|
1150
1239
|
}(Component);
|
|
1151
1240
|
RelatedLinksButton.value = 'RelatedLinksKey';
|
|
1152
|
-
var mapStateToProps$1 = function mapStateToProps(state,
|
|
1241
|
+
var mapStateToProps$1 = function mapStateToProps(state, _ref2) {
|
|
1153
1242
|
var _state$config$mirador;
|
|
1154
|
-
var windowId =
|
|
1243
|
+
var windowId = _ref2.windowId;
|
|
1155
1244
|
var manifestId = getManifestUrl(state, {
|
|
1156
1245
|
windowId: windowId
|
|
1157
1246
|
});
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-component"
|
|
7
7
|
],
|
|
8
|
-
"version": "0.0.
|
|
8
|
+
"version": "0.0.5",
|
|
9
9
|
"description": "A Mirador 3 plugin for displaying Harvard-specific citations.",
|
|
10
10
|
"module": "dist/es/index.js",
|
|
11
11
|
"files": [
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@testing-library/react": "^12.0.0",
|
|
35
35
|
"babel-jest": "^29.7.0",
|
|
36
36
|
"babel-loader": "^9.1.2",
|
|
37
|
-
"jest": "^
|
|
38
|
-
"jest-environment-jsdom": "^
|
|
37
|
+
"jest": "^30.0.2",
|
|
38
|
+
"jest-environment-jsdom": "^30.0.2",
|
|
39
39
|
"mirador": "^3.4.3",
|
|
40
40
|
"npm-run-all": "^4.1.5",
|
|
41
41
|
"rollup": "^3.29.5",
|