@hexclave/tanstack-start 1.0.24 → 1.0.26
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/components/elements/sidebar-layout.js +1 -1
- package/dist/components-page/hexclave-handler-client.js +6 -5
- package/dist/components-page/hexclave-handler-client.js.map +1 -1
- package/dist/dev-tool/dev-tool-core.d.ts.map +1 -1
- package/dist/dev-tool/dev-tool-core.js +4 -68
- package/dist/dev-tool/dev-tool-core.js.map +1 -1
- package/dist/esm/components/elements/sidebar-layout.js +1 -1
- package/dist/esm/components-page/hexclave-handler-client.js +6 -5
- package/dist/esm/components-page/hexclave-handler-client.js.map +1 -1
- package/dist/esm/dev-tool/dev-tool-core.d.ts.map +1 -1
- package/dist/esm/dev-tool/dev-tool-core.js +4 -68
- package/dist/esm/dev-tool/dev-tool-core.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +7 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.js +35 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +1 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.js +18 -11
- package/dist/esm/lib/hexclave-app/apps/implementations/client-app-impl.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/common.js +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/event-tracker.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/event-tracker.js +2 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/event-tracker.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/event-tracker.test.js +26 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/event-tracker.test.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/session-replay.d.ts +7 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/session-replay.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/session-replay.js +11 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/session-replay.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/implementations/session-replay.test.js +43 -0
- package/dist/esm/lib/hexclave-app/apps/implementations/session-replay.test.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/interfaces/admin-app.d.ts +2 -1
- package/dist/esm/lib/hexclave-app/apps/interfaces/admin-app.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/interfaces/admin-app.js.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/interfaces/client-app.d.ts +1 -0
- package/dist/esm/lib/hexclave-app/apps/interfaces/client-app.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/apps/interfaces/client-app.js.map +1 -1
- package/dist/esm/lib/hexclave-app/index.d.ts +2 -1
- package/dist/esm/lib/hexclave-app/plan-usage/index.d.ts +27 -0
- package/dist/esm/lib/hexclave-app/plan-usage/index.d.ts.map +1 -0
- package/dist/esm/lib/hexclave-app/plan-usage/index.js +1 -0
- package/dist/esm/lib/hexclave-app/projects/index.d.ts +7 -0
- package/dist/esm/lib/hexclave-app/projects/index.d.ts.map +1 -1
- package/dist/esm/lib/hexclave-app/projects/index.js.map +1 -1
- package/dist/esm/pushed-config-error-overlay/index.d.ts +7 -0
- package/dist/esm/pushed-config-error-overlay/index.d.ts.map +1 -0
- package/dist/esm/pushed-config-error-overlay/index.js +464 -0
- package/dist/esm/pushed-config-error-overlay/index.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts +7 -0
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.d.ts.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.js +35 -1
- package/dist/lib/hexclave-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.d.ts +1 -0
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.d.ts.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.js +18 -11
- package/dist/lib/hexclave-app/apps/implementations/client-app-impl.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/common.js +1 -1
- package/dist/lib/hexclave-app/apps/implementations/event-tracker.d.ts.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/event-tracker.js +1 -0
- package/dist/lib/hexclave-app/apps/implementations/event-tracker.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/event-tracker.test.js +26 -0
- package/dist/lib/hexclave-app/apps/implementations/event-tracker.test.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/session-replay.d.ts +7 -1
- package/dist/lib/hexclave-app/apps/implementations/session-replay.d.ts.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/session-replay.js +11 -0
- package/dist/lib/hexclave-app/apps/implementations/session-replay.js.map +1 -1
- package/dist/lib/hexclave-app/apps/implementations/session-replay.test.js +43 -0
- package/dist/lib/hexclave-app/apps/implementations/session-replay.test.js.map +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/admin-app.d.ts +2 -1
- package/dist/lib/hexclave-app/apps/interfaces/admin-app.d.ts.map +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/admin-app.js.map +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/client-app.d.ts +1 -0
- package/dist/lib/hexclave-app/apps/interfaces/client-app.d.ts.map +1 -1
- package/dist/lib/hexclave-app/apps/interfaces/client-app.js.map +1 -1
- package/dist/lib/hexclave-app/index.d.ts +2 -1
- package/dist/lib/hexclave-app/plan-usage/index.d.ts +27 -0
- package/dist/lib/hexclave-app/plan-usage/index.d.ts.map +1 -0
- package/dist/lib/hexclave-app/plan-usage/index.js +0 -0
- package/dist/lib/hexclave-app/projects/index.d.ts +7 -0
- package/dist/lib/hexclave-app/projects/index.d.ts.map +1 -1
- package/dist/lib/hexclave-app/projects/index.js.map +1 -1
- package/dist/pushed-config-error-overlay/index.d.ts +7 -0
- package/dist/pushed-config-error-overlay/index.d.ts.map +1 -0
- package/dist/pushed-config-error-overlay/index.js +466 -0
- package/dist/pushed-config-error-overlay/index.js.map +1 -0
- package/package.json +3 -3
- package/src/components-page/hexclave-handler-client.tsx +6 -5
- package/src/dev-tool/dev-tool-core.ts +5 -59
- package/src/lib/hexclave-app/apps/implementations/admin-app-impl.ts +44 -1
- package/src/lib/hexclave-app/apps/implementations/client-app-impl.ts +20 -11
- package/src/lib/hexclave-app/apps/implementations/event-tracker.test.ts +33 -0
- package/src/lib/hexclave-app/apps/implementations/event-tracker.ts +6 -1
- package/src/lib/hexclave-app/apps/implementations/session-replay.test.ts +52 -0
- package/src/lib/hexclave-app/apps/implementations/session-replay.ts +20 -0
- package/src/lib/hexclave-app/apps/interfaces/admin-app.ts +2 -0
- package/src/lib/hexclave-app/apps/interfaces/client-app.ts +1 -0
- package/src/lib/hexclave-app/index.ts +8 -0
- package/src/lib/hexclave-app/plan-usage/index.ts +29 -0
- package/src/lib/hexclave-app/projects/index.ts +3 -0
- package/src/pushed-config-error-overlay/index.ts +548 -0
|
@@ -4,8 +4,8 @@ import { Button, Typography, cn } from "@hexclave/ui";
|
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { XIcon } from "lucide-react";
|
|
7
|
-
import { useStackApp } from "../../index.js";
|
|
8
7
|
import { useHash } from "@hexclave/shared/dist/hooks/use-hash";
|
|
8
|
+
import { useStackApp } from "../../index.js";
|
|
9
9
|
|
|
10
10
|
//#region src/components/elements/sidebar-layout.tsx
|
|
11
11
|
function SidebarLayout(props) {
|
|
@@ -143,7 +143,7 @@ function renderComponent(props) {
|
|
|
143
143
|
});
|
|
144
144
|
default: {
|
|
145
145
|
if (Object.values(availablePaths).includes(path)) throw new HexclaveAssertionError(`Path alias ${path} not included in switch statement, but in availablePaths?`, { availablePaths });
|
|
146
|
-
for (const [key, value] of Object.entries(pathAliases)) if (path.toLowerCase().replaceAll("-", "") === key.toLowerCase().replaceAll("-", "")) return { redirect: `${app.
|
|
146
|
+
for (const [key, value] of Object.entries(pathAliases)) if (path.toLowerCase().replaceAll("-", "") === key.toLowerCase().replaceAll("-", "")) return { redirect: `${app[hexclaveAppInternalsSymbol].getUrls().handler}/${value}?${new URLSearchParams(searchParams).toString()}` };
|
|
147
147
|
const defaultUnknownPathUrl = getDefaultUnknownPathUrl?.(path);
|
|
148
148
|
if (defaultUnknownPathUrl != null) {
|
|
149
149
|
const defaultUnknownPathUrlObject = new URL(defaultUnknownPathUrl, "http://example.com");
|
|
@@ -184,15 +184,16 @@ function RedirectToPage(props) {
|
|
|
184
184
|
}
|
|
185
185
|
function HexclaveHandlerClient(props) {
|
|
186
186
|
const hexclaveApp = useStackApp$1();
|
|
187
|
+
const handlerUrls = hexclaveApp[hexclaveAppInternalsSymbol].getUrls();
|
|
187
188
|
const clientOrigin = useClientOriginAfterHydration();
|
|
188
189
|
const navigate = hexclaveApp.useNavigate();
|
|
189
190
|
const navigateRef = useRef(navigate);
|
|
190
191
|
navigateRef.current = navigate;
|
|
191
|
-
const currentLocation = props.location ?? (typeof window === "undefined" ? new URL(
|
|
192
|
+
const currentLocation = props.location ?? (typeof window === "undefined" ? new URL(handlerUrls.handler, placeholderOrigin).pathname : window.location.pathname);
|
|
192
193
|
const searchParamsSource = new URLSearchParams(typeof window === "undefined" ? "" : window.location.search);
|
|
193
194
|
const redirectTargets = [];
|
|
194
195
|
const { path, searchParams, handlerPath } = useMemo(() => {
|
|
195
|
-
const handlerPath = new URL(
|
|
196
|
+
const handlerPath = new URL(handlerUrls.handler, "http://example.com").pathname;
|
|
196
197
|
return {
|
|
197
198
|
path: currentLocation.startsWith(handlerPath) ? currentLocation.slice(handlerPath.length).replace(/^\/+/, "") : currentLocation.replace(/^\/+/, ""),
|
|
198
199
|
searchParams: Object.fromEntries(searchParamsSource.entries()),
|
|
@@ -201,7 +202,7 @@ function HexclaveHandlerClient(props) {
|
|
|
201
202
|
}, [
|
|
202
203
|
currentLocation,
|
|
203
204
|
searchParamsSource,
|
|
204
|
-
|
|
205
|
+
handlerUrls.handler
|
|
205
206
|
]);
|
|
206
207
|
const getDefaultUnknownPathUrl = (unknownPath) => {
|
|
207
208
|
return resolveUnknownHandlerPathFallbackUrl({
|
|
@@ -211,7 +212,7 @@ function HexclaveHandlerClient(props) {
|
|
|
211
212
|
});
|
|
212
213
|
};
|
|
213
214
|
const shouldRedirectToPage = (name) => {
|
|
214
|
-
const url =
|
|
215
|
+
const url = handlerUrls[name];
|
|
215
216
|
if (name === "oauthCallback" && searchParams.hexclave_cross_domain_auth === "1") return false;
|
|
216
217
|
return !isLocalHandlerUrlTarget({
|
|
217
218
|
targetUrl: url,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hexclave-handler-client.js","names":["MessageCard","useStackApp"],"sources":["../../../src/components-page/hexclave-handler-client.tsx"],"sourcesContent":["\"use client\";\n\n\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\n\nimport { KnownError } from \"@hexclave/shared\";\nimport { captureError, HexclaveAssertionError } from \"@hexclave/shared/dist/utils/errors\";\nimport { FilterUndefined, filterUndefined } from \"@hexclave/shared/dist/utils/objects\";\nimport { use } from \"@hexclave/shared/dist/utils/react\";\nimport { getRelativePart } from \"@hexclave/shared/dist/utils/urls\";\nimport { Suspense, useMemo, useSyncExternalStore } from 'react';\nimport { useEffect, useRef } from 'react';\nimport { SignIn, SignUp, StackServerApp } from \"..\";\nimport { useStackApp } from \"../lib/hooks\";\nimport { HandlerUrls, StackClientApp, hexclaveAppInternalsSymbol } from \"../lib/hexclave-app\";\nimport { isLocalHandlerUrlTarget, resolveUnknownHandlerPathFallbackUrl } from \"../lib/hexclave-app/url-targets\";\nimport { AccountSettings } from \"./account-settings\";\nimport { CliAuthConfirmation } from \"./cli-auth-confirm\";\nimport { EmailVerification } from \"./email-verification\";\nimport { ErrorPage } from \"./error-page\";\nimport { ForgotPassword } from \"./forgot-password\";\nimport { MagicLinkCallback } from \"./magic-link-callback\";\nimport { MFA } from \"./mfa\";\nimport { OAuthCallback } from \"./oauth-callback\";\nimport { Onboarding } from \"./onboarding\";\nimport { PasswordReset } from \"./password-reset\";\nimport { SignOut } from \"./sign-out\";\nimport { TeamInvitation } from \"./team-invitation\";\n\nimport { KnownErrorMessageCard } from \"../components/message-cards/known-error-message-card\";\nimport { MessageCard } from \"../components/message-cards/message-card\";\nimport { PredefinedMessageCard } from \"../components/message-cards/predefined-message-card\";\n\ntype Components = {\n SignIn: typeof SignIn,\n SignUp: typeof SignUp,\n EmailVerification: typeof EmailVerification,\n PasswordReset: typeof PasswordReset,\n ForgotPassword: typeof ForgotPassword,\n SignOut: typeof SignOut,\n OAuthCallback: typeof OAuthCallback,\n MagicLinkCallback: typeof MagicLinkCallback,\n TeamInvitation: typeof TeamInvitation,\n ErrorPage: typeof ErrorPage,\n AccountSettings: typeof AccountSettings,\n CliAuthConfirmation: typeof CliAuthConfirmation,\n MFA: typeof MFA,\n Onboarding: typeof Onboarding,\n};\n\ntype RouteProps = {\n params: Promise<{ stack?: string[] }> | { stack?: string[] },\n searchParams: Promise<Record<string, string>> | Record<string, string>,\n};\n\ntype RedirectToPageResult =\n | { status: \"success\" }\n | { status: \"known-error\", error: KnownError }\n | { status: \"unknown-error\" };\n\nconst availablePaths = {\n signIn: 'sign-in',\n signUp: 'sign-up',\n emailVerification: 'email-verification',\n passwordReset: 'password-reset',\n forgotPassword: 'forgot-password',\n signOut: 'sign-out',\n oauthCallback: 'oauth-callback',\n magicLinkCallback: 'magic-link-callback',\n teamInvitation: 'team-invitation',\n accountSettings: 'account-settings',\n cliAuthConfirm: 'cli-auth-confirm',\n mfa: 'mfa',\n error: 'error',\n onboarding: 'onboarding',\n} as const;\n\nconst placeholderOrigin = \"http://example.com\";\n\nconst pathAliases = {\n // also includes the uppercase and non-dashed versions\n ...Object.fromEntries(Object.entries(availablePaths).map(([key, value]) => [value, value])),\n \"log-in\": availablePaths.signIn,\n \"register\": availablePaths.signUp,\n} as const;\n\nexport type BaseHandlerProps = {\n fullPage: boolean,\n componentProps?: {\n [K in keyof Components]?: Parameters<Components[K]>[0];\n },\n};\n\nfunction renderComponent(props: {\n path: string,\n searchParams: Record<string, string>,\n fullPage: boolean,\n componentProps?: BaseHandlerProps['componentProps'],\n shouldRedirectToPage?: (name: keyof HandlerUrls) => boolean,\n getDefaultUnknownPathUrl?: (path: string) => string | null,\n onNotFound: () => any,\n app: StackClientApp<any> | StackServerApp<any>,\n}) {\n const { path, searchParams, fullPage, componentProps, shouldRedirectToPage, getDefaultUnknownPathUrl, onNotFound, app } = props;\n\n switch (path) {\n case availablePaths.signIn: {\n if (shouldRedirectToPage?.('signIn')) return { redirectToPage: 'signIn' as const };\n return <SignIn\n fullPage={fullPage}\n automaticRedirect\n {...filterUndefinedINU(componentProps?.SignIn)}\n />;\n }\n case availablePaths.signUp: {\n if (shouldRedirectToPage?.('signUp')) return { redirectToPage: 'signUp' as const };\n return <SignUp\n fullPage={fullPage}\n automaticRedirect\n {...filterUndefinedINU(componentProps?.SignUp)}\n />;\n }\n case availablePaths.emailVerification: {\n if (shouldRedirectToPage?.('emailVerification')) return { redirectToPage: 'emailVerification' as const };\n return <EmailVerification\n searchParams={searchParams}\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.EmailVerification)}\n />;\n }\n case availablePaths.passwordReset: {\n if (shouldRedirectToPage?.('passwordReset')) return { redirectToPage: 'passwordReset' as const };\n return <PasswordReset\n searchParams={searchParams}\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.PasswordReset)}\n />;\n }\n case availablePaths.forgotPassword: {\n if (shouldRedirectToPage?.('forgotPassword')) return { redirectToPage: 'forgotPassword' as const };\n return <ForgotPassword\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.ForgotPassword)}\n />;\n }\n case availablePaths.signOut: {\n if (shouldRedirectToPage?.('signOut')) return { redirectToPage: 'signOut' as const };\n return <SignOut\n searchParams={searchParams}\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.SignOut)}\n />;\n }\n case availablePaths.oauthCallback: {\n if (shouldRedirectToPage?.('oauthCallback')) return { redirectToPage: 'oauthCallback' as const };\n return <OAuthCallback\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.OAuthCallback)}\n />;\n }\n case availablePaths.magicLinkCallback: {\n if (shouldRedirectToPage?.('magicLinkCallback')) return { redirectToPage: 'magicLinkCallback' as const };\n return <MagicLinkCallback\n searchParams={searchParams}\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.MagicLinkCallback)}\n />;\n }\n case availablePaths.teamInvitation: {\n if (shouldRedirectToPage?.('teamInvitation')) return { redirectToPage: 'teamInvitation' as const };\n return <TeamInvitation\n searchParams={searchParams}\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.TeamInvitation)}\n />;\n }\n case availablePaths.accountSettings: {\n return <AccountSettings\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.AccountSettings)}\n />;\n }\n case availablePaths.error: {\n return <ErrorPage\n searchParams={searchParams}\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.ErrorPage)}\n />;\n }\n case availablePaths.cliAuthConfirm: {\n if (shouldRedirectToPage?.('cliAuthConfirm')) return { redirectToPage: 'cliAuthConfirm' as const };\n return <CliAuthConfirmation\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.CliAuthConfirmation)}\n />;\n }\n case availablePaths.mfa: {\n if (shouldRedirectToPage?.('mfa')) return { redirectToPage: 'mfa' as const };\n return <MFA\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.MFA)}\n />;\n }\n case availablePaths.onboarding: {\n if (shouldRedirectToPage?.('onboarding')) return { redirectToPage: 'onboarding' as const };\n return <Onboarding\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.Onboarding)}\n />;\n }\n default: {\n if (Object.values(availablePaths).includes(path as any)) {\n throw new HexclaveAssertionError(`Path alias ${path} not included in switch statement, but in availablePaths?`, { availablePaths });\n }\n for (const [key, value] of Object.entries(pathAliases)) {\n if (path.toLowerCase().replaceAll('-', '') === key.toLowerCase().replaceAll('-', '')) {\n const redirectUrl = `${app.urls.handler}/${value}?${new URLSearchParams(searchParams).toString()}`;\n return { redirect: redirectUrl };\n }\n }\n const defaultUnknownPathUrl = getDefaultUnknownPathUrl?.(path);\n if (defaultUnknownPathUrl != null) {\n const defaultUnknownPathUrlObject = new URL(defaultUnknownPathUrl, \"http://example.com\");\n for (const [key, value] of Object.entries(searchParams)) {\n defaultUnknownPathUrlObject.searchParams.set(key, value);\n }\n return { redirect: toAbsoluteOrRelativeRedirectTarget(defaultUnknownPathUrlObject) };\n }\n return onNotFound();\n }\n }\n}\n\nexport async function getRedirectToPageResult(\n app: StackClientApp,\n redirectToPage: keyof HandlerUrls,\n): Promise<RedirectToPageResult> {\n try {\n await app[hexclaveAppInternalsSymbol].redirectToHandler(redirectToPage, { replace: true });\n return { status: \"success\" };\n } catch (e) {\n if (KnownError.isKnownError(e)) {\n return { status: \"known-error\", error: e };\n }\n captureError(\"<HexclaveHandlerClient redirectToPage />\", e);\n return { status: \"unknown-error\" };\n }\n}\n\nfunction RedirectToPage(props: {\n app: StackClientApp,\n fullPage?: boolean,\n redirectToPage: keyof HandlerUrls,\n}) {\n const redirectResultPromise = useMemo(\n () => getRedirectToPageResult(props.app, props.redirectToPage),\n [props.app, props.redirectToPage],\n );\n\n const redirectResult = use(redirectResultPromise);\n if (redirectResult.status === \"known-error\") {\n return <KnownErrorMessageCard error={redirectResult.error} fullPage={props.fullPage} />;\n }\n if (redirectResult.status === \"unknown-error\") {\n return <PredefinedMessageCard type=\"unknownError\" fullPage={props.fullPage} />;\n }\n return <MessageCard title=\"Redirecting...\" fullPage={props.fullPage} />;\n}\n\nexport function HexclaveHandlerClient(props: BaseHandlerProps & Partial<RouteProps> & { location?: string }) {\n // Use hooks to get app\n const hexclaveApp = useStackApp();\n const clientOrigin = useClientOriginAfterHydration();\n\n const navigate = hexclaveApp.useNavigate();\n const navigateRef = useRef(navigate);\n navigateRef.current = navigate;\n const currentLocation = props.location ?? (typeof window === \"undefined\" ? new URL(hexclaveApp.urls.handler, placeholderOrigin).pathname : window.location.pathname);\n const searchParamsSource = new URLSearchParams(typeof window === \"undefined\" ? \"\" : window.location.search);\n const redirectTargets: (string | undefined)[] = [];\n\n const { path, searchParams, handlerPath } = useMemo(() => {\n const handlerPath = new URL(hexclaveApp.urls.handler, 'http://example.com').pathname;\n const relativePath = currentLocation.startsWith(handlerPath)\n ? currentLocation.slice(handlerPath.length).replace(/^\\/+/, '')\n : currentLocation.replace(/^\\/+/, '');\n\n return {\n path: relativePath,\n searchParams: Object.fromEntries(searchParamsSource.entries()),\n handlerPath,\n };\n }, [currentLocation, searchParamsSource, hexclaveApp.urls.handler]);\n\n const getDefaultUnknownPathUrl = (unknownPath: string): string | null => {\n return resolveUnknownHandlerPathFallbackUrl({\n defaultTarget: hexclaveApp[hexclaveAppInternalsSymbol].getConstructorOptions().urls?.default,\n projectId: hexclaveApp.projectId,\n unknownPath,\n });\n };\n\n const shouldRedirectToPage = (name: keyof HandlerUrls): boolean => {\n const url = hexclaveApp.urls[name];\n const isCrossDomainLocalOauthCallback = name === \"oauthCallback\" && searchParams.hexclave_cross_domain_auth === \"1\";\n if (isCrossDomainLocalOauthCallback) {\n return false;\n }\n return !isLocalHandlerUrlTarget({\n targetUrl: url,\n handlerPath,\n currentOrigin: clientOrigin,\n });\n };\n\n const result = renderComponent({\n path,\n searchParams,\n fullPage: props.fullPage,\n componentProps: props.componentProps,\n shouldRedirectToPage,\n getDefaultUnknownPathUrl,\n onNotFound: () =>\n (\n <MessageCard\n title=\"Page does not exist\"\n fullPage={props.fullPage}\n primaryButtonText=\"Go to Home\"\n primaryAction={() => hexclaveApp.redirectToHome()}\n >\n The page you are looking for could not be found. Please check the URL and try again.\n </MessageCard>\n )\n ,\n app: hexclaveApp,\n });\n\n const redirectToPage = (result != null && typeof result === 'object' && 'redirectToPage' in result) ? result.redirectToPage : undefined;\n\n if (redirectToPage != null) {\n return (\n <Suspense fallback={<MessageCard title=\"Redirecting...\" fullPage={props.fullPage} />}>\n <RedirectToPage app={hexclaveApp} redirectToPage={redirectToPage} fullPage={props.fullPage} />\n </Suspense>\n );\n }\n\n if (result && 'redirect' in result) {\n redirectTargets.push(result.redirect);\n }\n\n const redirectTarget = redirectTargets[0];\n const shouldRenderRedirectFallback = redirectTarget != null && hexclaveApp[hexclaveAppInternalsSymbol].getRedirectMethod() === \"none\";\n useEffect(() => {\n if (redirectTarget == null || shouldRenderRedirectFallback) {\n return;\n }\n navigateRef.current(redirectTarget);\n }, [redirectTarget, shouldRenderRedirectFallback]);\n\n if (redirectTarget != null && shouldRenderRedirectFallback) {\n return (\n <MessageCard\n title=\"Continue\"\n fullPage={props.fullPage}\n primaryButtonText=\"Continue\"\n primaryAction={() => window.location.assign(redirectTarget)}\n >\n Continue to the next page.\n </MessageCard>\n );\n }\n\n if (redirectTarget != null) {\n return null;\n }\n\n return result;\n}\n\n// filter undefined values in object. if object itself is undefined, return undefined\nfunction filterUndefinedINU<T extends {}>(value: T | undefined): FilterUndefined<T> | undefined {\n return value === undefined ? value : filterUndefined(value);\n}\n\nfunction toAbsoluteOrRelativeRedirectTarget(url: URL): string {\n return url.origin === \"http://example.com\" ? getRelativePart(url) : url.toString();\n}\n\nfunction useClientOriginAfterHydration(): string | undefined {\n // The first hydrated render must match SSR. After hydration, React re-checks\n // the snapshot and lets us distinguish same-path cross-origin handler URLs.\n return useSyncExternalStore(\n () => () => {},\n () => window.location.origin,\n () => undefined,\n );\n}\n"],"mappings":";;;;;;;;;;;;;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EACA,UAAU,MAAM;EAChB,gBAAgB,MAAM;EACtB;EACA;EACA,kBAEI,oBAACD;GACC,OAAM;GACN,UAAU,MAAM;GAChB,mBAAkB;GAClB,qBAAqB,YAAY,gBAAgB;aAClD;IAEa;EAGlB,KAAK;EACN,CAAC;CAEF,MAAM,iBAAkB,UAAU,QAAQ,OAAO,WAAW,YAAY,oBAAoB,SAAU,OAAO,iBAAiB;AAE9H,KAAI,kBAAkB,KACpB,QACE,oBAAC;EAAS,UAAU,oBAACA;GAAY,OAAM;GAAiB,UAAU,MAAM;IAAY;YAClF,oBAAC;GAAe,KAAK;GAA6B;GAAgB,UAAU,MAAM;IAAY;GACrF;AAIf,KAAI,UAAU,cAAc,OAC1B,iBAAgB,KAAK,OAAO,SAAS;CAGvC,MAAM,iBAAiB,gBAAgB;CACvC,MAAM,+BAA+B,kBAAkB,QAAQ,YAAY,4BAA4B,mBAAmB,KAAK;AAC/H,iBAAgB;AACd,MAAI,kBAAkB,QAAQ,6BAC5B;AAEF,cAAY,QAAQ,eAAe;IAClC,CAAC,gBAAgB,6BAA6B,CAAC;AAElD,KAAI,kBAAkB,QAAQ,6BAC5B,QACE,oBAACA;EACC,OAAM;EACN,UAAU,MAAM;EAChB,mBAAkB;EAClB,qBAAqB,OAAO,SAAS,OAAO,eAAe;YAC5D;GAEa;AAIlB,KAAI,kBAAkB,KACpB,QAAO;AAGT,QAAO;;AAIT,SAAS,mBAAiC,OAAsD;AAC9F,QAAO,UAAU,SAAY,QAAQ,gBAAgB,MAAM;;AAG7D,SAAS,mCAAmC,KAAkB;AAC5D,QAAO,IAAI,WAAW,uBAAuB,gBAAgB,IAAI,GAAG,IAAI,UAAU;;AAGpF,SAAS,gCAAoD;AAG3D,QAAO,iCACO,UACN,OAAO,SAAS,cAChB,OACP"}
|
|
1
|
+
{"version":3,"file":"hexclave-handler-client.js","names":["MessageCard","useStackApp"],"sources":["../../../src/components-page/hexclave-handler-client.tsx"],"sourcesContent":["\"use client\";\n\n\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY UNLESS YOU ALSO EDIT THE CORRESPONDING FILE IN packages/template\n//===========================================\n\nimport { KnownError } from \"@hexclave/shared\";\nimport { captureError, HexclaveAssertionError } from \"@hexclave/shared/dist/utils/errors\";\nimport { FilterUndefined, filterUndefined } from \"@hexclave/shared/dist/utils/objects\";\nimport { use } from \"@hexclave/shared/dist/utils/react\";\nimport { getRelativePart } from \"@hexclave/shared/dist/utils/urls\";\nimport { Suspense, useMemo, useSyncExternalStore } from 'react';\nimport { useEffect, useRef } from 'react';\nimport { SignIn, SignUp, StackServerApp } from \"..\";\nimport { useStackApp } from \"../lib/hooks\";\nimport { HandlerUrls, StackClientApp, hexclaveAppInternalsSymbol } from \"../lib/hexclave-app\";\nimport { isLocalHandlerUrlTarget, resolveUnknownHandlerPathFallbackUrl } from \"../lib/hexclave-app/url-targets\";\nimport { AccountSettings } from \"./account-settings\";\nimport { CliAuthConfirmation } from \"./cli-auth-confirm\";\nimport { EmailVerification } from \"./email-verification\";\nimport { ErrorPage } from \"./error-page\";\nimport { ForgotPassword } from \"./forgot-password\";\nimport { MagicLinkCallback } from \"./magic-link-callback\";\nimport { MFA } from \"./mfa\";\nimport { OAuthCallback } from \"./oauth-callback\";\nimport { Onboarding } from \"./onboarding\";\nimport { PasswordReset } from \"./password-reset\";\nimport { SignOut } from \"./sign-out\";\nimport { TeamInvitation } from \"./team-invitation\";\n\nimport { KnownErrorMessageCard } from \"../components/message-cards/known-error-message-card\";\nimport { MessageCard } from \"../components/message-cards/message-card\";\nimport { PredefinedMessageCard } from \"../components/message-cards/predefined-message-card\";\n\ntype Components = {\n SignIn: typeof SignIn,\n SignUp: typeof SignUp,\n EmailVerification: typeof EmailVerification,\n PasswordReset: typeof PasswordReset,\n ForgotPassword: typeof ForgotPassword,\n SignOut: typeof SignOut,\n OAuthCallback: typeof OAuthCallback,\n MagicLinkCallback: typeof MagicLinkCallback,\n TeamInvitation: typeof TeamInvitation,\n ErrorPage: typeof ErrorPage,\n AccountSettings: typeof AccountSettings,\n CliAuthConfirmation: typeof CliAuthConfirmation,\n MFA: typeof MFA,\n Onboarding: typeof Onboarding,\n};\n\ntype RouteProps = {\n params: Promise<{ stack?: string[] }> | { stack?: string[] },\n searchParams: Promise<Record<string, string>> | Record<string, string>,\n};\n\ntype RedirectToPageResult =\n | { status: \"success\" }\n | { status: \"known-error\", error: KnownError }\n | { status: \"unknown-error\" };\n\nconst availablePaths = {\n signIn: 'sign-in',\n signUp: 'sign-up',\n emailVerification: 'email-verification',\n passwordReset: 'password-reset',\n forgotPassword: 'forgot-password',\n signOut: 'sign-out',\n oauthCallback: 'oauth-callback',\n magicLinkCallback: 'magic-link-callback',\n teamInvitation: 'team-invitation',\n accountSettings: 'account-settings',\n cliAuthConfirm: 'cli-auth-confirm',\n mfa: 'mfa',\n error: 'error',\n onboarding: 'onboarding',\n} as const;\n\nconst placeholderOrigin = \"http://example.com\";\n\nconst pathAliases = {\n // also includes the uppercase and non-dashed versions\n ...Object.fromEntries(Object.entries(availablePaths).map(([key, value]) => [value, value])),\n \"log-in\": availablePaths.signIn,\n \"register\": availablePaths.signUp,\n} as const;\n\nexport type BaseHandlerProps = {\n fullPage: boolean,\n componentProps?: {\n [K in keyof Components]?: Parameters<Components[K]>[0];\n },\n};\n\nfunction renderComponent(props: {\n path: string,\n searchParams: Record<string, string>,\n fullPage: boolean,\n componentProps?: BaseHandlerProps['componentProps'],\n shouldRedirectToPage?: (name: keyof HandlerUrls) => boolean,\n getDefaultUnknownPathUrl?: (path: string) => string | null,\n onNotFound: () => any,\n app: StackClientApp<any> | StackServerApp<any>,\n}) {\n const { path, searchParams, fullPage, componentProps, shouldRedirectToPage, getDefaultUnknownPathUrl, onNotFound, app } = props;\n\n switch (path) {\n case availablePaths.signIn: {\n if (shouldRedirectToPage?.('signIn')) return { redirectToPage: 'signIn' as const };\n return <SignIn\n fullPage={fullPage}\n automaticRedirect\n {...filterUndefinedINU(componentProps?.SignIn)}\n />;\n }\n case availablePaths.signUp: {\n if (shouldRedirectToPage?.('signUp')) return { redirectToPage: 'signUp' as const };\n return <SignUp\n fullPage={fullPage}\n automaticRedirect\n {...filterUndefinedINU(componentProps?.SignUp)}\n />;\n }\n case availablePaths.emailVerification: {\n if (shouldRedirectToPage?.('emailVerification')) return { redirectToPage: 'emailVerification' as const };\n return <EmailVerification\n searchParams={searchParams}\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.EmailVerification)}\n />;\n }\n case availablePaths.passwordReset: {\n if (shouldRedirectToPage?.('passwordReset')) return { redirectToPage: 'passwordReset' as const };\n return <PasswordReset\n searchParams={searchParams}\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.PasswordReset)}\n />;\n }\n case availablePaths.forgotPassword: {\n if (shouldRedirectToPage?.('forgotPassword')) return { redirectToPage: 'forgotPassword' as const };\n return <ForgotPassword\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.ForgotPassword)}\n />;\n }\n case availablePaths.signOut: {\n if (shouldRedirectToPage?.('signOut')) return { redirectToPage: 'signOut' as const };\n return <SignOut\n searchParams={searchParams}\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.SignOut)}\n />;\n }\n case availablePaths.oauthCallback: {\n if (shouldRedirectToPage?.('oauthCallback')) return { redirectToPage: 'oauthCallback' as const };\n return <OAuthCallback\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.OAuthCallback)}\n />;\n }\n case availablePaths.magicLinkCallback: {\n if (shouldRedirectToPage?.('magicLinkCallback')) return { redirectToPage: 'magicLinkCallback' as const };\n return <MagicLinkCallback\n searchParams={searchParams}\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.MagicLinkCallback)}\n />;\n }\n case availablePaths.teamInvitation: {\n if (shouldRedirectToPage?.('teamInvitation')) return { redirectToPage: 'teamInvitation' as const };\n return <TeamInvitation\n searchParams={searchParams}\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.TeamInvitation)}\n />;\n }\n case availablePaths.accountSettings: {\n return <AccountSettings\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.AccountSettings)}\n />;\n }\n case availablePaths.error: {\n return <ErrorPage\n searchParams={searchParams}\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.ErrorPage)}\n />;\n }\n case availablePaths.cliAuthConfirm: {\n if (shouldRedirectToPage?.('cliAuthConfirm')) return { redirectToPage: 'cliAuthConfirm' as const };\n return <CliAuthConfirmation\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.CliAuthConfirmation)}\n />;\n }\n case availablePaths.mfa: {\n if (shouldRedirectToPage?.('mfa')) return { redirectToPage: 'mfa' as const };\n return <MFA\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.MFA)}\n />;\n }\n case availablePaths.onboarding: {\n if (shouldRedirectToPage?.('onboarding')) return { redirectToPage: 'onboarding' as const };\n return <Onboarding\n fullPage={fullPage}\n {...filterUndefinedINU(componentProps?.Onboarding)}\n />;\n }\n default: {\n if (Object.values(availablePaths).includes(path as any)) {\n throw new HexclaveAssertionError(`Path alias ${path} not included in switch statement, but in availablePaths?`, { availablePaths });\n }\n for (const [key, value] of Object.entries(pathAliases)) {\n if (path.toLowerCase().replaceAll('-', '') === key.toLowerCase().replaceAll('-', '')) {\n const redirectUrl = `${app[hexclaveAppInternalsSymbol].getUrls().handler}/${value}?${new URLSearchParams(searchParams).toString()}`;\n return { redirect: redirectUrl };\n }\n }\n const defaultUnknownPathUrl = getDefaultUnknownPathUrl?.(path);\n if (defaultUnknownPathUrl != null) {\n const defaultUnknownPathUrlObject = new URL(defaultUnknownPathUrl, \"http://example.com\");\n for (const [key, value] of Object.entries(searchParams)) {\n defaultUnknownPathUrlObject.searchParams.set(key, value);\n }\n return { redirect: toAbsoluteOrRelativeRedirectTarget(defaultUnknownPathUrlObject) };\n }\n return onNotFound();\n }\n }\n}\n\nexport async function getRedirectToPageResult(\n app: StackClientApp,\n redirectToPage: keyof HandlerUrls,\n): Promise<RedirectToPageResult> {\n try {\n await app[hexclaveAppInternalsSymbol].redirectToHandler(redirectToPage, { replace: true });\n return { status: \"success\" };\n } catch (e) {\n if (KnownError.isKnownError(e)) {\n return { status: \"known-error\", error: e };\n }\n captureError(\"<HexclaveHandlerClient redirectToPage />\", e);\n return { status: \"unknown-error\" };\n }\n}\n\nfunction RedirectToPage(props: {\n app: StackClientApp,\n fullPage?: boolean,\n redirectToPage: keyof HandlerUrls,\n}) {\n const redirectResultPromise = useMemo(\n () => getRedirectToPageResult(props.app, props.redirectToPage),\n [props.app, props.redirectToPage],\n );\n\n const redirectResult = use(redirectResultPromise);\n if (redirectResult.status === \"known-error\") {\n return <KnownErrorMessageCard error={redirectResult.error} fullPage={props.fullPage} />;\n }\n if (redirectResult.status === \"unknown-error\") {\n return <PredefinedMessageCard type=\"unknownError\" fullPage={props.fullPage} />;\n }\n return <MessageCard title=\"Redirecting...\" fullPage={props.fullPage} />;\n}\n\nexport function HexclaveHandlerClient(props: BaseHandlerProps & Partial<RouteProps> & { location?: string }) {\n // Use hooks to get app\n const hexclaveApp = useStackApp();\n const handlerUrls = hexclaveApp[hexclaveAppInternalsSymbol].getUrls();\n const clientOrigin = useClientOriginAfterHydration();\n\n const navigate = hexclaveApp.useNavigate();\n const navigateRef = useRef(navigate);\n navigateRef.current = navigate;\n const currentLocation = props.location ?? (typeof window === \"undefined\" ? new URL(handlerUrls.handler, placeholderOrigin).pathname : window.location.pathname);\n const searchParamsSource = new URLSearchParams(typeof window === \"undefined\" ? \"\" : window.location.search);\n const redirectTargets: (string | undefined)[] = [];\n\n const { path, searchParams, handlerPath } = useMemo(() => {\n const handlerPath = new URL(handlerUrls.handler, 'http://example.com').pathname;\n const relativePath = currentLocation.startsWith(handlerPath)\n ? currentLocation.slice(handlerPath.length).replace(/^\\/+/, '')\n : currentLocation.replace(/^\\/+/, '');\n\n return {\n path: relativePath,\n searchParams: Object.fromEntries(searchParamsSource.entries()),\n handlerPath,\n };\n }, [currentLocation, searchParamsSource, handlerUrls.handler]);\n\n const getDefaultUnknownPathUrl = (unknownPath: string): string | null => {\n return resolveUnknownHandlerPathFallbackUrl({\n defaultTarget: hexclaveApp[hexclaveAppInternalsSymbol].getConstructorOptions().urls?.default,\n projectId: hexclaveApp.projectId,\n unknownPath,\n });\n };\n\n const shouldRedirectToPage = (name: keyof HandlerUrls): boolean => {\n const url = handlerUrls[name];\n const isCrossDomainLocalOauthCallback = name === \"oauthCallback\" && searchParams.hexclave_cross_domain_auth === \"1\";\n if (isCrossDomainLocalOauthCallback) {\n return false;\n }\n return !isLocalHandlerUrlTarget({\n targetUrl: url,\n handlerPath,\n currentOrigin: clientOrigin,\n });\n };\n\n const result = renderComponent({\n path,\n searchParams,\n fullPage: props.fullPage,\n componentProps: props.componentProps,\n shouldRedirectToPage,\n getDefaultUnknownPathUrl,\n onNotFound: () =>\n (\n <MessageCard\n title=\"Page does not exist\"\n fullPage={props.fullPage}\n primaryButtonText=\"Go to Home\"\n primaryAction={() => hexclaveApp.redirectToHome()}\n >\n The page you are looking for could not be found. Please check the URL and try again.\n </MessageCard>\n )\n ,\n app: hexclaveApp,\n });\n\n const redirectToPage = (result != null && typeof result === 'object' && 'redirectToPage' in result) ? result.redirectToPage : undefined;\n\n if (redirectToPage != null) {\n return (\n <Suspense fallback={<MessageCard title=\"Redirecting...\" fullPage={props.fullPage} />}>\n <RedirectToPage app={hexclaveApp} redirectToPage={redirectToPage} fullPage={props.fullPage} />\n </Suspense>\n );\n }\n\n if (result && 'redirect' in result) {\n redirectTargets.push(result.redirect);\n }\n\n const redirectTarget = redirectTargets[0];\n const shouldRenderRedirectFallback = redirectTarget != null && hexclaveApp[hexclaveAppInternalsSymbol].getRedirectMethod() === \"none\";\n useEffect(() => {\n if (redirectTarget == null || shouldRenderRedirectFallback) {\n return;\n }\n navigateRef.current(redirectTarget);\n }, [redirectTarget, shouldRenderRedirectFallback]);\n\n if (redirectTarget != null && shouldRenderRedirectFallback) {\n return (\n <MessageCard\n title=\"Continue\"\n fullPage={props.fullPage}\n primaryButtonText=\"Continue\"\n primaryAction={() => window.location.assign(redirectTarget)}\n >\n Continue to the next page.\n </MessageCard>\n );\n }\n\n if (redirectTarget != null) {\n return null;\n }\n\n return result;\n}\n\n// filter undefined values in object. if object itself is undefined, return undefined\nfunction filterUndefinedINU<T extends {}>(value: T | undefined): FilterUndefined<T> | undefined {\n return value === undefined ? value : filterUndefined(value);\n}\n\nfunction toAbsoluteOrRelativeRedirectTarget(url: URL): string {\n return url.origin === \"http://example.com\" ? getRelativePart(url) : url.toString();\n}\n\nfunction useClientOriginAfterHydration(): string | undefined {\n // The first hydrated render must match SSR. After hydration, React re-checks\n // the snapshot and lets us distinguish same-path cross-origin handler URLs.\n return useSyncExternalStore(\n () => () => {},\n () => window.location.origin,\n () => undefined,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,MAAM,iBAAiB;CACrB,QAAQ;CACR,QAAQ;CACR,mBAAmB;CACnB,eAAe;CACf,gBAAgB;CAChB,SAAS;CACT,eAAe;CACf,mBAAmB;CACnB,gBAAgB;CAChB,iBAAiB;CACjB,gBAAgB;CAChB,KAAK;CACL,OAAO;CACP,YAAY;CACb;AAED,MAAM,oBAAoB;AAE1B,MAAM,cAAc;CAElB,GAAG,OAAO,YAAY,OAAO,QAAQ,eAAe,CAAC,KAAK,CAAC,KAAK,WAAW,CAAC,OAAO,MAAM,CAAC,CAAC;CAC3F,UAAU,eAAe;CACzB,YAAY,eAAe;CAC5B;AASD,SAAS,gBAAgB,OAStB;CACD,MAAM,EAAE,MAAM,cAAc,UAAU,gBAAgB,sBAAsB,0BAA0B,YAAY,QAAQ;AAE1H,SAAQ,MAAR;EACE,KAAK,eAAe;AAClB,OAAI,uBAAuB,SAAS,CAAE,QAAO,EAAE,gBAAgB,UAAmB;AAClF,UAAO,oBAAC;IACI;IACV;IACA,GAAI,mBAAmB,gBAAgB,OAAO;KAC9C;EAEJ,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gBAAgB,6BAA6B,CAAC;AAElD,KAAI,kBAAkB,QAAQ,6BAC5B,QACE,oBAACA;EACC,OAAM;EACN,UAAU,MAAM;EAChB,mBAAkB;EAClB,qBAAqB,OAAO,SAAS,OAAO,eAAe;YAC5D;GAEa;AAIlB,KAAI,kBAAkB,KACpB,QAAO;AAGT,QAAO;;AAIT,SAAS,mBAAiC,OAAsD;AAC9F,QAAO,UAAU,SAAY,QAAQ,gBAAgB,MAAM;;AAG7D,SAAS,mCAAmC,KAAkB;AAC5D,QAAO,IAAI,WAAW,uBAAuB,gBAAgB,IAAI,GAAG,IAAI,UAAU;;AAGpF,SAAS,gCAAoD;AAG3D,QAAO,iCACO,UACN,OAAO,SAAS,cAChB,OACP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-tool-core.d.ts","names":[],"sources":["../../../src/dev-tool/dev-tool-core.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"dev-tool-core.d.ts","names":[],"sources":["../../../src/dev-tool/dev-tool-core.ts"],"mappings":";;;iBA4tEgB,aAAA,CAAc,GAAA,EAAK,cAAA"}
|
|
@@ -502,14 +502,6 @@ function createOverviewTab(app) {
|
|
|
502
502
|
className: "sdt-ov-toast",
|
|
503
503
|
style: { display: "none" }
|
|
504
504
|
});
|
|
505
|
-
const emailRow = h("div", { className: "sdt-ov-email-input" });
|
|
506
|
-
const emailInput = h("input", {
|
|
507
|
-
type: "email",
|
|
508
|
-
placeholder: "Sign in as email…"
|
|
509
|
-
});
|
|
510
|
-
const emailBtn = h("button", null);
|
|
511
|
-
setHtml(emailBtn, "<svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/><polyline points=\"12 5 19 12 12 19\"/></svg>");
|
|
512
|
-
emailRow.append(emailInput, emailBtn);
|
|
513
505
|
function isBestEffortOverviewError(error) {
|
|
514
506
|
if (error instanceof DOMException && error.name === "AbortError") return true;
|
|
515
507
|
if (error instanceof TypeError) return true;
|
|
@@ -561,15 +553,13 @@ function createOverviewTab(app) {
|
|
|
561
553
|
});
|
|
562
554
|
actions.append(signOutBtn, randomBtn);
|
|
563
555
|
} else {
|
|
564
|
-
const quickBtn = h("button", { className: "sdt-ov-btn sdt-ov-btn-primary sdt-ov-btn-wide" }, loading ? "Working…" : "Quick Sign
|
|
556
|
+
const quickBtn = h("button", { className: "sdt-ov-btn sdt-ov-btn-primary sdt-ov-btn-wide" }, loading ? "Working…" : "Quick Sign Up");
|
|
565
557
|
quickBtn.disabled = loading;
|
|
566
558
|
quickBtn.addEventListener("click", () => {
|
|
567
559
|
runAsynchronously(doQuickSignIn());
|
|
568
560
|
});
|
|
569
561
|
actions.appendChild(quickBtn);
|
|
570
562
|
}
|
|
571
|
-
emailInput.placeholder = currentUser ? "Switch to email…" : "Sign in as email…";
|
|
572
|
-
actions.appendChild(emailRow);
|
|
573
563
|
}
|
|
574
564
|
async function doQuickSignIn() {
|
|
575
565
|
if (!isLocalhost(window.location.href)) {
|
|
@@ -604,60 +594,6 @@ function createOverviewTab(app) {
|
|
|
604
594
|
loading = false;
|
|
605
595
|
await refreshUser();
|
|
606
596
|
}
|
|
607
|
-
async function doSignInAs(targetEmail) {
|
|
608
|
-
if (!targetEmail.trim()) return;
|
|
609
|
-
if (!isLocalhost(window.location.href)) {
|
|
610
|
-
showToast("Quick sign-in is only available on localhost", "error");
|
|
611
|
-
return;
|
|
612
|
-
}
|
|
613
|
-
loading = true;
|
|
614
|
-
rebuildActions();
|
|
615
|
-
const trimmed = targetEmail.trim();
|
|
616
|
-
try {
|
|
617
|
-
if ((await app.signInWithCredential({
|
|
618
|
-
email: trimmed,
|
|
619
|
-
password: trimmed,
|
|
620
|
-
noRedirect: true
|
|
621
|
-
})).status === "ok") {
|
|
622
|
-
showToast(`Signed in as ${trimmed}`, "success");
|
|
623
|
-
emailInput.value = "";
|
|
624
|
-
loading = false;
|
|
625
|
-
await refreshUser();
|
|
626
|
-
return;
|
|
627
|
-
}
|
|
628
|
-
const signUpResult = await app.signUpWithCredential({
|
|
629
|
-
email: trimmed,
|
|
630
|
-
password: trimmed,
|
|
631
|
-
noRedirect: true
|
|
632
|
-
});
|
|
633
|
-
if (signUpResult.status === "error") {
|
|
634
|
-
showToast(`Failed: ${signUpResult.error.message}`, "error");
|
|
635
|
-
loading = false;
|
|
636
|
-
rebuildActions();
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
const retryResult = await app.signInWithCredential({
|
|
640
|
-
email: trimmed,
|
|
641
|
-
password: trimmed,
|
|
642
|
-
noRedirect: true
|
|
643
|
-
});
|
|
644
|
-
if (retryResult.status === "error") showToast(`Sign in failed: ${retryResult.error.message}`, "error");
|
|
645
|
-
else {
|
|
646
|
-
showToast(`Signed in as ${trimmed}`, "success");
|
|
647
|
-
emailInput.value = "";
|
|
648
|
-
}
|
|
649
|
-
} catch (e) {
|
|
650
|
-
showToast(e.message || "Unknown error", "error");
|
|
651
|
-
}
|
|
652
|
-
loading = false;
|
|
653
|
-
await refreshUser();
|
|
654
|
-
}
|
|
655
|
-
emailBtn.addEventListener("click", () => {
|
|
656
|
-
runAsynchronously(doSignInAs(emailInput.value));
|
|
657
|
-
});
|
|
658
|
-
emailInput.addEventListener("keydown", (e) => {
|
|
659
|
-
if (e.key === "Enter") runAsynchronously(doSignInAs(emailInput.value));
|
|
660
|
-
});
|
|
661
597
|
heroCard.append(actions, toast);
|
|
662
598
|
const methodsCard = h("div", { className: "sdt-ov-card sdt-ov-card-auth" });
|
|
663
599
|
methodsCard.appendChild(h("div", { className: "sdt-ov-label" }, "Auth Methods"));
|
|
@@ -728,7 +664,7 @@ function createOverviewTab(app) {
|
|
|
728
664
|
hasPersistentTokenStore ? {
|
|
729
665
|
ok: !!currentUser,
|
|
730
666
|
label: "Sign in a test user",
|
|
731
|
-
hint: "Use “Quick Sign
|
|
667
|
+
hint: "Use “Quick Sign Up” above →"
|
|
732
668
|
} : {
|
|
733
669
|
ok: true,
|
|
734
670
|
label: "Current-user tools unavailable",
|
|
@@ -790,7 +726,7 @@ function createOverviewTab(app) {
|
|
|
790
726
|
avatar.className = "sdt-ov-avatar sdt-ov-avatar-active";
|
|
791
727
|
if (currentUser.profileImageUrl) avatar.innerHTML = `<img src="${escapeHtml(currentUser.profileImageUrl)}" alt="" />`;
|
|
792
728
|
else avatar.textContent = initials;
|
|
793
|
-
userName.textContent = currentUser.displayName || "
|
|
729
|
+
userName.textContent = currentUser.displayName || "(No display name)";
|
|
794
730
|
userEmail.textContent = currentUser.primaryEmail || "No email";
|
|
795
731
|
authIndicator.style.display = "";
|
|
796
732
|
} else {
|
|
@@ -1655,7 +1591,7 @@ function createSupportTab(app) {
|
|
|
1655
1591
|
function createComponentsTab(app) {
|
|
1656
1592
|
const container = h("div", { className: "sdt-pg-layout" });
|
|
1657
1593
|
const apiBaseUrl = resolveApiBaseUrl(app);
|
|
1658
|
-
const urls = app.
|
|
1594
|
+
const urls = app[hexclaveAppInternalsSymbol].getUrls();
|
|
1659
1595
|
const urlOptions = app[hexclaveAppInternalsSymbol].getConstructorOptions().urls ?? {};
|
|
1660
1596
|
const PAGE_ENTRIES = [
|
|
1661
1597
|
{
|