@capxul/sdk-react 4.2.0-rc.11 → 4.2.0-rc.13
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/capxul-source.json +3 -3
- package/dist/index.d.mts +34 -4
- package/dist/index.mjs +52 -16
- package/package.json +2 -2
package/dist/capxul-source.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"source": {
|
|
3
|
-
"commit": "
|
|
4
|
-
"tree": "
|
|
3
|
+
"commit": "887920e1ba54e17bd8465975fcbc6e1537dfb6b8",
|
|
4
|
+
"tree": "deed16dc942ed9d6b587ceead4dbf8b0b4174e2c",
|
|
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.
|
|
10
|
+
"version": "4.2.0-rc.13"
|
|
11
11
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -833,8 +833,19 @@ type DashboardScope = {
|
|
|
833
833
|
readonly orgId?: string;
|
|
834
834
|
};
|
|
835
835
|
type DashboardAccessPhase = "checking" | "error" | "redirect" | "granted";
|
|
836
|
+
/**
|
|
837
|
+
* Which of the three probes produced the error the screen is showing. The
|
|
838
|
+
* error code alone cannot say: a provider failure reads the same whether the
|
|
839
|
+
* session read, the membership list or the lifecycle read raised it, and a
|
|
840
|
+
* consumer that reports a displayed gate error has to keep those apart
|
|
841
|
+
* (#1963 R05-2). It names the SOURCE only; `retry` still re-runs every failed
|
|
842
|
+
* probe, exactly as before.
|
|
843
|
+
*/
|
|
844
|
+
type DashboardAccessProbe = "session" | "membership" | "lifecycle";
|
|
836
845
|
interface DashboardAccessErrorSlice {
|
|
837
846
|
readonly error: CapxulError;
|
|
847
|
+
/** The probe the surfaced error came from, in the frozen precedence order. */
|
|
848
|
+
readonly probe: DashboardAccessProbe;
|
|
838
849
|
/** Re-runs each failed probe. */
|
|
839
850
|
readonly retry: () => void;
|
|
840
851
|
}
|
|
@@ -853,6 +864,12 @@ declare function Checking({ children }: {
|
|
|
853
864
|
declare function DashboardError({ children }: {
|
|
854
865
|
readonly children: (slice: DashboardAccessErrorSlice) => ReactNode;
|
|
855
866
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
867
|
+
/**
|
|
868
|
+
* Hands the destination and draws nothing. Reaching this part is a REQUEST to
|
|
869
|
+
* navigate, never an arrival: the app may cancel or supersede it, so nothing
|
|
870
|
+
* here — and nothing a consumer hangs off it — may claim a completed redirect
|
|
871
|
+
* (#1963 R05-1). The destination page's own normalized pageview proves arrival.
|
|
872
|
+
*/
|
|
856
873
|
declare function Redirect({ children }: {
|
|
857
874
|
readonly children: (slice: DashboardAccessRedirectSlice) => ReactNode;
|
|
858
875
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -891,8 +908,14 @@ interface PayrollSummarySlice {
|
|
|
891
908
|
}
|
|
892
909
|
interface PayrollGroupsSlice {
|
|
893
910
|
readonly groups: readonly PayrollGroupRow[];
|
|
894
|
-
|
|
895
|
-
|
|
911
|
+
/**
|
|
912
|
+
* R13 (#1968): `options` is the browser attempt the caller captured before the
|
|
913
|
+
* employer pressed the button. It reaches the SDK operation unchanged, so the
|
|
914
|
+
* group's `ui_payroll_action_completed` and the durable `payroll_group_changed`
|
|
915
|
+
* share one correlation. Absent, the write keeps its own invocation context.
|
|
916
|
+
*/
|
|
917
|
+
readonly save: (input: PayrollGroupInput, options?: InvocationOptions) => Promise<CapxulResult<PayrollGroupRow>>;
|
|
918
|
+
readonly remove: (id: PayrollGroupId, options?: InvocationOptions) => Promise<CapxulResult<void>>;
|
|
896
919
|
readonly isSaving: boolean;
|
|
897
920
|
readonly isLoading: boolean;
|
|
898
921
|
readonly error: CapxulError | null;
|
|
@@ -984,7 +1007,14 @@ interface PayrollRunSummarySlice {
|
|
|
984
1007
|
interface PayrollRunActionsSlice {
|
|
985
1008
|
readonly recovery: "none" | "restoring" | "required" | "unavailable";
|
|
986
1009
|
readonly recoveryError: CapxulError | null;
|
|
987
|
-
|
|
1010
|
+
/**
|
|
1011
|
+
* R13 (#1968): `options` is the browser attempt captured before the employer
|
|
1012
|
+
* confirmed. It reaches `authorizeRun` unchanged, so the sheet's own
|
|
1013
|
+
* `ui_payroll_action_completed` and the durable `payroll_run_transitioned`
|
|
1014
|
+
* rows share one correlation. It is NEVER written into the persisted draft —
|
|
1015
|
+
* a restored run keeps its own identity, not a stale attempt's.
|
|
1016
|
+
*/
|
|
1017
|
+
readonly submit: (options?: InvocationOptions) => void;
|
|
988
1018
|
readonly isSubmitting: boolean;
|
|
989
1019
|
readonly blocked: boolean;
|
|
990
1020
|
readonly blockedReason: CapxulPayrollRunBlockedReason | null;
|
|
@@ -1068,4 +1098,4 @@ declare const capxulKeys: {
|
|
|
1068
1098
|
payment: (paymentId: string | undefined) => readonly ["capxul", "payments", string];
|
|
1069
1099
|
};
|
|
1070
1100
|
//#endregion
|
|
1071
|
-
export { type AccountFailure, type AccountProgress, type ActionResult, type ActivityDetailSlice, type ActivityExportSlice, type ActivityFilterValues, type ActivityFiltersSlice, type ActivityLoadMoreSlice, type ActivityReceipt, type ActivityRow, type ActivityRowsSlice, type ActivitySearchSlice, type ActivitySummarySlice, type AuthenticatedState, type AuthenticationSlots, type CanReason, CapxulActivity, type CapxulActivityProps, type CapxulAuth, CapxulAuthenticationController, type CapxulBootstrapState, type CapxulBootstrapStatus, CapxulContacts, type CapxulContactsProps, CapxulDashboardAccess, type CapxulDashboardAccessProps, CapxulOnboardingController, CapxulOrgMember, type CapxulOrgMemberProps, CapxulPayroll, type CapxulPayrollProps, CapxulPayrollRun, type CapxulPayrollRunBlockedReason, type CapxulPayrollRunProps, CapxulProvider, type CapxulProviderProps, type CapxulSend, CapxulSendMoney, type CapxulSendMoneyBlockedReason, type CapxulSendMoneyProps, type Contact, type ContactRelationship, type ContactRow, type ContactsActor, type ContactsAddBlockedReason, type ContactsAddError, type ContactsAddSlice, type ContactsListOptions, type ContactsListSlice, type ContactsRefusal, type ContactsSummarySlice, type ControllerAction, type CreateOrganizationFailure, type CreateOrganizationSubmission, type CsvExport, type DashboardAccessErrorSlice, type DashboardAccessPhase, type DashboardAccessRedirectSlice, type DashboardScope, type Destination, type FaultedState, type HandleAvailability, type ImageUploadInput, type ImageUploadTarget, type InvocationOptions, type NavigationAction, type OnboardingControllerProps, type OnboardingIntent, type OnboardingJourney, type OnboardingJourneyPosition, type OnboardingOrigin, type OnboardingStep, type OrgFailure, type OrgMemberAction, type OrgMemberCanSlice, type OrgMemberStanding, type OrgMemberStandingSlice, type OrgProgress, type OrganizationDetails, type OrganizationDraft, type OtpPendingState, type PayoutDraftChain, type PayoutDraftEntry, type PayrollGroupRow, type PayrollGroupsSlice, type PayrollRecipientOption, type PayrollRunActionsSlice, type PayrollRunAmountEntry, type PayrollRunAmountsSlice, type PayrollRunAssetSlice, type PayrollRunGroupOption, type PayrollRunPrefill, type PayrollRunRecipientsSlice, type PayrollRunStatus, type PayrollRunSummarySlice, type PayrollSummarySlice, type PendingAuthState, type ProfileDetails, type ProfileDraft, type ProfileSlotProps, type ReadyDestination, type RetryAction, type SendActor, type SendMoneyActionsSlice, type SendMoneyAmountSlice, type SendMoneyAssetError, type SendMoneyAssetOption, type SendMoneyAssetSlice, type SendMoneyRecipientSlice, type SendMoneyRecipientStatus, type SendMoneySourceError, type SendMoneySourceOption, type SendMoneySourceSlice, type SendResult, type SentPayment, type SentPayrollRun, type SignedOutState, type Slot, type SummaryWindow, type UseCapxulAccountBalanceOptions, type UseCapxulAccountBalanceReturn, type UseCapxulAccountFundReturn, type UseCapxulCreateCommitmentReturn, type UseCapxulCreateOrgReturn, type UseCapxulHandleAvailabilityReturn, type UseCapxulImageUploadReturn, type UseCapxulInviteMemberReturn, type UseCapxulOrgMembersOptions, type UseCapxulOrgMembersReturn, type UseCapxulOrgRolesOptions, type UseCapxulOrgRolesReturn, type UseCapxulOrgTreasuryOptions, type UseCapxulOrgTreasuryReturn, type UseCapxulOrgsReturn, type UseCapxulPayReturn, type UseCapxulPaymentReturn, type UseCapxulPaymentsReturn, type UseCapxulProfileReturn, type UseCapxulRedirectPaymentReturn, type UseCapxulUploadImageReturn, acknowledgeOnboardingDestination, activeOnboardingRecovery, capxulKeys, clearOnboardingJourney, currentOnboardingJourneyId, entered, invalidateOnboardingJourneyObservation, isClaimed, isRestoring, loadOnboardingJourney, onboardingJourneyPosition, saveOnboardingJourney, startOnboardingJourney, useCapxul, useCapxulAccountBalance, useCapxulAccountFund, useCapxulActivity, useCapxulActivityDetail, useCapxulAnnotateMovement, useCapxulAuth, useCapxulCancelPayment, useCapxulClaimPayment, useCapxulClientOrNull, useCapxulCreateCommitment, useCapxulCreateOrg, useCapxulDestination, useCapxulHandleAvailability, useCapxulHoldings, useCapxulIdentity, useCapxulImageUpload, useCapxulInviteMember, useCapxulOrgMembers, useCapxulOrgRoles, useCapxulOrgTreasury, useCapxulOrganizationPay, useCapxulOrganizationPayBatch, useCapxulOrgs, useCapxulPay, useCapxulPayment, useCapxulPayments, useCapxulPermission, useCapxulPermissionAssign, useCapxulPermissionChange, useCapxulPermissionCreate, useCapxulPermissionReplace, useCapxulPermissionRevoke, useCapxulPermissions, useCapxulProfile, useCapxulRedirectPayment, useCapxulSend, useCapxulTransitions, useCapxulUploadImage };
|
|
1101
|
+
export { type AccountFailure, type AccountProgress, type ActionResult, type ActivityDetailSlice, type ActivityExportSlice, type ActivityFilterValues, type ActivityFiltersSlice, type ActivityLoadMoreSlice, type ActivityReceipt, type ActivityRow, type ActivityRowsSlice, type ActivitySearchSlice, type ActivitySummarySlice, type AuthenticatedState, type AuthenticationSlots, type CanReason, CapxulActivity, type CapxulActivityProps, type CapxulAuth, CapxulAuthenticationController, type CapxulBootstrapState, type CapxulBootstrapStatus, CapxulContacts, type CapxulContactsProps, CapxulDashboardAccess, type CapxulDashboardAccessProps, CapxulOnboardingController, CapxulOrgMember, type CapxulOrgMemberProps, CapxulPayroll, type CapxulPayrollProps, CapxulPayrollRun, type CapxulPayrollRunBlockedReason, type CapxulPayrollRunProps, CapxulProvider, type CapxulProviderProps, type CapxulSend, CapxulSendMoney, type CapxulSendMoneyBlockedReason, type CapxulSendMoneyProps, type Contact, type ContactRelationship, type ContactRow, type ContactsActor, type ContactsAddBlockedReason, type ContactsAddError, type ContactsAddSlice, type ContactsListOptions, type ContactsListSlice, type ContactsRefusal, type ContactsSummarySlice, type ControllerAction, type CreateOrganizationFailure, type CreateOrganizationSubmission, type CsvExport, type DashboardAccessErrorSlice, type DashboardAccessPhase, type DashboardAccessProbe, type DashboardAccessRedirectSlice, type DashboardScope, type Destination, type FaultedState, type HandleAvailability, type ImageUploadInput, type ImageUploadTarget, type InvocationOptions, type NavigationAction, type OnboardingControllerProps, type OnboardingIntent, type OnboardingJourney, type OnboardingJourneyPosition, type OnboardingOrigin, type OnboardingStep, type OrgFailure, type OrgMemberAction, type OrgMemberCanSlice, type OrgMemberStanding, type OrgMemberStandingSlice, type OrgProgress, type OrganizationDetails, type OrganizationDraft, type OtpPendingState, type PayoutDraftChain, type PayoutDraftEntry, type PayrollGroupRow, type PayrollGroupsSlice, type PayrollRecipientOption, type PayrollRunActionsSlice, type PayrollRunAmountEntry, type PayrollRunAmountsSlice, type PayrollRunAssetSlice, type PayrollRunGroupOption, type PayrollRunPrefill, type PayrollRunRecipientsSlice, type PayrollRunStatus, type PayrollRunSummarySlice, type PayrollSummarySlice, type PendingAuthState, type ProfileDetails, type ProfileDraft, type ProfileSlotProps, type ReadyDestination, type RetryAction, type SendActor, type SendMoneyActionsSlice, type SendMoneyAmountSlice, type SendMoneyAssetError, type SendMoneyAssetOption, type SendMoneyAssetSlice, type SendMoneyRecipientSlice, type SendMoneyRecipientStatus, type SendMoneySourceError, type SendMoneySourceOption, type SendMoneySourceSlice, type SendResult, type SentPayment, type SentPayrollRun, type SignedOutState, type Slot, type SummaryWindow, type UseCapxulAccountBalanceOptions, type UseCapxulAccountBalanceReturn, type UseCapxulAccountFundReturn, type UseCapxulCreateCommitmentReturn, type UseCapxulCreateOrgReturn, type UseCapxulHandleAvailabilityReturn, type UseCapxulImageUploadReturn, type UseCapxulInviteMemberReturn, type UseCapxulOrgMembersOptions, type UseCapxulOrgMembersReturn, type UseCapxulOrgRolesOptions, type UseCapxulOrgRolesReturn, type UseCapxulOrgTreasuryOptions, type UseCapxulOrgTreasuryReturn, type UseCapxulOrgsReturn, type UseCapxulPayReturn, type UseCapxulPaymentReturn, type UseCapxulPaymentsReturn, type UseCapxulProfileReturn, type UseCapxulRedirectPaymentReturn, type UseCapxulUploadImageReturn, acknowledgeOnboardingDestination, activeOnboardingRecovery, capxulKeys, clearOnboardingJourney, currentOnboardingJourneyId, entered, invalidateOnboardingJourneyObservation, isClaimed, isRestoring, loadOnboardingJourney, onboardingJourneyPosition, saveOnboardingJourney, startOnboardingJourney, useCapxul, useCapxulAccountBalance, useCapxulAccountFund, useCapxulActivity, useCapxulActivityDetail, useCapxulAnnotateMovement, useCapxulAuth, useCapxulCancelPayment, useCapxulClaimPayment, useCapxulClientOrNull, useCapxulCreateCommitment, useCapxulCreateOrg, useCapxulDestination, useCapxulHandleAvailability, useCapxulHoldings, useCapxulIdentity, useCapxulImageUpload, useCapxulInviteMember, useCapxulOrgMembers, useCapxulOrgRoles, useCapxulOrgTreasury, useCapxulOrganizationPay, useCapxulOrganizationPayBatch, useCapxulOrgs, useCapxulPay, useCapxulPayment, useCapxulPayments, useCapxulPermission, useCapxulPermissionAssign, useCapxulPermissionChange, useCapxulPermissionCreate, useCapxulPermissionReplace, useCapxulPermissionRevoke, useCapxulPermissions, useCapxulProfile, useCapxulRedirectPayment, useCapxulSend, useCapxulTransitions, useCapxulUploadImage };
|
package/dist/index.mjs
CHANGED
|
@@ -880,7 +880,7 @@ function useCapxulUploadImage() {
|
|
|
880
880
|
//#endregion
|
|
881
881
|
//#region src/headless/contacts/use-contacts.ts
|
|
882
882
|
/** One captured snapshot, or nothing — never a fabricated empty options object. */
|
|
883
|
-
const carry = (options) => options === void 0 ? {} : { options };
|
|
883
|
+
const carry$1 = (options) => options === void 0 ? {} : { options };
|
|
884
884
|
function useContacts(input) {
|
|
885
885
|
const { actor, onAdded, onFailed } = input;
|
|
886
886
|
const client = useCapxulClientOrNull();
|
|
@@ -922,7 +922,7 @@ function useContacts(input) {
|
|
|
922
922
|
setAddError(null);
|
|
923
923
|
addMutate({
|
|
924
924
|
ref: refFromTypedText(value),
|
|
925
|
-
...carry(attempt)
|
|
925
|
+
...carry$1(attempt)
|
|
926
926
|
}, {
|
|
927
927
|
onSuccess: (entry) => {
|
|
928
928
|
setValue("");
|
|
@@ -955,17 +955,17 @@ function useContacts(input) {
|
|
|
955
955
|
kind: "rename",
|
|
956
956
|
id,
|
|
957
957
|
name,
|
|
958
|
-
...carry(toInvocationOptions(options))
|
|
958
|
+
...carry$1(toInvocationOptions(options))
|
|
959
959
|
}), [writeMutate]),
|
|
960
960
|
hide: useCallback((id, options) => writeMutate({
|
|
961
961
|
kind: "hide",
|
|
962
962
|
id,
|
|
963
|
-
...carry(toInvocationOptions(options))
|
|
963
|
+
...carry$1(toInvocationOptions(options))
|
|
964
964
|
}), [writeMutate]),
|
|
965
965
|
unhide: useCallback((id, options) => writeMutate({
|
|
966
966
|
kind: "unhide",
|
|
967
967
|
id,
|
|
968
|
-
...carry(toInvocationOptions(options))
|
|
968
|
+
...carry$1(toInvocationOptions(options))
|
|
969
969
|
}), [writeMutate]),
|
|
970
970
|
add: {
|
|
971
971
|
value,
|
|
@@ -2315,6 +2315,16 @@ function decidePhase(input) {
|
|
|
2315
2315
|
if (input.orgLaneSettled && input.destination !== null) return "redirect";
|
|
2316
2316
|
return "checking";
|
|
2317
2317
|
}
|
|
2318
|
+
/**
|
|
2319
|
+
* Which probe produced the surfaced error — the SAME precedence `error` itself
|
|
2320
|
+
* is chosen by, written once so the code and its source can never disagree.
|
|
2321
|
+
*/
|
|
2322
|
+
function probeOf(session, membership, lifecycle) {
|
|
2323
|
+
if (session !== null) return "session";
|
|
2324
|
+
if (membership !== null) return "membership";
|
|
2325
|
+
if (lifecycle !== null) return "lifecycle";
|
|
2326
|
+
return null;
|
|
2327
|
+
}
|
|
2318
2328
|
/** The engine — all the logic. NOT exported from the package barrel. */
|
|
2319
2329
|
function useDashboardAccess(scope) {
|
|
2320
2330
|
const client = useCapxulClientOrNull();
|
|
@@ -2351,6 +2361,7 @@ function useDashboardAccess(scope) {
|
|
|
2351
2361
|
lifecycle.refetch
|
|
2352
2362
|
]);
|
|
2353
2363
|
const error = sessionError ?? membershipError ?? lifecycleError;
|
|
2364
|
+
const probe = probeOf(sessionError, membershipError, lifecycleError);
|
|
2354
2365
|
const phase = decidePhase({
|
|
2355
2366
|
error,
|
|
2356
2367
|
settled: client !== null && identity !== null && !isRestoring$1(identity) && membershipsSettled && lifecycleSettled,
|
|
@@ -2361,11 +2372,13 @@ function useDashboardAccess(scope) {
|
|
|
2361
2372
|
return useMemo(() => ({
|
|
2362
2373
|
phase,
|
|
2363
2374
|
error,
|
|
2375
|
+
probe,
|
|
2364
2376
|
destination,
|
|
2365
2377
|
retry
|
|
2366
2378
|
}), [
|
|
2367
2379
|
phase,
|
|
2368
2380
|
error,
|
|
2381
|
+
probe,
|
|
2369
2382
|
destination,
|
|
2370
2383
|
retry
|
|
2371
2384
|
]);
|
|
@@ -2410,12 +2423,19 @@ function Checking({ children }) {
|
|
|
2410
2423
|
}
|
|
2411
2424
|
function DashboardError({ children }) {
|
|
2412
2425
|
const state = usePart("error");
|
|
2413
|
-
if (state === null || state.error === null) return null;
|
|
2426
|
+
if (state === null || state.error === null || state.probe === null) return null;
|
|
2414
2427
|
return /* @__PURE__ */ jsx(Fragment, { children: children({
|
|
2415
2428
|
error: state.error,
|
|
2429
|
+
probe: state.probe,
|
|
2416
2430
|
retry: state.retry
|
|
2417
2431
|
}) });
|
|
2418
2432
|
}
|
|
2433
|
+
/**
|
|
2434
|
+
* Hands the destination and draws nothing. Reaching this part is a REQUEST to
|
|
2435
|
+
* navigate, never an arrival: the app may cancel or supersede it, so nothing
|
|
2436
|
+
* here — and nothing a consumer hangs off it — may claim a completed redirect
|
|
2437
|
+
* (#1963 R05-1). The destination page's own normalized pageview proves arrival.
|
|
2438
|
+
*/
|
|
2419
2439
|
function Redirect({ children }) {
|
|
2420
2440
|
const state = usePart("redirect");
|
|
2421
2441
|
if (state === null || state.destination === null) return null;
|
|
@@ -2579,6 +2599,14 @@ function scopedClient(client, method, orgId) {
|
|
|
2579
2599
|
//#region src/headless/payroll/use-payroll.ts
|
|
2580
2600
|
/** Money reads the same way everywhere on this screen: amount then code. */
|
|
2581
2601
|
const GRAMMAR$1 = { grammar: "code" };
|
|
2602
|
+
/**
|
|
2603
|
+
* One captured snapshot, or nothing — never a fabricated empty options object,
|
|
2604
|
+
* and never a DOM event a screen wired straight to `onClick`.
|
|
2605
|
+
*/
|
|
2606
|
+
function carry(options) {
|
|
2607
|
+
const attempt = toInvocationOptions(options);
|
|
2608
|
+
return attempt === void 0 ? {} : { options: attempt };
|
|
2609
|
+
}
|
|
2582
2610
|
function toPayrollGroupRow(group) {
|
|
2583
2611
|
const currency = new Set(group.members.map((member) => member.currency)).size === 1 ? group.members[0]?.currency : void 0;
|
|
2584
2612
|
return {
|
|
@@ -2618,16 +2646,17 @@ function usePayroll(orgId) {
|
|
|
2618
2646
|
const write = useMutation({
|
|
2619
2647
|
mutationFn: async (command) => {
|
|
2620
2648
|
const payroll = scopedClient(client, CAPXUL_OPERATIONS.org.payroll.groups[command.kind], orgId).payroll;
|
|
2649
|
+
const controls = toInvocationControls(command.options);
|
|
2621
2650
|
if (command.kind === "remove") {
|
|
2622
|
-
unwrapCapxulResult(await payroll.groups.remove(command.id));
|
|
2651
|
+
unwrapCapxulResult(await payroll.groups.remove(command.id, controls));
|
|
2623
2652
|
return null;
|
|
2624
2653
|
}
|
|
2625
|
-
return unwrapCapxulResult(await payroll.groups.save(command.input));
|
|
2654
|
+
return unwrapCapxulResult(await payroll.groups.save(command.input, controls));
|
|
2626
2655
|
},
|
|
2627
2656
|
onSettled: invalidate
|
|
2628
2657
|
});
|
|
2629
2658
|
const mutateAsync = write.mutateAsync;
|
|
2630
|
-
const save = useCallback(async (input) => {
|
|
2659
|
+
const save = useCallback(async (input, options) => {
|
|
2631
2660
|
const refusal = invalidGroup(input);
|
|
2632
2661
|
if (refusal !== null) return {
|
|
2633
2662
|
ok: false,
|
|
@@ -2636,7 +2665,8 @@ function usePayroll(orgId) {
|
|
|
2636
2665
|
try {
|
|
2637
2666
|
const saved = await mutateAsync({
|
|
2638
2667
|
kind: "save",
|
|
2639
|
-
input
|
|
2668
|
+
input,
|
|
2669
|
+
...carry(options)
|
|
2640
2670
|
});
|
|
2641
2671
|
return saved === null ? {
|
|
2642
2672
|
ok: false,
|
|
@@ -2652,11 +2682,12 @@ function usePayroll(orgId) {
|
|
|
2652
2682
|
};
|
|
2653
2683
|
}
|
|
2654
2684
|
}, [mutateAsync]);
|
|
2655
|
-
const remove = useCallback(async (id) => {
|
|
2685
|
+
const remove = useCallback(async (id, options) => {
|
|
2656
2686
|
try {
|
|
2657
2687
|
await mutateAsync({
|
|
2658
2688
|
kind: "remove",
|
|
2659
|
-
id
|
|
2689
|
+
id,
|
|
2690
|
+
...carry(options)
|
|
2660
2691
|
});
|
|
2661
2692
|
return {
|
|
2662
2693
|
ok: true,
|
|
@@ -3174,11 +3205,12 @@ function usePayrollRun(input) {
|
|
|
3174
3205
|
amountsParse: total !== null
|
|
3175
3206
|
});
|
|
3176
3207
|
const authorize = useMutation({
|
|
3177
|
-
mutationFn: async (candidate) => {
|
|
3208
|
+
mutationFn: async ({ candidate, options }) => {
|
|
3178
3209
|
if (candidate.scope !== currentScope.current) throw Errors.notAuthenticated();
|
|
3179
3210
|
return executeRunDraft(candidate, async (persisted, onRequestKey, onResolved) => {
|
|
3180
3211
|
if (candidate.scope === currentScope.current) setDraft(persisted);
|
|
3181
3212
|
return unwrapCapxulResult(await scopedClient(client, CAPXUL_OPERATIONS.org.payroll.authorizeRun, orgId).payroll.authorizeRun(persisted.input, {
|
|
3213
|
+
...toInvocationControls(options),
|
|
3182
3214
|
onResolved,
|
|
3183
3215
|
onRequestKey: (key) => {
|
|
3184
3216
|
if (candidate.scope !== currentScope.current) throw Errors.notAuthenticated();
|
|
@@ -3187,14 +3219,15 @@ function usePayrollRun(input) {
|
|
|
3187
3219
|
}));
|
|
3188
3220
|
});
|
|
3189
3221
|
},
|
|
3190
|
-
onSettled: (_run, _error, candidate) => {
|
|
3222
|
+
onSettled: (_run, _error, { candidate }) => {
|
|
3191
3223
|
queryClient.invalidateQueries({ queryKey: capxulKeys.payrollRuns(orgId) });
|
|
3192
3224
|
if (candidate.scope === currentScope.current) restoreDraft(candidate.scope);
|
|
3193
3225
|
}
|
|
3194
3226
|
});
|
|
3195
3227
|
const totalDisplay = total === null ? null : formatMoney(total, GRAMMAR);
|
|
3196
3228
|
const authorizeMutate = authorize.mutate;
|
|
3197
|
-
const submit = useCallback(() => {
|
|
3229
|
+
const submit = useCallback((options) => {
|
|
3230
|
+
const attempt = toInvocationOptions(options);
|
|
3198
3231
|
const permissionId = budgets[0]?.id;
|
|
3199
3232
|
if (blockedReason !== null || submitGate.current || draftBlocked || draftScope === null || assetMoney === null || selectedAsset === null) return;
|
|
3200
3233
|
if (permissionId === void 0 || totalDisplay === null || parsedAmounts === null) return;
|
|
@@ -3236,7 +3269,10 @@ function usePayrollRun(input) {
|
|
|
3236
3269
|
}
|
|
3237
3270
|
};
|
|
3238
3271
|
submitGate.current = true;
|
|
3239
|
-
authorizeMutate(
|
|
3272
|
+
authorizeMutate({
|
|
3273
|
+
candidate,
|
|
3274
|
+
...attempt === void 0 ? {} : { options: attempt }
|
|
3275
|
+
}, {
|
|
3240
3276
|
onSuccess: (run) => {
|
|
3241
3277
|
if (candidate.scope === currentScope.current) onRun({
|
|
3242
3278
|
id: run.id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capxul/sdk-react",
|
|
3
|
-
"version": "4.2.0-rc.
|
|
3
|
+
"version": "4.2.0-rc.13",
|
|
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.
|
|
29
|
+
"@capxul/sdk": "4.2.0-rc.13"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@tanstack/react-query": "^5.66.9",
|