@harvard-lts/mirador-annotations-auth-plugin 0.0.4 → 0.0.6
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 +35 -173
- package/package.json +1 -1
package/dist/es/index.js
CHANGED
|
@@ -15,9 +15,6 @@ import { withTranslation } from 'react-i18next';
|
|
|
15
15
|
import { getVisibleCanvasIds, getCanvases, getCanvasLabel } from 'mirador/dist/es/src/state/selectors';
|
|
16
16
|
import AnnotationFactory from 'mirador/dist/es/src/lib/AnnotationFactory';
|
|
17
17
|
|
|
18
|
-
function _OverloadYield(e, d) {
|
|
19
|
-
this.v = e, this.k = d;
|
|
20
|
-
}
|
|
21
18
|
function _assertThisInitialized(e) {
|
|
22
19
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
23
20
|
return e;
|
|
@@ -189,45 +186,6 @@ function _regenerator() {
|
|
|
189
186
|
};
|
|
190
187
|
})();
|
|
191
188
|
}
|
|
192
|
-
function _regeneratorAsync(n, e, r, t, o) {
|
|
193
|
-
var a = _regeneratorAsyncGen(n, e, r, t, o);
|
|
194
|
-
return a.next().then(function (n) {
|
|
195
|
-
return n.done ? n.value : a.next();
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
function _regeneratorAsyncGen(r, e, t, o, n) {
|
|
199
|
-
return new _regeneratorAsyncIterator(_regenerator().w(r, e, t, o), n || Promise);
|
|
200
|
-
}
|
|
201
|
-
function _regeneratorAsyncIterator(t, e) {
|
|
202
|
-
function n(r, o, i, f) {
|
|
203
|
-
try {
|
|
204
|
-
var c = t[r](o),
|
|
205
|
-
u = c.value;
|
|
206
|
-
return u instanceof _OverloadYield ? e.resolve(u.v).then(function (t) {
|
|
207
|
-
n("next", t, i, f);
|
|
208
|
-
}, function (t) {
|
|
209
|
-
n("throw", t, i, f);
|
|
210
|
-
}) : e.resolve(u).then(function (t) {
|
|
211
|
-
c.value = t, i(c);
|
|
212
|
-
}, function (t) {
|
|
213
|
-
return n("throw", t, i, f);
|
|
214
|
-
});
|
|
215
|
-
} catch (t) {
|
|
216
|
-
f(t);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
var r;
|
|
220
|
-
this.next || (_regeneratorDefine(_regeneratorAsyncIterator.prototype), _regeneratorDefine(_regeneratorAsyncIterator.prototype, "function" == typeof Symbol && Symbol.asyncIterator || "@asyncIterator", function () {
|
|
221
|
-
return this;
|
|
222
|
-
})), _regeneratorDefine(this, "_invoke", function (t, o, i) {
|
|
223
|
-
function f() {
|
|
224
|
-
return new e(function (e, r) {
|
|
225
|
-
n(t, i, e, r);
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
return r = r ? r.then(f, f) : f();
|
|
229
|
-
}, !0);
|
|
230
|
-
}
|
|
231
189
|
function _regeneratorDefine(e, r, n, t) {
|
|
232
190
|
var i = Object.defineProperty;
|
|
233
191
|
try {
|
|
@@ -249,32 +207,6 @@ function _regeneratorDefine(e, r, n, t) {
|
|
|
249
207
|
}) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
|
|
250
208
|
}, _regeneratorDefine(e, r, n, t);
|
|
251
209
|
}
|
|
252
|
-
function _regeneratorKeys(e) {
|
|
253
|
-
var n = Object(e),
|
|
254
|
-
r = [];
|
|
255
|
-
for (var t in n) r.unshift(t);
|
|
256
|
-
return function e() {
|
|
257
|
-
for (; r.length;) if ((t = r.pop()) in n) return e.value = t, e.done = !1, e;
|
|
258
|
-
return e.done = !0, e;
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
function _regeneratorValues(e) {
|
|
262
|
-
if (null != e) {
|
|
263
|
-
var t = e["function" == typeof Symbol && Symbol.iterator || "@@iterator"],
|
|
264
|
-
r = 0;
|
|
265
|
-
if (t) return t.call(e);
|
|
266
|
-
if ("function" == typeof e.next) return e;
|
|
267
|
-
if (!isNaN(e.length)) return {
|
|
268
|
-
next: function () {
|
|
269
|
-
return e && r >= e.length && (e = void 0), {
|
|
270
|
-
value: e && e[r++],
|
|
271
|
-
done: !e
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
throw new TypeError(typeof e + " is not iterable");
|
|
277
|
-
}
|
|
278
210
|
function _setPrototypeOf(t, e) {
|
|
279
211
|
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
|
|
280
212
|
return t.__proto__ = e, t;
|
|
@@ -294,74 +226,6 @@ function _toPropertyKey(t) {
|
|
|
294
226
|
var i = _toPrimitive(t, "string");
|
|
295
227
|
return "symbol" == typeof i ? i : i + "";
|
|
296
228
|
}
|
|
297
|
-
function _regeneratorRuntime() {
|
|
298
|
-
|
|
299
|
-
var r = _regenerator(),
|
|
300
|
-
e = r.m(_regeneratorRuntime),
|
|
301
|
-
t = (Object.getPrototypeOf ? Object.getPrototypeOf(e) : e.__proto__).constructor;
|
|
302
|
-
function n(r) {
|
|
303
|
-
var e = "function" == typeof r && r.constructor;
|
|
304
|
-
return !!e && (e === t || "GeneratorFunction" === (e.displayName || e.name));
|
|
305
|
-
}
|
|
306
|
-
var o = {
|
|
307
|
-
throw: 1,
|
|
308
|
-
return: 2,
|
|
309
|
-
break: 3,
|
|
310
|
-
continue: 3
|
|
311
|
-
};
|
|
312
|
-
function a(r) {
|
|
313
|
-
var e, t;
|
|
314
|
-
return function (n) {
|
|
315
|
-
e || (e = {
|
|
316
|
-
stop: function () {
|
|
317
|
-
return t(n.a, 2);
|
|
318
|
-
},
|
|
319
|
-
catch: function () {
|
|
320
|
-
return n.v;
|
|
321
|
-
},
|
|
322
|
-
abrupt: function (r, e) {
|
|
323
|
-
return t(n.a, o[r], e);
|
|
324
|
-
},
|
|
325
|
-
delegateYield: function (r, o, a) {
|
|
326
|
-
return e.resultName = o, t(n.d, _regeneratorValues(r), a);
|
|
327
|
-
},
|
|
328
|
-
finish: function (r) {
|
|
329
|
-
return t(n.f, r);
|
|
330
|
-
}
|
|
331
|
-
}, t = function (r, t, o) {
|
|
332
|
-
n.p = e.prev, n.n = e.next;
|
|
333
|
-
try {
|
|
334
|
-
return r(t, o);
|
|
335
|
-
} finally {
|
|
336
|
-
e.next = n.n;
|
|
337
|
-
}
|
|
338
|
-
}), e.resultName && (e[e.resultName] = n.v, e.resultName = void 0), e.sent = n.v, e.next = n.n;
|
|
339
|
-
try {
|
|
340
|
-
return r.call(this, e);
|
|
341
|
-
} finally {
|
|
342
|
-
n.p = e.prev, n.n = e.next;
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
return (_regeneratorRuntime = function () {
|
|
347
|
-
return {
|
|
348
|
-
wrap: function (e, t, n, o) {
|
|
349
|
-
return r.w(a(e), t, n, o && o.reverse());
|
|
350
|
-
},
|
|
351
|
-
isGeneratorFunction: n,
|
|
352
|
-
mark: r.m,
|
|
353
|
-
awrap: function (r, e) {
|
|
354
|
-
return new _OverloadYield(r, e);
|
|
355
|
-
},
|
|
356
|
-
AsyncIterator: _regeneratorAsyncIterator,
|
|
357
|
-
async: function (r, e, t, o, u) {
|
|
358
|
-
return (n(e) ? _regeneratorAsyncGen : _regeneratorAsync)(a(r), e, t, o, u);
|
|
359
|
-
},
|
|
360
|
-
keys: _regeneratorKeys,
|
|
361
|
-
values: _regeneratorValues
|
|
362
|
-
};
|
|
363
|
-
})();
|
|
364
|
-
}
|
|
365
229
|
|
|
366
230
|
var AnnotationsAuthSidePanel = /*#__PURE__*/function (_Component) {
|
|
367
231
|
function AnnotationsAuthSidePanel(props) {
|
|
@@ -425,54 +289,53 @@ var AnnotationsAuthSidePanel = /*#__PURE__*/function (_Component) {
|
|
|
425
289
|
}, {
|
|
426
290
|
key: "componentDidMount",
|
|
427
291
|
value: function () {
|
|
428
|
-
var _componentDidMount = _asyncToGenerator(/*#__PURE__*/
|
|
429
|
-
var _this$state, canvasAnnotationPages, canvasAnnotationList, promises, results;
|
|
430
|
-
return
|
|
431
|
-
while (1) switch (_context2.
|
|
292
|
+
var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
293
|
+
var _this$state, canvasAnnotationPages, canvasAnnotationList, promises, results, _t2;
|
|
294
|
+
return _regenerator().w(function (_context2) {
|
|
295
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
432
296
|
case 0:
|
|
433
297
|
_this$state = this.state, canvasAnnotationPages = _this$state.canvasAnnotationPages, canvasAnnotationList = _this$state.canvasAnnotationList;
|
|
434
298
|
if (!(canvasAnnotationList.json !== undefined)) {
|
|
435
|
-
_context2.
|
|
299
|
+
_context2.n = 1;
|
|
436
300
|
break;
|
|
437
301
|
}
|
|
438
302
|
if (!(canvasAnnotationList.json[0].items !== undefined)) {
|
|
439
|
-
_context2.
|
|
303
|
+
_context2.n = 1;
|
|
440
304
|
break;
|
|
441
305
|
}
|
|
442
306
|
this.setState({
|
|
443
307
|
annotationData: canvasAnnotationList.json[0].items,
|
|
444
308
|
loading: false
|
|
445
309
|
});
|
|
446
|
-
return _context2.
|
|
447
|
-
case
|
|
310
|
+
return _context2.a(2);
|
|
311
|
+
case 1:
|
|
448
312
|
promises = [];
|
|
449
313
|
canvasAnnotationPages.forEach(function (annotationPage, index) {
|
|
450
314
|
var promise = new Promise(/*#__PURE__*/function () {
|
|
451
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/
|
|
315
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(resolve, reject) {
|
|
452
316
|
var result;
|
|
453
|
-
return
|
|
454
|
-
while (1) switch (_context.
|
|
317
|
+
return _regenerator().w(function (_context) {
|
|
318
|
+
while (1) switch (_context.p = _context.n) {
|
|
455
319
|
case 0:
|
|
456
|
-
_context.
|
|
457
|
-
_context.
|
|
320
|
+
_context.p = 0;
|
|
321
|
+
_context.n = 1;
|
|
458
322
|
return fetch(annotationPage, {
|
|
459
323
|
method: 'get',
|
|
460
324
|
credentials: 'include'
|
|
461
325
|
});
|
|
462
|
-
case
|
|
463
|
-
result = _context.
|
|
326
|
+
case 1:
|
|
327
|
+
result = _context.v;
|
|
464
328
|
resolve(result.json());
|
|
465
|
-
_context.
|
|
329
|
+
_context.n = 3;
|
|
466
330
|
break;
|
|
467
|
-
case
|
|
468
|
-
_context.
|
|
469
|
-
_context.
|
|
331
|
+
case 2:
|
|
332
|
+
_context.p = 2;
|
|
333
|
+
_context.v;
|
|
470
334
|
reject('Network response was not ok');
|
|
471
|
-
case
|
|
472
|
-
|
|
473
|
-
return _context.stop();
|
|
335
|
+
case 3:
|
|
336
|
+
return _context.a(2);
|
|
474
337
|
}
|
|
475
|
-
}, _callee, null, [[0,
|
|
338
|
+
}, _callee, null, [[0, 2]]);
|
|
476
339
|
}));
|
|
477
340
|
return function (_x, _x2) {
|
|
478
341
|
return _ref.apply(this, arguments);
|
|
@@ -480,30 +343,29 @@ var AnnotationsAuthSidePanel = /*#__PURE__*/function (_Component) {
|
|
|
480
343
|
}());
|
|
481
344
|
promises.push(promise);
|
|
482
345
|
});
|
|
483
|
-
_context2.
|
|
484
|
-
_context2.
|
|
346
|
+
_context2.p = 2;
|
|
347
|
+
_context2.n = 3;
|
|
485
348
|
return Promise.all(promises);
|
|
486
|
-
case
|
|
487
|
-
results = _context2.
|
|
349
|
+
case 3:
|
|
350
|
+
results = _context2.v;
|
|
488
351
|
this.setState({
|
|
489
352
|
annotationData: results,
|
|
490
353
|
loading: false
|
|
491
354
|
});
|
|
492
|
-
_context2.
|
|
355
|
+
_context2.n = 5;
|
|
493
356
|
break;
|
|
494
|
-
case
|
|
495
|
-
_context2.
|
|
496
|
-
|
|
497
|
-
console.error('There was a problem receiving the annotation:',
|
|
357
|
+
case 4:
|
|
358
|
+
_context2.p = 4;
|
|
359
|
+
_t2 = _context2.v;
|
|
360
|
+
console.error('There was a problem receiving the annotation:', _t2);
|
|
498
361
|
this.setState({
|
|
499
362
|
loading: false,
|
|
500
|
-
error:
|
|
363
|
+
error: _t2.message
|
|
501
364
|
});
|
|
502
|
-
case
|
|
503
|
-
|
|
504
|
-
return _context2.stop();
|
|
365
|
+
case 5:
|
|
366
|
+
return _context2.a(2);
|
|
505
367
|
}
|
|
506
|
-
}, _callee2, this, [[
|
|
368
|
+
}, _callee2, this, [[2, 4]]);
|
|
507
369
|
}));
|
|
508
370
|
function componentDidMount() {
|
|
509
371
|
return _componentDidMount.apply(this, arguments);
|