Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

User Account Installation

Version: 1.2.0 | 5 containers

Step-by-step

Use the following steps to install the User Account component:

Install the packages

Install the required packages using npm:

npm install @dropins/tools @dropins/storefront-account

Map the packages

Add the drop-in to your importmap in the head.html file:

<script nonce="aem" type="importmap">
{
"imports": {
"@dropins/storefront-account/": "/scripts/__dropins__/@dropins/storefront-account/",
"@dropins/tools/": "/scripts/__dropins__/tools/"
}
}
</script>

With the importmap defined, you can now import the required files from these packages into your block as described in the next step.

Import the required files

Import the necessary components and utilities:

// GraphQL Client
import * as mesh from '@dropins/tools/fetch-graphql.js';
// Component tools
import { initializers } from '@dropins/tools/initializer.js';
// Drop-in component provider
import { render as provider } from '@dropins/storefront-account/render.js';
// Drop-in component API functions
import * as api from '@dropins/storefront-account/api.js';
// Drop-in component containers
import { AddressForm } from '@dropins/storefront-account';

Connect to the endpoint

Configure the GraphQL endpoint:

// Set endpoint configuration
mesh.setEndpoint('https://<graphql-service-endpoint>/graphql');
// Set store code header
mesh.setFetchGraphQlHeader('store', '<default>');

Register and load the drop-in

Mount the initializers after the page has loaded:

// Register drop-in initializer
initializers.register(api.initialize, {});
// Mount initializers (must be called after all initializers are registered)
initializers.mountImmediately(initialize, { langDefinitions });

Render the drop-in

Render the AddressForm container on your page:

// Render User Account
provider.render(AddressForm, {
// Add configuration options here
})(document.getElementById('your-dropin-element'));

Next steps

  • Explore the [API functions](/dropins/User Account/functions/) available for programmatic control
  • Customize the appearance using [slots](/dropins/User Account/slots/)
  • Learn about [events](/dropins/User Account/events/) for integration with other components