V1 SDK Guide
Upgrading from V1 to V2
This guide outlines some of the biggest changes you need to make to upgrade from V1 to V2. Scroll down to the bottom for instructions on how to use V1 and V2 at the same time.
Provider theme
In V2, we have a fully-fledged theming system that allows you to customize every token in our design system. If you used V1’s theme colors, you can convert them to V2 like so:
Note that colorTextSecondary
was deprecated and doesn’t have a V2 equivalent.
Global style overrides
We no longer wrap descendents of the Frigade Provider in a container element, as we found that for most users adding an extra wrapper to the DOM at (or near) the top was more disruptive than helpful.
As a result, we no longer support the config.defaultAppearance.styleOverrides
property that existed on FrigadeProvider
in V1.
We now recommend that you author global styles using your existing CSS workflow.
Component style overrides
We use Emotion’s CSS prop in V2, so you can write any CSS that Emotion supports directly on any component:
Important difference between V1 styleOverrides
and V2 css
props:
The V2 css
prop accepts a style object, which means that if you’re using V1’s styleOverrides
prop to pass Tailwind classNames through to sub-components, you’ll need to update your code to pass Tailwind’s arbitrary variants, e.g.:
Navigation
The navigate
prop is now a top-level prop on Provider, it is no longer nested inside config
:
Event handlers
The catch-all onButtonClick
prop has been replaced with individual handlers for onPrimary
, onSecondary
, onDismiss
, and onComplete
.
Full definitions of each handler are available in our component docs
Hooks
Our SDK hooks now expose objects from our JS SDK directly, for example useFlow returns an instance of Flow, which you can operate directly on as you would in the JS SDK.
Running V1 and V2 together
If you already have a V1 implementation and aren’t ready to fully upgrade yet, you can use both V1 and V2 at the same time. This setup allows you to import V1 components from @frigade/react
and V2 components from @frigade/reactv2
.
Instructions
First, install V2 using a package alias:
Then add the V2 `Provider` above the V1 `FrigadeProvider`:
Sharing state between V1 and V2
When using V1 and V2 together, state is not shared between the two providers. Be sure to call frigade.reload()
from the useFrigade() hook (V2) and/or refresh()
from the useFlows()
hook (V1).