2.5.0 • Published 11 months ago

@flatfile/sdk v2.5.0

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

@flatfile/sdk

Install

npm install @flatfile/sdk

Getting started

Make sure you are in Developer Mode by clicking the toggle in the bottom left corner of the Flatfile dashboard.

Get your Embed ID

First, grab your Embed ID for the Portal you want to embed. You can find this on the Edit Portal page in the Flatfile dashboard, and it should look something like this:

76aa0b10-d7f8-4dc7-a007-4a791736eed1

Embed your Portal

Use the following code to embed your Portal into your app:

import { Flatfile } from "@flatfile/sdk";

// find this in your Flatfile dashboard after creating a new Portal
const EMBED_ID = "";

// use this wherever you need to trigger an import
export function importData() {
  Flatfile.requestDataFromUser({
    embedId: EMBED_ID,
    user: { id: 99, name: "John Doe", email: "john@doe.com" },
    org: { id: 77, name: "Acme Inc." },
    onData(chunk, next) {
      /* handle submitted data here */
    },
  });
}

// change this to whatever DOM trigger you want to use
document.getElementById("button").addEventListener("click", importData);

This should open the Portal upon clicking the element you passed to document.getElementById. Try it out by uploading a CSV, and see your cleaned data appear in your Flatfile dashboard!

Check out additional options for requestDataFromUser in the Flatilfe developer docs.

Next steps

Check out the Flatfile developer docs to see what's needed to get your Portal working in production, including:

  1. Accepting data
  2. Securing data
  3. Using Data Hooks®
2.5.0

11 months ago

2.3.5

11 months ago

2.4.5

1 year ago

2.3.4

1 year ago

2.3.3

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.2.2

1 year ago

2.1.9

1 year ago

2.1.4-rc.0

2 years ago

2.3.0

1 year ago

2.1.2

2 years ago

2.3.2

1 year ago

2.1.4

2 years ago

2.3.1

1 year ago

2.1.3

2 years ago

2.1.6

1 year ago

2.1.5

2 years ago

2.1.8

1 year ago

2.1.7

1 year ago

2.2.0-rc0

1 year ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.4

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.2-beta.0

2 years ago

2.0.0-beta.2

2 years ago

2.0.0-beta.1

2 years ago

2.0.0-beta.0

2 years ago

2.0.0-beta.5

2 years ago

2.0.1

2 years ago

2.0.0-beta.4

2 years ago

2.0.0

2 years ago

2.0.0-beta.3

2 years ago

2.0.0-rc11

2 years ago

2.0.0-rc12

2 years ago

2.0.0-rc13

2 years ago

2.0.0-rc14

2 years ago

2.0.0-rc10

2 years ago

0.1.0

2 years ago

2.0.1-rc.0

2 years ago

2.0.1-rc.1

2 years ago

2.0.0-rc9

2 years ago

2.0.0-rc8

2 years ago

2.0.0-rc7

2 years ago

2.0.0-rc6

2 years ago

2.0.0-rc5

2 years ago

2.0.0-rc4

2 years ago

2.0.0-rc3

2 years ago

2.0.0-rc2

2 years ago

2.0.0-rc1

2 years ago

1.0.5

2 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.0-beta.0

3 years ago