@commercelayer/react-components
Version:
The Official Commerce Layer React Components
2 lines • 529 B
JavaScript
"use client";
import{jsx as _jsx}from"react/jsx-runtime";import CommerceLayerContext from"../../context/CommerceLayerContext";import ErrorBoundary from"../utils/ErrorBoundary";import{jwt}from"../../utils/jwt";export function CommerceLayer(props){const{children,...p}=props;if(!p.endpoint){const{organization}=jwt(p.accessToken);p.endpoint=`https://${organization.slug}.${p.domain??"commercelayer.io"}`}return _jsx(ErrorBoundary,{children:_jsx(CommerceLayerContext.Provider,{value:{...p},children})})}export default CommerceLayer;