zudoku 0.3.1-dev.2 → 0.3.1-dev.20

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 (125) hide show
  1. package/LICENSE.md +21 -0
  2. package/dist/lib/authentication/authentication.d.ts +1 -0
  3. package/dist/lib/authentication/components/CallbackHandler.d.ts +3 -0
  4. package/dist/lib/authentication/components/CallbackHandler.js +34 -0
  5. package/dist/lib/authentication/components/CallbackHandler.js.map +1 -0
  6. package/dist/lib/authentication/providers/auth0.js +20 -1
  7. package/dist/lib/authentication/providers/auth0.js.map +1 -1
  8. package/dist/lib/authentication/providers/openid.d.ts +3 -10
  9. package/dist/lib/authentication/providers/openid.js +46 -31
  10. package/dist/lib/authentication/providers/openid.js.map +1 -1
  11. package/dist/lib/components/Header.js +2 -4
  12. package/dist/lib/components/Header.js.map +1 -1
  13. package/dist/lib/components/Layout.js +5 -1
  14. package/dist/lib/components/Layout.js.map +1 -1
  15. package/dist/lib/components/context/ZudokuProvider.js +1 -3
  16. package/dist/lib/components/context/ZudokuProvider.js.map +1 -1
  17. package/dist/lib/core/DevPortalContext.d.ts +1 -4
  18. package/dist/lib/core/DevPortalContext.js +2 -2
  19. package/dist/lib/core/DevPortalContext.js.map +1 -1
  20. package/dist/lib/core/plugins.d.ts +2 -4
  21. package/dist/lib/core/plugins.js.map +1 -1
  22. package/dist/lib/plugins/openapi/OperationList.js +3 -4
  23. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  24. package/dist/lib/plugins/openapi/OperationListItem.js +2 -3
  25. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  26. package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
  27. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  28. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +2 -2
  29. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -1
  30. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.d.ts +9 -0
  31. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js +14 -0
  32. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js.map +1 -0
  33. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.d.ts +6 -0
  34. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.js +17 -0
  35. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.js.map +1 -0
  36. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.d.ts +7 -0
  37. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js +10 -0
  38. package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js.map +1 -0
  39. package/dist/lib/plugins/openapi/schema/SchemaComponents.d.ts +3 -3
  40. package/dist/lib/plugins/openapi/schema/SchemaComponents.js +15 -15
  41. package/dist/lib/plugins/openapi/schema/SchemaComponents.js.map +1 -1
  42. package/dist/lib/plugins/openapi/schema/SchemaView.js +1 -1
  43. package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
  44. package/dist/lib/plugins/openapi/schema/utils.d.ts +6 -0
  45. package/dist/lib/plugins/openapi/schema/utils.js +5 -0
  46. package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
  47. package/lib/{AuthenticationPlugin-CH5NSVOu.js → AuthenticationPlugin-owbEUimP.js} +3 -3
  48. package/lib/{AuthenticationPlugin-CH5NSVOu.js.map → AuthenticationPlugin-owbEUimP.js.map} +1 -1
  49. package/lib/{CategoryHeading-z15xh7Jb.js → CategoryHeading-DnPprxtD.js} +2 -2
  50. package/lib/{CategoryHeading-z15xh7Jb.js.map → CategoryHeading-DnPprxtD.js.map} +1 -1
  51. package/lib/{Combination-DTfV-c98.js → Combination-DruV0zX_.js} +3 -3
  52. package/lib/{Combination-DTfV-c98.js.map → Combination-DruV0zX_.js.map} +1 -1
  53. package/lib/ErrorPage-PUg985n_.js +18 -0
  54. package/lib/ErrorPage-PUg985n_.js.map +1 -0
  55. package/lib/{Input-DB9VROFR.js → Input-CBfi9Yjc.js} +5 -4
  56. package/lib/{Input-DB9VROFR.js.map → Input-CBfi9Yjc.js.map} +1 -1
  57. package/lib/{Markdown-CEccPMI_.js → Markdown-Chb9VIBv.js} +2 -2
  58. package/lib/{Markdown-CEccPMI_.js.map → Markdown-Chb9VIBv.js.map} +1 -1
  59. package/lib/{MdxPage-CnqOoqvp.js → MdxPage-CIBHMwTd.js} +5 -5
  60. package/lib/{MdxPage-CnqOoqvp.js.map → MdxPage-CIBHMwTd.js.map} +1 -1
  61. package/lib/OperationList-CZiSz5JH.js +590 -0
  62. package/lib/OperationList-CZiSz5JH.js.map +1 -0
  63. package/lib/{Route-DfAFiR7v.js → Route-Cle-r-bq.js} +4 -4
  64. package/lib/{Route-DfAFiR7v.js.map → Route-Cle-r-bq.js.map} +1 -1
  65. package/lib/{Spinner-BT_AYFrA.js → SidebarBadge-Ba0PhibA.js} +66 -76
  66. package/lib/SidebarBadge-Ba0PhibA.js.map +1 -0
  67. package/lib/{SlotletProvider-ByLSCZQa.js → SlotletProvider-Dq80og6-.js} +4 -4
  68. package/lib/{SlotletProvider-ByLSCZQa.js.map → SlotletProvider-Dq80og6-.js.map} +1 -1
  69. package/lib/Spinner-CvXZ7QK4.js +15 -0
  70. package/lib/Spinner-CvXZ7QK4.js.map +1 -0
  71. package/lib/{ZudokuContext-BIZ8zHbZ.js → ZudokuContext-BQ45UjcB.js} +2 -2
  72. package/lib/{ZudokuContext-BIZ8zHbZ.js.map → ZudokuContext-BQ45UjcB.js.map} +1 -1
  73. package/lib/{index-D-9zqIOh.js → index-Br1MQPxy.js} +595 -587
  74. package/lib/index-Br1MQPxy.js.map +1 -0
  75. package/lib/{index-Dz4LyXZI.js → index-DCJ9wEIV.js} +3 -3
  76. package/lib/{index-Dz4LyXZI.js.map → index-DCJ9wEIV.js.map} +1 -1
  77. package/lib/{index-7kcHaXD6.js → index-Yjb2PyPF.js} +4 -4
  78. package/lib/{index-7kcHaXD6.js.map → index-Yjb2PyPF.js.map} +1 -1
  79. package/lib/{urql-DrBfkb92.js → urql-YhcsXYy8.js} +2 -2
  80. package/lib/urql-YhcsXYy8.js.map +1 -0
  81. package/lib/{utils-Bh4upQ0e.js → utils-pDHePxa0.js} +3 -3
  82. package/lib/{utils-Bh4upQ0e.js.map → utils-pDHePxa0.js.map} +1 -1
  83. package/lib/zudoku.auth-auth0.js +31 -17
  84. package/lib/zudoku.auth-auth0.js.map +1 -1
  85. package/lib/zudoku.auth-clerk.js +1 -1
  86. package/lib/zudoku.auth-openid.js +491 -421
  87. package/lib/zudoku.auth-openid.js.map +1 -1
  88. package/lib/zudoku.components.js +434 -443
  89. package/lib/zudoku.components.js.map +1 -1
  90. package/lib/zudoku.openapi-worker.js +1 -1
  91. package/lib/zudoku.plugin-api-keys.js +6 -6
  92. package/lib/zudoku.plugin-custom-page.js +1 -1
  93. package/lib/zudoku.plugin-markdown.js +1 -1
  94. package/lib/zudoku.plugin-openapi.js +8 -7
  95. package/lib/zudoku.plugin-openapi.js.map +1 -1
  96. package/package.json +80 -100
  97. package/src/app/main.css +26 -1
  98. package/src/lib/authentication/authentication.ts +1 -0
  99. package/src/lib/authentication/components/CallbackHandler.tsx +59 -0
  100. package/src/lib/authentication/providers/auth0.tsx +28 -2
  101. package/src/lib/authentication/providers/openid.tsx +50 -37
  102. package/src/lib/components/Header.tsx +3 -10
  103. package/src/lib/components/Layout.tsx +6 -1
  104. package/src/lib/components/context/ZudokuProvider.tsx +1 -4
  105. package/src/lib/core/DevPortalContext.ts +2 -7
  106. package/src/lib/core/plugins.ts +1 -2
  107. package/src/lib/plugins/openapi/OperationList.tsx +3 -7
  108. package/src/lib/plugins/openapi/OperationListItem.tsx +3 -4
  109. package/src/lib/plugins/openapi/ParameterListItem.tsx +1 -1
  110. package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +27 -5
  111. package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.tsx +47 -0
  112. package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupConnector.tsx +54 -0
  113. package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.tsx +30 -0
  114. package/src/lib/plugins/openapi/schema/SchemaComponents.tsx +41 -41
  115. package/src/lib/plugins/openapi/schema/SchemaView.tsx +4 -4
  116. package/src/lib/plugins/openapi/schema/utils.ts +8 -0
  117. package/dist/lib/plugins/openapi/util/prose.d.ts +0 -1
  118. package/dist/lib/plugins/openapi/util/prose.js +0 -4
  119. package/dist/lib/plugins/openapi/util/prose.js.map +0 -1
  120. package/lib/OperationList-Cxiw2Z-v.js +0 -457
  121. package/lib/OperationList-Cxiw2Z-v.js.map +0 -1
  122. package/lib/Spinner-BT_AYFrA.js.map +0 -1
  123. package/lib/index-D-9zqIOh.js.map +0 -1
  124. package/lib/urql-DrBfkb92.js.map +0 -1
  125. package/src/lib/plugins/openapi/util/prose.ts +0 -7
@@ -13,7 +13,7 @@ var ir = (t, e, n, r) => ({
13
13
  return m(t, e, r);
14
14
  }
15
15
  });
16
- import { C as Uo, c as Vo, m as Bo, f as Go } from "./urql-DrBfkb92.js";
16
+ import { C as Uo, c as Vo, m as Bo, f as Go } from "./urql-YhcsXYy8.js";
17
17
  import { a as Iu } from "./_commonjsHelpers-BVfed4GL.js";
18
18
  import { s as _u } from "./slugify-CiPVjteN.js";
19
19
  function Ou(t, e) {
@@ -1,12 +1,12 @@
1
1
  import { j as e } from "./jsx-runtime-B6kdoens.js";
2
- import { S as p, R as f } from "./SlotletProvider-ByLSCZQa.js";
3
- import { u as g, a as u, I as j, S as k, b as v, c as w, d as b, e as K, f as y } from "./Input-DB9VROFR.js";
4
- import { b as N, L as x, O as E } from "./index-7kcHaXD6.js";
5
- import { u as h, t as A, j as S } from "./ZudokuContext-BIZ8zHbZ.js";
6
- import { B as l, p as I } from "./Combination-DTfV-c98.js";
2
+ import { S as p, R as f } from "./SlotletProvider-Dq80og6-.js";
3
+ import { u as g, a as u, I as j, S as k, b as v, c as w, d as b, e as K, f as y } from "./Input-CBfi9Yjc.js";
4
+ import { e as N, L as x, O as E } from "./index-Yjb2PyPF.js";
5
+ import { u as h, t as A, j as S } from "./ZudokuContext-BQ45UjcB.js";
6
+ import { B as l, p as I } from "./Combination-DruV0zX_.js";
7
7
  import { D as P } from "./DeveloperHint-BQSFXH01.js";
8
8
  import { useState as C } from "react";
9
- import { c as d, a as D } from "./Markdown-CEccPMI_.js";
9
+ import { c as d, a as D } from "./Markdown-Chb9VIBv.js";
10
10
  /**
11
11
  * @license lucide-react v0.378.0 - ISC
12
12
  *
@@ -1,5 +1,5 @@
1
1
  import { j as m } from "./jsx-runtime-B6kdoens.js";
2
- import { P as o } from "./Markdown-CEccPMI_.js";
2
+ import { P as o } from "./Markdown-Chb9VIBv.js";
3
3
  const l = (s) => ({
4
4
  getRoutes: () => s.map(({ path: e, element: t }) => ({
5
5
  path: e,
@@ -6,7 +6,7 @@ const u = (t, e) => Object.entries(t).flatMap(([a, r]) => {
6
6
  return {
7
7
  path: s.at(-1) === "index" ? s.slice(0, -1).join("/") : o,
8
8
  lazy: async () => {
9
- const { MdxPage: i } = await import("./MdxPage-CnqOoqvp.js"), { default: p, ...c } = await r();
9
+ const { MdxPage: i } = await import("./MdxPage-CIBHMwTd.js"), { default: p, ...c } = await r();
10
10
  return {
11
11
  element: /* @__PURE__ */ m.jsx(
12
12
  i,
@@ -1,14 +1,15 @@
1
1
  import "./jsx-runtime-B6kdoens.js";
2
- import { o as l } from "./index-D-9zqIOh.js";
3
- import "./urql-DrBfkb92.js";
4
- import "./ZudokuContext-BIZ8zHbZ.js";
2
+ import { o as s } from "./index-Br1MQPxy.js";
3
+ import "./urql-YhcsXYy8.js";
4
+ import "./ZudokuContext-BQ45UjcB.js";
5
5
  import "zudoku/openapi-worker";
6
- import "./Combination-DTfV-c98.js";
7
- import "./Markdown-CEccPMI_.js";
6
+ import "./Combination-DruV0zX_.js";
7
+ import "./ErrorPage-PUg985n_.js";
8
+ import "./Markdown-Chb9VIBv.js";
8
9
  import "./joinPath-B7kNnUX4.js";
9
10
  import "./router-BiRCp01d.js";
10
- import "./index-7kcHaXD6.js";
11
+ import "./index-Yjb2PyPF.js";
11
12
  export {
12
- l as openApiPlugin
13
+ s as openApiPlugin
13
14
  };
14
15
  //# sourceMappingURL=zudoku.plugin-openapi.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"zudoku.plugin-openapi.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
1
+ {"version":3,"file":"zudoku.plugin-openapi.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudoku",
3
- "version": "0.3.1-dev.2",
3
+ "version": "0.3.1-dev.20",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -13,104 +13,73 @@
13
13
  "zudoku": "./cli.js"
14
14
  },
15
15
  "exports": {
16
- ".": "./src/index.ts",
17
- "./internal": "./src/internal.ts",
18
- "./auth/clerk": "./src/lib/authentication/providers/clerk.ts",
19
- "./auth/auth0": "./src/lib/authentication/providers/auth0.ts",
20
- "./auth/openid": "./src/lib/authentication/providers/openid.ts",
21
- "./plugins/api-keys": "./src/lib/plugins/api-keys/index.ts",
22
- "./plugins/markdown": "./src/lib/plugins/markdown/index.ts",
23
- "./plugins/openapi": "./src/lib/plugins/openapi/index.ts",
24
- "./plugins/redirect": "./src/lib/plugins/redirect/index.ts",
25
- "./plugins/custom-page": "./src/lib/plugins/custom-page/index.ts",
26
- "./plugins/search-inkeep": "./src/lib/plugins/search-inkeep/index.ts",
27
- "./openapi-worker": "./src/lib/plugins/openapi-worker.ts",
28
- "./components": "./src/lib/components/index.ts",
29
- "./vite": "./src/vite/plugin.ts",
30
- "./tailwind": "./src/app/tailwind.ts",
31
- "./app/*": "./src/app/*"
32
- },
33
- "publishConfig": {
34
- "module": "./dist/index.js",
35
- "types": "./dist/index.d.ts",
36
- "exports": {
37
- ".": {
38
- "import": "./dist/index.js",
39
- "types": "./dist/index.d.ts"
40
- },
41
- "./internal": {
42
- "import": "./dist/internal.js"
43
- },
44
- "./auth/clerk": {
45
- "import": "./lib/zudoku.auth-clerk.js",
46
- "types": "./dist/lib/authentication/providers/clerk.d.ts"
47
- },
48
- "./auth/auth0": {
49
- "import": "./lib/zudoku.auth-auth0.js",
50
- "types": "./dist/lib/authentication/providers/auth0.d.ts"
51
- },
52
- "./auth/openid": {
53
- "import": "./lib/zudoku.auth-openid.js",
54
- "types": "./dist/lib/authentication/providers/openid.d.ts"
55
- },
56
- "./plugins/api-keys": {
57
- "import": "./lib/zudoku.plugin-api-keys.js",
58
- "types": "./dist/lib/plugins/api-keys/index.d.ts"
59
- },
60
- "./plugins/markdown": {
61
- "import": "./lib/zudoku.plugin-markdown.js",
62
- "types": "./dist/lib/plugins/markdown/index.d.ts"
63
- },
64
- "./plugins/openapi": {
65
- "import": "./lib/zudoku.plugin-openapi.js",
66
- "types": "./dist/lib/plugins/openapi/index.d.ts"
67
- },
68
- "./plugins/redirect": {
69
- "import": "./lib/zudoku.plugin-redirect.js",
70
- "types": "./dist/lib/plugins/redirect/index.d.ts"
71
- },
72
- "./plugins/custom-page": {
73
- "import": "./lib/zudoku.plugin-custom-page.js",
74
- "types": "./dist/lib/plugins/custom-page/index.d.ts"
75
- },
76
- "./plugins/search-inkeep": {
77
- "import": "./lib/zudoku.plugin-search-inkeep.js",
78
- "types": "./dist/lib/plugins/search-inkeep/index.d.ts"
79
- },
80
- "./openapi-worker": {
81
- "import": "./lib/zudoku.openapi-worker.js",
82
- "types": "./dist/lib/plugins/openapi-worker.d.ts"
83
- },
84
- "./components": {
85
- "import": "./lib/zudoku.components.js",
86
- "types": "./dist/lib/components/index.d.ts"
87
- },
88
- "./vite": {
89
- "require": "./dist/vite/plugin.js",
90
- "import": "./dist/vite/plugin.js"
91
- },
92
- "./tailwind": {
93
- "require": "./dist/app/tailwind.js",
94
- "import": "./dist/app/tailwind.js"
95
- },
96
- "./main.css": {
97
- "require": "./src/app/main.css",
98
- "import": "./src/app/main.css"
99
- },
100
- "./app/*": {
101
- "import": "./src/app/*"
102
- }
16
+ ".": {
17
+ "import": "./dist/index.js",
18
+ "types": "./dist/index.d.ts"
19
+ },
20
+ "./internal": {
21
+ "import": "./dist/internal.js"
22
+ },
23
+ "./auth/clerk": {
24
+ "import": "./lib/zudoku.auth-clerk.js",
25
+ "types": "./dist/lib/authentication/providers/clerk.d.ts"
26
+ },
27
+ "./auth/auth0": {
28
+ "import": "./lib/zudoku.auth-auth0.js",
29
+ "types": "./dist/lib/authentication/providers/auth0.d.ts"
30
+ },
31
+ "./auth/openid": {
32
+ "import": "./lib/zudoku.auth-openid.js",
33
+ "types": "./dist/lib/authentication/providers/openid.d.ts"
34
+ },
35
+ "./plugins/api-keys": {
36
+ "import": "./lib/zudoku.plugin-api-keys.js",
37
+ "types": "./dist/lib/plugins/api-keys/index.d.ts"
38
+ },
39
+ "./plugins/markdown": {
40
+ "import": "./lib/zudoku.plugin-markdown.js",
41
+ "types": "./dist/lib/plugins/markdown/index.d.ts"
42
+ },
43
+ "./plugins/openapi": {
44
+ "import": "./lib/zudoku.plugin-openapi.js",
45
+ "types": "./dist/lib/plugins/openapi/index.d.ts"
46
+ },
47
+ "./plugins/redirect": {
48
+ "import": "./lib/zudoku.plugin-redirect.js",
49
+ "types": "./dist/lib/plugins/redirect/index.d.ts"
50
+ },
51
+ "./plugins/custom-page": {
52
+ "import": "./lib/zudoku.plugin-custom-page.js",
53
+ "types": "./dist/lib/plugins/custom-page/index.d.ts"
54
+ },
55
+ "./plugins/search-inkeep": {
56
+ "import": "./lib/zudoku.plugin-search-inkeep.js",
57
+ "types": "./dist/lib/plugins/search-inkeep/index.d.ts"
58
+ },
59
+ "./openapi-worker": {
60
+ "import": "./lib/zudoku.openapi-worker.js",
61
+ "types": "./dist/lib/plugins/openapi-worker.d.ts"
62
+ },
63
+ "./components": {
64
+ "import": "./lib/zudoku.components.js",
65
+ "types": "./dist/lib/components/index.d.ts"
66
+ },
67
+ "./vite": {
68
+ "require": "./dist/vite/plugin.js",
69
+ "import": "./dist/vite/plugin.js"
70
+ },
71
+ "./tailwind": {
72
+ "require": "./dist/app/tailwind.js",
73
+ "import": "./dist/app/tailwind.js"
74
+ },
75
+ "./main.css": {
76
+ "require": "./src/app/main.css",
77
+ "import": "./src/app/main.css"
78
+ },
79
+ "./app/*": {
80
+ "import": "./src/app/*"
103
81
  }
104
82
  },
105
- "scripts": {
106
- "build": "tsc --project tsconfig.json",
107
- "build:vite": "vite build && pnpm run hack:fix-worker-paths lib",
108
- "build:standalone:vite": "vite build --mode standalone --config vite.standalone.config.ts",
109
- "build:standalone:html": "cp ./src/app/standalone.html ./standalone/standalone.html && cp ./src/app/demo.html ./standalone/demo.html && cp ./src/app/demo-cdn.html ./standalone/index.html",
110
- "hack:fix-worker-paths": "node ./scripts/hack-worker.mjs",
111
- "clean": "tsc --build --clean",
112
- "test": "node --test --enable-source-maps"
113
- },
114
83
  "dependencies": {
115
84
  "@envelop/core": "5.0.1",
116
85
  "@graphql-typed-document-node/core": "3.2.0",
@@ -147,7 +116,7 @@
147
116
  "openapi-types": "12.1.3",
148
117
  "picocolors": "^1.0.1",
149
118
  "postcss": "8.4.39",
150
- "posthog-node": "^4.0.1",
119
+ "posthog-node": "^4.1.1",
151
120
  "prism-react-renderer": "2.3.1",
152
121
  "prismjs": "1.29.0",
153
122
  "react": "18.3.1",
@@ -216,5 +185,16 @@
216
185
  "optionalDependencies": {
217
186
  "@clerk/clerk-js": "5.11.0",
218
187
  "@inkeep/widgets": "^0.2.289"
219
- }
220
- }
188
+ },
189
+ "scripts": {
190
+ "build": "tsc --project tsconfig.json",
191
+ "build:vite": "vite build && pnpm run hack:fix-worker-paths lib",
192
+ "build:standalone:vite": "vite build --mode standalone --config vite.standalone.config.ts",
193
+ "build:standalone:html": "cp ./src/app/standalone.html ./standalone/standalone.html && cp ./src/app/demo.html ./standalone/demo.html && cp ./src/app/demo-cdn.html ./standalone/index.html",
194
+ "hack:fix-worker-paths": "node ./scripts/hack-worker.mjs",
195
+ "clean": "tsc --build --clean",
196
+ "test": "node --test --enable-source-maps"
197
+ },
198
+ "module": "./dist/index.js",
199
+ "types": "./dist/index.d.ts"
200
+ }
package/src/app/main.css CHANGED
@@ -192,6 +192,31 @@
192
192
  background: transparent;
193
193
  }
194
194
 
195
+ .wavy-line {
196
+ @apply bg-primary w-full;
197
+
198
+ --s: 3px; /* size of the wave */
199
+ --b: 2px; /* thickness of the line */
200
+ --m: 1; /* curvature of the wave [0 2] */
201
+
202
+ --R: calc(var(--s) * sqrt(var(--m) * var(--m) + 1) + var(--b) / 2);
203
+ height: calc(2 * var(--R));
204
+ --_g: #0000 calc(99% - var(--b)), #000 calc(101% - var(--b)) 99%, #0000 101%;
205
+ mask:
206
+ radial-gradient(
207
+ var(--R) at left 50% bottom calc(-1 * var(--m) * var(--s)),
208
+ var(--_g)
209
+ )
210
+ calc(50% - 2 * var(--s)) calc(50% - var(--s) / 2 - var(--b) / 2) /
211
+ calc(4 * var(--s)) calc(var(--s) + var(--b)) repeat-x,
212
+ radial-gradient(
213
+ var(--R) at left 50% top calc(-1 * var(--m) * var(--s)),
214
+ var(--_g)
215
+ )
216
+ 50% calc(50% + var(--s) / 2 + var(--b) / 2) / calc(4 * var(--s))
217
+ calc(var(--s) + var(--b)) repeat-x;
218
+ }
219
+
195
220
  /* Theme */
196
221
  :root {
197
222
  --background: 0 0% 100%;
@@ -224,7 +249,7 @@
224
249
  --popover: 222.2 84% 4.9%;
225
250
  --popover-foreground: 210 40% 98%;
226
251
  --primary: 217.2 91.2% 59.8%;
227
- --primary-foreground: 222.2 47.4% 11.2%;
252
+ --primary-foreground: 210 40% 98%;
228
253
  --secondary: 217.2 32.6% 17.5%;
229
254
  --secondary-foreground: 210 40% 98%;
230
255
  --muted: 217.2 32.6% 17.5%;
@@ -5,6 +5,7 @@ export interface AuthenticationProvider {
5
5
  signIn(options?: { redirectTo?: string }): Promise<void>;
6
6
  signOut(): Promise<void>;
7
7
  getAccessToken(): Promise<string>;
8
+ pageLoad?(): void;
8
9
  getAuthenticationPlugin?(): DevPortalPlugin;
9
10
  }
10
11
 
@@ -0,0 +1,59 @@
1
+ import logger from "loglevel";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import { useNavigate } from "react-router-dom";
4
+ import { DeveloperHint } from "../../components/DeveloperHint.js";
5
+ import { ErrorPage } from "../../components/ErrorPage.js";
6
+ import { Spinner } from "../../components/Spinner.js";
7
+ import { SyntaxHighlight } from "../../components/SyntaxHighlight.js";
8
+
9
+ export function CallbackHandler({
10
+ handleCallback,
11
+ }: {
12
+ handleCallback: () => Promise<string>;
13
+ }) {
14
+ const [error, setError] = useState<Error | null>(null);
15
+ const navigate = useNavigate();
16
+ // Deal with double mount in dev mode which will break
17
+ // the OAuth flow because you can only use the code once
18
+ const didInitialize = useRef(false);
19
+
20
+ useEffect(() => {
21
+ if (didInitialize.current) {
22
+ return;
23
+ }
24
+ didInitialize.current = true;
25
+ handleCallback()
26
+ .then((redirect) => {
27
+ navigate(redirect);
28
+ })
29
+ .catch((err) => {
30
+ logger.error(err);
31
+ setError(err);
32
+ });
33
+ }, [navigate, handleCallback]);
34
+
35
+ if (error) {
36
+ return (
37
+ <ErrorPage
38
+ category="Error"
39
+ title="Authentication Error"
40
+ message={
41
+ <>
42
+ <DeveloperHint className="mb-4">
43
+ Check the configuration of your authorization provider and ensure
44
+ all settings such as the callback URL are configured correctly.
45
+ </DeveloperHint>
46
+ An error occurred while authorizing the user.
47
+ <SyntaxHighlight code={error.toString()} language="plain" />
48
+ </>
49
+ }
50
+ />
51
+ );
52
+ }
53
+
54
+ return (
55
+ <div className="grid h-full place-items-center">
56
+ <Spinner />
57
+ </div>
58
+ );
59
+ }
@@ -1,9 +1,24 @@
1
- import { Auth0AuthenticationConfig } from "../../../config/config.js";
1
+ import {
2
+ Auth0AuthenticationConfig,
3
+ OpenIDAuthenticationConfig,
4
+ } from "../../../config/config.js";
2
5
  import { AuthenticationProviderInitializer } from "../authentication.js";
3
6
  import { useAuthState } from "../state.js";
4
7
  import { OpenIDAuthenticationProvider } from "./openid.js";
5
8
 
6
9
  class Auth0AuthenticationProvider extends OpenIDAuthenticationProvider {
10
+ constructor(config: OpenIDAuthenticationConfig) {
11
+ super(config);
12
+
13
+ // Prefill the authorization server since we know what Auth0's config is
14
+ this.authorizationServer = {
15
+ issuer: config.issuer,
16
+ authorization_endpoint: `${config.issuer}/authorize`,
17
+ token_endpoint: `${config.issuer}/oauth/token`,
18
+ code_challenge_methods_supported: ["S256", "plain"],
19
+ };
20
+ }
21
+
7
22
  onAuthorizationUrl = async (
8
23
  url: URL,
9
24
  { isSignUp }: { isSignUp: boolean },
@@ -12,13 +27,24 @@ class Auth0AuthenticationProvider extends OpenIDAuthenticationProvider {
12
27
  url.searchParams.set("screen_hint", "signup");
13
28
  }
14
29
  };
30
+
31
+ override async getAuthServer() {
32
+ this.authorizationServer = {
33
+ issuer: new URL(this.authorizationEndpoint!).origin,
34
+ authorization_endpoint: this.authorizationEndpoint,
35
+ token_endpoint: this.tokenEndpoint,
36
+ code_challenge_methods_supported: [],
37
+ };
38
+ return this.authorizationServer;
39
+ }
40
+
15
41
  signOut = async (): Promise<void> => {
16
42
  useAuthState.setState({
17
43
  isAuthenticated: false,
18
44
  isPending: false,
19
45
  profile: undefined,
20
46
  });
21
- localStorage.removeItem("auto-login");
47
+ sessionStorage.clear();
22
48
  const as = await this.getAuthServer();
23
49
 
24
50
  const redirectUrl = new URL(
@@ -1,13 +1,12 @@
1
1
  import logger from "loglevel";
2
2
  import * as oauth from "oauth4webapi";
3
- import { NavigateFunction } from "react-router-dom";
4
3
  import { OpenIDAuthenticationConfig } from "../../../config/config.js";
5
- import { CommonPlugin } from "../../core/plugins.js";
6
4
  import {
7
5
  AuthenticationProvider,
8
6
  AuthenticationProviderInitializer,
9
7
  } from "../authentication.js";
10
8
  import { AuthenticationPlugin } from "../AuthenticationPlugin.js";
9
+ import { CallbackHandler } from "../components/CallbackHandler.js";
11
10
  import { AuthorizationError, OAuthAuthorizationError } from "../errors.js";
12
11
  import { useAuthState, UserProfile } from "../state.js";
13
12
 
@@ -23,7 +22,7 @@ interface TokenState {
23
22
  class OpenIdAuthPlugin extends AuthenticationPlugin {
24
23
  constructor(
25
24
  private callbackUrlPath: string,
26
- public initialize?: CommonPlugin["initialize"],
25
+ private handleCallback: () => Promise<string>,
27
26
  ) {
28
27
  super();
29
28
  }
@@ -32,7 +31,7 @@ class OpenIdAuthPlugin extends AuthenticationPlugin {
32
31
  ...super.getRoutes(),
33
32
  {
34
33
  path: this.callbackUrlPath,
35
- element: <div />,
34
+ element: <CallbackHandler handleCallback={this.handleCallback} />,
36
35
  },
37
36
  ];
38
37
  }
@@ -45,7 +44,6 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
45
44
  protected tokenEndpoint: string | undefined;
46
45
 
47
46
  protected authorizationServer: oauth.AuthorizationServer | undefined;
48
- protected tokens: TokenState | undefined;
49
47
 
50
48
  protected callbackUrlPath = "/oauth/callback";
51
49
  protected logoutRedirectUrlPath = "/";
@@ -118,13 +116,13 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
118
116
  throw new AuthorizationError("No expires_in in response");
119
117
  }
120
118
 
121
- this.tokens = {
119
+ const tokens: TokenState = {
122
120
  accessToken: response.access_token,
123
121
  refreshToken: response.refresh_token,
124
122
  expiresOn: new Date(Date.now() + response.expires_in * 1000),
125
123
  tokenType: response.token_type,
126
124
  };
127
- sessionStorage.setItem("openid-token", JSON.stringify(this.tokens));
125
+ sessionStorage.setItem("token-state", JSON.stringify(tokens));
128
126
  }
129
127
 
130
128
  async signUp({ redirectTo }: { redirectTo?: string } = {}) {
@@ -178,7 +176,7 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
178
176
  authorizationUrl.searchParams.set("client_id", this.client.client_id);
179
177
  authorizationUrl.searchParams.set("redirect_uri", redirectUrl.toString());
180
178
  authorizationUrl.searchParams.set("response_type", "code");
181
- authorizationUrl.searchParams.set("scope", "openid+profile+email");
179
+ authorizationUrl.searchParams.set("scope", "openid profile email");
182
180
  authorizationUrl.searchParams.set("code_challenge", codeChallenge);
183
181
  authorizationUrl.searchParams.set(
184
182
  "code_challenge_method",
@@ -211,11 +209,14 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
211
209
 
212
210
  async getAccessToken(): Promise<string> {
213
211
  const as = await this.getAuthServer();
214
- if (!this.tokens) {
212
+ const tokenState = sessionStorage.getItem("token-state");
213
+ if (!tokenState) {
215
214
  throw new AuthorizationError("User is not authenticated");
216
215
  }
217
- if (this.tokens.expiresOn < new Date()) {
218
- if (!this.tokens.refreshToken) {
216
+
217
+ const state = JSON.parse(tokenState) as TokenState;
218
+ if (state.expiresOn < new Date()) {
219
+ if (!state.refreshToken) {
219
220
  await this.signIn();
220
221
  return "";
221
222
  }
@@ -223,7 +224,7 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
223
224
  const request = await oauth.refreshTokenGrantRequest(
224
225
  as,
225
226
  this.client,
226
- this.tokens.refreshToken,
227
+ state.refreshToken,
227
228
  );
228
229
  const response = await oauth.processRefreshTokenResponse(
229
230
  as,
@@ -231,10 +232,16 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
231
232
  request,
232
233
  );
233
234
 
235
+ if (!response.access_token) {
236
+ throw new AuthorizationError("No access token in response");
237
+ }
238
+
234
239
  this.setTokensFromResponse(response);
235
- }
236
240
 
237
- return this.tokens.accessToken;
241
+ return response.access_token.toString();
242
+ } else {
243
+ return state.accessToken;
244
+ }
238
245
  }
239
246
 
240
247
  signOut = async () => {
@@ -243,7 +250,7 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
243
250
  isPending: false,
244
251
  profile: undefined,
245
252
  });
246
- localStorage.removeItem("auto-login");
253
+ sessionStorage.clear();
247
254
 
248
255
  const as = await this.getAuthServer();
249
256
 
@@ -279,9 +286,8 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
279
286
  // Authorization Code Grant Request & Response
280
287
  const codeVerifier = sessionStorage.getItem(CODE_VERIFIER_KEY);
281
288
  sessionStorage.removeItem(CODE_VERIFIER_KEY);
282
-
283
289
  if (!codeVerifier) {
284
- return "/";
290
+ throw new AuthorizationError("No code verifier found in state.");
285
291
  }
286
292
 
287
293
  const authServer = await this.getAuthServer();
@@ -320,7 +326,7 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
320
326
  // }
321
327
  // throw new Error(); // Handle WWW-Authenticate Challenges as needed
322
328
  // }
323
- const oauthResult = await oauth.processAuthorizationCodeOAuth2Response(
329
+ const oauthResult = await oauth.processAuthorizationCodeOpenIDResponse(
324
330
  authServer,
325
331
  this.client,
326
332
  response,
@@ -351,29 +357,36 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
351
357
  profile,
352
358
  });
353
359
 
354
- localStorage.setItem("auto-login", "1");
360
+ sessionStorage.setItem(
361
+ "profile-state",
362
+ JSON.stringify(useAuthState.getState().profile),
363
+ );
355
364
 
356
- return sessionStorage.getItem("redirect-to") ?? "/";
365
+ const redirectTo = sessionStorage.getItem("redirect-to") ?? "/";
366
+ sessionStorage.removeItem("redirect-to");
367
+ return redirectTo;
357
368
  };
358
369
 
370
+ pageLoad(): void {
371
+ const profileState = sessionStorage.getItem("profile-state");
372
+ if (profileState) {
373
+ try {
374
+ const profile = JSON.parse(profileState);
375
+ useAuthState.setState({
376
+ isAuthenticated: true,
377
+ isPending: false,
378
+ profile,
379
+ });
380
+ } catch (err) {
381
+ logger.error("Error parsing auth state", err);
382
+ }
383
+ }
384
+ }
385
+
359
386
  getAuthenticationPlugin() {
360
- return new OpenIdAuthPlugin(
361
- this.callbackUrlPath,
362
- async (_, options: { navigate: NavigateFunction }) => {
363
- if (typeof window === "undefined") return;
364
-
365
- if (localStorage.getItem("auto-login")) {
366
- localStorage.removeItem("auto-login");
367
-
368
- await this.authorize({ redirectTo: window.location.pathname });
369
- } else if (window.location.pathname === "/oauth/callback") {
370
- const redirect = await this.handleCallback();
371
- if (redirect) {
372
- options.navigate(redirect);
373
- }
374
- }
375
- },
376
- );
387
+ // TODO: This API is a bit messy, we need to refactor auth plugins/providers
388
+ // to remove the extra layers of abstraction.
389
+ return new OpenIdAuthPlugin(this.callbackUrlPath, this.handleCallback);
377
390
  }
378
391
  }
379
392