What You Can Do With Arc.js

Arc.js is a development framework built on the V8 Javascript runtime that allows server-side JavaScript applications to execute on the Kibo eCommerce platform. With Arc.js, you can make deep changes to the Kibo eCommerce platform by manipulating API operations through the HTTP request-response protocol as well as interacting directly with underlying Kibo eCommerce microservices.

Example: Keeping Track of a Shopper's Recurring Purchases

The following JavaScript code shows a high-level example of how you can use Arc.js to leverage the lodash package and the Kibo eCommerce Node.js SDK to keep a record of products that are repurchased frequently by a shopper and store those products in a custom attribute within the shopper's account. The example uses the embedded.commerce.order.action.after action available in the commerce.orders domain of the Arc.js framework.

assets/src/domains/commerce.orders/embedded.commerce.order.action.after.js

// Import awesome libraries
var _ = require('lodash');
var OrderClient = require('mozu-node-sdk/clients/commerce/orders');
var CustomerHelper = require('./customer-helper');

// Run this function after an order is placed (corresponds to the 'embedded.commerce.order.action.after' action)
module.exports = function(context, callback) {
	
	// Access the context argument to retrieve useful Mozu data
	var orderClient = new OrderClient(context);
	var customerHelper = new CustomerHelper(context);
	var order = context.get.order();
   
	orderClient.getOrders({ pageSize: 50 }).then(function(last50UserOrderHistory) {
		// Get the list of every product code a shopper has ever ordered and create a custom attribute on the shopper's account that lists all the product codes that have been re-purchased on separate orders
		var productCodesOrderedOnceBefore = _.intersection(_.pluck(order().items, 'product.productCode'), _.pluck(_.flatten(_.pluck(last50UserOrderHistory, 'items'), 'product.productCode')));
		
	if (productCodesOrderedOnceBefore.length > 0) {
		return customerHelper.updateAttribute({ 
			accountId: context.get.order().customerAccountId, 
			attribute: 'tenant~repurchasedProducts' 
			values: productCodesOrderedOnceBefore 
	});
	}
	}).then(function() {
		// Success!
		callback();
	}).catch(callback);
}

Take Full Control of the Shopper Experience

Arc.js gives you tremendous control over the commerce experience in a fully managed multi-tenant SaaS environment. Developers can use Kibo eCommerce Arc.js applications to augment, replace, or customize the behavior of Kibo eCommerce storefronts and API microservices, resulting in richer, more rewarding experiences for your shoppers. For example, you can:

Empower Developers to Innovate on the Kibo eCommerce Platform

Arc.js applications work by giving you the ability to bind custom JavaScript functions to actions in Kibo eCommerce so you can surface unique behaviors throughout the Kibo eCommerce platform. With Arc.js, you can run an application transactionally and augment data during the transaction process instead of being limited to listening for events or receiving standard information over HTTP. The following are examples of the limitless innovations you can achieve with Arc.js to benefit your business users:

Write Your Code in a Simple, Universal Language

With Arc.js, there's no need to learn a new language. Arc.js applications are Node.js compatible and allow you to leverage the thousands of NPM packages developed by the community to enhance the functionality of applications built on Kibo eCommerce.


Try It Now
10 Min. Quickstart

Arc.js Ideas

Arc.js is a development framework that allows you to run custom JavaScript functions when Kibo eCommerce actions occur. For example, you can run custom functions whenever a shopper creates a new account, deletes an item from a cart, or views a page on your site. Custom functions augment or bypass Kibo eCommerce's out-of-the-box behavior and provide your shoppers with a more tailored and compelling shopping experience. The following are just a few examples of what you can do with Arc.js:

How Arc.js Fits into the Kibo eCommerce Platform

As shopper, merchant, and application actions occur, Kibo eCommerce invokes Arc.js to customize the actions to the your needs Arc.js is a growing framework that continually adds action entry points to give you an ever more complete ability to customize the Kibo eCommerce platform. The following diagram provides a high-level overview of the typical Kibo eCommerce components that the initial releases of the Arc.js framework will interact with.

Major components of Arc.js include:

Arc.js can customize the following Kibo eCommerce components:

How do I use Arc.js?

First you use JavaScript to code the custom functionality that you want to associate with an action(s) in Kibo eCommerce. Then, you upload the action(s) to an application in Dev Center and install that application to a sandbox. Finally, you enable the action(s) from within the sandbox using the Action Management JSON editor. To get started, we suggest the following learning path:

  1. Learn about the basic structure of an Arc.js application.
  2. Learn about the types of actions available for you to bind custom functions to.
  3. Learn about the JavaScript templates you use to code the custom functionality for an action.
  4. Learn about the JSON editor you use to enable actions for a sandbox.
  5. Work through the Quick Start for a start-to-finish example of implementing an Arc.js application.
  6. Leverage the reference content to learn the details of actions and the methods they have access to.