@forge/bridge 5.9.0-next.9-experimental-4bd2ca0 → 5.9.1-experimental-3311bec

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,26 +1,112 @@
1
1
  # @forge/bridge
2
2
 
3
- ## 5.9.0-next.9-experimental-4bd2ca0
3
+ ## 5.9.1-experimental-3311bec
4
4
 
5
5
  ### Minor Changes
6
6
 
7
+ - 95a9af8: Add public event methods to Events API. These allow events to be emitted between Forge apps on the same page.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [c7544d8]
12
+ - @forge/manifest@11.2.0-experimental-3311bec
13
+
14
+ ## 5.9.1
15
+
16
+ ### Patch Changes
17
+
18
+ - bb3d4a7: Fix iframe resizer in create adf renderer iframe props
19
+ - Updated dependencies [29741cf]
20
+ - Updated dependencies [0c31fcd]
21
+ - Updated dependencies [0c31fcd]
22
+ - Updated dependencies [354f5d1]
23
+ - Updated dependencies [09bdcf1]
24
+ - @forge/manifest@11.2.0
25
+
26
+ ## 5.9.1-next.3
27
+
28
+ ### Patch Changes
29
+
30
+ - Updated dependencies [0c31fcd]
31
+ - Updated dependencies [0c31fcd]
32
+ - @forge/manifest@11.2.0-next.2
33
+
34
+ ## 5.9.1-next.2
35
+
36
+ ### Patch Changes
37
+
38
+ - Updated dependencies [09bdcf1]
39
+ - @forge/manifest@11.1.1-next.1
40
+
41
+ ## 5.9.1-next.1
42
+
43
+ ### Patch Changes
44
+
45
+ - Updated dependencies [29741cf]
46
+ - Updated dependencies [354f5d1]
47
+ - @forge/manifest@11.1.1-next.0
48
+
49
+ ## 5.9.1-next.0
50
+
51
+ ### Patch Changes
52
+
53
+ - bb3d4a7: Fix iframe resizer in create adf renderer iframe props
54
+
55
+ ## 5.9.0
56
+
57
+ ### Minor Changes
58
+
59
+ - d211acd: Add iframe resizer support in forge adf renderer bridge package
7
60
  - 63997f2: Add requestRemote API to the Forge bridge
8
61
  - dc95e42: Add adf renderer wrapper function
9
62
  - 34aea87: Add support for rovo open bridge api
10
63
 
11
64
  ### Patch Changes
12
65
 
66
+ - 4acf2e9: Change createAdfRendererIframeProps param to accept the full product context.
13
67
  - Updated dependencies [559c541]
14
68
  - Updated dependencies [b5f0775]
69
+ - Updated dependencies [af4af6f]
15
70
  - Updated dependencies [2f0c3c2]
71
+ - Updated dependencies [c50eeb5]
72
+ - Updated dependencies [beefc94]
16
73
  - Updated dependencies [00eaa35]
17
74
  - Updated dependencies [b9cefff]
18
75
  - Updated dependencies [b5f0775]
19
76
  - Updated dependencies [069288e]
20
77
  - Updated dependencies [d317f2e]
21
78
  - Updated dependencies [bf0e0f6]
79
+ - Updated dependencies [af4af6f]
22
80
  - Updated dependencies [bb6e58a]
23
- - @forge/manifest@11.1.0-next.6-experimental-4bd2ca0
81
+ - @forge/manifest@11.1.0
82
+
83
+ ## 5.9.0-next.13
84
+
85
+ ### Patch Changes
86
+
87
+ - Updated dependencies [c50eeb5]
88
+ - Updated dependencies [beefc94]
89
+ - @forge/manifest@11.1.0-next.8
90
+
91
+ ## 5.9.0-next.12
92
+
93
+ ### Patch Changes
94
+
95
+ - Updated dependencies [af4af6f]
96
+ - Updated dependencies [af4af6f]
97
+ - @forge/manifest@11.1.0-next.7
98
+
99
+ ## 5.9.0-next.11
100
+
101
+ ### Patch Changes
102
+
103
+ - 4acf2e9: Change createAdfRendererIframeProps param to accept the full product context.
104
+
105
+ ## 5.9.0-next.10
106
+
107
+ ### Minor Changes
108
+
109
+ - d211acd: Add iframe resizer support in forge adf renderer bridge package
24
110
 
25
111
  ## 5.9.0-next.9
26
112
 
@@ -1,6 +1,10 @@
1
1
  import { Subscription } from '../types';
2
2
  export declare const events: {
3
3
  emit: (event: string, payload?: any) => Promise<void>;
4
+ emitPublic: (event: string, payload?: any, options?: {
5
+ allowedRecipients: string[];
6
+ }) => Promise<void>;
4
7
  on: (event: string, callback: (payload?: any) => any) => Promise<Subscription>;
8
+ onPublic: (event: string, callback: (payload?: any) => any) => Promise<Subscription>;
5
9
  };
6
10
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/events/events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AA8BxC,eAAO,MAAM,MAAM;kBApBQ,MAAM,YAAY,GAAG,KAAG,QAAQ,IAAI,CAAC;gBAQ7C,MAAM,uBAAuB,GAAG,KAAK,GAAG,KAAG,QAAQ,YAAY,CAAC;CAelF,CAAC"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/events/events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AA4CxC,eAAO,MAAM,MAAM;kBAxBQ,MAAM,YAAY,GAAG,KAAG,QAAQ,IAAI,CAAC;wBAQ/B,MAAM,YAAY,GAAG,YAAY;QAAE,iBAAiB,EAAE,MAAM,EAAE,CAAA;KAAE,KAAG,QAAQ,IAAI,CAAC;gBAQ9F,MAAM,uBAAuB,GAAG,KAAK,GAAG,KAAG,QAAQ,YAAY,CAAC;sBAI1D,MAAM,uBAAuB,GAAG,KAAK,GAAG,KAAG,QAAQ,YAAY,CAAC;CASxF,CAAC"}
@@ -4,6 +4,15 @@ exports.events = void 0;
4
4
  const bridge_1 = require("../bridge");
5
5
  const serialiseBlob_1 = require("./serialiseBlob");
6
6
  const callBridge = (0, bridge_1.getCallBridge)();
7
+ const wrappedCallback = (callback) => {
8
+ return (payload) => {
9
+ let newPayload = payload;
10
+ if ((0, serialiseBlob_1.containsSerialisedBlobs)(payload)) {
11
+ newPayload = (0, serialiseBlob_1.deserialiseBlobsInPayload)(payload);
12
+ }
13
+ return callback(newPayload);
14
+ };
15
+ };
7
16
  const emit = async (event, payload) => {
8
17
  let newPayload = payload;
9
18
  if ((0, serialiseBlob_1.containsBlobs)(payload)) {
@@ -11,17 +20,22 @@ const emit = async (event, payload) => {
11
20
  }
12
21
  return callBridge('emit', { event, payload: newPayload });
13
22
  };
23
+ const emitPublic = async (event, payload, options) => {
24
+ let newPayload = payload;
25
+ if ((0, serialiseBlob_1.containsBlobs)(payload)) {
26
+ newPayload = await (0, serialiseBlob_1.serialiseBlobsInPayload)(payload);
27
+ }
28
+ return callBridge('emitPublic', { event, payload: newPayload, allowedRecipients: options === null || options === void 0 ? void 0 : options.allowedRecipients });
29
+ };
14
30
  const on = (event, callback) => {
15
- const wrappedCallback = (payload) => {
16
- let newPayload = payload;
17
- if ((0, serialiseBlob_1.containsSerialisedBlobs)(payload)) {
18
- newPayload = (0, serialiseBlob_1.deserialiseBlobsInPayload)(payload);
19
- }
20
- return callback(newPayload);
21
- };
22
- return callBridge('on', { event, callback: wrappedCallback });
31
+ return callBridge('on', { event, callback: wrappedCallback(callback) });
32
+ };
33
+ const onPublic = (event, callback) => {
34
+ return callBridge('onPublic', { event, callback: wrappedCallback(callback) });
23
35
  };
24
36
  exports.events = {
25
37
  emit,
26
- on
38
+ emitPublic,
39
+ on,
40
+ onPublic
27
41
  };
@@ -1,7 +1,7 @@
1
- import { DocNode } from '@atlaskit/adf-schema';
2
- export declare const createAdfRendererIframeProps: (adfDocument: DocNode, iframeId?: string) => {
1
+ import type { FullContext } from '../types';
2
+ export declare const createAdfRendererIframeProps: (context: FullContext, iframeId?: string) => Promise<{
3
3
  id: string;
4
4
  src: string;
5
5
  onLoad: () => void;
6
- };
6
+ }>;
7
7
  //# sourceMappingURL=adf-renderer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adf-renderer.d.ts","sourceRoot":"","sources":["../../src/view/adf-renderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAU/C,eAAO,MAAM,4BAA4B,gBAAiB,OAAO,aAAa,MAAM;;;;CAuBnF,CAAC"}
1
+ {"version":3,"file":"adf-renderer.d.ts","sourceRoot":"","sources":["../../src/view/adf-renderer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAU5C,eAAO,MAAM,4BAA4B,YAAmB,WAAW,aAAa,MAAM;;;;EAuCzF,CAAC"}
@@ -2,21 +2,35 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createAdfRendererIframeProps = void 0;
4
4
  const uuid_1 = require("uuid");
5
- const createAdfRendererIframeProps = (adfDocument, iframeId) => {
5
+ const createAdfRendererIframeProps = async (context, iframeId) => {
6
+ const { iframeResizer } = await import('iframe-resizer');
6
7
  const origin = new URL(document.referrer).origin;
7
8
  const src = `${origin}/forge-apps/adf-renderer`;
8
9
  const id = iframeId || `forge-adf-renderer-iframe-${(0, uuid_1.v4)()}`;
9
10
  const onLoad = () => {
10
- var _a;
11
+ var _a, _b;
11
12
  const iframe = document.getElementById(id);
12
13
  const message = {
13
14
  type: 'adf-document',
14
- document: adfDocument,
15
+ document: (_a = context.extension.macro) === null || _a === void 0 ? void 0 : _a.body,
15
16
  timestamp: Date.now(),
16
- source: 'forge-adf-renderer'
17
+ source: 'forge-adf-renderer',
18
+ localId: context.localId
17
19
  };
18
- (_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(message, origin);
20
+ iframeResizer({
21
+ heightCalculationMethod: 'taggedElement',
22
+ widthCalculationMethod: 'bodyScroll',
23
+ initCallback: (iframe) => {
24
+ var _a;
25
+ (_a = iframe === null || iframe === void 0 ? void 0 : iframe.iFrameResizer) === null || _a === void 0 ? void 0 : _a.resize();
26
+ }
27
+ }, iframe || '');
28
+ (_b = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _b === void 0 ? void 0 : _b.postMessage(message, origin);
19
29
  };
30
+ setTimeout(() => {
31
+ document.documentElement.style.height = 'auto';
32
+ document.body.style.height = 'auto';
33
+ }, 200);
20
34
  return {
21
35
  id,
22
36
  src,
@@ -10,10 +10,10 @@ export declare const view: {
10
10
  };
11
11
  changeWindowTitle: (title: string) => Promise<void>;
12
12
  emitReadyEvent: () => Promise<void>;
13
- createAdfRendererIframeProps: (adfDocument: import("@atlaskit/adf-schema").DocNode, iframeId?: string | undefined) => {
13
+ createAdfRendererIframeProps: (context: import("../types").FullContext, iframeId?: string | undefined) => Promise<{
14
14
  id: string;
15
15
  src: string;
16
16
  onLoad: () => void;
17
- };
17
+ }>;
18
18
  };
19
19
  //# sourceMappingURL=view.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/bridge",
3
- "version": "5.9.0-next.9-experimental-4bd2ca0",
3
+ "version": "5.9.1-experimental-3311bec",
4
4
  "description": "Forge bridge API for custom UI apps",
5
5
  "author": "Atlassian",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
@@ -19,7 +19,9 @@
19
19
  "@forge/resolver": "1.7.1",
20
20
  "@statsig/js-client": "3.18.2",
21
21
  "@types/history": "^4.7.11",
22
- "@forge/manifest": "11.1.0-next.6-experimental-4bd2ca0",
22
+ "@forge/manifest": "11.2.0-experimental-3311bec",
23
+ "@types/iframe-resizer": "^3.5.8",
24
+ "iframe-resizer": "^4.4.5",
23
25
  "uuid": "^9.0.1"
24
26
  },
25
27
  "devDependencies": {