@atlaskit/emoji 71.9.1 → 71.9.2

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,13 @@
1
1
  # @atlaskit/emoji
2
2
 
3
+ ## 71.9.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7c2b0276e2e68`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7c2b0276e2e68) -
8
+ Render custom emojis with empty IDs using tokenized media URLs
9
+ - Updated dependencies
10
+
3
11
  ## 71.9.1
4
12
 
5
13
  ### Patch Changes
@@ -81,6 +81,9 @@ var ResourcedEmojiComponent = exports.ResourcedEmojiComponent = function Resourc
81
81
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_emojiProvider, emojiId) {
82
82
  var optimisticFetch,
83
83
  reason,
84
+ useUnicodeEmojis,
85
+ normalizedEmojiId,
86
+ shouldFetchOptimistically,
84
87
  foundEmoji,
85
88
  _args = arguments;
86
89
  return _regenerator.default.wrap(function (_context) {
@@ -98,10 +101,13 @@ var ResourcedEmojiComponent = exports.ResourcedEmojiComponent = function Resourc
98
101
  }
99
102
  });
100
103
  }
101
-
102
- // When id is absent/empty, fetchByEmojiId won't retry if the catalogue isn't loaded yet.
103
- // findByEmojiId has retryIfLoading built in — use it for shortName-only lookups.
104
- foundEmoji = !emojiId.id && (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_use_unicode_emojis', 'isEnabled', true) ? _emojiProvider.findByEmojiId(emojiId) : _emojiProvider.fetchByEmojiId(emojiId, optimisticFetch);
104
+ useUnicodeEmojis = (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_use_unicode_emojis', 'isEnabled', true);
105
+ normalizedEmojiId = useUnicodeEmojis ? _objectSpread(_objectSpread({}, emojiId), {}, {
106
+ id: emojiId.id || undefined
107
+ }) : emojiId; // A shortName-only optimistic request can resolve without an emoji before the catalogue loads.
108
+ // Use the non-optimistic path so it waits for the catalogue and tokenizes custom emoji media.
109
+ shouldFetchOptimistically = useUnicodeEmojis ? optimisticFetch && Boolean(emojiId.id) : optimisticFetch;
110
+ foundEmoji = _emojiProvider.fetchByEmojiId(normalizedEmojiId, shouldFetchOptimistically);
105
111
  (0, _analytics.sampledUfoRenderedEmoji)(emojiId).mark(_types.UfoEmojiTimings.METADATA_START);
106
112
  if ((0, _typeHelpers.isPromise)(foundEmoji)) {
107
113
  setLoaded(false);
@@ -20,7 +20,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
20
20
  actionSubjectId: actionSubjectId,
21
21
  attributes: _objectSpread({
22
22
  packageName: "@atlaskit/emoji",
23
- packageVersion: "71.9.0"
23
+ packageVersion: "71.9.1"
24
24
  }, attributes)
25
25
  };
26
26
  };
@@ -57,10 +57,15 @@ export const ResourcedEmojiComponent = ({
57
57
  }
58
58
  });
59
59
  }
60
-
61
- // When id is absent/empty, fetchByEmojiId won't retry if the catalogue isn't loaded yet.
62
- // findByEmojiId has retryIfLoading built in — use it for shortName-only lookups.
63
- const foundEmoji = !emojiId.id && expValEqualsNoExposure('platform_use_unicode_emojis', 'isEnabled', true) ? _emojiProvider.findByEmojiId(emojiId) : _emojiProvider.fetchByEmojiId(emojiId, optimisticFetch);
60
+ const useUnicodeEmojis = expValEqualsNoExposure('platform_use_unicode_emojis', 'isEnabled', true);
61
+ const normalizedEmojiId = useUnicodeEmojis ? {
62
+ ...emojiId,
63
+ id: emojiId.id || undefined
64
+ } : emojiId;
65
+ // A shortName-only optimistic request can resolve without an emoji before the catalogue loads.
66
+ // Use the non-optimistic path so it waits for the catalogue and tokenizes custom emoji media.
67
+ const shouldFetchOptimistically = useUnicodeEmojis ? optimisticFetch && Boolean(emojiId.id) : optimisticFetch;
68
+ const foundEmoji = _emojiProvider.fetchByEmojiId(normalizedEmojiId, shouldFetchOptimistically);
64
69
  sampledUfoRenderedEmoji(emojiId).mark(UfoEmojiTimings.METADATA_START);
65
70
  if (isPromise(foundEmoji)) {
66
71
  setLoaded(false);
@@ -9,7 +9,7 @@ const createEvent = (eventType, action, actionSubject, actionSubjectId, attribut
9
9
  actionSubjectId,
10
10
  attributes: {
11
11
  packageName: "@atlaskit/emoji",
12
- packageVersion: "71.9.0",
12
+ packageVersion: "71.9.1",
13
13
  ...attributes
14
14
  }
15
15
  });
@@ -4,9 +4,9 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
5
  import "./ResourcedEmojiComponent.compiled.css";
6
6
  import { ax, ix } from "@compiled/react/runtime";
7
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
7
8
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
8
9
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
- import _regeneratorRuntime from "@babel/runtime/regenerator";
10
10
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
11
11
  import { defaultEmojiHeight } from '../../util/constants';
12
12
  import { isImageRepresentation, isMediaRepresentation, isPromise } from '../../util/type-helpers';
@@ -72,6 +72,9 @@ export var ResourcedEmojiComponent = function ResourcedEmojiComponent(_ref) {
72
72
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_emojiProvider, emojiId) {
73
73
  var optimisticFetch,
74
74
  reason,
75
+ useUnicodeEmojis,
76
+ normalizedEmojiId,
77
+ shouldFetchOptimistically,
75
78
  foundEmoji,
76
79
  _args = arguments;
77
80
  return _regeneratorRuntime.wrap(function (_context) {
@@ -89,10 +92,13 @@ export var ResourcedEmojiComponent = function ResourcedEmojiComponent(_ref) {
89
92
  }
90
93
  });
91
94
  }
92
-
93
- // When id is absent/empty, fetchByEmojiId won't retry if the catalogue isn't loaded yet.
94
- // findByEmojiId has retryIfLoading built in — use it for shortName-only lookups.
95
- foundEmoji = !emojiId.id && expValEqualsNoExposure('platform_use_unicode_emojis', 'isEnabled', true) ? _emojiProvider.findByEmojiId(emojiId) : _emojiProvider.fetchByEmojiId(emojiId, optimisticFetch);
95
+ useUnicodeEmojis = expValEqualsNoExposure('platform_use_unicode_emojis', 'isEnabled', true);
96
+ normalizedEmojiId = useUnicodeEmojis ? _objectSpread(_objectSpread({}, emojiId), {}, {
97
+ id: emojiId.id || undefined
98
+ }) : emojiId; // A shortName-only optimistic request can resolve without an emoji before the catalogue loads.
99
+ // Use the non-optimistic path so it waits for the catalogue and tokenizes custom emoji media.
100
+ shouldFetchOptimistically = useUnicodeEmojis ? optimisticFetch && Boolean(emojiId.id) : optimisticFetch;
101
+ foundEmoji = _emojiProvider.fetchByEmojiId(normalizedEmojiId, shouldFetchOptimistically);
96
102
  sampledUfoRenderedEmoji(emojiId).mark(UfoEmojiTimings.METADATA_START);
97
103
  if (isPromise(foundEmoji)) {
98
104
  setLoaded(false);
@@ -14,7 +14,7 @@ var createEvent = function createEvent(eventType, action, actionSubject, actionS
14
14
  actionSubjectId: actionSubjectId,
15
15
  attributes: _objectSpread({
16
16
  packageName: "@atlaskit/emoji",
17
- packageVersion: "71.9.0"
17
+ packageVersion: "71.9.1"
18
18
  }, attributes)
19
19
  };
20
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/emoji",
3
- "version": "71.9.1",
3
+ "version": "71.9.2",
4
4
  "description": "Fabric emoji React components",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -50,7 +50,7 @@
50
50
  "@atlaskit/spinner": "^20.1.0",
51
51
  "@atlaskit/textfield": "^9.1.0",
52
52
  "@atlaskit/theme": "^26.1.0",
53
- "@atlaskit/tmp-editor-statsig": "^125.0.0",
53
+ "@atlaskit/tmp-editor-statsig": "^125.1.0",
54
54
  "@atlaskit/tokens": "^15.8.0",
55
55
  "@atlaskit/tooltip": "^23.1.0",
56
56
  "@atlaskit/ufo": "^1.0.0",