Skip to content

Releases: commercetools/commercetools-sunrise-java

v0.11.0

17 Oct 16:53
Compare
Choose a tag to compare

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.

v0.10.0

17 Aug 13:51
Compare
Choose a tag to compare

Technical

  • Checkout's Payment and Shipping pages have been reworked and are now completely integrated in Sunrise Framework:

    • Some related templates have been changed, check shipping-form.hbs and payment-form.hbs.
    • The associated view models are generated via injected factories.
    • The injected factories are using Play Forms instead of own classes.
    • Pages are correctly displaying form errors.
    • Controllers are completely overridable and allow components to be registered.
    • Controllers are following Form structure from Sunrise.
  • A cart instance in commercetools platform is now only created when is strictly necessary (i.e. when adding a product to the cart), so no unnecessary carts are generated.

  • Removed unused classes ShippingRateBean, ShopShippingRate, ProductVariantBeanFactoryInjectless, UserFeedback, CountryFormFieldBean, FormBean and all its subclasses, plus some FormUtils methods that are not needed anymore due to the change of Form handling.

  • Renamed Settings beans to SettingsBean to follow same pattern as other view models.

  • All view models are following an uniformed structure and extending from ModelBean, which enables dynamic data to be passed.

  • Renamed and moved Play Framework extended classes to their own package com.commercetools.sunrise.play, which affects application.conf:

    play.application.loader = "com.commercetools.sunrise.common.configuration.SunriseApplicationLoader"
    play.http.filters = "com.commercetools.sunrise.common.basicauth.BasicAuthHttpFilters"
    play.http.errorHandler = "com.commercetools.sunrise.http.SunriseDefaultHttpErrorHandler"
    

    Are now

    play.application.loader = "com.commercetools.sunrise.play.inject.SunriseGuiceApplicationLoader"
    play.http.filters = "com.commercetools.sunrise.play.http.SunriseHttpFilters"
    play.http.errorHandler = "com.commercetools.sunrise.play.http.SunriseDefaultHttpErrorHandler"
    
  • Added global CSRF Filter so that a CSRF token is always available and it forces to receive a CSRF token on certain requests without the need of explicitly declare it via @AddCSRFToken and @RequireCSRFToken.

  • Renamed InfoData to TitleDescriptionBean to provide a better description of what it contains.

  • Reworked Cart related bean classes and factories:

    • Created MiniCartBeanFactory to generate MiniCartBean
    • CartLikeBean and CartLikeBeanFactory has been split to CartBean/OrderBean and CartBeanFactory/OrderBeanFactory respectively, while CartLikeBeanFactory has become an abstract class.
    • MiniCartLineItemBean and MiniCartLineItemBeanFactory has been renamed to LineItemBeanand LineItemBeanFactory respectively.
    • LineItemBean and LineItemBeanFactory has been renamed to LineItemExtendedBeanand LineItemExtendedBeanFactory respectively.
    • LineItemsBean has been renamed to LineItemListBean and replaces MiniCartLineItemsBean too.
    • LineItemsBeanFactory has been removed and the logic is now in CartLikeBeanFactory.
  • Fixed memory issue that generated an increasing amount of SphereClient instances that could not be garbage collected.

  • Fixed another issue with JavaMoney API, which might raise on certain situations rounding related exceptions.

v0.9.0

27 Jul 12:50
Compare
Choose a tag to compare

Technical

  • The CMS API has been split into two different interfaces: CmsService and CmsPage. CmsIdentifier has been removed as it has no use with the new structure anymore. This API has been moved to an external project Sunrise Java CMS, along with a first implementation of Contentful.
  • FileBasedCmsService requires now additional configuration for the internal I18nResolver it uses. In particular, you need to include application.cms.i18n.bundles and application.cms.i18n.resolverLoaders in your application.conf. Check this example, but be aware that the structure for the expected CMS content has changed so the theme and i18n messages need to be adapted.
  • The Documentation for Sunrise is now larger and better organized, check it out in the Manual folder.

v0.8.0

20 Jul 07:39
Compare
Choose a tag to compare

Technical

  • Rework of most of the factories, now they are easier to override without losing the setting from the base class (breaking changes)
  • support of view components which "know" their template, see also https://github.com/commercetools/commercetools-sunrise-theme/pull/420/files
  • HandlebarsFactory can be overridden to attach new helpers or other Handlebars settings
  • by default SphereClient is request scoped, if you need it outside (should rarely happen) use
@Inject
@Named("global")
private SphereClient client;
  • FutureUtils has been removed, use CompletableFutureUtils instead
  • RequestScoped DI scope is now bound in the module RequestScopeModule, so in order to be able to use it you'll need to add to application.conf:
play.modules.enabled += "com.commercetools.sunrise.common.contexts.RequestScopeModule"

v0.7.0

15 Jul 13:38
Compare
Choose a tag to compare

Features

  • My Account functionalities, such as:
    • Change my personal details
    • My address book
    • My orders

Configuration

  • Created Sunrise Demo which contains now the running application along with its configuration.

Technical

  • Converted Sunrise into a framework, better suited to customize and extend the default Sunrise behaviour.
  • Introduced @RequestScoped DI Scope to bind the lifetime of injected objects to the request.
  • Many, many improvements on the overall class structure and code.
  • Sunrise Framework is released to Maven Central.
  • Updated to Play Framework 2.5.4.
  • Updated to commercetools JVM SDK 1.1.0.
  • Updated to commercetools Sunrise Theme 0.59.0.

v0.6.0

15 Apr 14:06
Compare
Choose a tag to compare

Features

  • Banners in home page are now coming from CMS.
  • Enabled product image gallery in the product detail page and quickview.

Configuration

  • Enabled easy configuration for facets, sort options and other search criteria, through application.conf.
  • Fixed bug that prevented selectable attributes from working when an attribute did not have a value for that variant.

Technical

  • Default local file-based implementation for CMS.
  • Introduced ProductSuggestion interface to provide suggestions for products, with some basic default implementation.
  • YAML i18n Resolver can use arguments and some basic pluralization.
  • Enabled Sunrise as Lightbend Activator Template.
  • Migrated to Play Framework 2.5.1.
  • Updated to commercetools JVM SDK 1.0.0-RC5.
  • Updated to commercetools Sunrise Theme 0.55.0.
  • Moved QueryAll class to JVM SDK Convenience module.
  • Moved CategoryTree extended functionality to JVM SDK Models module.
  • Enabled access to favicon.ico in root path to avoid 404 HTTP errors on some pages.
  • SBT tasks do not depend on the rest of the project anymore, thus highly improving compilation time.
  • Better structured injection modules.

v0.5.0

26 Feb 17:51
Compare
Choose a tag to compare

Features

  • Implement sign in/up/out functionality, thus integrating customer with cart.
  • Improved displayed errors in forms.
  • Fix shipping address, which was duplicating the street address.

Configuration

  • List product attributes with configurable parameter productData.displayedAttributes (env var DISPLAYED_ATTRIBUTES)
  • Enable product variant selection by reloading the page via the configurable parameter productData.hardSelectableAttributes (env var HARD_SELECTABLE_ATTRIBUTES).
  • Better documentation on configuration, both in application.conf and the "Deploy to Heroku" button functionality.
  • Fix Webjars files copier SBT task, which now also works with non-existent directories.

Technical

  • Stop caching via HTTP headers sensible endpoints such as health, version, checkout or my account.
  • Updated to commercetools JVM SDK 1.0.0-RC1.
  • Reduced slug size when deploying to Heroku to avoid slug too large issues.
  • Configured production logger to work with Docker.

v0.4.0

05 Feb 15:47
Compare
Choose a tag to compare

Features

Configuration

  • Enabled all configurable options when deploying Sunrise as a Heroku application.
  • Provided possibility to enable HTTP basic access authentication via configuration.
  • Forces to set application secret and auto-generates it for Heroku.
  • Documented:
    • Explanation of template structure
    • How to do basic modifications on template's HTML and web assets
    • How to do advanced modifications on template and i18n source loaders
  • Provides SBT task to copy template files (i.e. template sources and i18n YAML files) into /conf, so that it is easier to override them.

Technical

  • Improved performance thanks to:
    • Introducing configuration to enable/disable metrics
    • Not using random suggestions, instead fetch exactly the amount it is shown
    • Updating to Sunrise Template v0.51.0, which introduces many performance improvements
    • Updating to Handlebars Java 4.0.3, with cache improvements, and other Handlebars related work
    • Cleaning up code and some small (in size, not necessarily in impact) optimizations.
  • Tests with a running Play's application or with test servers are easier to build using WithSunriseApplication test class.
  • Injects custom configuration class that allows to parse some comma-separated text as a list. This allows an easy configuration from Heroku without forcing to change the way the app provides lists.
  • Done rebranding from SPHERE.IO to commercetools

v0.3.0

20 Jan 17:17
Compare
Choose a tag to compare

Features

  • Displays mini-cart contents and price calculation, plus it allows to remove line items directly from the mini-cart.
  • Displays all possible attributes for the current product variant and disables those combinations that are not available.
  • Allows to add to the cart the selected product variant.
  • Enabled basic language switcher that redirects to home page.
  • Enabled country switcher that saves country in session and redirects to home page.
  • Disabled country selection for shipping address in checkout process, to force country selection only globally.
  • Enabled "new products" link in home page.
  • Enabled full-text product search.

Configuration

  • Provided I18nResolver interface, along with implementations YamlI18nResolver (to read from YAML files) and CompositeI18nResolver. Default injected configuration reads i18n messages from the YAML files located in sunrise-design webjars, which can be overriden by local YAML files.
  • Fetches available languages, countries and currencies from CTP project, but allows to override them through configuration.
  • Possibility to enable Handlebars caching through configuration.

Technical

  • Improved structure and code quality from product-catalog and shopping-cart modules.
  • Updated sunrise-design template to v0.45.0
  • Updated to Commercetools JVM SDK M26

v0.2.0

22 Dec 15:12
Compare
Choose a tag to compare
  • Implemented Home: category tree menu, suggested products.
  • Implemented POP: facets, breadcrumb, display selector, sort selector, pagination, quickview with quick add to cart.
  • Implemented PDP: attributes, prices, pictures, related products, add to cart.
  • Implemented Cart: change quantity, delete line item, price info disaggregated.
  • Implemented Checkout: shipping address, optional billing address, shipping methods, basic payment method, summary page, thank you page.
  • Uses an external template: https://github.com/sphereio/sphere-sunrise-design.
  • Uses Guice Dependency Injection to easily test and replace components.
  • Powerful collection of classes to build facets easily.
  • Class QueryAll to asynchronously fetch all possible documents of an endpoint.
  • Enriched CategoryTreeExtended with additional convenient methods.
  • Refreshable CategoryTree via an endpoint.