generated from FlatFilers/getting-started
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* HCM Embed and FileFeed * Use new sync file feed route * Fix number rounding * Use webhook instead of v2 * Coderabbit fix and comment about filefeed
- Loading branch information
Showing
9 changed files
with
659 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { configureSpace } from '@flatfile/plugin-space-configure'; | ||
import * as hcmBlueprints from '@/workflows/hcm/blueprints/_index'; | ||
import { FlatfileListener } from '@flatfile/listener'; | ||
import { embeddedSpaceTheme } from '@/workflows/themes/embedded-space-theme'; | ||
import { embeddedSpaceDocument } from '@/workflows/plm/documents/embedded-space-document'; | ||
import api from '@flatfile/api'; | ||
import { HCM_WORKBOOK_NAME } from '@/shared/constants'; | ||
|
||
export function hcmEmbeddedSpaceConfigure(listener: FlatfileListener) { | ||
listener.use( | ||
configureSpace( | ||
{ | ||
documents: [embeddedSpaceDocument], | ||
workbooks: [ | ||
{ | ||
name: HCM_WORKBOOK_NAME, | ||
namespace: 'hcmImport', | ||
sheets: [hcmBlueprints.benefits], | ||
actions: [ | ||
{ | ||
operation: 'submitAction', | ||
mode: 'foreground', | ||
constraints: [{ type: 'hasData' }], | ||
label: 'Push records to HCM.show', | ||
primary: true, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
async (event) => { | ||
const { spaceId } = event.context; | ||
const documents = await api.documents.list(spaceId); | ||
|
||
// Get the first documentId | ||
const documentId = | ||
documents.data.length > 0 ? documents.data[0]['id'] : null; | ||
|
||
// Update the space adding theme and setting the documentId as the default page | ||
await api.spaces.update(spaceId, { | ||
metadata: { | ||
sidebarConfig: { | ||
showSidebar: true, | ||
defaultPage: { | ||
documentId, | ||
}, | ||
}, | ||
theme: embeddedSpaceTheme, | ||
}, | ||
}); | ||
} | ||
) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { configureSpace } from '@flatfile/plugin-space-configure'; | ||
import * as hcmBlueprints from '../blueprints/_index'; | ||
import { FlatfileListener } from '@flatfile/listener'; | ||
import { modifySheet } from '../../../shared/helpers/modifySheet'; | ||
import { fileFeedSpaceTheme } from '@/workflows/themes/file-feed-space-theme'; | ||
import { fileFeedSpaceDocument } from '@/workflows/hcm/documents/file-feed-space-document'; | ||
import api from '@flatfile/api'; | ||
import { HCM_WORKBOOK_NAME } from '@/shared/constants'; | ||
|
||
const modifiedBenefits = modifySheet(hcmBlueprints.benefits); | ||
|
||
export function hcmFileFeedSpaceConfigure(listener: FlatfileListener) { | ||
listener.use( | ||
configureSpace( | ||
{ | ||
documents: [fileFeedSpaceDocument], | ||
workbooks: [ | ||
{ | ||
name: HCM_WORKBOOK_NAME, | ||
namespace: 'hcmImport', | ||
sheets: [modifiedBenefits], | ||
actions: [ | ||
{ | ||
operation: 'submitAction', | ||
mode: 'foreground', | ||
constraints: [{ type: 'hasData' }], | ||
label: 'Submit Data', | ||
primary: true, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
async (event) => { | ||
const { spaceId } = event.context; | ||
const documents = await api.documents.list(spaceId); | ||
|
||
// Get the first documentId | ||
const documentId = | ||
documents.data.length > 0 ? documents.data[0]['id'] : null; | ||
|
||
// Update the space adding theme and setting the documentId as the default page | ||
await api.spaces.update(spaceId, { | ||
metadata: { | ||
sidebarConfig: { | ||
showSidebar: true, | ||
defaultPage: { | ||
documentId, | ||
}, | ||
}, | ||
theme: fileFeedSpaceTheme, | ||
}, | ||
}); | ||
} | ||
) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from './benefits'; | ||
export * from './departments'; | ||
export * from './employees'; | ||
export * from './jobs'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import { SheetConfig } from '@flatfile/api/api'; | ||
|
||
export const BENEFITS_SHEET_NAME = 'Benefit Elections'; | ||
|
||
export const benefits: SheetConfig = { | ||
name: BENEFITS_SHEET_NAME, | ||
slug: 'benefit-elections-sheet', | ||
readonly: false, | ||
fields: [ | ||
//Validate against exisitng Employess in DB. If not found, throw an error in Flatfile. Open question around whether this could be a ReferenceField with a lookup to the Employee table. What should happen if an Emplpyee is not found? Should we create a new Employee record in Flatfile or should that occur in HCM.Show? | ||
|
||
{ | ||
key: 'employeeId', | ||
label: 'Employee ID', | ||
description: 'Employee ID for existing Employee in HCM.Show.', | ||
type: 'string', | ||
constraints: [{ type: 'required' }], | ||
}, | ||
|
||
// Validate against exisitng benefit plans in DB. If not found, throw an error in Flatfile. Open question around whether this could be a ReferenceField with a lookup to the Benefit Plan table. What should happen if a Benefit Plan is not found? Should we create a new Benefit Plan record in Flatfile or should that occur in HCM.Show? | ||
|
||
{ | ||
key: 'benefitPlan', | ||
label: 'Benefit Plan', | ||
description: 'Benefit Plan for existing Benefit Plan in HCM.Show.', | ||
type: 'string', | ||
constraints: [{ type: 'required' }], | ||
}, | ||
|
||
//Required checkbox → “required: true” validation | ||
|
||
{ | ||
key: 'currentlyEnrolled', | ||
label: 'Currently Enrolled', | ||
description: 'Is the employee currently enrolled in this benefit plan?', | ||
type: 'boolean', | ||
constraints: [ | ||
{ type: 'required' }, | ||
{ type: 'external', validator: 'boolean' }, | ||
], | ||
}, | ||
|
||
//Date fields have a date format selection → updated target date format for SmartDateField | ||
|
||
{ | ||
key: 'coverageStartDate', | ||
label: 'Coverage Start Date', | ||
description: | ||
'Date coverage begins for this benefit plan. Must be formatted as yyyy-MM-dd', | ||
type: 'date', | ||
constraints: [ | ||
{ type: 'required' }, | ||
{ | ||
type: 'external', | ||
validator: 'date', | ||
config: { format: 'yyyy-MM-dd' }, | ||
}, | ||
], | ||
}, | ||
|
||
//Round to two decimal places → validation / compute on Number fields for decimal places (trim and validate) | ||
|
||
{ | ||
key: 'employerContribution', | ||
label: 'Employer Contribution', | ||
type: 'string', | ||
description: | ||
'Employer contribution for this benefit plan per plan frequency.', | ||
constraints: [ | ||
{ type: 'required' }, | ||
{ type: 'external', validator: 'number', config: { decimalPlaces: 2 } }, | ||
], | ||
}, | ||
|
||
{ | ||
key: 'benefitCoverageType', | ||
label: 'Benefit Coverage Type', | ||
type: 'enum', | ||
description: | ||
'Indicates the type of insurance, retirement savings, or other benefits that are provided by an employer to an employee.', | ||
constraints: [{ type: 'required' }], | ||
config: { | ||
options: [ | ||
{ | ||
value: 'Insurance_Coverage_Type_Insurance', | ||
label: 'Insurance', | ||
}, | ||
|
||
{ | ||
value: 'Health_Care_Coverage_Type_Medical', | ||
label: 'Medical', | ||
}, | ||
{ | ||
value: 'Health_Care_Coverage_Type_Dental', | ||
label: 'Dental', | ||
}, | ||
{ | ||
value: 'Retirement_Savings_Coverage_Type_Retirement', | ||
label: 'Retirement', | ||
}, | ||
{ | ||
value: 'Additional_Benefits_Coverage_Type_Other', | ||
label: 'Other', | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
actions: [ | ||
{ | ||
operation: 'dedupe-benefit-elections', | ||
mode: 'background', | ||
label: 'Dedupe benefit elections', | ||
description: 'Remove duplicate benefit elections', | ||
}, | ||
], | ||
}; |
Oops, something went wrong.