@valiantys/atlassian-app-frontend 1.0.0 → 2.0.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/atlassian-app-forge-BwFXF-6M.js +3 -0
- package/atlassian-app-forge-DG01gNAI.mjs +139 -0
- package/atlassian-app-frontend.api.json +966 -186
- package/atlassian-app-frontend.api.md +89 -32
- package/index-BePJjrLy.js +1 -0
- package/{index-CBKhl1FP.mjs → index-ZJX0bAUh.mjs} +1 -0
- package/index.d.ts +96 -48
- package/index.js +2 -2
- package/index.mjs +635 -477
- package/package.json +2 -2
- package/style.css +1 -1
- package/valiantys-atlassian-app-frontend-2.0.0.tgz +0 -0
- package/atlassian-app-forge-CTaVjJLt.js +0 -1
- package/atlassian-app-forge-DdtDadi2.mjs +0 -117
- package/atlassian-app-standalone-DJOVbfp6.js +0 -1
- package/atlassian-app-standalone-DyyH6WPO.mjs +0 -111
- package/index-CP8emE0q.js +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),c=require("@forge/bridge"),f=require("react"),i=require("./index.js");require("@atlaskit/flag");require("@atlaskit/icon/glyph/check-circle");require("@atlaskit/icon/glyph/error");require("@atlaskit/icon/glyph/info");require("@atlaskit/icon/glyph/warning");require("@atlaskit/tokens");require("@atlaskit/button/new");require("@atlaskit/heading");require("@atlaskit/primitives");require("@atlaskit/button");require("@atlaskit/form");require("@atlaskit/section-message");require("@atlaskit/select");require("@atlaskit/spinner");require("@atlaskit/app-provider");require("react-router-dom");function x(e){return async({url:r,method:t,responseType:u="json",allowExperimental:d=!1},a)=>{const o={Accept:u==="json"?"application/json":"text/html"};a&&(o["Content-Type"]="application/json"),d&&(o["X-ExperimentalApi"]="opt-in");const l=JSON.stringify(a),s=await e(r,{method:t,headers:o,body:l});if(s.ok)return t==="DELETE"||s.status===204?void 0:u==="text"?p(s):j(s);{const v=`${t} ${r.value} - ${s.status} ${s.statusText}
|
|
2
|
+
Request Body: ${l}
|
|
3
|
+
Response Body: ${await p(s)}`;throw console.error(v),new Error(v)}}}async function p(e){try{return await e.text()}catch{return""}}async function j(e){try{return await e.json()}catch{return p(e)}}function m(e){switch(e){case"jira":return c.requestJira;case"bitbucket":return c.requestBitbucket;case"confluence":return c.requestConfluence}}function h(e){const r=m(e);return{productType:e,fetch:x((t,u)=>r(t.value,u)),route:i.route,rawFetch:r}}function k({children:e}){const[r,t]=f.useReducer(w,{});return n.jsx(i.AppFlagsDispatchContext.Provider,{value:t,children:e})}function w(e,r){var t;switch(r.type){case"add":return r.props?{...e,[r.props.id]:c.showFlag(r.props)}:(console.error("invalid flag action: ",JSON.stringify(r)),e);case"remove":return(t=e[r.id])==null||t.close(),{...e,[r.id]:void 0};default:throw Error("Unknown action: "+r.type)}}c.view.theme.enable();const F=h("jira"),y=h("bitbucket"),b=h("confluence"),P={open(e){return new c.Modal(e).open()}};function q({appName:e,doCheckWorkspace:r,invokeRemoteImpl:t,useAtlasKitFlags:u,children:d}){const a=f.useCallback(async(l,s)=>c.invoke(l,{...s}),[]);let o=d;return r&&(o=n.jsx(i.FeatureChosenWorkspaceCheck,{appName:e,children:o})),o=n.jsx(i.RemoteAdapterProvider,{invokeRemoteImplementation:t||c.invokeRemote,children:n.jsx(i.BackendAdapterProvider,{invokeImplementation:a,children:n.jsx(i.HostRouterProvider,{hostRouter:c.router,children:n.jsx(i.RequestBitbucketProvider,{requestBitbucketImplementation:y,children:n.jsx(i.RequestConfluenceProvider,{requestConfluenceImplementation:b,children:n.jsx(i.RequestJiraProvider,{requestJiraImplementation:F,children:n.jsx(i.ViewContextProvider,{viewContext:c.view,children:n.jsx(i.ModalServiceProvider,{modalService:P,children:o})})})})})})})}),u?n.jsx(i.AppFlagsProviderAtlasKit,{children:o}):n.jsx(k,{children:o})}exports.AtlassianAppForge=q;exports.default=q;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { requestConfluence as h, requestBitbucket as v, requestJira as f, showFlag as k, view as m, invoke as w, invokeRemote as F, router as y, Modal as P } from "@forge/bridge";
|
|
3
|
+
import { useReducer as b, useCallback as R } from "react";
|
|
4
|
+
import { route as x, AppFlagsDispatchContext as C, AppFlagsProviderAtlasKit as q, FeatureChosenWorkspaceCheck as A, RemoteAdapterProvider as S, BackendAdapterProvider as g, HostRouterProvider as j, RequestBitbucketProvider as E, RequestConfluenceProvider as J, RequestJiraProvider as B, ViewContextProvider as $, ModalServiceProvider as I } from "./index.mjs";
|
|
5
|
+
import "@atlaskit/flag";
|
|
6
|
+
import "@atlaskit/icon/glyph/check-circle";
|
|
7
|
+
import "@atlaskit/icon/glyph/error";
|
|
8
|
+
import "@atlaskit/icon/glyph/info";
|
|
9
|
+
import "@atlaskit/icon/glyph/warning";
|
|
10
|
+
import "@atlaskit/tokens";
|
|
11
|
+
import "@atlaskit/button/new";
|
|
12
|
+
import "@atlaskit/heading";
|
|
13
|
+
import "@atlaskit/primitives";
|
|
14
|
+
import "@atlaskit/button";
|
|
15
|
+
import "@atlaskit/form";
|
|
16
|
+
import "@atlaskit/section-message";
|
|
17
|
+
import "@atlaskit/select";
|
|
18
|
+
import "@atlaskit/spinner";
|
|
19
|
+
import "@atlaskit/app-provider";
|
|
20
|
+
import "react-router-dom";
|
|
21
|
+
function M(e) {
|
|
22
|
+
return async ({ url: t, method: r, responseType: c = "json", allowExperimental: u = !1 }, s) => {
|
|
23
|
+
const n = {
|
|
24
|
+
Accept: c === "json" ? "application/json" : "text/html"
|
|
25
|
+
};
|
|
26
|
+
s && (n["Content-Type"] = "application/json"), u && (n["X-ExperimentalApi"] = "opt-in");
|
|
27
|
+
const a = JSON.stringify(s), i = await e(t, {
|
|
28
|
+
method: r,
|
|
29
|
+
headers: n,
|
|
30
|
+
body: a
|
|
31
|
+
});
|
|
32
|
+
if (i.ok)
|
|
33
|
+
return r === "DELETE" || i.status === 204 ? void 0 : c === "text" ? p(i) : T(i);
|
|
34
|
+
{
|
|
35
|
+
const d = `${r} ${t.value} - ${i.status} ${i.statusText}
|
|
36
|
+
Request Body: ${a}
|
|
37
|
+
Response Body: ${await p(i)}`;
|
|
38
|
+
throw console.error(d), new Error(d);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
async function p(e) {
|
|
43
|
+
try {
|
|
44
|
+
return await e.text();
|
|
45
|
+
} catch {
|
|
46
|
+
return "";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async function T(e) {
|
|
50
|
+
try {
|
|
51
|
+
return await e.json();
|
|
52
|
+
} catch {
|
|
53
|
+
return p(e);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function _(e) {
|
|
57
|
+
switch (e) {
|
|
58
|
+
case "jira":
|
|
59
|
+
return f;
|
|
60
|
+
case "bitbucket":
|
|
61
|
+
return v;
|
|
62
|
+
case "confluence":
|
|
63
|
+
return h;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function l(e) {
|
|
67
|
+
const t = _(e);
|
|
68
|
+
return {
|
|
69
|
+
productType: e,
|
|
70
|
+
fetch: M(
|
|
71
|
+
(r, c) => t(r.value, c)
|
|
72
|
+
),
|
|
73
|
+
route: x,
|
|
74
|
+
// @ts-expect-error slight difference in typing, null vs undefined
|
|
75
|
+
rawFetch: t
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function D({ children: e }) {
|
|
79
|
+
const [t, r] = b(N, {});
|
|
80
|
+
return /* @__PURE__ */ o(C.Provider, { value: r, children: e });
|
|
81
|
+
}
|
|
82
|
+
function N(e, t) {
|
|
83
|
+
var r;
|
|
84
|
+
switch (t.type) {
|
|
85
|
+
case "add":
|
|
86
|
+
return t.props ? {
|
|
87
|
+
...e,
|
|
88
|
+
[t.props.id]: k(t.props)
|
|
89
|
+
} : (console.error("invalid flag action: ", JSON.stringify(t)), e);
|
|
90
|
+
case "remove":
|
|
91
|
+
return (r = e[t.id]) == null || r.close(), { ...e, [t.id]: void 0 };
|
|
92
|
+
default:
|
|
93
|
+
throw Error("Unknown action: " + t.type);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
m.theme.enable();
|
|
97
|
+
const O = l("jira"), W = l("bitbucket"), H = l("confluence"), K = {
|
|
98
|
+
open(e) {
|
|
99
|
+
return new P(e).open();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
function le({
|
|
103
|
+
appName: e,
|
|
104
|
+
doCheckWorkspace: t,
|
|
105
|
+
invokeRemoteImpl: r,
|
|
106
|
+
useAtlasKitFlags: c,
|
|
107
|
+
children: u
|
|
108
|
+
}) {
|
|
109
|
+
const s = R(
|
|
110
|
+
async (a, i) => w(a, {
|
|
111
|
+
...i
|
|
112
|
+
}),
|
|
113
|
+
[]
|
|
114
|
+
);
|
|
115
|
+
let n = u;
|
|
116
|
+
return t && (n = /* @__PURE__ */ o(A, { appName: e, children: n })), n = /* @__PURE__ */ o(
|
|
117
|
+
S,
|
|
118
|
+
{
|
|
119
|
+
invokeRemoteImplementation: r || F,
|
|
120
|
+
children: /* @__PURE__ */ o(g, { invokeImplementation: s, children: /* @__PURE__ */ o(j, { hostRouter: y, children: /* @__PURE__ */ o(
|
|
121
|
+
E,
|
|
122
|
+
{
|
|
123
|
+
requestBitbucketImplementation: W,
|
|
124
|
+
children: /* @__PURE__ */ o(
|
|
125
|
+
J,
|
|
126
|
+
{
|
|
127
|
+
requestConfluenceImplementation: H,
|
|
128
|
+
children: /* @__PURE__ */ o(B, { requestJiraImplementation: O, children: /* @__PURE__ */ o($, { viewContext: m, children: /* @__PURE__ */ o(I, { modalService: K, children: n }) }) })
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
) }) })
|
|
133
|
+
}
|
|
134
|
+
), c ? /* @__PURE__ */ o(q, { children: n }) : /* @__PURE__ */ o(D, { children: n });
|
|
135
|
+
}
|
|
136
|
+
export {
|
|
137
|
+
le as AtlassianAppForge,
|
|
138
|
+
le as default
|
|
139
|
+
};
|