Technical Changes in Spartacus 3.0
Note: Spartacus 4.x is no longer maintained. Please upgrade to the latest version.
Note: Spartacus 4.x was tested with SAP Commerce Cloud versions 1905 to 2205. Spartacus 4.x has not been verified to work with (and is not guaranteed to work with) SAP Commerce Cloud 2211 or later releases.
Table of Contents
- Breaking Changes Introduced in 3.0
- Translations (i18n) changed
- Default router options changed
- Page Layout
- Static CMS structure config changes
- OCC prefix
- Storefront config
- JSON-LD schemas
- ContentPageMetaResolver
- LoginFormComponent
- HttpClientModule is not imported in feature libraries
- SSR engine optimizations
- Store finder functionality was moved to a new library
- StockNotificationComponent
- CmsComponentsService
- Config cmsComponents
- PageMetaService lazy-loading related changes
- ConverterService lazy-loading related changes
- Payload for constructor of PlaceOrder class from Checkout actions requires an additional property
- PlaceOrderComponent
- Property renamed in SearchConfig interface
- Changes in CheckoutStepsState interface
- Changes in CheckoutState interface
- OutletRefDirective unregisters template on destroy
- CartItemComponent lost members
- CartItemListComponent
- AddToCartComponent
- Auth module refactor
- KymaModule
- ASM module refactor
- CDC library
- OrderDetailHeadlineComponent
- OrderDetailShippingComponent
- OrderConfirmationOverviewComponent
- BaseSiteService
- ConfigInitializerService constructor
- CmsComponentsService constructor
- CheckoutProgressMobileBottomComponent
- CheckoutProgressMobileTopComponent
- CheckoutProgressComponent
- DeliveryModeComponent
- PaymentMethodComponent
- ShippingAddressComponent
- CheckoutAuthGuard
- CheckoutConfigService
- The placeOrder method for CheckoutAdapter, OccCheckoutAdapter and CheckoutConnector
- BreakpointService
- ProtectedRoutesGuard
- ItemCounterComponent
- ViewComponent
- UpdateEmailComponent
- StorefrontComponent
- StarRatingComponent
- CartNotEmptyGuard
- NotCheckoutAuthGuard
- ProductVariantGuard
- LogoutGuard
- CurrentProductService
- MultiCartStatePersistenceService
- ProductReferenceService
- LanguageService
- CurrencyService
- OccCmsComponentAdapter
- UserState
- CloseAccountModalComponent
- BaseSiteState
- UserService
- UserOrderService
- Checkout selectors
- ProductListComponentService
- ProductCarouselService
- CheckoutService
- AnonymousConsentTemplatesAdapter
- AnonymousConsentTemplatesConnector
- SplitViewComponent
- Error payload of LOAD FAIL actions has changed in
@spartacus/core
- Automated Migrations for Version 3.0
Breaking Changes Introduced in 3.0
Translations (i18n) changed
- fixed the typo in the key
user.register.managementInMyAccount
(previously …managmentInMyAccount
) - key
checkout.checkoutReview.editShippingMethod
was removed - key
checkout.checkoutReview.editPaymentMethod
was removed
Default router options changed
The Angular router can be initialized with so-called ExtraOptions
in the forRoot
method of the RouterModule
. For more information, see https://angular.io/api/router/ExtraOptions.
The default ExtraOptions
have changed with 3.0. Before 3.0, Spartacus set the anchorScrolling
and scrollPositionRestoration
options. In Spartacus 3.0, the scrollPositionRestoration
was removed, and the relativeLinkResolution
and initialNavigation
have been added. See the following table for the actual values and reasoning:
Option | < 3.0 | ≥ 3.0 |
---|---|---|
anchorScrolling |
'enabled' |
'enabled' |
scrollPositionRestoration |
'enabled' |
(removed) |
relativeLinkResolution |
n/a | 'corrected' |
initialNavigation |
n/a | 'enabled' |
The enabled scrollPositionRestoration
was causing a bad experience in most cases, as it would scroll the page to the top on each route change. This is unexpected in a single page experience.
The corrected relativeLinkResolution
is used to opt-in to a fix that was added in Angular. This will become the default from Angular 11 onwards.
The enabled initialNavigation
provides a better experience with server-side rendering, which starts initial navigation before the root component is created and blocks bootstrap until the initial navigation is complete. For more information, see the Angular documentation.
The RouterModule.forRoot()
method can actually be called only once in an Angular application. This makes the default options rather opinionated, which is why the default configurations are carefully selected in Spartacus. The options that have been added or removed can be provided in your custom application with the Angular ROUTER_CONFIGURATION
injection token. The following is an example:
providers: [
{
provide: ROUTER_CONFIGURATION,
useValue: {
scrollPositionRestoration: 'enabled',
},
},
];
There is no automation (schematics) planned for this change.
Page Layout
With version 2.1, we started to add the page layout-based style class to the root element of the application (cx-storefront
). This was done in addition to the style class being added by the PageLayoutComponent
. The style class on the PageLayoutComponent
was considered to be too limited, as it would not affect selectors outside the page template component.
The implementation of the page layout-based style class has moved from the PageLayoutComponent
to the PageTemplateDirective
. This results in a cleaner PageLayoutComponent
with a constructor that no longer requires the lower level Renderer2
service and ElementRef
. The constructor reduces to the following signature:
constructor(protected pageLayoutService: PageLayoutService) {}
We’ve also made the PageLayoutService
a protected argument, so that it is extensible.
There is no automation (schematics) planned to migrate constructors automatically.
Static CMS structure config changes
The default-header-config
and default-cms-content-config
have been removed. To create CMS content, use the defaultCmsContentProviders
instead.
OCC prefix
The default value for the backend.occ.prefix
configuration option was changed from /rest/v2/
to /occ/v2/
.
Storefront config
The new config SeoConfig
is imported.
JSON-LD schemas
To continue using JSON-LD schemas in Spartacus, or to start using JSON-LD schemas in Spartacus, you need to import the JsonLdBuilderModule
to your application.
ContentPageMetaResolver
The ContentPageMetaResolver
has a new required constructor dependency RoutingPageMetaResolver
.
LoginFormComponent
It is no longer the responsibility of the LoginFormComponent
to redirect to the anticipated page (it no longer calls the method AuthRedirectService.redirect
). Now the redirecting logic is placed inside the core AuthService
to support more OAuth flows.
The LoginFormComponent
no longer has the loginAsGuest
and sub
properties, and the ngOnDestroy
method was removed as well.
HttpClientModule is not imported in feature libraries
In most cases, the HttpClientModule
should only be imported in the root app module, because importing it in lazy-loaded modules can
cause unexpected side effects regarding the visibility of HTTP_INTERCEPTORS
, and so on. To fix this, we removed all HttpClientModule
imports from all of our feature libraries and moved them to recipes.
There is no automation (schematics) planned for this change.
SSR engine optimizations
The NgExpressEngineDecorator
now adds SSR optimization logic on top of the universal engine by default.
The NgExpressEngineDecorator
was moved from @spartacus/core
to @spartacus/setup/ssr
. Also, the NgExpressEngineDecorator.get()
method now accepts an additional second parameter to fine-tune SSR optimizations. Passing null
there will turn off optimizations by removing the optimization layer completely (which brings back default 2.x behavior).
Store finder functionality was moved to a new library
The store finder logic from @spartacus/core
and the store finder components from @spartacus/storefront
were moved to respective entry points in the @spartacus/storefinder
library. Store finder translations (storeFinderTranslations
) and translation chunks (storeFinderTranslationChunksConfig
) were moved to @spartacus/storefinder/assets
.
Store finder functionality is now also lazy-loadable out of the box.
StockNotificationComponent
The StockNotificationComponent
has a new required UserIdService
dependency, but no longer depends on AuthService
.
CmsComponentsService
The return type for the CmsComponentsService.getChildRoutes
method has changed from Route[]
to CmsComponentChildRoutesConfig
.
Config cmsComponents
The childRoutes
property of the cmsComponents
config changed type from Route[]
to Route[] | CmsComponentChildRoutesConfig
.
PageMetaService lazy-loading related changes
- The return type for the
PageMetaService.getMeta
method changed fromObservable<PageMeta>
toObservable<PageMeta | null>
so it can take into account page meta resolvers from lazy-loaded features. - The return type for the
PageMetaService.getMetaResolver
protected method changed fromPageMateResolver
toObservable<PageMetaResolver>
so it can take into account page meta resolvers from lazy-loaded features. - The constructor for
PageMetaService
now uses theUnifiedInjector
instead of injecting thePageMetaResolver
token directly.
ConverterService lazy-loading related changes
The constructor for ConverterService
now uses the UnifiedInjector
instead of the standard Injector
.
Payload for constructor of PlaceOrder class from Checkout actions requires an additional property
The Checkout.action
constructor payload now needs an additional termsChecked
property.
PlaceOrderComponent
- The
placeOrderSubscription
property was removed. There is no replacement. - The component has the following new, required constructor dependencies:
CheckoutReplenishmentFormService
,LaunchDialogService
andViewContainerRef
.
Property renamed in SearchConfig interface
The sortCode
property in the SearchConfig
interface was renamed to sort
.
Changes in CheckoutStepsState interface
- The
CheckoutStepsState
interface has a new, required property:poNumber: { po: string; costCenter: string; };
- The type for the
orderDetails
property was changed fromOrder
toOrder | ReplenishmentOrder
Changes in CheckoutState interface
The CheckoutState
interface has the following new, required properties:
paymentTypes: PaymentTypesState;
orderType: OrderTypesState;
OutletRefDirective unregisters template on destroy
The directive’s template in unregistered from the outlet on directive destroy.
Before v3.0, when an instance of OutletRefDirective
was destroyed (removed from the DOM), its template remained registered for the outlet, which could cause the same template to be rendered multiple times if the same [cxOutletRef]
was created again later on. This has now been fixed.
CartItemComponent lost members
The @Output()
view
and viewItem()
members of the CartItemComponent
have been removed. Use the [cxModal]
directive instead to close modals on link click.
CartItemListComponent
There can be more than one cart entry with the same product code. So now they are referenced by the entryNumber
property instead of the product code in the CartItemListComponent
.
AddToCartComponent
The AddToCartComponent
lost the following members:
increment
- use the newnumberOfEntriesBeforeAdd
insteadcartEntry$
- useactiveCartService.getLastEntry(productCode)
instead
Auth module refactor
The @spartacus/core
library has a new dependency on the angular-oauth2-oidc
library. It is used to handle OAuth login and logout flows in Spartacus.
Store
AuthSelectors
were removed. Selectors related to the client token were moved underClientAuthSelectors
. The user token is no longer stored in NgRx Store. To get the token, use theAuthStorageService.getToken
method.StateWithAuth
was removed. The state related to the client token was moved toStateWithClientAuth
. Data related to the user token are stored inAuthStorageService
andUserIdService
.AuthState
was removed. The state related to the client token was moved toClientAuthState
. Data related to the user token are stored inAuthStorageService
andUserIdService
.UserTokenState
was removed. Data related to the user token are no longer stored in NgRx Store. The user token is stored inAuthStorageService
and the user id is stored inUserIdService
.AUTH_FEATURE
was removed. The client token state is under the key from theCLIENT_AUTH_FEATURE
variable.- The value of the
CLIENT_TOKEN_DATA
variable changed to[Client auth] Client Token Data
. Previously, it was[Auth] Client Token Data
. AuthActions
now only containsLogin
andLogout
action classes andLOGIN
andLOGOUT
variables with action type. Actions related to the client token (LoadClientToken...
) are now available underClientAuthActions
export. TheLOGOUT_CUSTOMER_SUPPORT_AGENT
constant is available inAsmActions
export. Actions related to the user token were removed (LOAD_USER_TOKEN
,LOAD_USER_TOKEN_FAIL
,LOAD_USER_TOKEN_SUCCESS
,REFRESH_USER_TOKEN
,REFRESH_USER_TOKEN_FAIL
,REFRESH_USER_TOKEN_SUCCESS
,REVOKE_USER_TOKEN
,REVOKE_USER_TOKEN_FAIL
,REVOKE_USER_TOKEN_SUCCESS
,LoadUserToken
,LoadUserTokenFail
,LoadUserTokenSuccess
,RefreshUserToken
,RefreshUserTokenSuccess
,RefreshUserTokenFail
,RevokeUserToken
,RevokeUserTokenSuccess
andRevokeUserTokenFail
). Instead, initialize the user token load, and refresh or revoke with methods exposed inAuthService
andOAuthLibWrapperService
.
Models
- The
UserToken
interface was replaced with theAuthToken
interface. The new interface contains different properties from the previous interface in order to match the requirements of theangular-oauth2-oidc
library. - The
AuthenticationToken
interface was removed. UseAuthToken
orClientToken
directly. - The
Occ.UserGroupList
interface was removed. - The
Occ.UserSignUp
interface was removed.
Guards
NotAuthGuard
now returnsObservable<UrlTree>
as the homepage for logged-in users, instead of invoking a redirect. The constructor also changed for this guard. TheRoutingService
is no longer needed, butSemanticPathService
andRouter
are now required.AuthGuard
now returnsObservable<UrlTree>
as the login page for anonymous users, instead of invoking a redirect. The constructor also changed for this guard. TheRoutingService
is no longer needed, butSemanticPathService
is now required.
Services
AuthRedirectService
now requiresAuthRedirectStorageService
. Please ensure to provide it. It is a replacement for theredirectUrl
private variable.AuthService
now requiresUserIdService
,OAuthLibWrapperService
,AuthStorageService
,AuthRedirectService
andRoutingService
.AuthService.authorize
was renamed tologinWithCredentials
. It returns a Promise that resolves after the login procedure completes. Instead of dispatching an action, the method now invokes the login method from the OAuth library and sets the correct userId, dispatches theLogin
action, and redirects to the previously-visited page.AuthService.getOccUserId
was removed fromAuthService
. Use theUserIdService.getUserId
method instead. It is the direct replacement.AuthService.invokeWithUserId
was moved toUserIdService
. It is available under the same name.AuthService.getUserToken
was removed. To check if a user is logged in, useisUserLoggedIn
, and to get the user id, useUserIdService.getUserId
. If you need access to tokens, useAuthStorageService.getToken
.AuthService.refreshUserToken
was moved and renamed toOAuthLibWrapperService.refreshToken
. The behavior changed as well. It not only dispatches actions, but performs a complete token refresh procedure from the OAuth library.AuthService.authorizeWithToken
was removed. Instead, you can create an object of the shapeAuthToken
and pass it toAuthStorageService.setToken
.- The
AuthService.logout
method changed behavior to redirect to thelogout
page. Then the methodAuthService.coreLogout
is dispatched and performs operations previously done by thelogout
method (Logout action dispatch, clearing local state, revoking tokens). AuthService.getClientToken
,AuthService.refreshClientToken
andAuthService.isClientTokenLoaded
were moved toClientTokenService
.
Config
AuthConfig
no longer extendsOccConfig
.- The
login
andrevoke
endpoints were removed fromOccConfig
. Thelogin
endpoint is now available under thetokenEndpoint
property inAuthConfig
. Therevoke
endpoint is available under therevokeEndpoint
property inAuthConfig
. - The
storageSync
configuration for theauth
branch in NgRx Store was removed. The state of the token and userId is now synchronized withAuthStatePersistenceService
. Override this service if you want to sync more properties tolocalStorage
(for example,refresh_token
). - The
storageSync
configuration for theanonymous-consents
branch in NgRx Store was removed. The state is now synchronized withAnonymousConsentsStatePersistenceService
. Override this service if you want to sync more or less properties tolocalStorage
.
KymaModule
The KymaModule
was removed with all its code. We expose the same functionality through configuration of auth.
To fetch the OpenId
token along with the access token in Resource Owner Password Flow, you have to use following configuration:
authentication: {
client_id: 'client4kyma',
client_secret: 'secret',
OAuthLibConfig: {
responseType: 'id_token',
scope: 'openid',
customTokenParameters: ['token_type', 'id_token'],
}
}
Then you can access the OpenId
token with the OAuthLibWrapperService.getIdToken
method. For more options related to the OpenId
token, look into the angular-oauth2-oidc
library documentation.
ASM module refactor
getCustomerSupportAgentTokenState
,getCustomerSupportAgentToken
andgetCustomerSupportAgentTokenLoading
were removed fromAsmSelectors
. To get a token, useAuthStorageService.getToken
andAsmAuthStorageService.getTokenTarget
to check if it belongs to the CS agent.- Effects in
AsmModule
now usenormalizeHttpError
instead ofmakeErrorSerializable
for error transformation. - The
storageSync
configuration for theasm
branch in NgRx Store was removed. The state of the ASM UI and tokens is now synchronized withAsmStatePersistenceService
. - The
CSAGENT_TOKEN_DATA
variable was removed. - The
AsmState.csagentToken
was removed. The token is now stored inAuthStorageService
. CheckAsmAuthStorageService.getTokenTarget
to validate if the token belongs to the CS agent. AsmActions
no longer contains actions related to the customer agent token (LoadCustomerSupportAgentToken
,LoadCustomerSupportAgentTokenFail
,LoadCustomerSupportAgentTokenSuccess
). Instead, interact directly withCsAgentAuthService
.- The
CustomerSupportAgentTokenInterceptor
interceptor was removed. Token and error handling for CS agent requests are now handled byAuthInterceptor
andAsmAuthHttpHeaderService
.
AsmAuthService
The AsmAuthService
was renamed to CsAgentAuthService
. This service is now responsible for making the AuthService
aware of ASM, and adjusts it for CS agent support.
AsmAuthService.authorizeCustomerSupportAgent
was moved toCsAgentAuthService
. It now performs full login flow for the CS agent and resolves when it completes.AsmAuthService.startCustomerEmulationSession
was moved toCsAgentAuthService
. Behavior has not changed.AsmAuthService.isCustomerEmulationToken
was removed. To check the token, useAuthStorageService.getToken
, and to check if it belongs to the CS agent, useAsmAuthStorageService.getTokenTarget
.AsmAuthService.getCustomerSupportAgentToken
was removed. To check the token, useAuthStorageService.getToken
and to check if it belongs to the CS agent, useAsmAuthStorageService.getTokenTarget
.-
AsmAuthService.getCustomerSupportAgentTokenLoading
was moved toCsAgentAuthService
.Note: It is not implemented there yet.
AsmAuthService.logoutCustomerSupportAgent
was moved toCsAgentAuthService
. It performs the logout procedure for the CS agent and resolves when it completes.
CDC library
CdcUserTokenEffects
now usesnormalizeHttpError
for error serialization.- The
CdcUserTokenEffects.loadCdcUserToken$
effect now callsCdcAuthService.loginWithToken
instead of dispatchingAuthActions.LoadUserTokenSuccess
action. CdcAuthService
no longer extendsAuthService
.CdcAuthService
has the following new, required dependencies:AuthStorageService
,UserIdService
,GlobalMessageService
andAuthRedirectService
need to provided.- The
CdcAuthService.authorizeWithCustomCdcFlow
method was renamed tologinWithCustomCdcFlow
. - The
CdcAuthService.logout
method was removed. Now CDC hooks into the logout process by providingCdcLogoutGuard
asLogoutGuard
. CdcJsService
now requiresAuthService
becauseCdcAuthService
no longer extends it.AuthService
should be passed afterCdcAuthService
.CdcAuthService
is available in the service undercdcAuth
andAuthService
is available under theauth
property. Additionally,GlobalMessageService
andAuthRedirectService
are not longer required. Note that we do not provide automatic migration for that constructor change.
OrderDetailHeadlineComponent
The OrderDetailHeadlineComponent
was removed.
OrderDetailShippingComponent
The following functions have been removed from the OrderDetailShippingComponent
component:
getAddressCardContent()
getBillingAddressCardContent()
getPaymentCardContent()
getShippingMethodCardContent()
You can use the OrderOverviewComponent
instead.
OrderConfirmationOverviewComponent
The following functions have been removed from the OrderConfirmationOverviewComponent
component:
getAddressCardContent()
getDeliveryModeCardContent()
getPaymentInfoCardContent()
getBillingAddressCardContent()
The return type for order$
was changed from Observable<Order>
to Observable<any>
.
BaseSiteService
The BaseSiteService
type is changed from BaseSiteService implements SiteContext<string>
to BaseSiteService implements SiteContext<BaseSite>
.
The return type of the getAll()
function is changed from getAll(): Observable<string[]>
to getAll(): Observable<BaseSite[]>
.
The return type of the setActive(baseSite: string)
function is changed from setActive(baseSite: string): Subscription
to setActive(baseSite: string): void
.
ConfigInitializerService constructor
An additional parameter was added to the ConfigInitializerService
constructor. Before 3.0, it was the following:
constructor(
@Inject(Config) protected config: any,
@Optional()
@Inject(CONFIG_INITIALIZER_FORROOT_GUARD)
protected initializerGuard
) {}
In Spartacus 3.0, it is the following:
constructor(
@Inject(Config) protected config: any,
@Optional()
@Inject(CONFIG_INITIALIZER_FORROOT_GUARD)
protected initializerGuard,
@Inject(RootConfig) protected rootConfig: any
CmsComponentsService constructor
An additional parameter was added to the CmsComponentsService
constructor. Before 3.0, it was the following:
constructor(
protected config: CmsConfig,
@Inject(PLATFORM_ID) protected platformId: Object
) {}
In Spartacus 3.0, it is the following:
constructor(
protected config: CmsConfig,
@Inject(PLATFORM_ID) protected platformId: Object,
protected featureModules?: FeatureModulesService
) {}
The configurationFactory was removed
The configuration merging logic now uses separate tokens for the default configuration and the user configuration.
CheckoutProgressMobileBottomComponent
- The
routerState$
property was removed. This logic is now handled bycheckoutStepService
. - The
activeStepUrl
property was removed. This logic is now handled bycheckoutStepService
. - The
steps
property was removed. Usesteps$
instead.
CheckoutProgressMobileTopComponent
- The
routerState$
property was removed. This logic is now handled bycheckoutStepService
. - The
activeStepUrl
property was removed. This logic is now handled bycheckoutStepService
. - The
steps
property was removed. Usesteps$
instead.
CheckoutProgressComponent
- The
routerState$
property was removed. This logic is now handled bycheckoutStepService
. - The
activeStepUrl
property was removed. This logic is now handled bycheckoutStepService
. - The
steps
property was removed. Usesteps$
instead.
DeliveryModeComponent
- The
checkoutStepUrlNext
property was removed. This logic is now handled bycheckoutStepService
. - The
checkoutStepUrlPrevious
property was removed. This logic is now handled bycheckoutStepService
. - The
currentDeliveryModeId
property was removed. The current delivery mode selection is stored in a form called “mode” in the “deliveryModeId” input field. Also, you can useCheckoutDeliveryService.getSelectedDeliveryMode()
to access the selected delivery mode in the checkout state. - The
supportedDeliveryModes$
property was modified. This observable will now only emit when the data in the list of supported delivery modes changes. - The
next()
function does not update the delivery mode on the cart because the delivery mode is already updated on the cart when the component initializes, and when a choice is made in the delivery mode form.
PaymentMethodComponent
- The
checkoutStepUrlNext
property was removed. This logic is now handled bycheckoutStepService
. - The
checkoutStepUrlPrevious
property was removed. This logic is now handled bycheckoutStepService
. - The
goNext
method was renamed tonext
. - The
goPrevious
method was renamed toback
.
ShippingAddressComponent
- The
existingAddresses$
property was removed. - The
newAddressFormManuallyOpened
property was renamed toaddressFormOpened
. - The
goNext
method was renamed tonext
. - The
goPrevious
method was renamed toback
. - The
ShippingAddressComponent
now implementsOnDestroy
.
CheckoutAuthGuard
The canActivate
method now returns the type Observable<boolean | UrlTree
.
CheckoutConfigService
- The
steps
property was removed. UsecheckoutStepService
instead. - The
checkoutStepService
method was removed. Use thecheckoutStepRoute
method incheckoutStepService
instead. - The
getFirstCheckoutStepRoute
method was removed. Use thegetFirstCheckoutStepRoute
method incheckoutStepService
instead. - The
getFirstCheckoutStepRoute
method was removed. Use thegetFirstCheckoutStepRoute
method incheckoutStepService
instead. - The
getNextCheckoutStepUrl
method was removed. Use thegetNextCheckoutStepUrl
method incheckoutStepService
instead. - The
getPreviousCheckoutStepUrl
method was removed. Use thegetPreviousCheckoutStepUrl
method incheckoutStepService
instead. - The
getCurrentStepIndex
method was removed. Use thegetCurrentStepIndex
method incheckoutStepService
instead. - The
CheckoutConfigService
no longer usesRoutingConfigService
.
The placeOrder method for CheckoutAdapter, OccCheckoutAdapter and CheckoutConnector
The placeOrder
method for CheckoutAdapter
, OccCheckoutAdapter
and CheckoutConnector
now has a new, third, required argument: termsChecked: boolean
.
BreakpointService
- The public
window()
getter method was removed. Instead, you can directly reference thewindowRef
. - The protected
getClosest
method was removed. Instead, use thegetBreakpoint
method. - The
_breakpoints
property was removed. - The public
breakpoint$
getter was removed. Instead, use thebreakpoint$
property. - The
BreakpointService
has a new, requiredplatform
dependency.
ProtectedRoutesGuard
The return type of the ProtectedRoutesGuard.canActivate
method changed from Observable<boolean>
to Observable<boolean | UrlTree>
.
ItemCounterComponent
The ItemCounterComponent
component now implements OnInit
and OnDestroy
.
ViewComponent
The protected splitViewCount
getter method was removed.
UpdateEmailComponent
The return type of the onSuccess
method was changed from void
to Promise<void>
in order to wait for the logout to complete before updating the email.
StorefrontComponent
The param type of the collapseMenuIfClickOutside
method was changed from MouseEvent
to any
. The behavior has also been modified to only trigger when the header element is passed to the function.
StarRatingComponent
- The
StarRatingComponent
usesHostBinding
to bind to CSS custom properties (available since angular 9), which is why we no longer need theElementRef
andRenderer2
in the constructor. There is an automated constructor migration added for the 3.0 release. ngOnInit
is no longer used.- The
setRate
no longer requires a second argument (force
). - The
setRateOnEvent()
method is replaced by reusing thesetRate()
(which also fixes a bug). We now bindkeydown.space
directly from the view. The more generickeydown
output binding was removed.
CartNotEmptyGuard
- The return type of the
canActivate
method was changed fromObservable<boolean>
toObservable<boolean | UrlTree>
to support OAuth flows. SemanticPathService
is a new, required constructor dependency.Router
is new, required constructor dependency.CartNotEmptyGuard
no longer usesRoutingService
. The use of this service was replaced with the corresponding methods fromRouter
andSemanticPathService
.
NotCheckoutAuthGuard
The return type of the canActivate
method was changed from Observable<boolean>
to Observable<boolean | UrlTree>
to support OAuth flows.
ProductVariantGuard
- The
canActivate
method now requires a parameter of typeActivatedRouteSnapshot
.
LogoutGuard
- The return type of the
canActivate
method was changed fromObservable<boolean>
toObservable<boolean | UrlTree>
to support OAuth flows. - The return type of the
logout
method was changed fromvoid
toPromise<any>
to support OAuth flows. - The
redirect
method was removed. UsegetRedirectUrl
instead.
CurrentProductService
The getProduct
method now only emits distinct products.
MultiCartStatePersistenceService
The sync
method was renamed to initSync
.
ProductReferenceService
The get
method was removed. Use the getProductReferences
and loadProductReferences
methods instead.
LanguageService
The return type of the setActive
method was changed from Subscription
to void
.
CurrencyService
The return type of the setActive
method was changed from Subscription
to void
.
OccCmsComponentAdapter
The OCC CMS component API in SAP Commerce Cloud before version 1905 was using a POST method. This was changed in 1905 to use a GET method instead. Spartacus has supported both version from version 1.0 by using a legacy
flag to distinguish this back end API behavior. With the release of Spartacus 3.0, we maintain the support for the pre-1905 CMS component API, but the implementation was moved to a separate adapter (LegacyOccCmsComponentAdapter
). With that change, we are also dropping the legacy
flag in the OCC configuration.
UserState
The interface for the UserState
NgRx state now has the following new, required properties: replenishmentOrders
, replenishmentOrder
and costCenters
.
CloseAccountModalComponent
The userToken$
property of the CloseAccountModalComponent
was replaced with isLoggedIn$
of type Observable<boolean>
.
BaseSiteState
The BaseSiteState
interface has now a new, required entities: BaseSiteEntities
property.
UserService
The loadOrderList
method of the UserService
also loads replenishment orders when the URL contains a replenishment code.
UserOrderService
The getTitles
method of the UserOrderService
will load titles when it is empty.
Checkout selectors
The MemoizedSelector
return type of the getCheckoutOrderDetails
selector was changed from Order
to Order | ReplenishmentOrder
.
ProductListComponentService
- The
sub
property was removed fromProductListComponentService
. It is no longer used. - The
setQuery
method was removed fromProductListComponentService
. It is no longer used. - The
viewPage
method was removed fromProductListComponentService
. It is no longer used.
ProductCarouselService
The getProductReferences()
function was removed.
CheckoutService
- The
placeOrder
method of theCheckoutService
now requires atermsChecked
parameter. - The return type of the
getOrderDetails
method was changed fromObservable<Order>
toObservable<Order | ReplenishmentOrder>
.
AnonymousConsentTemplatesAdapter
The loadAnonymousConsents
method of AnonymousConsentTemplatesAdapter
is no longer optional.
AnonymousConsentTemplatesConnector
The return type of the loadAnonymousConsents
method of the AnonymousConsentTemplatesConnector
was changed from Observable<AnonymousConsent[] | null>
to Observable<AnonymousConsent[]>
.
SplitViewComponent
The subscription
property of the SplitViewComponent
is no longer protected. It is private now.
Error payload of LOAD FAIL actions has changed in @spartacus/core
It now has a consistent shape of HttpErrorModel
or is undefined
.
Automated Migrations for Version 3.0
CheckoutProgressMobileBottomComponent
no longer usesCheckoutConfig
,RoutingService
andRoutingConfigService
. The use of these services was replaced with the corresponding methods from theCheckoutStepService
. This service needs to be provided to theCheckoutProgressMobileBottomComponent
.CheckoutAuthGuard
no longer usesRoutingService
. The use of this service was replaced with the corresponding methods fromRouter
andSemanticPathService
. The additionalUserService
andGlobalMessageService
services also need to be provided toCheckoutAuthGuard
.CheckoutProgressMobileTopComponent
no longer usesCheckoutConfig
,RoutingService
andRoutingConfigService
. The use of these services was replaced with the corresponding methods fromCheckoutStepService
. This service needs to be provided toCheckoutProgressMobileTopComponent
.CheckoutProgressComponent
no longer usesCheckoutConfig
,RoutingService
andRoutingConfigService
. The use of these services was replaced with the corresponding methods fromCheckoutStepService
. This service needs to be provided toCheckoutProgressComponent
.DeliveryModeSetGuard
no longer usesCheckoutConfigService
. The use of this service was replaced with the corresponding methods fromCheckoutStepService
. This service needs to be provided toDeliveryModeSetGuard
.DeliveryModeComponent
no longer usesRoutingService
. The use of this service was replaced with the corresponding methods fromCheckoutStepService
. This service needs to be provided toDeliveryModeComponent
.LoginFormComponent
no longer usesActivatedRoute
,CheckoutConfigService
andAuthRedirectService
. The logic that used these services was moved to a different component.OrderDetailShippingComponent
no longer usesTranslationService
. The logic that used this service was moved toOrderDetailShippingComponent
.PaymentDetailsSetGuard
no longer usesCheckoutConfigService
. The use of this service was replaced with the corresponding methods fromCheckoutStepService
. This service needs to be provided toPaymentDetailsSetGuard
.PaymentMethodComponent
no longer usesCheckoutConfigService
andRoutingService
. The use of these services was replaced with the corresponding methods fromCheckoutStepService
. This service needs to be provided toPaymentMethodComponent
.ReviewSubmitComponent
no longer usesCheckoutConfigService
. The use of this service was replaced with the corresponding methods fromCheckoutStepService
. In addition,PaymentTypeService
,CheckoutCostCenterService
andUserCostCenterService
need to be provided toReviewSubmitComponent
.ShippingAddressSetGuard
no longer usesCheckoutConfigService
. The use of this service was replaced with the corresponding methods fromCheckoutStepService
. This service needs to be provided toShippingAddressSetGuard
.ShippingAddressComponent
no longer usesCheckoutConfigService
andRoutingService
. The use of these services was replaced with the corresponding methods fromCheckoutStepService
. This service needs to be provided toShippingAddressComponent
.MultiCartService
now requires the additional providerUserIdService
.PageSlotComponent
no longer usesCmsComponentsService
. The use of this service was replaced with thePageSlotService
.ForbiddenHandler
now usesGlobalMessageService
,AuthService
, andOccEndpointsService
.CheckoutPaymentService
no longer usesAuthService
. The use of this service was replaced with the corresponding methods fromUserIdService
.CheckoutService
no longer usesAuthService
. The use of this service was replaced with the corresponding methods fromUserIdService
.CustomerCouponService
no longer usesAuthService
. The use of this service was replaced with the corresponding methods fromUserIdService
.OrderReturnRequestService
no longer usesAuthService
. The use of this service was replaced with the corresponding methods fromUserIdService
.UserAddressService
no longer usesAuthService
. The use of this service was replaced with the corresponding methods fromUserIdService
.UserConsentService
now also requiresUserIdService
.UserInterestsService
no longer usesAuthService
. The use of this service was replaced with the corresponding methods fromUserIdService
.UserNotificationPreferenceService
no longer usesAuthService
. The use of this service was replaced with the corresponding methods fromUserIdService
.UserOrderService
no longer usesAuthService
. The use of this service was replaced with the corresponding methods fromUserIdService
. It now also requiresRoutingService
.UserPaymentService
no longer usesAuthService
. The use of this service was replaced with the corresponding methods fromUserIdService
.UserService
no longer usesAuthService
. The use of this service was replaced with the corresponding methods fromUserIdService
.ActiveCartService
no longer usesAuthService
. The use of this service was replaced with theUserIdService
.CartVoucherService
no longer usesAuthService
. The use of this service was replaced with theUserIdService
.SelectiveCartService
no longer usesAuthService
. The use of this service was replaced with theUserIdService
.WishListService
no longer usesAuthService
. The use of this service was replaced with theUserIdService
.CheckoutDeliveryService
no longer usesAuthService
. The use of this service was replaced with theUserIdService
.UnauthorizedErrorHandler
was removed.StarRatingComponent
no longer usesElementRef
andRenderer2
.ProductCarouselService
no longer usesProductReferenceService
.NotCheckoutAuthGuard
no longer usesRoutingService
. The use of this service was replaced with the corresponding methods fromSemanticPathService
andRouter
.StoreFinderSearchConfig
was removed.SearchConfig
should be used instead.ForgotPasswordComponent
now also requiresAuthConfigService
.OrderHistoryComponent
now also requiresUserReplenishmentOrderService
.OrderReturnGuard
no longer usesRoutingService
. The use of this service was replaced with the corresponding methods fromRouter
andSemanticPathService
.OrderCancellationGuard
no longer usesRoutingService
. The use of this service was replaced with the corresponding methods fromRouter
andSemanticPathService
.OutletRefDirective
no longer usesFeatureConfigService
.OutletService
no longer usesFeatureConfigService
.RoutingService
now also requiresRoutingParamsService
.TOKEN_REVOCATION_HEADER
was removed.JsonLdScriptFactory
now also requiresSeoConfig
.LogoutGuard
no longer usesRoutingService
. The use of this service was replaced with the corresponding methods fromRouter
.ProductVariantGuard
no longer usesRoutingService
. The use of this service was replaced with the corresponding methods fromRouter
andSemanticPathService
.FeatureModulesService
no longer has thegetInjectors
method.CmsComponentsService
no longer has thegetInjectors
method.ViewComponent
now also requiresChangeDetectorRef
.SplitViewDeactivateGuard
was removed.FeatureModulesService
no longer usesCompiler
. The newly-addedgetModule
method does not need it anymore.FeatureModulesService
no longer usesInjector
. The newly-addedgetModule
method does not need it anymore.FeatureModulesService
now usesLazyModulesService
.JsonLdProductReviewBuilder
now usesSeoConfig
.RegisterComponent
now usesAuthConfigService
.SplitViewComponent
now also requiresBreakpointService
andElementRef
.CheckoutGuard
now also requiresCheckoutStepService
.OrderConfirmationOverviewComponent
no longer usesTranslationService
. The logic using this service was moved to theOrderOverviewComponent
.