@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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=class h{constructor(e){this.fetchSvc=e}async updateField(e,t,s){await this.updateFields(e,{[t]:s})}async updateFields(e,t){await this.fetchSvc.fetch({method:"PUT",url:this.fetchSvc.route`/rest/api/3/issue/${e}`},{fields:t})}async getIssueField(e,t){var s;return(s=await this.getIssueFields(e,[t]))==null?void 0:s[t]}async getIssueFields(e,t){return(await this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}?fields=${t.join(",")}`})).fields}async getIssue(e,t=["*all"]){return this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}?fields=${t.join(",")}`})}async issueSearch(e,t,s=50){let c;const r=[];do{const u=await this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/search/jql?jql=${e}&fields=${t.join(",")}&maxResults=${s}&${c?"nextPageToken="+c:""}`});r.push(...u.issues),c=u.nextPageToken}while(c!==void 0);return r}async addWorklog(e,t){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/3/issue/${e}/worklog`},t)}async queryForIssuesInProjects(e){const t=`project IN (${e.join(",")})`;return this.issueSearch(t,["key"],5e3)}async createIssue(e){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/2/issue`},e)}async updateIssue(e,t){return this.fetchSvc.fetch({method:"PUT",url:this.fetchSvc.route`/rest/api/2/issue/${e}`},t)}async getIssueComments(e,t=0){const s=t?`?startAt=${t}`:"";return this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}/comment${s}`})}async getIssueCommentById(e,t){return this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}/comment/${t}`})}async addIssueComment(e,t){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/3/issue/${e}/comment`},{body:t})}async transitionIssue(e,t){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/3/issue/${e}/transitions`},t)}async createIssueLink(e){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/3/issueLink`},e)}};h.issueUrl="/rest/api/3/issue";let i=h;exports.JiraIssueService=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=class i{constructor(e){this.fetchSvc=e}async updateProperty(e,t,s){return this.fetchSvc.fetch({method:"PUT",url:this.fetchSvc.route`/rest/api/3/issue/${e}/properties/${t}`},s)}async updateField(e,t,s){await this.updateFields(e,{[t]:s})}async updateFields(e,t){await this.updateIssue(e,{fields:t})}async getIssueField(e,t){var s;return(s=await this.getIssueFields(e,[t]))==null?void 0:s[t]}async getIssueFields(e,t){return(await this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}?fields=${t.join(",")}`})).fields}async getIssue(e,t=["*all"],s=!1){return this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}?fields=${t.join(",")}&expand=${s?"renderedFields":""}`})}async issueSearch(e,t,s=50){let c;const h=[];do{const u=await this.issueSearchByPage(e,t,c,s);h.push(...u.issues),c=u.nextPageToken}while(c!==void 0);return h}async issueSearchByPage(e,t,s,c=50){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/3/search/jql`},{fields:t,jql:e,maxResults:c,nextPageToken:s})}async addWorklog(e,t){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/3/issue/${e}/worklog`},t)}async queryForIssuesInProjects(e){const t=`project IN (${e.join(",")})`;return this.issueSearch(t,["key","project"],5e3)}async createIssue(e){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/3/issue`},e)}async updateIssue(e,t){return this.fetchSvc.fetch({method:"PUT",url:this.fetchSvc.route`/rest/api/3/issue/${e}`},t)}async getIssueComments(e,t=0){const s=t?`?startAt=${t}`:"";return this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}/comment${s}`})}async getIssueCommentById(e,t){return this.fetchSvc.fetch({method:"GET",url:this.fetchSvc.route`/rest/api/3/issue/${e}/comment/${t}`})}async addIssueComment(e,t){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/3/issue/${e}/comment`},{body:t})}async transitionIssue(e,t){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/3/issue/${e}/transitions`},t)}async createIssueLink(e){return this.fetchSvc.fetch({method:"POST",url:this.fetchSvc.route`/rest/api/3/issueLink`},e)}};i.issueUrl="/rest/api/3/issue";let r=i;exports.JiraIssueService=r;
@@ -1,19 +1,22 @@
1
- const h = class h {
1
+ const r = class r {
2
2
  constructor(e) {
3
3
  this.fetchSvc = e;
4
4
  }
5
- async updateField(e, t, s) {
6
- await this.updateFields(e, { [t]: s });
7
- }
8
- async updateFields(e, t) {
9
- await this.fetchSvc.fetch(
5
+ async updateProperty(e, t, s) {
6
+ return this.fetchSvc.fetch(
10
7
  {
11
8
  method: "PUT",
12
- url: this.fetchSvc.route`/rest/api/3/issue/${e}`
9
+ url: this.fetchSvc.route`/rest/api/3/issue/${e}/properties/${t}`
13
10
  },
14
- { fields: t }
11
+ s
15
12
  );
16
13
  }
14
+ async updateField(e, t, s) {
15
+ await this.updateFields(e, { [t]: s });
16
+ }
17
+ async updateFields(e, t) {
18
+ await this.updateIssue(e, { fields: t });
19
+ }
17
20
  async getIssueField(e, t) {
18
21
  var s;
19
22
  return (s = await this.getIssueFields(e, [t])) == null ? void 0 : s[t];
@@ -24,23 +27,34 @@ const h = class h {
24
27
  url: this.fetchSvc.route`/rest/api/3/issue/${e}?fields=${t.join(",")}`
25
28
  })).fields;
26
29
  }
27
- async getIssue(e, t = ["*all"]) {
30
+ async getIssue(e, t = ["*all"], s = !1) {
28
31
  return this.fetchSvc.fetch({
29
32
  method: "GET",
30
- url: this.fetchSvc.route`/rest/api/3/issue/${e}?fields=${t.join(",")}`
33
+ url: this.fetchSvc.route`/rest/api/3/issue/${e}?fields=${t.join(",")}&expand=${s ? "renderedFields" : ""}`
31
34
  });
32
35
  }
33
36
  async issueSearch(e, t, s = 50) {
34
37
  let c;
35
- const i = [];
38
+ const h = [];
36
39
  do {
37
- const r = await this.fetchSvc.fetch({
38
- method: "GET",
39
- url: this.fetchSvc.route`/rest/api/3/search/jql?jql=${e}&fields=${t.join(",")}&maxResults=${s}&${c ? "nextPageToken=" + c : ""}`
40
- });
41
- i.push(...r.issues), c = r.nextPageToken;
40
+ const i = await this.issueSearchByPage(e, t, c, s);
41
+ h.push(...i.issues), c = i.nextPageToken;
42
42
  } while (c !== void 0);
43
- return i;
43
+ return h;
44
+ }
45
+ async issueSearchByPage(e, t, s, c = 50) {
46
+ return this.fetchSvc.fetch(
47
+ {
48
+ method: "POST",
49
+ url: this.fetchSvc.route`/rest/api/3/search/jql`
50
+ },
51
+ {
52
+ fields: t,
53
+ jql: e,
54
+ maxResults: c,
55
+ nextPageToken: s
56
+ }
57
+ );
44
58
  }
45
59
  async addWorklog(e, t) {
46
60
  return this.fetchSvc.fetch(
@@ -53,13 +67,13 @@ const h = class h {
53
67
  }
54
68
  async queryForIssuesInProjects(e) {
55
69
  const t = `project IN (${e.join(",")})`;
56
- return this.issueSearch(t, ["key"], 5e3);
70
+ return this.issueSearch(t, ["key", "project"], 5e3);
57
71
  }
58
72
  async createIssue(e) {
59
73
  return this.fetchSvc.fetch(
60
74
  {
61
75
  method: "POST",
62
- url: this.fetchSvc.route`/rest/api/2/issue`
76
+ url: this.fetchSvc.route`/rest/api/3/issue`
63
77
  },
64
78
  e
65
79
  );
@@ -68,7 +82,7 @@ const h = class h {
68
82
  return this.fetchSvc.fetch(
69
83
  {
70
84
  method: "PUT",
71
- url: this.fetchSvc.route`/rest/api/2/issue/${e}`
85
+ url: this.fetchSvc.route`/rest/api/3/issue/${e}`
72
86
  },
73
87
  t
74
88
  );
@@ -115,8 +129,8 @@ const h = class h {
115
129
  );
116
130
  }
117
131
  };
118
- h.issueUrl = "/rest/api/3/issue";
119
- let u = h;
132
+ r.issueUrl = "/rest/api/3/issue";
133
+ let u = r;
120
134
  export {
121
135
  u as JiraIssueService
122
136
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../../../../../../shared/util-fetch/src/lib/shared-util-fetch/index.cjs.js"),o=require("../route/index.cjs.js");function u(t,e){if(e){const n=t.startsWith("/")?t.slice(1):t;return`${e}/${n}`}else return t}function r(t,e,n){return{productType:n,fetch:({url:a,method:s,responseType:c="json",allowExperimental:h=!1},l)=>i.bearerAuthFetch(t,u(a.value,e),s,l,c,{"X-ExperimentalApi":h?"opt-in":""}),route:o.route,rawFetch:(a,s)=>i.bearerAuthFetchRaw(t,u(a.value,e),s),fullUrl:a=>u(a,e)}}function A(t,e){return r(t,`https://api.atlassian.com/ex/jira/${e}`,"jira")}function f(t,e){return r(t,`https://api.atlassian.com/ex/confluence/${e}`,"confluence")}function p(t){return r(t,"https://api.bitbucket.org","bitbucket")}async function F(t){return i.bearerAuthFetch(t,"https://api.atlassian.com/me","GET")}async function O(t,e,n,a,s){return i.jsonFetch("https://auth.atlassian.com/oauth/token","POST",void 0,{grant_type:t,client_id:e,client_secret:n,code:a,redirect_uri:s})}exports.atlassianOAuthBitbucketFetch=p;exports.atlassianOAuthConfluenceFetch=f;exports.atlassianOAuthJiraFetch=A;exports.atlassianOAuthRawFetch=r;exports.getAtlassianOAuthToken=O;exports.getAtlassianUserDetails=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../../../../../shared/util-fetch/src/lib/shared-util-fetch/index.cjs.js"),F=require("../../../../util-error/src/index/index.cjs.js"),u=require("../route/index.cjs.js");function c(t,e){if(e){const a=t.startsWith("/")?t.slice(1):t;return`${e}/${a}`}else return t}function i(t,e,a){return{productType:a,fetch:({url:n,method:r,responseType:f="json",allowExperimental:A=!1},p)=>s.bearerAuthFetch(t,c(n.value,e),r,p,f,{"X-ExperimentalApi":A?"opt-in":""}),route:u.route,rawFetch:(n,r)=>s.bearerAuthFetchRaw(t,c(n.value,e),r),fullUrl:n=>c(n,e)}}function h(t,e){return i(t,`https://api.atlassian.com/ex/jira/${e}`,"jira")}function O(t){return{productType:"jira",fetch:(e,a)=>{const n={request:e,body:a};return s.jsonFetch(t,"POST",void 0,n,"json","include")},route:u.routeNoEscaping,rawFetch:(e,a)=>{throw new Error("Not implemented")},fullUrl:e=>t}}function o(t,e){return i(t,`https://api.atlassian.com/ex/confluence/${e}`,"confluence")}function l(t){return i(t,"https://api.bitbucket.org","bitbucket")}async function b(t){return s.bearerAuthFetch(t,"https://api.atlassian.com/me","GET")}async function g(t,e,a,n,r){return s.jsonFetch("https://auth.atlassian.com/oauth/token","POST",void 0,{grant_type:t,client_id:e,client_secret:a,code:n,redirect_uri:r})}async function d(t,e,a){if(a)switch(t){case"confluence":return o(e,a);case"bitbucket":return l(e);case"jira":default:return h(e,a)}else throw new F.AtlassianBadRequest("resource-id header is missing")}exports.atlassianOAuthBitbucketFetch=l;exports.atlassianOAuthConfluenceFetch=o;exports.atlassianOAuthJiraFetch=h;exports.atlassianOAuthJiraFetchViaProxy=O;exports.atlassianOAuthRawFetch=i;exports.getAtlassianOAuthToken=g;exports.getAtlassianUserDetails=b;exports.getFetch=d;
@@ -1,64 +1,86 @@
1
- import { bearerAuthFetchRaw as l, bearerAuthFetch as c, jsonFetch as f } from "../../../../../../shared/util-fetch/src/lib/shared-util-fetch/index.es.js";
2
- import { route as p } from "../route/index.es.js";
3
- function s(t, e) {
1
+ import { bearerAuthFetchRaw as f, bearerAuthFetch as c, jsonFetch as u } from "../../../../../../shared/util-fetch/src/lib/shared-util-fetch/index.es.js";
2
+ import { AtlassianBadRequest as p } from "../../../../util-error/src/index/index.es.js";
3
+ import { route as m, routeNoEscaping as A } from "../route/index.es.js";
4
+ function i(t, e) {
4
5
  if (e) {
5
6
  const n = t.startsWith("/") ? t.slice(1) : t;
6
7
  return `${e}/${n}`;
7
8
  } else
8
9
  return t;
9
10
  }
10
- function i(t, e, n) {
11
+ function s(t, e, n) {
11
12
  return {
12
13
  productType: n,
13
- fetch: ({ url: a, method: r, responseType: u = "json", allowExperimental: o = !1 }, h) => c(
14
+ fetch: ({ url: r, method: a, responseType: o = "json", allowExperimental: h = !1 }, l) => c(
14
15
  t,
15
- s(a.value, e),
16
- r,
17
- h,
18
- u,
16
+ i(r.value, e),
17
+ a,
18
+ l,
19
+ o,
19
20
  {
20
- "X-ExperimentalApi": o ? "opt-in" : ""
21
+ "X-ExperimentalApi": h ? "opt-in" : ""
21
22
  }
22
23
  ),
23
- route: p,
24
- rawFetch: (a, r) => l(
24
+ route: m,
25
+ rawFetch: (r, a) => f(
25
26
  t,
26
- s(a.value, e),
27
- r
27
+ i(r.value, e),
28
+ a
28
29
  ),
29
- fullUrl: (a) => s(a, e)
30
+ fullUrl: (r) => i(r, e)
30
31
  };
31
32
  }
32
33
  function F(t, e) {
33
- return i(
34
+ return s(
34
35
  t,
35
36
  `https://api.atlassian.com/ex/jira/${e}`,
36
37
  "jira"
37
38
  );
38
39
  }
40
+ function j(t) {
41
+ return {
42
+ productType: "jira",
43
+ fetch: (e, n) => u(
44
+ t,
45
+ "POST",
46
+ void 0,
47
+ {
48
+ request: e,
49
+ body: n
50
+ },
51
+ "json",
52
+ "include"
53
+ ),
54
+ route: A,
55
+ rawFetch: (e, n) => {
56
+ throw new Error("Not implemented");
57
+ },
58
+ fullUrl: (e) => t
59
+ };
60
+ }
39
61
  function b(t, e) {
40
- return i(
62
+ return s(
41
63
  t,
42
64
  `https://api.atlassian.com/ex/confluence/${e}`,
43
65
  "confluence"
44
66
  );
45
67
  }
46
- function O(t) {
47
- return i(
68
+ function w(t) {
69
+ return s(
48
70
  t,
49
71
  "https://api.bitbucket.org",
50
72
  "bitbucket"
51
73
  );
52
74
  }
53
- async function j(t) {
75
+ async function g(t) {
54
76
  return c(
55
77
  t,
56
78
  "https://api.atlassian.com/me",
57
79
  "GET"
58
80
  );
59
81
  }
60
- async function k(t, e, n, a, r) {
61
- return f(
82
+ async function x(t, e, n, r, a) {
83
+ return u(
62
84
  "https://auth.atlassian.com/oauth/token",
63
85
  "POST",
64
86
  void 0,
@@ -66,16 +88,40 @@ async function k(t, e, n, a, r) {
66
88
  grant_type: t,
67
89
  client_id: e,
68
90
  client_secret: n,
69
- code: a,
70
- redirect_uri: r
91
+ code: r,
92
+ redirect_uri: a
71
93
  }
72
94
  );
73
95
  }
96
+ async function v(t, e, n) {
97
+ if (n)
98
+ switch (t) {
99
+ case "confluence":
100
+ return b(
101
+ e,
102
+ n
103
+ );
104
+ case "bitbucket":
105
+ return w(
106
+ e
107
+ );
108
+ case "jira":
109
+ default:
110
+ return F(
111
+ e,
112
+ n
113
+ );
114
+ }
115
+ else
116
+ throw new p("resource-id header is missing");
117
+ }
74
118
  export {
75
- O as atlassianOAuthBitbucketFetch,
119
+ w as atlassianOAuthBitbucketFetch,
76
120
  b as atlassianOAuthConfluenceFetch,
77
121
  F as atlassianOAuthJiraFetch,
78
- i as atlassianOAuthRawFetch,
79
- k as getAtlassianOAuthToken,
80
- j as getAtlassianUserDetails
122
+ j as atlassianOAuthJiraFetchViaProxy,
123
+ s as atlassianOAuthRawFetch,
124
+ x as getAtlassianOAuthToken,
125
+ g as getAtlassianUserDetails,
126
+ v as getFetch
81
127
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class l{constructor(n){this.value_=n}set value(n){throw new Error("modification of a Route is not allowed")}get value(){return this.value_}}function c(t){return t instanceof l}const f=["..",".%2e","%2e.","%2e%2e",".%2E","%2E.","%2E%2e"],h=["/","\\"],r=["?","#"];function i(t,n){return t.some(o=>n.includes(o))}function a(t,n){switch(n){case"path":if(c(t))return t.value;if(t=String(t),i(f,t)||i(r,t)||i(h,t))throw new Error("Disallowing path manipulation attempt. For more information see: https://go.atlassian.com/product-fetch-api-route");return t;case"query":return c(t)?encodeURIComponent(t.value):t instanceof URLSearchParams?t.toString():encodeURIComponent(t)}}function d(t,...n){let o="path",u="";for(let e=0;e<t.length;e++){const s=t[e];if(i(r,s)&&(o="query"),u+=s,e>=n.length)break;u+=a(n[e],o)}return new l(u)}exports.route=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class s{constructor(n){this.value_=n}set value(n){throw new Error("modification of a Route is not allowed")}get value(){return this.value_}}function l(t){return t instanceof s}const f=["..",".%2e","%2e.","%2e%2e",".%2E","%2E.","%2E%2e"],g=["/","\\"],r=["?","#"];function u(t,n){return t.some(o=>n.includes(o))}function h(t,n){switch(n){case"path":if(l(t))return t.value;if(t=String(t),u(f,t)||u(r,t)||u(g,t))throw new Error("Disallowing path manipulation attempt. For more information see: https://go.atlassian.com/product-fetch-api-route");return t;case"query":return l(t)?encodeURIComponent(t.value):t instanceof URLSearchParams?t.toString():encodeURIComponent(t)}}function a(t,...n){let o="path",e="";for(let i=0;i<t.length;i++){const c=t[i];if(u(r,c)&&(o="query"),e+=c,i>=n.length)break;e+=h(n[i],o)}return new s(e)}function d(t,...n){let o="";for(let e=0;e<t.length;e++){const i=t[e];if(o+=i,e>=n.length)break;o+=n[e]}return new s(o)}exports.route=a;exports.routeNoEscaping=d;
@@ -1,4 +1,4 @@
1
- class l {
1
+ class s {
2
2
  constructor(t) {
3
3
  this.value_ = t;
4
4
  }
@@ -9,37 +9,48 @@ class l {
9
9
  return this.value_;
10
10
  }
11
11
  }
12
- function c(n) {
13
- return n instanceof l;
12
+ function l(n) {
13
+ return n instanceof s;
14
14
  }
15
15
  const f = ["..", ".%2e", "%2e.", "%2e%2e", ".%2E", "%2E.", "%2E%2e"], h = ["/", "\\"], r = ["?", "#"];
16
- function i(n, t) {
17
- return n.some((e) => t.includes(e));
16
+ function u(n, t) {
17
+ return n.some((o) => t.includes(o));
18
18
  }
19
- function a(n, t) {
19
+ function g(n, t) {
20
20
  switch (t) {
21
21
  case "path":
22
- if (c(n))
22
+ if (l(n))
23
23
  return n.value;
24
- if (n = String(n), i(f, n) || i(r, n) || i(h, n))
24
+ if (n = String(n), u(f, n) || u(r, n) || u(h, n))
25
25
  throw new Error(
26
26
  "Disallowing path manipulation attempt. For more information see: https://go.atlassian.com/product-fetch-api-route"
27
27
  );
28
28
  return n;
29
29
  case "query":
30
- return c(n) ? encodeURIComponent(n.value) : n instanceof URLSearchParams ? n.toString() : encodeURIComponent(n);
30
+ return l(n) ? encodeURIComponent(n.value) : n instanceof URLSearchParams ? n.toString() : encodeURIComponent(n);
31
31
  }
32
32
  }
33
- function R(n, ...t) {
34
- let e = "path", u = "";
35
- for (let o = 0; o < n.length; o++) {
36
- const s = n[o];
37
- if (i(r, s) && (e = "query"), u += s, o >= t.length)
33
+ function a(n, ...t) {
34
+ let o = "path", e = "";
35
+ for (let i = 0; i < n.length; i++) {
36
+ const c = n[i];
37
+ if (u(r, c) && (o = "query"), e += c, i >= t.length)
38
38
  break;
39
- u += a(t[o], e);
39
+ e += g(t[i], o);
40
40
  }
41
- return new l(u);
41
+ return new s(e);
42
+ }
43
+ function w(n, ...t) {
44
+ let o = "";
45
+ for (let e = 0; e < n.length; e++) {
46
+ const i = n[e];
47
+ if (o += i, e >= t.length)
48
+ break;
49
+ o += t[e];
50
+ }
51
+ return new s(o);
42
52
  }
43
53
  export {
44
- R as route
54
+ a as route,
55
+ w as routeNoEscaping
45
56
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),b=require("@atlaskit/app-provider"),o=require("react"),S=require("../../../../../data-access-atlassian-product-fetch-oauth/src/lib/atlassian-oauth-fetch/index.cjs.js"),g=require("../../../../../data-access-resources/src/lib/atlassian-user-resource-service/index.cjs.js"),O=require("../../../../../frontend-feature-chosen-workspace-check/src/lib/feature-chosen-workspace-check/index.cjs.js");require("../../../../../frontend-feature-chosen-workspace-check/src/lib/jira-workspace-provider/index.cjs.js");const x=require("../../../../../frontend-feature-oauth-login/src/lib/feature-oauth/index.cjs.js");require("../../../../../frontend-ui-app-flags/src/lib/app-flags-dispatch/index.cjs.js");const B=require("../../../../../frontend-ui-app-flags/src/lib/app-flags-provider-atlaskit/index.cjs.js"),W=require("../../../../../frontend-ui-atlassian-product-fetch/src/lib/request-bitbucket/index.cjs.js"),J=require("../../../../../frontend-ui-atlassian-product-fetch/src/lib/request-confluence/index.cjs.js"),T=require("../../../../../frontend-ui-atlassian-product-fetch/src/lib/request-jira/index.cjs.js"),E=require("../../../../../frontend-ui-backend-adapter/src/lib/backend-adapter/index.cjs.js"),y=require("../../../../../frontend-ui-backend-adapter/src/lib/oauth-fetch-invoke/index.cjs.js"),M=require("../../../../../frontend-ui-host-router/src/lib/host-router/index.cjs.js");require("@atlaskit/button/new");const H=require("../../../../../frontend-ui-host-router/src/lib/host-router-provider/index.cjs.js");require("../../../../../frontend-ui-modal/src/lib/modal-content/index.cjs.js");require("@atlaskit/heading");require("@atlaskit/primitives");const _=require("../../../../../frontend-ui-modal/src/lib/modal-service/index.cjs.js"),$=require("../../../../../frontend-ui-modal/src/lib/modal-service-provider/index.cjs.js"),z=require("../../../../../frontend-ui-modal/src/lib/modal-view-context/index.cjs.js"),K=require("../../../../../frontend-ui-remote-adapter/src/lib/remote-adapter/index.cjs.js"),U=require("../../../../../frontend-ui-remote-adapter/src/lib/oauth-fetch-invoke-remote/index.cjs.js"),D=require("../../../../../frontend-ui-view-context/src/lib/view-context-provider/index.cjs.js"),G=require("../../../../../frontend-ui-view-context/src/lib/mock-view-context/index.cjs.js"),L=o.lazy(()=>Promise.resolve().then(()=>require("../../../../../frontend-feature-chosen-resource-check/src/index/index.cjs.js")));function P({initialMockViewContext:n,backendUrl:c,remoteUrl:h,doCheckWorkspace:A,appName:u,doCheckResource:l,modalOpenerConfig:d,modalContextConfig:v,oauthConfig:i,children:t}){const q=r.jsx(Q,{appName:u,backendUrl:c,remoteUrl:h,initialMockViewContext:n,modalOpenerConfig:d,modalContextConfig:v,doCheckWorkspace:A,doCheckResource:l,oauthConfig:i,children:t});return i?r.jsx(x.OAuthProvider,{clientId:i.clientId,codeTokenExchangeUrl:i.codeTokenExchangeUrl,appName:u,oAuthScopes:i.oAuthScopes,children:q}):q}function Q({initialMockViewContext:n,backendUrl:c,remoteUrl:h,doCheckWorkspace:A,appName:u,doCheckResource:l,modalOpenerConfig:d,modalContextConfig:v,children:i}){const[t,q]=o.useState(),[a,R]=o.useState(),{getAuthToken:s}=x.useOAuth(),f=o.useCallback(()=>S.atlassianOAuthJiraFetch(s(),t??""),[s,t]),j=o.useCallback(()=>S.atlassianOAuthConfluenceFetch(s(),t??""),[s,t]),F=o.useCallback(()=>S.atlassianOAuthBitbucketFetch(s()),[s]),C=o.useCallback(async p=>{if(c&&l){const I=p??localStorage.getItem(`${u}-user-resource-id`)??"",k=await new g.AtlassianUserResourceService().checkUserChosenResource(s(),I);return k.hasChosen&&(localStorage.setItem(`${u}-user-resource-id`,k.resource.id),q(k.resource.id)),k}else return{hasChosen:!0}},[c,s,u,l]);o.useEffect(()=>{const p=t??(n==null?void 0:n.cloudId)??"";if(!a||a.cloudId!==p){const I={...a||n,cloudId:p};R(I)}},[n,t,a]);const w=o.useCallback(()=>c?y.getOauthFetchInvokeImpl(c,s(),t??""):void 0,[t,s,c]);let e=i;A&&(e=r.jsx(O.FeatureChosenWorkspaceCheck,{appName:u,children:e})),d&&(e=r.jsx($.ModalServiceProvider,{modalService:new _.WindowModalService(d.defaultUrl,d.resourceMap),children:e})),a&&(e=r.jsx(D.ViewContextProvider,{viewContext:v?new z.ModalViewContext(a,v.openerOrigin):new G.MockViewContext(a),children:e})),e=r.jsx(H.HostRouterProvider,{hostRouter:new M.WindowHostRouter,children:r.jsx(W.RequestBitbucketProvider,{requestBitbucketImplementation:F(),children:r.jsx(J.RequestConfluenceProvider,{requestConfluenceImplementation:j(),children:r.jsx(T.RequestJiraProvider,{requestJiraImplementation:f(),children:e})})})});const m=w();return m&&(e=r.jsx(E.BackendAdapterProvider,{invokeImplementation:m,children:e})),h&&(e=r.jsx(K.RemoteAdapterProvider,{invokeRemoteImplementation:U.oauthFetchInvokeRemote(h),children:e})),l&&(e=r.jsx(L,{checkResource:C,children:e})),r.jsx(b,{children:r.jsx(B.AppFlagsProviderAtlasKit,{children:e})})}exports.AtlassianAppStandalone=P;exports.default=P;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),g=require("@atlaskit/app-provider"),o=require("react"),S=require("../../../../../data-access-atlassian-product-fetch-oauth/src/lib/atlassian-oauth-fetch/index.cjs.js"),B=require("../../../../../data-access-resources/src/lib/atlassian-user-resource-service/index.cjs.js"),O=require("../../../../../frontend-feature-chosen-workspace-check/src/lib/feature-chosen-workspace-check/index.cjs.js");require("../../../../../frontend-feature-chosen-workspace-check/src/lib/jira-workspace-provider/index.cjs.js");const P=require("../../../../../frontend-feature-oauth-login/src/lib/feature-oauth/index.cjs.js");require("../../../../../frontend-feature-oauth-login/src/lib/oauth-routes/index.cjs.js");require("@atlaskit/heading");require("@atlaskit/primitives");require("@atlaskit/section-message");require("@atlaskit/spinner");require("../../../../../frontend-ui-app-flags/src/lib/app-flags-dispatch/index.cjs.js");const W=require("../../../../../frontend-ui-app-flags/src/lib/app-flags-provider-atlaskit/index.cjs.js"),J=require("../../../../../frontend-ui-atlassian-product-fetch/src/lib/request-bitbucket/index.cjs.js"),T=require("../../../../../frontend-ui-atlassian-product-fetch/src/lib/request-confluence/index.cjs.js"),E=require("../../../../../frontend-ui-atlassian-product-fetch/src/lib/request-jira/index.cjs.js"),y=require("../../../../../frontend-ui-backend-adapter/src/lib/backend-adapter/index.cjs.js"),M=require("../../../../../frontend-ui-backend-adapter/src/lib/oauth-fetch-invoke/index.cjs.js"),H=require("../../../../../frontend-ui-host-router/src/lib/host-router/index.cjs.js");require("@atlaskit/button/new");const _=require("../../../../../frontend-ui-host-router/src/lib/host-router-provider/index.cjs.js");require("../../../../../frontend-ui-modal/src/lib/modal-content/index.cjs.js");const $=require("../../../../../frontend-ui-modal/src/lib/modal-service/index.cjs.js"),z=require("../../../../../frontend-ui-modal/src/lib/modal-service-provider/index.cjs.js"),K=require("../../../../../frontend-ui-modal/src/lib/modal-view-context/index.cjs.js"),U=require("../../../../../frontend-ui-remote-adapter/src/lib/remote-adapter/index.cjs.js"),D=require("../../../../../frontend-ui-remote-adapter/src/lib/oauth-fetch-invoke-remote/index.cjs.js"),G=require("../../../../../frontend-ui-view-context/src/lib/view-context-provider/index.cjs.js"),L=require("../../../../../frontend-ui-view-context/src/lib/mock-view-context/index.cjs.js"),Q=o.lazy(()=>Promise.resolve().then(()=>require("../../../../../frontend-feature-chosen-resource-check/src/index/index.cjs.js")));function R({initialMockViewContext:c,backendUrl:u,remoteUrl:h,doCheckWorkspace:A,appName:i,doCheckResource:l,modalOpenerConfig:d,modalContextConfig:q,oauthConfig:n,atlassianResourceId:x,children:t}){const v=r.jsx(X,{appName:i,backendUrl:u,remoteUrl:h,initialMockViewContext:c,modalOpenerConfig:d,modalContextConfig:q,doCheckWorkspace:A,doCheckResource:l,oauthConfig:n,atlassianResourceId:x,children:t});return n?r.jsx(P.OAuthProvider,{clientId:n.clientId,codeTokenExchangeUrl:n.codeTokenExchangeUrl,appName:i,oAuthScopes:n.oAuthScopes,appBaseContext:n.appBaseContext,children:v}):v}function X({initialMockViewContext:c,backendUrl:u,remoteUrl:h,doCheckWorkspace:A,appName:i,doCheckResource:l,modalOpenerConfig:d,modalContextConfig:q,atlassianResourceId:n,children:x}){const[t,v]=o.useState(n),[a,j]=o.useState(),{getAuthToken:s}=P.useOAuth(),f=o.useCallback(()=>S.atlassianOAuthJiraFetch(s(),t??""),[s,t]),C=o.useCallback(()=>S.atlassianOAuthConfluenceFetch(s(),t??""),[s,t]),F=o.useCallback(()=>S.atlassianOAuthBitbucketFetch(s()),[s]),w=o.useCallback(async p=>{if(u&&l){const I=p??localStorage.getItem(`${i}-user-resource-id`)??"",k=await new B.AtlassianUserResourceService().checkUserChosenResource(s(),I);return k.hasChosen&&(localStorage.setItem(`${i}-user-resource-id`,k.resource.id),v(k.resource.id)),k}else return{hasChosen:!0}},[u,s,i,l]);o.useEffect(()=>{const p=t??(c==null?void 0:c.cloudId)??"";if(!a||a.cloudId!==p){const I={...a||c,cloudId:p};j(I)}},[c,t,a]);const b=o.useCallback(()=>u?M.getOauthFetchInvokeImpl(u,s(),t??""):void 0,[t,s,u]);let e=x;A&&(e=r.jsx(O.FeatureChosenWorkspaceCheck,{appName:i,children:e})),d&&(e=r.jsx(z.ModalServiceProvider,{modalService:new $.WindowModalService(d.defaultUrl,d.resourceMap),children:e})),a&&(e=r.jsx(G.ViewContextProvider,{viewContext:q?new K.ModalViewContext(a,q.openerOrigin):new L.MockViewContext(a),children:e})),e=r.jsx(_.HostRouterProvider,{hostRouter:new H.WindowHostRouter,children:r.jsx(J.RequestBitbucketProvider,{requestBitbucketImplementation:F(),children:r.jsx(T.RequestConfluenceProvider,{requestConfluenceImplementation:C(),children:r.jsx(E.RequestJiraProvider,{requestJiraImplementation:f(),children:e})})})});const m=b();return m&&(e=r.jsx(y.BackendAdapterProvider,{invokeImplementation:m,children:e})),h&&(e=r.jsx(U.RemoteAdapterProvider,{invokeRemoteImplementation:D.oauthFetchInvokeRemote(h),children:e})),l&&(e=r.jsx(Q,{checkResource:w,children:e})),r.jsx(g,{children:r.jsx(W.AppFlagsProviderAtlasKit,{children:e})})}exports.AtlassianAppStandalone=R;exports.default=R;