Skip to main content
Version: 3.14.0

GiftRedeemModal

The gift redeem modal is used when the user wants to start the flow of redeeming a gift code. once the user submits a gift code successfully in this modal, the code is stored in usePelcro's giftCode field.

Loading...

Usage#

import React from "react";
import {
GiftRedeemModal,
PelcroModalController,
usePelcro,
} from "@pelcro/react-pelcro-js";
import "@pelcro/react-pelcro-js/dist/pelcro.css";
export const GiftRedeemExample = () => {
const { switchView } = usePelcro();
return (
<>
<button onClick={() => switchView("gift-redeem")}>Redeem gift</button>
<PelcroModalController>
<GiftRedeemModal />
</PelcroModalController>
</>
);
};

Reference#

Props#

onDisplay#

() โ‡’ void

Callback function called when the modal is first displayed.

onClose#

() โ‡’ void

Callback function called when the modal is closed.

onSuccess#

(giftCode) โ‡’ void

Callback function called when the gift code is submitted succesfully.

onFailure#

(errorObject) โ‡’ void

Callback function called when submitting the gift code fails.