Monite React SDK v4 migration guide
Overview
This guide provides step-by-step instructions on migrating to the latest version of the Monite React SDK. Please read carefully and ensure all steps are followed to avoid potential issues.
Upgrade steps
Uninstall old dependencies
The @monite/sdk-api package has been deprecated.
All API calls are now part of the main @monite/sdk-react package.
You will need to uninstall the deprecated package and update the imports.
Replace deprecated methods
If your code uses deprecated methods, replace them with the new recommended alternatives as detailed in the changelog.
New MoniteProvider syntax
The @monite/sdk-api package has been deprecated.
All API calls are now part of the main @monite/sdk-react package.
Also, the MoniteSDK object that was used to initialize the MoniteProvider has been removed.
The MoniteProvider.monite prop now expects a plain JavaScript object instead of a MoniteSDK instance.
The following example shows the old and new syntaxes.
New SDK v4 syntax
Old SDK v3 syntax
Theming update
Key changes
- No more Material UI. The new theme object is a custom solution and no longer uses the Material UI theme specification.
- paletteis now- colors. The- paletteobject has been replaced by a flatter- colorsobject. Color definitions are now a single string value instead of an object with- mainand- contrastText.
- New top-level properties. borderRadiusandspacinghave been added to control general UI metrics.
- Simplified typography. Typography variants have been standardized, and values are now primarily numbers instead of strings.
Migration steps
Follow these steps to convert your old customTheme object to the new format.
1. Update color definitions (palette → colors)
The palette object is now colors.
You’ll need to map your old color values to the new, simplified keys:
- Take the mainvalue from your old color objects (e.g.palette.primary.main).
- Assign this string directly to the new color key (e.g. colors.primary).
New theme structure in SDK v4
Old theme structure in SDK v3
2. Update typography
The typography object is similar but has key differences in its variants and value types.
- Value types: fontSizeandfontWeightshould now be numbers, not strings (e.g.500not"500").lineHeightremains a string with apxunit.
- Variant names: Some variants like buttonhave been removed in favor of more semantic names likebody1orbody2. You’ll need to map your old styles to the most appropriate new variant.
New typography in SDK v4
Old typography in SDK v3
3. Add new global properties
Add the new borderRadius and spacing properties at the top level of your theme object.
You can use the default values to start.
❌ Unsupported & deprecated properties
The following properties from the old Material UI theme are no longer supported:
- palette.mode: The light/dark mode toggle is not supported anymore.
- palette.*.contrastText: The new- colorsobject does not have a field for contrasting text color. This is now handled internally.
- palette.background.paper: This is simplified to- colors.background.
- palette.text.secondary: This is simplified to- colors.text.
- typography.button: This variant has been removed. Use- body1or- body2instead.
- typography.*.textTransform: This CSS property can no longer be configured through the theme.
Complete theme migration example
Here is a full conversion of the sample customTheme from the old format to the new format.
SDK v4 (new)
SDK v3 (old)
Troubleshooting
If you encounter any issues during or after the migration, refer to the full Monite SDK documentation for usage tips and FAQs.
Support
For further assistance, contact our support team.