Parent: https://github.com/Expensify/Expensify/issues/625136
Design doc: https://docs.google.com/document/d/1TGdZYwm4_fvPOZtUziiz27bwVRqYm6HuEGopUYWNg8Y/edit
Scope
Add the TriNet OAuth wiring on the App side: a new Zenefits.ts action file and a ConnectToZenefitsFlow/ component. Mirrors gusto1.6 from the Gusto port.
Depends on: Issue 4 (constants, types, API parameters) and Issue 2 (backend ConnectPolicyToZenefits command).
Implementation notes (from design doc)
src/libs/actions/connections/Zenefits.ts
Mirror src/libs/actions/connections/Gusto.ts. Two functions:
getZenefitsSetupLink(policyID) — builds the OAuth URL using getCommandURL and READ_COMMANDS.CONNECT_POLICY_TO_ZENEFITS.
updateZenefitsApprovalMode(policyID, approvalMode, currentApprovalMode) — calls write(WRITE_COMMANDS.UPDATE_ZENEFITS_APPROVAL_MODE, ...) with optimistic / success / failure Onyx data merging into policy.connections.zenefits.config.approvalMode.
src/libs/actions/connections/index.ts
Wire Zenefits into getSyncConnectionParameters():
case CONST.POLICY.CONNECTIONS.NAME.ZENEFITS: {
return {
readCommand: READ_COMMANDS.SYNC_POLICY_TO_ZENEFITS,
stageInProgress: CONST.POLICY.CONNECTIONS.SYNC_STAGE_NAME.ZENEFITS_SYNC_TITLE,
};
}
src/components/ConnectToZenefitsFlow/
Mirror src/components/ConnectToGustoFlow/:
types.ts — { policyID: string }
index.tsx (web) — imports useEnvironment and passes environmentURL to openLink(getZenefitsSetupLink(policyID), environmentURL) inside a useEffect. Returns null. Matches ConnectToGustoFlow/index.tsx exactly.
index.native.tsx — full-screen modal with HeaderWithBackButton and FullPageOfflineBlockingView wrapping a WebView loading the setup link.
Tests
- Unit test that
getZenefitsSetupLink returns the expected URL shape.
- Unit test that
updateZenefitsApprovalMode produces correct optimistic / success / failure Onyx data.
- Manual: end-to-end OAuth flow against staging (covered by Manual Test Doc — see Manual Test Doc Release 1 "Connect TriNet flow" section).
Issue Owner
Current Issue Owner: @ShridharGoel
Parent: https://github.com/Expensify/Expensify/issues/625136
Design doc: https://docs.google.com/document/d/1TGdZYwm4_fvPOZtUziiz27bwVRqYm6HuEGopUYWNg8Y/edit
Scope
Add the TriNet OAuth wiring on the App side: a new
Zenefits.tsaction file and aConnectToZenefitsFlow/component. Mirrorsgusto1.6from the Gusto port.Depends on: Issue 4 (constants, types, API parameters) and Issue 2 (backend
ConnectPolicyToZenefitscommand).Implementation notes (from design doc)
src/libs/actions/connections/Zenefits.tsMirror
src/libs/actions/connections/Gusto.ts. Two functions:getZenefitsSetupLink(policyID)— builds the OAuth URL usinggetCommandURLandREAD_COMMANDS.CONNECT_POLICY_TO_ZENEFITS.updateZenefitsApprovalMode(policyID, approvalMode, currentApprovalMode)— callswrite(WRITE_COMMANDS.UPDATE_ZENEFITS_APPROVAL_MODE, ...)with optimistic / success / failure Onyx data merging intopolicy.connections.zenefits.config.approvalMode.src/libs/actions/connections/index.tsWire Zenefits into
getSyncConnectionParameters():src/components/ConnectToZenefitsFlow/Mirror
src/components/ConnectToGustoFlow/:types.ts—{ policyID: string }index.tsx(web) — importsuseEnvironmentand passesenvironmentURLtoopenLink(getZenefitsSetupLink(policyID), environmentURL)inside auseEffect. Returnsnull. MatchesConnectToGustoFlow/index.tsxexactly.index.native.tsx— full-screen modal withHeaderWithBackButtonandFullPageOfflineBlockingViewwrapping aWebViewloading the setup link.Tests
getZenefitsSetupLinkreturns the expected URL shape.updateZenefitsApprovalModeproduces correct optimistic / success / failure Onyx data.Issue Owner
Current Issue Owner: @ShridharGoel