@forge/bridge 2.3.0-next.1 → 2.4.0-next.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,25 @@
1
1
  # @forge/bridge
2
2
 
3
+ ## 2.4.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 14cd9b02: Add a new view.refresh() method
8
+
9
+ ## 2.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - ae90999: Add router.reload()
14
+ - 27af6ce: Add showFlag API to open flags in products
15
+ - d307c8f: Add on and emit methods to Events API
16
+
17
+ ## 2.3.0-next.2
18
+
19
+ ### Minor Changes
20
+
21
+ - 27af6ce4: Add showFlag API to open flags in products
22
+
3
23
  ## 2.3.0-next.1
4
24
 
5
25
  ### Minor Changes
@@ -0,0 +1,20 @@
1
+ export declare type FlagAppearance = 'info' | 'success' | 'warning' | 'error';
2
+ export declare type FlagType = FlagAppearance;
3
+ export interface Flag {
4
+ close: () => Promise<boolean | void>;
5
+ }
6
+ export interface FlagAction {
7
+ text: string;
8
+ onClick: () => void;
9
+ }
10
+ export interface FlagOptions {
11
+ id: number | string;
12
+ title?: string;
13
+ description?: string;
14
+ type?: FlagType;
15
+ appearance?: FlagAppearance;
16
+ actions?: FlagAction[];
17
+ isAutoDismiss?: boolean;
18
+ }
19
+ export declare const showFlag: (options: FlagOptions) => Flag;
20
+ //# sourceMappingURL=flag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flag.d.ts","sourceRoot":"","sources":["../../src/flag/flag.ts"],"names":[],"mappings":"AAGA,oBAAY,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AACtE,oBAAY,QAAQ,GAAG,cAAc,CAAC;AAEtC,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IAKrB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAIhB,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAID,eAAO,MAAM,QAAQ,YAAa,WAAW,KAAG,IAgB/C,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.showFlag = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const bridge_1 = require("../bridge");
6
+ const errors_1 = require("../errors");
7
+ const callBridge = bridge_1.getCallBridge();
8
+ exports.showFlag = (options) => {
9
+ var _a;
10
+ if (!options.id) {
11
+ throw new errors_1.BridgeAPIError('"id" must be defined in flag options');
12
+ }
13
+ const result = callBridge('showFlag', Object.assign(Object.assign({}, options), { type: (_a = options.type) !== null && _a !== void 0 ? _a : 'info' }));
14
+ return {
15
+ close: () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
16
+ yield result;
17
+ return callBridge('closeFlag', { id: options.id });
18
+ })
19
+ };
20
+ };
@@ -0,0 +1,2 @@
1
+ export { showFlag, FlagOptions } from './flag';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/flag/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var flag_1 = require("./flag");
4
+ Object.defineProperty(exports, "showFlag", { enumerable: true, get: function () { return flag_1.showFlag; } });
package/out/index.d.ts CHANGED
@@ -3,5 +3,6 @@ export * from './view';
3
3
  export * from './router';
4
4
  export * from './modal';
5
5
  export * from './fetch';
6
+ export * from './flag';
6
7
  export * from './events';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
package/out/index.js CHANGED
@@ -6,4 +6,5 @@ tslib_1.__exportStar(require("./view"), exports);
6
6
  tslib_1.__exportStar(require("./router"), exports);
7
7
  tslib_1.__exportStar(require("./modal"), exports);
8
8
  tslib_1.__exportStar(require("./fetch"), exports);
9
+ tslib_1.__exportStar(require("./flag"), exports);
9
10
  tslib_1.__exportStar(require("./events"), exports);
@@ -0,0 +1,2 @@
1
+ export declare const refresh: (payload?: any) => Promise<void>;
2
+ //# sourceMappingURL=refresh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../../src/view/refresh.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,aAAoB,GAAG,kBAK1C,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.refresh = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const bridge_1 = require("../bridge");
6
+ const errors_1 = require("../errors");
7
+ const callBridge = bridge_1.getCallBridge();
8
+ exports.refresh = (payload) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
9
+ const success = yield callBridge('refresh', payload);
10
+ if (success === false) {
11
+ throw new errors_1.BridgeAPIError("this resource's view is not refreshable.");
12
+ }
13
+ });
@@ -1,6 +1,7 @@
1
1
  export declare const view: {
2
2
  submit: (payload?: any) => Promise<void>;
3
3
  close: (payload?: any) => Promise<void>;
4
+ refresh: (payload?: any) => Promise<void>;
4
5
  createHistory: () => Promise<import("history").History<unknown>>;
5
6
  getContext: () => Promise<import("../types").FullContext>;
6
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/view/view.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI;;;;;CAKhB,CAAC"}
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/view/view.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,IAAI;;;;;;CAMhB,CAAC"}
package/out/view/view.js CHANGED
@@ -3,11 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.view = void 0;
4
4
  const submit_1 = require("./submit");
5
5
  const close_1 = require("./close");
6
+ const refresh_1 = require("./refresh");
6
7
  const createHistory_1 = require("./createHistory");
7
8
  const getContext_1 = require("./getContext");
8
9
  exports.view = {
9
10
  submit: submit_1.submit,
10
11
  close: close_1.close,
12
+ refresh: refresh_1.refresh,
11
13
  createHistory: createHistory_1.createHistory,
12
14
  getContext: getContext_1.getContext
13
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/bridge",
3
- "version": "2.3.0-next.1",
3
+ "version": "2.4.0-next.0",
4
4
  "description": "Forge bridge API for custom UI apps",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",