Skip to content

v0.11.0

Compare
Choose a tag to compare
@lauraluiz lauraluiz released this 17 Oct 16:53
· 209 commits to master since this release

Features

  • Availability logic is now processed and displayed for 3 states: "not available", "few items left" and "available".
  • Order list on my account are sorted descending by creation date.
  • Hardcoded image URLs in ProductOverviewPageContentFactory have been removed from the framework.

Configuration

  • Reduced the number of Guice Modules from conf/application.conf, so that it becomes easier to override behavior and migrate to other Sunrise versions. Some further details:

    • The Modules you might need to remove from your conf/application.conf are:
    play.modules.enabled += "com.commercetools.sunrise.common.contexts.RequestScopeModule"
    play.modules.enabled += "demo.common.ComponentsModule"
    play.modules.enabled += "com.commercetools.sunrise.common.contexts.ContextDataModule"
    play.modules.enabled += "com.commercetools.sunrise.common.basicauth.BasicAuthModule"
    play.modules.enabled += "com.commercetools.sunrise.common.template.TemplateModule"
    play.modules.enabled += "com.commercetools.sunrise.common.pages.FrameworkPageModule"
    
    • From the deleted Modules, those bindings that are Sunrise-internal and less likely to be overridden have been moved to SunriseModule, which now needs to be enabled in Play Framework:
      play.modules.enabled += "com.commercetools.sunrise.common.injection.SunriseModule"
    • Those bindings without Providers could be declared with Just-In-Time Bindings, effectively removing them from all Modules. In order to override them you just need to declare the binding in your own Module.
    • Those bindings that require a Provider need to be explicitly declared in your own Module, optionally using one of the Providers in Sunrise. Notice they are already declared in Sunrise Starter Project's default Module class.
  • SunriseHttpFilters has been dropped in favor of Play Framework's default Filters class, so that the enabled Play Filters are managed by the developer from a single place. Therefore you will need to remove it from your conf/application.conf:

    play.http.filters = "com.commercetools.sunrise.play.http.SunriseHttpFilters"
    

    The HttpAuthenticationFilter and CSRFFilter are enabled by default in Sunrise Starter Project's default Filters class.

Technical

  • Decoupled ReverseRouter from all the modules. Now the reverse routes are obtained via reflection directly from the conf/routes file, just by implementing your own ..ReverseRouter interface using the method getCallerForRoute(parsedRoutes, routeTag) (example code: ReflectionCartReverseRouter). At the same time, the routes need to be associated with the controller actions using some identifiable tag via the @SunriseRoute("someRouteTag") annotation. Enabling the route in Sunrise Theme can be easily done by modifying the PageMeta object from a Sunrise Component that implements PageDataReadyHook.
  • Sunrise Hooks have been renamed and moved into different packages according to their type. Additionally, each Hook contains now a static method runHook(hookRunner, ...) that conceals the complexity behind executing the Hook. There are currently 4 types of hooks:
    • ConsumerHook: allows using and modifying (if mutable) the consumed object. Follows the naming convention [Element][Status]Hook, e.g. PageDataReadyHook.
    • EventHook: after some event you are able to trigger some separate action, which in no case can alter the previous result. Follows the naming convention [Element][Status]Hook, e.g. CartLoadedHook, CartUpdatedHook, RequestStartedHook.
    • ActionHook: after some event you have the option to perform an additional action in order to replace the previous result. Follows the naming convention [Element][Status]ActionHook, e.g. CartLoadedActionHook, CartUpdatedActionHook.
    • RequestHook: right before executing a request (e.g. a SphereRequest) you are able to modify it, for example to add additional filter parameters. Follows the naming convention [RequestClassName]Hook, e.g. CartQueryHook, CartUpdateCommandHook.
  • Some controller interfaces have been renamed:
    • WithOverwriteableTemplateName -> WithTemplateName
    • FormBindingTrait -> WithForm
    • SimpleFormBindingControllerTrait -> WithFormFlow
  • ModelBean, the base class used for all view models, have been renamed to SunriseModel. The dynamic attributes are now located in ViewModel, which extends from SunriseModel.
  • Created HttpAuthentication interface and HttpAuthenticationFilter Play Filter to enable HTTP Authentication. The previous implementation BasicHttpAuthentication has been improved and follows this schema, so it can be enabled via injection binding it to HttpAuthentication.class.
  • Cart fetching related classes and methods have been renamed in order to remove the "primary" adjective, therefore understanding "cart" as the main shopping cart and any other variation will have its own name (e.g. wish list, reservation). Also requiringExistingPrimaryCartWithLineItem() has been renamed to requiringNonEmptyCart() for simplicity.
  • Updated to commercetools JVM SDK 1.3.0.
  • Updated to Sunrise Theme 0.61.1.
  • Updated to Play Framework 2.5.6.