@valiantys/atlassian-app-frontend 3.0.0-alpha-10 → 3.0.0-alpha-17

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.
Files changed (48) hide show
  1. package/atlassian/jira/shared/data-access-issue/src/lib/jira-issue-service/index.cjs.js +1 -1
  2. package/atlassian/jira/shared/data-access-issue/src/lib/jira-issue-service/index.es.js +36 -22
  3. package/atlassian/shared/data-access-atlassian-product-fetch-oauth/src/lib/atlassian-oauth-fetch/index.cjs.js +1 -1
  4. package/atlassian/shared/data-access-atlassian-product-fetch-oauth/src/lib/atlassian-oauth-fetch/index.es.js +74 -28
  5. package/atlassian/shared/data-access-atlassian-product-fetch-oauth/src/lib/route/index.cjs.js +1 -1
  6. package/atlassian/shared/data-access-atlassian-product-fetch-oauth/src/lib/route/index.es.js +28 -17
  7. package/atlassian/shared/frontend-feature-atlassian-app/src/lib/standalone/atlassian-app-standalone/index.cjs.js +1 -1
  8. package/atlassian/shared/frontend-feature-atlassian-app/src/lib/standalone/atlassian-app-standalone/index.es.js +93 -84
  9. package/atlassian/shared/frontend-feature-oauth-login/src/lib/feature-oauth/index.cjs.js +1 -1
  10. package/atlassian/shared/frontend-feature-oauth-login/src/lib/feature-oauth/index.es.js +58 -66
  11. package/atlassian/shared/frontend-feature-oauth-login/src/lib/oauth-routes/index.cjs.js +1 -0
  12. package/atlassian/shared/frontend-feature-oauth-login/src/lib/oauth-routes/index.es.js +51 -0
  13. package/atlassian/shared/frontend-ui-page-loading-view/src/lib/page-loading-view/index.cjs.js +1 -1
  14. package/atlassian/shared/frontend-ui-page-loading-view/src/lib/page-loading-view/index.es.js +1 -1
  15. package/atlassian-app/index.d.ts +1 -0
  16. package/atlassian-app-standalone/atlassian-app-frontend-atlassian-app-standalone.api.json +29 -2
  17. package/atlassian-app-standalone/atlassian-app-frontend.api.md +3 -1
  18. package/atlassian-app-standalone/index.d.ts +3 -1
  19. package/atlassian-app-test/index.d.ts +1 -1
  20. package/data-access-assets/index.d.ts +1 -1
  21. package/data-access-atlassian-product-fetch-oauth/atlassian-app-frontend-data-access-atlassian-product-fetch-oauth.api.json +354 -2
  22. package/data-access-atlassian-product-fetch-oauth/atlassian-app-frontend.api.md +20 -1
  23. package/data-access-atlassian-product-fetch-oauth/index.cjs.js +1 -1
  24. package/data-access-atlassian-product-fetch-oauth/index.d.ts +14 -2
  25. package/data-access-atlassian-product-fetch-oauth/index.es.js +10 -7
  26. package/data-access-issue/atlassian-app-frontend-data-access-issue.api.json +238 -9
  27. package/data-access-issue/atlassian-app-frontend.api.md +12 -5
  28. package/data-access-issue/index.d.ts +40 -17
  29. package/data-access-jql/index.d.ts +1 -1
  30. package/data-access-workspaces/index.d.ts +1 -1
  31. package/package.json +1 -1
  32. package/shared/util-fetch/src/lib/shared-util-fetch/index.cjs.js +2 -2
  33. package/shared/util-fetch/src/lib/shared-util-fetch/index.es.js +25 -24
  34. package/ui-atlassian-product-fetch/index.d.ts +1 -1
  35. package/ui-oauth-login/atlassian-app-frontend-ui-oauth-login.api.json +340 -0
  36. package/ui-oauth-login/atlassian-app-frontend.api.md +29 -0
  37. package/ui-oauth-login/index.cjs.js +1 -1
  38. package/ui-oauth-login/index.d.ts +23 -0
  39. package/ui-oauth-login/index.es.js +7 -3
  40. package/ui-page-loading-view/atlassian-app-frontend-ui-page-loading-view.api.json +10 -5
  41. package/ui-page-loading-view/atlassian-app-frontend.api.md +2 -2
  42. package/ui-page-loading-view/index.d.ts +2 -2
  43. package/util-atlassian-product-fetch/atlassian-app-frontend-util-atlassian-product-fetch.api.json +106 -20
  44. package/util-atlassian-product-fetch/atlassian-app-frontend.api.md +13 -5
  45. package/util-atlassian-product-fetch/index.d.ts +10 -5
  46. package/util-jira-v3-api/atlassian-app-frontend-util-jira-v3-api.api.json +695 -80
  47. package/util-jira-v3-api/atlassian-app-frontend.api.md +71 -24
  48. package/util-jira-v3-api/index.d.ts +46 -19
@@ -1,141 +1,150 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import B from "@atlaskit/app-provider";
3
- import { useState as k, useCallback as d, useEffect as O, lazy as W } from "react";
4
- import { atlassianOAuthJiraFetch as x, atlassianOAuthConfluenceFetch as C, atlassianOAuthBitbucketFetch as E } from "../../../../../data-access-atlassian-product-fetch-oauth/src/lib/atlassian-oauth-fetch/index.es.js";
5
- import { AtlassianUserResourceService as J } from "../../../../../data-access-resources/src/lib/atlassian-user-resource-service/index.es.js";
6
- import { FeatureChosenWorkspaceCheck as T } from "../../../../../frontend-feature-chosen-workspace-check/src/lib/feature-chosen-workspace-check/index.es.js";
2
+ import g from "@atlaskit/app-provider";
3
+ import { useState as R, useCallback as d, useEffect as C, lazy as O } from "react";
4
+ import { atlassianOAuthJiraFetch as W, atlassianOAuthConfluenceFetch as E, atlassianOAuthBitbucketFetch as J } from "../../../../../data-access-atlassian-product-fetch-oauth/src/lib/atlassian-oauth-fetch/index.es.js";
5
+ import { AtlassianUserResourceService as T } from "../../../../../data-access-resources/src/lib/atlassian-user-resource-service/index.es.js";
6
+ import { FeatureChosenWorkspaceCheck as y } from "../../../../../frontend-feature-chosen-workspace-check/src/lib/feature-chosen-workspace-check/index.es.js";
7
7
  import "../../../../../frontend-feature-chosen-workspace-check/src/lib/jira-workspace-provider/index.es.js";
8
- import { OAuthProvider as y, useOAuth as H } from "../../../../../frontend-feature-oauth-login/src/lib/feature-oauth/index.es.js";
8
+ import { OAuthProvider as H, useOAuth as $ } from "../../../../../frontend-feature-oauth-login/src/lib/feature-oauth/index.es.js";
9
+ import "../../../../../frontend-feature-oauth-login/src/lib/oauth-routes/index.es.js";
10
+ import "@atlaskit/heading";
11
+ import "@atlaskit/primitives";
12
+ import "@atlaskit/section-message";
13
+ import "@atlaskit/spinner";
9
14
  import "../../../../../frontend-ui-app-flags/src/lib/app-flags-dispatch/index.es.js";
10
- import { AppFlagsProviderAtlasKit as $ } from "../../../../../frontend-ui-app-flags/src/lib/app-flags-provider-atlaskit/index.es.js";
11
- import { RequestBitbucketProvider as b } from "../../../../../frontend-ui-atlassian-product-fetch/src/lib/request-bitbucket/index.es.js";
12
- import { RequestConfluenceProvider as j } from "../../../../../frontend-ui-atlassian-product-fetch/src/lib/request-confluence/index.es.js";
13
- import { RequestJiraProvider as z } from "../../../../../frontend-ui-atlassian-product-fetch/src/lib/request-jira/index.es.js";
14
- import { BackendAdapterProvider as K } from "../../../../../frontend-ui-backend-adapter/src/lib/backend-adapter/index.es.js";
15
- import { getOauthFetchInvokeImpl as M } from "../../../../../frontend-ui-backend-adapter/src/lib/oauth-fetch-invoke/index.es.js";
16
- import { WindowHostRouter as D } from "../../../../../frontend-ui-host-router/src/lib/host-router/index.es.js";
15
+ import { AppFlagsProviderAtlasKit as b } from "../../../../../frontend-ui-app-flags/src/lib/app-flags-provider-atlaskit/index.es.js";
16
+ import { RequestBitbucketProvider as j } from "../../../../../frontend-ui-atlassian-product-fetch/src/lib/request-bitbucket/index.es.js";
17
+ import { RequestConfluenceProvider as z } from "../../../../../frontend-ui-atlassian-product-fetch/src/lib/request-confluence/index.es.js";
18
+ import { RequestJiraProvider as K } from "../../../../../frontend-ui-atlassian-product-fetch/src/lib/request-jira/index.es.js";
19
+ import { BackendAdapterProvider as M } from "../../../../../frontend-ui-backend-adapter/src/lib/backend-adapter/index.es.js";
20
+ import { getOauthFetchInvokeImpl as D } from "../../../../../frontend-ui-backend-adapter/src/lib/oauth-fetch-invoke/index.es.js";
21
+ import { WindowHostRouter as G } from "../../../../../frontend-ui-host-router/src/lib/host-router/index.es.js";
17
22
  import "@atlaskit/button/new";
18
- import { HostRouterProvider as G } from "../../../../../frontend-ui-host-router/src/lib/host-router-provider/index.es.js";
23
+ import { HostRouterProvider as L } from "../../../../../frontend-ui-host-router/src/lib/host-router-provider/index.es.js";
19
24
  import "../../../../../frontend-ui-modal/src/lib/modal-content/index.es.js";
20
- import "@atlaskit/heading";
21
- import "@atlaskit/primitives";
22
- import { WindowModalService as L } from "../../../../../frontend-ui-modal/src/lib/modal-service/index.es.js";
23
- import { ModalServiceProvider as Q } from "../../../../../frontend-ui-modal/src/lib/modal-service-provider/index.es.js";
24
- import { ModalViewContext as U } from "../../../../../frontend-ui-modal/src/lib/modal-view-context/index.es.js";
25
- import { RemoteAdapterProvider as X } from "../../../../../frontend-ui-remote-adapter/src/lib/remote-adapter/index.es.js";
26
- import { oauthFetchInvokeRemote as Y } from "../../../../../frontend-ui-remote-adapter/src/lib/oauth-fetch-invoke-remote/index.es.js";
27
- import { ViewContextProvider as Z } from "../../../../../frontend-ui-view-context/src/lib/view-context-provider/index.es.js";
28
- import { MockViewContext as _ } from "../../../../../frontend-ui-view-context/src/lib/mock-view-context/index.es.js";
29
- const V = W(
25
+ import { WindowModalService as Q } from "../../../../../frontend-ui-modal/src/lib/modal-service/index.es.js";
26
+ import { ModalServiceProvider as U } from "../../../../../frontend-ui-modal/src/lib/modal-service-provider/index.es.js";
27
+ import { ModalViewContext as X } from "../../../../../frontend-ui-modal/src/lib/modal-view-context/index.es.js";
28
+ import { RemoteAdapterProvider as Y } from "../../../../../frontend-ui-remote-adapter/src/lib/remote-adapter/index.es.js";
29
+ import { oauthFetchInvokeRemote as Z } from "../../../../../frontend-ui-remote-adapter/src/lib/oauth-fetch-invoke-remote/index.es.js";
30
+ import { ViewContextProvider as _ } from "../../../../../frontend-ui-view-context/src/lib/view-context-provider/index.es.js";
31
+ import { MockViewContext as V } from "../../../../../frontend-ui-view-context/src/lib/mock-view-context/index.es.js";
32
+ const N = O(
30
33
  () => import("../../../../../frontend-feature-chosen-resource-check/src/index/index.es.js")
31
34
  );
32
- function Oe({
33
- initialMockViewContext: n,
35
+ function Ee({
36
+ initialMockViewContext: i,
34
37
  backendUrl: c,
35
38
  remoteUrl: l,
36
39
  doCheckWorkspace: I,
37
- appName: i,
38
- doCheckResource: u,
39
- modalOpenerConfig: p,
40
+ appName: s,
41
+ doCheckResource: p,
42
+ modalOpenerConfig: u,
40
43
  modalContextConfig: a,
41
- oauthConfig: s,
44
+ oauthConfig: n,
45
+ atlassianResourceId: A,
42
46
  children: t
43
47
  }) {
44
48
  const h = /* @__PURE__ */ r(
45
- N,
49
+ ee,
46
50
  {
47
- appName: i,
51
+ appName: s,
48
52
  backendUrl: c,
49
53
  remoteUrl: l,
50
- initialMockViewContext: n,
51
- modalOpenerConfig: p,
54
+ initialMockViewContext: i,
55
+ modalOpenerConfig: u,
52
56
  modalContextConfig: a,
53
57
  doCheckWorkspace: I,
54
- doCheckResource: u,
55
- oauthConfig: s,
58
+ doCheckResource: p,
59
+ oauthConfig: n,
60
+ atlassianResourceId: A,
56
61
  children: t
57
62
  }
58
63
  );
59
- return s ? /* @__PURE__ */ r(
60
- y,
64
+ return n ? /* @__PURE__ */ r(
65
+ H,
61
66
  {
62
- clientId: s.clientId,
63
- codeTokenExchangeUrl: s.codeTokenExchangeUrl,
64
- appName: i,
65
- oAuthScopes: s.oAuthScopes,
67
+ clientId: n.clientId,
68
+ codeTokenExchangeUrl: n.codeTokenExchangeUrl,
69
+ appName: s,
70
+ oAuthScopes: n.oAuthScopes,
71
+ appBaseContext: n.appBaseContext,
66
72
  children: h
67
73
  }
68
74
  ) : h;
69
75
  }
70
- function N({
71
- initialMockViewContext: n,
76
+ function ee({
77
+ initialMockViewContext: i,
72
78
  backendUrl: c,
73
79
  remoteUrl: l,
74
80
  doCheckWorkspace: I,
75
- appName: i,
76
- doCheckResource: u,
77
- modalOpenerConfig: p,
81
+ appName: s,
82
+ doCheckResource: p,
83
+ modalOpenerConfig: u,
78
84
  modalContextConfig: a,
79
- children: s
85
+ atlassianResourceId: n,
86
+ children: A
80
87
  }) {
81
- const [t, h] = k(), [m, R] = k(), { getAuthToken: o } = H(), F = d(() => x(o(), t ?? ""), [o, t]), P = d(() => C(o(), t ?? ""), [o, t]), w = d(() => E(o()), [o]), g = d(
88
+ const [t, h] = R(
89
+ n
90
+ ), [m, F] = R(), { getAuthToken: o } = $(), P = d(() => W(o(), t ?? ""), [o, t]), w = d(() => E(o(), t ?? ""), [o, t]), B = d(() => J(o()), [o]), q = d(
82
91
  async (f) => {
83
- if (c && u) {
84
- const A = f ?? localStorage.getItem(`${i}-user-resource-id`) ?? "", v = await new J().checkUserChosenResource(
92
+ if (c && p) {
93
+ const S = f ?? localStorage.getItem(`${s}-user-resource-id`) ?? "", v = await new T().checkUserChosenResource(
85
94
  o(),
86
- A
95
+ S
87
96
  );
88
97
  return v.hasChosen && (localStorage.setItem(
89
- `${i}-user-resource-id`,
98
+ `${s}-user-resource-id`,
90
99
  v.resource.id
91
100
  ), h(v.resource.id)), v;
92
101
  } else
93
102
  return { hasChosen: !0 };
94
103
  },
95
- [c, o, i, u]
104
+ [c, o, s, p]
96
105
  );
97
- O(() => {
98
- const f = t ?? (n == null ? void 0 : n.cloudId) ?? "";
106
+ C(() => {
107
+ const f = t ?? (i == null ? void 0 : i.cloudId) ?? "";
99
108
  if (!m || m.cloudId !== f) {
100
- const A = {
101
- ...m || n,
109
+ const S = {
110
+ ...m || i,
102
111
  cloudId: f
103
112
  };
104
- R(A);
113
+ F(S);
105
114
  }
106
- }, [n, t, m]);
107
- const q = d(
108
- () => c ? M(c, o(), t ?? "") : void 0,
115
+ }, [i, t, m]);
116
+ const x = d(
117
+ () => c ? D(c, o(), t ?? "") : void 0,
109
118
  [t, o, c]
110
119
  );
111
- let e = s;
112
- I && (e = /* @__PURE__ */ r(T, { appName: i, children: e })), p && (e = /* @__PURE__ */ r(
113
- Q,
120
+ let e = A;
121
+ I && (e = /* @__PURE__ */ r(y, { appName: s, children: e })), u && (e = /* @__PURE__ */ r(
122
+ U,
114
123
  {
115
- modalService: new L(
116
- p.defaultUrl,
117
- p.resourceMap
124
+ modalService: new Q(
125
+ u.defaultUrl,
126
+ u.resourceMap
118
127
  ),
119
128
  children: e
120
129
  }
121
130
  )), m && (e = /* @__PURE__ */ r(
122
- Z,
131
+ _,
123
132
  {
124
- viewContext: a ? new U(m, a.openerOrigin) : new _(m),
133
+ viewContext: a ? new X(m, a.openerOrigin) : new V(m),
125
134
  children: e
126
135
  }
127
- )), e = /* @__PURE__ */ r(G, { hostRouter: new D(), children: /* @__PURE__ */ r(
128
- b,
136
+ )), e = /* @__PURE__ */ r(L, { hostRouter: new G(), children: /* @__PURE__ */ r(
137
+ j,
129
138
  {
130
- requestBitbucketImplementation: w(),
139
+ requestBitbucketImplementation: B(),
131
140
  children: /* @__PURE__ */ r(
132
- j,
141
+ z,
133
142
  {
134
- requestConfluenceImplementation: P(),
143
+ requestConfluenceImplementation: w(),
135
144
  children: /* @__PURE__ */ r(
136
- z,
145
+ K,
137
146
  {
138
- requestJiraImplementation: F(),
147
+ requestJiraImplementation: P(),
139
148
  children: e
140
149
  }
141
150
  )
@@ -143,16 +152,16 @@ function N({
143
152
  )
144
153
  }
145
154
  ) });
146
- const S = q();
147
- return S && (e = /* @__PURE__ */ r(K, { invokeImplementation: S, children: e })), l && (e = /* @__PURE__ */ r(
148
- X,
155
+ const k = x();
156
+ return k && (e = /* @__PURE__ */ r(M, { invokeImplementation: k, children: e })), l && (e = /* @__PURE__ */ r(
157
+ Y,
149
158
  {
150
- invokeRemoteImplementation: Y(l),
159
+ invokeRemoteImplementation: Z(l),
151
160
  children: e
152
161
  }
153
- )), u && (e = /* @__PURE__ */ r(V, { checkResource: g, children: e })), /* @__PURE__ */ r(B, { children: /* @__PURE__ */ r($, { children: e }) });
162
+ )), p && (e = /* @__PURE__ */ r(N, { checkResource: q, children: e })), /* @__PURE__ */ r(g, { children: /* @__PURE__ */ r(b, { children: e }) });
154
163
  }
155
164
  export {
156
- Oe as AtlassianAppStandalone,
157
- Oe as default
165
+ Ee as AtlassianAppStandalone,
166
+ Ee as default
158
167
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),d=require("@atlaskit/primitives"),a=require("react"),r=require("react-router-dom"),w=require("../ui-oauth-callback/index.cjs.js"),j=require("../ui-oauth-redirect-login/index.cjs.js"),g=require("../util/index.cjs.js"),v=d.xcss({paddingBlockStart:"space.1000"}),h=a.createContext(null),O=()=>{const o=a.useContext(h);return o||(console.warn("No OAuth provider"),{getAuthToken:()=>""})};function x({children:o,...e}){const[u,m]=a.useState(localStorage.getItem(`${e.appName}-auth-token`)),i=localStorage.getItem(`${e.appName}-auth-expires-at`),[n,A]=a.useState(i?Number(i):null),l=window.location.protocol+"//"+window.location.hostname+(window.location.port?`:${window.location.port}`:""),c=l+"/callback";function k(){return n&&u&&!p(n)?u:(g.redirectLogin(e.clientId,c,e.oAuthScopes),"")}function S(s){m(s.token),localStorage.setItem(`${e.appName}-auth-token`,s.token),A(s.expiresAt),localStorage.setItem(`${e.appName}-auth-expires-at`,s.expiresAt.toString()),localStorage.removeItem(`${e.appName}-user-resource-id`),localStorage.removeItem(`${e.appName}-user-workspace-id`),window.location.href=l}return!u||!n||p(n)?t.jsx(d.Flex,{justifyContent:"center",xcss:v,children:t.jsx(r.BrowserRouter,{children:t.jsxs(r.Routes,{children:[t.jsx(r.Route,{path:"/",element:t.jsx(j.OAuthRedirectLogin,{clientId:e.clientId,redirectUri:c,oAuthScopes:e.oAuthScopes})}),t.jsx(r.Route,{path:"/callback",element:t.jsx(w.OAuthCallback,{setAuth:S,redirectUri:c,codeTokenExchangeUrl:e.codeTokenExchangeUrl})}),t.jsx(r.Route,{path:"/*",element:t.jsx(r.Navigate,{to:"/",replace:!0})})]})})}):t.jsx(h.Provider,{value:{getAuthToken:k},children:o})}function p(o){return o<Date.now()}exports.OAuthProvider=x;exports.default=x;exports.useOAuth=O;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),t=require("react"),w=require("../oauth-routes/index.cjs.js"),A=require("../util/index.cjs.js"),p=t.createContext(null),S=()=>{const o=t.useContext(p);return o||(console.warn("No OAuth provider"),{getAuthToken:()=>""})};function i({children:o,...e}){const s=t.useMemo(()=>localStorage.getItem(`${e.appName}-auth-token`),[e.appName]),a=t.useMemo(()=>{const r=localStorage.getItem(`${e.appName}-auth-expires-at`);return r?Number(r):null},[e.appName]),n=t.useMemo(()=>window.location.protocol+"//"+window.location.hostname+(window.location.port?`:${window.location.port}`:"")+(e.appBaseContext??""),[e.appBaseContext]),u=t.useMemo(()=>n+"/callback?location="+window.location.href,[n]),m=t.useMemo(()=>(e.appBaseContext??"")+"/callback",[e.appBaseContext]),h=t.useCallback(r=>{localStorage.setItem(`${e.appName}-auth-token`,r.token),localStorage.setItem(`${e.appName}-auth-expires-at`,r.expiresAt.toString()),localStorage.removeItem(`${e.appName}-user-resource-id`),localStorage.removeItem(`${e.appName}-user-workspace-id`);const x=new URLSearchParams(window.location.search);window.location.href=x.get("location")??n},[e.appName,n]),d=t.useMemo(()=>({getAuthToken:()=>a&&s&&!c(a)?s:(A.redirectLogin(e.clientId,u,e.oAuthScopes),"")}),[e.clientId,e.oAuthScopes,a,u,s]);return!s||!a||c(a)?l.jsx(w.OAuthRoutes,{setAuth:h,redirectUri:u,oAuthScopes:e.oAuthScopes,codeTokenExchangeUrl:e.codeTokenExchangeUrl,callbackPath:m,clientId:e.clientId}):l.jsx(p.Provider,{value:d,children:o})}function c(o){return o<Date.now()}exports.OAuthProvider=i;exports.default=i;exports.useOAuth=S;
@@ -1,73 +1,65 @@
1
- import { jsx as t, jsxs as k } from "react/jsx-runtime";
2
- import { Flex as w, xcss as S } from "@atlaskit/primitives";
3
- import { useState as p, createContext as I, useContext as N } from "react";
4
- import { BrowserRouter as g, Routes as f, Route as l, Navigate as v } from "react-router-dom";
5
- import { OAuthCallback as $ } from "../ui-oauth-callback/index.es.js";
6
- import { OAuthRedirectLogin as O } from "../ui-oauth-redirect-login/index.es.js";
7
- import { redirectLogin as T } from "../util/index.es.js";
8
- const C = S({
9
- paddingBlockStart: "space.1000"
10
- }), m = I(null), L = () => {
11
- const o = N(m);
12
- return o || (console.warn("No OAuth provider"), { getAuthToken: () => "" });
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import { useMemo as o, useCallback as w, createContext as x, useContext as A } from "react";
3
+ import { OAuthRoutes as k } from "../oauth-routes/index.es.js";
4
+ import { redirectLogin as S } from "../util/index.es.js";
5
+ const u = x(null), v = () => {
6
+ const t = A(u);
7
+ return t || (console.warn("No OAuth provider"), { getAuthToken: () => "" });
13
8
  };
14
- function P({
15
- children: o,
9
+ function b({
10
+ children: t,
16
11
  ...e
17
12
  }) {
18
- const [a, d] = p(
19
- localStorage.getItem(`${e.appName}-auth-token`)
20
- ), c = localStorage.getItem(
21
- `${e.appName}-auth-expires-at`
22
- ), [r, h] = p(
23
- c ? Number(c) : null
24
- ), i = window.location.protocol + "//" + window.location.hostname + (window.location.port ? `:${window.location.port}` : ""), s = i + "/callback";
25
- function x() {
26
- return r && a && !u(r) ? a : (T(e.clientId, s, e.oAuthScopes), "");
27
- }
28
- function A(n) {
29
- d(n.token), localStorage.setItem(`${e.appName}-auth-token`, n.token), h(n.expiresAt), localStorage.setItem(
30
- `${e.appName}-auth-expires-at`,
31
- n.expiresAt.toString()
32
- ), localStorage.removeItem(`${e.appName}-user-resource-id`), localStorage.removeItem(`${e.appName}-user-workspace-id`), window.location.href = i;
33
- }
34
- return !a || !r || u(r) ? /* @__PURE__ */ t(w, { justifyContent: "center", xcss: C, children: /* @__PURE__ */ t(g, { children: /* @__PURE__ */ k(f, { children: [
35
- /* @__PURE__ */ t(
36
- l,
37
- {
38
- path: "/",
39
- element: /* @__PURE__ */ t(
40
- O,
41
- {
42
- clientId: e.clientId,
43
- redirectUri: s,
44
- oAuthScopes: e.oAuthScopes
45
- }
46
- )
47
- }
48
- ),
49
- /* @__PURE__ */ t(
50
- l,
51
- {
52
- path: "/callback",
53
- element: /* @__PURE__ */ t(
54
- $,
55
- {
56
- setAuth: A,
57
- redirectUri: s,
58
- codeTokenExchangeUrl: e.codeTokenExchangeUrl
59
- }
60
- )
61
- }
62
- ),
63
- /* @__PURE__ */ t(l, { path: "/*", element: /* @__PURE__ */ t(v, { to: "/", replace: !0 }) })
64
- ] }) }) }) : /* @__PURE__ */ t(m.Provider, { value: { getAuthToken: x }, children: o });
13
+ const n = o(
14
+ () => localStorage.getItem(`${e.appName}-auth-token`),
15
+ [e.appName]
16
+ ), a = o(() => {
17
+ const r = localStorage.getItem(
18
+ `${e.appName}-auth-expires-at`
19
+ );
20
+ return r ? Number(r) : null;
21
+ }, [e.appName]), s = o(
22
+ () => window.location.protocol + "//" + window.location.hostname + (window.location.port ? `:${window.location.port}` : "") + (e.appBaseContext ?? ""),
23
+ [e.appBaseContext]
24
+ ), l = o(
25
+ () => s + "/callback?location=" + window.location.href,
26
+ [s]
27
+ ), m = o(
28
+ () => (e.appBaseContext ?? "") + "/callback",
29
+ [e.appBaseContext]
30
+ ), i = w(
31
+ (r) => {
32
+ localStorage.setItem(`${e.appName}-auth-token`, r.token), localStorage.setItem(
33
+ `${e.appName}-auth-expires-at`,
34
+ r.expiresAt.toString()
35
+ ), localStorage.removeItem(`${e.appName}-user-resource-id`), localStorage.removeItem(`${e.appName}-user-workspace-id`);
36
+ const d = new URLSearchParams(window.location.search);
37
+ window.location.href = d.get("location") ?? s;
38
+ },
39
+ [e.appName, s]
40
+ ), h = o(
41
+ () => ({
42
+ getAuthToken: () => a && n && !c(a) ? n : (S(e.clientId, l, e.oAuthScopes), "")
43
+ }),
44
+ [e.clientId, e.oAuthScopes, a, l, n]
45
+ );
46
+ return !n || !a || c(a) ? /* @__PURE__ */ p(
47
+ k,
48
+ {
49
+ setAuth: i,
50
+ redirectUri: l,
51
+ oAuthScopes: e.oAuthScopes,
52
+ codeTokenExchangeUrl: e.codeTokenExchangeUrl,
53
+ callbackPath: m,
54
+ clientId: e.clientId
55
+ }
56
+ ) : /* @__PURE__ */ p(u.Provider, { value: h, children: t });
65
57
  }
66
- function u(o) {
67
- return o < Date.now();
58
+ function c(t) {
59
+ return t < Date.now();
68
60
  }
69
61
  export {
70
- P as OAuthProvider,
71
- P as default,
72
- L as useOAuth
62
+ b as OAuthProvider,
63
+ b as default,
64
+ v as useOAuth
73
65
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("@atlaskit/primitives"),t=require("react-router-dom"),a=require("../ui-oauth-callback/index.cjs.js"),l=require("../ui-oauth-redirect-login/index.cjs.js"),x=r.xcss({paddingBlockStart:"space.1000"});function h({codeTokenExchangeUrl:u,clientId:o,oAuthScopes:n,redirectUri:s,callbackPath:i,setAuth:c}){return e.jsx(r.Flex,{justifyContent:"center",xcss:x,children:e.jsx(t.BrowserRouter,{children:e.jsxs(t.Routes,{children:[e.jsx(t.Route,{path:"/",element:e.jsx(l.OAuthRedirectLogin,{clientId:o,redirectUri:s,oAuthScopes:n})}),e.jsx(t.Route,{path:i,element:e.jsx(a.OAuthCallback,{setAuth:c,redirectUri:s,codeTokenExchangeUrl:u})}),e.jsx(t.Route,{path:"/*",element:e.jsx(t.Navigate,{to:"/",replace:!0})})]})})})}exports.OAuthRoutes=h;
@@ -0,0 +1,51 @@
1
+ import { jsx as t, jsxs as m } from "react/jsx-runtime";
2
+ import { Flex as a, xcss as l } from "@atlaskit/primitives";
3
+ import { BrowserRouter as p, Routes as u, Route as e, Navigate as h } from "react-router-dom";
4
+ import { OAuthCallback as f } from "../ui-oauth-callback/index.es.js";
5
+ import { OAuthRedirectLogin as x } from "../ui-oauth-redirect-login/index.es.js";
6
+ const d = l({
7
+ paddingBlockStart: "space.1000"
8
+ });
9
+ function k({
10
+ codeTokenExchangeUrl: r,
11
+ clientId: n,
12
+ oAuthScopes: s,
13
+ redirectUri: o,
14
+ callbackPath: c,
15
+ setAuth: i
16
+ }) {
17
+ return /* @__PURE__ */ t(a, { justifyContent: "center", xcss: d, children: /* @__PURE__ */ t(p, { children: /* @__PURE__ */ m(u, { children: [
18
+ /* @__PURE__ */ t(
19
+ e,
20
+ {
21
+ path: "/",
22
+ element: /* @__PURE__ */ t(
23
+ x,
24
+ {
25
+ clientId: n,
26
+ redirectUri: o,
27
+ oAuthScopes: s
28
+ }
29
+ )
30
+ }
31
+ ),
32
+ /* @__PURE__ */ t(
33
+ e,
34
+ {
35
+ path: c,
36
+ element: /* @__PURE__ */ t(
37
+ f,
38
+ {
39
+ setAuth: i,
40
+ redirectUri: o,
41
+ codeTokenExchangeUrl: r
42
+ }
43
+ )
44
+ }
45
+ ),
46
+ /* @__PURE__ */ t(e, { path: "/*", element: /* @__PURE__ */ t(h, { to: "/", replace: !0 }) })
47
+ ] }) }) });
48
+ }
49
+ export {
50
+ k as OAuthRoutes
51
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),s=require("@atlaskit/heading"),o=require("@atlaskit/primitives"),a=require("@atlaskit/section-message"),c=require("@atlaskit/spinner");function r({label:n,loadingError:i,labelSize:t}){return e.jsxs(o.Flex,{direction:"column",children:[e.jsx(s,{size:t||"large",children:n}),i?e.jsx(a,{appearance:"error",children:i}):e.jsx(c,{interactionName:"load"})]})}exports.PageLoadingView=r;exports.default=r;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),s=require("@atlaskit/heading"),o=require("@atlaskit/primitives"),a=require("@atlaskit/section-message"),c=require("@atlaskit/spinner");function r({label:n,loadingError:i,labelSize:t}){return e.jsxs(o.Flex,{direction:"column",children:[e.jsx(s,{size:t??"large",children:n}),i?e.jsx(a,{appearance:"error",children:i}):e.jsx(c,{interactionName:"load"})]})}exports.PageLoadingView=r;exports.default=r;
@@ -9,7 +9,7 @@ function g({
9
9
  labelSize: o
10
10
  }) {
11
11
  return /* @__PURE__ */ n(a, { direction: "column", children: [
12
- /* @__PURE__ */ e(t, { size: o || "large", children: i }),
12
+ /* @__PURE__ */ e(t, { size: o ?? "large", children: i }),
13
13
  r ? /* @__PURE__ */ e(m, { appearance: "error", children: r }) : /* @__PURE__ */ e(c, { interactionName: "load" })
14
14
  ] });
15
15
  }
@@ -104,6 +104,7 @@ export declare const IS_STANDALONE: boolean;
104
104
  declare interface OAuthProviderProps {
105
105
  clientId: string;
106
106
  codeTokenExchangeUrl: string;
107
+ appBaseContext?: string;
107
108
  /**
108
109
  * OAuth App Name
109
110
  */
@@ -179,7 +179,7 @@
179
179
  "excerptTokens": [
180
180
  {
181
181
  "kind": "Content",
182
- "text": "export declare function AtlassianAppStandalone({ initialMockViewContext, backendUrl, remoteUrl, doCheckWorkspace, appName, doCheckResource, modalOpenerConfig, modalContextConfig, oauthConfig, children, }: "
182
+ "text": "export declare function AtlassianAppStandalone({ initialMockViewContext, backendUrl, remoteUrl, doCheckWorkspace, appName, doCheckResource, modalOpenerConfig, modalContextConfig, oauthConfig, atlassianResourceId, children, }: "
183
183
  },
184
184
  {
185
185
  "kind": "Reference",
@@ -226,7 +226,7 @@
226
226
  "overloadIndex": 1,
227
227
  "parameters": [
228
228
  {
229
- "parameterName": "{ initialMockViewContext, backendUrl, remoteUrl, doCheckWorkspace, appName, doCheckResource, modalOpenerConfig, modalContextConfig, oauthConfig, children, }",
229
+ "parameterName": "{ initialMockViewContext, backendUrl, remoteUrl, doCheckWorkspace, appName, doCheckResource, modalOpenerConfig, modalContextConfig, oauthConfig, atlassianResourceId, children, }",
230
230
  "parameterTypeTokenRange": {
231
231
  "startIndex": 1,
232
232
  "endIndex": 5
@@ -278,6 +278,33 @@
278
278
  "endIndex": 2
279
279
  }
280
280
  },
281
+ {
282
+ "kind": "PropertySignature",
283
+ "canonicalReference": "@valiantys/atlassian-app-frontend!JiraStandaloneAppWrapperProps#atlassianResourceId:member",
284
+ "docComment": "",
285
+ "excerptTokens": [
286
+ {
287
+ "kind": "Content",
288
+ "text": "atlassianResourceId?: "
289
+ },
290
+ {
291
+ "kind": "Content",
292
+ "text": "string"
293
+ },
294
+ {
295
+ "kind": "Content",
296
+ "text": ";"
297
+ }
298
+ ],
299
+ "isReadonly": false,
300
+ "isOptional": true,
301
+ "releaseTag": "Public",
302
+ "name": "atlassianResourceId",
303
+ "propertyTypeTokenRange": {
304
+ "startIndex": 1,
305
+ "endIndex": 2
306
+ }
307
+ },
281
308
  {
282
309
  "kind": "PropertySignature",
283
310
  "canonicalReference": "@valiantys/atlassian-app-frontend!JiraStandaloneAppWrapperProps#backendUrl:member",
@@ -9,13 +9,15 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
9
9
  import { PropsWithChildren } from 'react';
10
10
 
11
11
  // @public (undocumented)
12
- export function AtlassianAppStandalone({ initialMockViewContext, backendUrl, remoteUrl, doCheckWorkspace, appName, doCheckResource, modalOpenerConfig, modalContextConfig, oauthConfig, children, }: PropsWithChildren<JiraStandaloneAppWrapperProps>): JSX_2.Element;
12
+ export function AtlassianAppStandalone({ initialMockViewContext, backendUrl, remoteUrl, doCheckWorkspace, appName, doCheckResource, modalOpenerConfig, modalContextConfig, oauthConfig, atlassianResourceId, children, }: PropsWithChildren<JiraStandaloneAppWrapperProps>): JSX_2.Element;
13
13
 
14
14
  // @public (undocumented)
15
15
  export interface JiraStandaloneAppWrapperProps {
16
16
  // (undocumented)
17
17
  appName: string;
18
18
  // (undocumented)
19
+ atlassianResourceId?: string;
20
+ // (undocumented)
19
21
  backendUrl?: string;
20
22
  // (undocumented)
21
23
  doCheckResource?: boolean;
@@ -2,7 +2,7 @@ import { FullContext } from '@forge/bridge/out/types';
2
2
  import { JSX as JSX_2 } from 'react/jsx-runtime';
3
3
  import { PropsWithChildren } from 'react';
4
4
 
5
- export declare function AtlassianAppStandalone({ initialMockViewContext, backendUrl, remoteUrl, doCheckWorkspace, appName, doCheckResource, modalOpenerConfig, modalContextConfig, oauthConfig, children, }: PropsWithChildren<JiraStandaloneAppWrapperProps>): JSX_2.Element;
5
+ export declare function AtlassianAppStandalone({ initialMockViewContext, backendUrl, remoteUrl, doCheckWorkspace, appName, doCheckResource, modalOpenerConfig, modalContextConfig, oauthConfig, atlassianResourceId, children, }: PropsWithChildren<JiraStandaloneAppWrapperProps>): JSX_2.Element;
6
6
 
7
7
  declare type AtlassianAppStandaloneOauthConfig = OAuthProviderProps & {
8
8
  doCheckResource?: boolean;
@@ -28,11 +28,13 @@ export declare interface JiraStandaloneAppWrapperProps {
28
28
  };
29
29
  appName: string;
30
30
  oauthConfig?: AtlassianAppStandaloneOauthConfig;
31
+ atlassianResourceId?: string;
31
32
  }
32
33
 
33
34
  declare interface OAuthProviderProps {
34
35
  clientId: string;
35
36
  codeTokenExchangeUrl: string;
37
+ appBaseContext?: string;
36
38
  /**
37
39
  * OAuth App Name
38
40
  */
@@ -39,7 +39,7 @@ declare type FetchRoute = {
39
39
  readonly value: string;
40
40
  };
41
41
 
42
- declare type FetchSignature = <T>(request: FetchRequest, body?: Record<string, any>) => Promise<T>;
42
+ declare type FetchSignature = <T>(request: FetchRequest, body?: any) => Promise<T>;
43
43
 
44
44
  declare interface HostRouter {
45
45
  navigate(url: string): Promise<void>;
@@ -225,7 +225,7 @@ declare type FetchRoute = {
225
225
  readonly value: string;
226
226
  };
227
227
 
228
- declare type FetchSignature = <T>(request: FetchRequest, body?: Record<string, any>) => Promise<T>;
228
+ declare type FetchSignature = <T>(request: FetchRequest, body?: any) => Promise<T>;
229
229
 
230
230
  export declare function getAssetLinkedIssues(fetch: AtlassianProductFetchService<'jira'>, workspaceId: string, objectId: string): Promise<ObjectConnectedTickets>;
231
231