@atlaskit/emoji 71.17.0 → 72.0.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.
Files changed (725) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/cjs/api/EmojiLoader.js +4 -3
  3. package/dist/cjs/api/EmojiRepository.js +25 -24
  4. package/dist/cjs/api/EmojiResource.js +31 -30
  5. package/dist/cjs/api/EmojiUtils.js +72 -167
  6. package/dist/cjs/api/calculateScale.js +34 -0
  7. package/dist/cjs/api/denormaliseEmojiServiceResponse.js +43 -0
  8. package/dist/cjs/api/denormaliseServiceAltRepresentation.js +11 -0
  9. package/dist/cjs/api/denormaliseServiceRepresentation.js +50 -0
  10. package/dist/cjs/api/denormaliseSkinEmoji.js +31 -0
  11. package/dist/cjs/api/denormaliseStandardRepresentation.js +17 -0
  12. package/dist/cjs/api/emojiRequest.js +32 -0
  13. package/dist/cjs/api/getAltRepresentation.js +12 -0
  14. package/dist/cjs/api/getEmojiVariation.js +19 -0
  15. package/dist/cjs/api/getPixelRatio.js +12 -0
  16. package/dist/cjs/api/internal/AlphabeticalShortnameComparator.js +25 -0
  17. package/dist/cjs/api/internal/AsciiMatchComparator.js +32 -0
  18. package/dist/cjs/api/internal/ChainedEmojiComparator.js +37 -0
  19. package/dist/cjs/api/internal/Comparators.js +1 -275
  20. package/dist/cjs/api/internal/EmojiTypeComparator.js +40 -0
  21. package/dist/cjs/api/internal/ExactShortNameMatchComparator.js +34 -0
  22. package/dist/cjs/api/internal/Gateway.js +52 -0
  23. package/dist/cjs/api/internal/OrderComparator.js +28 -0
  24. package/dist/cjs/api/internal/QueryStringPositionMatchComparator.js +43 -0
  25. package/dist/cjs/api/internal/UsageFrequencyComparator.js +59 -0
  26. package/dist/cjs/api/internal/UsageFrequencyTracker.js +7 -49
  27. package/dist/cjs/api/internal/createSearchEmojiComparator.js +46 -0
  28. package/dist/cjs/api/internal/createUsageOnlyEmojiComparator.js +15 -0
  29. package/dist/cjs/api/isMediaApiUrl.js +9 -0
  30. package/dist/cjs/api/media/BrowserCacheStrategy.js +87 -0
  31. package/dist/cjs/api/media/MediaEmojiCache.js +24 -148
  32. package/dist/cjs/api/media/MemoryCacheStrategy.js +67 -0
  33. package/dist/cjs/api/media/SiteEmojiResource.js +21 -15
  34. package/dist/cjs/api/media/getRequiredRepresentation.js +9 -0
  35. package/dist/cjs/api/shouldUseAltRepresentation.js +13 -0
  36. package/dist/cjs/api/supportsUploadFeature.js +17 -0
  37. package/dist/cjs/components/common/AddOwnEmoji.compiled.css +6 -0
  38. package/dist/cjs/components/common/AddOwnEmoji.js +62 -0
  39. package/dist/cjs/components/common/CachingEmoji.js +15 -93
  40. package/dist/cjs/components/common/CachingMediaEmoji.js +95 -0
  41. package/dist/cjs/components/common/CreateEmojiWithRovo.js +6 -4
  42. package/dist/cjs/components/common/DeletableEmojiTooltipContent.js +2 -14
  43. package/dist/cjs/components/common/DeletableEmojiTooltipContentForScreenReader.js +22 -0
  44. package/dist/cjs/components/common/Emoji.js +32 -374
  45. package/dist/cjs/components/common/EmojiActions.compiled.css +0 -6
  46. package/dist/cjs/components/common/EmojiActions.js +15 -69
  47. package/dist/cjs/components/common/EmojiPlaceholder.js +14 -6
  48. package/dist/cjs/components/common/ImageEmoji.js +198 -0
  49. package/dist/cjs/components/common/RecordSelectionDefault.js +10 -8
  50. package/dist/cjs/components/common/ResourcedEmoji.js +7 -6
  51. package/dist/cjs/components/common/ResourcedEmojiComponent.js +21 -19
  52. package/dist/cjs/components/common/SpriteEmoji.js +66 -0
  53. package/dist/cjs/components/common/ToneSelector.js +8 -134
  54. package/dist/cjs/components/common/ToneSelectorInternal.js +142 -0
  55. package/dist/cjs/components/common/ToolTipContentWithKeymap.js +2 -2
  56. package/dist/cjs/components/common/UnicodeEmoji.js +137 -0
  57. package/dist/cjs/components/common/UploadEmoji.js +9 -8
  58. package/dist/cjs/components/common/emojiPlaceholderTestId.js +14 -0
  59. package/dist/cjs/components/common/handleDelete.js +19 -0
  60. package/dist/cjs/components/common/isRefreshEmojiPickerEnabled.js +22 -0
  61. package/dist/cjs/components/picker/AbstractItem.js +14 -0
  62. package/dist/cjs/components/picker/CategoryHeadingItem.js +36 -0
  63. package/dist/cjs/components/picker/CategorySelector.js +10 -16
  64. package/dist/cjs/components/picker/EmojiPicker.js +48 -110
  65. package/dist/cjs/components/picker/EmojiPickerCategoryHeading.js +3 -3
  66. package/dist/cjs/components/picker/EmojiPickerComponent.js +58 -42
  67. package/dist/cjs/components/picker/EmojiPickerInternal.js +99 -0
  68. package/dist/cjs/components/picker/EmojiPickerList.js +35 -30
  69. package/dist/cjs/components/picker/EmojiPickerVirtualItems.js +1 -95
  70. package/dist/cjs/components/picker/EmojisRowItem.js +39 -0
  71. package/dist/cjs/components/picker/LoadingItem.js +42 -0
  72. package/dist/cjs/components/picker/NoResultsItem.js +36 -0
  73. package/dist/cjs/components/picker/categorySelectorCategoryTestId.js +14 -0
  74. package/dist/cjs/components/picker/{utils.js → emojiPickerHeightOffset.js} +1 -7
  75. package/dist/cjs/components/picker/emojiPickerLoader.js +17 -0
  76. package/dist/cjs/components/picker/emojiPickerModuleLoader.js +19 -0
  77. package/dist/cjs/components/picker/preloadEmojiPicker.js +18 -0
  78. package/dist/cjs/components/picker/scrollToRow.js +11 -0
  79. package/dist/cjs/components/picker/sortCategories.js +15 -0
  80. package/dist/cjs/components/picker/sortCategoriesNew.js +15 -0
  81. package/dist/cjs/components/picker/virtualItemRenderer.js +19 -0
  82. package/dist/cjs/components/typeahead/EmojiTypeAheadComponent.js +11 -8
  83. package/dist/cjs/components/typeahead/EmojiTypeAheadItem.js +17 -53
  84. package/dist/cjs/components/typeahead/EmojiTypeAheadItemInternal.js +58 -0
  85. package/dist/cjs/components/typeahead/EmojiTypeAheadList.js +7 -6
  86. package/dist/cjs/components/uploader/EmojiUploadComponent.js +11 -8
  87. package/dist/cjs/components/uploader/EmojiUploader.js +16 -63
  88. package/dist/cjs/components/uploader/EmojiUploaderInternal.js +66 -0
  89. package/dist/cjs/index.js +21 -18
  90. package/dist/cjs/util/actual-mouse-move.js +14 -0
  91. package/dist/cjs/util/analytics/Attributes.js +1 -0
  92. package/dist/cjs/util/analytics/CommonAttributes.js +1 -0
  93. package/dist/cjs/util/analytics/Duration.js +1 -0
  94. package/dist/cjs/util/analytics/aiGenerationCompletedEvent.js +12 -0
  95. package/dist/cjs/util/analytics/aiGenerationFailedEvent.js +12 -0
  96. package/dist/cjs/util/analytics/aiGenerationStartedEvent.js +15 -0
  97. package/dist/cjs/util/analytics/analytics.js +422 -228
  98. package/dist/cjs/util/analytics/categoryClickedEvent.js +12 -0
  99. package/dist/cjs/util/analytics/clearSampled.js +24 -0
  100. package/dist/cjs/util/analytics/closedPickerEvent.js +12 -0
  101. package/dist/cjs/util/analytics/createEvent.js +25 -0
  102. package/dist/cjs/util/analytics/deleteBeginEvent.js +12 -0
  103. package/dist/cjs/util/analytics/deleteCancelEvent.js +12 -0
  104. package/dist/cjs/util/analytics/deleteConfirmEvent.js +12 -0
  105. package/dist/cjs/util/analytics/emojiPickerEvent.js +12 -0
  106. package/dist/cjs/util/analytics/emojiUploaderEvent.js +10 -0
  107. package/dist/cjs/util/analytics/extractCommonAttributes.js +15 -0
  108. package/dist/cjs/util/analytics/extractErrorInfo.js +20 -0
  109. package/dist/cjs/util/analytics/getSkinTone.js +35 -0
  110. package/dist/cjs/util/analytics/hasUfoMarked.js +11 -0
  111. package/dist/cjs/util/analytics/isExperienceSampled.js +23 -0
  112. package/dist/cjs/util/analytics/openedPickerEvent.js +12 -0
  113. package/dist/cjs/util/analytics/pickerClickedEvent.js +15 -0
  114. package/dist/cjs/util/analytics/pickerSearchedEvent.js +12 -0
  115. package/dist/cjs/util/analytics/recordFailed.js +12 -0
  116. package/dist/cjs/util/analytics/recordFailedEmoji.js +19 -0
  117. package/dist/cjs/util/analytics/recordSelectionFailedSli.js +20 -0
  118. package/dist/cjs/util/analytics/recordSelectionSucceededSli.js +19 -0
  119. package/dist/cjs/util/analytics/recordSucceeded.js +12 -0
  120. package/dist/cjs/util/analytics/recordSucceededEmoji.js +19 -0
  121. package/dist/cjs/util/analytics/sampledUfoEmojiResourceFetched.js +11 -0
  122. package/dist/cjs/util/analytics/sampledUfoRenderedEmoji.js +11 -0
  123. package/dist/cjs/util/analytics/samplingUfo.js +30 -204
  124. package/dist/cjs/util/analytics/selectedFileEvent.js +12 -0
  125. package/dist/cjs/util/analytics/skinTones.js +22 -0
  126. package/dist/cjs/util/analytics/skintoneSelectorEvent.js +11 -0
  127. package/dist/cjs/util/analytics/toneSelectedEvent.js +12 -0
  128. package/dist/cjs/util/analytics/toneSelectorClosedEvent.js +12 -0
  129. package/dist/cjs/util/analytics/toneSelectorOpenedEvent.js +12 -0
  130. package/dist/cjs/util/analytics/typeaheadCancelledEvent.js +17 -0
  131. package/dist/cjs/util/analytics/typeaheadRenderedEvent.js +17 -0
  132. package/dist/cjs/util/analytics/typeaheadSelectedEvent.js +31 -0
  133. package/dist/cjs/util/analytics/ufoExperiences.js +37 -14
  134. package/dist/cjs/util/analytics/uploadBeginButton.js +12 -0
  135. package/dist/cjs/util/analytics/uploadCancelButton.js +12 -0
  136. package/dist/cjs/util/analytics/uploadConfirmButton.js +12 -0
  137. package/dist/cjs/util/analytics/uploadFailedEvent.js +12 -0
  138. package/dist/cjs/util/analytics/uploadSucceededEvent.js +12 -0
  139. package/dist/cjs/util/analytics/useSampledUFOComponentExperience.js +3 -3
  140. package/dist/cjs/util/analytics/withSampling.js +182 -0
  141. package/dist/cjs/util/build-emoji-description-with-alt-representation.js +19 -0
  142. package/dist/cjs/util/contains-emoji-id.js +18 -0
  143. package/dist/cjs/util/convert-image-to-media-representation.js +13 -0
  144. package/dist/cjs/util/convert-media-to-image-emoji.js +28 -0
  145. package/dist/cjs/util/convert-media-to-image-representation.js +13 -0
  146. package/dist/cjs/util/filter-hidden-emojis.js +12 -0
  147. package/dist/cjs/util/filters.js +2 -5
  148. package/dist/cjs/util/format-shortcut.js +30 -0
  149. package/dist/cjs/util/get-category-id.js +9 -0
  150. package/dist/cjs/util/get-tone-emoji.js +10 -0
  151. package/dist/cjs/util/has-data-url-image.js +11 -0
  152. package/dist/cjs/util/is-emoji-description-with-variations.js +9 -0
  153. package/dist/cjs/util/is-emoji-description.js +9 -0
  154. package/dist/cjs/util/is-emoji-id-equal.js +9 -0
  155. package/dist/cjs/util/is-emoji-variation-description.js +9 -0
  156. package/dist/cjs/util/{hidden-emojis.js → is-hidden-emoji.js} +1 -6
  157. package/dist/cjs/util/is-image-representation.js +9 -0
  158. package/dist/cjs/util/is-loaded-media-emoji.js +11 -0
  159. package/dist/cjs/util/is-media-emoji.js +10 -0
  160. package/dist/cjs/util/is-media-representation.js +9 -0
  161. package/dist/cjs/util/is-messages-key.js +10 -0
  162. package/dist/cjs/util/is-promise.js +9 -0
  163. package/dist/cjs/util/is-sprite-representation.js +9 -0
  164. package/dist/cjs/util/is-sprite-service-representation.js +9 -0
  165. package/dist/cjs/util/is-unicode-representation.js +9 -0
  166. package/dist/cjs/util/keymaps.js +3 -37
  167. package/dist/cjs/util/left-click.js +9 -0
  168. package/dist/cjs/util/make-key-map-with-common.js +16 -0
  169. package/dist/cjs/util/make-keymap.js +18 -0
  170. package/dist/cjs/util/mouse-location.js +12 -0
  171. package/dist/cjs/util/mouse.js +1 -26
  172. package/dist/cjs/util/to-emoji-id.js +13 -0
  173. package/dist/cjs/util/to-optional-emoji-id.js +13 -0
  174. package/dist/cjs/util/type-helpers.js +154 -115
  175. package/dist/cjs/utils.js +6 -5
  176. package/dist/es2019/admin.js +4 -0
  177. package/dist/es2019/api/EmojiLoader.js +2 -1
  178. package/dist/es2019/api/EmojiRepository.js +14 -18
  179. package/dist/es2019/api/EmojiResource.js +15 -17
  180. package/dist/es2019/api/EmojiUtils.js +43 -166
  181. package/dist/es2019/api/calculateScale.js +28 -0
  182. package/dist/es2019/api/denormaliseEmojiServiceResponse.js +35 -0
  183. package/dist/es2019/api/denormaliseServiceAltRepresentation.js +5 -0
  184. package/dist/es2019/api/denormaliseServiceRepresentation.js +46 -0
  185. package/dist/es2019/api/denormaliseSkinEmoji.js +22 -0
  186. package/dist/es2019/api/denormaliseStandardRepresentation.js +11 -0
  187. package/dist/es2019/api/emojiRequest.js +23 -0
  188. package/dist/es2019/api/getAltRepresentation.js +6 -0
  189. package/dist/es2019/api/getEmojiVariation.js +13 -0
  190. package/dist/es2019/api/getPixelRatio.js +6 -0
  191. package/dist/es2019/api/internal/AlphabeticalShortnameComparator.js +9 -0
  192. package/dist/es2019/api/internal/AsciiMatchComparator.js +19 -0
  193. package/dist/es2019/api/internal/ChainedEmojiComparator.js +21 -0
  194. package/dist/es2019/api/internal/Comparators.js +1 -222
  195. package/dist/es2019/api/internal/EmojiTypeComparator.js +25 -0
  196. package/dist/es2019/api/internal/ExactShortNameMatchComparator.js +22 -0
  197. package/dist/es2019/api/internal/Gateway.js +36 -0
  198. package/dist/es2019/api/internal/OrderComparator.js +12 -0
  199. package/dist/es2019/api/internal/QueryStringPositionMatchComparator.js +28 -0
  200. package/dist/es2019/api/internal/UsageFrequencyComparator.js +41 -0
  201. package/dist/es2019/api/internal/UsageFrequencyTracker.js +4 -39
  202. package/dist/es2019/api/internal/createSearchEmojiComparator.js +39 -0
  203. package/dist/es2019/api/internal/createUsageOnlyEmojiComparator.js +9 -0
  204. package/dist/es2019/api/isMediaApiUrl.js +1 -0
  205. package/dist/es2019/api/media/BrowserCacheStrategy.js +66 -0
  206. package/dist/es2019/api/media/MediaEmojiCache.js +8 -114
  207. package/dist/es2019/api/media/MemoryCacheStrategy.js +54 -0
  208. package/dist/es2019/api/media/SiteEmojiResource.js +10 -4
  209. package/dist/es2019/api/media/getRequiredRepresentation.js +1 -0
  210. package/dist/es2019/api/shouldUseAltRepresentation.js +3 -0
  211. package/dist/es2019/api/supportsUploadFeature.js +11 -0
  212. package/dist/es2019/components/common/AddOwnEmoji.compiled.css +6 -0
  213. package/dist/es2019/components/common/AddOwnEmoji.js +53 -0
  214. package/dist/es2019/components/common/CachingEmoji.js +7 -84
  215. package/dist/es2019/components/common/CachingMediaEmoji.js +84 -0
  216. package/dist/es2019/components/common/CreateEmojiWithRovo.js +3 -1
  217. package/dist/es2019/components/common/DeletableEmojiTooltipContent.js +2 -15
  218. package/dist/es2019/components/common/DeletableEmojiTooltipContentForScreenReader.js +16 -0
  219. package/dist/es2019/components/common/Emoji.js +16 -353
  220. package/dist/es2019/components/common/EmojiActions.compiled.css +0 -6
  221. package/dist/es2019/components/common/EmojiActions.js +9 -63
  222. package/dist/es2019/components/common/EmojiPlaceholder.js +8 -2
  223. package/dist/es2019/components/common/ImageEmoji.js +181 -0
  224. package/dist/es2019/components/common/RecordSelectionDefault.js +4 -2
  225. package/dist/es2019/components/common/ResourcedEmoji.js +3 -2
  226. package/dist/es2019/components/common/ResourcedEmojiComponent.js +10 -8
  227. package/dist/es2019/components/common/SpriteEmoji.js +58 -0
  228. package/dist/es2019/components/common/ToneSelector.js +8 -127
  229. package/dist/es2019/components/common/ToneSelectorInternal.js +129 -0
  230. package/dist/es2019/components/common/ToolTipContentWithKeymap.js +1 -1
  231. package/dist/es2019/components/common/UnicodeEmoji.js +125 -0
  232. package/dist/es2019/components/common/UploadEmoji.js +5 -4
  233. package/dist/es2019/components/common/emojiPlaceholderTestId.js +6 -0
  234. package/dist/es2019/components/common/handleDelete.js +15 -0
  235. package/dist/es2019/components/common/isRefreshEmojiPickerEnabled.js +15 -0
  236. package/dist/es2019/components/picker/AbstractItem.js +6 -0
  237. package/dist/es2019/components/picker/CategoryHeadingItem.js +13 -0
  238. package/dist/es2019/components/picker/CategorySelector.js +6 -6
  239. package/dist/es2019/components/picker/EmojiPicker.js +25 -78
  240. package/dist/es2019/components/picker/EmojiPickerCategoryHeading.js +2 -2
  241. package/dist/es2019/components/picker/EmojiPickerComponent.js +33 -17
  242. package/dist/es2019/components/picker/EmojiPickerInternal.js +71 -0
  243. package/dist/es2019/components/picker/EmojiPickerList.js +13 -8
  244. package/dist/es2019/components/picker/EmojiPickerVirtualItems.js +1 -58
  245. package/dist/es2019/components/picker/EmojisRowItem.js +16 -0
  246. package/dist/es2019/components/picker/LoadingItem.js +19 -0
  247. package/dist/es2019/components/picker/NoResultsItem.js +13 -0
  248. package/dist/es2019/components/picker/categorySelectorCategoryTestId.js +6 -0
  249. package/dist/es2019/components/picker/emojiPickerHeightOffset.js +9 -0
  250. package/dist/es2019/components/picker/emojiPickerLoader.js +7 -0
  251. package/dist/es2019/components/picker/emojiPickerModuleLoader.js +6 -0
  252. package/dist/es2019/components/picker/preloadEmojiPicker.js +12 -0
  253. package/dist/es2019/components/picker/{utils.js → scrollToRow.js} +0 -10
  254. package/dist/es2019/components/picker/sortCategories.js +7 -0
  255. package/dist/es2019/components/picker/sortCategoriesNew.js +7 -0
  256. package/dist/es2019/components/picker/virtualItemRenderer.js +13 -0
  257. package/dist/es2019/components/typeahead/EmojiTypeAheadComponent.js +5 -2
  258. package/dist/es2019/components/typeahead/EmojiTypeAheadItem.js +11 -49
  259. package/dist/es2019/components/typeahead/EmojiTypeAheadItemInternal.js +50 -0
  260. package/dist/es2019/components/typeahead/EmojiTypeAheadList.js +4 -3
  261. package/dist/es2019/components/uploader/EmojiUploadComponent.js +6 -3
  262. package/dist/es2019/components/uploader/EmojiUploader.js +10 -33
  263. package/dist/es2019/components/uploader/EmojiUploaderInternal.js +31 -0
  264. package/dist/es2019/element.js +10 -0
  265. package/dist/es2019/index.js +12 -8
  266. package/dist/es2019/picker.js +4 -0
  267. package/dist/es2019/resource.js +18 -0
  268. package/dist/es2019/typeahead.js +7 -0
  269. package/dist/es2019/util/actual-mouse-move.js +8 -0
  270. package/dist/es2019/util/analytics/Attributes.js +0 -0
  271. package/dist/es2019/util/analytics/CommonAttributes.js +0 -0
  272. package/dist/es2019/util/analytics/Duration.js +0 -0
  273. package/dist/es2019/util/analytics/aiGenerationCompletedEvent.js +4 -0
  274. package/dist/es2019/util/analytics/aiGenerationFailedEvent.js +4 -0
  275. package/dist/es2019/util/analytics/aiGenerationStartedEvent.js +5 -0
  276. package/dist/es2019/util/analytics/analytics.js +157 -155
  277. package/dist/es2019/util/analytics/categoryClickedEvent.js +4 -0
  278. package/dist/es2019/util/analytics/clearSampled.js +6 -0
  279. package/dist/es2019/util/analytics/closedPickerEvent.js +4 -0
  280. package/dist/es2019/util/analytics/createEvent.js +13 -0
  281. package/dist/es2019/util/analytics/deleteBeginEvent.js +4 -0
  282. package/dist/es2019/util/analytics/deleteCancelEvent.js +4 -0
  283. package/dist/es2019/util/analytics/deleteConfirmEvent.js +4 -0
  284. package/dist/es2019/util/analytics/emojiPickerEvent.js +2 -0
  285. package/dist/es2019/util/analytics/emojiUploaderEvent.js +2 -0
  286. package/dist/es2019/util/analytics/extractCommonAttributes.js +7 -0
  287. package/dist/es2019/util/analytics/extractErrorInfo.js +14 -0
  288. package/dist/es2019/util/analytics/getSkinTone.js +18 -0
  289. package/dist/es2019/util/analytics/hasUfoMarked.js +3 -0
  290. package/dist/es2019/util/analytics/isExperienceSampled.js +17 -0
  291. package/dist/es2019/util/analytics/openedPickerEvent.js +4 -0
  292. package/dist/es2019/util/analytics/pickerClickedEvent.js +8 -0
  293. package/dist/es2019/util/analytics/pickerSearchedEvent.js +4 -0
  294. package/dist/es2019/util/analytics/recordFailed.js +6 -0
  295. package/dist/es2019/util/analytics/recordFailedEmoji.js +11 -0
  296. package/dist/es2019/util/analytics/recordSelectionFailedSli.js +12 -0
  297. package/dist/es2019/util/analytics/recordSelectionSucceededSli.js +11 -0
  298. package/dist/es2019/util/analytics/recordSucceeded.js +6 -0
  299. package/dist/es2019/util/analytics/recordSucceededEmoji.js +11 -0
  300. package/dist/es2019/util/analytics/sampledUfoEmojiResourceFetched.js +5 -0
  301. package/dist/es2019/util/analytics/sampledUfoRenderedEmoji.js +5 -0
  302. package/dist/es2019/util/analytics/samplingUfo.js +10 -121
  303. package/dist/es2019/util/analytics/selectedFileEvent.js +4 -0
  304. package/dist/es2019/util/analytics/skinTones.js +16 -0
  305. package/dist/es2019/util/analytics/skintoneSelectorEvent.js +2 -0
  306. package/dist/es2019/util/analytics/toneSelectedEvent.js +4 -0
  307. package/dist/es2019/util/analytics/toneSelectorClosedEvent.js +4 -0
  308. package/dist/es2019/util/analytics/toneSelectorOpenedEvent.js +4 -0
  309. package/dist/es2019/util/analytics/typeaheadCancelledEvent.js +8 -0
  310. package/dist/es2019/util/analytics/typeaheadRenderedEvent.js +8 -0
  311. package/dist/es2019/util/analytics/typeaheadSelectedEvent.js +20 -0
  312. package/dist/es2019/util/analytics/ufoExperiences.js +15 -11
  313. package/dist/es2019/util/analytics/uploadBeginButton.js +4 -0
  314. package/dist/es2019/util/analytics/uploadCancelButton.js +4 -0
  315. package/dist/es2019/util/analytics/uploadConfirmButton.js +4 -0
  316. package/dist/es2019/util/analytics/uploadFailedEvent.js +4 -0
  317. package/dist/es2019/util/analytics/uploadSucceededEvent.js +4 -0
  318. package/dist/es2019/util/analytics/useSampledUFOComponentExperience.js +1 -1
  319. package/dist/es2019/util/analytics/withSampling.js +104 -0
  320. package/dist/es2019/util/build-emoji-description-with-alt-representation.js +10 -0
  321. package/dist/es2019/util/contains-emoji-id.js +12 -0
  322. package/dist/es2019/util/convert-image-to-media-representation.js +5 -0
  323. package/dist/es2019/util/convert-media-to-image-emoji.js +19 -0
  324. package/dist/es2019/util/convert-media-to-image-representation.js +5 -0
  325. package/dist/es2019/util/filter-hidden-emojis.js +2 -0
  326. package/dist/es2019/util/filters.js +1 -2
  327. package/dist/es2019/util/format-shortcut.js +23 -0
  328. package/dist/es2019/util/get-category-id.js +1 -0
  329. package/dist/es2019/util/get-tone-emoji.js +2 -0
  330. package/dist/es2019/util/has-data-url-image.js +3 -0
  331. package/dist/es2019/util/is-emoji-description-with-variations.js +1 -0
  332. package/dist/es2019/util/is-emoji-description.js +1 -0
  333. package/dist/es2019/util/is-emoji-id-equal.js +1 -0
  334. package/dist/es2019/util/is-emoji-variation-description.js +3 -0
  335. package/dist/es2019/util/{hidden-emojis.js → is-hidden-emoji.js} +1 -2
  336. package/dist/es2019/util/is-image-representation.js +1 -0
  337. package/dist/es2019/util/is-loaded-media-emoji.js +3 -0
  338. package/dist/es2019/util/is-media-emoji.js +2 -0
  339. package/dist/es2019/util/is-media-representation.js +1 -0
  340. package/dist/es2019/util/is-messages-key.js +2 -0
  341. package/dist/es2019/util/is-promise.js +1 -0
  342. package/dist/es2019/util/is-sprite-representation.js +1 -0
  343. package/dist/es2019/util/is-sprite-service-representation.js +1 -0
  344. package/dist/es2019/util/is-unicode-representation.js +1 -0
  345. package/dist/es2019/util/keymaps.js +2 -32
  346. package/dist/es2019/util/left-click.js +3 -0
  347. package/dist/es2019/util/make-key-map-with-common.js +10 -0
  348. package/dist/es2019/util/make-keymap.js +12 -0
  349. package/dist/es2019/util/mouse-location.js +6 -0
  350. package/dist/es2019/util/mouse.js +0 -18
  351. package/dist/es2019/util/to-emoji-id.js +5 -0
  352. package/dist/es2019/util/to-optional-emoji-id.js +7 -0
  353. package/dist/es2019/util/type-helpers.js +89 -78
  354. package/dist/es2019/utils.js +16 -2
  355. package/dist/esm/admin.js +4 -0
  356. package/dist/esm/api/EmojiLoader.js +2 -1
  357. package/dist/esm/api/EmojiRepository.js +14 -18
  358. package/dist/esm/api/EmojiResource.js +14 -17
  359. package/dist/esm/api/EmojiUtils.js +43 -167
  360. package/dist/esm/api/calculateScale.js +28 -0
  361. package/dist/esm/api/denormaliseEmojiServiceResponse.js +37 -0
  362. package/dist/esm/api/denormaliseServiceAltRepresentation.js +5 -0
  363. package/dist/esm/api/denormaliseServiceRepresentation.js +43 -0
  364. package/dist/esm/api/denormaliseSkinEmoji.js +24 -0
  365. package/dist/esm/api/denormaliseStandardRepresentation.js +11 -0
  366. package/dist/esm/api/emojiRequest.js +25 -0
  367. package/dist/esm/api/getAltRepresentation.js +6 -0
  368. package/dist/esm/api/getEmojiVariation.js +13 -0
  369. package/dist/esm/api/getPixelRatio.js +6 -0
  370. package/dist/esm/api/internal/AlphabeticalShortnameComparator.js +18 -0
  371. package/dist/esm/api/internal/AsciiMatchComparator.js +25 -0
  372. package/dist/esm/api/internal/ChainedEmojiComparator.js +30 -0
  373. package/dist/esm/api/internal/Comparators.js +1 -275
  374. package/dist/esm/api/internal/EmojiTypeComparator.js +33 -0
  375. package/dist/esm/api/internal/ExactShortNameMatchComparator.js +28 -0
  376. package/dist/esm/api/internal/Gateway.js +45 -0
  377. package/dist/esm/api/internal/OrderComparator.js +21 -0
  378. package/dist/esm/api/internal/QueryStringPositionMatchComparator.js +36 -0
  379. package/dist/esm/api/internal/UsageFrequencyComparator.js +52 -0
  380. package/dist/esm/api/internal/UsageFrequencyTracker.js +4 -46
  381. package/dist/esm/api/internal/createSearchEmojiComparator.js +40 -0
  382. package/dist/esm/api/internal/createUsageOnlyEmojiComparator.js +9 -0
  383. package/dist/esm/api/isMediaApiUrl.js +3 -0
  384. package/dist/esm/api/media/BrowserCacheStrategy.js +80 -0
  385. package/dist/esm/api/media/MediaEmojiCache.js +18 -143
  386. package/dist/esm/api/media/MemoryCacheStrategy.js +61 -0
  387. package/dist/esm/api/media/SiteEmojiResource.js +10 -4
  388. package/dist/esm/api/media/getRequiredRepresentation.js +3 -0
  389. package/dist/esm/api/shouldUseAltRepresentation.js +7 -0
  390. package/dist/esm/api/supportsUploadFeature.js +11 -0
  391. package/dist/esm/components/common/AddOwnEmoji.compiled.css +6 -0
  392. package/dist/esm/components/common/AddOwnEmoji.js +53 -0
  393. package/dist/esm/components/common/CachingEmoji.js +8 -87
  394. package/dist/esm/components/common/CachingMediaEmoji.js +88 -0
  395. package/dist/esm/components/common/CreateEmojiWithRovo.js +3 -1
  396. package/dist/esm/components/common/DeletableEmojiTooltipContent.js +2 -14
  397. package/dist/esm/components/common/DeletableEmojiTooltipContentForScreenReader.js +15 -0
  398. package/dist/esm/components/common/Emoji.js +17 -359
  399. package/dist/esm/components/common/EmojiActions.compiled.css +0 -6
  400. package/dist/esm/components/common/EmojiActions.js +9 -63
  401. package/dist/esm/components/common/EmojiPlaceholder.js +8 -4
  402. package/dist/esm/components/common/ImageEmoji.js +189 -0
  403. package/dist/esm/components/common/RecordSelectionDefault.js +4 -2
  404. package/dist/esm/components/common/ResourcedEmoji.js +3 -2
  405. package/dist/esm/components/common/ResourcedEmojiComponent.js +10 -8
  406. package/dist/esm/components/common/SpriteEmoji.js +58 -0
  407. package/dist/esm/components/common/ToneSelector.js +8 -131
  408. package/dist/esm/components/common/ToneSelectorInternal.js +133 -0
  409. package/dist/esm/components/common/ToolTipContentWithKeymap.js +1 -1
  410. package/dist/esm/components/common/UnicodeEmoji.js +128 -0
  411. package/dist/esm/components/common/UploadEmoji.js +5 -4
  412. package/dist/esm/components/common/emojiPlaceholderTestId.js +8 -0
  413. package/dist/esm/components/common/handleDelete.js +13 -0
  414. package/dist/esm/components/common/isRefreshEmojiPickerEnabled.js +15 -0
  415. package/dist/esm/components/picker/AbstractItem.js +7 -0
  416. package/dist/esm/components/picker/CategoryHeadingItem.js +27 -0
  417. package/dist/esm/components/picker/CategorySelector.js +6 -12
  418. package/dist/esm/components/picker/EmojiPicker.js +25 -105
  419. package/dist/esm/components/picker/EmojiPickerCategoryHeading.js +2 -2
  420. package/dist/esm/components/picker/EmojiPickerComponent.js +33 -17
  421. package/dist/esm/components/picker/EmojiPickerInternal.js +92 -0
  422. package/dist/esm/components/picker/EmojiPickerList.js +13 -8
  423. package/dist/esm/components/picker/EmojiPickerVirtualItems.js +1 -90
  424. package/dist/esm/components/picker/EmojisRowItem.js +30 -0
  425. package/dist/esm/components/picker/LoadingItem.js +33 -0
  426. package/dist/esm/components/picker/NoResultsItem.js +27 -0
  427. package/dist/esm/components/picker/categorySelectorCategoryTestId.js +8 -0
  428. package/dist/esm/components/picker/emojiPickerHeightOffset.js +9 -0
  429. package/dist/esm/components/picker/emojiPickerLoader.js +11 -0
  430. package/dist/esm/components/picker/emojiPickerModuleLoader.js +8 -0
  431. package/dist/esm/components/picker/preloadEmojiPicker.js +12 -0
  432. package/dist/esm/components/picker/{utils.js → scrollToRow.js} +0 -10
  433. package/dist/esm/components/picker/sortCategories.js +9 -0
  434. package/dist/esm/components/picker/sortCategoriesNew.js +9 -0
  435. package/dist/esm/components/picker/virtualItemRenderer.js +11 -0
  436. package/dist/esm/components/typeahead/EmojiTypeAheadComponent.js +5 -2
  437. package/dist/esm/components/typeahead/EmojiTypeAheadItem.js +11 -50
  438. package/dist/esm/components/typeahead/EmojiTypeAheadItemInternal.js +51 -0
  439. package/dist/esm/components/typeahead/EmojiTypeAheadList.js +4 -3
  440. package/dist/esm/components/uploader/EmojiUploadComponent.js +6 -3
  441. package/dist/esm/components/uploader/EmojiUploader.js +10 -57
  442. package/dist/esm/components/uploader/EmojiUploaderInternal.js +55 -0
  443. package/dist/esm/element.js +10 -0
  444. package/dist/esm/index.js +12 -8
  445. package/dist/esm/picker.js +4 -0
  446. package/dist/esm/resource.js +18 -0
  447. package/dist/esm/typeahead.js +7 -0
  448. package/dist/esm/util/actual-mouse-move.js +8 -0
  449. package/dist/esm/util/analytics/Attributes.js +0 -0
  450. package/dist/esm/util/analytics/CommonAttributes.js +0 -0
  451. package/dist/esm/util/analytics/Duration.js +0 -0
  452. package/dist/esm/util/analytics/aiGenerationCompletedEvent.js +6 -0
  453. package/dist/esm/util/analytics/aiGenerationFailedEvent.js +6 -0
  454. package/dist/esm/util/analytics/aiGenerationStartedEvent.js +9 -0
  455. package/dist/esm/util/analytics/analytics.js +157 -223
  456. package/dist/esm/util/analytics/categoryClickedEvent.js +6 -0
  457. package/dist/esm/util/analytics/clearSampled.js +18 -0
  458. package/dist/esm/util/analytics/closedPickerEvent.js +6 -0
  459. package/dist/esm/util/analytics/createEvent.js +18 -0
  460. package/dist/esm/util/analytics/deleteBeginEvent.js +6 -0
  461. package/dist/esm/util/analytics/deleteCancelEvent.js +6 -0
  462. package/dist/esm/util/analytics/deleteConfirmEvent.js +6 -0
  463. package/dist/esm/util/analytics/emojiPickerEvent.js +6 -0
  464. package/dist/esm/util/analytics/emojiUploaderEvent.js +4 -0
  465. package/dist/esm/util/analytics/extractCommonAttributes.js +9 -0
  466. package/dist/esm/util/analytics/extractErrorInfo.js +14 -0
  467. package/dist/esm/util/analytics/getSkinTone.js +29 -0
  468. package/dist/esm/util/analytics/hasUfoMarked.js +5 -0
  469. package/dist/esm/util/analytics/isExperienceSampled.js +17 -0
  470. package/dist/esm/util/analytics/openedPickerEvent.js +6 -0
  471. package/dist/esm/util/analytics/pickerClickedEvent.js +10 -0
  472. package/dist/esm/util/analytics/pickerSearchedEvent.js +6 -0
  473. package/dist/esm/util/analytics/recordFailed.js +6 -0
  474. package/dist/esm/util/analytics/recordFailedEmoji.js +13 -0
  475. package/dist/esm/util/analytics/recordSelectionFailedSli.js +14 -0
  476. package/dist/esm/util/analytics/recordSelectionSucceededSli.js +13 -0
  477. package/dist/esm/util/analytics/recordSucceeded.js +6 -0
  478. package/dist/esm/util/analytics/recordSucceededEmoji.js +13 -0
  479. package/dist/esm/util/analytics/sampledUfoEmojiResourceFetched.js +5 -0
  480. package/dist/esm/util/analytics/sampledUfoRenderedEmoji.js +5 -0
  481. package/dist/esm/util/analytics/samplingUfo.js +10 -204
  482. package/dist/esm/util/analytics/selectedFileEvent.js +6 -0
  483. package/dist/esm/util/analytics/skinTones.js +16 -0
  484. package/dist/esm/util/analytics/skintoneSelectorEvent.js +5 -0
  485. package/dist/esm/util/analytics/toneSelectedEvent.js +6 -0
  486. package/dist/esm/util/analytics/toneSelectorClosedEvent.js +6 -0
  487. package/dist/esm/util/analytics/toneSelectorOpenedEvent.js +6 -0
  488. package/dist/esm/util/analytics/typeaheadCancelledEvent.js +12 -0
  489. package/dist/esm/util/analytics/typeaheadRenderedEvent.js +12 -0
  490. package/dist/esm/util/analytics/typeaheadSelectedEvent.js +26 -0
  491. package/dist/esm/util/analytics/ufoExperiences.js +15 -13
  492. package/dist/esm/util/analytics/uploadBeginButton.js +6 -0
  493. package/dist/esm/util/analytics/uploadCancelButton.js +6 -0
  494. package/dist/esm/util/analytics/uploadConfirmButton.js +6 -0
  495. package/dist/esm/util/analytics/uploadFailedEvent.js +6 -0
  496. package/dist/esm/util/analytics/uploadSucceededEvent.js +6 -0
  497. package/dist/esm/util/analytics/useSampledUFOComponentExperience.js +1 -1
  498. package/dist/esm/util/analytics/withSampling.js +175 -0
  499. package/dist/esm/util/build-emoji-description-with-alt-representation.js +12 -0
  500. package/dist/esm/util/contains-emoji-id.js +12 -0
  501. package/dist/esm/util/convert-image-to-media-representation.js +7 -0
  502. package/dist/esm/util/convert-media-to-image-emoji.js +21 -0
  503. package/dist/esm/util/convert-media-to-image-representation.js +7 -0
  504. package/dist/esm/util/filter-hidden-emojis.js +6 -0
  505. package/dist/esm/util/filters.js +1 -4
  506. package/dist/esm/util/format-shortcut.js +23 -0
  507. package/dist/esm/util/get-category-id.js +3 -0
  508. package/dist/esm/util/get-tone-emoji.js +4 -0
  509. package/dist/esm/util/has-data-url-image.js +5 -0
  510. package/dist/esm/util/is-emoji-description-with-variations.js +3 -0
  511. package/dist/esm/util/is-emoji-description.js +3 -0
  512. package/dist/esm/util/is-emoji-id-equal.js +3 -0
  513. package/dist/esm/util/is-emoji-variation-description.js +3 -0
  514. package/dist/esm/util/{hidden-emojis.js → is-hidden-emoji.js} +0 -5
  515. package/dist/esm/util/is-image-representation.js +3 -0
  516. package/dist/esm/util/is-loaded-media-emoji.js +5 -0
  517. package/dist/esm/util/is-media-emoji.js +4 -0
  518. package/dist/esm/util/is-media-representation.js +3 -0
  519. package/dist/esm/util/is-messages-key.js +4 -0
  520. package/dist/esm/util/is-promise.js +3 -0
  521. package/dist/esm/util/is-sprite-representation.js +3 -0
  522. package/dist/esm/util/is-sprite-service-representation.js +3 -0
  523. package/dist/esm/util/is-unicode-representation.js +3 -0
  524. package/dist/esm/util/keymaps.js +2 -32
  525. package/dist/esm/util/left-click.js +3 -0
  526. package/dist/esm/util/make-key-map-with-common.js +10 -0
  527. package/dist/esm/util/make-keymap.js +12 -0
  528. package/dist/esm/util/mouse-location.js +6 -0
  529. package/dist/esm/util/mouse.js +0 -18
  530. package/dist/esm/util/to-emoji-id.js +7 -0
  531. package/dist/esm/util/to-optional-emoji-id.js +7 -0
  532. package/dist/esm/util/type-helpers.js +89 -113
  533. package/dist/esm/utils.js +16 -2
  534. package/dist/types/admin.d.ts +3 -0
  535. package/dist/types/api/EmojiLoader.d.ts +1 -1
  536. package/dist/types/api/EmojiRepository.d.ts +4 -1
  537. package/dist/types/api/EmojiResource.d.ts +5 -9
  538. package/dist/types/api/EmojiUtils.d.ts +46 -15
  539. package/dist/types/api/calculateScale.d.ts +2 -0
  540. package/dist/types/api/denormaliseEmojiServiceResponse.d.ts +6 -0
  541. package/dist/types/api/denormaliseServiceAltRepresentation.d.ts +2 -0
  542. package/dist/types/api/denormaliseServiceRepresentation.d.ts +2 -0
  543. package/dist/types/api/denormaliseSkinEmoji.d.ts +2 -0
  544. package/dist/types/api/denormaliseStandardRepresentation.d.ts +2 -0
  545. package/dist/types/api/emojiRequest.d.ts +4 -0
  546. package/dist/types/api/getAltRepresentation.d.ts +2 -0
  547. package/dist/types/api/getEmojiVariation.d.ts +2 -0
  548. package/dist/types/api/getPixelRatio.d.ts +1 -0
  549. package/dist/types/api/internal/AlphabeticalShortnameComparator.d.ts +8 -0
  550. package/dist/types/api/internal/AsciiMatchComparator.d.ts +11 -0
  551. package/dist/types/api/internal/ChainedEmojiComparator.d.ts +14 -0
  552. package/dist/types/api/internal/Comparators.d.ts +0 -98
  553. package/dist/types/api/internal/EmojiTypeComparator.d.ts +14 -0
  554. package/dist/types/api/internal/ExactShortNameMatchComparator.d.ts +12 -0
  555. package/dist/types/api/internal/Gateway.d.ts +13 -0
  556. package/dist/types/api/internal/OrderComparator.d.ts +8 -0
  557. package/dist/types/api/internal/QueryStringPositionMatchComparator.d.ts +21 -0
  558. package/dist/types/api/internal/UsageFrequencyComparator.d.ts +17 -0
  559. package/dist/types/api/internal/UsageFrequencyTracker.d.ts +0 -13
  560. package/dist/types/api/internal/createSearchEmojiComparator.d.ts +9 -0
  561. package/dist/types/api/internal/createUsageOnlyEmojiComparator.d.ts +2 -0
  562. package/dist/types/api/isMediaApiUrl.d.ts +2 -0
  563. package/dist/types/api/media/BrowserCacheStrategy.d.ts +15 -0
  564. package/dist/types/api/media/MediaEmojiCache.d.ts +2 -29
  565. package/dist/types/api/media/MemoryCacheStrategy.d.ts +19 -0
  566. package/dist/types/api/media/getRequiredRepresentation.d.ts +2 -0
  567. package/dist/types/api/shouldUseAltRepresentation.d.ts +2 -0
  568. package/dist/types/api/supportsUploadFeature.d.ts +9 -0
  569. package/dist/types/components/common/AddOwnEmoji.d.ts +9 -0
  570. package/dist/types/components/common/CachingEmoji.d.ts +0 -5
  571. package/dist/types/components/common/CachingMediaEmoji.d.ts +7 -0
  572. package/dist/types/components/common/DeletableEmojiTooltipContent.d.ts +0 -4
  573. package/dist/types/components/common/DeletableEmojiTooltipContentForScreenReader.d.ts +1 -0
  574. package/dist/types/components/common/Emoji.d.ts +1 -3
  575. package/dist/types/components/common/EmojiActions.d.ts +4 -6
  576. package/dist/types/components/common/EmojiPlaceholder.d.ts +8 -1
  577. package/dist/types/components/common/ImageEmoji.d.ts +6 -0
  578. package/dist/types/components/common/RecordSelectionDefault.d.ts +2 -2
  579. package/dist/types/components/common/SpriteEmoji.d.ts +6 -0
  580. package/dist/types/components/common/ToneSelector.d.ts +6 -3
  581. package/dist/types/components/common/ToneSelectorInternal.d.ts +9 -0
  582. package/dist/types/components/common/ToolTipContentWithKeymap.d.ts +1 -1
  583. package/dist/types/components/common/UnicodeEmoji.d.ts +6 -0
  584. package/dist/types/components/common/UploadEmoji.d.ts +2 -2
  585. package/dist/types/components/common/emojiPlaceholderTestId.d.ts +5 -0
  586. package/dist/types/components/common/handleDelete.d.ts +5 -0
  587. package/dist/types/components/common/isRefreshEmojiPickerEnabled.d.ts +5 -0
  588. package/dist/types/components/picker/AbstractItem.d.ts +7 -0
  589. package/dist/types/components/picker/CategoryHeadingItem.d.ts +10 -0
  590. package/dist/types/components/picker/CategorySelector.d.ts +5 -4
  591. package/dist/types/components/picker/EmojiPicker.d.ts +19 -19
  592. package/dist/types/components/picker/EmojiPickerCategoryHeading.d.ts +4 -0
  593. package/dist/types/components/picker/EmojiPickerComponent.d.ts +6 -2
  594. package/dist/types/components/picker/EmojiPickerInternal.d.ts +24 -0
  595. package/dist/types/components/picker/EmojiPickerList.d.ts +5 -5
  596. package/dist/types/components/picker/EmojiPickerVirtualItems.d.ts +0 -26
  597. package/dist/types/components/picker/EmojisRowItem.d.ts +11 -0
  598. package/dist/types/components/picker/LoadingItem.d.ts +9 -0
  599. package/dist/types/components/picker/NoResultsItem.d.ts +10 -0
  600. package/dist/types/components/picker/categorySelectorCategoryTestId.d.ts +5 -0
  601. package/dist/types/components/picker/{utils.d.ts → emojiPickerHeightOffset.d.ts} +0 -1
  602. package/dist/types/components/picker/emojiPickerLoader.d.ts +7 -0
  603. package/dist/types/components/picker/emojiPickerModuleLoader.d.ts +5 -0
  604. package/dist/types/components/picker/preloadEmojiPicker.d.ts +5 -0
  605. package/dist/types/components/picker/scrollToRow.d.ts +1 -0
  606. package/dist/types/components/picker/sortCategories.d.ts +6 -0
  607. package/dist/types/components/picker/sortCategoriesNew.d.ts +6 -0
  608. package/dist/types/components/picker/virtualItemRenderer.d.ts +10 -0
  609. package/dist/types/components/typeahead/EmojiTypeAheadComponent.d.ts +3 -3
  610. package/dist/types/components/typeahead/EmojiTypeAheadItem.d.ts +7 -2
  611. package/dist/types/components/typeahead/EmojiTypeAheadItemInternal.d.ts +6 -0
  612. package/dist/types/components/uploader/EmojiUploadComponent.d.ts +3 -3
  613. package/dist/types/components/uploader/EmojiUploader.d.ts +8 -14
  614. package/dist/types/components/uploader/EmojiUploaderInternal.d.ts +14 -0
  615. package/dist/types/element.d.ts +9 -0
  616. package/dist/types/index.d.ts +13 -8
  617. package/dist/types/picker.d.ts +3 -0
  618. package/dist/types/resource.d.ts +15 -0
  619. package/dist/types/typeahead.d.ts +6 -0
  620. package/dist/types/util/actual-mouse-move.d.ts +2 -0
  621. package/dist/types/util/analytics/Attributes.d.ts +3 -0
  622. package/dist/types/util/analytics/CommonAttributes.d.ts +5 -0
  623. package/dist/types/util/analytics/Duration.d.ts +3 -0
  624. package/dist/types/util/analytics/aiGenerationCompletedEvent.d.ts +3 -0
  625. package/dist/types/util/analytics/aiGenerationFailedEvent.d.ts +4 -0
  626. package/dist/types/util/analytics/aiGenerationStartedEvent.d.ts +4 -0
  627. package/dist/types/util/analytics/analytics.d.ts +162 -74
  628. package/dist/types/util/analytics/categoryClickedEvent.d.ts +4 -0
  629. package/dist/types/util/analytics/clearSampled.d.ts +1 -0
  630. package/dist/types/util/analytics/closedPickerEvent.d.ts +3 -0
  631. package/dist/types/util/analytics/createEvent.d.ts +2 -0
  632. package/dist/types/util/analytics/deleteBeginEvent.d.ts +3 -0
  633. package/dist/types/util/analytics/deleteCancelEvent.d.ts +3 -0
  634. package/dist/types/util/analytics/deleteConfirmEvent.d.ts +3 -0
  635. package/dist/types/util/analytics/emojiPickerEvent.d.ts +1 -0
  636. package/dist/types/util/analytics/emojiUploaderEvent.d.ts +1 -0
  637. package/dist/types/util/analytics/extractCommonAttributes.d.ts +3 -0
  638. package/dist/types/util/analytics/extractErrorInfo.d.ts +6 -0
  639. package/dist/types/util/analytics/getSkinTone.d.ts +1 -0
  640. package/dist/types/util/analytics/hasUfoMarked.d.ts +3 -0
  641. package/dist/types/util/analytics/isExperienceSampled.d.ts +8 -0
  642. package/dist/types/util/analytics/openedPickerEvent.d.ts +2 -0
  643. package/dist/types/util/analytics/pickerClickedEvent.d.ts +13 -0
  644. package/dist/types/util/analytics/pickerSearchedEvent.d.ts +5 -0
  645. package/dist/types/util/analytics/recordFailed.d.ts +2 -0
  646. package/dist/types/util/analytics/recordFailedEmoji.d.ts +1 -0
  647. package/dist/types/util/analytics/recordSelectionFailedSli.d.ts +1 -0
  648. package/dist/types/util/analytics/recordSelectionSucceededSli.d.ts +1 -0
  649. package/dist/types/util/analytics/recordSucceeded.d.ts +2 -0
  650. package/dist/types/util/analytics/recordSucceededEmoji.d.ts +1 -0
  651. package/dist/types/util/analytics/sampledUfoEmojiResourceFetched.d.ts +3 -0
  652. package/dist/types/util/analytics/sampledUfoRenderedEmoji.d.ts +3 -0
  653. package/dist/types/util/analytics/samplingUfo.d.ts +9 -15
  654. package/dist/types/util/analytics/selectedFileEvent.d.ts +2 -0
  655. package/dist/types/util/analytics/skinTones.d.ts +1 -0
  656. package/dist/types/util/analytics/skintoneSelectorEvent.d.ts +1 -0
  657. package/dist/types/util/analytics/toneSelectedEvent.d.ts +4 -0
  658. package/dist/types/util/analytics/toneSelectorClosedEvent.d.ts +2 -0
  659. package/dist/types/util/analytics/toneSelectorOpenedEvent.d.ts +4 -0
  660. package/dist/types/util/analytics/typeaheadCancelledEvent.d.ts +3 -0
  661. package/dist/types/util/analytics/typeaheadRenderedEvent.d.ts +3 -0
  662. package/dist/types/util/analytics/typeaheadSelectedEvent.d.ts +3 -0
  663. package/dist/types/util/analytics/ufoExperiences.d.ts +14 -7
  664. package/dist/types/util/analytics/uploadBeginButton.d.ts +2 -0
  665. package/dist/types/util/analytics/uploadCancelButton.d.ts +2 -0
  666. package/dist/types/util/analytics/uploadConfirmButton.d.ts +4 -0
  667. package/dist/types/util/analytics/uploadFailedEvent.d.ts +5 -0
  668. package/dist/types/util/analytics/uploadSucceededEvent.d.ts +3 -0
  669. package/dist/types/util/analytics/withSampling.d.ts +8 -0
  670. package/dist/types/util/build-emoji-description-with-alt-representation.d.ts +2 -0
  671. package/dist/types/util/contains-emoji-id.d.ts +2 -0
  672. package/dist/types/util/convert-image-to-media-representation.d.ts +2 -0
  673. package/dist/types/util/convert-media-to-image-emoji.d.ts +2 -0
  674. package/dist/types/util/convert-media-to-image-representation.d.ts +2 -0
  675. package/dist/types/util/{hidden-emojis.d.ts → filter-hidden-emojis.d.ts} +0 -1
  676. package/dist/types/util/filters.d.ts +2 -3
  677. package/dist/types/util/format-shortcut.d.ts +5 -0
  678. package/dist/types/util/get-category-id.d.ts +3 -0
  679. package/dist/types/util/get-tone-emoji.d.ts +3 -0
  680. package/dist/types/util/has-data-url-image.d.ts +2 -0
  681. package/dist/types/util/is-emoji-description-with-variations.d.ts +2 -0
  682. package/dist/types/util/is-emoji-description.d.ts +2 -0
  683. package/dist/types/util/is-emoji-id-equal.d.ts +2 -0
  684. package/dist/types/util/is-emoji-variation-description.d.ts +2 -0
  685. package/dist/types/util/is-hidden-emoji.d.ts +2 -0
  686. package/dist/types/util/is-image-representation.d.ts +2 -0
  687. package/dist/types/util/is-loaded-media-emoji.d.ts +2 -0
  688. package/dist/types/util/is-media-emoji.d.ts +2 -0
  689. package/dist/types/util/is-media-representation.d.ts +2 -0
  690. package/dist/types/util/is-messages-key.d.ts +2 -0
  691. package/dist/types/util/is-promise.d.ts +1 -0
  692. package/dist/types/util/is-sprite-representation.d.ts +2 -0
  693. package/dist/types/util/is-sprite-service-representation.d.ts +2 -0
  694. package/dist/types/util/is-unicode-representation.d.ts +2 -0
  695. package/dist/types/util/keymaps.d.ts +0 -3
  696. package/dist/types/util/left-click.d.ts +2 -0
  697. package/dist/types/util/make-key-map-with-common.d.ts +5 -0
  698. package/dist/types/util/make-keymap.d.ts +5 -0
  699. package/dist/types/util/mouse-location.d.ts +3 -0
  700. package/dist/types/util/mouse.d.ts +0 -4
  701. package/dist/types/util/to-emoji-id.d.ts +2 -0
  702. package/dist/types/util/to-optional-emoji-id.d.ts +2 -0
  703. package/dist/types/util/type-helpers.d.ts +88 -25
  704. package/dist/types/utils.d.ts +15 -2
  705. package/package.json +2 -2
  706. package/dist/cjs/i18n/index.js +0 -216
  707. package/dist/cjs/util/analytics/index.js +0 -231
  708. package/dist/es2019/i18n/index.js +0 -37
  709. package/dist/es2019/util/analytics/index.js +0 -4
  710. package/dist/esm/i18n/index.js +0 -37
  711. package/dist/esm/util/analytics/index.js +0 -4
  712. package/dist/types/i18n/index.d.ts +0 -37
  713. package/dist/types/util/analytics/index.d.ts +0 -6
  714. /package/dist/cjs/components/common/{ToneSelector.compiled.css → ToneSelectorInternal.compiled.css} +0 -0
  715. /package/dist/cjs/components/picker/{EmojiPicker.compiled.css → EmojiPickerInternal.compiled.css} +0 -0
  716. /package/dist/cjs/components/picker/{EmojiPickerVirtualItems.compiled.css → LoadingItem.compiled.css} +0 -0
  717. /package/dist/cjs/components/typeahead/{EmojiTypeAheadItem.compiled.css → EmojiTypeAheadItemInternal.compiled.css} +0 -0
  718. /package/dist/es2019/components/common/{ToneSelector.compiled.css → ToneSelectorInternal.compiled.css} +0 -0
  719. /package/dist/es2019/components/picker/{EmojiPicker.compiled.css → EmojiPickerInternal.compiled.css} +0 -0
  720. /package/dist/es2019/components/picker/{EmojiPickerVirtualItems.compiled.css → LoadingItem.compiled.css} +0 -0
  721. /package/dist/es2019/components/typeahead/{EmojiTypeAheadItem.compiled.css → EmojiTypeAheadItemInternal.compiled.css} +0 -0
  722. /package/dist/esm/components/common/{ToneSelector.compiled.css → ToneSelectorInternal.compiled.css} +0 -0
  723. /package/dist/esm/components/picker/{EmojiPicker.compiled.css → EmojiPickerInternal.compiled.css} +0 -0
  724. /package/dist/esm/components/picker/{EmojiPickerVirtualItems.compiled.css → LoadingItem.compiled.css} +0 -0
  725. /package/dist/esm/components/typeahead/{EmojiTypeAheadItem.compiled.css → EmojiTypeAheadItemInternal.compiled.css} +0 -0
@@ -1,222 +1 @@
1
- import { MAX_ORDINAL } from '../../util/constants';
2
- import { isEmojiVariationDescription } from '../../util/type-helpers';
3
- /**
4
- * Create the default sort comparator to be used for the user queries against emoji
5
- *
6
- * @param query the query used in the search to be sorted. Any colons will be stripped from the query and it will be
7
- * converted to lowercase.
8
- * @param orderedIds the id of emoji ordered by how frequently they are used
9
- */
10
- export function createSearchEmojiComparator(query, orderedIds) {
11
- const textQuery = query ? query.replace(/:/g, '').toLowerCase().trim() : undefined;
12
- const comparators = [];
13
- if (query) {
14
- comparators.push(new AsciiMatchComparator(query));
15
- }
16
-
17
- // Add the comparators to the 'chain'. The order of adding each comparator is important to the sort that is applied by the
18
- // ChainedEmojiComparator. (Which is why you may see the same 'if' a few times.)
19
-
20
- if (textQuery) {
21
- comparators.push(new ExactShortNameMatchComparator(textQuery));
22
- }
23
- if (orderedIds && orderedIds.length) {
24
- comparators.push(new UsageFrequencyComparator(orderedIds));
25
- }
26
- if (textQuery) {
27
- comparators.push(new QueryStringPositionMatchComparator(textQuery, 'shortName'), new QueryStringPositionMatchComparator(textQuery, 'name'));
28
- }
29
- comparators.push(OrderComparator.Instance, AlphabeticalShortnameComparator.Instance);
30
- const comparator = new ChainedEmojiComparator(...comparators);
31
- comparator.compare = comparator.compare.bind(comparator);
32
- return comparator;
33
- }
34
- export function createUsageOnlyEmojiComparator(orderedIds) {
35
- const comparator = new ChainedEmojiComparator(new UsageFrequencyComparator(orderedIds), new EmojiTypeComparator(), OrderComparator.Instance);
36
- comparator.compare = comparator.compare.bind(comparator);
37
- return comparator;
38
- }
39
-
40
- /**
41
- * Returns a number representing the result of comparing e1 and e2.
42
- * Compatible with Array.sort, which is to say -
43
- * - less than 0 if e1 should come first
44
- * - 0 if they are equal; e1 and e2 will be unchanged in position relative to each other
45
- * - greater than 0 if e2 should come first.
46
- */
47
-
48
- /**
49
- * A combinator comparator that applies an ordered chained of sub-comparators. The first comparator that
50
- * returns a non-zero value stops the chain and causes that value to be returned. If a comparator returns a
51
- * zero then the next one in the chain is tried.
52
- *
53
- * If no comparators in the chain return a non-zero value then zero will be returned.
54
- */
55
- export class ChainedEmojiComparator {
56
- constructor(...comparators) {
57
- this.chain = comparators;
58
- }
59
- compare(e1, e2) {
60
- for (let i = 0; i < this.chain.length; i++) {
61
- const result = this.chain[i].compare(e1, e2);
62
- if (result !== 0) {
63
- return result;
64
- }
65
- }
66
- return 0;
67
- }
68
- }
69
-
70
- /**
71
- * Orders two emoji such that if one of them has an ascii representation that exactly matches the query then it will
72
- * be ordered first.
73
- */
74
- export class AsciiMatchComparator {
75
- constructor(query) {
76
- this.query = query;
77
- }
78
- compare(e1, e2) {
79
- const e1HasAscii = e1.ascii && e1.ascii.indexOf(this.query) !== -1;
80
- const e2HasAscii = e2.ascii && e2.ascii.indexOf(this.query) !== -1;
81
- if (e1HasAscii && !e2HasAscii) {
82
- return -1;
83
- } else if (!e1HasAscii && e2HasAscii) {
84
- return 1;
85
- }
86
- return 0;
87
- }
88
- }
89
-
90
- /**
91
- * Orders two emoji such that the one who's shortname matches the query exactly comes first. If there are matching
92
- * shortnames then the type of emoji is taken into account with SITE emoji coming first.
93
- */
94
- export class ExactShortNameMatchComparator {
95
- constructor(query) {
96
- this.colonQuery = `:${query}:`;
97
- this.typeComparator = new EmojiTypeComparator(true);
98
- }
99
- compare(e1, e2) {
100
- if (e1.shortName === this.colonQuery && e2.shortName === this.colonQuery) {
101
- return this.typeComparator.compare(e1, e2);
102
- } else if (e1.shortName === this.colonQuery) {
103
- return -1;
104
- } else if (e2.shortName === this.colonQuery) {
105
- return 1;
106
- }
107
- return 0;
108
- }
109
- }
110
-
111
- /**
112
- * Orders two emoji based on their type, with the types being STANDARD, ATLASSIAN and SITE (in that order).
113
- * If the comparator is configured to 'reverse' then the order will be SITE, ATLASSIAN, STANDARD.
114
- *
115
- * Regardless of the reverse setting, an unknown type will always come last.
116
- */
117
- export class EmojiTypeComparator {
118
- constructor(reverse) {
119
- if (reverse) {
120
- this.typeToNumber = new Map([['SITE', 0], ['ATLASSIAN', 1], ['STANDARD', 2]]);
121
- } else {
122
- this.typeToNumber = new Map([['STANDARD', 0], ['ATLASSIAN', 1], ['SITE', 2]]);
123
- }
124
- }
125
- compare(e1, e2) {
126
- return this.emojiTypeToOrdinal(e1) - this.emojiTypeToOrdinal(e2);
127
- }
128
- emojiTypeToOrdinal(emoji) {
129
- let ordinal = this.typeToNumber.get(emoji.type);
130
- if (ordinal === undefined) {
131
- ordinal = 10;
132
- }
133
- return ordinal;
134
- }
135
- }
136
-
137
- /**
138
- * Order two emoji such as the one which is more frequently used comes first. If neither have any usage
139
- * information then leave their order unchanged.
140
- */
141
- export class UsageFrequencyComparator {
142
- // A Map of emoji base Id to their order in a least of most frequently used
143
-
144
- constructor(orderedIds) {
145
- this.positionLookup = new Map();
146
- // Make ordering start from 1 to avoid having zero in the map (which is falsey)
147
- orderedIds.map((id, index) => this.positionLookup.set(id, index + 1));
148
- }
149
- compare(e1, e2) {
150
- if (!e1.id || !e2.id) {
151
- return 0; // this shouldn't occur. Leave position unchanged if there is any missing id.
152
- }
153
- let i1 = this.getPositionInOrder(e1);
154
- let i2 = this.getPositionInOrder(e2);
155
- return i1 - i2;
156
- }
157
-
158
- /**
159
- * Get the ordinal representing the position of this emoji.
160
- *
161
- * @param id the id of the emoji
162
- */
163
- getPositionInOrder(emoji) {
164
- let id = emoji.id ? emoji.id : '0';
165
- if (isEmojiVariationDescription(emoji)) {
166
- id = emoji.baseId;
167
- }
168
- const position = this.positionLookup.get(id);
169
- if (position) {
170
- return position;
171
- } else {
172
- return MAX_ORDINAL;
173
- }
174
- }
175
- }
176
- /**
177
- * A comparator that will sort higher an emoji which matches the query string earliest in the indicated
178
- * property.
179
- */
180
- export class QueryStringPositionMatchComparator {
181
- /**
182
- * @param query the query to match
183
- * @param propertyToCompare the property of EmojiDescription to check for query within
184
- */
185
- constructor(query, propertyToCompare) {
186
- this.query = query;
187
- if (!propertyToCompare) {
188
- throw new Error('propertyToCompare is required');
189
- }
190
- this.propertyName = propertyToCompare;
191
- }
192
- getScore(emoji) {
193
- // It is fine to do override the null check here because we are checking
194
- // it on the constructor.
195
- const propertyValue = emoji[this.propertyName];
196
- const score = propertyValue ? propertyValue.indexOf(this.query) : MAX_ORDINAL;
197
- return score === -1 ? MAX_ORDINAL : score;
198
- }
199
- compare(e1, e2) {
200
- return this.getScore(e1) - this.getScore(e2);
201
- }
202
- }
203
- export class OrderComparator {
204
- constructor() {}
205
- static get Instance() {
206
- return this.INSTANCE || (this.INSTANCE = new this());
207
- }
208
- compare(e1, e2) {
209
- let o1 = e1.order ? e1.order : MAX_ORDINAL;
210
- let o2 = e2.order ? e2.order : MAX_ORDINAL;
211
- return o1 - o2;
212
- }
213
- }
214
- export class AlphabeticalShortnameComparator {
215
- constructor() {}
216
- static get Instance() {
217
- return this.INSTANCE || (this.INSTANCE = new this());
218
- }
219
- compare(e1, e2) {
220
- return e1.shortName.localeCompare(e2.shortName);
221
- }
222
- }
1
+ export {};
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Orders two emoji based on their type, with the types being STANDARD, ATLASSIAN and SITE (in that order).
3
+ * If the comparator is configured to 'reverse' then the order will be SITE, ATLASSIAN, STANDARD.
4
+ *
5
+ * Regardless of the reverse setting, an unknown type will always come last.
6
+ */
7
+ export class EmojiTypeComparator {
8
+ constructor(reverse) {
9
+ if (reverse) {
10
+ this.typeToNumber = new Map([['SITE', 0], ['ATLASSIAN', 1], ['STANDARD', 2]]);
11
+ } else {
12
+ this.typeToNumber = new Map([['STANDARD', 0], ['ATLASSIAN', 1], ['SITE', 2]]);
13
+ }
14
+ }
15
+ compare(e1, e2) {
16
+ return this.emojiTypeToOrdinal(e1) - this.emojiTypeToOrdinal(e2);
17
+ }
18
+ emojiTypeToOrdinal(emoji) {
19
+ let ordinal = this.typeToNumber.get(emoji.type);
20
+ if (ordinal === undefined) {
21
+ ordinal = 10;
22
+ }
23
+ return ordinal;
24
+ }
25
+ }
@@ -0,0 +1,22 @@
1
+ import { EmojiTypeComparator } from './EmojiTypeComparator';
2
+
3
+ /**
4
+ * Orders two emoji such that the one who's shortname matches the query exactly comes first. If there are matching
5
+ * shortnames then the type of emoji is taken into account with SITE emoji coming first.
6
+ */
7
+ export class ExactShortNameMatchComparator {
8
+ constructor(query) {
9
+ this.colonQuery = `:${query}:`;
10
+ this.typeComparator = new EmojiTypeComparator(true);
11
+ }
12
+ compare(e1, e2) {
13
+ if (e1.shortName === this.colonQuery && e2.shortName === this.colonQuery) {
14
+ return this.typeComparator.compare(e1, e2);
15
+ } else if (e1.shortName === this.colonQuery) {
16
+ return -1;
17
+ } else if (e2.shortName === this.colonQuery) {
18
+ return 1;
19
+ }
20
+ return 0;
21
+ }
22
+ }
@@ -0,0 +1,36 @@
1
+ export class Gateway {
2
+ constructor(maximumPermitted) {
3
+ if (maximumPermitted < 1) {
4
+ throw new RangeError('The maximumPermitted parameter must be 1 or more.');
5
+ }
6
+ this.maximumPermitted = maximumPermitted;
7
+ this.count = 0;
8
+ }
9
+
10
+ /**
11
+ * Run the supplied function if the count of already submitted work allows it. Drop the work
12
+ * if it's not allowed to run.
13
+ *
14
+ * Will return true if the function has been submitted or false if it was not submitted.
15
+ */
16
+ submit(f) {
17
+ if (this.count >= this.maximumPermitted) {
18
+ return false;
19
+ }
20
+ this.count++;
21
+ const wrappedFunc = () => {
22
+ try {
23
+ f();
24
+ } finally {
25
+ this.completed();
26
+ }
27
+ };
28
+ if (typeof window !== 'undefined') {
29
+ window.setTimeout(wrappedFunc);
30
+ }
31
+ return true;
32
+ }
33
+ completed() {
34
+ this.count--;
35
+ }
36
+ }
@@ -0,0 +1,12 @@
1
+ import { MAX_ORDINAL } from '../../util/constants';
2
+ export class OrderComparator {
3
+ constructor() {}
4
+ static get Instance() {
5
+ return this.INSTANCE || (this.INSTANCE = new this());
6
+ }
7
+ compare(e1, e2) {
8
+ let o1 = e1.order ? e1.order : MAX_ORDINAL;
9
+ let o2 = e2.order ? e2.order : MAX_ORDINAL;
10
+ return o1 - o2;
11
+ }
12
+ }
@@ -0,0 +1,28 @@
1
+ import { MAX_ORDINAL } from '../../util/constants';
2
+ /**
3
+ * A comparator that will sort higher an emoji which matches the query string earliest in the indicated
4
+ * property.
5
+ */
6
+ export class QueryStringPositionMatchComparator {
7
+ /**
8
+ * @param query the query to match
9
+ * @param propertyToCompare the property of EmojiDescription to check for query within
10
+ */
11
+ constructor(query, propertyToCompare) {
12
+ this.query = query;
13
+ if (!propertyToCompare) {
14
+ throw new Error('propertyToCompare is required');
15
+ }
16
+ this.propertyName = propertyToCompare;
17
+ }
18
+ getScore(emoji) {
19
+ // It is fine to do override the null check here because we are checking
20
+ // it on the constructor.
21
+ const propertyValue = emoji[this.propertyName];
22
+ const score = propertyValue ? propertyValue.indexOf(this.query) : MAX_ORDINAL;
23
+ return score === -1 ? MAX_ORDINAL : score;
24
+ }
25
+ compare(e1, e2) {
26
+ return this.getScore(e1) - this.getScore(e2);
27
+ }
28
+ }
@@ -0,0 +1,41 @@
1
+ import { MAX_ORDINAL } from '../../util/constants';
2
+ import { isEmojiVariationDescription } from '../../util/is-emoji-variation-description';
3
+ /**
4
+ * Order two emoji such as the one which is more frequently used comes first. If neither have any usage
5
+ * information then leave their order unchanged.
6
+ */
7
+ export class UsageFrequencyComparator {
8
+ // A Map of emoji base Id to their order in a least of most frequently used
9
+
10
+ constructor(orderedIds) {
11
+ this.positionLookup = new Map();
12
+ // Make ordering start from 1 to avoid having zero in the map (which is falsey)
13
+ orderedIds.map((id, index) => this.positionLookup.set(id, index + 1));
14
+ }
15
+ compare(e1, e2) {
16
+ if (!e1.id || !e2.id) {
17
+ return 0; // this shouldn't occur. Leave position unchanged if there is any missing id.
18
+ }
19
+ let i1 = this.getPositionInOrder(e1);
20
+ let i2 = this.getPositionInOrder(e2);
21
+ return i1 - i2;
22
+ }
23
+
24
+ /**
25
+ * Get the ordinal representing the position of this emoji.
26
+ *
27
+ * @param id the id of the emoji
28
+ */
29
+ getPositionInOrder(emoji) {
30
+ let id = emoji.id ? emoji.id : '0';
31
+ if (isEmojiVariationDescription(emoji)) {
32
+ id = emoji.baseId;
33
+ }
34
+ const position = this.positionLookup.get(id);
35
+ if (position) {
36
+ return position;
37
+ } else {
38
+ return MAX_ORDINAL;
39
+ }
40
+ }
41
+ }
@@ -1,9 +1,10 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { isEmojiVariationDescription } from '../../util/type-helpers';
3
- import { localStoragePrefix } from '../../util/constants';
4
2
  import DuplicateLimitedQueue from '../../util/DuplicateLimitedQueue';
5
3
  import StoredDuplicateLimitedQueue from '../../util/StoredDuplicateLimitedQueue';
4
+ import { localStoragePrefix } from '../../util/constants';
5
+ import { isEmojiVariationDescription } from '../../util/is-emoji-variation-description';
6
6
  import storageAvailable from '../../util/storage-available';
7
+ import { Gateway } from './Gateway';
7
8
 
8
9
  /**
9
10
  * Keeps track of the last 150 emoji usages, although limiting the maximum count for a single emoji to 25 to
@@ -70,40 +71,4 @@ _defineProperty(UsageFrequencyTracker, "queueOptions", {
70
71
  storagePrefix: localStoragePrefix,
71
72
  maxDuplicates: 25,
72
73
  minUniqueItems: 5
73
- });
74
- export class Gateway {
75
- constructor(maximumPermitted) {
76
- if (maximumPermitted < 1) {
77
- throw new RangeError('The maximumPermitted parameter must be 1 or more.');
78
- }
79
- this.maximumPermitted = maximumPermitted;
80
- this.count = 0;
81
- }
82
-
83
- /**
84
- * Run the supplied function if the count of already submitted work allows it. Drop the work
85
- * if it's not allowed to run.
86
- *
87
- * Will return true if the function has been submitted or false if it was not submitted.
88
- */
89
- submit(f) {
90
- if (this.count >= this.maximumPermitted) {
91
- return false;
92
- }
93
- this.count++;
94
- const wrappedFunc = () => {
95
- try {
96
- f();
97
- } finally {
98
- this.completed();
99
- }
100
- };
101
- if (typeof window !== 'undefined') {
102
- window.setTimeout(wrappedFunc);
103
- }
104
- return true;
105
- }
106
- completed() {
107
- this.count--;
108
- }
109
- }
74
+ });
@@ -0,0 +1,39 @@
1
+ import { AlphabeticalShortnameComparator } from './AlphabeticalShortnameComparator';
2
+ import { AsciiMatchComparator } from './AsciiMatchComparator';
3
+ import { ChainedEmojiComparator } from './ChainedEmojiComparator';
4
+ import { ExactShortNameMatchComparator } from './ExactShortNameMatchComparator';
5
+ import { OrderComparator } from './OrderComparator';
6
+ import { QueryStringPositionMatchComparator } from './QueryStringPositionMatchComparator';
7
+ import { UsageFrequencyComparator } from './UsageFrequencyComparator';
8
+
9
+ /**
10
+ * Create the default sort comparator to be used for the user queries against emoji
11
+ *
12
+ * @param query the query used in the search to be sorted. Any colons will be stripped from the query and it will be
13
+ * converted to lowercase.
14
+ * @param orderedIds the id of emoji ordered by how frequently they are used
15
+ */
16
+ export function createSearchEmojiComparator(query, orderedIds) {
17
+ const textQuery = query ? query.replace(/:/g, '').toLowerCase().trim() : undefined;
18
+ const comparators = [];
19
+ if (query) {
20
+ comparators.push(new AsciiMatchComparator(query));
21
+ }
22
+
23
+ // Add the comparators to the 'chain'. The order of adding each comparator is important to the sort that is applied by the
24
+ // ChainedEmojiComparator. (Which is why you may see the same 'if' a few times.)
25
+
26
+ if (textQuery) {
27
+ comparators.push(new ExactShortNameMatchComparator(textQuery));
28
+ }
29
+ if (orderedIds && orderedIds.length) {
30
+ comparators.push(new UsageFrequencyComparator(orderedIds));
31
+ }
32
+ if (textQuery) {
33
+ comparators.push(new QueryStringPositionMatchComparator(textQuery, 'shortName'), new QueryStringPositionMatchComparator(textQuery, 'name'));
34
+ }
35
+ comparators.push(OrderComparator.Instance, AlphabeticalShortnameComparator.Instance);
36
+ const comparator = new ChainedEmojiComparator(...comparators);
37
+ comparator.compare = comparator.compare.bind(comparator);
38
+ return comparator;
39
+ }
@@ -0,0 +1,9 @@
1
+ import { ChainedEmojiComparator } from './ChainedEmojiComparator';
2
+ import { EmojiTypeComparator } from './EmojiTypeComparator';
3
+ import { OrderComparator } from './OrderComparator';
4
+ import { UsageFrequencyComparator } from './UsageFrequencyComparator';
5
+ export function createUsageOnlyEmojiComparator(orderedIds) {
6
+ const comparator = new ChainedEmojiComparator(new UsageFrequencyComparator(orderedIds), new EmojiTypeComparator(), OrderComparator.Instance);
7
+ comparator.compare = comparator.compare.bind(comparator);
8
+ return comparator;
9
+ }
@@ -0,0 +1 @@
1
+ export const isMediaApiUrl = (url, meta) => !!(meta && meta.mediaApiToken && url.indexOf(meta.mediaApiToken.url) === 0);
@@ -0,0 +1,66 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ import { isMediaRepresentation } from '../../util/is-media-representation';
3
+ import debug from '../../util/logger';
4
+ import { getRequiredRepresentation } from './getRequiredRepresentation';
5
+ const isUnsupportedBrowser = () => {
6
+ const isIE = /*@cc_on!@*/false || !!document.documentMode; // Internet Explorer 6-11
7
+ const isEdge = !isIE && !!window.StyleMedia; // Edge 20+
8
+
9
+ return isIE || isEdge;
10
+ };
11
+
12
+ /**
13
+ * For browsers that support caching for resources
14
+ * regardless of originally supplied headers (basically everything but Firefox).
15
+ */
16
+ export class BrowserCacheStrategy {
17
+ constructor(mediaImageLoader) {
18
+ _defineProperty(this, "cachedImageUrls", new Set());
19
+ debug('BrowserCacheStrategy');
20
+ this.mediaImageLoader = mediaImageLoader;
21
+ }
22
+ loadEmoji(emoji, useAlt) {
23
+ const representation = getRequiredRepresentation(emoji, useAlt);
24
+ if (!isMediaRepresentation(representation)) {
25
+ return emoji;
26
+ }
27
+ const {
28
+ mediaPath
29
+ } = representation;
30
+ if (this.cachedImageUrls.has(mediaPath)) {
31
+ // Already cached
32
+ return emoji;
33
+ }
34
+ return this.mediaImageLoader.loadMediaImage(mediaPath).then(() => {
35
+ // Media is loaded, can use original URL now, so just return original emoji
36
+ this.cachedImageUrls.add(mediaPath);
37
+ return emoji;
38
+ }).catch(() => {
39
+ return undefined;
40
+ });
41
+ }
42
+ optimisticRendering() {
43
+ return true;
44
+ }
45
+ static supported(mediaPath, mediaImageLoader) {
46
+ // IE/Edge uses memory cache strategy else images can fail to load
47
+ // from a clean cache/if they are downloaded from the service
48
+ // TODO: fix as a part of FS-1592
49
+ if (isUnsupportedBrowser()) {
50
+ return Promise.resolve(false);
51
+ }
52
+ return mediaImageLoader.loadMediaImage(mediaPath).then(() =>
53
+ // Image should be cached in browser, if supported it should be accessible from the cache by an <img/>
54
+ // Try to load without via image to confirm this support (this fails in Firefox)
55
+ new Promise(resolve => {
56
+ const img = new Image();
57
+ img.addEventListener('load', () => {
58
+ resolve(true);
59
+ });
60
+ img.addEventListener('error', () => {
61
+ resolve(false);
62
+ });
63
+ img.src = mediaPath;
64
+ })).catch(() => false);
65
+ }
66
+ }