To integrate the referrd-widget-react
package into your Next.js project, follow the steps below:
Make sure to install the latest version of the referrd-widget-react
package. Open your terminal and run the following command:
npm install referrd-widget-react@^1.2.4
Create a file named subLayouts.js
in the layouts
folder of your Next.js project's root directory. Add the following content to set up the layout:
// File: layouts/subLayouts.js
'use client';
import { MainRefferalModal } from "referrd-widget-react";
export default function SubLayout({ children }) {
return (
<>
<MainRefferalModal />
<main>{children}</main>
</>
);
}
The referrd-widget-react
package follows a specific flow to display the referral widget:
-
Check for Active Campaigns:
- The package component checks all pages to identify if a campaign is active. A campaign is considered active if a brand user has created a campaign with a given product page URL.
-
Display Widget after Payment:
- The widget is displayed after a successful payment. Ensure that the redirection to the product page where the campaign is active includes the parameter
?payment_success=true
.
- The widget is displayed after a successful payment. Ensure that the redirection to the product page where the campaign is active includes the parameter
-
Redirect to Product Page with Parameters:
- After payment is done, redirect the user to the product page where the campaign is active.
- Include the parameter
?payment_success=true
in the URL to trigger the display of the widget.
-
Normal URL:
-
Referral URL:
Make sure to adapt the examples based on your project's specific URLs and routing. Now, you have successfully installed and configured the referrd-widget-react
package in your Next.js project.
If you encounter any technical issues or have questions related to the referrd-widget-react
package, please feel free to contact the system administrator or the Referrd team for assistance.
For technical support, you can reach out via email: support@referrd-widget.com.
They will be happy to help you with any inquiries or problems you may encounter during the integration or use of the referral widget.
Now you're all set! If you need further assistance, don't hesitate to get in touch with the support team.