@workos-inc/widgets 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/CHANGELOG.md +30 -8
  2. package/dist/cjs/admin-portal-domain-verification.client.cjs +34 -20
  3. package/dist/cjs/admin-portal-domain-verification.client.cjs.map +1 -1
  4. package/dist/cjs/admin-portal-domain-verification.client.d.cts +3 -2
  5. package/dist/cjs/{admin-portal-sso-connection-client.cjs → admin-portal-sso-connection.client.cjs} +61 -35
  6. package/dist/cjs/admin-portal-sso-connection.client.cjs.map +1 -0
  7. package/dist/cjs/admin-portal-sso-connection.client.d.cts +16 -0
  8. package/dist/cjs/api/api-provider.cjs +27 -19
  9. package/dist/cjs/api/api-provider.cjs.map +1 -1
  10. package/dist/cjs/api/api-provider.d.cts +5 -4
  11. package/dist/cjs/api/endpoint.cjs +62 -2
  12. package/dist/cjs/api/endpoint.cjs.map +1 -1
  13. package/dist/cjs/api/endpoint.d.cts +62 -1
  14. package/dist/cjs/api/utils.cjs +10 -0
  15. package/dist/cjs/api/utils.cjs.map +1 -1
  16. package/dist/cjs/api/utils.d.cts +7 -2
  17. package/dist/cjs/api/widgets-api-client.cjs +11 -5
  18. package/dist/cjs/api/widgets-api-client.cjs.map +1 -1
  19. package/dist/cjs/{api-keys-client.cjs → api-keys.client.cjs} +45 -33
  20. package/dist/cjs/api-keys.client.cjs.map +1 -0
  21. package/dist/cjs/api-keys.client.d.cts +15 -0
  22. package/dist/cjs/index.cjs +9 -2
  23. package/dist/cjs/index.cjs.map +1 -1
  24. package/dist/cjs/index.d.cts +6 -2
  25. package/dist/cjs/lib/add-mfa-dialog.cjs +1 -1
  26. package/dist/cjs/lib/add-mfa-dialog.cjs.map +1 -1
  27. package/dist/cjs/lib/admin-portal-domain-verification.cjs +18 -12
  28. package/dist/cjs/lib/admin-portal-domain-verification.cjs.map +1 -1
  29. package/dist/cjs/lib/admin-portal-domain-verification.d.cts +10 -6
  30. package/dist/cjs/lib/admin-portal-sso-connection.cjs +84 -106
  31. package/dist/cjs/lib/admin-portal-sso-connection.cjs.map +1 -1
  32. package/dist/cjs/lib/admin-portal-sso-connection.d.cts +13 -6
  33. package/dist/cjs/lib/api-keys/api-keys.cjs +70 -66
  34. package/dist/cjs/lib/api-keys/api-keys.cjs.map +1 -1
  35. package/dist/cjs/lib/api-keys/api-keys.d.cts +16 -8
  36. package/dist/cjs/lib/card-list.cjs.map +1 -0
  37. package/dist/cjs/lib/constants.cjs +5 -2
  38. package/dist/cjs/lib/constants.cjs.map +1 -1
  39. package/dist/cjs/lib/constants.d.cts +2 -1
  40. package/dist/cjs/lib/elevated-access.cjs.map +1 -1
  41. package/dist/cjs/lib/empty-state.cjs +24 -8
  42. package/dist/cjs/lib/empty-state.cjs.map +1 -1
  43. package/dist/cjs/lib/empty-state.d.cts +6 -2
  44. package/dist/cjs/lib/errors.cjs +1 -1
  45. package/dist/cjs/lib/errors.cjs.map +1 -1
  46. package/dist/cjs/lib/generic-error.cjs +56 -58
  47. package/dist/cjs/lib/generic-error.cjs.map +1 -1
  48. package/dist/cjs/lib/generic-error.d.cts +10 -3
  49. package/dist/cjs/lib/identity-providers.cjs +2 -1
  50. package/dist/cjs/lib/identity-providers.cjs.map +1 -1
  51. package/dist/cjs/lib/identity-providers.d.cts +2 -2
  52. package/dist/cjs/lib/oauth-icons.cjs +12 -7
  53. package/dist/cjs/lib/oauth-icons.cjs.map +1 -1
  54. package/dist/cjs/lib/oauth-icons.d.cts +7 -3
  55. package/dist/cjs/lib/organization-switcher.cjs +62 -9
  56. package/dist/cjs/lib/organization-switcher.cjs.map +1 -1
  57. package/dist/cjs/lib/organization-switcher.d.cts +12 -9
  58. package/dist/cjs/lib/otp-input.cjs +1 -1
  59. package/dist/cjs/lib/otp-input.cjs.map +1 -1
  60. package/dist/cjs/lib/pipes.cjs +343 -0
  61. package/dist/cjs/lib/pipes.cjs.map +1 -0
  62. package/dist/cjs/lib/pipes.d.cts +19 -0
  63. package/dist/cjs/lib/provider-icon.cjs +0 -6
  64. package/dist/cjs/lib/provider-icon.cjs.map +1 -1
  65. package/dist/cjs/lib/provider-icon.d.cts +4 -1
  66. package/dist/cjs/lib/save-button.cjs.map +1 -1
  67. package/dist/cjs/lib/use-permissions.cjs +7 -14
  68. package/dist/cjs/lib/use-permissions.cjs.map +1 -1
  69. package/dist/cjs/lib/use-permissions.d.cts +1 -1
  70. package/dist/cjs/lib/user-profile.cjs +77 -83
  71. package/dist/cjs/lib/user-profile.cjs.map +1 -1
  72. package/dist/cjs/lib/user-profile.d.cts +11 -7
  73. package/dist/cjs/lib/user-security.cjs +31 -25
  74. package/dist/cjs/lib/user-security.cjs.map +1 -1
  75. package/dist/cjs/lib/user-security.d.cts +10 -7
  76. package/dist/cjs/lib/user-sessions.cjs +20 -10
  77. package/dist/cjs/lib/user-sessions.cjs.map +1 -1
  78. package/dist/cjs/lib/user-sessions.d.cts +10 -6
  79. package/dist/cjs/lib/users-management.cjs +224 -216
  80. package/dist/cjs/lib/users-management.cjs.map +1 -1
  81. package/dist/cjs/lib/users-management.d.cts +10 -7
  82. package/dist/cjs/lib/utils.cjs +43 -0
  83. package/dist/cjs/lib/utils.cjs.map +1 -1
  84. package/dist/cjs/lib/utils.d.cts +29 -2
  85. package/dist/cjs/organization-switcher.client.cjs +47 -20
  86. package/dist/cjs/organization-switcher.client.cjs.map +1 -1
  87. package/dist/cjs/organization-switcher.client.d.cts +2 -1
  88. package/dist/cjs/pipes.client.cjs +64 -0
  89. package/dist/cjs/pipes.client.cjs.map +1 -0
  90. package/dist/cjs/pipes.client.d.cts +15 -0
  91. package/dist/cjs/user-profile.client.cjs +29 -16
  92. package/dist/cjs/user-profile.client.cjs.map +1 -1
  93. package/dist/cjs/user-profile.client.d.cts +4 -3
  94. package/dist/cjs/user-security.client.cjs +32 -14
  95. package/dist/cjs/user-security.client.cjs.map +1 -1
  96. package/dist/cjs/user-security.client.d.cts +3 -2
  97. package/dist/cjs/user-sessions.client.cjs +42 -28
  98. package/dist/cjs/user-sessions.client.cjs.map +1 -1
  99. package/dist/cjs/user-sessions.client.d.cts +4 -2
  100. package/dist/cjs/users-management.client.cjs +38 -27
  101. package/dist/cjs/users-management.client.cjs.map +1 -1
  102. package/dist/cjs/users-management.client.d.cts +3 -2
  103. package/dist/cjs/workos-widgets.client.cjs +7 -12
  104. package/dist/cjs/workos-widgets.client.cjs.map +1 -1
  105. package/dist/css/lib/provider-icon.css +16 -11
  106. package/dist/esm/admin-portal-domain-verification.client.d.ts +3 -2
  107. package/dist/esm/admin-portal-domain-verification.client.js +34 -21
  108. package/dist/esm/admin-portal-domain-verification.client.js.map +1 -1
  109. package/dist/esm/admin-portal-sso-connection.client.d.ts +16 -0
  110. package/dist/esm/{admin-portal-sso-connection-client.js → admin-portal-sso-connection.client.js} +61 -36
  111. package/dist/esm/admin-portal-sso-connection.client.js.map +1 -0
  112. package/dist/esm/api/api-provider.d.ts +5 -4
  113. package/dist/esm/api/api-provider.js +26 -19
  114. package/dist/esm/api/api-provider.js.map +1 -1
  115. package/dist/esm/api/endpoint.d.ts +62 -1
  116. package/dist/esm/api/endpoint.js +56 -2
  117. package/dist/esm/api/endpoint.js.map +1 -1
  118. package/dist/esm/api/utils.d.ts +7 -2
  119. package/dist/esm/api/utils.js +9 -0
  120. package/dist/esm/api/utils.js.map +1 -1
  121. package/dist/esm/api/widgets-api-client.js +11 -5
  122. package/dist/esm/api/widgets-api-client.js.map +1 -1
  123. package/dist/esm/api-keys.client.d.ts +15 -0
  124. package/dist/esm/api-keys.client.js +75 -0
  125. package/dist/esm/api-keys.client.js.map +1 -0
  126. package/dist/esm/index.d.ts +6 -2
  127. package/dist/esm/index.js +9 -2
  128. package/dist/esm/index.js.map +1 -1
  129. package/dist/esm/lib/add-mfa-dialog.js +1 -1
  130. package/dist/esm/lib/add-mfa-dialog.js.map +1 -1
  131. package/dist/esm/lib/admin-portal-domain-verification.d.ts +10 -6
  132. package/dist/esm/lib/admin-portal-domain-verification.js +18 -12
  133. package/dist/esm/lib/admin-portal-domain-verification.js.map +1 -1
  134. package/dist/esm/lib/admin-portal-sso-connection.d.ts +13 -6
  135. package/dist/esm/lib/admin-portal-sso-connection.js +88 -107
  136. package/dist/esm/lib/admin-portal-sso-connection.js.map +1 -1
  137. package/dist/esm/lib/api-keys/api-keys.d.ts +16 -8
  138. package/dist/esm/lib/api-keys/api-keys.js +69 -54
  139. package/dist/esm/lib/api-keys/api-keys.js.map +1 -1
  140. package/dist/esm/lib/card-list.js.map +1 -0
  141. package/dist/esm/lib/constants.d.ts +2 -1
  142. package/dist/esm/lib/constants.js +3 -1
  143. package/dist/esm/lib/constants.js.map +1 -1
  144. package/dist/esm/lib/elevated-access.js.map +1 -1
  145. package/dist/esm/lib/empty-state.d.ts +6 -2
  146. package/dist/esm/lib/empty-state.js +24 -8
  147. package/dist/esm/lib/empty-state.js.map +1 -1
  148. package/dist/esm/lib/errors.js +1 -1
  149. package/dist/esm/lib/errors.js.map +1 -1
  150. package/dist/esm/lib/generic-error.d.ts +10 -3
  151. package/dist/esm/lib/generic-error.js +56 -60
  152. package/dist/esm/lib/generic-error.js.map +1 -1
  153. package/dist/esm/lib/identity-providers.d.ts +2 -2
  154. package/dist/esm/lib/identity-providers.js +2 -1
  155. package/dist/esm/lib/identity-providers.js.map +1 -1
  156. package/dist/esm/lib/oauth-icons.d.ts +7 -3
  157. package/dist/esm/lib/oauth-icons.js +11 -6
  158. package/dist/esm/lib/oauth-icons.js.map +1 -1
  159. package/dist/esm/lib/organization-switcher.d.ts +12 -9
  160. package/dist/esm/lib/organization-switcher.js +54 -9
  161. package/dist/esm/lib/organization-switcher.js.map +1 -1
  162. package/dist/esm/lib/otp-input.js +1 -1
  163. package/dist/esm/lib/otp-input.js.map +1 -1
  164. package/dist/esm/lib/pipes.d.ts +19 -0
  165. package/dist/esm/lib/pipes.js +334 -0
  166. package/dist/esm/lib/pipes.js.map +1 -0
  167. package/dist/esm/lib/provider-icon.d.ts +4 -1
  168. package/dist/esm/lib/provider-icon.js +0 -8
  169. package/dist/esm/lib/provider-icon.js.map +1 -1
  170. package/dist/esm/lib/save-button.js.map +1 -1
  171. package/dist/esm/lib/use-permissions.d.ts +1 -1
  172. package/dist/esm/lib/use-permissions.js +8 -15
  173. package/dist/esm/lib/use-permissions.js.map +1 -1
  174. package/dist/esm/lib/user-profile.d.ts +11 -7
  175. package/dist/esm/lib/user-profile.js +82 -75
  176. package/dist/esm/lib/user-profile.js.map +1 -1
  177. package/dist/esm/lib/user-security.d.ts +10 -7
  178. package/dist/esm/lib/user-security.js +35 -26
  179. package/dist/esm/lib/user-security.js.map +1 -1
  180. package/dist/esm/lib/user-sessions.d.ts +10 -6
  181. package/dist/esm/lib/user-sessions.js +21 -10
  182. package/dist/esm/lib/user-sessions.js.map +1 -1
  183. package/dist/esm/lib/users-management.d.ts +10 -7
  184. package/dist/esm/lib/users-management.js +230 -217
  185. package/dist/esm/lib/users-management.js.map +1 -1
  186. package/dist/esm/lib/utils.d.ts +29 -2
  187. package/dist/esm/lib/utils.js +46 -1
  188. package/dist/esm/lib/utils.js.map +1 -1
  189. package/dist/esm/organization-switcher.client.d.ts +2 -1
  190. package/dist/esm/organization-switcher.client.js +47 -21
  191. package/dist/esm/organization-switcher.client.js.map +1 -1
  192. package/dist/esm/pipes.client.d.ts +15 -0
  193. package/dist/esm/pipes.client.js +42 -0
  194. package/dist/esm/pipes.client.js.map +1 -0
  195. package/dist/esm/user-profile.client.d.ts +4 -3
  196. package/dist/esm/user-profile.client.js +29 -17
  197. package/dist/esm/user-profile.client.js.map +1 -1
  198. package/dist/esm/user-security.client.d.ts +3 -2
  199. package/dist/esm/user-security.client.js +32 -15
  200. package/dist/esm/user-security.client.js.map +1 -1
  201. package/dist/esm/user-sessions.client.d.ts +4 -2
  202. package/dist/esm/user-sessions.client.js +43 -30
  203. package/dist/esm/user-sessions.client.js.map +1 -1
  204. package/dist/esm/users-management.client.d.ts +3 -2
  205. package/dist/esm/users-management.client.js +38 -28
  206. package/dist/esm/users-management.client.js.map +1 -1
  207. package/dist/esm/workos-widgets.client.js +7 -12
  208. package/dist/esm/workos-widgets.client.js.map +1 -1
  209. package/package.json +20 -10
  210. package/dist/cjs/admin-portal-sso-connection-client.cjs.map +0 -1
  211. package/dist/cjs/admin-portal-sso-connection-client.d.cts +0 -12
  212. package/dist/cjs/api-keys-client.cjs.map +0 -1
  213. package/dist/cjs/api-keys-client.d.cts +0 -10
  214. package/dist/cjs/card-list.cjs.map +0 -1
  215. package/dist/esm/admin-portal-sso-connection-client.d.ts +0 -12
  216. package/dist/esm/admin-portal-sso-connection-client.js.map +0 -1
  217. package/dist/esm/api-keys-client.d.ts +0 -10
  218. package/dist/esm/api-keys-client.js +0 -65
  219. package/dist/esm/api-keys-client.js.map +0 -1
  220. package/dist/esm/card-list.js.map +0 -1
  221. /package/dist/cjs/{card-list.cjs → lib/card-list.cjs} +0 -0
  222. /package/dist/cjs/{card-list.d.cts → lib/card-list.d.cts} +0 -0
  223. /package/dist/esm/{card-list.d.ts → lib/card-list.d.ts} +0 -0
  224. /package/dist/esm/{card-list.js → lib/card-list.js} +0 -0
@@ -9,15 +9,17 @@ import {
9
9
  InfoCircledIcon,
10
10
  Cross2Icon
11
11
  } from "@radix-ui/react-icons";
12
- import * as CardList from "../card-list.js";
12
+ import * as CardList from "./card-list.js";
13
13
  import { ProviderIcon } from "./provider-icon.js";
14
14
  import {
15
15
  getIdentityProviderName
16
16
  } from "./identity-providers.js";
17
17
  import { Status } from "./status.js";
18
- import { unreachable } from "./utils.js";
19
- import clsx from "clsx";
20
- import { ApiError, FetchError, NoAuthTokenError } from "./errors.js";
18
+ import {
19
+ getDomProps,
20
+ unreachable
21
+ } from "./utils.js";
22
+ import { getErrorMessage } from "./generic-error.js";
21
23
  const AdminPortalSsoConnectionContext = React.createContext(null);
22
24
  AdminPortalSsoConnectionContext.displayName = "AdminPortalSsoConnectionContext";
23
25
  function useAdminPortalSsoConnectionContext() {
@@ -35,84 +37,77 @@ const AdminPortalSsoConnection = ({
35
37
  identityProvider,
36
38
  expiryDate,
37
39
  lastSession,
38
- adminPortalOpenButton
40
+ adminPortalOpenButton,
41
+ ...domProps
39
42
  }) => {
40
- return /* @__PURE__ */ jsx(
41
- CardList.Root,
42
- {
43
- size: "2",
44
- className: clsx("woswidgets-widget"),
45
- "data-woswidgets-widget-id": "admin-portal-sso-connection",
46
- children: /* @__PURE__ */ jsxs(AdminPortalSsoConnectionContext.Provider, { value: { connectionStatus }, children: [
47
- /* @__PURE__ */ jsx(CardList.Item, { children: /* @__PURE__ */ jsx(Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: (() => {
48
- if (connectionStatus === "NotConfigured") {
49
- return /* @__PURE__ */ jsxs(Fragment, { children: [
50
- /* @__PURE__ */ jsx(Text, { size: "2", color: "gray", ml: "2", children: "You haven\u2019t set up Single Sign-On yet." }),
51
- adminPortalOpenButton
52
- ] });
43
+ return /* @__PURE__ */ jsx(CardList.Root, { size: "2", ...getWidgetRootDomProps("resolved", domProps), children: /* @__PURE__ */ jsxs(AdminPortalSsoConnectionContext.Provider, { value: { connectionStatus }, children: [
44
+ /* @__PURE__ */ jsx(CardList.Item, { children: /* @__PURE__ */ jsx(Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: (() => {
45
+ if (connectionStatus === "NotConfigured") {
46
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
47
+ /* @__PURE__ */ jsx(Text, { size: "2", color: "gray", children: "You haven\u2019t set up Single Sign-On yet." }),
48
+ adminPortalOpenButton
49
+ ] });
50
+ }
51
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
52
+ /* @__PURE__ */ jsx(
53
+ SessionInfo,
54
+ {
55
+ connectionStatus,
56
+ identityProvider,
57
+ lastSession,
58
+ currentDate
53
59
  }
54
- return /* @__PURE__ */ jsxs(Fragment, { children: [
55
- /* @__PURE__ */ jsx(
56
- SessionInfo,
57
- {
58
- connectionStatus,
59
- identityProvider,
60
- lastSession,
61
- currentDate
60
+ ),
61
+ /* @__PURE__ */ jsxs(Flex, { gap: "5", align: "center", children: [
62
+ /* @__PURE__ */ jsx(SsoStatus, { status: connectionStatus }),
63
+ adminPortalOpenButton
64
+ ] })
65
+ ] });
66
+ })() }) }),
67
+ connectionStatus === "Expired" && /* @__PURE__ */ jsx(CardList.Item, { children: /* @__PURE__ */ jsxs(Flex, { align: "start", gap: "2", children: [
68
+ /* @__PURE__ */ jsx(Box, { asChild: true, mt: "2px", flexShrink: "0", children: /* @__PURE__ */ jsx(InfoCircledIcon, { color: "gray" }) }),
69
+ (() => {
70
+ if (connectionStatus === "Expired") {
71
+ return /* @__PURE__ */ jsxs(Text, { size: "2", color: "gray", children: [
72
+ (() => {
73
+ if (!expiryDate) {
74
+ return "The SAML response signing certificate has expired";
62
75
  }
63
- ),
64
- /* @__PURE__ */ jsxs(Flex, { gap: "5", align: "center", children: [
65
- /* @__PURE__ */ jsx(SsoStatus, { status: connectionStatus }),
66
- adminPortalOpenButton
67
- ] })
68
- ] });
69
- })() }) }),
70
- connectionStatus === "Expired" && /* @__PURE__ */ jsx(CardList.Item, { children: /* @__PURE__ */ jsxs(Flex, { align: "start", gap: "2", children: [
71
- /* @__PURE__ */ jsx(Box, { asChild: true, mt: "2px", flexShrink: "0", children: /* @__PURE__ */ jsx(InfoCircledIcon, { color: "gray" }) }),
72
- (() => {
73
- if (connectionStatus === "Expired") {
74
- return /* @__PURE__ */ jsxs(Text, { size: "2", color: "gray", children: [
75
- (() => {
76
- if (!expiryDate) {
77
- return "The SAML response signing certificate has expired";
78
- }
79
- return /* @__PURE__ */ jsxs(Fragment, { children: [
80
- "The SAML response signing certificate expired on",
81
- " ",
82
- /* @__PURE__ */ jsx(Text, { weight: "bold", as: "span", children: expiryDate?.toLocaleString("en-US", {
83
- month: "long",
84
- day: "numeric",
85
- year: "numeric"
86
- }) })
87
- ] });
88
- })(),
89
- ". Users won\u2019t be able to sign-in to the application until the certificate is renewed."
76
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
77
+ "The SAML response signing certificate expired on",
78
+ " ",
79
+ /* @__PURE__ */ jsx(Text, { weight: "bold", as: "span", children: expiryDate?.toLocaleString("en-US", {
80
+ month: "long",
81
+ day: "numeric",
82
+ year: "numeric"
83
+ }) })
90
84
  ] });
91
- }
92
- if (connectionStatus === "Expiring") {
93
- return /* @__PURE__ */ jsxs(Text, { size: "2", color: "gray", children: [
94
- (() => {
95
- if (!expiryDate) {
96
- return "The SAML response signing certificate is expiring soon";
97
- }
98
- return /* @__PURE__ */ jsxs(Fragment, { children: [
99
- "The SAML response signing certificate will expire on",
100
- " ",
101
- /* @__PURE__ */ jsx(Text, { weight: "bold", as: "span", children: expiryDate?.toLocaleString("en-US", {
102
- month: "long",
103
- day: "numeric",
104
- year: "numeric"
105
- }) })
106
- ] });
107
- })(),
108
- ". When expired, users won\u2019t be able to sign-in."
85
+ })(),
86
+ ". Users won\u2019t be able to sign-in to the application until the certificate is renewed."
87
+ ] });
88
+ }
89
+ if (connectionStatus === "Expiring") {
90
+ return /* @__PURE__ */ jsxs(Text, { size: "2", color: "gray", children: [
91
+ (() => {
92
+ if (!expiryDate) {
93
+ return "The SAML response signing certificate is expiring soon";
94
+ }
95
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
96
+ "The SAML response signing certificate will expire on",
97
+ " ",
98
+ /* @__PURE__ */ jsx(Text, { weight: "bold", as: "span", children: expiryDate?.toLocaleString("en-US", {
99
+ month: "long",
100
+ day: "numeric",
101
+ year: "numeric"
102
+ }) })
109
103
  ] });
110
- }
111
- })()
112
- ] }) })
113
- ] })
114
- }
115
- );
104
+ })(),
105
+ ". When expired, users won\u2019t be able to sign-in."
106
+ ] });
107
+ }
108
+ })()
109
+ ] }) })
110
+ ] }) });
116
111
  };
117
112
  function SsoStatus({
118
113
  status
@@ -197,8 +192,8 @@ function AdminPortalOpenButton({
197
192
  }
198
193
  );
199
194
  }
200
- const AdminPortalSsoConnectionLoading = () => {
201
- return /* @__PURE__ */ jsx(Card, { size: "2", children: /* @__PURE__ */ jsxs(Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: [
195
+ const AdminPortalSsoConnectionLoading = (props) => {
196
+ return /* @__PURE__ */ jsx(Card, { size: "2", ...getWidgetRootDomProps("loading", props), children: /* @__PURE__ */ jsxs(Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: [
202
197
  /* @__PURE__ */ jsxs(Flex, { gap: "4", align: "center", children: [
203
198
  /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(IconPanel, { color: "panel", children: /* @__PURE__ */ jsx(ProviderIcon, { provider: "okta", size: "2" }) }) }),
204
199
  /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "1", my: "-4px", children: [
@@ -215,35 +210,12 @@ const AdminPortalSsoConnectionLoading = () => {
215
210
  ] })
216
211
  ] }) });
217
212
  };
218
- function AdminPortalSsoConnectionError({ error }) {
213
+ const AdminPortalSsoConnectionError = ({ error, ...domProps }) => {
219
214
  React.useEffect(() => {
220
215
  console.error(error);
221
216
  }, [error]);
222
- const { heading, message } = (() => {
223
- if (error instanceof FetchError) {
224
- return {
225
- heading: "Error fetching data",
226
- message: "An error occurred. You may need to configure CORS in the WorkOS Dashboard. Contact your organization admin for support."
227
- };
228
- }
229
- if (error instanceof NoAuthTokenError) {
230
- return {
231
- heading: "Error fetching data",
232
- message: "Authorization error. You likely forgot to provide an authorization token to the Users Management Widget."
233
- };
234
- }
235
- if (error instanceof ApiError && error.status === 404) {
236
- return {
237
- heading: "Error fetching data",
238
- message: "Authorization error. Contact your organization admin for support."
239
- };
240
- }
241
- return {
242
- heading: "Unknown error",
243
- message: "An unexpected error occurred. Please try refreshing the page, or contact your organization admin for support."
244
- };
245
- })();
246
- return /* @__PURE__ */ jsx(Card, { size: "2", children: /* @__PURE__ */ jsx(Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: /* @__PURE__ */ jsxs(Flex, { gap: "4", align: "center", children: [
217
+ const { heading, message } = getErrorMessage(error);
218
+ return /* @__PURE__ */ jsx(Card, { size: "2", ...getWidgetRootDomProps("error", domProps), children: /* @__PURE__ */ jsx(Flex, { direction: "row", justify: "between", align: "center", gap: "2", children: /* @__PURE__ */ jsxs(Flex, { gap: "4", align: "center", children: [
247
219
  /* @__PURE__ */ jsx(
248
220
  Flex,
249
221
  {
@@ -254,7 +226,8 @@ function AdminPortalSsoConnectionError({ error }) {
254
226
  style: {
255
227
  borderRadius: "9999px",
256
228
  backgroundColor: "var(--red-a4)",
257
- color: "var(--red-a11)"
229
+ color: "var(--red-a11)",
230
+ flexShrink: 0
258
231
  },
259
232
  children: /* @__PURE__ */ jsx(Cross2Icon, { width: "18px", height: "18px" })
260
233
  }
@@ -264,7 +237,7 @@ function AdminPortalSsoConnectionError({ error }) {
264
237
  /* @__PURE__ */ jsx(Text, { size: "2", color: "gray", children: message })
265
238
  ] })
266
239
  ] }) }) });
267
- }
240
+ };
268
241
  function getRelativeTimeString(currentDate, lastSession) {
269
242
  if (!currentDate || !lastSession) {
270
243
  return null;
@@ -294,6 +267,14 @@ function getRelativeTimeString(currentDate, lastSession) {
294
267
  }
295
268
  return rtf.format(diffYears, "year");
296
269
  }
270
+ function getWidgetRootDomProps(state, domProps) {
271
+ return getDomProps({
272
+ ...domProps,
273
+ isWidgetRoot: true,
274
+ widgetId: "admin-portal-sso-connection",
275
+ widgetState: state
276
+ });
277
+ }
297
278
  export {
298
279
  AdminPortalOpenButton,
299
280
  AdminPortalSsoConnection,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/admin-portal-sso-connection.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Box, Button, Card, Flex, Text } from \"@radix-ui/themes\";\nimport { Skeleton } from \"./elements.js\";\nimport { IconPanel } from \"./icon-panel.js\";\nimport {\n ExternalLinkIcon,\n InfoCircledIcon,\n Cross2Icon,\n} from \"@radix-ui/react-icons\";\nimport * as CardList from \"../card-list.js\";\nimport { ProviderIcon } from \"./provider-icon.js\";\nimport {\n getIdentityProviderName,\n type IdentityProvider,\n} from \"./identity-providers.js\";\nimport { Status } from \"./status.js\";\nimport { unreachable } from \"./utils.js\";\nimport clsx from \"clsx\";\n\nimport { ApiError, FetchError, NoAuthTokenError } from \"./errors.js\";\n\ninterface NotConfiguredProps {\n connectionStatus: \"NotConfigured\";\n identityProvider?: never;\n expiryDate?: never;\n}\n\ninterface InactiveProps {\n connectionStatus: \"Inactive\";\n identityProvider: IdentityProvider;\n expiryDate?: never;\n}\n\ninterface ActiveProps {\n connectionStatus: \"Active\";\n identityProvider: IdentityProvider;\n expiryDate?: never;\n}\n\ninterface RequiresActionProps {\n connectionStatus: \"Expired\" | \"Expiring\";\n identityProvider: IdentityProvider;\n expiryDate: Date | null;\n}\n\nexport type AdminPortalSsoConnectionStatusProps =\n | NotConfiguredProps\n | InactiveProps\n | ActiveProps\n | RequiresActionProps;\n\nexport type AdminPortalSsoConnectionProps =\n AdminPortalSsoConnectionStatusProps & {\n currentDate: Date | null;\n\n lastSession: Date | null;\n adminPortalOpenButton: React.ReactNode;\n };\n\ninterface AdminPortalSsoConnectionContextValue {\n connectionStatus: AdminPortalSsoConnectionStatusProps[\"connectionStatus\"];\n}\n\nconst AdminPortalSsoConnectionContext =\n React.createContext<AdminPortalSsoConnectionContextValue | null>(null);\nAdminPortalSsoConnectionContext.displayName = \"AdminPortalSsoConnectionContext\";\n\nfunction useAdminPortalSsoConnectionContext() {\n const context = React.useContext(AdminPortalSsoConnectionContext);\n if (!context) {\n throw new Error(\n \"useAdminPortalSsoConnectionContext must be used within a AdminPortalSsoConnectionContext provider\",\n );\n }\n return context;\n}\n\nexport const AdminPortalSsoConnection = ({\n currentDate,\n connectionStatus,\n identityProvider,\n expiryDate,\n lastSession,\n adminPortalOpenButton,\n}: AdminPortalSsoConnectionProps) => {\n return (\n <CardList.Root\n size=\"2\"\n className={clsx(\"woswidgets-widget\")}\n data-woswidgets-widget-id=\"admin-portal-sso-connection\"\n >\n <AdminPortalSsoConnectionContext.Provider value={{ connectionStatus }}>\n <CardList.Item>\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n {(() => {\n if (connectionStatus === \"NotConfigured\") {\n return (\n <>\n <Text size=\"2\" color=\"gray\" ml=\"2\">\n You haven’t set up Single Sign-On yet.\n </Text>\n {adminPortalOpenButton}\n </>\n );\n }\n\n return (\n <>\n <SessionInfo\n connectionStatus={connectionStatus}\n identityProvider={identityProvider}\n lastSession={lastSession}\n currentDate={currentDate}\n />\n <Flex gap=\"5\" align=\"center\">\n <SsoStatus status={connectionStatus} />\n {adminPortalOpenButton}\n </Flex>\n </>\n );\n })()}\n </Flex>\n </CardList.Item>\n {connectionStatus === \"Expired\" && (\n <CardList.Item>\n <Flex align=\"start\" gap=\"2\">\n <Box asChild mt=\"2px\" flexShrink=\"0\">\n <InfoCircledIcon color=\"gray\" />\n </Box>\n {(() => {\n if (connectionStatus === \"Expired\") {\n return (\n <Text size=\"2\" color=\"gray\">\n {(() => {\n if (!expiryDate) {\n return \"The SAML response signing certificate has expired\";\n }\n\n return (\n <>\n The SAML response signing certificate expired on{\" \"}\n <Text weight=\"bold\" as=\"span\">\n {expiryDate?.toLocaleString(\"en-US\", {\n month: \"long\",\n day: \"numeric\",\n year: \"numeric\",\n })}\n </Text>\n </>\n );\n })()}\n . Users won’t be able to sign-in to the application until\n the certificate is renewed.\n </Text>\n );\n }\n\n if (connectionStatus === \"Expiring\") {\n return (\n <Text size=\"2\" color=\"gray\">\n {(() => {\n if (!expiryDate) {\n return \"The SAML response signing certificate is expiring soon\";\n }\n\n return (\n <>\n The SAML response signing certificate will expire on{\" \"}\n <Text weight=\"bold\" as=\"span\">\n {expiryDate?.toLocaleString(\"en-US\", {\n month: \"long\",\n day: \"numeric\",\n year: \"numeric\",\n })}\n </Text>\n </>\n );\n })()}\n . When expired, users won’t be able to sign-in.\n </Text>\n );\n }\n })()}\n </Flex>\n </CardList.Item>\n )}\n </AdminPortalSsoConnectionContext.Provider>\n </CardList.Root>\n );\n};\n\nfunction SsoStatus({\n status,\n}: {\n status: AdminPortalSsoConnectionStatusProps[\"connectionStatus\"];\n}) {\n if (status === \"NotConfigured\") {\n return null;\n }\n\n if (status === \"Inactive\") {\n return <Status state=\"waiting\">Setup in progress</Status>;\n }\n\n if (status === \"Expired\") {\n return <Status state=\"error\">Requires action</Status>;\n }\n\n if (status === \"Active\" || status === \"Expiring\") {\n return <Status state=\"success\">Connected</Status>;\n }\n\n return unreachable(status);\n}\n\nfunction SessionInfo({\n currentDate,\n identityProvider,\n lastSession,\n connectionStatus,\n}: {\n identityProvider: IdentityProvider;\n lastSession: Date | null;\n currentDate: Date | null;\n connectionStatus: AdminPortalSsoConnectionStatusProps[\"connectionStatus\"];\n}) {\n const relativeTimeString = React.useMemo(() => {\n if (\n !lastSession ||\n !currentDate ||\n connectionStatus === \"NotConfigured\" ||\n connectionStatus === \"Inactive\"\n ) {\n return null;\n }\n\n return getRelativeTimeString(currentDate, lastSession);\n }, [lastSession, currentDate, connectionStatus]);\n\n return (\n <Flex gap=\"4\" align=\"center\">\n <IconPanel color=\"panel\">\n <ProviderIcon provider={identityProvider} size=\"2\" />\n </IconPanel>\n {lastSession ? (\n <Flex direction=\"column\">\n <Text size=\"2\" weight=\"bold\">\n {getIdentityProviderName(identityProvider)}\n </Text>\n {relativeTimeString ? (\n <Text color=\"gray\" size=\"2\">\n Last session {relativeTimeString}\n </Text>\n ) : null}\n </Flex>\n ) : (\n <Text size=\"2\" weight=\"bold\">\n {getIdentityProviderName(identityProvider)}\n </Text>\n )}\n </Flex>\n );\n}\n\nexport function AdminPortalOpenButton({\n isPending,\n href,\n initConfig,\n}: {\n isPending: boolean;\n href: string | null;\n initConfig: () => void;\n}) {\n const { connectionStatus } = useAdminPortalSsoConnectionContext();\n const label = (() => {\n switch (connectionStatus) {\n case \"NotConfigured\":\n return \"Set up SSO\";\n case \"Inactive\":\n return \"Continue setup\";\n case \"Active\":\n case \"Expiring\":\n case \"Expired\":\n return \"Manage\";\n default:\n return unreachable(connectionStatus);\n }\n })();\n\n if (href) {\n return (\n <Button variant=\"outline\" color=\"gray\" asChild>\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {label} <ExternalLinkIcon />\n </a>\n </Button>\n );\n }\n\n return (\n <Button\n variant=\"outline\"\n color=\"gray\"\n loading={isPending}\n disabled={isPending}\n onClick={initConfig}\n >\n {label} <ExternalLinkIcon />\n </Button>\n );\n}\n\nexport const AdminPortalSsoConnectionLoading: React.FC = () => {\n return (\n <Card size=\"2\">\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n <Flex gap=\"4\" align=\"center\">\n <Skeleton>\n <IconPanel color=\"panel\">\n <ProviderIcon provider=\"okta\" size=\"2\" />\n </IconPanel>\n </Skeleton>\n <Flex direction=\"column\" gap=\"1\" my=\"-4px\">\n <Skeleton>\n <Text size=\"1\">Okta</Text>\n </Skeleton>\n <Skeleton>\n <Text size=\"1\">Last session 10 minutes ago</Text>\n </Skeleton>\n </Flex>\n </Flex>\n <Flex gap=\"5\" align=\"center\">\n <Skeleton>\n <Status state=\"error\">Requires action</Status>\n </Skeleton>\n <Skeleton>\n <Button variant=\"outline\" color=\"gray\">\n Manage <ExternalLinkIcon />\n </Button>\n </Skeleton>\n </Flex>\n </Flex>\n </Card>\n );\n};\n\nexport function AdminPortalSsoConnectionError({ error }: { error: unknown }) {\n React.useEffect(() => {\n console.error(error);\n }, [error]);\n\n const { heading, message } = (() => {\n if (error instanceof FetchError) {\n return {\n heading: \"Error fetching data\",\n message:\n \"An error occurred. You may need to configure CORS in the WorkOS Dashboard. \" +\n \"Contact your organization admin for support.\",\n };\n }\n\n if (error instanceof NoAuthTokenError) {\n return {\n heading: \"Error fetching data\",\n message:\n \"Authorization error. You likely forgot to provide an authorization \" +\n \"token to the Users Management Widget.\",\n };\n }\n\n if (error instanceof ApiError && error.status === 404) {\n // The widgets API treats all authorization errors as 404s. If there is a\n // legitimate 404, it's a bug on our end but there's currently no way to\n // distinguish between the two.\n return {\n heading: \"Error fetching data\",\n message:\n \"Authorization error. Contact your organization admin for support.\",\n };\n }\n\n return {\n heading: \"Unknown error\",\n message:\n \"An unexpected error occurred. Please try refreshing the page, or contact your organization admin for support.\",\n };\n })();\n\n return (\n <Card size=\"2\">\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n <Flex gap=\"4\" align=\"center\">\n <Flex\n align=\"center\"\n justify=\"center\"\n width=\"24px\"\n height=\"24px\"\n style={{\n borderRadius: \"9999px\",\n backgroundColor: \"var(--red-a4)\",\n color: \"var(--red-a11)\",\n }}\n >\n <Cross2Icon width=\"18px\" height=\"18px\" />\n </Flex>\n <Flex direction=\"column\">\n <Text size=\"2\" weight=\"bold\">\n {heading}\n </Text>\n <Text size=\"2\" color=\"gray\">\n {message}\n </Text>\n </Flex>\n </Flex>\n </Flex>\n </Card>\n );\n}\n\nfunction getRelativeTimeString(\n currentDate: Date | null,\n lastSession: Date | null,\n) {\n if (!currentDate || !lastSession) {\n return null;\n }\n\n const rtf = new Intl.RelativeTimeFormat(\"en\", { numeric: \"auto\" });\n const diff = lastSession.getTime() - currentDate.getTime();\n\n const diffSeconds = Math.round(diff / 1000);\n const diffMinutes = Math.round(diffSeconds / 60);\n const diffHours = Math.round(diffMinutes / 60);\n const diffDays = Math.round(diffHours / 24);\n const diffMonths = Math.round(diffDays / 30);\n const diffYears = Math.round(diffMonths / 12);\n\n if (Math.abs(diffSeconds) < 60) {\n return \"now\";\n }\n\n if (Math.abs(diffMinutes) < 60) {\n return rtf.format(diffMinutes, \"minute\");\n }\n\n if (Math.abs(diffHours) < 24) {\n return rtf.format(diffHours, \"hour\");\n }\n\n if (Math.abs(diffDays) < 30) {\n return rtf.format(diffDays, \"day\");\n }\n\n if (Math.abs(diffMonths) < 12) {\n return rtf.format(diffMonths, \"month\");\n }\n\n return rtf.format(diffYears, \"year\");\n}\n"],"mappings":";AAmGkB,mBACE,KADF;AA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E,QAAM,OAAO,YAAY,QAAQ,IAAI,YAAY,QAAQ;AAEzD,QAAM,cAAc,KAAK,MAAM,OAAO,GAAI;AAC1C,QAAM,cAAc,KAAK,MAAM,cAAc,EAAE;AAC/C,QAAM,YAAY,KAAK,MAAM,cAAc,EAAE;AAC7C,QAAM,WAAW,KAAK,MAAM,YAAY,EAAE;AAC1C,QAAM,aAAa,KAAK,MAAM,WAAW,EAAE;AAC3C,QAAM,YAAY,KAAK,MAAM,aAAa,EAAE;AAE5C,MAAI,KAAK,IAAI,WAAW,IAAI,IAAI;AAC9B,WAAO;AAAA,EACT;AAEA,MAAI,KAAK,IAAI,WAAW,IAAI,IAAI;AAC9B,WAAO,IAAI,OAAO,aAAa,QAAQ;AAAA,EACzC;AAEA,MAAI,KAAK,IAAI,SAAS,IAAI,IAAI;AAC5B,WAAO,IAAI,OAAO,WAAW,MAAM;AAAA,EACrC;AAEA,MAAI,KAAK,IAAI,QAAQ,IAAI,IAAI;AAC3B,WAAO,IAAI,OAAO,UAAU,KAAK;AAAA,EACnC;AAEA,MAAI,KAAK,IAAI,UAAU,IAAI,IAAI;AAC7B,WAAO,IAAI,OAAO,YAAY,OAAO;AAAA,EACvC;AAEA,SAAO,IAAI,OAAO,WAAW,MAAM;AACrC;","names":[]}
1
+ {"version":3,"sources":["../../../src/lib/admin-portal-sso-connection.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Box, Button, Card, Flex, Text } from \"@radix-ui/themes\";\nimport { Skeleton } from \"./elements.js\";\nimport { IconPanel } from \"./icon-panel.js\";\nimport {\n ExternalLinkIcon,\n InfoCircledIcon,\n Cross2Icon,\n} from \"@radix-ui/react-icons\";\nimport * as CardList from \"./card-list.js\";\nimport { ProviderIcon } from \"./provider-icon.js\";\nimport {\n getIdentityProviderName,\n type IdentityProvider,\n} from \"./identity-providers.js\";\nimport { Status } from \"./status.js\";\nimport {\n getDomProps,\n unreachable,\n type WidgetRootState,\n type WidgetRootDomProps,\n} from \"./utils.js\";\nimport { getErrorMessage } from \"./generic-error.js\";\n\ninterface NotConfiguredProps {\n connectionStatus: \"NotConfigured\";\n identityProvider?: never;\n expiryDate?: never;\n}\n\ninterface InactiveProps {\n connectionStatus: \"Inactive\";\n identityProvider: IdentityProvider;\n expiryDate?: never;\n}\n\ninterface ActiveProps {\n connectionStatus: \"Active\";\n identityProvider: IdentityProvider;\n expiryDate?: never;\n}\n\ninterface RequiresActionProps {\n connectionStatus: \"Expired\" | \"Expiring\";\n identityProvider: IdentityProvider;\n expiryDate: Date | null;\n}\n\nexport type AdminPortalSsoConnectionStatusProps =\n | NotConfiguredProps\n | InactiveProps\n | ActiveProps\n | RequiresActionProps;\n\ntype AdminPortalSsoConnectionProps = WidgetRootDomProps &\n AdminPortalSsoConnectionStatusProps & {\n currentDate: Date | null;\n lastSession: Date | null;\n adminPortalOpenButton: React.ReactNode;\n };\n\ninterface AdminPortalSsoConnectionContextValue {\n connectionStatus: AdminPortalSsoConnectionStatusProps[\"connectionStatus\"];\n}\n\nconst AdminPortalSsoConnectionContext =\n React.createContext<AdminPortalSsoConnectionContextValue | null>(null);\nAdminPortalSsoConnectionContext.displayName = \"AdminPortalSsoConnectionContext\";\n\nfunction useAdminPortalSsoConnectionContext() {\n const context = React.useContext(AdminPortalSsoConnectionContext);\n if (!context) {\n throw new Error(\n \"useAdminPortalSsoConnectionContext must be used within a AdminPortalSsoConnectionContext provider\",\n );\n }\n return context;\n}\n\nconst AdminPortalSsoConnection: React.FC<AdminPortalSsoConnectionProps> = ({\n currentDate,\n connectionStatus,\n identityProvider,\n expiryDate,\n lastSession,\n adminPortalOpenButton,\n ...domProps\n}) => {\n return (\n <CardList.Root size=\"2\" {...getWidgetRootDomProps(\"resolved\", domProps)}>\n <AdminPortalSsoConnectionContext.Provider value={{ connectionStatus }}>\n <CardList.Item>\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n {(() => {\n if (connectionStatus === \"NotConfigured\") {\n return (\n <>\n <Text size=\"2\" color=\"gray\">\n You haven’t set up Single Sign-On yet.\n </Text>\n {adminPortalOpenButton}\n </>\n );\n }\n\n return (\n <>\n <SessionInfo\n connectionStatus={connectionStatus}\n identityProvider={identityProvider}\n lastSession={lastSession}\n currentDate={currentDate}\n />\n <Flex gap=\"5\" align=\"center\">\n <SsoStatus status={connectionStatus} />\n {adminPortalOpenButton}\n </Flex>\n </>\n );\n })()}\n </Flex>\n </CardList.Item>\n {connectionStatus === \"Expired\" && (\n <CardList.Item>\n <Flex align=\"start\" gap=\"2\">\n <Box asChild mt=\"2px\" flexShrink=\"0\">\n <InfoCircledIcon color=\"gray\" />\n </Box>\n {(() => {\n if (connectionStatus === \"Expired\") {\n return (\n <Text size=\"2\" color=\"gray\">\n {(() => {\n if (!expiryDate) {\n return \"The SAML response signing certificate has expired\";\n }\n\n return (\n <>\n The SAML response signing certificate expired on{\" \"}\n <Text weight=\"bold\" as=\"span\">\n {expiryDate?.toLocaleString(\"en-US\", {\n month: \"long\",\n day: \"numeric\",\n year: \"numeric\",\n })}\n </Text>\n </>\n );\n })()}\n . Users won’t be able to sign-in to the application until\n the certificate is renewed.\n </Text>\n );\n }\n\n if (connectionStatus === \"Expiring\") {\n return (\n <Text size=\"2\" color=\"gray\">\n {(() => {\n if (!expiryDate) {\n return \"The SAML response signing certificate is expiring soon\";\n }\n\n return (\n <>\n The SAML response signing certificate will expire on{\" \"}\n <Text weight=\"bold\" as=\"span\">\n {expiryDate?.toLocaleString(\"en-US\", {\n month: \"long\",\n day: \"numeric\",\n year: \"numeric\",\n })}\n </Text>\n </>\n );\n })()}\n . When expired, users won’t be able to sign-in.\n </Text>\n );\n }\n })()}\n </Flex>\n </CardList.Item>\n )}\n </AdminPortalSsoConnectionContext.Provider>\n </CardList.Root>\n );\n};\n\nfunction SsoStatus({\n status,\n}: {\n status: AdminPortalSsoConnectionStatusProps[\"connectionStatus\"];\n}) {\n if (status === \"NotConfigured\") {\n return null;\n }\n\n if (status === \"Inactive\") {\n return <Status state=\"waiting\">Setup in progress</Status>;\n }\n\n if (status === \"Expired\") {\n return <Status state=\"error\">Requires action</Status>;\n }\n\n if (status === \"Active\" || status === \"Expiring\") {\n return <Status state=\"success\">Connected</Status>;\n }\n\n return unreachable(status);\n}\n\nfunction SessionInfo({\n currentDate,\n identityProvider,\n lastSession,\n connectionStatus,\n}: {\n identityProvider: IdentityProvider;\n lastSession: Date | null;\n currentDate: Date | null;\n connectionStatus: AdminPortalSsoConnectionStatusProps[\"connectionStatus\"];\n}) {\n const relativeTimeString = React.useMemo(() => {\n if (\n !lastSession ||\n !currentDate ||\n connectionStatus === \"NotConfigured\" ||\n connectionStatus === \"Inactive\"\n ) {\n return null;\n }\n\n return getRelativeTimeString(currentDate, lastSession);\n }, [lastSession, currentDate, connectionStatus]);\n\n return (\n <Flex gap=\"4\" align=\"center\">\n <IconPanel color=\"panel\">\n <ProviderIcon provider={identityProvider} size=\"2\" />\n </IconPanel>\n {lastSession ? (\n <Flex direction=\"column\">\n <Text size=\"2\" weight=\"bold\">\n {getIdentityProviderName(identityProvider)}\n </Text>\n {relativeTimeString ? (\n <Text color=\"gray\" size=\"2\">\n Last session {relativeTimeString}\n </Text>\n ) : null}\n </Flex>\n ) : (\n <Text size=\"2\" weight=\"bold\">\n {getIdentityProviderName(identityProvider)}\n </Text>\n )}\n </Flex>\n );\n}\n\nfunction AdminPortalOpenButton({\n isPending,\n href,\n initConfig,\n}: {\n isPending: boolean;\n href: string | null;\n initConfig: () => void;\n}) {\n const { connectionStatus } = useAdminPortalSsoConnectionContext();\n const label = (() => {\n switch (connectionStatus) {\n case \"NotConfigured\":\n return \"Set up SSO\";\n case \"Inactive\":\n return \"Continue setup\";\n case \"Active\":\n case \"Expiring\":\n case \"Expired\":\n return \"Manage\";\n default:\n return unreachable(connectionStatus);\n }\n })();\n\n if (href) {\n return (\n <Button variant=\"outline\" color=\"gray\" asChild>\n <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n {label} <ExternalLinkIcon />\n </a>\n </Button>\n );\n }\n\n return (\n <Button\n variant=\"outline\"\n color=\"gray\"\n loading={isPending}\n disabled={isPending}\n onClick={initConfig}\n >\n {label} <ExternalLinkIcon />\n </Button>\n );\n}\n\ninterface AdminPortalSsoConnectionLoadingProps extends WidgetRootDomProps {}\n\nconst AdminPortalSsoConnectionLoading: React.FC<\n AdminPortalSsoConnectionLoadingProps\n> = (props) => {\n return (\n <Card size=\"2\" {...getWidgetRootDomProps(\"loading\", props)}>\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n <Flex gap=\"4\" align=\"center\">\n <Skeleton>\n <IconPanel color=\"panel\">\n <ProviderIcon provider=\"okta\" size=\"2\" />\n </IconPanel>\n </Skeleton>\n <Flex direction=\"column\" gap=\"1\" my=\"-4px\">\n <Skeleton>\n <Text size=\"1\">Okta</Text>\n </Skeleton>\n <Skeleton>\n <Text size=\"1\">Last session 10 minutes ago</Text>\n </Skeleton>\n </Flex>\n </Flex>\n <Flex gap=\"5\" align=\"center\">\n <Skeleton>\n <Status state=\"error\">Requires action</Status>\n </Skeleton>\n <Skeleton>\n <Button variant=\"outline\" color=\"gray\">\n Manage <ExternalLinkIcon />\n </Button>\n </Skeleton>\n </Flex>\n </Flex>\n </Card>\n );\n};\n\ninterface AdminPortalSsoConnectionErrorProps extends WidgetRootDomProps {\n error: unknown;\n}\n\nconst AdminPortalSsoConnectionError: React.FC<\n AdminPortalSsoConnectionErrorProps\n> = ({ error, ...domProps }) => {\n React.useEffect(() => {\n console.error(error);\n }, [error]);\n\n const { heading, message } = getErrorMessage(error);\n\n return (\n <Card size=\"2\" {...getWidgetRootDomProps(\"error\", domProps)}>\n <Flex direction=\"row\" justify=\"between\" align=\"center\" gap=\"2\">\n <Flex gap=\"4\" align=\"center\">\n <Flex\n align=\"center\"\n justify=\"center\"\n width=\"24px\"\n height=\"24px\"\n style={{\n borderRadius: \"9999px\",\n backgroundColor: \"var(--red-a4)\",\n color: \"var(--red-a11)\",\n flexShrink: 0,\n }}\n >\n <Cross2Icon width=\"18px\" height=\"18px\" />\n </Flex>\n <Flex direction=\"column\">\n <Text size=\"2\" weight=\"bold\">\n {heading}\n </Text>\n <Text size=\"2\" color=\"gray\">\n {message}\n </Text>\n </Flex>\n </Flex>\n </Flex>\n </Card>\n );\n};\n\nfunction getRelativeTimeString(\n currentDate: Date | null,\n lastSession: Date | null,\n) {\n if (!currentDate || !lastSession) {\n return null;\n }\n\n const rtf = new Intl.RelativeTimeFormat(\"en\", { numeric: \"auto\" });\n const diff = lastSession.getTime() - currentDate.getTime();\n\n const diffSeconds = Math.round(diff / 1000);\n const diffMinutes = Math.round(diffSeconds / 60);\n const diffHours = Math.round(diffMinutes / 60);\n const diffDays = Math.round(diffHours / 24);\n const diffMonths = Math.round(diffDays / 30);\n const diffYears = Math.round(diffMonths / 12);\n\n if (Math.abs(diffSeconds) < 60) {\n return \"now\";\n }\n\n if (Math.abs(diffMinutes) < 60) {\n return rtf.format(diffMinutes, \"minute\");\n }\n\n if (Math.abs(diffHours) < 24) {\n return rtf.format(diffHours, \"hour\");\n }\n\n if (Math.abs(diffDays) < 30) {\n return rtf.format(diffDays, \"day\");\n }\n\n if (Math.abs(diffMonths) < 12) {\n return rtf.format(diffMonths, \"month\");\n }\n\n return rtf.format(diffYears, \"year\");\n}\n\nfunction getWidgetRootDomProps(\n state: WidgetRootState,\n domProps: WidgetRootDomProps,\n) {\n return getDomProps({\n ...domProps,\n isWidgetRoot: true,\n widgetId: \"admin-portal-sso-connection\",\n widgetState: state,\n });\n}\n\nexport type {\n AdminPortalSsoConnectionProps,\n AdminPortalSsoConnectionLoadingProps,\n AdminPortalSsoConnectionErrorProps,\n};\nexport {\n AdminPortalSsoConnection,\n AdminPortalSsoConnectionLoading,\n AdminPortalSsoConnectionError,\n /** @internal */\n AdminPortalOpenButton,\n};\n"],"mappings":";AAkGkB,mBACE,KADF;AAhGlB,YAAY,WAAW;AACvB,SAAS,KAAK,QAAQ,MAAM,MAAM,YAA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,IAAI;AAC9B,WAAO,IAAI,OAAO,aAAa,QAAQ;AAAA,EACzC;AAEA,MAAI,KAAK,IAAI,SAAS,IAAI,IAAI;AAC5B,WAAO,IAAI,OAAO,WAAW,MAAM;AAAA,EACrC;AAEA,MAAI,KAAK,IAAI,QAAQ,IAAI,IAAI;AAC3B,WAAO,IAAI,OAAO,UAAU,KAAK;AAAA,EACnC;AAEA,MAAI,KAAK,IAAI,UAAU,IAAI,IAAI;AAC7B,WAAO,IAAI,OAAO,YAAY,OAAO;AAAA,EACvC;AAEA,SAAO,IAAI,OAAO,WAAW,MAAM;AACrC;AAEA,SAAS,sBACP,OACA,UACA;AACA,SAAO,YAAY;AAAA,IACjB,GAAG;AAAA,IACH,cAAc;AAAA,IACd,UAAU;AAAA,IACV,aAAa;AAAA,EACf,CAAC;AACH;","names":[]}
@@ -1,11 +1,19 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { Flex } from '@radix-ui/themes';
1
+ import { WidgetRootDomProps } from '../utils.js';
2
+ import { ListOrganizationApiKeysResponse } from '../../api/endpoint.js';
3
+ import '@tanstack/react-query';
4
+ import '../../api/widgets-api-client.js';
3
5
 
4
- declare function ApiKeysError({ error }: {
6
+ interface ApiKeysProps extends WidgetRootDomProps {
7
+ apiKeys: ListOrganizationApiKeysResponse;
8
+ searchQuery: string | null;
9
+ }
10
+ declare const ApiKeys: React.FC<ApiKeysProps>;
11
+ interface ApiKeysLoadingProps extends WidgetRootDomProps {
12
+ }
13
+ declare const ApiKeysLoading: React.FC<ApiKeysLoadingProps>;
14
+ interface ApiKeysErrorProps extends WidgetRootDomProps {
5
15
  error: unknown;
6
- }): react_jsx_runtime.JSX.Element;
7
- declare function ApiKeysEmptyState(): react_jsx_runtime.JSX.Element;
8
- declare function ApiKeysLoading(): react_jsx_runtime.JSX.Element;
9
- declare function ApiKeysRoot({ className, children, ...props }: React.ComponentProps<typeof Flex>): react_jsx_runtime.JSX.Element;
16
+ }
17
+ declare const ApiKeysError: React.FC<ApiKeysErrorProps>;
10
18
 
11
- export { ApiKeysEmptyState, ApiKeysError, ApiKeysLoading, ApiKeysRoot };
19
+ export { ApiKeys, ApiKeysError, type ApiKeysErrorProps, ApiKeysLoading, type ApiKeysLoadingProps, type ApiKeysProps };
@@ -1,4 +1,4 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Button, Flex, Skeleton } from "@radix-ui/themes";
3
3
  import { TextField, TextFieldSlot } from "../elements.js";
4
4
  import { GenericError } from "../generic-error.js";
@@ -6,69 +6,84 @@ import { EmptyState } from "../empty-state.js";
6
6
  import { MagnifyingGlassIcon } from "@radix-ui/react-icons";
7
7
  import { SkeletonTable } from "./skeleton-table.js";
8
8
  import { CreateApiKeyButton } from "./create-api-key.js";
9
- import clsx from "clsx";
10
- function ApiKeysError({ error }) {
11
- return /* @__PURE__ */ jsx(GenericError, { error });
12
- }
13
- function ApiKeysEmptyState() {
14
- return /* @__PURE__ */ jsx(
15
- EmptyState,
9
+ import { getDomProps } from "../utils.js";
10
+ import { ApiKeysSearchProvider } from "./api-keys-search-provider.js";
11
+ import { ApiKeysTable } from "./api-keys-table.js";
12
+ const ApiKeys = ({
13
+ apiKeys,
14
+ searchQuery,
15
+ ...domProps
16
+ }) => {
17
+ return apiKeys.data.length === 0 && !searchQuery ? /* @__PURE__ */ jsx(ApiKeysEmptyState, { ...getWidgetRootDomProps("resolved", domProps) }) : /* @__PURE__ */ jsx(ApiKeysSearchProvider, { children: /* @__PURE__ */ jsx(
18
+ ApiKeysTable,
16
19
  {
17
- heading: "No API keys yet",
18
- message: "Generate an API key to authenticate and interact with our API.",
19
- action: /* @__PURE__ */ jsx(CreateApiKeyButton, {})
20
+ apiKeys,
21
+ ...getWidgetRootDomProps("resolved", domProps)
20
22
  }
21
- );
22
- }
23
- function ApiKeysLoading() {
24
- return /* @__PURE__ */ jsxs(Fragment, { children: [
25
- /* @__PURE__ */ jsxs(Flex, { justify: "between", align: "center", children: [
26
- /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(
27
- TextField,
28
- {
29
- name: "api-keys-widget-search",
30
- style: { width: "390px" },
31
- placeholder: "Search by name",
32
- children: /* @__PURE__ */ jsx(TextFieldSlot, { side: "left", children: /* @__PURE__ */ jsx(MagnifyingGlassIcon, { "aria-hidden": "true", height: "16", width: "16" }) })
33
- }
34
- ) }),
35
- /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(Button, { children: "Create API key" }) })
36
- ] }),
37
- /* @__PURE__ */ jsx(
38
- SkeletonTable,
39
- {
40
- numRows: 5,
41
- columns: [
42
- { children: "Name", width: "25%" },
43
- { children: "Secret key", width: "25%" },
44
- { children: "Last used", width: "25%" },
45
- { children: "Created", width: "25%" }
46
- ]
47
- }
48
- )
49
- ] });
50
- }
51
- function ApiKeysRoot({
52
- className,
53
- children,
54
- ...props
55
- }) {
56
- return /* @__PURE__ */ jsx(
23
+ ) });
24
+ };
25
+ const ApiKeysLoading = (props) => {
26
+ return /* @__PURE__ */ jsxs(
57
27
  Flex,
58
28
  {
59
- className: clsx("woswidgets-widget", className),
60
- "data-woswidgets-widget-id": "api-keys",
61
29
  direction: "column",
30
+ align: "stretch",
62
31
  gap: "3",
63
- ...props,
64
- children
32
+ ...getWidgetRootDomProps("loading", props),
33
+ children: [
34
+ /* @__PURE__ */ jsxs(Flex, { justify: "between", align: "center", children: [
35
+ /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(
36
+ TextField,
37
+ {
38
+ name: "api-keys-widget-search",
39
+ style: { width: "390px" },
40
+ placeholder: "Search by name",
41
+ children: /* @__PURE__ */ jsx(TextFieldSlot, { side: "left", children: /* @__PURE__ */ jsx(MagnifyingGlassIcon, { "aria-hidden": "true", height: "16", width: "16" }) })
42
+ }
43
+ ) }),
44
+ /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(Button, { children: "Create API key" }) })
45
+ ] }),
46
+ /* @__PURE__ */ jsx(
47
+ SkeletonTable,
48
+ {
49
+ numRows: 5,
50
+ columns: [
51
+ { children: "Name", width: "25%" },
52
+ { children: "Secret key", width: "25%" },
53
+ { children: "Last used", width: "25%" },
54
+ { children: "Created", width: "25%" }
55
+ ]
56
+ }
57
+ )
58
+ ]
65
59
  }
66
60
  );
61
+ };
62
+ const ApiKeysError = ({ error, ...domProps }) => {
63
+ return /* @__PURE__ */ jsx(GenericError, { error, ...getWidgetRootDomProps("error", domProps) });
64
+ };
65
+ function ApiKeysEmptyState(props) {
66
+ return /* @__PURE__ */ jsx(
67
+ EmptyState,
68
+ {
69
+ heading: "No API keys yet",
70
+ message: "Generate an API key to authenticate and interact with our API.",
71
+ action: /* @__PURE__ */ jsx(CreateApiKeyButton, {}),
72
+ ...props
73
+ }
74
+ );
75
+ }
76
+ function getWidgetRootDomProps(state, domProps) {
77
+ return getDomProps({
78
+ ...domProps,
79
+ isWidgetRoot: true,
80
+ widgetId: "api-keys",
81
+ widgetState: state
82
+ });
67
83
  }
68
84
  export {
69
- ApiKeysEmptyState,
85
+ ApiKeys,
70
86
  ApiKeysError,
71
- ApiKeysLoading,
72
- ApiKeysRoot
87
+ ApiKeysLoading
73
88
  };
74
89
  //# sourceMappingURL=api-keys.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lib/api-keys/api-keys.tsx"],"sourcesContent":["import { Button, Flex, Skeleton } from \"@radix-ui/themes\";\nimport { TextField, TextFieldSlot } from \"../elements.js\";\nimport { GenericError } from \"../generic-error.js\";\nimport { EmptyState } from \"../empty-state.js\";\nimport { MagnifyingGlassIcon } from \"@radix-ui/react-icons\";\nimport { SkeletonTable } from \"./skeleton-table.js\";\nimport { CreateApiKeyButton } from \"./create-api-key.js\";\nimport clsx from \"clsx\";\n\nexport function ApiKeysError({ error }: { error: unknown }) {\n return <GenericError error={error} />;\n}\n\nexport function ApiKeysEmptyState() {\n return (\n <EmptyState\n heading=\"No API keys yet\"\n message=\"Generate an API key to authenticate and interact with our API.\"\n action={<CreateApiKeyButton />}\n />\n );\n}\n\nexport function ApiKeysLoading() {\n return (\n <>\n <Flex justify=\"between\" align=\"center\">\n <Skeleton>\n <TextField\n name=\"api-keys-widget-search\"\n style={{ width: \"390px\" }}\n placeholder=\"Search by name\"\n >\n <TextFieldSlot side=\"left\">\n <MagnifyingGlassIcon aria-hidden=\"true\" height=\"16\" width=\"16\" />\n </TextFieldSlot>\n </TextField>\n </Skeleton>\n <Skeleton>\n <Button>Create API key</Button>\n </Skeleton>\n </Flex>\n <SkeletonTable\n numRows={5}\n columns={[\n { children: \"Name\", width: \"25%\" },\n { children: \"Secret key\", width: \"25%\" },\n { children: \"Last used\", width: \"25%\" },\n { children: \"Created\", width: \"25%\" },\n ]}\n />\n </>\n );\n}\n\nexport function ApiKeysRoot({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof Flex>) {\n return (\n <Flex\n className={clsx(\"woswidgets-widget\", className)}\n data-woswidgets-widget-id=\"api-keys\"\n direction=\"column\"\n gap=\"3\"\n {...props}\n >\n {children}\n </Flex>\n );\n}\n"],"mappings":"AAUS,SAeL,UAfK,KAgBH,YAhBG;AAVT,SAAS,QAAQ,MAAM,gBAAgB;AACvC,SAAS,WAAW,qBAAqB;AACzC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AACpC,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AACnC,OAAO,UAAU;AAEV,SAAS,aAAa,EAAE,MAAM,GAAuB;AAC1D,SAAO,oBAAC,gBAAa,OAAc;AACrC;AAEO,SAAS,oBAAoB;AAClC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,SAAQ;AAAA,MACR,QAAQ,oBAAC,sBAAmB;AAAA;AAAA,EAC9B;AAEJ;AAEO,SAAS,iBAAiB;AAC/B,SACE,iCACE;AAAA,yBAAC,QAAK,SAAQ,WAAU,OAAM,UAC5B;AAAA,0BAAC,YACC;AAAA,QAAC;AAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAO,EAAE,OAAO,QAAQ;AAAA,UACxB,aAAY;AAAA,UAEZ,8BAAC,iBAAc,MAAK,QAClB,8BAAC,uBAAoB,eAAY,QAAO,QAAO,MAAK,OAAM,MAAK,GACjE;AAAA;AAAA,MACF,GACF;AAAA,MACA,oBAAC,YACC,8BAAC,UAAO,4BAAc,GACxB;AAAA,OACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT,SAAS;AAAA,UACP,EAAE,UAAU,QAAQ,OAAO,MAAM;AAAA,UACjC,EAAE,UAAU,cAAc,OAAO,MAAM;AAAA,UACvC,EAAE,UAAU,aAAa,OAAO,MAAM;AAAA,UACtC,EAAE,UAAU,WAAW,OAAO,MAAM;AAAA,QACtC;AAAA;AAAA,IACF;AAAA,KACF;AAEJ;AAEO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAsC;AACpC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,KAAK,qBAAqB,SAAS;AAAA,MAC9C,6BAA0B;AAAA,MAC1B,WAAU;AAAA,MACV,KAAI;AAAA,MACH,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/lib/api-keys/api-keys.tsx"],"sourcesContent":["import { Button, Flex, Skeleton } from \"@radix-ui/themes\";\nimport { TextField, TextFieldSlot } from \"../elements.js\";\nimport { GenericError } from \"../generic-error.js\";\nimport { EmptyState } from \"../empty-state.js\";\nimport { MagnifyingGlassIcon } from \"@radix-ui/react-icons\";\nimport { SkeletonTable } from \"./skeleton-table.js\";\nimport { CreateApiKeyButton } from \"./create-api-key.js\";\nimport { getDomProps, WidgetRootDomProps, WidgetRootState } from \"../utils.js\";\nimport { ListOrganizationApiKeysResponse } from \"../../api/endpoint.js\";\nimport { ApiKeysSearchProvider } from \"./api-keys-search-provider.js\";\nimport { ApiKeysTable } from \"./api-keys-table.js\";\n\ninterface ApiKeysProps extends WidgetRootDomProps {\n apiKeys: ListOrganizationApiKeysResponse;\n searchQuery: string | null;\n}\n\nconst ApiKeys: React.FC<ApiKeysProps> = ({\n apiKeys,\n searchQuery,\n ...domProps\n}) => {\n return apiKeys.data.length === 0 && !searchQuery ? (\n <ApiKeysEmptyState {...getWidgetRootDomProps(\"resolved\", domProps)} />\n ) : (\n <ApiKeysSearchProvider>\n <ApiKeysTable\n apiKeys={apiKeys}\n {...getWidgetRootDomProps(\"resolved\", domProps)}\n />\n </ApiKeysSearchProvider>\n );\n};\n\ninterface ApiKeysLoadingProps extends WidgetRootDomProps {}\n\nconst ApiKeysLoading: React.FC<ApiKeysLoadingProps> = (props) => {\n return (\n <Flex\n direction=\"column\"\n align=\"stretch\"\n gap=\"3\"\n {...getWidgetRootDomProps(\"loading\", props)}\n >\n <Flex justify=\"between\" align=\"center\">\n <Skeleton>\n <TextField\n name=\"api-keys-widget-search\"\n style={{ width: \"390px\" }}\n placeholder=\"Search by name\"\n >\n <TextFieldSlot side=\"left\">\n <MagnifyingGlassIcon aria-hidden=\"true\" height=\"16\" width=\"16\" />\n </TextFieldSlot>\n </TextField>\n </Skeleton>\n <Skeleton>\n <Button>Create API key</Button>\n </Skeleton>\n </Flex>\n <SkeletonTable\n numRows={5}\n columns={[\n { children: \"Name\", width: \"25%\" },\n { children: \"Secret key\", width: \"25%\" },\n { children: \"Last used\", width: \"25%\" },\n { children: \"Created\", width: \"25%\" },\n ]}\n />\n </Flex>\n );\n};\n\ninterface ApiKeysErrorProps extends WidgetRootDomProps {\n error: unknown;\n}\n\nconst ApiKeysError: React.FC<ApiKeysErrorProps> = ({ error, ...domProps }) => {\n return (\n <GenericError error={error} {...getWidgetRootDomProps(\"error\", domProps)} />\n );\n};\n\nfunction ApiKeysEmptyState(props: WidgetRootDomProps) {\n return (\n <EmptyState\n heading=\"No API keys yet\"\n message=\"Generate an API key to authenticate and interact with our API.\"\n action={<CreateApiKeyButton />}\n {...props}\n />\n );\n}\n\nfunction getWidgetRootDomProps(\n state: WidgetRootState,\n domProps: WidgetRootDomProps,\n) {\n return getDomProps({\n ...domProps,\n isWidgetRoot: true,\n widgetId: \"api-keys\",\n widgetState: state,\n });\n}\n\nexport type { ApiKeysProps, ApiKeysLoadingProps, ApiKeysErrorProps };\nexport { ApiKeys, ApiKeysLoading, ApiKeysError };\n"],"mappings":"AAuBI,cAqBE,YArBF;AAvBJ,SAAS,QAAQ,MAAM,gBAAgB;AACvC,SAAS,WAAW,qBAAqB;AACzC,SAAS,oBAAoB;AAC7B,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B;AACpC,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AACnC,SAAS,mBAAwD;AAEjE,SAAS,6BAA6B;AACtC,SAAS,oBAAoB;AAO7B,MAAM,UAAkC,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,SAAO,QAAQ,KAAK,WAAW,KAAK,CAAC,cACnC,oBAAC,qBAAmB,GAAG,sBAAsB,YAAY,QAAQ,GAAG,IAEpE,oBAAC,yBACC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACC,GAAG,sBAAsB,YAAY,QAAQ;AAAA;AAAA,EAChD,GACF;AAEJ;AAIA,MAAM,iBAAgD,CAAC,UAAU;AAC/D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAM;AAAA,MACN,KAAI;AAAA,MACH,GAAG,sBAAsB,WAAW,KAAK;AAAA,MAE1C;AAAA,6BAAC,QAAK,SAAQ,WAAU,OAAM,UAC5B;AAAA,8BAAC,YACC;AAAA,YAAC;AAAA;AAAA,cACC,MAAK;AAAA,cACL,OAAO,EAAE,OAAO,QAAQ;AAAA,cACxB,aAAY;AAAA,cAEZ,8BAAC,iBAAc,MAAK,QAClB,8BAAC,uBAAoB,eAAY,QAAO,QAAO,MAAK,OAAM,MAAK,GACjE;AAAA;AAAA,UACF,GACF;AAAA,UACA,oBAAC,YACC,8BAAC,UAAO,4BAAc,GACxB;AAAA,WACF;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,SAAS;AAAA,YACT,SAAS;AAAA,cACP,EAAE,UAAU,QAAQ,OAAO,MAAM;AAAA,cACjC,EAAE,UAAU,cAAc,OAAO,MAAM;AAAA,cACvC,EAAE,UAAU,aAAa,OAAO,MAAM;AAAA,cACtC,EAAE,UAAU,WAAW,OAAO,MAAM;AAAA,YACtC;AAAA;AAAA,QACF;AAAA;AAAA;AAAA,EACF;AAEJ;AAMA,MAAM,eAA4C,CAAC,EAAE,OAAO,GAAG,SAAS,MAAM;AAC5E,SACE,oBAAC,gBAAa,OAAe,GAAG,sBAAsB,SAAS,QAAQ,GAAG;AAE9E;AAEA,SAAS,kBAAkB,OAA2B;AACpD,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,SAAQ;AAAA,MACR,QAAQ,oBAAC,sBAAmB;AAAA,MAC3B,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,SAAS,sBACP,OACA,UACA;AACA,SAAO,YAAY;AAAA,IACjB,GAAG;AAAA,IACH,cAAc;AAAA,IACd,UAAU;AAAA,IACV,aAAa;AAAA,EACf,CAAC;AACH;","names":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/card-list.tsx"],"sourcesContent":["import { Box, Card, CardProps, Inset } from \"@radix-ui/themes\";\n\nexport function Root({ children, ...props }: CardProps) {\n return (\n <Card size=\"2\" {...props} className=\"woswidgets-card-list\">\n <Inset side=\"all\" clip=\"padding-box\">\n {children}\n </Inset>\n </Card>\n );\n}\n\nexport function Item({ children }: { children: React.ReactNode }) {\n return (\n <Inset\n side=\"x\"\n px=\"current\"\n className=\"woswidgets-card-list-item\"\n clip=\"padding-box\"\n >\n <Box px=\"4\" py=\"4\">\n {children}\n </Box>\n </Inset>\n );\n}\n"],"mappings":"AAKM;AALN,SAAS,KAAK,MAAiB,aAAa;AAErC,SAAS,KAAK,EAAE,UAAU,GAAG,MAAM,GAAc;AACtD,SACE,oBAAC,QAAK,MAAK,KAAK,GAAG,OAAO,WAAU,wBAClC,8BAAC,SAAM,MAAK,OAAM,MAAK,eACpB,UACH,GACF;AAEJ;AAEO,SAAS,KAAK,EAAE,SAAS,GAAkC;AAChE,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,IAAG;AAAA,MACH,WAAU;AAAA,MACV,MAAK;AAAA,MAEL,8BAAC,OAAI,IAAG,KAAI,IAAG,KACZ,UACH;AAAA;AAAA,EACF;AAEJ;","names":[]}
@@ -1,5 +1,6 @@
1
1
  declare const USER_ROW_LIMIT = 10;
2
2
  declare const WIDGETS_API_VERSION = "1";
3
3
  declare const WIDGETS_CLASS_NAMESPACE = "woswidgets";
4
+ declare const WIDGETS_DATA_ATTRIBUTE_NAMESPACE = "woswidgets";
4
5
 
5
- export { USER_ROW_LIMIT, WIDGETS_API_VERSION, WIDGETS_CLASS_NAMESPACE };
6
+ export { USER_ROW_LIMIT, WIDGETS_API_VERSION, WIDGETS_CLASS_NAMESPACE, WIDGETS_DATA_ATTRIBUTE_NAMESPACE };
@@ -1,9 +1,11 @@
1
1
  const USER_ROW_LIMIT = 10;
2
2
  const WIDGETS_API_VERSION = "1";
3
3
  const WIDGETS_CLASS_NAMESPACE = "woswidgets";
4
+ const WIDGETS_DATA_ATTRIBUTE_NAMESPACE = "woswidgets";
4
5
  export {
5
6
  USER_ROW_LIMIT,
6
7
  WIDGETS_API_VERSION,
7
- WIDGETS_CLASS_NAMESPACE
8
+ WIDGETS_CLASS_NAMESPACE,
9
+ WIDGETS_DATA_ATTRIBUTE_NAMESPACE
8
10
  };
9
11
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lib/constants.ts"],"sourcesContent":["export const USER_ROW_LIMIT = 10;\nexport const WIDGETS_API_VERSION = \"1\";\nexport const WIDGETS_CLASS_NAMESPACE = \"woswidgets\";\n"],"mappings":"AAAO,MAAM,iBAAiB;AACvB,MAAM,sBAAsB;AAC5B,MAAM,0BAA0B;","names":[]}
1
+ {"version":3,"sources":["../../../src/lib/constants.ts"],"sourcesContent":["export const USER_ROW_LIMIT = 10;\nexport const WIDGETS_API_VERSION = \"1\";\nexport const WIDGETS_CLASS_NAMESPACE = \"woswidgets\";\nexport const WIDGETS_DATA_ATTRIBUTE_NAMESPACE = \"woswidgets\";\n"],"mappings":"AAAO,MAAM,iBAAiB;AACvB,MAAM,sBAAsB;AAC5B,MAAM,0BAA0B;AAChC,MAAM,mCAAmC;","names":[]}