@atlaskit/media-common 12.2.0 → 12.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/media-common
2
2
 
3
+ ## 12.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`df75f0a17ca69`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/df75f0a17ca69) -
8
+ Integrate web-search-ai endpoint to web search toggle
9
+
10
+ ## 12.3.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [#177492](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/177492)
15
+ [`d7167fba38657`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d7167fba38657) -
16
+ Added useStaticCallback hook to enable shared hook functionality
17
+
3
18
  ## 12.2.0
4
19
 
5
20
  ### Minor Changes
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/analytics/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/analytics/index.d.ts"
12
12
  ]
@@ -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
@@ -147,6 +147,12 @@ Object.defineProperty(exports, "pick", {
147
147
  return _helpers.pick;
148
148
  }
149
149
  });
150
+ Object.defineProperty(exports, "useStaticCallback", {
151
+ enumerable: true,
152
+ get: function get() {
153
+ return _hooks.useStaticCallback;
154
+ }
155
+ });
150
156
  Object.defineProperty(exports, "withMediaAnalyticsContext", {
151
157
  enumerable: true,
152
158
  get: function get() {
@@ -158,4 +164,5 @@ var _mediaFeatureFlags = require("./mediaFeatureFlags");
158
164
  var _withMediaAnalyticsContext = require("./analytics/withMediaAnalyticsContext");
159
165
  var _constants = require("./analytics/constants");
160
166
  var _mediaTypeUtils = require("./mediaTypeUtils");
161
- var _helpers = require("./utils/helpers");
167
+ var _helpers = require("./utils/helpers");
168
+ var _hooks = require("./hooks");
@@ -0,0 +1 @@
1
+ export { useStaticCallback } from './useStaticCallback';
@@ -0,0 +1,6 @@
1
+ import { useCallback, useRef } from 'react';
2
+ export const useStaticCallback = callback => {
3
+ const callbackRef = useRef(callback);
4
+ callbackRef.current = callback;
5
+ return useCallback((...args) => callbackRef.current(...args), []);
6
+ };
@@ -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, getRandomTelemetryId } 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, getRandomTelemetryId } from './utils/helpers';
18
+ export { isUndefined, pick, omitBy, debounce, matches, getRandomHex, getRandomTelemetryId } from './utils/helpers';
19
+ export { useStaticCallback } from './hooks';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type ContextPublicAttributes } from './types';
2
+ import { type ContextPublicAttributes, type ContextStaticProps } from './types';
3
3
  /**
4
4
  * HOC for attaching MediaAnalyticsContext to a top-level React Component.
5
5
  *
@@ -12,4 +12,4 @@ import { type ContextPublicAttributes } from './types';
12
12
  *
13
13
  * @see packages/analytics/analytics-next/src/hocs/withAnalyticsContext.tsx
14
14
  */
15
- export declare const withMediaAnalyticsContext: (contextPublicAttributes: ContextPublicAttributes) => <Props extends import("..").WithMediaFeatureFlags, Component extends React.ComponentType<Props>>(WrappedComponent: React.JSXElementConstructor<Props> & Component) => React.ForwardRefExoticComponent<React.PropsWithoutRef<JSX.LibraryManagedAttributes<Component, Props>> & React.RefAttributes<any>>;
15
+ export declare const withMediaAnalyticsContext: (contextPublicAttributes: ContextPublicAttributes) => <Props extends ContextStaticProps, Component extends React.ComponentType<Props>>(WrappedComponent: React.JSXElementConstructor<Props> & Component) => React.ForwardRefExoticComponent<React.PropsWithoutRef<JSX.LibraryManagedAttributes<Component, Props>> & React.RefAttributes<any>>;
@@ -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);
@@ -13,3 +13,4 @@ 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
15
  export { isUndefined, pick, omitBy, debounce, matches, getRandomHex, getRandomTelemetryId, } from './utils/helpers';
16
+ export { useStaticCallback } from './hooks';
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  interface MockedJest<F, S> {
3
2
  fn: (value?: F) => MockStub<F, F>;
4
3
  spyOn: () => MockStub<S, S>;
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  export declare const asMock: (fn: Function) => jest.Mock;
3
2
  export declare const asMockFunction: <T extends (...args: any[]) => any>(fn: T) => jest.MockedFunction<T>;
4
3
  export declare const asMockReturnValue: <T extends (...args: any[]) => any>(fn: T, returnValue: ReturnType<T>) => jest.Mock<any, any, any>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type ContextPublicAttributes } from './types';
2
+ import { type ContextPublicAttributes, type ContextStaticProps } from './types';
3
3
  /**
4
4
  * HOC for attaching MediaAnalyticsContext to a top-level React Component.
5
5
  *
@@ -12,4 +12,4 @@ import { type ContextPublicAttributes } from './types';
12
12
  *
13
13
  * @see packages/analytics/analytics-next/src/hocs/withAnalyticsContext.tsx
14
14
  */
15
- export declare const withMediaAnalyticsContext: (contextPublicAttributes: ContextPublicAttributes) => <Props extends import("..").WithMediaFeatureFlags, Component extends React.ComponentType<Props>>(WrappedComponent: React.JSXElementConstructor<Props> & Component) => React.ForwardRefExoticComponent<React.PropsWithoutRef<JSX.LibraryManagedAttributes<Component, Props>> & React.RefAttributes<any>>;
15
+ export declare const withMediaAnalyticsContext: (contextPublicAttributes: ContextPublicAttributes) => <Props extends ContextStaticProps, Component extends React.ComponentType<Props>>(WrappedComponent: React.JSXElementConstructor<Props> & Component) => React.ForwardRefExoticComponent<React.PropsWithoutRef<JSX.LibraryManagedAttributes<Component, Props>> & React.RefAttributes<any>>;
@@ -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);
@@ -13,3 +13,4 @@ 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
15
  export { isUndefined, pick, omitBy, debounce, matches, getRandomHex, getRandomTelemetryId, } from './utils/helpers';
16
+ export { useStaticCallback } from './hooks';
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  interface MockedJest<F, S> {
3
2
  fn: (value?: F) => MockStub<F, F>;
4
3
  spyOn: () => MockStub<S, S>;
@@ -1,4 +1,3 @@
1
- /// <reference types="jest" />
2
1
  export declare const asMock: (fn: Function) => jest.Mock;
3
2
  export declare const asMockFunction: <T extends (...args: any[]) => any>(fn: T) => jest.MockedFunction<T>;
4
3
  export declare const asMockReturnValue: <T extends (...args: any[]) => any>(fn: T, returnValue: ReturnType<T>) => jest.Mock<any, any, any>;
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/downloadUrl.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/downloadUrl.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/mediaFeatureFlags/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/mediaFeatureFlags/index.d.ts"
12
12
  ]
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/mediaTypeUtils/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/mediaTypeUtils/index.d.ts"
12
12
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-common",
3
- "version": "12.2.0",
3
+ "version": "12.3.1",
4
4
  "description": "Includes common utilities used by other media packages",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -22,29 +22,19 @@
22
22
  },
23
23
  "sideEffects": false,
24
24
  "atlaskit:src": "src/index.ts",
25
- "af:exports": {
26
- "./downloadUrl": "./src/downloadUrl.ts",
27
- "./mediaFeatureFlags": "./src/mediaFeatureFlags/index.ts",
28
- "./analytics": "./src/analytics/index.ts",
29
- "./docs": "./src/docs/index.ts",
30
- "./mediaTypeUtils": "./src/mediaTypeUtils/index.ts",
31
- "./test-helpers": "./src/test-helpers/index.ts",
32
- ".": "./src/index.ts"
33
- },
34
25
  "atlassian": {
35
26
  "team": "Media Exif",
36
27
  "website": {
37
28
  "name": "Media Common"
38
- },
39
- "runReact18": true
29
+ }
40
30
  },
41
31
  "dependencies": {
42
32
  "@atlaskit/analytics-gas-types": "^5.1.0",
43
- "@atlaskit/analytics-namespaced-context": "^7.0.0",
33
+ "@atlaskit/analytics-namespaced-context": "^7.1.0",
44
34
  "@atlaskit/analytics-next": "^11.1.0",
45
35
  "@atlaskit/link": "^3.2.0",
46
36
  "@atlaskit/platform-feature-flags": "^1.1.0",
47
- "@atlaskit/section-message": "^8.2.0",
37
+ "@atlaskit/section-message": "^8.7.0",
48
38
  "@babel/runtime": "^7.0.0",
49
39
  "immer": "^9.0.12",
50
40
  "uuid-validate": "^0.0.3"
@@ -63,8 +53,7 @@
63
53
  "@types/uuid-validate": "^0.0.2",
64
54
  "enzyme": "^3.10.0",
65
55
  "react": "^18.2.0",
66
- "react-dom": "^18.2.0",
67
- "typescript": "~5.4.2"
56
+ "react-dom": "^18.2.0"
68
57
  },
69
58
  "platform-feature-flags": {
70
59
  "dst-a11y__replace-anchor-with-link__media-exif": {
@@ -6,7 +6,7 @@
6
6
  "sideEffects": false,
7
7
  "types": "../dist/types/test-helpers/index.d.ts",
8
8
  "typesVersions": {
9
- ">=4.5 <5.4": {
9
+ ">=4.5 <5.9": {
10
10
  "*": [
11
11
  "../dist/types-ts4.5/test-helpers/index.d.ts"
12
12
  ]