0.0.8 • Published 2 years ago

@rapdel/bizdelivery v0.0.8

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

Rapdel biz delivery react component

Rapdel is a delivery service, this library will allow developers to integrate the Rapdel biz to your website and create orders using this component.

  • Obtain the Google Map API key and Rapdel API Key
  • Just import and call components.
  • Try to order and check on your biz account on rapdel.com.
  • ✨See the Magic ✨

Installation

Install the Rapdel biz delivery module.

npm i @rapdel/bizdelivery --save
yarn add @rapdel/bizdelivery

import module in your project ...

import RapdelBizDelivery from '@rapdel/bizdelivery';

set basic values for testing...

  const setup = {
    googleApiKey: 'GOOGLE_MAP_API_KEY',
    rapdelApiKey: 'RAPDEL_BIZ_API_KEY_FOR_YOUR_ACCOUNT',
    sandbox: true, // for testing in sandbox remove this once ready for prod
  };
     const RapdelBizOrder = RapdelBizDelivery(setup,{});
# And call this wherever you like to show the component
<div>{RapdelBizOrder}</div>

Customization

Rapdel allows you to do full customization.

import module in your project ...

import { RapdelBizOrder } from '@rapdel/bizdelivery';

import css if needed

  import "@rapdel/bizdelivery/dist/index.css";

set basic values for testing...

Basic app setup

  const setup = {
    googleApiKey: 'GOOGLE_MAP_API_KEY',
    rapdelApiKey: 'RAPDEL_BIZ_API_KEY_FOR_YOUR_ACCOUNT',
    sandbox: true, // for testing in sandbox remove this once ready for prod
  };

User details to use in project setup

   const userDetails = {
    addressLine3: 'addressLine3',
    phone: 'phone number must be 10 digit',
    name: 'name',
    email: 'email@email.com',
    specialInstructions: 'special Instructions',
  };

customize using projectSetup props

  const projectSetup = {
    hideDeliveryCharges: false,
    showAddessOnly: false,
    userDetails, // this will auto-fill user details
    hideButton: false, // to hide submit button,
    onDelveryChargeChange: (deliveryCharge) => {
      console.log('onDelveryChargeChange delivery charges, deliveryCharge);
    },
    onSuccessfulOrder: (order) => {
      console.log('onSuccessfulOrder order', order);
    }
  };

To call delivery order from the button Define a ref

const rapdelOrderRef = useRef(null);

Now we can call add ref to component and call when we needed Call this wherever you like to show the component

<RapdelBizOrder setup={setup} projectSetup={projectSetup} ref={rapdelOrderRef} />

To see the result create a function on the button click

const requestDelivery = async () => {
    rapdelOrderRef.current && rapdelOrderRef.current.requestDelivery();
};

Use the HTML button example

   <button onClick={requestDelivery}>Request Delivery</button>

Props and options

Allowed valuesdefaulttypeUse
hideDeliveryChargesfalsebooleanRemove delivery charge box
showAddessOnlyfalsebooleanif it's true, will show only the address field, make sure to set user fields
hideButtonfalsebooleanremove submit button (call order function using ref like in the example)
userDetailsuserDetailsobjectuser details value
onDelveryChargeChange-functionCall back to get delivery charge
onSuccessfulOrder-functionOnce the order is placed this will return the order number

if something is not right?

Write us: hello@rapdel.com

Visit: https://rapdel.com/

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago