zudoku 0.0.0-fix-firebase-export.f8270825 → 0.0.0-monetization-standalone.zd1543a39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/main.d.ts +6 -6
- package/dist/cli/common/version-check.js +12 -3
- package/dist/cli/common/version-check.js.map +1 -1
- package/dist/config/create-plugin.d.ts +2 -0
- package/dist/config/create-plugin.js +53 -0
- package/dist/config/create-plugin.js.map +1 -0
- package/dist/config/loader.js +3 -1
- package/dist/config/loader.js.map +1 -1
- package/dist/config/validators/InputNavigationSchema.d.ts +77 -75
- package/dist/config/validators/InputNavigationSchema.js +1 -0
- package/dist/config/validators/InputNavigationSchema.js.map +1 -1
- package/dist/config/validators/NavigationSchema.js +6 -1
- package/dist/config/validators/NavigationSchema.js.map +1 -1
- package/dist/config/validators/ProtectedRoutesSchema.d.ts +1 -1
- package/dist/config/validators/validate.d.ts +61 -13
- package/dist/config/validators/validate.js +9 -4
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/flat-config.d.ts +29 -26
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/auth/issuer.js +1 -1
- package/dist/lib/auth/issuer.js.map +1 -1
- package/dist/lib/authentication/authentication.d.ts +3 -2
- package/dist/lib/authentication/components/CallbackHandler.js +1 -1
- package/dist/lib/authentication/components/CallbackHandler.js.map +1 -1
- package/dist/lib/authentication/components/SignIn.js +4 -2
- package/dist/lib/authentication/components/SignIn.js.map +1 -1
- package/dist/lib/authentication/components/SignUp.js +4 -2
- package/dist/lib/authentication/components/SignUp.js.map +1 -1
- package/dist/lib/authentication/hook.d.ts +2 -0
- package/dist/lib/authentication/hook.js +10 -0
- package/dist/lib/authentication/hook.js.map +1 -1
- package/dist/lib/authentication/providers/auth0.js +11 -7
- package/dist/lib/authentication/providers/auth0.js.map +1 -1
- package/dist/lib/authentication/providers/clerk.js +0 -22
- package/dist/lib/authentication/providers/clerk.js.map +1 -1
- package/dist/lib/authentication/providers/firebase.js +67 -9
- package/dist/lib/authentication/providers/firebase.js.map +1 -1
- package/dist/lib/authentication/providers/supabase.js +6 -15
- package/dist/lib/authentication/providers/supabase.js.map +1 -1
- package/dist/lib/authentication/ui/EmailVerificationUi.d.ts +4 -0
- package/dist/lib/authentication/ui/EmailVerificationUi.js +34 -0
- package/dist/lib/authentication/ui/EmailVerificationUi.js.map +1 -0
- package/dist/lib/authentication/ui/ZudokuAuthUi.d.ts +7 -2
- package/dist/lib/authentication/ui/ZudokuAuthUi.js +43 -11
- package/dist/lib/authentication/ui/ZudokuAuthUi.js.map +1 -1
- package/dist/lib/authentication/utils/relativeRedirectUrl.d.ts +1 -0
- package/dist/lib/authentication/utils/relativeRedirectUrl.js +8 -0
- package/dist/lib/authentication/utils/relativeRedirectUrl.js.map +1 -0
- package/dist/lib/components/Bootstrap.js +1 -2
- package/dist/lib/components/Bootstrap.js.map +1 -1
- package/dist/lib/components/Pagination.js +2 -2
- package/dist/lib/components/Pagination.js.map +1 -1
- package/dist/lib/components/Zudoku.js +2 -5
- package/dist/lib/components/Zudoku.js.map +1 -1
- package/dist/lib/components/context/ZudokuContext.d.ts +2 -4
- package/dist/lib/components/context/ZudokuContext.js +2 -2
- package/dist/lib/components/context/ZudokuContext.js.map +1 -1
- package/dist/lib/components/context/ZudokuProvider.js +1 -1
- package/dist/lib/components/context/ZudokuProvider.js.map +1 -1
- package/dist/lib/components/context/ZudokuReactContext.d.ts +11 -0
- package/dist/lib/components/context/ZudokuReactContext.js +4 -0
- package/dist/lib/components/context/ZudokuReactContext.js.map +1 -0
- package/dist/lib/components/index.d.ts +5 -0
- package/dist/lib/components/index.js +4 -0
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/components/navigation/NavigationItem.js +2 -2
- package/dist/lib/components/navigation/NavigationItem.js.map +1 -1
- package/dist/lib/core/RouteGuard.js +12 -7
- package/dist/lib/core/RouteGuard.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +11 -1
- package/dist/lib/core/plugins.js +1 -0
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/core/react-query.d.ts +1 -0
- package/dist/lib/core/react-query.js +2 -0
- package/dist/lib/core/react-query.js.map +1 -0
- package/dist/lib/core/transform-config.d.ts +2 -0
- package/dist/lib/core/transform-config.js +22 -0
- package/dist/lib/core/transform-config.js.map +1 -0
- package/dist/lib/errors/ErrorAlert.js +1 -2
- package/dist/lib/errors/ErrorAlert.js.map +1 -1
- package/dist/lib/errors/ErrorMessage.d.ts +3 -0
- package/dist/lib/errors/ErrorMessage.js +16 -0
- package/dist/lib/errors/ErrorMessage.js.map +1 -0
- package/dist/lib/hooks/index.d.ts +2 -0
- package/dist/lib/oas/graphql/circular.d.ts +2 -0
- package/dist/lib/oas/graphql/circular.js +32 -10
- package/dist/lib/oas/graphql/circular.js.map +1 -1
- package/dist/lib/oas/graphql/circular.test.d.ts +1 -0
- package/dist/lib/oas/graphql/circular.test.js +152 -0
- package/dist/lib/oas/graphql/circular.test.js.map +1 -0
- package/dist/lib/oas/graphql/index.js +7 -3
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js +9 -172
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
- package/dist/lib/plugins/api-keys/index.d.ts +11 -4
- package/dist/lib/plugins/api-keys/index.js +36 -22
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/settings/ApiKeyItem.d.ts +12 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyItem.js +133 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyItem.js.map +1 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyList.d.ts +4 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyList.js +33 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyList.js.map +1 -0
- package/dist/lib/plugins/api-keys/settings/RevealApiKey.d.ts +6 -0
- package/dist/lib/plugins/api-keys/settings/RevealApiKey.js +39 -0
- package/dist/lib/plugins/api-keys/settings/RevealApiKey.js.map +1 -0
- package/dist/lib/plugins/openapi/OasProvider.js +6 -2
- package/dist/lib/plugins/openapi/OasProvider.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +4 -4
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/ParamInfos.js +1 -0
- package/dist/lib/plugins/openapi/ParamInfos.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +3 -2
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +3 -0
- package/dist/lib/plugins/openapi/schema/SchemaView.js +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/utils.js +11 -3
- package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
- package/dist/lib/plugins/openapi/util/createHttpSnippet.js +24 -1
- package/dist/lib/plugins/openapi/util/createHttpSnippet.js.map +1 -1
- package/dist/lib/plugins/openapi/util/getRoutes.d.ts +3 -0
- package/dist/lib/plugins/openapi/util/getRoutes.js +2 -1
- package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
- package/dist/lib/ui/Button.js +1 -1
- package/dist/lib/ui/Button.js.map +1 -1
- package/dist/lib/ui/Command.d.ts +3 -3
- package/dist/lib/ui/Secret.js +2 -2
- package/dist/lib/ui/Secret.js.map +1 -1
- package/dist/lib/util/invariant.d.ts +1 -1
- package/dist/lib/util/invariant.js +2 -2
- package/dist/lib/util/invariant.js.map +1 -1
- package/dist/vite/api/SchemaManager.d.ts +12 -1
- package/dist/vite/api/SchemaManager.js +31 -14
- package/dist/vite/api/SchemaManager.js.map +1 -1
- package/dist/vite/api/SchemaManager.test.js +44 -0
- package/dist/vite/api/SchemaManager.test.js.map +1 -1
- package/dist/vite/config.js +10 -4
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/error-handler.js +1 -5
- package/dist/vite/error-handler.js.map +1 -1
- package/dist/vite/mdx/remark-link-rewrite.js +1 -1
- package/dist/vite/plugin-api-keys.js +5 -1
- package/dist/vite/plugin-api-keys.js.map +1 -1
- package/dist/vite/plugin-api.js +5 -3
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-markdown-export.js +1 -1
- package/dist/vite/plugin-markdown-export.js.map +1 -1
- package/dist/vite/plugin-theme.js +2 -1
- package/dist/vite/plugin-theme.js.map +1 -1
- package/dist/vite/prerender/utils.js +9 -3
- package/dist/vite/prerender/utils.js.map +1 -1
- package/dist/vite/prerender/worker.js +3 -0
- package/dist/vite/prerender/worker.js.map +1 -1
- package/dist/vite/zuplo.d.ts +13 -0
- package/dist/vite/zuplo.js +15 -0
- package/dist/vite/zuplo.js.map +1 -0
- package/lib/{ActionButton-DUgvSylL.js → ActionButton-B0CXL1Lq.js} +3 -3
- package/lib/{ActionButton-DUgvSylL.js.map → ActionButton-B0CXL1Lq.js.map} +1 -1
- package/lib/{Button-CynVW1JV.js → Button-GUVe7pmt.js} +8 -7
- package/lib/{Button-CynVW1JV.js.map → Button-GUVe7pmt.js.map} +1 -1
- package/lib/{Card-KFniaZn5.js → Card-DCdq37aA.js} +2 -2
- package/lib/{Card-KFniaZn5.js.map → Card-DCdq37aA.js.map} +1 -1
- package/lib/{ClaudeLogo-B4Xxt-x_.js → ClaudeLogo-CUaQXKLK.js} +22 -22
- package/lib/ClaudeLogo-CUaQXKLK.js.map +1 -0
- package/lib/{Command-BpT1iBE6.js → Command-N6VujV30.js} +3 -3
- package/lib/{Command-BpT1iBE6.js.map → Command-N6VujV30.js.map} +1 -1
- package/lib/{Dialog-BQciPiHN.js → Dialog-hlvmmQ_c.js} +2 -2
- package/lib/{Dialog-BQciPiHN.js.map → Dialog-hlvmmQ_c.js.map} +1 -1
- package/lib/{Drawer-Ci7XwhqT.js → Drawer-Ch7927PF.js} +7 -7
- package/lib/{Drawer-Ci7XwhqT.js.map → Drawer-Ch7927PF.js.map} +1 -1
- package/lib/{DropdownMenu-C8SX_-S_.js → DropdownMenu-DN0jNrjj.js} +2 -2
- package/lib/{DropdownMenu-C8SX_-S_.js.map → DropdownMenu-DN0jNrjj.js.map} +1 -1
- package/lib/Frame-DKlOmSkU.js +205 -0
- package/lib/Frame-DKlOmSkU.js.map +1 -0
- package/lib/HydrationBoundary-CNF2ZV3E.js +601 -0
- package/lib/HydrationBoundary-CNF2ZV3E.js.map +1 -0
- package/lib/{IndexingDialog-B5zCiUKr.js → IndexingDialog-D0YdGfbn.js} +3 -3
- package/lib/{IndexingDialog-B5zCiUKr.js.map → IndexingDialog-D0YdGfbn.js.map} +1 -1
- package/lib/Input-Cx-GeKoF.js +22 -0
- package/lib/Input-Cx-GeKoF.js.map +1 -0
- package/lib/{MdxPage-BagO2c-n.js → MdxPage-BiAVpP8K.js} +11 -11
- package/lib/{MdxPage-BagO2c-n.js.map → MdxPage-BiAVpP8K.js.map} +1 -1
- package/lib/{Mermaid-D_VSX7_Q.js → Mermaid-DEztDKFw.js} +4 -4
- package/lib/{Mermaid-D_VSX7_Q.js.map → Mermaid-DEztDKFw.js.map} +1 -1
- package/lib/{OAuthErrorPage-Fq54RLgt.js → OAuthErrorPage-DhJo-O2B.js} +15 -15
- package/lib/OAuthErrorPage-DhJo-O2B.js.map +1 -0
- package/lib/OasProvider-DFMZwyNn.js +48 -0
- package/lib/OasProvider-DFMZwyNn.js.map +1 -0
- package/lib/{OperationList-C0jiEaG5.js → OperationList-CnmLfOuu.js} +1560 -1545
- package/lib/{OperationList-C0jiEaG5.js.map → OperationList-CnmLfOuu.js.map} +1 -1
- package/lib/RouteGuard-CZuPjknT.js +77 -0
- package/lib/RouteGuard-CZuPjknT.js.map +1 -0
- package/lib/{SchemaList-BU0zCHn9.js → SchemaList-B5ikunUd.js} +9 -9
- package/lib/{SchemaList-BU0zCHn9.js.map → SchemaList-B5ikunUd.js.map} +1 -1
- package/lib/SchemaView-rjji7zMf.js +438 -0
- package/lib/SchemaView-rjji7zMf.js.map +1 -0
- package/lib/{Select-CkxXP5I7.js → Secret-BE7V0Vb5.js} +159 -139
- package/lib/Secret-BE7V0Vb5.js.map +1 -0
- package/lib/{Separator-CTPSeW1S.js → Separator-BXt1LYnm.js} +2 -2
- package/lib/{Separator-CTPSeW1S.js.map → Separator-BXt1LYnm.js.map} +1 -1
- package/lib/SignUp-DHWDXat-.js +50 -0
- package/lib/SignUp-DHWDXat-.js.map +1 -0
- package/lib/{SyntaxHighlight-Kdyskw3C.js → SyntaxHighlight-paLQ8NP8.js} +1751 -1725
- package/lib/SyntaxHighlight-paLQ8NP8.js.map +1 -0
- package/lib/{Toc-DJxFPfcS.js → Toc-vMbSQCkj.js} +3 -3
- package/lib/{Toc-DJxFPfcS.js.map → Toc-vMbSQCkj.js.map} +1 -1
- package/lib/ZudokuContext-CnEI8jPU.js +389 -0
- package/lib/ZudokuContext-CnEI8jPU.js.map +1 -0
- package/lib/{___vite-browser-external_commonjs-proxy-Cga3HsWk.js → ___vite-browser-external_commonjs-proxy-BttVsNON.js} +2 -2
- package/lib/___vite-browser-external_commonjs-proxy-BttVsNON.js.map +1 -0
- package/lib/chunk-EPOLDU6W-C6C8jAwd.js +8558 -0
- package/lib/chunk-EPOLDU6W-C6C8jAwd.js.map +1 -0
- package/lib/{circular-CzWF1hj5.js → circular-CLhJAE3S.js} +771 -749
- package/lib/{circular-CzWF1hj5.js.map → circular-CLhJAE3S.js.map} +1 -1
- package/lib/{cn-dYga0KKN.js → cn-5-Gd1Dss.js} +531 -498
- package/lib/cn-5-Gd1Dss.js.map +1 -0
- package/lib/{createServer-BIr2_tGn.js → createServer-BYtu5Pcr.js} +12 -12
- package/lib/{createServer-BIr2_tGn.js.map → createServer-BYtu5Pcr.js.map} +1 -1
- package/lib/createVariantComponent-Dc0vtOvr.js +18 -0
- package/lib/createVariantComponent-Dc0vtOvr.js.map +1 -0
- package/lib/{errors-Bs4duWDy.js → errors-DkJIl45d.js} +3 -3
- package/lib/{errors-Bs4duWDy.js.map → errors-DkJIl45d.js.map} +1 -1
- package/lib/{firebase-qUdSEL1p.js → firebase-CmsW0j7-.js} +1590 -1342
- package/lib/firebase-CmsW0j7-.js.map +1 -0
- package/lib/hook-Da8QTnPd.js +52 -0
- package/lib/hook-Da8QTnPd.js.map +1 -0
- package/lib/{index-Css56y3F.js → index-Ba6RP577.js} +4 -4
- package/lib/{index-Css56y3F.js.map → index-Ba6RP577.js.map} +1 -1
- package/lib/index-CrcNWbel.js.map +1 -1
- package/lib/{index-Bh-MffiL.js → index-D35F-SCL.js} +2 -2
- package/lib/{index-Bh-MffiL.js.map → index-D35F-SCL.js.map} +1 -1
- package/lib/{index-0oT9beQN.js → index-k0PVZBYl.js} +155 -151
- package/lib/{index-0oT9beQN.js.map → index-k0PVZBYl.js.map} +1 -1
- package/lib/{ErrorAlert-DrOR8w3f.js → index-ofqkdEjL.js} +5457 -4444
- package/lib/index-ofqkdEjL.js.map +1 -0
- package/lib/index.esm-BYObtETB.js.map +1 -1
- package/lib/{index.esm-DtzT_KoE.js → index.esm-B_0dvNjB.js} +2 -2
- package/lib/{index.esm-DtzT_KoE.js.map → index.esm-B_0dvNjB.js.map} +1 -1
- package/lib/{index.esm-kW-Utcsi.js → index.esm-DFzsB75P.js} +16 -14
- package/lib/index.esm-DFzsB75P.js.map +1 -0
- package/lib/{invariant-CGOLuIIz.js → invariant-BJAl77rw.js} +4 -4
- package/lib/invariant-BJAl77rw.js.map +1 -0
- package/lib/jsx-runtime-BzflLqGi.js.map +1 -1
- package/lib/{mutation-BoVlx8yA.js → mutation-BISOc7OM.js} +70 -44
- package/lib/mutation-BISOc7OM.js.map +1 -0
- package/lib/ui/Accordion.js +1 -1
- package/lib/ui/ActionButton.js +2 -2
- package/lib/ui/Alert.js +1 -1
- package/lib/ui/AlertDialog.js +1 -1
- package/lib/ui/Badge.js +1 -1
- package/lib/ui/Breadcrumb.js +1 -1
- package/lib/ui/Button.js +7 -6
- package/lib/ui/Button.js.map +1 -1
- package/lib/ui/ButtonGroup.js +1 -1
- package/lib/ui/Callout.js +1 -1
- package/lib/ui/Card.js +1 -1
- package/lib/ui/Carousel.js +1 -1
- package/lib/ui/Carousel.js.map +1 -1
- package/lib/ui/Checkbox.js +1 -1
- package/lib/ui/CodeBlock.js +1 -1
- package/lib/ui/Command.js +2 -2
- package/lib/ui/Dialog.js +1 -1
- package/lib/ui/Drawer.js +3 -3
- package/lib/ui/DropdownMenu.js +1 -1
- package/lib/ui/EmbeddedCodeBlock.js +1 -1
- package/lib/ui/Form.js +1 -1
- package/lib/ui/Frame.js +1 -1
- package/lib/ui/HoverCard.js +1 -1
- package/lib/ui/Input.js +1 -1
- package/lib/ui/Item.js +1 -1
- package/lib/ui/Label.js +1 -1
- package/lib/ui/NativeSelect.js +1 -1
- package/lib/ui/Pagination.js +1 -1
- package/lib/ui/Popover.js +1 -1
- package/lib/ui/Progress.js +1 -1
- package/lib/ui/RadioGroup.js +1 -1
- package/lib/ui/ScrollArea.js +1 -1
- package/lib/ui/Secret.js +3 -3
- package/lib/ui/Secret.js.map +1 -1
- package/lib/ui/Separator.js +1 -1
- package/lib/ui/Skeleton.js +1 -1
- package/lib/ui/Slider.js +1 -1
- package/lib/ui/Switch.js +1 -1
- package/lib/ui/SyntaxHighlight.js +3 -3
- package/lib/ui/Tabs.js +1 -1
- package/lib/ui/Textarea.js +1 -1
- package/lib/ui/Toggle.js +1 -1
- package/lib/ui/ToggleGroup.js +1 -1
- package/lib/ui/Value.js +1 -1
- package/lib/ui/util.js +1 -1
- package/lib/{useMutation-C6RqWmTS.js → useMutation-CFMGlAMW.js} +39 -17
- package/lib/useMutation-CFMGlAMW.js.map +1 -0
- package/lib/useSuspenseQuery-CSB_rVek.js +1226 -0
- package/lib/useSuspenseQuery-CSB_rVek.js.map +1 -0
- package/lib/zudoku.__internal.js +826 -1325
- package/lib/zudoku.__internal.js.map +1 -1
- package/lib/zudoku.auth-auth0.js +16 -16
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-azureb2c.js +4 -4
- package/lib/zudoku.auth-clerk.js +52 -75
- package/lib/zudoku.auth-clerk.js.map +1 -1
- package/lib/zudoku.auth-firebase.js +6 -5
- package/lib/zudoku.auth-firebase.js.map +1 -1
- package/lib/zudoku.auth-openid.js +5 -5
- package/lib/zudoku.auth-supabase.js +31 -40
- package/lib/zudoku.auth-supabase.js.map +1 -1
- package/lib/zudoku.components.js +23 -21
- package/lib/zudoku.hooks.js +3 -3
- package/lib/zudoku.mermaid.js +3 -3
- package/lib/zudoku.plugin-api-catalog.js +8 -8
- package/lib/zudoku.plugin-api-keys.js +607 -552
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +3 -3
- package/lib/zudoku.plugin-redirect.js +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +30 -29
- package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
- package/lib/zudoku.plugins.js +9 -8
- package/lib/zudoku.plugins.js.map +1 -1
- package/lib/zudoku.react-query.js +440 -0
- package/lib/zudoku.react-query.js.map +1 -0
- package/lib/zudoku.router.js +1130 -1404
- package/lib/zudoku.router.js.map +1 -1
- package/package.json +36 -22
- package/src/lib/auth/issuer.ts +1 -1
- package/src/lib/authentication/authentication.ts +8 -2
- package/src/lib/authentication/components/CallbackHandler.tsx +1 -1
- package/src/lib/authentication/components/SignIn.tsx +5 -2
- package/src/lib/authentication/components/SignUp.tsx +5 -2
- package/src/lib/authentication/hook.ts +16 -0
- package/src/lib/authentication/providers/auth0.tsx +15 -9
- package/src/lib/authentication/providers/clerk.tsx +0 -26
- package/src/lib/authentication/providers/firebase.tsx +98 -6
- package/src/lib/authentication/providers/supabase.tsx +6 -15
- package/src/lib/authentication/ui/EmailVerificationUi.tsx +129 -0
- package/src/lib/authentication/ui/ZudokuAuthUi.tsx +170 -38
- package/src/lib/authentication/utils/relativeRedirectUrl.ts +12 -0
- package/src/lib/components/Bootstrap.tsx +1 -4
- package/src/lib/components/Pagination.tsx +4 -5
- package/src/lib/components/Zudoku.tsx +5 -11
- package/src/lib/components/context/ZudokuContext.ts +2 -6
- package/src/lib/components/context/ZudokuProvider.tsx +1 -1
- package/src/lib/components/context/ZudokuReactContext.tsx +17 -0
- package/src/lib/components/index.ts +4 -0
- package/src/lib/components/navigation/NavigationItem.tsx +9 -3
- package/src/lib/core/RouteGuard.tsx +30 -24
- package/src/lib/core/plugins.ts +21 -1
- package/src/lib/core/react-query.ts +1 -0
- package/src/lib/core/transform-config.ts +29 -0
- package/src/lib/errors/ErrorAlert.tsx +1 -6
- package/src/lib/errors/ErrorMessage.tsx +38 -0
- package/src/lib/oas/graphql/circular.test.ts +186 -0
- package/src/lib/oas/graphql/circular.ts +49 -10
- package/src/lib/oas/graphql/index.ts +7 -3
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +36 -476
- package/src/lib/plugins/api-keys/index.tsx +76 -32
- package/src/lib/plugins/api-keys/settings/ApiKeyItem.tsx +342 -0
- package/src/lib/plugins/api-keys/settings/ApiKeyList.tsx +67 -0
- package/src/lib/plugins/api-keys/settings/RevealApiKey.tsx +124 -0
- package/src/lib/plugins/openapi/OasProvider.tsx +10 -2
- package/src/lib/plugins/openapi/OperationList.tsx +4 -4
- package/src/lib/plugins/openapi/ParamInfos.tsx +1 -0
- package/src/lib/plugins/openapi/Sidecar.tsx +3 -2
- package/src/lib/plugins/openapi/interfaces.ts +6 -1
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +6 -4
- package/src/lib/plugins/openapi/schema/utils.ts +15 -4
- package/src/lib/plugins/openapi/util/createHttpSnippet.ts +29 -1
- package/src/lib/plugins/openapi/util/getRoutes.tsx +4 -1
- package/src/lib/ui/Button.tsx +1 -0
- package/src/lib/ui/Secret.tsx +2 -2
- package/src/lib/util/invariant.ts +2 -1
- package/src/shiki/langs/c3.js +1 -0
- package/src/shiki/langs/gn.js +1 -0
- package/src/shiki/langs/moonbit.js +1 -0
- package/lib/ClaudeLogo-B4Xxt-x_.js.map +0 -1
- package/lib/ErrorAlert-DrOR8w3f.js.map +0 -1
- package/lib/OAuthErrorPage-Fq54RLgt.js.map +0 -1
- package/lib/OasProvider-DPH8mwDa.js +0 -40
- package/lib/OasProvider-DPH8mwDa.js.map +0 -1
- package/lib/RouteGuard-9wjejsKm.js +0 -77
- package/lib/RouteGuard-9wjejsKm.js.map +0 -1
- package/lib/RouterError-DSLXagd5.js +0 -42
- package/lib/RouterError-DSLXagd5.js.map +0 -1
- package/lib/SchemaView-DVae4RO2.js +0 -597
- package/lib/SchemaView-DVae4RO2.js.map +0 -1
- package/lib/Select-CkxXP5I7.js.map +0 -1
- package/lib/SignUp-BjS4ozA7.js +0 -50
- package/lib/SignUp-BjS4ozA7.js.map +0 -1
- package/lib/SyntaxHighlight-Kdyskw3C.js.map +0 -1
- package/lib/ZudokuContext-BXldanA8.js +0 -1508
- package/lib/ZudokuContext-BXldanA8.js.map +0 -1
- package/lib/___vite-browser-external_commonjs-proxy-Cga3HsWk.js.map +0 -1
- package/lib/chunk-PVWAREVJ-dLIqswPy.js +0 -7965
- package/lib/chunk-PVWAREVJ-dLIqswPy.js.map +0 -1
- package/lib/cn-dYga0KKN.js.map +0 -1
- package/lib/createVariantComponent-B9_dVBvu.js +0 -35
- package/lib/createVariantComponent-B9_dVBvu.js.map +0 -1
- package/lib/firebase-qUdSEL1p.js.map +0 -1
- package/lib/hook-BNxidGQq.js +0 -40
- package/lib/hook-BNxidGQq.js.map +0 -1
- package/lib/index-CCmMJp02.js +0 -1059
- package/lib/index-CCmMJp02.js.map +0 -1
- package/lib/index.esm-kW-Utcsi.js.map +0 -1
- package/lib/invariant-CGOLuIIz.js.map +0 -1
- package/lib/mutation-BoVlx8yA.js.map +0 -1
- package/lib/useMutation-C6RqWmTS.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zudoku",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-monetization-standalone.zd1543a39",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"homepage": "https://zudoku.dev",
|
|
6
6
|
"repository": {
|
|
@@ -119,6 +119,10 @@
|
|
|
119
119
|
"import": "./lib/zudoku.router.js",
|
|
120
120
|
"types": "./dist/lib/core/router.d.ts"
|
|
121
121
|
},
|
|
122
|
+
"./react-query": {
|
|
123
|
+
"import": "./lib/zudoku.react-query.js",
|
|
124
|
+
"types": "./dist/lib/core/react-query.d.ts"
|
|
125
|
+
},
|
|
122
126
|
"./processors/*": {
|
|
123
127
|
"import": "./lib/processors/*.js",
|
|
124
128
|
"types": "./dist/lib/plugins/openapi/processors/*.d.ts"
|
|
@@ -150,6 +154,7 @@
|
|
|
150
154
|
"dependencies": {
|
|
151
155
|
"@apidevtools/json-schema-ref-parser": "14.1.1",
|
|
152
156
|
"@envelop/core": "5.3.2",
|
|
157
|
+
"@fastify/deepmerge": "3.1.0",
|
|
153
158
|
"@graphql-typed-document-node/core": "3.2.0",
|
|
154
159
|
"@lekoarts/rehype-meta-as-attributes": "3.0.3",
|
|
155
160
|
"@mdx-js/react": "3.1.1",
|
|
@@ -180,30 +185,32 @@
|
|
|
180
185
|
"@radix-ui/react-visually-hidden": "1.2.4",
|
|
181
186
|
"@scalar/openapi-parser": "0.23.2",
|
|
182
187
|
"@sentry/node": "10.27.0",
|
|
183
|
-
"@shikijs/engine-javascript": "3.
|
|
184
|
-
"@shikijs/langs": "3.
|
|
185
|
-
"@shikijs/rehype": "3.
|
|
186
|
-
"@shikijs/themes": "3.
|
|
187
|
-
"@shikijs/transformers": "3.
|
|
188
|
+
"@shikijs/engine-javascript": "3.21.0",
|
|
189
|
+
"@shikijs/langs": "3.21.0",
|
|
190
|
+
"@shikijs/rehype": "3.21.0",
|
|
191
|
+
"@shikijs/themes": "3.21.0",
|
|
192
|
+
"@shikijs/transformers": "3.21.0",
|
|
188
193
|
"@sindresorhus/slugify": "3.0.0",
|
|
189
194
|
"@stefanprobst/rehype-extract-toc": "3.0.0",
|
|
190
195
|
"@tailwindcss/typography": "0.5.19",
|
|
191
196
|
"@tailwindcss/vite": "4.1.16",
|
|
192
197
|
"@tanem/react-nprogress": "5.0.56",
|
|
193
|
-
"@tanstack/react-query": "5.
|
|
198
|
+
"@tanstack/react-query": "5.90.12",
|
|
194
199
|
"@types/react": "19.2.7",
|
|
195
|
-
"@types/react-dom": "19.2.
|
|
200
|
+
"@types/react-dom": "19.2.3",
|
|
196
201
|
"@vitejs/plugin-react": "5.1.0",
|
|
197
202
|
"@x0k/json-schema-merge": "1.0.2",
|
|
198
203
|
"@zudoku/httpsnippet": "10.0.9",
|
|
199
204
|
"@zudoku/react-helmet-async": "2.0.5",
|
|
200
205
|
"@zuplo/mcp": "^0.0.22",
|
|
206
|
+
"bs58": "^6.0.0",
|
|
201
207
|
"class-variance-authority": "0.7.1",
|
|
202
208
|
"clsx": "2.1.1",
|
|
203
209
|
"cmdk": "1.1.1",
|
|
210
|
+
"dotenv": "^17.2.3",
|
|
204
211
|
"embla-carousel-react": "8.6.0",
|
|
205
212
|
"estree-util-value-to-estree": "3.4.1",
|
|
206
|
-
"express": "5.2.
|
|
213
|
+
"express": "5.2.1",
|
|
207
214
|
"fast-equals": "5.2.2",
|
|
208
215
|
"glob": "13.0.0",
|
|
209
216
|
"glob-parent": "6.0.2",
|
|
@@ -223,15 +230,15 @@
|
|
|
223
230
|
"next-themes": "0.4.6",
|
|
224
231
|
"oauth4webapi": "2.17.0",
|
|
225
232
|
"openapi-types": "12.1.3",
|
|
226
|
-
"pagefind": "1.
|
|
233
|
+
"pagefind": "1.5.0-beta.1",
|
|
227
234
|
"picocolors": "1.1.1",
|
|
228
235
|
"piscina": "5.1.4",
|
|
229
236
|
"posthog-node": "5.14.1",
|
|
230
237
|
"react-error-boundary": "6.0.0",
|
|
231
238
|
"react-hook-form": "7.66.0",
|
|
232
|
-
"react-is": "19.2.
|
|
239
|
+
"react-is": "19.2.3",
|
|
233
240
|
"react-markdown": "10.1.0",
|
|
234
|
-
"react-router": "7.
|
|
241
|
+
"react-router": "7.12.0",
|
|
235
242
|
"rehype-mdx-import-media": "1.2.0",
|
|
236
243
|
"rehype-raw": "7.0.0",
|
|
237
244
|
"rehype-slug": "6.0.0",
|
|
@@ -243,11 +250,11 @@
|
|
|
243
250
|
"remark-mdx-frontmatter": "5.2.0",
|
|
244
251
|
"rollup": "4.52.5",
|
|
245
252
|
"semver": "7.7.2",
|
|
246
|
-
"shiki": "3.
|
|
253
|
+
"shiki": "3.21.0",
|
|
247
254
|
"sitemap": "9.0.0",
|
|
248
255
|
"strip-ansi": "7.1.2",
|
|
249
|
-
"tailwind-merge": "3.
|
|
250
|
-
"tailwindcss": "4.1.
|
|
256
|
+
"tailwind-merge": "3.4.0",
|
|
257
|
+
"tailwindcss": "4.1.18",
|
|
251
258
|
"tw-animate-css": "1.4.0",
|
|
252
259
|
"unified": "^11.0.5",
|
|
253
260
|
"unist-util-visit": "5.0.0",
|
|
@@ -266,28 +273,28 @@
|
|
|
266
273
|
"@testing-library/jest-dom": "6.9.1",
|
|
267
274
|
"@testing-library/react": "16.3.0",
|
|
268
275
|
"@types/estree": "1.0.8",
|
|
269
|
-
"@types/express": "5.0.
|
|
276
|
+
"@types/express": "5.0.6",
|
|
270
277
|
"@types/glob-parent": "5.1.3",
|
|
271
278
|
"@types/har-format": "1.2.16",
|
|
272
279
|
"@types/hast": "^3.0.4",
|
|
273
280
|
"@types/json-schema": "7.0.15",
|
|
274
281
|
"@types/mdast": "4.0.4",
|
|
275
282
|
"@types/mdx": "2.0.13",
|
|
276
|
-
"@types/node": "22.
|
|
283
|
+
"@types/node": "22.19.1",
|
|
277
284
|
"@types/react-is": "19.2.0",
|
|
278
285
|
"@types/semver": "7.7.0",
|
|
279
286
|
"@types/unist": "^3.0.3",
|
|
280
287
|
"@types/yargs": "17.0.35",
|
|
281
|
-
"@vitest/coverage-v8": "
|
|
288
|
+
"@vitest/coverage-v8": "4.0.16",
|
|
282
289
|
"esbuild": "0.27.0",
|
|
283
290
|
"happy-dom": "20.0.10",
|
|
284
291
|
"mdast-util-mdx": "3.0.0",
|
|
285
|
-
"react": "19.2.
|
|
286
|
-
"react-dom": "19.2.
|
|
292
|
+
"react": "19.2.3",
|
|
293
|
+
"react-dom": "19.2.3",
|
|
287
294
|
"rollup-plugin-visualizer": "6.0.5",
|
|
288
295
|
"tsx": "4.20.6",
|
|
289
296
|
"typescript": "5.9.3",
|
|
290
|
-
"vitest": "4.0.
|
|
297
|
+
"vitest": "4.0.15"
|
|
291
298
|
},
|
|
292
299
|
"peerDependencies": {
|
|
293
300
|
"@azure/msal-browser": "^4.13.0",
|
|
@@ -301,6 +308,13 @@
|
|
|
301
308
|
"react": ">=19.2.0",
|
|
302
309
|
"react-dom": ">=19.2.0"
|
|
303
310
|
},
|
|
311
|
+
"typesVersions": {
|
|
312
|
+
"*": {
|
|
313
|
+
"ui/*": [
|
|
314
|
+
"./src/lib/ui/*"
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
},
|
|
304
318
|
"peerDependenciesMeta": {
|
|
305
319
|
"@azure/msal-browser": {
|
|
306
320
|
"optional": true
|
|
@@ -329,7 +343,7 @@
|
|
|
329
343
|
},
|
|
330
344
|
"scripts": {
|
|
331
345
|
"build": "tsc --project tsconfig.app.json",
|
|
332
|
-
"build:dev": "esbuild './src/**/*.ts' --format=esm --platform=node --target=node22 --outdir=dist --splitting --log-level=warning",
|
|
346
|
+
"build:dev": "esbuild './src/**/*.ts' './src/**/*.tsx' --format=esm --platform=node --target=node22 --outdir=dist --splitting --log-level=warning",
|
|
333
347
|
"build:vite": "vite build",
|
|
334
348
|
"generate:types": "tsx scripts/generate-types.js && tsx scripts/generate-flat-config.js",
|
|
335
349
|
"build:standalone:vite": "vite build --mode standalone --config vite.standalone.config.ts",
|
package/src/lib/auth/issuer.ts
CHANGED
|
@@ -32,7 +32,7 @@ export const getIssuer = async (config: ZudokuConfig) => {
|
|
|
32
32
|
return config.authentication.issuer;
|
|
33
33
|
}
|
|
34
34
|
case "firebase": {
|
|
35
|
-
return config.authentication.
|
|
35
|
+
return `https://securetoken.google.com/${config.authentication.projectId}`;
|
|
36
36
|
}
|
|
37
37
|
case undefined: {
|
|
38
38
|
return undefined;
|
|
@@ -6,6 +6,7 @@ export type AuthActionOptions = { redirectTo?: string; replace?: boolean };
|
|
|
6
6
|
|
|
7
7
|
export interface AuthenticationPlugin {
|
|
8
8
|
initialize?(context: ZudokuContext): Promise<void>;
|
|
9
|
+
onPageLoad?(): void;
|
|
9
10
|
setNavigate?(navigate: NavigateFunction): void;
|
|
10
11
|
|
|
11
12
|
signUp(
|
|
@@ -18,12 +19,17 @@ export interface AuthenticationPlugin {
|
|
|
18
19
|
): Promise<void>;
|
|
19
20
|
|
|
20
21
|
signOut({ navigate }: AuthActionContext): Promise<void>;
|
|
22
|
+
|
|
23
|
+
signRequest(request: Request): Promise<Request>;
|
|
24
|
+
requestEmailVerification?(
|
|
25
|
+
{ navigate }: AuthActionContext,
|
|
26
|
+
options?: AuthActionOptions,
|
|
27
|
+
): Promise<void>;
|
|
28
|
+
|
|
21
29
|
/**
|
|
22
30
|
* @deprecated use signRequest instead
|
|
23
31
|
*/
|
|
24
32
|
getAccessToken?(): Promise<string>;
|
|
25
|
-
onPageLoad?(): void;
|
|
26
|
-
signRequest(request: Request): Promise<Request>;
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
export type AuthenticationProviderInitializer<TConfig> = (
|
|
@@ -13,7 +13,7 @@ export function CallbackHandler({
|
|
|
13
13
|
const { options } = useZudoku();
|
|
14
14
|
const executeCallback = useSuspenseQuery({
|
|
15
15
|
retry: false,
|
|
16
|
-
queryKey: ["oauth-callback"],
|
|
16
|
+
queryKey: ["oauth-callback", window.location.search],
|
|
17
17
|
queryFn: async () => {
|
|
18
18
|
const url = new URL(window.location.href);
|
|
19
19
|
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
CardHeader,
|
|
9
9
|
CardTitle,
|
|
10
10
|
} from "zudoku/ui/Card.js";
|
|
11
|
+
import { useLatest } from "../../util/useLatest.js";
|
|
11
12
|
import { useAuth } from "../hook.js";
|
|
12
13
|
|
|
13
14
|
export const SignIn = () => {
|
|
@@ -15,12 +16,14 @@ export const SignIn = () => {
|
|
|
15
16
|
const [search] = useSearchParams();
|
|
16
17
|
const redirectTo = search.get("redirect") ?? undefined;
|
|
17
18
|
|
|
19
|
+
const login = useLatest(auth.login);
|
|
20
|
+
|
|
18
21
|
useEffect(() => {
|
|
19
|
-
void
|
|
22
|
+
void login.current({
|
|
20
23
|
redirectTo,
|
|
21
24
|
replace: true,
|
|
22
25
|
});
|
|
23
|
-
}, [
|
|
26
|
+
}, [login, redirectTo]);
|
|
24
27
|
|
|
25
28
|
return (
|
|
26
29
|
<div className="flex items-center justify-center mt-8">
|
|
@@ -7,14 +7,17 @@ import {
|
|
|
7
7
|
CardHeader,
|
|
8
8
|
CardTitle,
|
|
9
9
|
} from "zudoku/ui/Card.js";
|
|
10
|
+
import { useLatest } from "../../util/useLatest.js";
|
|
10
11
|
import { useAuth } from "../hook.js";
|
|
11
12
|
|
|
12
13
|
export const SignUp = () => {
|
|
13
14
|
const auth = useAuth();
|
|
14
15
|
|
|
16
|
+
const signup = useLatest(auth.signup);
|
|
17
|
+
|
|
15
18
|
useEffect(() => {
|
|
16
|
-
void
|
|
17
|
-
}, [
|
|
19
|
+
void signup.current();
|
|
20
|
+
}, [signup]);
|
|
18
21
|
|
|
19
22
|
return (
|
|
20
23
|
<div className="flex items-center justify-center mt-8">
|
|
@@ -52,5 +52,21 @@ export const useAuth = () => {
|
|
|
52
52
|
},
|
|
53
53
|
);
|
|
54
54
|
},
|
|
55
|
+
supportsEmailVerification:
|
|
56
|
+
typeof authentication?.requestEmailVerification === "function",
|
|
57
|
+
|
|
58
|
+
requestEmailVerification: async (options?: AuthActionOptions) => {
|
|
59
|
+
if (!isAuthEnabled) {
|
|
60
|
+
throw new Error("Authentication is not enabled.");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
await authentication.requestEmailVerification?.(
|
|
64
|
+
{ navigate },
|
|
65
|
+
{
|
|
66
|
+
...options,
|
|
67
|
+
redirectTo: options?.redirectTo ?? window.location.href,
|
|
68
|
+
},
|
|
69
|
+
);
|
|
70
|
+
},
|
|
55
71
|
};
|
|
56
72
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Auth0AuthenticationConfig } from "../../../config/config.js";
|
|
2
|
+
import { joinUrl } from "../../util/joinUrl.js";
|
|
2
3
|
import type {
|
|
3
4
|
AuthActionContext,
|
|
4
5
|
AuthenticationPlugin,
|
|
@@ -43,7 +44,10 @@ class Auth0AuthenticationProvider
|
|
|
43
44
|
|
|
44
45
|
signOut = async (_: AuthActionContext): Promise<void> => {
|
|
45
46
|
const as = await this.getAuthServer();
|
|
46
|
-
|
|
47
|
+
|
|
48
|
+
// biome-ignore lint/suspicious/noExplicitAny: We don't have a good way for typing provider-data yet.
|
|
49
|
+
const providerData = useAuthState.getState().providerData as any;
|
|
50
|
+
const idToken = providerData?.idToken;
|
|
47
51
|
|
|
48
52
|
useAuthState.setState({
|
|
49
53
|
isAuthenticated: false,
|
|
@@ -53,15 +57,18 @@ class Auth0AuthenticationProvider
|
|
|
53
57
|
});
|
|
54
58
|
|
|
55
59
|
const redirectUrl = new URL(window.location.origin);
|
|
56
|
-
redirectUrl.pathname =
|
|
60
|
+
redirectUrl.pathname = joinUrl(
|
|
61
|
+
import.meta.env.BASE_URL,
|
|
62
|
+
this.redirectToAfterSignOut,
|
|
63
|
+
);
|
|
57
64
|
|
|
58
65
|
// SEE: https://auth0.com/docs/authenticate/login/logout/log-users-out-of-auth0
|
|
59
66
|
// For Auth0 tenants created on or after 14 November 2023, RP-Initiated
|
|
60
67
|
// Logout End Session Endpoint Discovery is enabled by default.
|
|
61
68
|
// Otherwise we fallback to the old non-compliant logout
|
|
62
69
|
|
|
63
|
-
// The
|
|
64
|
-
// so we use
|
|
70
|
+
// The end_session_endpoint is set, the IdP supports some form of logout,
|
|
71
|
+
// so we use auth0 logout. Otherwise, just redirect the user to home
|
|
65
72
|
if (as.end_session_endpoint) {
|
|
66
73
|
const logoutUrl = new URL(as.end_session_endpoint);
|
|
67
74
|
if (idToken) {
|
|
@@ -72,12 +79,11 @@ class Auth0AuthenticationProvider
|
|
|
72
79
|
redirectUrl.toString(),
|
|
73
80
|
);
|
|
74
81
|
|
|
75
|
-
|
|
82
|
+
window.location.href = logoutUrl.toString();
|
|
76
83
|
} else {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// window.location.href = logoutUrl.toString();
|
|
84
|
+
// const logoutUrl = new URL(`${this.issuer.replace(/\/$/, "")}/v2/logout`);
|
|
85
|
+
// logoutUrl.searchParams.set("returnTo", redirectUrl.toString());
|
|
86
|
+
// don't support the deprecated logout today
|
|
81
87
|
}
|
|
82
88
|
};
|
|
83
89
|
}
|
|
@@ -29,32 +29,6 @@ const clerkAuth: AuthenticationProviderInitializer<
|
|
|
29
29
|
|
|
30
30
|
await clerkApi.load();
|
|
31
31
|
|
|
32
|
-
if (clerkApi.user) {
|
|
33
|
-
const verifiedEmail = clerkApi.user.emailAddresses.find(
|
|
34
|
-
(email) => email.verification.status === "verified",
|
|
35
|
-
);
|
|
36
|
-
useAuthState.getState().setLoggedIn({
|
|
37
|
-
profile: {
|
|
38
|
-
sub: clerkApi.user.id,
|
|
39
|
-
name: clerkApi.user.fullName ?? undefined,
|
|
40
|
-
email:
|
|
41
|
-
verifiedEmail?.emailAddress ??
|
|
42
|
-
clerkApi.user.emailAddresses[0]?.emailAddress,
|
|
43
|
-
emailVerified: verifiedEmail !== undefined,
|
|
44
|
-
pictureUrl: clerkApi.user.imageUrl,
|
|
45
|
-
},
|
|
46
|
-
providerData: {
|
|
47
|
-
user: {
|
|
48
|
-
publicMetadata: clerkApi.user.publicMetadata,
|
|
49
|
-
id: clerkApi.user.id,
|
|
50
|
-
emailAddresses: clerkApi.user.emailAddresses,
|
|
51
|
-
imageUrl: clerkApi.user.imageUrl,
|
|
52
|
-
fullName: clerkApi.user.fullName,
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
32
|
return clerkApi;
|
|
59
33
|
})();
|
|
60
34
|
|
|
@@ -3,12 +3,15 @@ import {
|
|
|
3
3
|
type Auth,
|
|
4
4
|
createUserWithEmailAndPassword,
|
|
5
5
|
getAuth,
|
|
6
|
+
sendEmailVerification,
|
|
7
|
+
sendPasswordResetEmail,
|
|
6
8
|
signInWithEmailAndPassword,
|
|
7
9
|
signInWithPopup,
|
|
8
10
|
signOut,
|
|
9
11
|
type User,
|
|
10
12
|
} from "firebase/auth";
|
|
11
13
|
import type { FirebaseAuthenticationConfig } from "../../../config/config.js";
|
|
14
|
+
import { ZudokuError } from "../../util/invariant.js";
|
|
12
15
|
import { CoreAuthenticationPlugin } from "../AuthenticationPlugin.js";
|
|
13
16
|
import type {
|
|
14
17
|
AuthActionContext,
|
|
@@ -19,7 +22,12 @@ import type {
|
|
|
19
22
|
import { SignOut } from "../components/SignOut.js";
|
|
20
23
|
import { AuthorizationError } from "../errors.js";
|
|
21
24
|
import { useAuthState } from "../state.js";
|
|
22
|
-
import {
|
|
25
|
+
import { EmailVerificationUi } from "../ui/EmailVerificationUi.js";
|
|
26
|
+
import {
|
|
27
|
+
ZudokuPasswordResetUi,
|
|
28
|
+
ZudokuSignInUi,
|
|
29
|
+
ZudokuSignUpUi,
|
|
30
|
+
} from "../ui/ZudokuAuthUi.js";
|
|
23
31
|
|
|
24
32
|
class FirebaseAuthenticationProvider
|
|
25
33
|
extends CoreAuthenticationPlugin
|
|
@@ -28,6 +36,7 @@ class FirebaseAuthenticationProvider
|
|
|
28
36
|
private readonly app: FirebaseApp;
|
|
29
37
|
private readonly auth: Auth;
|
|
30
38
|
private readonly providers: string[];
|
|
39
|
+
private readonly enableUsernamePassword: boolean;
|
|
31
40
|
|
|
32
41
|
constructor(config: FirebaseAuthenticationConfig) {
|
|
33
42
|
super();
|
|
@@ -42,7 +51,13 @@ class FirebaseAuthenticationProvider
|
|
|
42
51
|
measurementId: config.measurementId,
|
|
43
52
|
});
|
|
44
53
|
this.auth = getAuth(this.app);
|
|
45
|
-
this.providers = config.providers ?? [];
|
|
54
|
+
this.providers = config.providers?.filter((p) => p !== "password") ?? [];
|
|
55
|
+
this.enableUsernamePassword =
|
|
56
|
+
config.providers?.includes("password") ?? false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async initialize() {
|
|
60
|
+
await this.auth.authStateReady();
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
async signRequest(request: Request): Promise<Request> {
|
|
@@ -76,13 +91,77 @@ class FirebaseAuthenticationProvider
|
|
|
76
91
|
);
|
|
77
92
|
};
|
|
78
93
|
|
|
94
|
+
requestEmailVerification = async (
|
|
95
|
+
{ navigate }: AuthActionContext,
|
|
96
|
+
{ redirectTo }: AuthActionOptions,
|
|
97
|
+
) => {
|
|
98
|
+
if (!this.auth.currentUser) {
|
|
99
|
+
throw new ZudokuError("User is not authenticated", {
|
|
100
|
+
title: "User not authenticated",
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
await sendEmailVerification(this.auth.currentUser);
|
|
105
|
+
void navigate(
|
|
106
|
+
redirectTo
|
|
107
|
+
? `/verify-email?redirectTo=${encodeURIComponent(redirectTo)}`
|
|
108
|
+
: `/verify-email`,
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
79
112
|
getRoutes = () => {
|
|
80
113
|
return [
|
|
114
|
+
{
|
|
115
|
+
path: "/verify-email",
|
|
116
|
+
element: (
|
|
117
|
+
<EmailVerificationUi
|
|
118
|
+
onResendVerification={async () => {
|
|
119
|
+
if (!this.auth.currentUser) {
|
|
120
|
+
throw new ZudokuError("User is not authenticated", {
|
|
121
|
+
title: "User not authenticated",
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
await sendEmailVerification(this.auth.currentUser);
|
|
125
|
+
}}
|
|
126
|
+
onCheckVerification={async () => {
|
|
127
|
+
if (!this.auth.currentUser) {
|
|
128
|
+
throw new ZudokuError("User is not authenticated", {
|
|
129
|
+
title: "User not authenticated",
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
await this.auth.currentUser.reload();
|
|
133
|
+
const isVerified = this.auth.currentUser.emailVerified;
|
|
134
|
+
|
|
135
|
+
if (isVerified) {
|
|
136
|
+
await this.auth.currentUser.getIdToken(true);
|
|
137
|
+
await this.setUserLoggedIn(this.auth.currentUser);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return isVerified;
|
|
141
|
+
}}
|
|
142
|
+
/>
|
|
143
|
+
),
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
path: "/reset-password",
|
|
147
|
+
element: (
|
|
148
|
+
<ZudokuPasswordResetUi
|
|
149
|
+
onPasswordReset={async (email: string) => {
|
|
150
|
+
try {
|
|
151
|
+
await sendPasswordResetEmail(this.auth, email);
|
|
152
|
+
} catch (error) {
|
|
153
|
+
throw Error(getFirebaseErrorMessage(error), { cause: error });
|
|
154
|
+
}
|
|
155
|
+
}}
|
|
156
|
+
/>
|
|
157
|
+
),
|
|
158
|
+
},
|
|
81
159
|
{
|
|
82
160
|
path: "/signin",
|
|
83
161
|
element: (
|
|
84
162
|
<ZudokuSignInUi
|
|
85
163
|
providers={this.providers}
|
|
164
|
+
enableUsernamePassword={this.enableUsernamePassword}
|
|
86
165
|
onOAuthSignIn={async (providerId: string) => {
|
|
87
166
|
useAuthState.setState({ isPending: true });
|
|
88
167
|
const provider = await getProviderForId(providerId);
|
|
@@ -109,7 +188,13 @@ class FirebaseAuthenticationProvider
|
|
|
109
188
|
password: string,
|
|
110
189
|
) => {
|
|
111
190
|
try {
|
|
112
|
-
|
|
191
|
+
useAuthState.setState({ isPending: false });
|
|
192
|
+
const result = await signInWithEmailAndPassword(
|
|
193
|
+
this.auth,
|
|
194
|
+
email,
|
|
195
|
+
password,
|
|
196
|
+
);
|
|
197
|
+
await this.setUserLoggedIn(result.user);
|
|
113
198
|
} catch (error) {
|
|
114
199
|
throw Error(getFirebaseErrorMessage(error), { cause: error });
|
|
115
200
|
}
|
|
@@ -122,6 +207,7 @@ class FirebaseAuthenticationProvider
|
|
|
122
207
|
element: (
|
|
123
208
|
<ZudokuSignUpUi
|
|
124
209
|
providers={this.providers}
|
|
210
|
+
enableUsernamePassword={this.enableUsernamePassword}
|
|
125
211
|
onOAuthSignUp={async (providerId: string) => {
|
|
126
212
|
const provider = await getProviderForId(providerId);
|
|
127
213
|
if (!provider) {
|
|
@@ -135,7 +221,13 @@ class FirebaseAuthenticationProvider
|
|
|
135
221
|
email: string,
|
|
136
222
|
password: string,
|
|
137
223
|
) => {
|
|
138
|
-
|
|
224
|
+
useAuthState.setState({ isPending: true });
|
|
225
|
+
const createUser = await createUserWithEmailAndPassword(
|
|
226
|
+
this.auth,
|
|
227
|
+
email,
|
|
228
|
+
password,
|
|
229
|
+
);
|
|
230
|
+
await this.setUserLoggedIn(createUser.user);
|
|
139
231
|
}}
|
|
140
232
|
/>
|
|
141
233
|
),
|
|
@@ -162,13 +254,13 @@ class FirebaseAuthenticationProvider
|
|
|
162
254
|
const user = this.auth.currentUser;
|
|
163
255
|
|
|
164
256
|
if (user) {
|
|
165
|
-
await this.
|
|
257
|
+
await this.setUserLoggedIn(user);
|
|
166
258
|
} else {
|
|
167
259
|
useAuthState.setState({ isPending: false });
|
|
168
260
|
}
|
|
169
261
|
};
|
|
170
262
|
|
|
171
|
-
private async
|
|
263
|
+
private async setUserLoggedIn(user: User) {
|
|
172
264
|
useAuthState.getState().setLoggedIn({
|
|
173
265
|
profile: {
|
|
174
266
|
sub: user.uid,
|
|
@@ -129,21 +129,12 @@ class SupabaseAuthenticationProvider
|
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
signOut = async () => {
|
|
132
|
-
await
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
void this.client.auth.signOut();
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
useAuthState.setState({
|
|
142
|
-
isAuthenticated: false,
|
|
143
|
-
isPending: false,
|
|
144
|
-
profile: undefined,
|
|
145
|
-
providerData: undefined,
|
|
146
|
-
});
|
|
132
|
+
const { error } = await this.client.auth.signOut({ scope: "local" });
|
|
133
|
+
if (error) {
|
|
134
|
+
// biome-ignore lint/suspicious: Logging is better than not doing anything
|
|
135
|
+
console.error("Error signing out", error);
|
|
136
|
+
}
|
|
137
|
+
useAuthState.getState().setLoggedOut();
|
|
147
138
|
};
|
|
148
139
|
|
|
149
140
|
onPageLoad = async () => {
|