@forge/bridge 5.16.3-next.0-experimental-4a332af → 5.17.0-next.10

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,13 +1,73 @@
1
1
  # @forge/bridge
2
2
 
3
- ## 5.16.3-next.0-experimental-4a332af
3
+ ## 5.17.0-next.10
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - aa757af: Module add
8
- - dba5074: Send adf doc when ready for createAdfRendererIframeProps
9
- - Updated dependencies [aa757af]
10
- - @forge/manifest@12.8.0-experimental-4a332af
7
+ - Updated dependencies [ee691bf]
8
+ - @forge/manifest@12.9.0-next.6
9
+
10
+ ## 5.17.0-next.9
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [8197e66]
15
+ - @forge/manifest@12.9.0-next.5
16
+
17
+ ## 5.17.0-next.8
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies [4493006]
22
+ - @forge/manifest@12.9.0-next.4
23
+
24
+ ## 5.17.0-next.7
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [723fab8]
29
+ - Updated dependencies [9f3add6]
30
+ - @forge/manifest@12.9.0-next.3
31
+
32
+ ## 5.17.0-next.6
33
+
34
+ ### Minor Changes
35
+
36
+ - fc55c83: Add `getFrameDispatch` method to `view` module. The method fetches the dispatch prop passed to Frame inside the frame resource.
37
+
38
+ ## 5.17.0-next.5
39
+
40
+ ### Patch Changes
41
+
42
+ - Updated dependencies [b7b1f36]
43
+ - @forge/manifest@12.8.1-next.2
44
+
45
+ ## 5.17.0-next.4
46
+
47
+ ### Minor Changes
48
+
49
+ - f7f06c8: Add resizable to modal named sizes type
50
+
51
+ ## 5.17.0-next.3
52
+
53
+ ### Patch Changes
54
+
55
+ - Updated dependencies [5beb8ad]
56
+ - Updated dependencies [f1f11f0]
57
+ - @forge/manifest@12.8.1-next.1
58
+
59
+ ## 5.17.0-next.2
60
+
61
+ ### Patch Changes
62
+
63
+ - Updated dependencies [ccdcfc3]
64
+ - @forge/manifest@12.8.1-next.0
65
+
66
+ ## 5.17.0-next.1
67
+
68
+ ### Minor Changes
69
+
70
+ - 3cf97c3: Extend forge/bridge modal types with custom dimensions
11
71
 
12
72
  ## 5.16.3-next.0
13
73
 
@@ -1,7 +1,14 @@
1
+ declare const NAMED_MODAL_SIZES: readonly ["small", "medium", "large", "xlarge", "max", "fullscreen", "resizable"];
2
+ declare type NamedModalSize = (typeof NAMED_MODAL_SIZES)[number];
3
+ declare type CustomModalSize = {
4
+ width: string;
5
+ height?: string;
6
+ };
7
+ export declare type ModalSizes = NamedModalSize | CustomModalSize;
1
8
  export interface ModalOptions {
2
9
  resource?: string | null;
3
10
  onClose?: (payload: any) => any;
4
- size?: string;
11
+ size?: ModalSizes;
5
12
  context?: any;
6
13
  closeOnEscape?: boolean;
7
14
  closeOnOverlayClick?: boolean;
@@ -11,7 +18,7 @@ export interface ModalOptions {
11
18
  export declare class Modal {
12
19
  resource: string | null;
13
20
  onClose: NonNullable<ModalOptions['onClose']>;
14
- size: string;
21
+ size: ModalSizes;
15
22
  context: any;
16
23
  closeOnEscape: boolean;
17
24
  closeOnOverlayClick: boolean;
@@ -20,4 +27,5 @@ export declare class Modal {
20
27
  constructor(opts?: ModalOptions);
21
28
  open(): Promise<void>;
22
29
  }
30
+ export {};
23
31
  //# sourceMappingURL=modal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../src/modal/modal.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,GAAG,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mBAAmB,CAAC,E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OAAO,EAAE,WAAW,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;IAC9C,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,GAAG,CAAC;IACb,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;gBACD,IAAI,CAAC,EAAE,YAAY;IAWzB,IAAI;CA0BX"}
@@ -4,8 +4,21 @@ exports.Modal = void 0;
4
4
  const bridge_1 = require("../bridge");
5
5
  const errors_1 = require("../errors");
6
6
  const callBridge = (0, bridge_1.getCallBridge)();
7
+ const NAMED_MODAL_SIZES = ['small', 'medium', 'large', 'xlarge', 'max', 'fullscreen', 'resizable'];
7
8
  // eslint-disable-next-line @typescript-eslint/no-empty-function
8
9
  const noop = () => { };
10
+ function isNamedModalSize(size) {
11
+ return typeof size === 'string' && NAMED_MODAL_SIZES.includes(size);
12
+ }
13
+ function isCustomModalSize(size) {
14
+ if (typeof size !== 'object' || size === null)
15
+ return false;
16
+ const s = size;
17
+ return typeof s.width === 'string' && (s.height === undefined || typeof s.height === 'string');
18
+ }
19
+ function isValidModalSize(size) {
20
+ return isNamedModalSize(size) || isCustomModalSize(size);
21
+ }
9
22
  class Modal {
10
23
  constructor(opts) {
11
24
  var _a, _b;
@@ -19,6 +32,9 @@ class Modal {
19
32
  this.icon = (opts === null || opts === void 0 ? void 0 : opts.icon) || '';
20
33
  }
21
34
  async open() {
35
+ if (!isValidModalSize(this.size)) {
36
+ throw new errors_1.BridgeAPIError(`Invalid modal size: ${JSON.stringify(this.size)}. Must be one of the named sizes (${NAMED_MODAL_SIZES.join(', ')}) or a custom dimensions object with a "width" string property and an optional "height" string property.`);
37
+ }
22
38
  try {
23
39
  const success = await callBridge('openModal', {
24
40
  resource: this.resource,
@@ -0,0 +1,4 @@
1
+ declare type DispatchFunction = (...args: any[]) => any;
2
+ export declare const getFrameDispatch: <T extends DispatchFunction>() => Promise<T | undefined>;
3
+ export {};
4
+ //# sourceMappingURL=getFrameDispatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFrameDispatch.d.ts","sourceRoot":"","sources":["../../src/view/getFrameDispatch.ts"],"names":[],"mappings":"AAEA,aAAK,gBAAgB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAIhD,eAAO,MAAM,gBAAgB,0DAE5B,CAAC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getFrameDispatch = void 0;
4
+ const bridge_1 = require("../bridge");
5
+ const callBridge = (0, bridge_1.getCallBridge)();
6
+ const getFrameDispatch = async () => {
7
+ return await callBridge('getFrameDispatch');
8
+ };
9
+ exports.getFrameDispatch = getFrameDispatch;
@@ -6,6 +6,7 @@ export declare const view: {
6
6
  refresh: (payload?: any) => Promise<void>;
7
7
  createHistory: () => Promise<import("history").History>;
8
8
  getContext: () => Promise<import("../types").FullContext>;
9
+ getFrameDispatch: <T extends (...args: any[]) => any>() => Promise<T | undefined>;
9
10
  theme: {
10
11
  enable: () => Promise<void>;
11
12
  };
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/view/view.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;CAYhB,CAAC"}
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/view/view.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;CAahB,CAAC"}
package/out/view/view.js CHANGED
@@ -12,6 +12,7 @@ const theme_1 = require("./theme");
12
12
  const emitReadyEvent_1 = require("./emitReadyEvent");
13
13
  const adf_renderer_1 = require("./adf-renderer");
14
14
  const onClose_1 = require("./onClose");
15
+ const getFrameDispatch_1 = require("./getFrameDispatch");
15
16
  exports.view = {
16
17
  submit: submit_1.submit,
17
18
  close: close_1.close,
@@ -20,6 +21,7 @@ exports.view = {
20
21
  refresh: refresh_1.refresh,
21
22
  createHistory: createHistory_1.createHistory,
22
23
  getContext: getContext_1.getContext,
24
+ getFrameDispatch: getFrameDispatch_1.getFrameDispatch,
23
25
  theme: theme_1.theme,
24
26
  changeWindowTitle: changeWindowTitle_1.changeWindowTitle,
25
27
  emitReadyEvent: emitReadyEvent_1.emitReadyEvent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/bridge",
3
- "version": "5.16.3-next.0-experimental-4a332af",
3
+ "version": "5.17.0-next.10",
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,7 @@
19
19
  "@forge/i18n": "0.0.7",
20
20
  "@forge/resolver": "1.8.0",
21
21
  "@types/history": "^4.7.11",
22
- "@forge/manifest": "12.8.0-experimental-4a332af",
22
+ "@forge/manifest": "12.9.0-next.6",
23
23
  "@types/iframe-resizer": "^3.5.8",
24
24
  "iframe-resizer": "^4.4.5"
25
25
  },