SCA Module Architecture

The source files for SuiteCommerce Advanced (SCA) are organized in multiple modules. Each module defines a specific area of functionality which generally falls in one of the following categories:

  • Application modules: define high-level collections of features that perform similar types of functions. SCA includes three separate applications:
    • Shopping
    • Checkout
    • My Account
  • Feature modules: define specific areas of functionality within SCA. The Case module, for example, contains the code and style sheets that implement the Case Management feature.
  • Framework modules: define the general logic and structure of SCA and define how modules and applications work together. The application modules extend these modules to inherit the basic framework.
  • Utility modules: provide functionality that is used by multiple modules. The GlobalViews module, for example, defines views that are reused in multiple areas of SCA.

The following sections provide more information about SCA modules and source files:

Dependencies
Application Modules
Feature Modules

Dependencies

Every JavaScript file in the SCA source contains the same general structure that corresponds to Asynchronous Module Definition (AMD) API. RequireJS uses the AMD API to asynchronously load modules within the application. The following code sample shows the general structure of each file:

define('<module_name>'
,
   [   '<dependency_1>'
   ,
      '<dependency_2>'.
      ...
   ]
   function (
      <module_1>
   ,   <module_2>
      ...
   )
)
{
      <module code>
}

All files within a module contain one define function which occurs at the beginning of the file and uses the following syntax:

define(module_id, [dependencies], function)
  • module_id – a string defining the name of the module.
  • dependencies – an array containing the names of the dependencies. In SCA, this is generally the name of a module, a component within a module, or a core dependency.
  • function – defines a function that instantiates the module.

By following this structure consistently, the developer tools can compile the application into a single JavaScript file by calculating the cascading dependencies starting with the root level application modules down to each lower-level feature and utility modules.

Application Modules

SuiteCommerce Advanced (SCA) is composed of three separate applications: Checkout, My Account, and Shopping. Each of these applications contains its own top-level modules that define the dependencies and general layout. These modules are contained in the following directories:

ApplicationDirectoryEntry Point
My AccountMyAccountApplicationMyAccountApplication.SCASC.MyAccount.Starter.ts
CheckoutCheckoutApplicationSC.Checkout.Starter.ts
ShoppingShopping ApplicationSC.Shopping.Starter.ts

Each application module contains a starter file which defines the starting node or entry point for each application. Starter files for recent SCA versions are TypeScript files with a .ts extension. Earlier SCA versions have JavaScript starter files with a .js extension. Each starter file lists all of the dependencies for each application. Any dependencies not listed in the starter file will not be included in the application.

The following image shows the hierarchical relationship between the top-level application modules and the lower-level feature modules.

Feature Modules

Most of the modules within SuiteCommerce Advanced (SCA) are feature modules, which means they define the behavior for a specific feature or related functionality. In contrast to the application and framework modules which define the underlying infrastructure and logic of an application, feature modules perform the following:

  • Define the user interface for a feature
  • Define the low-level application behavior
  • Define data models
  • Handle data transfer between the application and NetSuite

Leave a comment

Your email address will not be published. Required fields are marked *