Sana Add-on Development Kit
Sana Add-on Development Kit (abbr. Sana ADK) — is a set of libraries and APIs, specifically designed for the Sana add-on development.
Sana ADK is part of the full Sana Commerce SDK and consists of:
- Sana Extension Framework — a server-side library, providing backward-compatible contracts for interoperability between the add-ons and the core product
- Reusable client-side React components, libraries and APIs
- Set of tools for streamlined add-on development, testing and packaging
Whereas full Sana Commerce SDK is targeting customized Sana projects and will change with every new version of Sana Commerce, the Sana ADK is the exhaustive set of core product APIs and components, which are allowed to be used by the add-ons and are guaranteed to be backward-compatible in the future product releases.
Sana Extension Framework
Sana Extension Framework is the core asset of the add-on development, which resides on the server side of the application.
For more details, Sana Extension Framework.
Client Side
On client side, ADK contains client side API(s), contracts and resuable react components.
1. Client-Side APIs
Client-side APIs refer to a set of application programming interfaces (APIs) that are used on the client-side, specifically within the browser. There are two separate sets of APIs for the web store and Sana Admin, and they are located under the Sana.Commerce.WebApp/ClientApp/src/adk directory. These APIs include JavaScript modules (*.js files) and SASS variables (*.scss files) that are provided by Sana to be used in add-ons. The JavaScript modules can be imported into add-on JS files using the import statement, while the SASS variables can be used in add-ons to inject configured values into stylesheets at runtime.
For more details, Client Side API(s).
2. Client-Side Contracts
Client-side contracts refer to the expected exports of the JavaScript bundles provided by an add-on for the web store and Sana Admin client applications. These exports are similar but different for each application, and must be provided by the entry point of each bundle named index.js.
For more details, Client Side Bundles.
Tooling
Every add-on project references the same Scripts/Addons/msbuild.targets file, which centralizes and automates common workflows of add-on development.
For example, it automatically copies the add-on output assemblies into the root of the "bin" directory to be correctly picked up by the Sana web application at startup.
Additionally, it overrides the "Publish" MSBuild target to build the production-ready add-on client-side bundle, as well as collect all required files and package them into a ".sanapkg" file format.
So that, in order to assemble a package out of an add-on source project, just run dotnet publish "<path_to_addon_project>" -c Release -o "<output_dir>" in the command line.
As a result, the assembled ".sanapkg" file is created under the "output_dir" folder.