Guides

Web Component

importOK is a reusable custom web component that embeds an import wizard into your app. You can follow this installation guide to set it up by using custom web components.

Installation

The tester version of the importOK JavaScript and React components are available on NPM, while the full (paid) versions are hosted in a private repository. Both versions are fully compatible and no code changes are required when upgrading to the full (paid) versions.

1npm install @importok/javascript

Usage

To embed the importOK wizard in your project, simply add the following snippet to your page. This will render the interactive import wizard, allowing users to import data seamlessly. For a complete list of configuration options, including available props and event handlers, refer to the Props & Events section of the documentation.

To help you get started, we’ve also prepared a live StackBlitz example you can use as a reference for setting up your configuration.

1<importok-wizard></importok-wizard>

Next you will need to define and configure the custom component.

1import ImportOK from './node_modules/@importok/javascript/importok.js';
2/**
3 * Define the custom web component
4 */
5ImportOK.defineCustomElements();
6 
7/**
8 * Import fields to be mapped
9 * Check https://importok.io/docs/fields for more details
10 */
11const importFields = {};
12 
13/**
14 * Push the provided record to the API
15 * Check https://importok.io/docs/webhooks for more details
16 */
17const saveRecord = async function (record, meta) {};
18 
19/**
20 * Pass the full configuration to the wizard
21 */
22const wizard = document.querySelector('importok-wizard');
23wizard.config = {
24 fields: importFields,
25 meta: {
26 user_id: 1,
27 },
28 onRecordReady: saveRecord
29};

Note: There is a limit of 20 records for each import with the trial version. Additionally, access to custom validators, transformers, and data providers is restricted. Once you upgrade to a paid plan, you’ll gain access to the private packages and unlock full functionality with no limitations.