@commercelayer/react-components
Version:
The Official Commerce Layer React Components
2 lines • 1.05 kB
JavaScript
"use client";
;Object.defineProperty(exports,"__esModule",{value:!0}),exports.PaymentMethodName=PaymentMethodName;const tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),PaymentMethodChildrenContext_1=tslib_1.__importDefault(require("../../context/PaymentMethodChildrenContext")),Parent_1=tslib_1.__importDefault(require("../utils/Parent")),useCustomContext_1=tslib_1.__importDefault(require("../../utils/hooks/useCustomContext"));function PaymentMethodName(props){const{payment}=(0,useCustomContext_1.default)({context:PaymentMethodChildrenContext_1.default,contextComponentName:"PaymentMethod",currentComponentName:"PaymentMethodName",key:"payment"}),labelName=payment?.name,htmlFor=payment?.payment_source_type,paymentGateway=payment?.payment_gateway,parentProps={htmlFor,labelName,paymentGateway,...props};return props.children?(0,jsx_runtime_1.jsx)(Parent_1.default,{...parentProps,children:props.children}):(0,jsx_runtime_1.jsx)("label",{htmlFor,...props,children:labelName})}exports.default=PaymentMethodName;