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-accountMap 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 Clientimport * as mesh from '@dropins/tools/fetch-graphql.js';
// Component toolsimport { initializers } from '@dropins/tools/initializer.js';
// Drop-in component providerimport { render as provider } from '@dropins/storefront-account/render.js';
// Drop-in component API functionsimport * as api from '@dropins/storefront-account/api.js';
// Drop-in component containersimport { AddressForm } from '@dropins/storefront-account';Connect to the endpoint
Configure the GraphQL endpoint:
// Set endpoint configurationmesh.setEndpoint('https://<graphql-service-endpoint>/graphql');
// Set store code headermesh.setFetchGraphQlHeader('store', '<default>');Register and load the drop-in
Mount the initializers after the page has loaded:
// Register drop-in initializerinitializers.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 Accountprovider.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