Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ability to customise recipe functions (supertokens#251)
* bumps version and changes changelog * changes to typing of user input * more types fixing * type fixing for thirdparty * type fixing for thirdpartyemailpassword * fixes types in emailpassword > components * fixes types in emailverification > components * gets all TS to build * builds and prettifies * fixes bug with emailverificaiton type inside authmodule * adds comments for types in emailverification * fixes use of emailverification recipe inside authmodule * changes to js map * fixes all tests * creates email password interface * gets ts to build * fixes tests * adds interface definition to thirdparty recipe * implements thirdparty interface * adds override config for thirdparty recipe and fixes tests * creates interface for thirdpartyemailpassword and some other refactors * fixes tests * reverts preAPIHook to how it used to be - for ease of use * refactors thirdparty recipe feature code to put it in the implementation class * cleans up props passed to theme in thirdparty and tpep recipe * cleans up props passed * changes to redirectToAuth function signature * fixes tests, and using one recipe inside the other without duplicate creation of objects * fixes tests * adds override for emailverification * adds recipe interface to session with ability to override * removes sigout API call from authrecipe module * fixes test * fires events when the relevant API is called as opposed to in feature logic. Removoes onSuccess callback function from base theme props * fires success events when the relevant API is called as opposed to in feature logic. * removes httpRequest from base class recipe class * moves with-ts project into test folder and removes unnecessary .ts files from the project * checks ts for override * Add component override context, make components functional, add override map This is the preliminary work to allow component overriding. * Rename theme components to include recipe name This aims to provide a unique name for each component to simplify overriding them. * adds few more recipe interface functions to session recipe to save, fetch session and to handle session expiry * removes handleSessionExpiry from recipe interface for sessions * changes to testing for normalisation of url and path * changes how path is normalised * Change component override context implementation to object, throw error on no context * Move override mechanism parts to a dedicated component directory * Add override map to normalised config, use override provider in feature component * Add overrides for ThirdParty and ThirdPartyEmailPassword recipes * updates use of session SDK * checks pre api hook for session recipe * Add default component override map for normalised configs * Make EmailVerification components overridable * Add component overrides for resetPasswordUsingToken feature * Enable override component for signInAndUpCallback feature * Change theme component exports to named exports This is done so that component names in React inspector match the override names. To accomplish that, a named export with variable matching the filename is exported instead of default. Otherwise, the only way to do this would be to use variable shadowing, like: ```ts export const EmailPasswordSignUp = withOverride("EmailPasswordSignUp", class EmailPasswordSignUp extends ... ); // or export const EmailPasswordSignUp = withOverride("EmailPasswordSignUp", function EmailPasswordSignUp(...)); ``` Since variable shadowing is not recommended and this is pretty ugly, unexpected and "tricky", current approach was used. * updates changelog * Add .idea to gitignore, check for undefined or null context in withOverride * detects if withOverride is being using without parent provider * Add component testing framework, test withOverride as an example * Move jest.config.js to test/unit * Move tsconfig.test.json to test/unit folder, adjust testRegex config * Add unit component-testing step to test script * Remove redundant check of null or undefined context This probably was a merging leftover. * Extend emailVerification override with components override map * Pass component overrides to recipes instantiated within ThirdPartyEmailPassword * Update withOverride test to throw an error without parent provider * Test EmailPassword component overrides * Enforce testing all overridable components in tests * Change default to named exports in remaining recipes, add missing override tests * adds prop-types to dev dependency * fixes routing issue when base path is / * streamlines type of override function * updates dependencies * Separate e2e test script in package file * Add Querier preApiHook tests * Separate e2e test script in package file * Test embedding component behaviour using disableDefaultImplementation * Add EmailVerification and ResetPassword tests * Fix EmailVerification test issue by signing up * Add preAPIHook and onHandleEvent handlers, test handlers * changes input type of thirdparty * Remove leftover page.screenshot call * Link an issue to a refresh session workaround * Add EmailPassword recipe override tests * Add ThirdParty recipe override tests * Add Session recipe override tests * Add ThirdPartyEmailPassword recipe override tests * Use log with prefix function in override implementations * Add EmailVerification implementation overrides tests for all recipes * changes to pre api hook action name for third party * changes to tests for previous commit * fixes to tests Co-authored-by: Marek Dulowski <[email protected]>
- Loading branch information