To install execute the following command in the terminal:
npm install
Create your .env.local
file based on the env.example
file`.
First, run the development server:
npm run dev
Open https://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx
. The page auto-updates as you edit the file.
This project uses next/font
to automatically optimize and load Inter, a custom Google Font.
This guide provides step-by-step instructions for integrating the Incode Web SDK with Next.js.
- The Incode Web SDK is primarily designed for client-side rendering. While most functionality is available, it's not optimized for server-side rendering.
- Currently, the Incode Web SDK package is not compatible with server-side rendering solutions. To use it, you must import it via a script.
- For security reasons, session tokens and data fetching should be handled on the backend to protect your API keys and sensitive data.
A backend server that will generate the url is needed for this sample, luckily for you we already have sample server for PHP, NodeJS, Python, PHP and Java and .NET, please reffer to our documentation on subject: Quick Start Sample Server
For this sample we have included a server API service at pages/api/start.tsx
to let you run the sample without any extra requirements.
-
While working with Next.js and TypeScript, declare the
OnBoarding
element in thewindow
orGlobalThis
object to prevent any build issues while using the Incode Web SDK. As a recommendation, declare it at the top-level entry file to ensure the element is available across the app.declare global { interface Window { OnBoarding: any; } }
-
Load the CDN library script using Next.js's
next/script
module, utilizing the "beforeInteractive" strategy to ensure the SDK is available.// pages.tsx import Script from "next/script"; export default function Home() { return ( <> <Script id="incode-sdk" src="https://sdk.incode.com/sdk/onBoarding-1.70.0.js" strategy="beforeInteractive" /> </> ); }
-
Now that we have the Incode Web SDK loaded, initialize it to enable the SDK to start calling the different methods.
-
To seamlessly integrate the Incode Web SDK into your application, follow the instructions outlined in the How to use Web SDK guide. By adhering to these steps, you'll gain access to the data capture tools, allowing you to seamlessly integrate them into your application based on your preferred architecture strategy.
© Incode Technologies Inc. All rights reserved.