3.18 -> 3.19
This page lists the highlights for upgrading a project from Front-Commerce 3.18 to 3.19
Update dependencies
Update all your @front-commerce/* dependencies to this version:
pnpm update "@front-commerce/*@3.19.0"
Automated Migration
We provide a codemod to automatically update your codebase to the latest version of Front-Commerce. This tool will update your code when possible.
pnpm run front-commerce migrate --transform 3.19.0
Manual Migration
Custom External Login Providers
If you have created a
custom external login provider,
you need to update the parseProfileFromProviderCallback method.
The method signature has changed to return { profile, rawProfile } instead of
just Profile. This change enables the new
profile and payload transformers
feature.
Update your custom provider as follows:
import type {
Profile,
ExternalLoginProvider,
} from "@front-commerce/core/external-login";
class SSOCompanyProvider implements ExternalLoginProvider {
name = "sso-company";
loginRoute(callbackUrl: string): string {
return `https://sso.mycompany.com/login/oauth2?callback=${callbackUrl}`;
}
async parseProfileFromProviderCallback(
- request: Request
- ): Promise<Profile | undefined> {
+ request: Request,
+ callbackUrl: string
+ ): Promise<{ profile: Profile; rawProfile: unknown } | undefined> {
try {
const requestJson = await request.json();
- return {
- email: requestJson.profile.email,
- firstname: requestJson.profile.firstname,
- lastname: requestJson.profile.lastname,
- };
+ return {
+ profile: {
+ email: requestJson.profile.email,
+ firstname: requestJson.profile.firstname,
+ lastname: requestJson.profile.lastname,
+ },
+ rawProfile: requestJson,
+ };
} catch (e) {
return undefined;
}
}
}
The rawProfile should contain the complete response from your OAuth provider.
This allows profile transformers to access any additional fields from the
provider's response.
Take advantage of this change to implement profile and payload transformers if you need to enrich user profiles or customize customer creation payloads.