UNPKG

@commercelayer/react-components

Version:
2 lines 771 B
"use client"; "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CommerceLayer=CommerceLayer;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),CommerceLayerContext_1=tslib_1.__importDefault(require("../../context/CommerceLayerContext")),ErrorBoundary_1=tslib_1.__importDefault(require("../utils/ErrorBoundary")),jwt_1=require("../../utils/jwt");function CommerceLayer(props){const{children,...p}=props;if(!p.endpoint){const{organization}=(0,jwt_1.jwt)(p.accessToken);p.endpoint=`https://${organization.slug}.${p.domain??"commercelayer.io"}`}return(0,jsx_runtime_1.jsx)(ErrorBoundary_1.default,{children:(0,jsx_runtime_1.jsx)(CommerceLayerContext_1.default.Provider,{value:{...p},children})})}exports.default=CommerceLayer;