@atlaskit/emoji 71.15.17 → 71.16.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/AGENTS.md +19 -0
- package/CHANGELOG.md +14 -0
- package/dist/cjs/api/media/SiteEmojiResource.js +28 -3
- package/dist/cjs/util/analytics/analytics.js +1 -1
- package/dist/es2019/api/media/SiteEmojiResource.js +27 -1
- package/dist/es2019/util/analytics/analytics.js +1 -1
- package/dist/esm/api/media/SiteEmojiResource.js +27 -2
- package/dist/esm/util/analytics/analytics.js +1 -1
- package/dist/types/api/media/SiteEmojiResource.d.ts +1 -0
- package/package.json +6 -3
package/AGENTS.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Emoji Package
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
|
|
5
|
+
This guide applies to work under `platform/packages/elements/emoji/**`.
|
|
6
|
+
|
|
7
|
+
This package is a shared platform for interacting with Emoji and is used by multiple products.
|
|
8
|
+
|
|
9
|
+
## Coding standards
|
|
10
|
+
|
|
11
|
+
- ⛔ ** Avoid adding product specific behaviour to the components **. As this is a platform
|
|
12
|
+
component we should prefer that users of the platform component control how the components behave.
|
|
13
|
+
- A11Y fixes should be made in a platform component manner
|
|
14
|
+
|
|
15
|
+
## Feature gating
|
|
16
|
+
|
|
17
|
+
- Changes should be behind a feature gate/experiment
|
|
18
|
+
- Target apps for the gate/experiment should include: `confluence_web`, `jira_web`, `atlas_web`,
|
|
19
|
+
`mercury_frontend_web`, `post-office_web`
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/emoji
|
|
2
2
|
|
|
3
|
+
## 71.16.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`ef1f56f6c307e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ef1f56f6c307e) -
|
|
8
|
+
Gated behind `add_emoji_media_size_to_media_file_upload_request`, emoji uploads pass file size to
|
|
9
|
+
media upload requests when enabled.
|
|
10
|
+
|
|
11
|
+
## 71.15.18
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 71.15.17
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.mediaProportionOfProgress = exports.default = void 0;
|
|
7
|
+
exports.mediaProportionOfProgress = exports.getDataUrlSizeInBytes = exports.default = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
@@ -14,6 +14,7 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
var _utilServiceSupport = require("@atlaskit/util-service-support");
|
|
16
16
|
var _mediaClientReact = require("@atlaskit/media-client-react");
|
|
17
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
17
18
|
var _typeHelpers = require("../../util/type-helpers");
|
|
18
19
|
var _MediaEmojiCache = _interopRequireDefault(require("./MediaEmojiCache"));
|
|
19
20
|
var _EmojiUtils = require("../EmojiUtils");
|
|
@@ -24,6 +25,27 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
24
25
|
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) { (0, _defineProperty2.default)(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; }
|
|
25
26
|
// Assume media is 95% of total upload time.
|
|
26
27
|
var mediaProportionOfProgress = exports.mediaProportionOfProgress = 95 / 100;
|
|
28
|
+
var getDataUrlSizeInBytes = exports.getDataUrlSizeInBytes = function getDataUrlSizeInBytes(dataURL) {
|
|
29
|
+
var separatorIndex = dataURL.indexOf(',');
|
|
30
|
+
if (separatorIndex === -1) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
var metadata = dataURL.slice(0, separatorIndex);
|
|
34
|
+
var data = dataURL.slice(separatorIndex + 1);
|
|
35
|
+
if (!data) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
if (metadata.includes(';base64')) {
|
|
39
|
+
var _data$match;
|
|
40
|
+
var padding = ((_data$match = data.match(/=*$/)) === null || _data$match === void 0 ? void 0 : _data$match[0].length) || 0;
|
|
41
|
+
return Math.floor(data.length * 3 / 4) - padding;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
return new TextEncoder().encode(decodeURIComponent(data)).length;
|
|
45
|
+
} catch (_unused) {
|
|
46
|
+
return data.length;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
27
49
|
var SiteEmojiResource = exports.default = /*#__PURE__*/function () {
|
|
28
50
|
// @ts-ignore: I am not being read from, should I be deleted???
|
|
29
51
|
|
|
@@ -188,11 +210,14 @@ var SiteEmojiResource = exports.default = /*#__PURE__*/function () {
|
|
|
188
210
|
},
|
|
189
211
|
useSha256ForUploads: true
|
|
190
212
|
});
|
|
191
|
-
var
|
|
213
|
+
var size = (0, _fg.fg)('add_emoji_media_size_to_media_file_upload_request') ? getDataUrlSizeInBytes(upload.dataURL) : undefined;
|
|
214
|
+
var subscription = mediaClient.file.upload(_objectSpread({
|
|
192
215
|
content: upload.dataURL,
|
|
193
216
|
name: upload.filename,
|
|
194
217
|
collection: collectionName
|
|
195
|
-
}
|
|
218
|
+
}, size !== undefined ? {
|
|
219
|
+
size: size
|
|
220
|
+
} : {})).subscribe({
|
|
196
221
|
next: function next(state) {
|
|
197
222
|
if (state.status === 'uploading' && progressCallback) {
|
|
198
223
|
progressCallback({
|
|
@@ -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.15.
|
|
23
|
+
packageVersion: "71.15.18"
|
|
24
24
|
}, attributes)
|
|
25
25
|
};
|
|
26
26
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { utils as serviceUtils } from '@atlaskit/util-service-support';
|
|
3
3
|
import { getMediaClient } from '@atlaskit/media-client-react';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
5
|
import { buildEmojiDescriptionWithAltRepresentation, isMediaRepresentation, isMediaEmoji, convertImageToMediaRepresentation, isLoadedMediaEmoji } from '../../util/type-helpers';
|
|
5
6
|
import MediaEmojiCache from './MediaEmojiCache';
|
|
6
7
|
import { denormaliseEmojiServiceResponse, emojiRequest, getAltRepresentation } from '../EmojiUtils';
|
|
@@ -8,6 +9,27 @@ import TokenManager from './TokenManager';
|
|
|
8
9
|
import debug from '../../util/logger';
|
|
9
10
|
// Assume media is 95% of total upload time.
|
|
10
11
|
export const mediaProportionOfProgress = 95 / 100;
|
|
12
|
+
export const getDataUrlSizeInBytes = dataURL => {
|
|
13
|
+
const separatorIndex = dataURL.indexOf(',');
|
|
14
|
+
if (separatorIndex === -1) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const metadata = dataURL.slice(0, separatorIndex);
|
|
18
|
+
const data = dataURL.slice(separatorIndex + 1);
|
|
19
|
+
if (!data) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
if (metadata.includes(';base64')) {
|
|
23
|
+
var _data$match;
|
|
24
|
+
const padding = ((_data$match = data.match(/=*$/)) === null || _data$match === void 0 ? void 0 : _data$match[0].length) || 0;
|
|
25
|
+
return Math.floor(data.length * 3 / 4) - padding;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
return new TextEncoder().encode(decodeURIComponent(data)).length;
|
|
29
|
+
} catch {
|
|
30
|
+
return data.length;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
11
33
|
export default class SiteEmojiResource {
|
|
12
34
|
// @ts-ignore: I am not being read from, should I be deleted???
|
|
13
35
|
|
|
@@ -145,10 +167,14 @@ export default class SiteEmojiResource {
|
|
|
145
167
|
}),
|
|
146
168
|
useSha256ForUploads: true
|
|
147
169
|
});
|
|
170
|
+
const size = fg('add_emoji_media_size_to_media_file_upload_request') ? getDataUrlSizeInBytes(upload.dataURL) : undefined;
|
|
148
171
|
const subscription = mediaClient.file.upload({
|
|
149
172
|
content: upload.dataURL,
|
|
150
173
|
name: upload.filename,
|
|
151
|
-
collection: collectionName
|
|
174
|
+
collection: collectionName,
|
|
175
|
+
...(size !== undefined ? {
|
|
176
|
+
size
|
|
177
|
+
} : {})
|
|
152
178
|
}).subscribe({
|
|
153
179
|
next: state => {
|
|
154
180
|
if (state.status === 'uploading' && progressCallback) {
|
|
@@ -10,6 +10,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
10
10
|
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; }
|
|
11
11
|
import { utils as serviceUtils } from '@atlaskit/util-service-support';
|
|
12
12
|
import { getMediaClient } from '@atlaskit/media-client-react';
|
|
13
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
13
14
|
import { buildEmojiDescriptionWithAltRepresentation, isMediaRepresentation, isMediaEmoji, convertImageToMediaRepresentation, isLoadedMediaEmoji } from '../../util/type-helpers';
|
|
14
15
|
import MediaEmojiCache from './MediaEmojiCache';
|
|
15
16
|
import { denormaliseEmojiServiceResponse, emojiRequest, getAltRepresentation } from '../EmojiUtils';
|
|
@@ -17,6 +18,27 @@ import TokenManager from './TokenManager';
|
|
|
17
18
|
import debug from '../../util/logger';
|
|
18
19
|
// Assume media is 95% of total upload time.
|
|
19
20
|
export var mediaProportionOfProgress = 95 / 100;
|
|
21
|
+
export var getDataUrlSizeInBytes = function getDataUrlSizeInBytes(dataURL) {
|
|
22
|
+
var separatorIndex = dataURL.indexOf(',');
|
|
23
|
+
if (separatorIndex === -1) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
var metadata = dataURL.slice(0, separatorIndex);
|
|
27
|
+
var data = dataURL.slice(separatorIndex + 1);
|
|
28
|
+
if (!data) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
if (metadata.includes(';base64')) {
|
|
32
|
+
var _data$match;
|
|
33
|
+
var padding = ((_data$match = data.match(/=*$/)) === null || _data$match === void 0 ? void 0 : _data$match[0].length) || 0;
|
|
34
|
+
return Math.floor(data.length * 3 / 4) - padding;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
return new TextEncoder().encode(decodeURIComponent(data)).length;
|
|
38
|
+
} catch (_unused) {
|
|
39
|
+
return data.length;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
20
42
|
var SiteEmojiResource = /*#__PURE__*/function () {
|
|
21
43
|
// @ts-ignore: I am not being read from, should I be deleted???
|
|
22
44
|
|
|
@@ -181,11 +203,14 @@ var SiteEmojiResource = /*#__PURE__*/function () {
|
|
|
181
203
|
},
|
|
182
204
|
useSha256ForUploads: true
|
|
183
205
|
});
|
|
184
|
-
var
|
|
206
|
+
var size = fg('add_emoji_media_size_to_media_file_upload_request') ? getDataUrlSizeInBytes(upload.dataURL) : undefined;
|
|
207
|
+
var subscription = mediaClient.file.upload(_objectSpread({
|
|
185
208
|
content: upload.dataURL,
|
|
186
209
|
name: upload.filename,
|
|
187
210
|
collection: collectionName
|
|
188
|
-
}
|
|
211
|
+
}, size !== undefined ? {
|
|
212
|
+
size: size
|
|
213
|
+
} : {})).subscribe({
|
|
189
214
|
next: function next(state) {
|
|
190
215
|
if (state.status === 'uploading' && progressCallback) {
|
|
191
216
|
progressCallback({
|
|
@@ -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.15.
|
|
17
|
+
packageVersion: "71.15.18"
|
|
18
18
|
}, attributes)
|
|
19
19
|
};
|
|
20
20
|
};
|
|
@@ -15,6 +15,7 @@ type TokenisedEmojiRepresentation = {
|
|
|
15
15
|
representation?: EmojiRepresentation;
|
|
16
16
|
};
|
|
17
17
|
export declare const mediaProportionOfProgress: number;
|
|
18
|
+
export declare const getDataUrlSizeInBytes: (dataURL: string) => number | undefined;
|
|
18
19
|
export default class SiteEmojiResource {
|
|
19
20
|
private siteServiceConfig;
|
|
20
21
|
private mediaApiToken;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/emoji",
|
|
3
|
-
"version": "71.
|
|
3
|
+
"version": "71.16.0",
|
|
4
4
|
"description": "Fabric emoji React components",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"@atlaskit/spinner": "^20.1.0",
|
|
51
51
|
"@atlaskit/textfield": "^10.0.0",
|
|
52
52
|
"@atlaskit/theme": "^28.0.0",
|
|
53
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
54
|
-
"@atlaskit/tokens": "^16.
|
|
53
|
+
"@atlaskit/tmp-editor-statsig": "^145.0.0",
|
|
54
|
+
"@atlaskit/tokens": "^16.5.0",
|
|
55
55
|
"@atlaskit/tooltip": "^24.0.0",
|
|
56
56
|
"@atlaskit/ufo": "^1.0.0",
|
|
57
57
|
"@atlaskit/util-service-support": "^7.2.0",
|
|
@@ -134,6 +134,9 @@
|
|
|
134
134
|
"platform_emoji_keep_picker_open_on_upload": {
|
|
135
135
|
"type": "boolean"
|
|
136
136
|
},
|
|
137
|
+
"add_emoji_media_size_to_media_file_upload_request": {
|
|
138
|
+
"type": "boolean"
|
|
139
|
+
},
|
|
137
140
|
"use-elements-stargate-emoji-path": {
|
|
138
141
|
"type": "boolean"
|
|
139
142
|
},
|