@atlaskit/media-common 12.1.0 → 12.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/analytics/withMediaAnalyticsContext.js +1 -2
- package/dist/cjs/hooks/index.js +12 -0
- package/dist/cjs/hooks/useStaticCallback.js +14 -0
- package/dist/cjs/index.js +14 -1
- package/dist/cjs/test-helpers/flushPromises.js +1 -0
- package/dist/cjs/utils/helpers.js +4 -0
- package/dist/es2019/hooks/index.js +1 -0
- package/dist/es2019/hooks/useStaticCallback.js +6 -0
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/test-helpers/flushPromises.js +1 -0
- package/dist/es2019/utils/helpers.js +3 -0
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/useStaticCallback.js +8 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/test-helpers/flushPromises.js +1 -0
- package/dist/esm/utils/helpers.js +3 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useStaticCallback.d.ts +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/utils/helpers.d.ts +2 -1
- package/dist/types-ts4.5/hooks/index.d.ts +1 -0
- package/dist/types-ts4.5/hooks/useStaticCallback.d.ts +1 -0
- package/dist/types-ts4.5/index.d.ts +2 -1
- package/dist/types-ts4.5/utils/helpers.d.ts +2 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/media-common
|
|
2
2
|
|
|
3
|
+
## 12.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#177492](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/177492)
|
|
8
|
+
[`d7167fba38657`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d7167fba38657) -
|
|
9
|
+
Added useStaticCallback hook to enable shared hook functionality
|
|
10
|
+
|
|
11
|
+
## 12.2.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#169848](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/169848)
|
|
16
|
+
[`0c2daefdb5712`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0c2daefdb5712) -
|
|
17
|
+
Standardise generation of telemetry IDs across media packages.
|
|
18
|
+
|
|
3
19
|
## 12.1.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -11,8 +11,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
13
13
|
var _MediaAnalyticsContext = require("@atlaskit/analytics-namespaced-context/MediaAnalyticsContext");
|
|
14
|
-
function
|
|
15
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
16
15
|
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; }
|
|
17
16
|
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; }
|
|
18
17
|
/**
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "useStaticCallback", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _useStaticCallback.useStaticCallback;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _useStaticCallback = require("./useStaticCallback");
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useStaticCallback = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var useStaticCallback = exports.useStaticCallback = function useStaticCallback(callback) {
|
|
9
|
+
var callbackRef = (0, _react.useRef)(callback);
|
|
10
|
+
callbackRef.current = callback;
|
|
11
|
+
return (0, _react.useCallback)(function () {
|
|
12
|
+
return callbackRef.current.apply(callbackRef, arguments);
|
|
13
|
+
}, []);
|
|
14
|
+
};
|
package/dist/cjs/index.js
CHANGED
|
@@ -57,6 +57,12 @@ Object.defineProperty(exports, "getRandomHex", {
|
|
|
57
57
|
return _helpers.getRandomHex;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
+
Object.defineProperty(exports, "getRandomTelemetryId", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function get() {
|
|
63
|
+
return _helpers.getRandomTelemetryId;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
60
66
|
Object.defineProperty(exports, "isAudioMimeTypeSupportedByServer", {
|
|
61
67
|
enumerable: true,
|
|
62
68
|
get: function get() {
|
|
@@ -141,6 +147,12 @@ Object.defineProperty(exports, "pick", {
|
|
|
141
147
|
return _helpers.pick;
|
|
142
148
|
}
|
|
143
149
|
});
|
|
150
|
+
Object.defineProperty(exports, "useStaticCallback", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function get() {
|
|
153
|
+
return _hooks.useStaticCallback;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
144
156
|
Object.defineProperty(exports, "withMediaAnalyticsContext", {
|
|
145
157
|
enumerable: true,
|
|
146
158
|
get: function get() {
|
|
@@ -152,4 +164,5 @@ var _mediaFeatureFlags = require("./mediaFeatureFlags");
|
|
|
152
164
|
var _withMediaAnalyticsContext = require("./analytics/withMediaAnalyticsContext");
|
|
153
165
|
var _constants = require("./analytics/constants");
|
|
154
166
|
var _mediaTypeUtils = require("./mediaTypeUtils");
|
|
155
|
-
var _helpers = require("./utils/helpers");
|
|
167
|
+
var _helpers = require("./utils/helpers");
|
|
168
|
+
var _hooks = require("./hooks");
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.flushPromises = void 0;
|
|
7
7
|
/** deprecated Use React Testing Library's waitFor like method instead */
|
|
8
|
+
// eslint-disable-next-line @atlaskit/platform/no-set-immediate
|
|
8
9
|
var flushPromises = exports.flushPromises = function flushPromises() {
|
|
9
10
|
return new Promise(function (resolve) {
|
|
10
11
|
return setImmediate(resolve);
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.debounce = void 0;
|
|
8
8
|
exports.getRandomHex = getRandomHex;
|
|
9
|
+
exports.getRandomTelemetryId = getRandomTelemetryId;
|
|
9
10
|
exports.pick = exports.omitBy = exports.matches = exports.isUndefined = void 0;
|
|
10
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -73,4 +74,7 @@ function getRandomHex(byte) {
|
|
|
73
74
|
randomHex = getRandomHexValues(byte);
|
|
74
75
|
}
|
|
75
76
|
return randomHex;
|
|
77
|
+
}
|
|
78
|
+
function getRandomTelemetryId() {
|
|
79
|
+
return getRandomHex(8);
|
|
76
80
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useStaticCallback } from './useStaticCallback';
|
package/dist/es2019/index.js
CHANGED
|
@@ -15,4 +15,5 @@ export { withMediaAnalyticsContext } from './analytics/withMediaAnalyticsContext
|
|
|
15
15
|
// Analytics constants
|
|
16
16
|
export { ANALYTICS_MEDIA_CHANNEL } from './analytics/constants';
|
|
17
17
|
export { getMediaTypeFromMimeType, isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer } from './mediaTypeUtils';
|
|
18
|
-
export { isUndefined, pick, omitBy, debounce, matches, getRandomHex } from './utils/helpers';
|
|
18
|
+
export { isUndefined, pick, omitBy, debounce, matches, getRandomHex, getRandomTelemetryId } from './utils/helpers';
|
|
19
|
+
export { useStaticCallback } from './hooks';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useStaticCallback } from './useStaticCallback';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
|
+
export var useStaticCallback = function useStaticCallback(callback) {
|
|
3
|
+
var callbackRef = useRef(callback);
|
|
4
|
+
callbackRef.current = callback;
|
|
5
|
+
return useCallback(function () {
|
|
6
|
+
return callbackRef.current.apply(callbackRef, arguments);
|
|
7
|
+
}, []);
|
|
8
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -15,4 +15,5 @@ export { withMediaAnalyticsContext } from './analytics/withMediaAnalyticsContext
|
|
|
15
15
|
// Analytics constants
|
|
16
16
|
export { ANALYTICS_MEDIA_CHANNEL } from './analytics/constants';
|
|
17
17
|
export { getMediaTypeFromMimeType, isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer } from './mediaTypeUtils';
|
|
18
|
-
export { isUndefined, pick, omitBy, debounce, matches, getRandomHex } from './utils/helpers';
|
|
18
|
+
export { isUndefined, pick, omitBy, debounce, matches, getRandomHex, getRandomTelemetryId } from './utils/helpers';
|
|
19
|
+
export { useStaticCallback } from './hooks';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useStaticCallback } from './useStaticCallback';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStaticCallback: <Params extends any[], Result>(callback: (...args: Params) => Result) => (...args: Params) => Result;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -12,4 +12,5 @@ export { withMediaAnalyticsContext } from './analytics/withMediaAnalyticsContext
|
|
|
12
12
|
export { ANALYTICS_MEDIA_CHANNEL } from './analytics/constants';
|
|
13
13
|
export { getMediaTypeFromMimeType, isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer, } from './mediaTypeUtils';
|
|
14
14
|
export type SSR = 'client' | 'server';
|
|
15
|
-
export { isUndefined, pick, omitBy, debounce, matches, getRandomHex } from './utils/helpers';
|
|
15
|
+
export { isUndefined, pick, omitBy, debounce, matches, getRandomHex, getRandomTelemetryId, } from './utils/helpers';
|
|
16
|
+
export { useStaticCallback } from './hooks';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const isUndefined: (value: any) => boolean;
|
|
2
|
-
export declare const pick: (obj?: Object, keys?: Array<
|
|
2
|
+
export declare const pick: (obj?: Object, keys?: Array<string>) => {
|
|
3
3
|
[k: string]: any;
|
|
4
4
|
};
|
|
5
5
|
export declare const omitBy: (obj: Object, predicate: Function) => {
|
|
@@ -8,3 +8,4 @@ export declare const omitBy: (obj: Object, predicate: Function) => {
|
|
|
8
8
|
export declare const debounce: (func: Function, wait: number) => (...args: any[]) => void;
|
|
9
9
|
export declare const matches: (srcObj: Object) => (obj: Object) => boolean;
|
|
10
10
|
export declare function getRandomHex(byte: number): string;
|
|
11
|
+
export declare function getRandomTelemetryId(): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useStaticCallback } from './useStaticCallback';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useStaticCallback: <Params extends any[], Result>(callback: (...args: Params) => Result) => (...args: Params) => Result;
|
|
@@ -12,4 +12,5 @@ export { withMediaAnalyticsContext } from './analytics/withMediaAnalyticsContext
|
|
|
12
12
|
export { ANALYTICS_MEDIA_CHANNEL } from './analytics/constants';
|
|
13
13
|
export { getMediaTypeFromMimeType, isImageMimeTypeSupportedByBrowser, isDocumentMimeTypeSupportedByBrowser, isVideoMimeTypeSupportedByBrowser, isMimeTypeSupportedByBrowser, isImageMimeTypeSupportedByServer, isDocumentMimeTypeSupportedByServer, isAudioMimeTypeSupportedByServer, isVideoMimeTypeSupportedByServer, isUnknownMimeTypeSupportedByServer, isMimeTypeSupportedByServer, } from './mediaTypeUtils';
|
|
14
14
|
export type SSR = 'client' | 'server';
|
|
15
|
-
export { isUndefined, pick, omitBy, debounce, matches, getRandomHex } from './utils/helpers';
|
|
15
|
+
export { isUndefined, pick, omitBy, debounce, matches, getRandomHex, getRandomTelemetryId, } from './utils/helpers';
|
|
16
|
+
export { useStaticCallback } from './hooks';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const isUndefined: (value: any) => boolean;
|
|
2
|
-
export declare const pick: (obj?: Object, keys?: Array<
|
|
2
|
+
export declare const pick: (obj?: Object, keys?: Array<string>) => {
|
|
3
3
|
[k: string]: any;
|
|
4
4
|
};
|
|
5
5
|
export declare const omitBy: (obj: Object, predicate: Function) => {
|
|
@@ -8,3 +8,4 @@ export declare const omitBy: (obj: Object, predicate: Function) => {
|
|
|
8
8
|
export declare const debounce: (func: Function, wait: number) => (...args: any[]) => void;
|
|
9
9
|
export declare const matches: (srcObj: Object) => (obj: Object) => boolean;
|
|
10
10
|
export declare function getRandomHex(byte: number): string;
|
|
11
|
+
export declare function getRandomTelemetryId(): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-common",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.3.0",
|
|
4
4
|
"description": "Includes common utilities used by other media packages",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
43
43
|
"@atlaskit/analytics-namespaced-context": "^7.0.0",
|
|
44
|
-
"@atlaskit/analytics-next": "^11.
|
|
44
|
+
"@atlaskit/analytics-next": "^11.1.0",
|
|
45
45
|
"@atlaskit/link": "^3.2.0",
|
|
46
46
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
47
47
|
"@atlaskit/section-message": "^8.2.0",
|