Given the commit description below, create a new text that will be placed in the…
- User
Given the commit description below, create a new text that will be placed in the README.MD file that explain how to create a new knowledge base advisor in detail. ------ START OF COMMIT MESSAGE Improve Pearl reusability and improve DX
You'll now be able to create a new Advisor from the knowledgeBase by:
Creating a new file under ~/modules/Advisor/pages. (e.g.: ~/modules/Advisor/pages/benefits/tier.tsx) Exporting a Module type defining its data and inputs, along with what we currently export (TranslationComponent, queryFragment, etc) export type Module = AdvisorKnowledgeBase< { countryBenefits: { collection: CountryBenefits[] } }, { salaryCurrencyCode: string, tier?: Tier }
Running the type generation command: yarn advisor:generate (this will update the generated-types.d.ts file with the new file you created)
You can create a default translation for when knowledge_base is missing by adding an entry to knowledge_base/Default.translation.js
From now on, you'll be able to use it with full type safety and autosuggest for the field name and for the extraInputs (if exists) on all APIs: onFocusHandler("benefits.tier", { extraInputs: { salaryCurrencyCode: "USD" }). Same for createTooltip and createTooltipHandler.
A great advantage is that this new structure will allow scoping under a domain, allowing the hiring advisor to be used more widely for other usecases.
~/modules/Advisor/pages/hiring/probationPeriod ~/modules/Advisor/pages/onboarding/bankAccount I'm also working on making the advisor more standalone, so that it can be used on other pages and contexts easily.
------ END OF COMMIT MESSAGE
- Assistant
To create a new knowledge base Advisor, follow these steps:
- Create a new file under
~/modules/Advisor/pages. For example, you could create a file called~/modules/Advisor/pages/benefits/tier.tsx. - In this new file, export a
Moduletype that defines the data and inputs for your Advisor. Here is an example of what this might look like:
codeexport type Module = AdvisorknowledgeBase< { countryBenefits: { collection: CountryBenefits[] } }, { salaryCurrencyCode: string, tier?: Tier } >- Run the type generation command:
yarn advisor:generate. This will update the file with the new file you created.
- Create a new file under