@capxul/sdk-react 2.8.0 → 2.8.2

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.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { A as useCapxulAuth, C as CreateOrganizationSubmission, D as ProfileDetails, E as OrganizationDetails, M as useCapxulIdentity, N as useCapxulSend, O as SendResult, P as useCapxulTransitions, S as CapxulSend, T as InvocationOptions, _ 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 useCapxulDestination, k as entered, 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 Destination, x as CapxulAuth, y as SignedOutState } from "./controllers-CJEsthW2.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, 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, PermissionReadResult, Profile, RoleView, 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, 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. */
@@ -113,243 +113,14 @@ declare function useCapxulPayment(paymentId: string | undefined, options?: {
113
113
  declare function useCapxulOrganizationPay(orgId: OrgId | undefined): UseMutationResult<Payment, CapxulError, OrganizationPaymentInput>;
114
114
  declare function useCapxulOrganizationPayBatch(orgId: OrgId): UseMutationResult<readonly Payment[], CapxulError, OrganizationPaymentBatchInput>;
115
115
  //#endregion
116
- //#region ../types/src/brand.d.ts
117
- /**
118
- * Nominal type helper. `Brand<T, B>` is structurally a `T` at runtime but
119
- * distinct at compile time, preventing accidental swaps between primitives.
120
- *
121
- * @internal
122
- */
123
- declare const brand: unique symbol;
124
- type Brand<T, B extends string> = T & {
125
- readonly [brand]: B;
126
- };
127
- //#endregion
128
- //#region ../types/src/index.d.ts
129
- type Address = Brand<string, "Address">;
130
- type PermissionId = Brand<string, "PermissionId">;
131
- type PermissionAssignmentId = Brand<string, "PermissionAssignmentId">;
132
- type BudgetId = Brand<string, "BudgetId">;
133
- type PaymentCommandId = Brand<string, "PaymentCommandId">;
134
- type OrgId$1 = Brand<string, "OrgId">;
135
- type CurrencyCode = Brand<SupportedCurrencyCode, "CurrencyCode">;
136
- type WeiAmount = Brand<string, "WeiAmount">;
137
- type RoleKey = Brand<string, "RoleKey">;
138
- type AllowanceKey = Brand<string, "AllowanceKey">;
139
- declare const SUPPORTED_CURRENCIES: readonly [{
140
- readonly code: "USD";
141
- readonly symbol: "$";
142
- readonly name: "US Dollar";
143
- }, {
144
- readonly code: "NGN";
145
- readonly symbol: "NGN";
146
- readonly name: "Nigerian Naira";
147
- }, {
148
- readonly code: "GHS";
149
- readonly symbol: "GHS";
150
- readonly name: "Ghanaian Cedi";
151
- }, {
152
- readonly code: "KES";
153
- readonly symbol: "KSh";
154
- readonly name: "Kenyan Shilling";
155
- }, {
156
- readonly code: "UGX";
157
- readonly symbol: "USh";
158
- readonly name: "Ugandan Shilling";
159
- }];
160
- type SupportedCurrencyCode = (typeof SUPPORTED_CURRENCIES)[number]["code"];
161
- //#endregion
162
116
  //#region src/hooks/use-capxul-permissions.d.ts
163
- declare const useCapxulPermissionCreate: (orgId: OrgId) => UseMutationResult<{
164
- readonly status: "submitted";
165
- readonly executionId: string;
166
- readonly commandId: PaymentCommandId;
167
- readonly userOpHash: string;
168
- readonly value: readonly {
169
- readonly permissionId: PermissionId;
170
- readonly orgId: string;
171
- readonly type: "budget" | "managePeople";
172
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
173
- readonly revision: number;
174
- readonly roleKey: RoleKey;
175
- readonly tokenAddress?: Address | undefined;
176
- readonly limitRaw?: WeiAmount | undefined;
177
- readonly allowanceKey?: AllowanceKey | undefined;
178
- }[] | {
179
- readonly permissionId: PermissionId;
180
- readonly orgId: string;
181
- readonly type: "budget" | "managePeople";
182
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
183
- readonly revision: number;
184
- readonly roleKey: RoleKey;
185
- readonly tokenAddress?: Address | undefined;
186
- readonly limitRaw?: WeiAmount | undefined;
187
- readonly allowanceKey?: AllowanceKey | undefined;
188
- } | {
189
- readonly permissionAssignmentId: PermissionAssignmentId;
190
- readonly permissionId: PermissionId;
191
- readonly actor: {
192
- readonly kind: "account";
193
- readonly accountId: string;
194
- } | {
195
- readonly kind: "organization";
196
- readonly orgId: string;
197
- };
198
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
199
- };
200
- }, CapxulError, import("@capxul/sdk").PermissionCreateInput>;
201
- declare const useCapxulPermissionChange: (orgId: OrgId) => UseMutationResult<{
202
- readonly status: "submitted";
203
- readonly executionId: string;
204
- readonly commandId: PaymentCommandId;
205
- readonly userOpHash: string;
206
- readonly value: readonly {
207
- readonly permissionId: PermissionId;
208
- readonly orgId: string;
209
- readonly type: "budget" | "managePeople";
210
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
211
- readonly revision: number;
212
- readonly roleKey: RoleKey;
213
- readonly tokenAddress?: Address | undefined;
214
- readonly limitRaw?: WeiAmount | undefined;
215
- readonly allowanceKey?: AllowanceKey | undefined;
216
- }[] | {
217
- readonly permissionId: PermissionId;
218
- readonly orgId: string;
219
- readonly type: "budget" | "managePeople";
220
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
221
- readonly revision: number;
222
- readonly roleKey: RoleKey;
223
- readonly tokenAddress?: Address | undefined;
224
- readonly limitRaw?: WeiAmount | undefined;
225
- readonly allowanceKey?: AllowanceKey | undefined;
226
- } | {
227
- readonly permissionAssignmentId: PermissionAssignmentId;
228
- readonly permissionId: PermissionId;
229
- readonly actor: {
230
- readonly kind: "account";
231
- readonly accountId: string;
232
- } | {
233
- readonly kind: "organization";
234
- readonly orgId: string;
235
- };
236
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
237
- };
238
- }, CapxulError, import("@capxul/sdk").PermissionChangeInput>;
239
- declare const useCapxulPermissionAssign: (orgId: OrgId) => UseMutationResult<{
240
- readonly status: "submitted";
241
- readonly executionId: string;
242
- readonly commandId: PaymentCommandId;
243
- readonly userOpHash: string;
244
- readonly value: readonly {
245
- readonly permissionId: PermissionId;
246
- readonly orgId: string;
247
- readonly type: "budget" | "managePeople";
248
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
249
- readonly revision: number;
250
- readonly roleKey: RoleKey;
251
- readonly tokenAddress?: Address | undefined;
252
- readonly limitRaw?: WeiAmount | undefined;
253
- readonly allowanceKey?: AllowanceKey | undefined;
254
- }[] | {
255
- readonly permissionId: PermissionId;
256
- readonly orgId: string;
257
- readonly type: "budget" | "managePeople";
258
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
259
- readonly revision: number;
260
- readonly roleKey: RoleKey;
261
- readonly tokenAddress?: Address | undefined;
262
- readonly limitRaw?: WeiAmount | undefined;
263
- readonly allowanceKey?: AllowanceKey | undefined;
264
- } | {
265
- readonly permissionAssignmentId: PermissionAssignmentId;
266
- readonly permissionId: PermissionId;
267
- readonly actor: {
268
- readonly kind: "account";
269
- readonly accountId: string;
270
- } | {
271
- readonly kind: "organization";
272
- readonly orgId: string;
273
- };
274
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
275
- };
276
- }, CapxulError, import("@capxul/sdk").PermissionAssignInput>;
277
- declare const useCapxulPermissionRevoke: (orgId: OrgId) => UseMutationResult<{
278
- readonly status: "submitted";
279
- readonly executionId: string;
280
- readonly commandId: PaymentCommandId;
281
- readonly userOpHash: string;
282
- readonly value: readonly {
283
- readonly permissionId: PermissionId;
284
- readonly orgId: string;
285
- readonly type: "budget" | "managePeople";
286
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
287
- readonly revision: number;
288
- readonly roleKey: RoleKey;
289
- readonly tokenAddress?: Address | undefined;
290
- readonly limitRaw?: WeiAmount | undefined;
291
- readonly allowanceKey?: AllowanceKey | undefined;
292
- }[] | {
293
- readonly permissionId: PermissionId;
294
- readonly orgId: string;
295
- readonly type: "budget" | "managePeople";
296
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
297
- readonly revision: number;
298
- readonly roleKey: RoleKey;
299
- readonly tokenAddress?: Address | undefined;
300
- readonly limitRaw?: WeiAmount | undefined;
301
- readonly allowanceKey?: AllowanceKey | undefined;
302
- } | {
303
- readonly permissionAssignmentId: PermissionAssignmentId;
304
- readonly permissionId: PermissionId;
305
- readonly actor: {
306
- readonly kind: "account";
307
- readonly accountId: string;
308
- } | {
309
- readonly kind: "organization";
310
- readonly orgId: string;
311
- };
312
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
313
- };
314
- }, CapxulError, import("@capxul/sdk").PermissionRevokeInput>;
315
- declare const useCapxulPermissionReplace: (orgId: OrgId) => UseMutationResult<{
316
- readonly status: "submitted";
317
- readonly executionId: string;
318
- readonly commandId: PaymentCommandId;
319
- readonly userOpHash: string;
320
- readonly value: readonly {
321
- readonly permissionId: PermissionId;
322
- readonly orgId: string;
323
- readonly type: "budget" | "managePeople";
324
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
325
- readonly revision: number;
326
- readonly roleKey: RoleKey;
327
- readonly tokenAddress?: Address | undefined;
328
- readonly limitRaw?: WeiAmount | undefined;
329
- readonly allowanceKey?: AllowanceKey | undefined;
330
- }[] | {
331
- readonly permissionId: PermissionId;
332
- readonly orgId: string;
333
- readonly type: "budget" | "managePeople";
334
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
335
- readonly revision: number;
336
- readonly roleKey: RoleKey;
337
- readonly tokenAddress?: Address | undefined;
338
- readonly limitRaw?: WeiAmount | undefined;
339
- readonly allowanceKey?: AllowanceKey | undefined;
340
- } | {
341
- readonly permissionAssignmentId: PermissionAssignmentId;
342
- readonly permissionId: PermissionId;
343
- readonly actor: {
344
- readonly kind: "account";
345
- readonly accountId: string;
346
- } | {
347
- readonly kind: "organization";
348
- readonly orgId: string;
349
- };
350
- readonly state: "active" | "pending" | "revoked" | "superseded" | "suspended";
351
- };
352
- }, CapxulError, import("@capxul/sdk").PermissionReplaceInput>;
117
+ type Operation = "create" | "change" | "assign" | "revoke" | "replace";
118
+ type Input<K extends Operation> = Parameters<PermissionMethods[K]>[0];
119
+ declare const useCapxulPermissionCreate: (orgId: OrgId) => UseMutationResult<SubmittedPermissionExecution, CapxulError, Input<"create">>;
120
+ declare const useCapxulPermissionChange: (orgId: OrgId) => UseMutationResult<SubmittedPermissionExecution, CapxulError, Input<"change">>;
121
+ declare const useCapxulPermissionAssign: (orgId: OrgId) => UseMutationResult<SubmittedPermissionExecution, CapxulError, Input<"assign">>;
122
+ declare const useCapxulPermissionRevoke: (orgId: OrgId) => UseMutationResult<SubmittedPermissionExecution, CapxulError, Input<"revoke">>;
123
+ declare const useCapxulPermissionReplace: (orgId: OrgId) => UseMutationResult<SubmittedPermissionExecution, CapxulError, Input<"replace">>;
353
124
  declare function useCapxulPermissions(orgId: OrgId, options?: {
354
125
  readonly enabled?: boolean;
355
126
  }): UseQueryResult<PermissionReadResult, CapxulError>;
@@ -569,7 +340,7 @@ type ContactsActor = {
569
340
  readonly kind: "personal";
570
341
  } | {
571
342
  readonly kind: "organization";
572
- readonly orgId: OrgId$1 | undefined;
343
+ readonly orgId: OrgId | undefined;
573
344
  };
574
345
  /**
575
346
  * How a contact entered the book. Taken from the shipped surface rather than
@@ -868,7 +639,7 @@ type SendActor = {
868
639
  readonly kind: "personal";
869
640
  } | {
870
641
  readonly kind: "organization";
871
- readonly orgId: OrgId$1 | undefined;
642
+ readonly orgId: OrgId | undefined;
872
643
  };
873
644
  type SentPayment = {
874
645
  /** The backend payment row. */
@@ -1064,7 +835,7 @@ interface PayrollGroupRow {
1064
835
  /** The `partyId` — the stable id (ruling Q1), never an email. */
1065
836
  readonly recipientId: string;
1066
837
  readonly amount: string;
1067
- readonly currency: CurrencyCode;
838
+ readonly currency: Money["currency"];
1068
839
  }[];
1069
840
  }
1070
841
  interface PayrollSummarySlice {
@@ -1150,8 +921,8 @@ interface PayrollRunAmountEntry {
1150
921
  readonly error: MoneyParseErrorReason | null;
1151
922
  /** True while the value is one we seeded and the employer has not edited. */
1152
923
  readonly prefilled: boolean;
1153
- /** The treasury asset's currency the one-option dropdown stays. */
1154
- readonly currency: CurrencyCode;
924
+ /** The treasury asset's currency. Rows stay absent until this value exists. */
925
+ readonly currency: Money["currency"];
1155
926
  }
1156
927
  interface PayrollRunAmountsSlice {
1157
928
  readonly entries: readonly PayrollRunAmountEntry[];
package/dist/index.mjs CHANGED
@@ -2647,13 +2647,6 @@ function termsSeeds(terms, asset, period) {
2647
2647
  //#region src/headless/payroll/use-payroll-run.ts
2648
2648
  const GRAMMAR = { grammar: "code" };
2649
2649
  /**
2650
- * The one place the composer states a currency it has not read yet. The token
2651
- * dropdown holds exactly one option — the treasury's — so before that read
2652
- * lands there is no currency to name, and naming a wrong one would be a fake
2653
- * green on the money itself.
2654
- */
2655
- const CURRENCY_UNREAD = "";
2656
- /**
2657
2650
  * The period this composer composes: an INSTANT run (ruling Q3). `authorizeRun`
2658
2651
  * stamps `start === end === runAt` at submit, and the payslip's period renders
2659
2652
  * that date.
@@ -2762,19 +2755,22 @@ function usePayrollRun(input) {
2762
2755
  return resolved;
2763
2756
  }, [refs, selected]);
2764
2757
  const seeds = useMemo(() => termsSeeds(terms.data ?? [], assetMoney, INSTANT_RUN_PERIOD), [assetMoney, terms.data]);
2765
- const entries = useMemo(() => selected.map((recipientId) => {
2766
- const value = amountText(amounts, seeds, recipientId);
2767
- const parsed = assetMoney === null || value.trim() === "" ? null : parseMoney(value, assetMoney);
2768
- return {
2769
- recipientId,
2770
- name: named.get(recipientId)?.name ?? recipientId,
2771
- value,
2772
- change: (text) => change(recipientId, text),
2773
- error: parsed !== null && isMoneyParseError(parsed) ? parsed.reason : null,
2774
- prefilled: amounts[recipientId]?.prefilled ?? seeds.has(recipientId),
2775
- currency: assetMoney?.currency ?? CURRENCY_UNREAD
2776
- };
2777
- }), [
2758
+ const entries = useMemo(() => {
2759
+ if (assetMoney === null) return [];
2760
+ return selected.map((recipientId) => {
2761
+ const value = amountText(amounts, seeds, recipientId);
2762
+ const parsed = value.trim() === "" ? null : parseMoney(value, assetMoney);
2763
+ return {
2764
+ recipientId,
2765
+ name: named.get(recipientId)?.name ?? recipientId,
2766
+ value,
2767
+ change: (text) => change(recipientId, text),
2768
+ error: parsed !== null && isMoneyParseError(parsed) ? parsed.reason : null,
2769
+ prefilled: amounts[recipientId]?.prefilled ?? seeds.has(recipientId),
2770
+ currency: assetMoney.currency
2771
+ };
2772
+ });
2773
+ }, [
2778
2774
  amounts,
2779
2775
  assetMoney,
2780
2776
  change,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capxul/sdk-react",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
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": "2.8.0"
29
+ "@capxul/sdk": "2.8.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@tanstack/react-query": "^5.66.9",