@the-portland-company/shell 0.36.1 → 0.36.3

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.
@@ -2688,6 +2688,7 @@ function watchLogout(onLogout, options = {}) {
2688
2688
  return cleanup;
2689
2689
  }
2690
2690
  var CORE_APP = "vrm";
2691
+ var DEFAULT_SIGN_OUT_URL = "/auth/signout";
2691
2692
  var POLITOGY_APPS = {
2692
2693
  vrm: { title: "Politogy VRM", origin: "https://app.politogyvrm.com", storagePrefix: "vrm" },
2693
2694
  contacts: { title: "Contacts", origin: "https://contacts.politogyvrm.com", storagePrefix: "contacts" },
@@ -2715,6 +2716,7 @@ function PolitogyAppFrame({
2715
2716
  linkComponent,
2716
2717
  session,
2717
2718
  onSignOut,
2719
+ signOutUrl = DEFAULT_SIGN_OUT_URL,
2718
2720
  buildMeta,
2719
2721
  data,
2720
2722
  children
@@ -2742,6 +2744,7 @@ function PolitogyAppFrame({
2742
2744
  linkComponent,
2743
2745
  session,
2744
2746
  onSignOut,
2747
+ signOutUrl,
2745
2748
  buildMeta,
2746
2749
  data,
2747
2750
  children
@@ -2757,6 +2760,7 @@ function FrameBody({
2757
2760
  linkComponent,
2758
2761
  session,
2759
2762
  onSignOut,
2763
+ signOutUrl,
2760
2764
  buildMeta,
2761
2765
  data,
2762
2766
  children
@@ -2770,20 +2774,32 @@ function FrameBody({
2770
2774
  signingOutRef.current = true;
2771
2775
  broadcastLogout();
2772
2776
  signOutRef.current();
2773
- }, []);
2777
+ window.location.assign(signOutUrl);
2778
+ }, [signOutUrl]);
2774
2779
  react.useEffect(
2775
2780
  () => (
2776
- // A tab that learns of a sign-out elsewhere ends its OWN session properly
2777
- // (clear cookie, RP-initiated logout at the IdP) rather than merely
2778
- // navigating away — otherwise its session cookie would outlive the
2779
- // sign-out and a later visit would silently resume it. No re-broadcast:
2780
- // the signal that woke us is already on record for everyone.
2781
+ // A tab that learns of a sign-out elsewhere ends its own session for
2782
+ // real, by navigating to the same sign-out route.
2783
+ //
2784
+ // Measured against production before this landed: calling the app's
2785
+ // handler did nothing at all. Apps wire it as
2786
+ // `onSignOut={() => { void signOutAction(); }}` — a server action invoked
2787
+ // outside a transition, so the `redirect()` inside it can never be
2788
+ // applied by the client and the tab just sits there. Building cross-tab
2789
+ // logout on that path made the whole feature a no-op.
2790
+ //
2791
+ // A hard navigation cannot fail that way, and it hands the decision to
2792
+ // the authority rather than guessing: the app's middleware sees a session
2793
+ // whose auth_time predates `politogy_logout_at`, treats it as revoked,
2794
+ // and redirects to Politogy ID. Server-side truth decides; the client
2795
+ // only forces the request. No re-broadcast — the signal that woke us is
2796
+ // already on record for every tab.
2781
2797
  watchLogout(() => {
2782
2798
  if (signingOutRef.current) return;
2783
- signOutRef.current();
2799
+ window.location.assign(signOutUrl);
2784
2800
  })
2785
2801
  ),
2786
- []
2802
+ [signOutUrl]
2787
2803
  );
2788
2804
  const core = app === CORE_APP ? data?.core : void 0;
2789
2805
  const identity = useChromeIdentity({ userName: session.userName, email: session.email });