@atlaskit/emoji 67.3.2 → 67.4.0
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 +10 -0
- package/dist/cjs/api/EmojiResource.js +192 -203
- package/dist/cjs/api/media/SiteEmojiResource.js +27 -30
- package/dist/cjs/components/common/EmojiUploadPicker.js +23 -23
- package/dist/cjs/components/common/ResourcedEmoji.js +1 -1
- package/dist/cjs/components/common/ResourcedEmojiComponent.js +51 -53
- package/dist/cjs/components/common/Scrollable.js +2 -1
- package/dist/cjs/components/common/UfoErrorBoundary.js +1 -1
- package/dist/cjs/components/common/internal-types.js +4 -4
- package/dist/cjs/components/picker/EmojiPicker.js +3 -4
- package/dist/cjs/components/picker/EmojiPickerList.js +11 -13
- package/dist/cjs/components/typeahead/EmojiTypeAhead.js +3 -4
- package/dist/cjs/components/typeahead/EmojiTypeAheadComponent.js +1 -1
- package/dist/cjs/components/typeahead/EmojiTypeAheadItem.js +2 -1
- package/dist/cjs/components/typeahead/EmojiTypeAheadList.js +1 -2
- package/dist/cjs/components/uploader/EmojiUploadComponent.js +41 -42
- package/dist/cjs/components/uploader/EmojiUploader.js +3 -4
- package/dist/cjs/context/EmojiContextProvider.js +18 -20
- package/dist/cjs/hooks/useEmoji.js +20 -23
- package/dist/cjs/types.js +28 -28
- package/dist/cjs/util/analytics/samplingUfo.js +74 -83
- package/dist/cjs/util/constants.js +8 -8
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/common/ResourcedEmojiComponent.js +3 -3
- package/dist/es2019/components/common/Scrollable.js +2 -1
- package/dist/es2019/components/common/internal-types.js +3 -3
- package/dist/es2019/components/picker/EmojiPicker.js +2 -3
- package/dist/es2019/components/picker/EmojiPickerList.js +11 -14
- package/dist/es2019/components/typeahead/EmojiTypeAhead.js +2 -3
- package/dist/es2019/components/typeahead/EmojiTypeAheadItem.js +2 -1
- package/dist/es2019/components/typeahead/EmojiTypeAheadList.js +1 -3
- package/dist/es2019/components/uploader/EmojiUploader.js +2 -3
- package/dist/es2019/types.js +21 -21
- package/dist/es2019/util/constants.js +8 -8
- package/dist/es2019/version.json +1 -1
- package/dist/esm/api/EmojiResource.js +192 -203
- package/dist/esm/api/media/SiteEmojiResource.js +27 -30
- package/dist/esm/components/common/EmojiUploadPicker.js +21 -24
- package/dist/esm/components/common/ResourcedEmojiComponent.js +51 -54
- package/dist/esm/components/common/Scrollable.js +2 -1
- package/dist/esm/components/common/UfoErrorBoundary.js +1 -1
- package/dist/esm/components/common/internal-types.js +3 -3
- package/dist/esm/components/picker/EmojiPicker.js +2 -3
- package/dist/esm/components/picker/EmojiPickerList.js +11 -13
- package/dist/esm/components/typeahead/EmojiTypeAhead.js +2 -3
- package/dist/esm/components/typeahead/EmojiTypeAheadComponent.js +1 -1
- package/dist/esm/components/typeahead/EmojiTypeAheadItem.js +2 -1
- package/dist/esm/components/typeahead/EmojiTypeAheadList.js +1 -2
- package/dist/esm/components/uploader/EmojiUploadComponent.js +39 -42
- package/dist/esm/components/uploader/EmojiUploader.js +2 -3
- package/dist/esm/context/EmojiContextProvider.js +18 -21
- package/dist/esm/hooks/useEmoji.js +20 -23
- package/dist/esm/types.js +21 -21
- package/dist/esm/util/analytics/samplingUfo.js +74 -83
- package/dist/esm/util/constants.js +8 -8
- package/dist/esm/version.json +1 -1
- package/package.json +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/emoji
|
|
2
2
|
|
|
3
|
+
## 67.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 67.3.2
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.supportsUploadFeature = exports.default = exports.EmojiResource = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -27,7 +27,6 @@ var _SiteEmojiResource = _interopRequireDefault(require("./media/SiteEmojiResour
|
|
|
27
27
|
var _ufoExperiences = require("../util/analytics/ufoExperiences");
|
|
28
28
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
29
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
30
|
-
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; }
|
|
31
30
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
32
31
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
33
32
|
// Re-exporting to not cause a breaking change
|
|
@@ -90,37 +89,35 @@ var EmojiResource = /*#__PURE__*/function (_ref) {
|
|
|
90
89
|
(0, _createClass2.default)(EmojiResource, [{
|
|
91
90
|
key: "getEmojiProvider",
|
|
92
91
|
value: function () {
|
|
93
|
-
var _getEmojiProvider = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
92
|
+
var _getEmojiProvider = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
94
93
|
var options,
|
|
95
94
|
_args = arguments;
|
|
96
|
-
return
|
|
97
|
-
while (1) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
if (!options.fetchAtStart) {
|
|
104
|
-
_context.next = 11;
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
_context.prev = 2;
|
|
108
|
-
_context.next = 5;
|
|
109
|
-
return this.fetchEmojiProvider();
|
|
110
|
-
case 5:
|
|
95
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
96
|
+
while (1) switch (_context.prev = _context.next) {
|
|
97
|
+
case 0:
|
|
98
|
+
options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {
|
|
99
|
+
fetchAtStart: true
|
|
100
|
+
};
|
|
101
|
+
if (!options.fetchAtStart) {
|
|
111
102
|
_context.next = 11;
|
|
112
103
|
break;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
104
|
+
}
|
|
105
|
+
_context.prev = 2;
|
|
106
|
+
_context.next = 5;
|
|
107
|
+
return this.fetchEmojiProvider();
|
|
108
|
+
case 5:
|
|
109
|
+
_context.next = 11;
|
|
110
|
+
break;
|
|
111
|
+
case 7:
|
|
112
|
+
_context.prev = 7;
|
|
113
|
+
_context.t0 = _context["catch"](2);
|
|
114
|
+
(0, _logger.default)(_context.t0);
|
|
115
|
+
return _context.abrupt("return", Promise.resolve(this));
|
|
116
|
+
case 11:
|
|
117
|
+
return _context.abrupt("return", Promise.resolve(this));
|
|
118
|
+
case 12:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context.stop();
|
|
124
121
|
}
|
|
125
122
|
}, _callee, this, [[2, 7]]);
|
|
126
123
|
}));
|
|
@@ -132,55 +129,53 @@ var EmojiResource = /*#__PURE__*/function (_ref) {
|
|
|
132
129
|
}, {
|
|
133
130
|
key: "fetchIndividualProvider",
|
|
134
131
|
value: function () {
|
|
135
|
-
var _fetchIndividualProvider = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
132
|
+
var _fetchIndividualProvider = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(provider, index) {
|
|
136
133
|
var providerType, loader, emojiResponse;
|
|
137
|
-
return
|
|
138
|
-
while (1) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return _context2.stop();
|
|
183
|
-
}
|
|
134
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
135
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
136
|
+
case 0:
|
|
137
|
+
providerType = this.getProviderType(provider);
|
|
138
|
+
_context2.prev = 1;
|
|
139
|
+
(0, _ufoExperiences.sampledUfoEmojiResourceFetched)(providerType).start({
|
|
140
|
+
samplingRate: _constants.SAMPLING_RATE_EMOJI_RESOURCE_FETCHED_EXP
|
|
141
|
+
});
|
|
142
|
+
(0, _ufoExperiences.sampledUfoEmojiResourceFetched)(providerType).addMetadata({
|
|
143
|
+
type: providerType
|
|
144
|
+
});
|
|
145
|
+
loader = new _EmojiLoader.default(provider); // fetch emoji from provider url and denormalise
|
|
146
|
+
_context2.next = 7;
|
|
147
|
+
return loader.loadEmoji();
|
|
148
|
+
case 7:
|
|
149
|
+
emojiResponse = _context2.sent;
|
|
150
|
+
(0, _ufoExperiences.sampledUfoEmojiResourceFetched)(providerType).success();
|
|
151
|
+
// setup emoji repository
|
|
152
|
+
this.emojiResponses[index] = emojiResponse;
|
|
153
|
+
this.initEmojiRepository(this.emojiResponses);
|
|
154
|
+
_context2.next = 13;
|
|
155
|
+
return this.initSiteEmojiResource(emojiResponse, provider);
|
|
156
|
+
case 13:
|
|
157
|
+
this.activeLoaders--;
|
|
158
|
+
this.performRetries();
|
|
159
|
+
this.refreshLastFilter();
|
|
160
|
+
_context2.next = 25;
|
|
161
|
+
break;
|
|
162
|
+
case 18:
|
|
163
|
+
_context2.prev = 18;
|
|
164
|
+
_context2.t0 = _context2["catch"](1);
|
|
165
|
+
this.activeLoaders--;
|
|
166
|
+
this.notifyError(_context2.t0);
|
|
167
|
+
(0, _ufoExperiences.sampledUfoEmojiResourceFetched)(providerType).failure({
|
|
168
|
+
metadata: {
|
|
169
|
+
reason: _context2.t0,
|
|
170
|
+
source: 'EmojiProvider',
|
|
171
|
+
providerUrl: provider.url
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
(0, _logger.default)("failed to fetch emoji provider for ".concat(provider.url), _context2.t0);
|
|
175
|
+
throw new Error("failed to fetch emoji from ".concat(provider.url));
|
|
176
|
+
case 25:
|
|
177
|
+
case "end":
|
|
178
|
+
return _context2.stop();
|
|
184
179
|
}
|
|
185
180
|
}, _callee2, this, [[1, 18]]);
|
|
186
181
|
}));
|
|
@@ -192,32 +187,30 @@ var EmojiResource = /*#__PURE__*/function (_ref) {
|
|
|
192
187
|
}, {
|
|
193
188
|
key: "fetchEmojiProvider",
|
|
194
189
|
value: function () {
|
|
195
|
-
var _fetchEmojiProvider = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
190
|
+
var _fetchEmojiProvider = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
196
191
|
var _this2 = this;
|
|
197
192
|
var force,
|
|
198
193
|
_args3 = arguments;
|
|
199
|
-
return
|
|
200
|
-
while (1) {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (!(force || !this.isRepositoryAvailable(this.emojiRepository) && !this.isInitialised)) {
|
|
205
|
-
_context3.next = 6;
|
|
206
|
-
break;
|
|
207
|
-
}
|
|
208
|
-
this.isInitialised = true;
|
|
209
|
-
this.emojiResponses = [];
|
|
210
|
-
// fetch emoji providers
|
|
194
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
195
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
196
|
+
case 0:
|
|
197
|
+
force = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : false;
|
|
198
|
+
if (!(force || !this.isRepositoryAvailable(this.emojiRepository) && !this.isInitialised)) {
|
|
211
199
|
_context3.next = 6;
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
return
|
|
220
|
-
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
this.isInitialised = true;
|
|
203
|
+
this.emojiResponses = [];
|
|
204
|
+
// fetch emoji providers
|
|
205
|
+
_context3.next = 6;
|
|
206
|
+
return Promise.all(this.emojiProviderConfig.providers.map(function (provider, index) {
|
|
207
|
+
return _this2.fetchIndividualProvider(provider, index);
|
|
208
|
+
}));
|
|
209
|
+
case 6:
|
|
210
|
+
return _context3.abrupt("return", Promise.resolve(this.emojiRepository));
|
|
211
|
+
case 7:
|
|
212
|
+
case "end":
|
|
213
|
+
return _context3.stop();
|
|
221
214
|
}
|
|
222
215
|
}, _callee3, this);
|
|
223
216
|
}));
|
|
@@ -229,88 +222,86 @@ var EmojiResource = /*#__PURE__*/function (_ref) {
|
|
|
229
222
|
}, {
|
|
230
223
|
key: "fetchByEmojiId",
|
|
231
224
|
value: function () {
|
|
232
|
-
var _fetchByEmojiId = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
225
|
+
var _fetchByEmojiId = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(emojiId, optimistic) {
|
|
233
226
|
var _emoji, provider, loader, loadEmoji, _emoji2, emoji;
|
|
234
|
-
return
|
|
235
|
-
while (1) {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
if (this.isRepositoryAvailable(this.siteEmojiResource)) {
|
|
277
|
-
_context4.next = 20;
|
|
278
|
-
break;
|
|
279
|
-
}
|
|
227
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
228
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
229
|
+
case 0:
|
|
230
|
+
if (!(this.isLoaded() && this.isRepositoryAvailable(this.emojiRepository))) {
|
|
231
|
+
_context4.next = 8;
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
_context4.next = 3;
|
|
235
|
+
return this.findByEmojiId(emojiId);
|
|
236
|
+
case 3:
|
|
237
|
+
_emoji = _context4.sent;
|
|
238
|
+
if (!_emoji) {
|
|
239
|
+
_context4.next = 8;
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
_context4.next = 7;
|
|
243
|
+
return this.getMediaEmojiDescriptionURLWithInlineToken(_emoji);
|
|
244
|
+
case 7:
|
|
245
|
+
return _context4.abrupt("return", _context4.sent);
|
|
246
|
+
case 8:
|
|
247
|
+
if (!(this.emojiProviderConfig.singleEmojiApi && optimistic)) {
|
|
248
|
+
_context4.next = 31;
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
// if config has singleEmojiApi then fetch single emoji
|
|
252
|
+
provider = {
|
|
253
|
+
url: this.emojiProviderConfig.singleEmojiApi.getUrl(emojiId),
|
|
254
|
+
securityProvider: this.emojiProviderConfig.singleEmojiApi.securityProvider
|
|
255
|
+
};
|
|
256
|
+
loader = new _EmojiLoader.default(provider);
|
|
257
|
+
_context4.prev = 11;
|
|
258
|
+
_context4.next = 14;
|
|
259
|
+
return loader.loadEmoji();
|
|
260
|
+
case 14:
|
|
261
|
+
loadEmoji = _context4.sent;
|
|
262
|
+
if (loadEmoji.emojis[0]) {
|
|
263
|
+
_context4.next = 17;
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
266
|
+
return _context4.abrupt("return");
|
|
267
|
+
case 17:
|
|
268
|
+
if (this.isRepositoryAvailable(this.siteEmojiResource)) {
|
|
280
269
|
_context4.next = 20;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
_context4.next = 20;
|
|
273
|
+
return this.initSiteEmojiResource(loadEmoji, provider);
|
|
274
|
+
case 20:
|
|
275
|
+
return _context4.abrupt("return", this.getMediaEmojiDescriptionURLWithInlineToken(loadEmoji.emojis[0]));
|
|
276
|
+
case 23:
|
|
277
|
+
_context4.prev = 23;
|
|
278
|
+
_context4.t0 = _context4["catch"](11);
|
|
279
|
+
_context4.next = 27;
|
|
280
|
+
return this.findByEmojiId(emojiId);
|
|
281
|
+
case 27:
|
|
282
|
+
_emoji2 = _context4.sent;
|
|
283
|
+
if (_emoji2) {
|
|
284
|
+
_context4.next = 30;
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
return _context4.abrupt("return");
|
|
288
|
+
case 30:
|
|
289
|
+
return _context4.abrupt("return", this.getMediaEmojiDescriptionURLWithInlineToken(_emoji2));
|
|
290
|
+
case 31:
|
|
291
|
+
_context4.next = 33;
|
|
292
|
+
return this.findByEmojiId(emojiId);
|
|
293
|
+
case 33:
|
|
294
|
+
emoji = _context4.sent;
|
|
295
|
+
if (emoji) {
|
|
296
|
+
_context4.next = 36;
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
return _context4.abrupt("return");
|
|
300
|
+
case 36:
|
|
301
|
+
return _context4.abrupt("return", this.getMediaEmojiDescriptionURLWithInlineToken(emoji));
|
|
302
|
+
case 37:
|
|
303
|
+
case "end":
|
|
304
|
+
return _context4.stop();
|
|
314
305
|
}
|
|
315
306
|
}, _callee4, this, [[11, 23]]);
|
|
316
307
|
}));
|
|
@@ -435,31 +426,29 @@ var EmojiResource = /*#__PURE__*/function (_ref) {
|
|
|
435
426
|
}, {
|
|
436
427
|
key: "getMediaEmojiDescriptionURLWithInlineToken",
|
|
437
428
|
value: function () {
|
|
438
|
-
var _getMediaEmojiDescriptionURLWithInlineToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
429
|
+
var _getMediaEmojiDescriptionURLWithInlineToken = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(emoji) {
|
|
439
430
|
var tokenisedMediaPath;
|
|
440
|
-
return
|
|
441
|
-
while (1) {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
return _context5.stop();
|
|
462
|
-
}
|
|
431
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
432
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
433
|
+
case 0:
|
|
434
|
+
if (!(this.isRepositoryAvailable(this.siteEmojiResource) && (0, _typeHelpers.isMediaRepresentation)(emoji.representation))) {
|
|
435
|
+
_context5.next = 5;
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
_context5.next = 3;
|
|
439
|
+
return this.siteEmojiResource.generateTokenisedMediaURL(emoji);
|
|
440
|
+
case 3:
|
|
441
|
+
tokenisedMediaPath = _context5.sent;
|
|
442
|
+
return _context5.abrupt("return", _objectSpread(_objectSpread({}, emoji), {}, {
|
|
443
|
+
representation: _objectSpread(_objectSpread({}, emoji.representation), {}, {
|
|
444
|
+
mediaPath: tokenisedMediaPath
|
|
445
|
+
})
|
|
446
|
+
}));
|
|
447
|
+
case 5:
|
|
448
|
+
return _context5.abrupt("return", emoji);
|
|
449
|
+
case 6:
|
|
450
|
+
case "end":
|
|
451
|
+
return _context5.stop();
|
|
463
452
|
}
|
|
464
453
|
}, _callee5, this);
|
|
465
454
|
}));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.mediaProportionOfProgress = exports.default = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -19,7 +19,6 @@ var _EmojiUtils = require("../EmojiUtils");
|
|
|
19
19
|
var _TokenManager = _interopRequireDefault(require("./TokenManager"));
|
|
20
20
|
var _logger = _interopRequireDefault(require("../../util/logger"));
|
|
21
21
|
var _excluded = ["altRepresentations"];
|
|
22
|
-
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; }
|
|
23
22
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
24
23
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
24
|
// Assume media is 95% of total upload time.
|
|
@@ -80,35 +79,33 @@ var SiteEmojiResource = /*#__PURE__*/function () {
|
|
|
80
79
|
(0, _createClass2.default)(SiteEmojiResource, [{
|
|
81
80
|
key: "generateTokenisedMediaURL",
|
|
82
81
|
value: function () {
|
|
83
|
-
var _generateTokenisedMediaURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/
|
|
82
|
+
var _generateTokenisedMediaURL = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(emoji) {
|
|
84
83
|
var currentMediaPathURL, currentMediaPathPARAMS, readToken;
|
|
85
|
-
return
|
|
86
|
-
while (1) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
return _context.stop();
|
|
111
|
-
}
|
|
84
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
85
|
+
while (1) switch (_context.prev = _context.next) {
|
|
86
|
+
case 0:
|
|
87
|
+
if (!(emoji && (0, _typeHelpers.isMediaRepresentation)(emoji.representation))) {
|
|
88
|
+
_context.next = 9;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
currentMediaPathURL = new URL(emoji.representation.mediaPath);
|
|
92
|
+
currentMediaPathPARAMS = currentMediaPathURL.searchParams;
|
|
93
|
+
_context.next = 5;
|
|
94
|
+
return this.tokenManager.getToken('read');
|
|
95
|
+
case 5:
|
|
96
|
+
readToken = _context.sent;
|
|
97
|
+
if (currentMediaPathPARAMS.get('token') !== readToken.jwt) {
|
|
98
|
+
currentMediaPathPARAMS.set('token', readToken.jwt);
|
|
99
|
+
}
|
|
100
|
+
if (currentMediaPathPARAMS.get('client') !== readToken.clientId) {
|
|
101
|
+
currentMediaPathPARAMS.set('client', readToken.clientId);
|
|
102
|
+
}
|
|
103
|
+
return _context.abrupt("return", currentMediaPathURL.toString());
|
|
104
|
+
case 9:
|
|
105
|
+
throw Error('Emoji resource is not of type Media Representation');
|
|
106
|
+
case 10:
|
|
107
|
+
case "end":
|
|
108
|
+
return _context.stop();
|
|
112
109
|
}
|
|
113
110
|
}, _callee, this);
|
|
114
111
|
}));
|