@atlaskit/link-picker 1.12.0 → 1.13.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/link-picker
2
2
 
3
+ ## 1.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`91bd9e3193c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/91bd9e3193c) - add experimental support for UNSAFE_onActivation call for plugins
8
+
3
9
  ## 1.12.0
4
10
 
5
11
  ### Minor Changes
@@ -43,7 +43,13 @@ function usePlugins(state, activeTab, plugins) {
43
43
  pluginState = _usePluginReducer2[0],
44
44
  dispatch = _usePluginReducer2[1];
45
45
 
46
- var activePlugin = plugins === null || plugins === void 0 ? void 0 : plugins[activeTab];
46
+ var activePlugin = plugins === null || plugins === void 0 ? void 0 : plugins[activeTab]; // This useEffect block must be called before any other to ensure onActivation is fired at before resolve
47
+
48
+ (0, _react.useEffect)(function () {
49
+ if (activePlugin && activePlugin.UNSAFE_onActivation) {
50
+ activePlugin.UNSAFE_onActivation();
51
+ }
52
+ }, [activePlugin]);
47
53
  (0, _react.useEffect)(function () {
48
54
  if (!activePlugin) {
49
55
  return;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "sideEffects": false
5
5
  }
@@ -12,7 +12,13 @@ export function usePlugins(state, activeTab, plugins) {
12
12
  } = useAnalyticsEvents();
13
13
  const [retries, setRetries] = useState(0);
14
14
  const [pluginState, dispatch] = usePluginReducer();
15
- const activePlugin = plugins === null || plugins === void 0 ? void 0 : plugins[activeTab];
15
+ const activePlugin = plugins === null || plugins === void 0 ? void 0 : plugins[activeTab]; // This useEffect block must be called before any other to ensure onActivation is fired at before resolve
16
+
17
+ useEffect(() => {
18
+ if (activePlugin && activePlugin.UNSAFE_onActivation) {
19
+ activePlugin.UNSAFE_onActivation();
20
+ }
21
+ }, [activePlugin]);
16
22
  useEffect(() => {
17
23
  if (!activePlugin) {
18
24
  return;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "sideEffects": false
5
5
  }
@@ -23,7 +23,13 @@ export function usePlugins(state, activeTab, plugins) {
23
23
  pluginState = _usePluginReducer2[0],
24
24
  dispatch = _usePluginReducer2[1];
25
25
 
26
- var activePlugin = plugins === null || plugins === void 0 ? void 0 : plugins[activeTab];
26
+ var activePlugin = plugins === null || plugins === void 0 ? void 0 : plugins[activeTab]; // This useEffect block must be called before any other to ensure onActivation is fired at before resolve
27
+
28
+ useEffect(function () {
29
+ if (activePlugin && activePlugin.UNSAFE_onActivation) {
30
+ activePlugin.UNSAFE_onActivation();
31
+ }
32
+ }, [activePlugin]);
27
33
  useEffect(function () {
28
34
  if (!activePlugin) {
29
35
  return;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "sideEffects": false
5
5
  }
@@ -53,5 +53,7 @@ export interface LinkPickerPlugin {
53
53
  /** The data source that provides all results provided by the plugin */
54
54
  source?: string;
55
55
  };
56
+ /** Callback for plugin activation */
57
+ UNSAFE_onActivation?: () => void;
56
58
  }
57
59
  export declare type LinkPickerPluginErrorFallback = (error: unknown, retry: () => void) => ReactNode;
@@ -53,5 +53,7 @@ export interface LinkPickerPlugin {
53
53
  /** The data source that provides all results provided by the plugin */
54
54
  source?: string;
55
55
  };
56
+ /** Callback for plugin activation */
57
+ UNSAFE_onActivation?: () => void;
56
58
  }
57
59
  export declare type LinkPickerPluginErrorFallback = (error: unknown, retry: () => void) => ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-picker",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Standalone link picker",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "publishConfig": {
@@ -80,8 +80,8 @@
80
80
  "@atlaskit/visual-regression": "*",
81
81
  "@atlaskit/webdriver-runner": "*",
82
82
  "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
83
- "@atlassian/link-picker-atlassian-plugin": "^22.0.0",
84
- "@atlassian/link-picker-plugins": "^10.0.0",
83
+ "@atlassian/link-picker-atlassian-plugin": "^23.0.0",
84
+ "@atlassian/link-picker-plugins": "^11.0.0",
85
85
  "@atlassian/recent-work-client": "^1.6.0",
86
86
  "@atlassian/search-provider": "^2.3.0",
87
87
  "@testing-library/dom": "^8.17.1",
package/report.api.md CHANGED
@@ -41,6 +41,7 @@ export interface LinkPickerPlugin {
41
41
  ) => AsyncGenerator<ResolveResult, ResolveResult> | Promise<ResolveResult>;
42
42
  tabKey?: string;
43
43
  tabTitle?: string;
44
+ UNSAFE_onActivation?: () => void;
44
45
  }
45
46
 
46
47
  // @public (undocumented)
@@ -27,6 +27,7 @@ export interface LinkPickerPlugin {
27
27
  resolve: (state: LinkPickerState) => AsyncGenerator<ResolveResult, ResolveResult> | Promise<ResolveResult>;
28
28
  tabKey?: string;
29
29
  tabTitle?: string;
30
+ UNSAFE_onActivation?: () => void;
30
31
  }
31
32
 
32
33
  // @public (undocumented)