This package simply extends functionality within our @flatfile/configure package. If you’re not already using that package, this is an unnecessary step and you should start here instead.

Before you begin

Before you get started, there are both some new and redesigned terms to learn. Check out our Portal 3 Upgrade Guide’s before you begin section to learn about these concepts.

Using the plugin

If you’re using the Portal 3 class-based syntax for creating your Workbooks, Sheets, etc., the dxpConfigure method lets you pass in those classes and create your new Platform setup without having to move away from the classes for now.

In the below example, there is a Workbook that is being created with the class-based syntax like new Workbook(), new Sheet() and TextField(). The new Platform has moved away from this syntax to an object-based approach. While you won’t need to convert to this syntax, it is good to learn about it here for any future use cases you might have.

my-dxp-workbook.js
import { Sheet, TextField, Workbook } from "@flatfile/configure";

export const MyWorkbook = new Workbook({
  name: "My Workbook",
  namespace: "test",
  sheets: {
    mySheet: new Sheet("Test", {
      name: TextField("Full Name"),
      email: TextField({
        label: "Email Address",
        compute: (val) => {
          return val.toLowerCase();
        },
      }),
    }),
  },
});

With the dxpConfigure method, we can now plug this into a Listener to create a new Workbook from the v3 class-based syntax.

listener.js
import { MyWorkbook } from "./my-dxp-workbook.js";
import { dxpConfigure } from "@flatfile/plugin-dxp-configure";

export default (listener) => {
  listener.use(dxpConfigure(MyWorkbook));
};