1.0.4 • Published 5 years ago

react-braintree-impl v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

React braintree implementaion

JavaScript Style Guide

Install

npm install react-braintree-impl --save

Usage Example

Credit card add (braintree UI implementaion)
import { CreditCardAdd } from 'react-braintree-impl'

const CreditCard = ({
    setLoader,
    loadingBraintree,
    saveCreditCardDetails,
    onBraintreeFails,
    nonceToken
}) => (
       <CreditCardAdd
        setLoader={setLoader}
        loadingBraintree={loadingBraintree}
        saveCreditCardDetails={saveCreditCardDetails}
        onBraintreeFails={onBraintreeFails}
        nonceToken={nonceToken}
        containerClassName="Triniti-creditcard"
      />
    )

PROPTYPES

PropTypeDefaultDescription
setLoaderfunctionnullTo set loader state on parent
loadingBraintreeBooleanfalseLoading state identifier
saveCreditCardDetailsfunctionnullCredit card details submit method
onBraintreeFailsfunctionnullFailure handler for braintree connection establishment
nonceTokenString''Braintree authorization token
containerClassNameString''Parent classname to override the styles of the list

Usage Example

Invoices listing
import { InvoicesTable } from 'react-braintree-impl'

const Invoices = ({
    invoices,
    selectedStartDate,
    selectedEndDate,
    isLoading,
    onDateChange,
    minStartDate,
    onSelect,
    isRemarkEnabled,
}) => (
    <InvoicesTable
      invoices={invoices}
      selectedStartDate={selectedStartDate}
      selectedEndDate={selectedEndDate}
      isLoading={isLoading}
      onDateChange={this.handleDateChange}
      minStartDate={startDate}
      containerClassName="users-invoices"
      onSelect={this.selectInvoiceForRemark}
      isRemarkEnabled={true}
    />
);

PROPTYPES

PropTypeDefaultDescriptionSample
invoicesArray[]list of invoices
selectedStartDateDatenullStart date of the filter
selectedEndDateDatenullEnd date of the filter
isLoadingBooleanfalseloading state identifier
onDateChangefunctionnullTo handle date change for filters
minStartDateDatenullMinimum date possible in the filter
onSelectfunctionnullSelect handler for each invoice (Row)
isRemarkEnabledBooleanfalseTo either show or hide remarks
containerClassNameString''Parent classname to override the styles of the list

Usage Example

Plan charrges form
import { PlanCharges } from 'react-braintree-impl'

const PlanCharges = ({
    selectedDiscountType,
    selectedChargeType,
    handleChargeTypeSelect,
    handleDiscountTypeSelect,
    model,
    onChange,
    handleSubmit,
    schema,
    isEdited,
    slabsError,
    slabValidation,
    Input,
    Form,
    FieldArray,
    chargeTypeList,
    discountTypeList,
    Prompt
}) => (
    <PlanCharges
      selectedDiscountType={selectedDiscountType}
      selectedChargeType={selectedChargeType}
      handleChargeTypeSelect={handleChargeTypeSelect}
      handleDiscountTypeSelect={handleDiscountTypeSelect}
      model={model}
      onChange={this.onChange}
      handleSubmit={handleSubmit}
      schema={schema}
      isEdited={isEdited}
      slabsError={slabsError}
      slabValidation={this.slabValidation}
      Input={Input}
      Form={Form}
      FieldArray={FieldArray}
      chargeTypeList={chargeTypeList}
      discountTypeList={discountTypeList}
      Prompt={Prompt}
      containerClassName="plan-charges-container"
    />
);

PROPTYPES

PropTypeDefaultDescriptionSample
selectedDiscountTypeObject{}
selectedChargeTypeObject{}
handleChargeTypeSelectfunctionnullCharge type selection handler
handleDiscountTypeSelectfunctionnullDiscount type selection handler
modelObjectnullPlancharges object to be modified or written into
onChangefunctionnullForm onChange handler
handleSubmitfunctionnullSubmit handler
schemaobjectnullyup schema object for the form Validation
isEditedBooleanfalseWhether the form is touched (any value has been changed)
slabsErrorObject{}Validated errors for slabs
slabValidationfunctionnullvalidation method for slab
InputComponentnullInput Component for form
FormComponentnullForm Component to house the input components
FieldArrayComponentnullFieldArray component (Component capable of having array of fields)
chargeTypeListArray[]List of charge types
discountTypeListArray[]List of discount types
PromptComponentnullPrompt component to prompt on errors
containerClassNameString''Parent classname to override the styles of the list