@capxul/sdk-react 4.2.0-rc.14 → 4.2.0-rc.15

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.
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "source": {
3
- "commit": "ad9386dd8d539fea17964d05292fc0ca16495d2f",
4
- "tree": "87b1723ed13d7be72487cbcbbfded24b0ac850e5",
3
+ "commit": "b2dff9052ea3f3a55dfca98530c02b4ac3bcfa96",
4
+ "tree": "9fc0a21bc2cb477c62dd9f5c44c4977d74548d94",
5
5
  "branch": "codex/programme-rc",
6
6
  "repository": "https://github.com/Xelmar-tech/infrastructure",
7
7
  "lockfileSha256": "5870f53b72706d103220c1bcf733cb4fb71196aea32a9cfbdc277d73cc959264"
8
8
  },
9
9
  "name": "@capxul/sdk-react",
10
- "version": "4.2.0-rc.14"
10
+ "version": "4.2.0-rc.15"
11
11
  }
@@ -37,6 +37,18 @@ function useCapxulClientOrNull() {
37
37
  }
38
38
  //#endregion
39
39
  //#region src/internal/reactivity-keys.ts
40
+ /**
41
+ * The account a read is answered FOR, as a key segment (#2007 R19).
42
+ *
43
+ * A read whose answer depends on who is asking belongs to the (scope, account)
44
+ * pair, not to the scope. Replacing one claimed account with another is not a
45
+ * state-label change, so nothing invalidates the cache for it; keying is what
46
+ * makes the new person miss rather than read the previous person's answer.
47
+ * `undefined` while no account is claimed — no such read may run then anyway.
48
+ */
49
+ function actingAccount(identity) {
50
+ return identity !== null && identity.phase === "authenticated" && identity.account.at === "claimed" ? identity.account.address : void 0;
51
+ }
40
52
  const capxulKeys = {
41
53
  root: ["capxul"],
42
54
  profile: ["capxul", "profile"],
@@ -80,11 +92,12 @@ const capxulKeys = {
80
92
  orgId ?? "pending",
81
93
  "permissions"
82
94
  ],
83
- orgMe: (orgId) => [
95
+ orgMe: (orgId, account) => [
84
96
  "capxul",
85
97
  "org",
86
98
  orgId ?? "pending",
87
- "me"
99
+ "me",
100
+ account ?? "pending"
88
101
  ],
89
102
  orgLifecycle: (orgId) => [
90
103
  "capxul",
@@ -950,4 +963,4 @@ function organizationForm(props, state, auth, submitted) {
950
963
  });
951
964
  }
952
965
  //#endregion
953
- export { useCapxulAuth as a, useCapxulIdentityOrNull as c, toInvocationControls as d, toInvocationOptions as f, useCapxul as h, entered as i, useCapxulSend as l, useCapxulClientOrNull as m, CapxulOnboardingController as n, useCapxulDestination as o, capxulKeys as p, CapxulProvider as r, useCapxulIdentity as s, CapxulAuthenticationController as t, useCapxulTransitions as u };
966
+ export { useCapxulAuth as a, useCapxulIdentityOrNull as c, toInvocationControls as d, toInvocationOptions as f, useCapxul as g, useCapxulClientOrNull as h, entered as i, useCapxulSend as l, capxulKeys as m, CapxulOnboardingController as n, useCapxulDestination as o, actingAccount as p, CapxulProvider as r, useCapxulIdentity as s, CapxulAuthenticationController as t, useCapxulTransitions as u };
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { A as entered, C as CreateOrganizationFailure, D as OrganizationDetails, E as InvocationOptions, F as useCapxulTransitions, M as useCapxulDestination, N as useCapxulIdentity, O as ProfileDetails, P as useCapxulSend, S as CapxulSend, T as Destination, _ as ReadyDestination, a as AuthenticationSlots, b as Slot, c as ControllerAction, d as OnboardingControllerProps, f as OrgFailure, g as ProfileSlotProps, h as PendingAuthState, i as AuthenticatedState, j as useCapxulAuth, k as SendResult, l as FaultedState, m as OtpPendingState, n as AccountProgress, o as CapxulAuthenticationController, p as OrgProgress, r as ActionResult, s as CapxulOnboardingController, t as AccountFailure, u as NavigationAction, v as RetryAction, w as CreateOrganizationSubmission, x as CapxulAuth, y as SignedOutState } from "./controllers-BWmKRFy6.mjs";
2
2
  import { ReactNode, RefCallback } from "react";
3
3
  import { QueryClient, UseMutationResult, UseQueryResult } from "@tanstack/react-query";
4
- import { Account, AccountRequirement, ActivityAnnotation, ActivityAnnotationInput, ActivityDetail, ActivityKind, ActivityListParams, ActivityPage, ActivityPhase, ActivityRange, ActivityReference, ActorReference, AddressBookEntry, BudgetId, CapxulClient, CapxulError, CapxulResult, CapxulSigner, CreateOrgInput, CurrentHoldings, HostObservability, IdentityDestination, InviteMemberInput, MemberView, Money, MoneyParseErrorReason, OrgId, OrgView, OrganizationPaymentBatchInput, OrganizationPaymentInput, PartyId, Payment, PaymentDirection, PaymentDocumentRef, PaymentDocumentRender, PaymentStatus, PaymentTiming, PaymentType, PaymentsPayInput, PayrollGroupId, PayrollGroupInput, PayrollRunId, PayrollRunStatus, Permission, PermissionMethods, PermissionReadResult, Profile, RoleView, SubmittedPermissionExecution, isClaimed, isRestoring } from "@capxul/sdk";
4
+ import { Account, AccountRequirement, ActivityAnnotation, ActivityAnnotationInput, ActivityDetail, ActivityKind, ActivityListParams, ActivityPage, ActivityPhase, ActivityRange, ActivityReference, ActorReference, AddressBookEntry, BudgetId, CapxulClient, CapxulError, CapxulResult, CapxulSigner, CreateOrgInput, CurrentHoldings, HostObservability, IdentityDestination, IdentityState, InviteMemberInput, MemberView, Money, MoneyParseErrorReason, OrgId, OrgView, OrganizationPaymentBatchInput, OrganizationPaymentInput, PartyId, Payment, PaymentDirection, PaymentDocumentRef, PaymentDocumentRender, PaymentStatus, PaymentTiming, PaymentType, PaymentsPayInput, PayrollGroupId, PayrollGroupInput, PayrollRunId, PayrollRunStatus, Permission, PermissionMethods, PermissionReadResult, Profile, RoleView, SubmittedPermissionExecution, isClaimed, isRestoring } from "@capxul/sdk";
5
5
  //#region src/provider.d.ts
6
6
  type CapxulProviderSharedProps = {
7
7
  /** Bring your own QueryClient; otherwise the provider creates one. */
@@ -1092,7 +1092,7 @@ declare const capxulKeys: {
1092
1092
  orgRoles: (orgId: OrgId | undefined) => readonly ["capxul", "org", "pending" | OrgId, "roles"];
1093
1093
  orgTreasury: (orgId: OrgId | undefined) => readonly ["capxul", "org", "pending" | OrgId, "treasury"];
1094
1094
  orgPermissions: (orgId: OrgId | undefined) => readonly ["capxul", "org", "pending" | OrgId, "permissions"];
1095
- orgMe: (orgId: OrgId | undefined) => readonly ["capxul", "org", "pending" | OrgId, "me"];
1095
+ orgMe: (orgId: OrgId | undefined, account: string | undefined) => readonly ["capxul", "org", "pending" | OrgId, "me", string];
1096
1096
  orgLifecycle: (orgId: OrgId | undefined) => readonly ["capxul", "org", "pending" | OrgId, "lifecycle"];
1097
1097
  contacts: (scope: string) => readonly ["capxul", "contacts", string];
1098
1098
  contactsList: (scope: string, includeHidden: boolean) => readonly ["capxul", "contacts", string, "all" | "visible"];
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { a as useCapxulAuth, c as useCapxulIdentityOrNull, d as toInvocationControls, f as toInvocationOptions, h as useCapxul, i as entered, l as useCapxulSend, m as useCapxulClientOrNull, n as CapxulOnboardingController, o as useCapxulDestination, p as capxulKeys, r as CapxulProvider, s as useCapxulIdentity, t as CapxulAuthenticationController, u as useCapxulTransitions } from "./controllers-DaT-AGx6.mjs";
2
+ import { a as useCapxulAuth, c as useCapxulIdentityOrNull, d as toInvocationControls, f as toInvocationOptions, g as useCapxul, h as useCapxulClientOrNull, i as entered, l as useCapxulSend, m as capxulKeys, n as CapxulOnboardingController, o as useCapxulDestination, p as actingAccount, r as CapxulProvider, s as useCapxulIdentity, t as CapxulAuthenticationController, u as useCapxulTransitions } from "./controllers-BdmuA9X3.mjs";
3
3
  import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
4
4
  import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
5
5
  import { CAPXUL_OPERATIONS, CapxulError, EVM_ADDRESS_RE, Errors, HANDLE_RE, PAYMENT_DIRECTIONS, PAYMENT_STATUSES, fingerprintPaymentIntent, formatMoney, isCapxulError, isClaimed, isClaimed as isClaimed$1, isMoneyParseError, isRestoring, isRestoring as isRestoring$1, parseMoney, paymentPhase, resolveIdentityDestination, toEvmAddress, toPartyId } from "@capxul/sdk";
@@ -1811,7 +1811,7 @@ function useOrgMeReading(orgId) {
1811
1811
  const ready = client !== null && identity !== null && isClaimed$1(identity);
1812
1812
  const mayStillOpen = client === null || identity === null || isRestoring$1(identity);
1813
1813
  const query = useQuery({
1814
- queryKey: capxulKeys.orgMe(orgId),
1814
+ queryKey: capxulKeys.orgMe(orgId, actingAccount(identity)),
1815
1815
  queryFn: async () => {
1816
1816
  return unwrapCapxulResult(await requireBootstrappedClient(client, CAPXUL_OPERATIONS.org.me).org(orgId).me());
1817
1817
  },
@@ -2574,13 +2574,16 @@ function useOrgTreasury(orgId) {
2574
2574
  }
2575
2575
  /**
2576
2576
  * The caller's own standing, read for its Budgets alone (ruling Q2 grades
2577
- * them). Keyed as `CapxulOrgMember` keys it, so a payroll screen inside a
2578
- * `.Can` wrapper reads `org(id).me()` once.
2577
+ * them). Keyed as `CapxulOrgMember` keys it — Organization AND acting account
2578
+ * (#2007 R19) — so a payroll screen inside a `.Can` wrapper still reads
2579
+ * `org(id).me()` once, and an account replacement is a miss for both of them
2580
+ * rather than the previous person's Budgets for both.
2579
2581
  */
2580
2582
  function useOrgMe(orgId) {
2581
2583
  const client = useCapxulClientOrNull();
2584
+ const identity = useCapxulIdentityOrNull();
2582
2585
  return useQuery({
2583
- queryKey: capxulKeys.orgMe(orgId),
2586
+ queryKey: capxulKeys.orgMe(orgId, actingAccount(identity)),
2584
2587
  queryFn: async () => unwrapCapxulResult(await scopedClient(client, CAPXUL_OPERATIONS.org.me, orgId).me()),
2585
2588
  enabled: client !== null && orgId !== void 0
2586
2589
  });
@@ -1,4 +1,4 @@
1
- import { n as CapxulOnboardingController, r as CapxulProvider, t as CapxulAuthenticationController } from "../controllers-DaT-AGx6.mjs";
1
+ import { n as CapxulOnboardingController, r as CapxulProvider, t as CapxulAuthenticationController } from "../controllers-BdmuA9X3.mjs";
2
2
  import "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { createCapxulTestClient } from "@capxul/sdk/testing";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sdk-react",
3
- "version": "4.2.0-rc.14",
3
+ "version": "4.2.0-rc.15",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/Xelmar-tech/infrastructure.git",
@@ -26,7 +26,7 @@
26
26
  "access": "public"
27
27
  },
28
28
  "dependencies": {
29
- "@capxul/sdk": "4.2.0-rc.14"
29
+ "@capxul/sdk": "4.2.0-rc.15"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@tanstack/react-query": "^5.66.9",
@@ -43,9 +43,9 @@
43
43
  "vite": "npm:@voidzero-dev/vite-plus-core@0.3.0",
44
44
  "vite-plus": "0.3.0",
45
45
  "vitest": "4.1.11",
46
- "@capxul/types": "0.3.0",
46
+ "@capxul/errors": "0.3.0",
47
47
  "@capxul/typescript-config": "0.0.0",
48
- "@capxul/errors": "0.3.0"
48
+ "@capxul/types": "0.3.0"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@tanstack/react-query": "^5.66.9",