Movatterモバイル変換


[0]ホーム

URL:


⚠️

Security Update: npm classic token creation is now disabled. Existing classic tokens will be revoked onNovember 19, 2025. Migrate to trusted publishing or granular access tokens to avoid disruption.Learn more.

@adobe/aem-core-cif-react-components

2.17.2 • Public • Published

The React Components project is the code base for all the CIF Core Components built usingReact. The following components are exposed by this library:

Components related to the shopping cart

Cart

An implementation of the "minicart" component, complete with checkout experience.

CartProvider

A context provider for a cart component which provides state management for cart operations

CartInitializer

A component which provides cart operations such as "Add to cart" and "Remove from cart"

CheckoutProvider

A context provider for a cart component which provides state management for checkout operations

Components related to user authentication / account management

AuthBar

The account management components - Sign In, Forgot Password, Change Password and My Account, all wrapped into one component

AccountContainer

The same as AuthBar, but rendered in a dropdown instead of a panel.

AddressBook

A component that allows authenticated shoppers to manage their address books.

UserContextProvider

A context provider for user operations - sign in / sign-out, create user

General purpose components

CommerceApp

A convenience wrapper for React components, encapsulating all the required contexts to run the app

graphqlAuthLink

An ApolloLink instance that handles authorization on certain graphql requests (e.g.: cart mutations).This is intended to be used when creating a new ApolloClient instance:

import{ApolloClient,from,HttpLink,InMemoryCache}from'@apollo/client';import{graphqlAuthLink}from'@adobe/aem-core-cif-react-components';constclient=newApolloClient({link:from([graphqlAuthLink,newHttpLink({uri:graphqlEndpoint,headers:{Store:storeView}})]),cache:newInMemoryCache()});

Portal

A component that allows rendering a React tree inside of a Portal. UsesReactDOM.createPortal() under the hood.

Building the project

The project is built using the commandnpm run build. The build process bundles all the code into one client library which is placed in../ui.apps/src/main/content/jcr_root/apps/core/cif/clientlibs/react-components/dist.

Testing the components

This project usesJest for running unit tests andReact Testing Library as the testing framework. This framework allows you to test the behavior of the components rather than the implementations.

The unit tests are run using thenpm run test command. To run the tests during development you can usenpm run test:watch to start Jest in watch mode.

Development

Prerequisites

For development, please havenode.js (v12+) andnpm (v6+) installed.

The React components access the Magento GraphQL endpoint directly, so all calls have to either be served from the same endpoint as AEM or served via a proxy that adds CORS headers.

To start a local proxy server, you can use the following command:

npx local-cors-proxy --proxyUrl https://my.magento.cloud --port 3002 --proxyPartial ''

The GraphQL endpoint is then available athttp://localhost:3002/graphql.

If you develop for AEM on-prem installations, a proxy is included in our sample Dispatcher configuration (seethe dispacher configuration for details). You have to access AEM through the dispatcher (i.e. usehttps://localhost instead ofhttp://localhost:4502).

Building

To build the components you can use

npm run build

Readme

Keywords

none

Package Sidebar

Install

npm i @adobe/aem-core-cif-react-components

Weekly Downloads

1,125

Version

2.17.2

License

Apache-2.0

Unpacked Size

1.73 MB

Total Files

8

Last publish

Collaborators

  • marbec
  • tripod
  • garthdb
  • lazd
  • adobe-admin
  • patrickfulton
  • trieloff
  • shazron
  • krisnye
  • dcpfsdk
  • natebaldwin
  • devongovett
  • aspro83
  • symanovi
  • dpfister
  • stefan-guggisberg
  • rofe
  • kptdobe
  • adobehalls
  • fullcolorcoder
  • djaeggi
  • dylandepass
  • mhaack
  • amol-anand
  • stopp-adobe
  • doten
  • duh_schmidt
  • asthabh23
  • zdahbi
  • tuicu
  • fmeschbe

[8]ページ先頭

©2009-2025 Movatter.jp