@orangecheck/auth-client 2.22.0 → 2.23.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.
package/dist/index.mjs CHANGED
@@ -1998,15 +1998,27 @@ var primaryChipStyle = {
1998
1998
  color: V.primary,
1999
1999
  border: `1px solid ${V.primary}`
2000
2000
  };
2001
+ function isSameOriginPath(candidate, origin) {
2002
+ try {
2003
+ return new URL(candidate, origin).origin === origin;
2004
+ } catch {
2005
+ return false;
2006
+ }
2007
+ }
2008
+ function resolutionOrigin() {
2009
+ return typeof window === "undefined" ? "https://ochk.io" : window.location.origin;
2010
+ }
2001
2011
  function safeReturnTo(input) {
2002
2012
  const candidate = input ?? "/";
2003
2013
  if (typeof candidate !== "string") return "/";
2004
- if (!candidate.startsWith("/") || candidate.startsWith("//")) return "/";
2005
- return candidate;
2014
+ if (!candidate.startsWith("/")) return "/";
2015
+ return isSameOriginPath(candidate, resolutionOrigin()) ? candidate : "/";
2006
2016
  }
2007
2017
  function familyReturnTarget(input) {
2008
2018
  if (typeof input !== "string" || input.length === 0) return void 0;
2009
- if (input.startsWith("/") && !input.startsWith("//")) return input;
2019
+ if (input.startsWith("/") && isSameOriginPath(input, resolutionOrigin())) {
2020
+ return input;
2021
+ }
2010
2022
  try {
2011
2023
  const u = new URL(input);
2012
2024
  if (u.protocol !== "https:") return void 0;
@@ -2375,6 +2387,8 @@ function ProviderSignIn({
2375
2387
  if (providers.length === 0) return null;
2376
2388
  const providerReturnTo = returnTo.startsWith("/") ? origin ? `${origin}${returnTo}` : returnTo : returnTo;
2377
2389
  const line = { flex: 1, height: 1, background: "var(--border, #27272a)" };
2390
+ const BLOCK_GAP = 16;
2391
+ const BUTTON_GAP = 8;
2378
2392
  const divider = /* @__PURE__ */ jsxs(
2379
2393
  "div",
2380
2394
  {
@@ -2382,7 +2396,10 @@ function ProviderSignIn({
2382
2396
  display: "flex",
2383
2397
  alignItems: "center",
2384
2398
  gap: 10,
2385
- margin: first ? "14px 0 4px" : "4px 0 12px",
2399
+ // Symmetric in both orderings: in `first` mode the divider
2400
+ // owns the gap on both sides; at the bottom the container's
2401
+ // marginTop owns the gap above, so the divider only pads below.
2402
+ margin: first ? `${BLOCK_GAP}px 0` : `0 0 ${BLOCK_GAP}px`,
2386
2403
  color: "var(--muted-foreground, #a1a1aa)",
2387
2404
  fontFamily: "ui-monospace, SFMono-Regular, monospace",
2388
2405
  fontSize: 10,
@@ -2410,7 +2427,7 @@ function ProviderSignIn({
2410
2427
  gap: 10,
2411
2428
  boxSizing: "border-box",
2412
2429
  width: "100%",
2413
- marginTop: i === 0 ? 0 : 8,
2430
+ marginTop: i === 0 ? 0 : BUTTON_GAP,
2414
2431
  padding: "0.6rem 0.875rem",
2415
2432
  border: "1px solid var(--border, #27272a)",
2416
2433
  borderRadius: 6,
@@ -2427,13 +2444,20 @@ function ProviderSignIn({
2427
2444
  },
2428
2445
  p.id
2429
2446
  ));
2430
- return /* @__PURE__ */ jsx("div", { "data-oc-signin-providers": "", style: first ? { marginBottom: 4 } : { marginTop: 20 }, children: first ? /* @__PURE__ */ jsxs(Fragment, { children: [
2431
- buttons,
2432
- divider
2433
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2434
- divider,
2435
- buttons
2436
- ] }) });
2447
+ return /* @__PURE__ */ jsx(
2448
+ "div",
2449
+ {
2450
+ "data-oc-signin-providers": "",
2451
+ style: first ? { marginBottom: 0 } : { marginTop: BLOCK_GAP },
2452
+ children: first ? /* @__PURE__ */ jsxs(Fragment, { children: [
2453
+ buttons,
2454
+ divider
2455
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2456
+ divider,
2457
+ buttons
2458
+ ] })
2459
+ }
2460
+ );
2437
2461
  }
2438
2462
  function WalletFlow({ authOrigin, audience, add, onSuccess }) {
2439
2463
  const [address, setAddress] = React3.useState("");
@@ -3088,6 +3112,6 @@ function handleSudoRequired(body, args = {}) {
3088
3112
  return false;
3089
3113
  }
3090
3114
 
3091
- export { DEFAULT_CONFIG, DISPLAY_IDENTITY_KINDS, OcAccountChip, OcAccountPill, OcAddressInput, OcLinkedIdentities, OcSessionProvider, OcSignIn, OcSignInButton, TAB_ACCOUNT_HINT_KEY, TAB_ADOPT_HASH, TAB_SESSION_HEADER, TAB_SESSION_STORAGE_KEY, buildAddAccountUrl, buildSignInUrl, clearTabSession, consumeTabAccountHint, consumeTabAdoptMarker, fetchOcLinkedIdentities, handleSudoRequired, installTabFetchInterceptor, installTabLinkDecorator, readTabSession, redirectToSudo, tabSessionHeader, useOcAddressSuggestion, useOcSession, useOptionalOcSession, useStepUpAuth, useWebAuthnList, useWebAuthnRegister, writeTabSession };
3115
+ export { DEFAULT_CONFIG, DISPLAY_IDENTITY_KINDS, OcAccountChip, OcAccountPill, OcAddressInput, OcLinkedIdentities, OcSessionProvider, OcSignIn, OcSignInButton, TAB_ACCOUNT_HINT_KEY, TAB_ADOPT_HASH, TAB_SESSION_HEADER, TAB_SESSION_STORAGE_KEY, buildAddAccountUrl, buildSignInUrl, clearTabSession, consumeTabAccountHint, consumeTabAdoptMarker, familyReturnTarget, fetchOcLinkedIdentities, handleSudoRequired, installTabFetchInterceptor, installTabLinkDecorator, readTabSession, redirectToSudo, safeReturnTo, tabSessionHeader, useOcAddressSuggestion, useOcSession, useOptionalOcSession, useStepUpAuth, useWebAuthnList, useWebAuthnRegister, writeTabSession };
3092
3116
  //# sourceMappingURL=index.mjs.map
3093
3117
  //# sourceMappingURL=index.mjs.map