@atlaskit/editor-extension-dropbox 0.3.7 → 0.3.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/editor-extension-dropbox
2
2
 
3
+ ## 0.3.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 0.3.7
4
10
 
5
11
  ### Patch Changes
@@ -22,9 +22,7 @@ Please reach out to the Editor team if you need more information
22
22
  // @ts-ignore
23
23
  // prettier-ignore
24
24
  !function (e, o) {
25
- for (var n in o) {
26
- e[n] = o[n];
27
- }
25
+ for (var n in o) e[n] = o[n];
28
26
  }(window, function (e) {
29
27
  var o = {};
30
28
  function n(t) {
@@ -54,11 +52,9 @@ Please reach out to the Editor team if you need more information
54
52
  if (n.r(t), Object.defineProperty(t, "default", {
55
53
  enumerable: !0,
56
54
  value: e
57
- }), 2 & o && "string" != typeof e) for (var r in e) {
58
- n.d(t, r, function (o) {
59
- return e[o];
60
- }.bind(null, r));
61
- }
55
+ }), 2 & o && "string" != typeof e) for (var r in e) n.d(t, r, function (o) {
56
+ return e[o];
57
+ }.bind(null, r));
62
58
  return t;
63
59
  }, n.n = function (e) {
64
60
  var o = e && e.__esModule ? function () {
@@ -76,11 +72,7 @@ Please reach out to the Editor team if you need more information
76
72
  var t,
77
73
  r = this && this.__assign || function () {
78
74
  return (r = Object.assign || function (e) {
79
- for (var o, n = 1, t = arguments.length; n < t; n++) {
80
- for (var r in o = arguments[n]) {
81
- Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
82
- }
83
- }
75
+ for (var o, n = 1, t = arguments.length; n < t; n++) for (var r in o = arguments[n]) Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
84
76
  return e;
85
77
  }).apply(this, arguments);
86
78
  };
@@ -338,9 +330,7 @@ Please reach out to the Editor team if you need more information
338
330
  return n;
339
331
  };
340
332
  Dropbox.save = function () {
341
- for (var o = [], r = 0; r < arguments.length; r++) {
342
- o[r] = arguments[r];
343
- }
333
+ for (var o = [], r = 0; r < arguments.length; r++) o[r] = arguments[r];
344
334
  var s = e(o);
345
335
  if (Dropbox.isBrowserSupported()) {
346
336
  if (s._popup = !0, "object" != (0, _typeof2.default)(s.files) || !s.files.length) throw new Error("The object passed in must have a 'files' property that contains a list of objects. See documentation.");
@@ -432,9 +422,7 @@ Please reach out to the Editor team if you need more information
432
422
  t.currentChooserSession && (t.currentChooserSession.onClose && t.currentChooserSession.onClose(), t.currentChooserSession.options.cancel && t.currentChooserSession.options.cancel(t.last_navigation));
433
423
  }, Dropbox.isBrowserSupported = function () {
434
424
  var e = function () {
435
- for (var e = 0, o = [/IEMobile\/(7|8|9|10)\./, /BB10;/, /CriOS/]; e < o.length; e++) {
436
- if (o[e].test(navigator.userAgent)) return !1;
437
- }
425
+ for (var e = 0, o = [/IEMobile\/(7|8|9|10)\./, /BB10;/, /CriOS/]; e < o.length; e++) if (o[e].test(navigator.userAgent)) return !1;
438
426
  return "undefined" != typeof JSON && null !== JSON && null != window.postMessage && null != window.addEventListener && !/MSIE [7-9]/.test(navigator.userAgent);
439
427
  }();
440
428
  return Dropbox.isBrowserSupported = function () {
@@ -460,9 +448,7 @@ Please reach out to the Editor team if you need more information
460
448
  });
461
449
  }), o;
462
450
  }, Dropbox.createSaveButton = function () {
463
- for (var o = [], n = 0; n < arguments.length; n++) {
464
- o[n] = arguments[n];
465
- }
451
+ for (var o = [], n = 0; n < arguments.length; n++) o[n] = arguments[n];
466
452
  var t = e(o),
467
453
  r = o.shift();
468
454
  return r = s(i("Save to Dropbox"), r), Dropbox.addListener(r, "click", function (e) {
@@ -577,9 +563,7 @@ Please reach out to the Editor team if you need more information
577
563
  } instanceof Array && function (e, o) {
578
564
  e.__proto__ = o;
579
565
  } || function (e, o) {
580
- for (var n in o) {
581
- o.hasOwnProperty(n) && (e[n] = o[n]);
582
- }
566
+ for (var n in o) o.hasOwnProperty(n) && (e[n] = o[n]);
583
567
  })(e, o);
584
568
  }, function (e, o) {
585
569
  function n() {
@@ -616,9 +600,7 @@ Please reach out to the Editor team if you need more information
616
600
  }
617
601
  if (e("initialViewType", "string"), void 0 !== n.options.fields) {
618
602
  if (!(n.options.fields instanceof Array)) throw new Error("The fields option, if provided, must be an array");
619
- for (var c = 0, l = n.options.fields; c < l.length; c++) {
620
- if ("string" != typeof l[c]) throw new Error("The fields option, if provided, must be an array of strings");
621
- }
603
+ for (var c = 0, l = n.options.fields; c < l.length; c++) if ("string" != typeof l[c]) throw new Error("The fields option, if provided, must be an array of strings");
622
604
  }
623
605
  if (e("showSignOut", "boolean"), e("version", "string"), e("cl", "string"), "function" != typeof n.options.onSuccess) throw new Error("You must provide a success callback to the Chooser to see the files that the user selects");
624
606
  e("onReady", "function"), e("onCancel", "function"), e("onError", "function"), e("onResize", "function");
@@ -729,9 +711,7 @@ Please reach out to the Editor team if you need more information
729
711
  var t = n(9);
730
712
  function r(e) {
731
713
  return function () {
732
- for (var o = 0, n = e; o < n.length; o++) {
733
- (0, n[o])();
734
- }
714
+ for (var o = 0, n = e; o < n.length; o++) (0, n[o])();
735
715
  };
736
716
  }
737
717
  o.TARGET_ORIGIN = "https://www.dropbox.com";
@@ -803,9 +783,7 @@ Please reach out to the Editor team if you need more information
803
783
  }
804
784
  }
805
785
  }, e.prototype.throwIfAlreadyActive = function (e) {
806
- for (var o = 0, n = this.activeDropins; o < n.length; o++) {
807
- if (n[o].dropin === e) throw new Error("Component is already in use");
808
- }
786
+ for (var o = 0, n = this.activeDropins; o < n.length; o++) if (n[o].dropin === e) throw new Error("Component is already in use");
809
787
  }, e.prototype.attach = function (e, n) {
810
788
  e.sendMessage = function (e) {
811
789
  n().postMessage(JSON.stringify(e), o.TARGET_ORIGIN);
@@ -871,9 +849,7 @@ Please reach out to the Editor team if you need more information
871
849
  } instanceof Array && function (e, o) {
872
850
  e.__proto__ = o;
873
851
  } || function (e, o) {
874
- for (var n in o) {
875
- o.hasOwnProperty(n) && (e[n] = o[n]);
876
- }
852
+ for (var n in o) o.hasOwnProperty(n) && (e[n] = o[n]);
877
853
  })(e, o);
878
854
  }, function (e, o) {
879
855
  function n() {
@@ -910,9 +886,7 @@ Please reach out to the Editor team if you need more information
910
886
  } instanceof Array && function (e, o) {
911
887
  e.__proto__ = o;
912
888
  } || function (e, o) {
913
- for (var n in o) {
914
- o.hasOwnProperty(n) && (e[n] = o[n]);
915
- }
889
+ for (var n in o) o.hasOwnProperty(n) && (e[n] = o[n]);
916
890
  })(e, o);
917
891
  }, function (e, o) {
918
892
  function n() {
@@ -922,11 +896,7 @@ Please reach out to the Editor team if you need more information
922
896
  }),
923
897
  i = this && this.__assign || function () {
924
898
  return (i = Object.assign || function (e) {
925
- for (var o, n = 1, t = arguments.length; n < t; n++) {
926
- for (var r in o = arguments[n]) {
927
- Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
928
- }
929
- }
899
+ for (var o, n = 1, t = arguments.length; n < t; n++) for (var r in o = arguments[n]) Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
930
900
  return e;
931
901
  }).apply(this, arguments);
932
902
  };
@@ -988,9 +958,7 @@ Please reach out to the Editor team if you need more information
988
958
  } instanceof Array && function (e, o) {
989
959
  e.__proto__ = o;
990
960
  } || function (e, o) {
991
- for (var n in o) {
992
- o.hasOwnProperty(n) && (e[n] = o[n]);
993
- }
961
+ for (var n in o) o.hasOwnProperty(n) && (e[n] = o[n]);
994
962
  })(e, o);
995
963
  }, function (e, o) {
996
964
  function n() {
@@ -1000,11 +968,7 @@ Please reach out to the Editor team if you need more information
1000
968
  }),
1001
969
  i = this && this.__assign || function () {
1002
970
  return (i = Object.assign || function (e) {
1003
- for (var o, n = 1, t = arguments.length; n < t; n++) {
1004
- for (var r in o = arguments[n]) {
1005
- Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
1006
- }
1007
- }
971
+ for (var o, n = 1, t = arguments.length; n < t; n++) for (var r in o = arguments[n]) Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
1008
972
  return e;
1009
973
  }).apply(this, arguments);
1010
974
  };
@@ -6,32 +6,30 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
- 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; }
11
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
13
  var _default = /*#__PURE__*/function () {
14
- var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(appKey) {
15
- return _regeneratorRuntime().wrap(function _callee$(_context) {
16
- while (1) {
17
- switch (_context.prev = _context.next) {
18
- case 0:
19
- if (window.Dropbox) {
20
- _context.next = 4;
21
- break;
22
- }
23
- return _context.abrupt("return", Promise.resolve().then(function () {
24
- return _interopRequireWildcard(require('./dropboxscript'));
25
- }).then(function () {
26
- window.Dropbox.appKey = appKey;
27
- }));
28
- case 4:
14
+ var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(appKey) {
15
+ return _regenerator.default.wrap(function _callee$(_context) {
16
+ while (1) switch (_context.prev = _context.next) {
17
+ case 0:
18
+ if (window.Dropbox) {
19
+ _context.next = 4;
20
+ break;
21
+ }
22
+ return _context.abrupt("return", Promise.resolve().then(function () {
23
+ return _interopRequireWildcard(require('./dropboxscript'));
24
+ }).then(function () {
29
25
  window.Dropbox.appKey = appKey;
30
- return _context.abrupt("return", Promise.resolve());
31
- case 6:
32
- case "end":
33
- return _context.stop();
34
- }
26
+ }));
27
+ case 4:
28
+ window.Dropbox.appKey = appKey;
29
+ return _context.abrupt("return", Promise.resolve());
30
+ case 6:
31
+ case "end":
32
+ return _context.stop();
35
33
  }
36
34
  }, _callee);
37
35
  }));
@@ -6,107 +6,105 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.default = void 0;
9
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
11
  var _react = _interopRequireDefault(require("react"));
11
12
  var _reactDom = _interopRequireDefault(require("react-dom"));
12
13
  var _builders = require("@atlaskit/adf-utils/builders");
13
14
  var _enableDropbox = _interopRequireDefault(require("./enable-dropbox"));
14
15
  var _constants = require("./constants");
15
- 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; }
16
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
17
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
18
  function pickFromDropbox(_x, _x2) {
19
19
  return _pickFromDropbox.apply(this, arguments);
20
20
  }
21
21
  function _pickFromDropbox() {
22
- _pickFromDropbox = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appKey, canMountinIframe) {
22
+ _pickFromDropbox = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(appKey, canMountinIframe) {
23
23
  var popupMountPoint, Modal, files, node, newNodes;
24
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
25
- while (1) {
26
- switch (_context2.prev = _context2.next) {
27
- case 0:
28
- _context2.next = 2;
29
- return (0, _enableDropbox.default)(appKey);
30
- case 2:
31
- if (!canMountinIframe) {
32
- _context2.next = 9;
33
- break;
34
- }
35
- _context2.next = 5;
36
- return Promise.resolve().then(function () {
37
- return _interopRequireWildcard(require('./modal'));
38
- });
39
- case 5:
40
- Modal = _context2.sent;
41
- // The decision has been made to simply append our modal to the body
42
- // Using the passed in popupMountPoint has the potential to cause
43
- // problems, and several users pass down document.body anyway
44
- //
45
- // We want to append it and attach it to a new div so we have complete control.
46
- popupMountPoint = document.getElementById(_constants.POPUP_MOUNTPOINT);
47
- if (!popupMountPoint) {
48
- popupMountPoint = document.createElement('div');
49
- popupMountPoint.id = _constants.POPUP_MOUNTPOINT;
50
- document.body.appendChild(popupMountPoint);
51
- }
52
- _reactDom.default.render( /*#__PURE__*/_react.default.createElement(Modal.default, {
53
- onClose: function onClose() {}
54
- }), popupMountPoint);
55
- case 9:
56
- _context2.prev = 9;
57
- _context2.next = 12;
58
- return new Promise(function (resolve, reject) {
59
- window.Dropbox.choose({
60
- iframe: canMountinIframe,
61
- windowName: canMountinIframe ? _constants.DROPBOX_IFRAME_NAME : undefined,
62
- success: resolve,
63
- cancel: reject
64
- });
24
+ return _regenerator.default.wrap(function _callee2$(_context2) {
25
+ while (1) switch (_context2.prev = _context2.next) {
26
+ case 0:
27
+ _context2.next = 2;
28
+ return (0, _enableDropbox.default)(appKey);
29
+ case 2:
30
+ if (!canMountinIframe) {
31
+ _context2.next = 9;
32
+ break;
33
+ }
34
+ _context2.next = 5;
35
+ return Promise.resolve().then(function () {
36
+ return _interopRequireWildcard(require('./modal'));
37
+ });
38
+ case 5:
39
+ Modal = _context2.sent;
40
+ // The decision has been made to simply append our modal to the body
41
+ // Using the passed in popupMountPoint has the potential to cause
42
+ // problems, and several users pass down document.body anyway
43
+ //
44
+ // We want to append it and attach it to a new div so we have complete control.
45
+ popupMountPoint = document.getElementById(_constants.POPUP_MOUNTPOINT);
46
+ if (!popupMountPoint) {
47
+ popupMountPoint = document.createElement('div');
48
+ popupMountPoint.id = _constants.POPUP_MOUNTPOINT;
49
+ document.body.appendChild(popupMountPoint);
50
+ }
51
+ _reactDom.default.render( /*#__PURE__*/_react.default.createElement(Modal.default, {
52
+ onClose: function onClose() {}
53
+ }), popupMountPoint);
54
+ case 9:
55
+ _context2.prev = 9;
56
+ _context2.next = 12;
57
+ return new Promise(function (resolve, reject) {
58
+ window.Dropbox.choose({
59
+ iframe: canMountinIframe,
60
+ windowName: canMountinIframe ? _constants.DROPBOX_IFRAME_NAME : undefined,
61
+ success: resolve,
62
+ cancel: reject
65
63
  });
66
- case 12:
67
- files = _context2.sent;
68
- _context2.next = 19;
64
+ });
65
+ case 12:
66
+ files = _context2.sent;
67
+ _context2.next = 19;
68
+ break;
69
+ case 15:
70
+ _context2.prev = 15;
71
+ _context2.t0 = _context2["catch"](9);
72
+ if (popupMountPoint) {
73
+ _reactDom.default.unmountComponentAtNode(popupMountPoint);
74
+ }
75
+ return _context2.abrupt("return");
76
+ case 19:
77
+ if (files.length) {
78
+ _context2.next = 22;
69
79
  break;
70
- case 15:
71
- _context2.prev = 15;
72
- _context2.t0 = _context2["catch"](9);
73
- if (popupMountPoint) {
74
- _reactDom.default.unmountComponentAtNode(popupMountPoint);
75
- }
76
- return _context2.abrupt("return");
77
- case 19:
78
- if (files.length) {
79
- _context2.next = 22;
80
- break;
81
- }
82
- if (popupMountPoint) {
83
- _reactDom.default.unmountComponentAtNode(popupMountPoint);
84
- }
85
- return _context2.abrupt("return");
86
- case 22:
87
- newNodes = files.map(function (file) {
88
- return (0, _builders.inlineCard)({
89
- url: file.link
90
- });
80
+ }
81
+ if (popupMountPoint) {
82
+ _reactDom.default.unmountComponentAtNode(popupMountPoint);
83
+ }
84
+ return _context2.abrupt("return");
85
+ case 22:
86
+ newNodes = files.map(function (file) {
87
+ return (0, _builders.inlineCard)({
88
+ url: file.link
91
89
  });
92
- if (newNodes.length === 1) {
93
- node = newNodes[0];
94
- } else {
95
- // NOTE: we are not currently passing in `multiselect`, so this is not a possible state,
96
- // but we likely want to allow multiselect in the future so doing some future-proofing
97
- node = {
98
- type: 'paragraph',
99
- content: newNodes
100
- };
101
- }
102
- if (popupMountPoint) {
103
- _reactDom.default.unmountComponentAtNode(popupMountPoint);
104
- }
105
- return _context2.abrupt("return", node);
106
- case 26:
107
- case "end":
108
- return _context2.stop();
109
- }
90
+ });
91
+ if (newNodes.length === 1) {
92
+ node = newNodes[0];
93
+ } else {
94
+ // NOTE: we are not currently passing in `multiselect`, so this is not a possible state,
95
+ // but we likely want to allow multiselect in the future so doing some future-proofing
96
+ node = {
97
+ type: 'paragraph',
98
+ content: newNodes
99
+ };
100
+ }
101
+ if (popupMountPoint) {
102
+ _reactDom.default.unmountComponentAtNode(popupMountPoint);
103
+ }
104
+ return _context2.abrupt("return", node);
105
+ case 26:
106
+ case "end":
107
+ return _context2.stop();
110
108
  }
111
109
  }, _callee2, null, [[9, 15]]);
112
110
  }));
@@ -123,21 +121,21 @@ var manifestFunction = function manifestFunction(_ref) {
123
121
  icons: {
124
122
  '16': function _() {
125
123
  return Promise.resolve().then(function () {
126
- return _interopRequireWildcard(require('./icons/DropboxIcon'));
124
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */'./icons/DropboxIcon'));
127
125
  }).then(function (mod) {
128
126
  return mod.default;
129
127
  });
130
128
  },
131
129
  '24': function _() {
132
130
  return Promise.resolve().then(function () {
133
- return _interopRequireWildcard(require('./icons/DropboxIcon'));
131
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */'./icons/DropboxIcon'));
134
132
  }).then(function (mod) {
135
133
  return mod.default;
136
134
  });
137
135
  },
138
136
  '48': function _() {
139
137
  return Promise.resolve().then(function () {
140
- return _interopRequireWildcard(require('./icons/DropboxIcon'));
138
+ return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-dropbox" */'./icons/DropboxIcon'));
141
139
  }).then(function (mod) {
142
140
  return mod.default;
143
141
  });
@@ -148,32 +146,30 @@ var manifestFunction = function manifestFunction(_ref) {
148
146
  key: 'item',
149
147
  action: function action() {
150
148
  return new Promise( /*#__PURE__*/function () {
151
- var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
149
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(resolve, reject) {
152
150
  var newNode;
153
- return _regeneratorRuntime().wrap(function _callee$(_context) {
154
- while (1) {
155
- switch (_context.prev = _context.next) {
156
- case 0:
157
- _context.prev = 0;
158
- _context.next = 3;
159
- return pickFromDropbox(appKey, canMountinIframe);
160
- case 3:
161
- newNode = _context.sent;
162
- if (!newNode) {
163
- reject();
164
- } else {
165
- resolve(newNode);
166
- }
167
- _context.next = 10;
168
- break;
169
- case 7:
170
- _context.prev = 7;
171
- _context.t0 = _context["catch"](0);
172
- reject(_context.t0);
173
- case 10:
174
- case "end":
175
- return _context.stop();
176
- }
151
+ return _regenerator.default.wrap(function _callee$(_context) {
152
+ while (1) switch (_context.prev = _context.next) {
153
+ case 0:
154
+ _context.prev = 0;
155
+ _context.next = 3;
156
+ return pickFromDropbox(appKey, canMountinIframe);
157
+ case 3:
158
+ newNode = _context.sent;
159
+ if (!newNode) {
160
+ reject();
161
+ } else {
162
+ resolve(newNode);
163
+ }
164
+ _context.next = 10;
165
+ break;
166
+ case 7:
167
+ _context.prev = 7;
168
+ _context.t0 = _context["catch"](0);
169
+ reject(_context.t0);
170
+ case 10:
171
+ case "end":
172
+ return _context.stop();
177
173
  }
178
174
  }, _callee, null, [[0, 7]]);
179
175
  }));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-extension-dropbox",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-extension-dropbox",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "sideEffects": false
5
5
  }
@@ -15,9 +15,7 @@ Please reach out to the Editor team if you need more information
15
15
  // @ts-ignore
16
16
  // prettier-ignore
17
17
  !function (e, o) {
18
- for (var n in o) {
19
- e[n] = o[n];
20
- }
18
+ for (var n in o) e[n] = o[n];
21
19
  }(window, function (e) {
22
20
  var o = {};
23
21
  function n(t) {
@@ -47,11 +45,9 @@ Please reach out to the Editor team if you need more information
47
45
  if (n.r(t), Object.defineProperty(t, "default", {
48
46
  enumerable: !0,
49
47
  value: e
50
- }), 2 & o && "string" != typeof e) for (var r in e) {
51
- n.d(t, r, function (o) {
52
- return e[o];
53
- }.bind(null, r));
54
- }
48
+ }), 2 & o && "string" != typeof e) for (var r in e) n.d(t, r, function (o) {
49
+ return e[o];
50
+ }.bind(null, r));
55
51
  return t;
56
52
  }, n.n = function (e) {
57
53
  var o = e && e.__esModule ? function () {
@@ -69,11 +65,7 @@ Please reach out to the Editor team if you need more information
69
65
  var t,
70
66
  r = this && this.__assign || function () {
71
67
  return (r = Object.assign || function (e) {
72
- for (var o, n = 1, t = arguments.length; n < t; n++) {
73
- for (var r in o = arguments[n]) {
74
- Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
75
- }
76
- }
68
+ for (var o, n = 1, t = arguments.length; n < t; n++) for (var r in o = arguments[n]) Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
77
69
  return e;
78
70
  }).apply(this, arguments);
79
71
  };
@@ -331,9 +323,7 @@ Please reach out to the Editor team if you need more information
331
323
  return n;
332
324
  };
333
325
  Dropbox.save = function () {
334
- for (var o = [], r = 0; r < arguments.length; r++) {
335
- o[r] = arguments[r];
336
- }
326
+ for (var o = [], r = 0; r < arguments.length; r++) o[r] = arguments[r];
337
327
  var s = e(o);
338
328
  if (Dropbox.isBrowserSupported()) {
339
329
  if (s._popup = !0, "object" != _typeof(s.files) || !s.files.length) throw new Error("The object passed in must have a 'files' property that contains a list of objects. See documentation.");
@@ -425,9 +415,7 @@ Please reach out to the Editor team if you need more information
425
415
  t.currentChooserSession && (t.currentChooserSession.onClose && t.currentChooserSession.onClose(), t.currentChooserSession.options.cancel && t.currentChooserSession.options.cancel(t.last_navigation));
426
416
  }, Dropbox.isBrowserSupported = function () {
427
417
  var e = function () {
428
- for (var e = 0, o = [/IEMobile\/(7|8|9|10)\./, /BB10;/, /CriOS/]; e < o.length; e++) {
429
- if (o[e].test(navigator.userAgent)) return !1;
430
- }
418
+ for (var e = 0, o = [/IEMobile\/(7|8|9|10)\./, /BB10;/, /CriOS/]; e < o.length; e++) if (o[e].test(navigator.userAgent)) return !1;
431
419
  return "undefined" != typeof JSON && null !== JSON && null != window.postMessage && null != window.addEventListener && !/MSIE [7-9]/.test(navigator.userAgent);
432
420
  }();
433
421
  return Dropbox.isBrowserSupported = function () {
@@ -453,9 +441,7 @@ Please reach out to the Editor team if you need more information
453
441
  });
454
442
  }), o;
455
443
  }, Dropbox.createSaveButton = function () {
456
- for (var o = [], n = 0; n < arguments.length; n++) {
457
- o[n] = arguments[n];
458
- }
444
+ for (var o = [], n = 0; n < arguments.length; n++) o[n] = arguments[n];
459
445
  var t = e(o),
460
446
  r = o.shift();
461
447
  return r = s(i("Save to Dropbox"), r), Dropbox.addListener(r, "click", function (e) {
@@ -570,9 +556,7 @@ Please reach out to the Editor team if you need more information
570
556
  } instanceof Array && function (e, o) {
571
557
  e.__proto__ = o;
572
558
  } || function (e, o) {
573
- for (var n in o) {
574
- o.hasOwnProperty(n) && (e[n] = o[n]);
575
- }
559
+ for (var n in o) o.hasOwnProperty(n) && (e[n] = o[n]);
576
560
  })(e, o);
577
561
  }, function (e, o) {
578
562
  function n() {
@@ -609,9 +593,7 @@ Please reach out to the Editor team if you need more information
609
593
  }
610
594
  if (e("initialViewType", "string"), void 0 !== n.options.fields) {
611
595
  if (!(n.options.fields instanceof Array)) throw new Error("The fields option, if provided, must be an array");
612
- for (var c = 0, l = n.options.fields; c < l.length; c++) {
613
- if ("string" != typeof l[c]) throw new Error("The fields option, if provided, must be an array of strings");
614
- }
596
+ for (var c = 0, l = n.options.fields; c < l.length; c++) if ("string" != typeof l[c]) throw new Error("The fields option, if provided, must be an array of strings");
615
597
  }
616
598
  if (e("showSignOut", "boolean"), e("version", "string"), e("cl", "string"), "function" != typeof n.options.onSuccess) throw new Error("You must provide a success callback to the Chooser to see the files that the user selects");
617
599
  e("onReady", "function"), e("onCancel", "function"), e("onError", "function"), e("onResize", "function");
@@ -722,9 +704,7 @@ Please reach out to the Editor team if you need more information
722
704
  var t = n(9);
723
705
  function r(e) {
724
706
  return function () {
725
- for (var o = 0, n = e; o < n.length; o++) {
726
- (0, n[o])();
727
- }
707
+ for (var o = 0, n = e; o < n.length; o++) (0, n[o])();
728
708
  };
729
709
  }
730
710
  o.TARGET_ORIGIN = "https://www.dropbox.com";
@@ -796,9 +776,7 @@ Please reach out to the Editor team if you need more information
796
776
  }
797
777
  }
798
778
  }, e.prototype.throwIfAlreadyActive = function (e) {
799
- for (var o = 0, n = this.activeDropins; o < n.length; o++) {
800
- if (n[o].dropin === e) throw new Error("Component is already in use");
801
- }
779
+ for (var o = 0, n = this.activeDropins; o < n.length; o++) if (n[o].dropin === e) throw new Error("Component is already in use");
802
780
  }, e.prototype.attach = function (e, n) {
803
781
  e.sendMessage = function (e) {
804
782
  n().postMessage(JSON.stringify(e), o.TARGET_ORIGIN);
@@ -864,9 +842,7 @@ Please reach out to the Editor team if you need more information
864
842
  } instanceof Array && function (e, o) {
865
843
  e.__proto__ = o;
866
844
  } || function (e, o) {
867
- for (var n in o) {
868
- o.hasOwnProperty(n) && (e[n] = o[n]);
869
- }
845
+ for (var n in o) o.hasOwnProperty(n) && (e[n] = o[n]);
870
846
  })(e, o);
871
847
  }, function (e, o) {
872
848
  function n() {
@@ -903,9 +879,7 @@ Please reach out to the Editor team if you need more information
903
879
  } instanceof Array && function (e, o) {
904
880
  e.__proto__ = o;
905
881
  } || function (e, o) {
906
- for (var n in o) {
907
- o.hasOwnProperty(n) && (e[n] = o[n]);
908
- }
882
+ for (var n in o) o.hasOwnProperty(n) && (e[n] = o[n]);
909
883
  })(e, o);
910
884
  }, function (e, o) {
911
885
  function n() {
@@ -915,11 +889,7 @@ Please reach out to the Editor team if you need more information
915
889
  }),
916
890
  i = this && this.__assign || function () {
917
891
  return (i = Object.assign || function (e) {
918
- for (var o, n = 1, t = arguments.length; n < t; n++) {
919
- for (var r in o = arguments[n]) {
920
- Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
921
- }
922
- }
892
+ for (var o, n = 1, t = arguments.length; n < t; n++) for (var r in o = arguments[n]) Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
923
893
  return e;
924
894
  }).apply(this, arguments);
925
895
  };
@@ -981,9 +951,7 @@ Please reach out to the Editor team if you need more information
981
951
  } instanceof Array && function (e, o) {
982
952
  e.__proto__ = o;
983
953
  } || function (e, o) {
984
- for (var n in o) {
985
- o.hasOwnProperty(n) && (e[n] = o[n]);
986
- }
954
+ for (var n in o) o.hasOwnProperty(n) && (e[n] = o[n]);
987
955
  })(e, o);
988
956
  }, function (e, o) {
989
957
  function n() {
@@ -993,11 +961,7 @@ Please reach out to the Editor team if you need more information
993
961
  }),
994
962
  i = this && this.__assign || function () {
995
963
  return (i = Object.assign || function (e) {
996
- for (var o, n = 1, t = arguments.length; n < t; n++) {
997
- for (var r in o = arguments[n]) {
998
- Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
999
- }
1000
- }
964
+ for (var o, n = 1, t = arguments.length; n < t; n++) for (var r in o = arguments[n]) Object.prototype.hasOwnProperty.call(o, r) && (e[r] = o[r]);
1001
965
  return e;
1002
966
  }).apply(this, arguments);
1003
967
  };
@@ -1,26 +1,23 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- 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; }
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
3
  export default /*#__PURE__*/(function () {
5
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(appKey) {
6
- return _regeneratorRuntime().wrap(function _callee$(_context) {
7
- while (1) {
8
- switch (_context.prev = _context.next) {
9
- case 0:
10
- if (window.Dropbox) {
11
- _context.next = 4;
12
- break;
13
- }
14
- return _context.abrupt("return", import('./dropboxscript').then(function () {
15
- window.Dropbox.appKey = appKey;
16
- }));
17
- case 4:
4
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(appKey) {
5
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
6
+ while (1) switch (_context.prev = _context.next) {
7
+ case 0:
8
+ if (window.Dropbox) {
9
+ _context.next = 4;
10
+ break;
11
+ }
12
+ return _context.abrupt("return", import('./dropboxscript').then(function () {
18
13
  window.Dropbox.appKey = appKey;
19
- return _context.abrupt("return", Promise.resolve());
20
- case 6:
21
- case "end":
22
- return _context.stop();
23
- }
14
+ }));
15
+ case 4:
16
+ window.Dropbox.appKey = appKey;
17
+ return _context.abrupt("return", Promise.resolve());
18
+ case 6:
19
+ case "end":
20
+ return _context.stop();
24
21
  }
25
22
  }, _callee);
26
23
  }));
@@ -1,6 +1,5 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
- 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; }
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
3
  import React from 'react';
5
4
  import ReactDOM from 'react-dom';
6
5
  import { inlineCard } from '@atlaskit/adf-utils/builders';
@@ -10,92 +9,90 @@ function pickFromDropbox(_x, _x2) {
10
9
  return _pickFromDropbox.apply(this, arguments);
11
10
  }
12
11
  function _pickFromDropbox() {
13
- _pickFromDropbox = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(appKey, canMountinIframe) {
12
+ _pickFromDropbox = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(appKey, canMountinIframe) {
14
13
  var popupMountPoint, Modal, files, node, newNodes;
15
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
16
- while (1) {
17
- switch (_context2.prev = _context2.next) {
18
- case 0:
19
- _context2.next = 2;
20
- return enableDropbox(appKey);
21
- case 2:
22
- if (!canMountinIframe) {
23
- _context2.next = 9;
24
- break;
25
- }
26
- _context2.next = 5;
27
- return import('./modal');
28
- case 5:
29
- Modal = _context2.sent;
30
- // The decision has been made to simply append our modal to the body
31
- // Using the passed in popupMountPoint has the potential to cause
32
- // problems, and several users pass down document.body anyway
33
- //
34
- // We want to append it and attach it to a new div so we have complete control.
35
- popupMountPoint = document.getElementById(POPUP_MOUNTPOINT);
36
- if (!popupMountPoint) {
37
- popupMountPoint = document.createElement('div');
38
- popupMountPoint.id = POPUP_MOUNTPOINT;
39
- document.body.appendChild(popupMountPoint);
40
- }
41
- ReactDOM.render( /*#__PURE__*/React.createElement(Modal.default, {
42
- onClose: function onClose() {}
43
- }), popupMountPoint);
44
- case 9:
45
- _context2.prev = 9;
46
- _context2.next = 12;
47
- return new Promise(function (resolve, reject) {
48
- window.Dropbox.choose({
49
- iframe: canMountinIframe,
50
- windowName: canMountinIframe ? DROPBOX_IFRAME_NAME : undefined,
51
- success: resolve,
52
- cancel: reject
53
- });
14
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
15
+ while (1) switch (_context2.prev = _context2.next) {
16
+ case 0:
17
+ _context2.next = 2;
18
+ return enableDropbox(appKey);
19
+ case 2:
20
+ if (!canMountinIframe) {
21
+ _context2.next = 9;
22
+ break;
23
+ }
24
+ _context2.next = 5;
25
+ return import('./modal');
26
+ case 5:
27
+ Modal = _context2.sent;
28
+ // The decision has been made to simply append our modal to the body
29
+ // Using the passed in popupMountPoint has the potential to cause
30
+ // problems, and several users pass down document.body anyway
31
+ //
32
+ // We want to append it and attach it to a new div so we have complete control.
33
+ popupMountPoint = document.getElementById(POPUP_MOUNTPOINT);
34
+ if (!popupMountPoint) {
35
+ popupMountPoint = document.createElement('div');
36
+ popupMountPoint.id = POPUP_MOUNTPOINT;
37
+ document.body.appendChild(popupMountPoint);
38
+ }
39
+ ReactDOM.render( /*#__PURE__*/React.createElement(Modal.default, {
40
+ onClose: function onClose() {}
41
+ }), popupMountPoint);
42
+ case 9:
43
+ _context2.prev = 9;
44
+ _context2.next = 12;
45
+ return new Promise(function (resolve, reject) {
46
+ window.Dropbox.choose({
47
+ iframe: canMountinIframe,
48
+ windowName: canMountinIframe ? DROPBOX_IFRAME_NAME : undefined,
49
+ success: resolve,
50
+ cancel: reject
54
51
  });
55
- case 12:
56
- files = _context2.sent;
57
- _context2.next = 19;
52
+ });
53
+ case 12:
54
+ files = _context2.sent;
55
+ _context2.next = 19;
56
+ break;
57
+ case 15:
58
+ _context2.prev = 15;
59
+ _context2.t0 = _context2["catch"](9);
60
+ if (popupMountPoint) {
61
+ ReactDOM.unmountComponentAtNode(popupMountPoint);
62
+ }
63
+ return _context2.abrupt("return");
64
+ case 19:
65
+ if (files.length) {
66
+ _context2.next = 22;
58
67
  break;
59
- case 15:
60
- _context2.prev = 15;
61
- _context2.t0 = _context2["catch"](9);
62
- if (popupMountPoint) {
63
- ReactDOM.unmountComponentAtNode(popupMountPoint);
64
- }
65
- return _context2.abrupt("return");
66
- case 19:
67
- if (files.length) {
68
- _context2.next = 22;
69
- break;
70
- }
71
- if (popupMountPoint) {
72
- ReactDOM.unmountComponentAtNode(popupMountPoint);
73
- }
74
- return _context2.abrupt("return");
75
- case 22:
76
- newNodes = files.map(function (file) {
77
- return inlineCard({
78
- url: file.link
79
- });
68
+ }
69
+ if (popupMountPoint) {
70
+ ReactDOM.unmountComponentAtNode(popupMountPoint);
71
+ }
72
+ return _context2.abrupt("return");
73
+ case 22:
74
+ newNodes = files.map(function (file) {
75
+ return inlineCard({
76
+ url: file.link
80
77
  });
81
- if (newNodes.length === 1) {
82
- node = newNodes[0];
83
- } else {
84
- // NOTE: we are not currently passing in `multiselect`, so this is not a possible state,
85
- // but we likely want to allow multiselect in the future so doing some future-proofing
86
- node = {
87
- type: 'paragraph',
88
- content: newNodes
89
- };
90
- }
91
- if (popupMountPoint) {
92
- ReactDOM.unmountComponentAtNode(popupMountPoint);
93
- }
94
- return _context2.abrupt("return", node);
95
- case 26:
96
- case "end":
97
- return _context2.stop();
98
- }
78
+ });
79
+ if (newNodes.length === 1) {
80
+ node = newNodes[0];
81
+ } else {
82
+ // NOTE: we are not currently passing in `multiselect`, so this is not a possible state,
83
+ // but we likely want to allow multiselect in the future so doing some future-proofing
84
+ node = {
85
+ type: 'paragraph',
86
+ content: newNodes
87
+ };
88
+ }
89
+ if (popupMountPoint) {
90
+ ReactDOM.unmountComponentAtNode(popupMountPoint);
91
+ }
92
+ return _context2.abrupt("return", node);
93
+ case 26:
94
+ case "end":
95
+ return _context2.stop();
99
96
  }
100
97
  }, _callee2, null, [[9, 15]]);
101
98
  }));
@@ -131,32 +128,30 @@ var manifestFunction = function manifestFunction(_ref) {
131
128
  key: 'item',
132
129
  action: function action() {
133
130
  return new Promise( /*#__PURE__*/function () {
134
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
131
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(resolve, reject) {
135
132
  var newNode;
136
- return _regeneratorRuntime().wrap(function _callee$(_context) {
137
- while (1) {
138
- switch (_context.prev = _context.next) {
139
- case 0:
140
- _context.prev = 0;
141
- _context.next = 3;
142
- return pickFromDropbox(appKey, canMountinIframe);
143
- case 3:
144
- newNode = _context.sent;
145
- if (!newNode) {
146
- reject();
147
- } else {
148
- resolve(newNode);
149
- }
150
- _context.next = 10;
151
- break;
152
- case 7:
153
- _context.prev = 7;
154
- _context.t0 = _context["catch"](0);
155
- reject(_context.t0);
156
- case 10:
157
- case "end":
158
- return _context.stop();
159
- }
133
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
134
+ while (1) switch (_context.prev = _context.next) {
135
+ case 0:
136
+ _context.prev = 0;
137
+ _context.next = 3;
138
+ return pickFromDropbox(appKey, canMountinIframe);
139
+ case 3:
140
+ newNode = _context.sent;
141
+ if (!newNode) {
142
+ reject();
143
+ } else {
144
+ resolve(newNode);
145
+ }
146
+ _context.next = 10;
147
+ break;
148
+ case 7:
149
+ _context.prev = 7;
150
+ _context.t0 = _context["catch"](0);
151
+ reject(_context.t0);
152
+ case 10:
153
+ case "end":
154
+ return _context.stop();
160
155
  }
161
156
  }, _callee, null, [[0, 7]]);
162
157
  }));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-extension-dropbox",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-extension-dropbox",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "A an atlassian editor extension to add a native dropbox picker",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@atlaskit/adf-utils": "^18.1.0",
28
28
  "@atlaskit/button": "^16.6.0",
29
- "@atlaskit/editor-common": "^72.8.0",
29
+ "@atlaskit/editor-common": "^73.0.0",
30
30
  "@atlaskit/icon": "^21.11.0",
31
31
  "@atlaskit/modal-dialog": "^12.4.0",
32
32
  "@babel/runtime": "^7.0.0",