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.
palette
is nowcolors
. Thepalette
object has been replaced by a flattercolors
object. Color definitions are now a single string value instead of an object withmain
andcontrastText
.- New top-level properties.
borderRadius
andspacing
have 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
main
value 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:
fontSize
andfontWeight
should now be numbers, not strings (e.g.500
not"500"
).lineHeight
remains a string with apx
unit. - Variant names: Some variants like
button
have been removed in favor of more semantic names likebody1
orbody2
. 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 newcolors
object does not have a field for contrasting text color. This is now handled internally.palette.background.paper
: This is simplified tocolors.background
.palette.text.secondary
: This is simplified tocolors.text
.typography.button
: This variant has been removed. Usebody1
orbody2
instead.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.