@forge/bridge 4.3.0 → 4.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,11 @@
1
1
  # @forge/bridge
2
2
 
3
+ ## 4.4.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d516a64: Update router.navigate to allow navigation to an object containing a specified target and context properties
8
+
3
9
  ## 4.3.0
4
10
 
5
11
  ### Minor Changes
package/out/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { NavigationTarget } from './router/targets';
1
2
  export * from './invoke';
2
3
  export * from './invoke-remote';
3
4
  export * from './view';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
package/out/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.i18n = void 0;
3
+ exports.i18n = exports.NavigationTarget = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ var targets_1 = require("./router/targets");
6
+ Object.defineProperty(exports, "NavigationTarget", { enumerable: true, get: function () { return targets_1.NavigationTarget; } });
5
7
  tslib_1.__exportStar(require("./invoke"), exports);
6
8
  tslib_1.__exportStar(require("./invoke-remote"), exports);
7
9
  tslib_1.__exportStar(require("./view"), exports);
@@ -1,6 +1,9 @@
1
+ import { NavigationLocation } from './types';
2
+ declare type Navigate = (location: string | NavigationLocation) => Promise<void>;
1
3
  export declare const router: {
2
- navigate: (url: string) => Promise<void>;
3
- open: (url: string) => Promise<void>;
4
+ navigate: Navigate;
5
+ open: Navigate;
4
6
  reload: () => Promise<void>;
5
7
  };
8
+ export {};
6
9
  //# sourceMappingURL=router.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,MAAM;oBANG,MAAM,KAAK,QAAQ,IAAI,CAAC;gBAE5B,MAAM,KAAK,QAAQ,IAAI,CAAC;kBAEtB,QAAQ,IAAI,CAAC;CAMhC,CAAC"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router/router.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAI7C,aAAK,QAAQ,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AA2CzE,eAAO,MAAM,MAAM;;;kBAFC,QAAQ,IAAI,CAAC;CAMhC,CAAC"}
@@ -3,8 +3,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.router = void 0;
4
4
  const bridge_1 = require("../bridge");
5
5
  const callBridge = (0, bridge_1.getCallBridge)();
6
- const navigate = async (url) => callBridge('navigate', { url, type: 'same-tab' });
7
- const open = async (url) => callBridge('navigate', { url, type: 'new-tab' });
6
+ const navigate = async (location) => {
7
+ if (typeof location === 'string') {
8
+ return callBridge('navigate', { url: location, type: 'same-tab' });
9
+ }
10
+ else {
11
+ if (!(location === null || location === void 0 ? void 0 : location.target)) {
12
+ throw new Error('target is required for navigation');
13
+ }
14
+ return callBridge('navigate', { ...location, type: 'same-tab' });
15
+ }
16
+ };
17
+ const open = async (location) => {
18
+ if (typeof location === 'string') {
19
+ return callBridge('navigate', { url: location, type: 'new-tab' });
20
+ }
21
+ else {
22
+ if (!(location === null || location === void 0 ? void 0 : location.target)) {
23
+ throw new Error('target is required for navigation');
24
+ }
25
+ return callBridge('navigate', { ...location, type: 'new-tab' });
26
+ }
27
+ };
8
28
  const reload = async () => callBridge('reload');
9
29
  exports.router = {
10
30
  navigate,
@@ -0,0 +1,12 @@
1
+ export declare const NavigationTarget: {
2
+ readonly ContentView: "contentView";
3
+ readonly ContentEdit: "contentEdit";
4
+ readonly ContentList: "contentList";
5
+ readonly SpaceView: "spaceView";
6
+ readonly Module: "module";
7
+ readonly UserProfile: "userProfile";
8
+ readonly Dashboard: "dashboard";
9
+ readonly Issue: "issue";
10
+ readonly ProjectSettingsDetails: "projectSettingsDetails";
11
+ };
12
+ //# sourceMappingURL=targets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"targets.d.ts","sourceRoot":"","sources":["../../src/router/targets.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,gBAAgB;;;;;;;;;;CAqCnB,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NavigationTarget = void 0;
4
+ exports.NavigationTarget = {
5
+ ContentView: 'contentView',
6
+ ContentEdit: 'contentEdit',
7
+ ContentList: 'contentList',
8
+ SpaceView: 'spaceView',
9
+ Module: 'module',
10
+ UserProfile: 'userProfile',
11
+ Dashboard: 'dashboard',
12
+ Issue: 'issue',
13
+ ProjectSettingsDetails: 'projectSettingsDetails'
14
+ };
@@ -0,0 +1,49 @@
1
+ import { NavigationTarget } from './targets';
2
+ declare type ContentView = {
3
+ target: typeof NavigationTarget.ContentView;
4
+ contentId: string;
5
+ version?: string;
6
+ };
7
+ declare type ContentEdit = {
8
+ target: typeof NavigationTarget.ContentEdit;
9
+ contentId: string;
10
+ };
11
+ declare type SpaceView = {
12
+ target: typeof NavigationTarget.SpaceView;
13
+ spaceKey: string;
14
+ };
15
+ declare type ContentList = {
16
+ target: typeof NavigationTarget.ContentList;
17
+ contentType: 'page' | 'blogpost' | 'customContent';
18
+ } & ({
19
+ contentType: 'page' | 'blogpost';
20
+ spaceKey: string;
21
+ } | {
22
+ contentType: 'customContent';
23
+ moduleKey: string;
24
+ });
25
+ declare type Module = {
26
+ target: typeof NavigationTarget.Module;
27
+ moduleKey: string;
28
+ spaceKey?: string;
29
+ projectKey?: string;
30
+ };
31
+ declare type UserProfile = {
32
+ target: typeof NavigationTarget.UserProfile;
33
+ accountId: string;
34
+ };
35
+ declare type Dashboard = {
36
+ target: typeof NavigationTarget.Dashboard;
37
+ dashboardId: string;
38
+ };
39
+ declare type Issue = {
40
+ target: typeof NavigationTarget.Issue;
41
+ issueKey: string;
42
+ };
43
+ declare type ProjectSettingsDetails = {
44
+ target: typeof NavigationTarget.ProjectSettingsDetails;
45
+ projectKey: string;
46
+ };
47
+ export declare type NavigationLocation = ContentView | ContentEdit | SpaceView | UserProfile | ContentList | Module | Dashboard | Issue | ProjectSettingsDetails;
48
+ export {};
49
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/router/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7C,aAAK,WAAW,GAAG;IACjB,MAAM,EAAE,OAAO,gBAAgB,CAAC,WAAW,CAAC;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,aAAK,WAAW,GAAG;IACjB,MAAM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T,WAAW,GACX,WAAW,GACX,MAAM,GACN,SAAS,GACT,KAAK,GACL,sBAAsB,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/bridge",
3
- "version": "4.3.0",
3
+ "version": "4.4.0-next.0",
4
4
  "description": "Forge bridge API for custom UI apps",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",