Skip to content

[Due for payment 2026-05-26] [TriNet] Create Zenefits.ts action + ConnectToZenefitsFlow component (OAuth flow) #90581

Description

@yuwenmemon

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 OwnerCurrent Issue Owner: @ShridharGoel

Metadata

Metadata

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions