Module
When you need to extend or change logic in the @deity/falcon-talonone-module we need to start with two thinks; First of all we need to create a custom module where we can bind our new code. Secondly to make Falcon Platform actually use this new code we also have to load it in the project by adjusting our /config/default.json.
Client
The TalonOneClient is a wrapper around the Talon.One SDK where the correct project configuration is injected. It is mainly used by the TalonOneDataSource to make request. The TalonOneClient will return untouched data, straight from the Talon One API.
Datasource
The TalonOneDataSource forms a bridge between TalonOne and the middleware. It has methods build in to manage CustomerProfile, CustomerSessions, couopons, referrals and events. You can use it as a place to create methods that abstract over the TalonOneClient requests. Keeping your code neat and DRY.
Data mappers
Since the Falcon Middleware serves as an agnostic layer, incomming data from Talon.One API needs to be transformed in a format that is understood by deity/falcon-promotion-extension (and vice versa). A set of mapper classes are available to unify this process. Those mappers can be extended and partly overwritten.
Event handlers
For our Falcon Platform module @deity/falcon-talonone-module to be able to syncronize customer and session data with Talon.One we needs to 'hook' into some data flows. Where we can we do this in a non-blocking way, preventing the user from waiting unnecicerly long for a request to finish. However, in some cases non-blocking syncronizations are simply not viable. For example, all cart syncronizations need to be done in a blocking way, since Talon.One will give us an updated set of promotional effects after each cart update. In Falcon Plaform we need to wait for this effects and apply them to the cart in the shop backend.
Track custom events
When working with custom events, please make sure the event is also registered in the talon one application. By default tracking of events is only possible from the middleware. However, by exposing a GraphQl mutation we can easily port this behaviour to the client.