npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dabe5651/aem-core-cif-react-components-apollo-logger

v2.4.2

Published

A collection of React components used in the AEM CIF Core Components project

Downloads

3

Readme

CIF Core Components - React Components

The React Components project is the code base for all the CIF Core Components built using React. 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';

const client = new ApolloClient({
    link: from([graphqlAuthLink, new HttpLink({ uri: graphqlEndpoint, headers: { Store: storeView } })]),
    cache: new InMemoryCache()
});

Portal

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

Building the project

The project is built using the command npm 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 uses Jest for running unit tests and React 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 the npm run test command. To run the tests during development you can use npm run test:watch to start Jest in watch mode.

Development

Prerequisites

For development, please have node.js (v12+) and npm (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 at http://localhost:3002/graphql.

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

Building

To build the components you can use

npm run build