@forge/bridge 0.0.0-experimental-e1cefc4 → 0.0.0-experimental-416047f
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 +27 -3
- package/out/bridge.js +2 -2
- package/out/events/events.d.ts +6 -0
- package/out/events/events.d.ts.map +1 -0
- package/out/events/events.js +15 -0
- package/out/events/index.d.ts +2 -0
- package/out/events/index.d.ts.map +1 -0
- package/out/events/index.js +4 -0
- package/out/flag/flag.d.ts +20 -0
- package/out/flag/flag.d.ts.map +1 -0
- package/out/flag/flag.js +20 -0
- package/out/flag/index.d.ts +2 -0
- package/out/flag/index.d.ts.map +1 -0
- package/out/flag/index.js +4 -0
- package/out/index.d.ts +2 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +2 -0
- package/out/router/router.d.ts +1 -0
- package/out/router/router.d.ts.map +1 -1
- package/out/router/router.js +3 -1
- package/out/types.d.ts +3 -0
- package/out/types.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,36 @@
|
|
|
1
1
|
# @forge/bridge
|
|
2
2
|
|
|
3
|
-
## 0.0.0-experimental-
|
|
3
|
+
## 0.0.0-experimental-416047f
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ae90999: Add router.reload()
|
|
8
|
+
- 27af6ce: Add showFlag API to open flags in products
|
|
9
|
+
- d307c8f: Add on and emit methods to Events API
|
|
10
|
+
|
|
11
|
+
## 2.3.0-next.2
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 27af6ce4: Add showFlag API to open flags in products
|
|
16
|
+
|
|
17
|
+
## 2.3.0-next.1
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- ae90999: Add router.reload()
|
|
22
|
+
|
|
23
|
+
## 2.3.0-next.0
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- d307c8f: Add on and emit methods to Events API
|
|
28
|
+
|
|
29
|
+
## 2.2.1
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
6
32
|
|
|
7
|
-
- 869511d: Change
|
|
8
33
|
- 97ce1f3: update history.location in bridge when route changes
|
|
9
|
-
- 869511d: Add
|
|
10
34
|
|
|
11
35
|
## 2.2.1-next.0
|
|
12
36
|
|
package/out/bridge.js
CHANGED
|
@@ -6,11 +6,11 @@ function isBridgeAvailable(bridge) {
|
|
|
6
6
|
return !!(bridge === null || bridge === void 0 ? void 0 : bridge.callBridge);
|
|
7
7
|
}
|
|
8
8
|
exports.getCallBridge = () => {
|
|
9
|
-
if (!isBridgeAvailable(
|
|
9
|
+
if (!isBridgeAvailable(window.__bridge)) {
|
|
10
10
|
throw new errors_1.BridgeAPIError(`
|
|
11
11
|
Unable to establish a connection with the Custom UI bridge.
|
|
12
12
|
If you are trying to run your app locally, Forge apps only work in the context of Atlassian products. Refer to https://go.atlassian.com/forge-tunneling-with-custom-ui for how to tunnel when using a local development server.
|
|
13
13
|
`);
|
|
14
14
|
}
|
|
15
|
-
return
|
|
15
|
+
return window.__bridge.callBridge;
|
|
16
16
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/events/events.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAYxC,eAAO,MAAM,MAAM;kBARE,MAAM,YAAY,GAAG,KAAG,OAAO,CAAC,IAAI,CAAC;gBAIvC,MAAM,uBAAuB,GAAG,KAAK,GAAG,KAAG,OAAO,CAAC,YAAY,CAAC;CAOlF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.events = void 0;
|
|
4
|
+
const bridge_1 = require("../bridge");
|
|
5
|
+
const callBridge = bridge_1.getCallBridge();
|
|
6
|
+
const emit = (event, payload) => {
|
|
7
|
+
return callBridge('emit', { event, payload });
|
|
8
|
+
};
|
|
9
|
+
const on = (event, callback) => {
|
|
10
|
+
return callBridge('on', { event, callback });
|
|
11
|
+
};
|
|
12
|
+
exports.events = {
|
|
13
|
+
emit,
|
|
14
|
+
on
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -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"}
|
package/out/flag/flag.js
ADDED
|
@@ -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 @@
|
|
|
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"}
|
package/out/index.d.ts
CHANGED
package/out/index.d.ts.map
CHANGED
|
@@ -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"}
|
|
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,3 +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);
|
|
10
|
+
tslib_1.__exportStar(require("./events"), exports);
|
package/out/router/router.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,MAAM;oBANG,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;gBAE5B,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC;kBAEtB,OAAO,CAAC,IAAI,CAAC;CAMhC,CAAC"}
|
package/out/router/router.js
CHANGED
|
@@ -6,7 +6,9 @@ const bridge_1 = require("../bridge");
|
|
|
6
6
|
const callBridge = bridge_1.getCallBridge();
|
|
7
7
|
const navigate = (url) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return callBridge('navigate', { url, type: 'same-tab' }); });
|
|
8
8
|
const open = (url) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return callBridge('navigate', { url, type: 'new-tab' }); });
|
|
9
|
+
const reload = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return callBridge('reload'); });
|
|
9
10
|
exports.router = {
|
|
10
11
|
navigate,
|
|
11
|
-
open
|
|
12
|
+
open,
|
|
13
|
+
reload
|
|
12
14
|
};
|
package/out/types.d.ts
CHANGED
|
@@ -6,4 +6,7 @@ export declare type ProductFetchResponse = {
|
|
|
6
6
|
body?: string;
|
|
7
7
|
} & Pick<ResponseInit, 'headers' | 'status' | 'statusText'>;
|
|
8
8
|
export declare type FullContext = {};
|
|
9
|
+
export declare type Subscription = {
|
|
10
|
+
unsubscribe: () => void;
|
|
11
|
+
};
|
|
9
12
|
//# sourceMappingURL=types.d.ts.map
|
package/out/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa,GAAG;KACzB,GAAG,IAAI,MAAM,GAAG,MAAM,GAAG,GAAG;CAC9B,CAAC;AAEF,oBAAY,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;AAExD,oBAAY,oBAAoB,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,QAAQ,GAAG,YAAY,CAAC,CAAC;AAE/G,oBAAY,WAAW,GAAG,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa,GAAG;KACzB,GAAG,IAAI,MAAM,GAAG,MAAM,GAAG,GAAG;CAC9B,CAAC;AAEF,oBAAY,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;AAExD,oBAAY,oBAAoB,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,YAAY,EAAE,SAAS,GAAG,QAAQ,GAAG,YAAY,CAAC,CAAC;AAE/G,oBAAY,WAAW,GAAG,EAAE,CAAC;AAE7B,oBAAY,YAAY,GAAG;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC"}
|