Adapter

@flatfile/adapter › Globals › FlatfileImporter

Class: FlatfileImporter

Hierarchy

Index

Constructors

Properties

Methods

Constructors

constructor

+ new FlatfileImporter(apiKey: string, options: object, customer?: CustomerObject): FlatfileImporter

Defined in src/index.ts:41

Parameters:

Name Type
apiKey string
options object
customer? CustomerObject

Returns: FlatfileImporter

Properties

$ready

• $ready: Promise‹any›

Defined in src/index.ts:26

Promise that resolves when the handshake is completed between Flatfile.io and the adapter


Static Promise

▪ Promise: PromiseConstructor = Promise

Defined in src/index.ts:20


Static prefixed

▪ prefixed: *string boolean*

Inherited from FlatfileImporter.prefixed

Defined in node_modules/eventemitter3/index.d.ts:10

Methods

addListener

▸ addListener(event: string symbol, fn: ListenerFn, context?: any): this

Inherited from FlatfileImporter.addListener

Defined in node_modules/eventemitter3/index.d.ts:37

Parameters:

Name Type
event string | symbol
fn ListenerFn
context? any

Returns: this


close

▸ close(): void

Defined in src/index.ts:238

Call close() from the parent window in order to hide the importer. You can do this after handling the import callback so your users don’t have to click the confirmation button

Returns: void


displayError

▸ displayError(msg: string): void

Defined in src/index.ts:158

This will display a dialog inside of the importer with an error icon and the message you pass. The user will be able to acknowledge the error and be returned to the import data spreadsheet to ideally fix any issues or attempt submitting again.

deprecated

Parameters:

Name Type
msg string

Returns: void


displayLoader

▸ displayLoader(msg?: undefined string): void

Defined in src/index.ts:146

This will display a progress indicator inside the importer if you anticipate that handling the output of the importer may take some time.

Parameters:

Name Type
msg? undefined | string

Returns: void


displaySuccess

▸ displaySuccess(msg: string): void

Defined in src/index.ts:180

This will display a dialog inside of the importer with a success icon and the message you pass.

Parameters:

Name Type
msg string

Returns: void


emit

▸ emit(event: string symbol, …args: Array‹any›): boolean

Inherited from FlatfileImporter.emit

Defined in node_modules/eventemitter3/index.d.ts:31

Calls each of the listeners registered for a given event.

Parameters:

Name Type
event string | symbol
...args Array‹any›

Returns: boolean


eventNames

▸ eventNames(): *Array‹string symbol›*

Inherited from FlatfileImporter.eventNames

Defined in node_modules/eventemitter3/index.d.ts:16

Return an array listing the events for which the emitter has registered listeners.

Returns: *Array‹string symbol›*

getMeta

▸ getMeta(): object

Defined in src/index.ts:189

This will fetch the data from the importer

Returns: object


listenerCount

▸ listenerCount(event: string symbol): number

Inherited from FlatfileImporter.listenerCount

Defined in node_modules/eventemitter3/index.d.ts:26

Return the number of listeners listening to a given event.

Parameters:

Name Type
event string | symbol

Returns: number


listeners

▸ listeners(event: string symbol): Array‹ListenerFn›

Inherited from FlatfileImporter.listeners

Defined in node_modules/eventemitter3/index.d.ts:21

Return the listeners registered for a given event.

Parameters:

Name Type
event string | symbol

Returns: Array‹ListenerFn›


load

▸ load(): Promise‹Array‹Object››

Defined in src/index.ts:109

Use load() when you want a promise returned. This is necessary if you want to use async/await for an es6 implementation

deprecated

Returns: Promise‹Array‹Object››


off

▸ off(event: string symbol, fn?: ListenerFn, context?: any, once?: undefined false true): this

Inherited from FlatfileImporter.off

Defined in node_modules/eventemitter3/index.d.ts:48

Parameters:

Name Type
event string | symbol
fn? ListenerFn
context? any
once? undefined | false | true

Returns: this


on

▸ on(event: string symbol, fn: ListenerFn, context?: any): this

Inherited from FlatfileImporter.on

Defined in node_modules/eventemitter3/index.d.ts:36

Add a listener for a given event.

Parameters:

Name Type
event string | symbol
fn ListenerFn
context? any

Returns: this


once

▸ once(event: string symbol, fn: ListenerFn, context?: any): this

Inherited from FlatfileImporter.once

Defined in node_modules/eventemitter3/index.d.ts:42

Add a one-time listener for a given event.

Parameters:

Name Type
event string | symbol
fn ListenerFn
context? any

Returns: this


open

▸ open(options: object): void

Defined in src/index.ts:87

Call open() to activate the importer overlay dialog.

Parameters:

Name Type Default
options object {}

Returns: void


registerFieldHook

▸ registerFieldHook(field: string, cb: FieldHookCallback): void

Defined in src/index.ts:230

Set the customer information for this import

Parameters:

Name Type
field string
cb FieldHookCallback

Returns: void


registerNetworkErrorCallback

▸ registerNetworkErrorCallback(callback: FlatfileImporter[“$networkErrorCallback”]): void

Defined in src/index.ts:223

Parameters:

Name Type
callback FlatfileImporter[“$networkErrorCallback”]

Returns: void


registerRecordHook

▸ registerRecordHook(callback: FlatfileImporter[“$recordHook”]): void

Defined in src/index.ts:219

Set the customer information for this import

Parameters:

Name Type
callback FlatfileImporter[“$recordHook”]

Returns: void


registerValidatorCallback

▸ registerValidatorCallback(callback: FlatfileImporter[“$validatorCallback”]): void

Defined in src/index.ts:209

Set the customer information for this import

Parameters:

Name Type
callback FlatfileImporter[“$validatorCallback”]

Returns: void


removeAllListeners

▸ removeAllListeners(event?: string symbol): this

Inherited from FlatfileImporter.removeAllListeners

Defined in node_modules/eventemitter3/index.d.ts:53

Remove all listeners, or those of the specified event.

Parameters:

Name Type
event? string | symbol

Returns: this


removeListener

▸ removeListener(event: string symbol, fn?: ListenerFn, context?: any, once?: undefined false true): this

Inherited from FlatfileImporter.removeListener

Defined in node_modules/eventemitter3/index.d.ts:47

Remove the listeners of a given event.

Parameters:

Name Type
event string | symbol
fn? ListenerFn
context? any
once? undefined | false | true

Returns: this


requestCorrectionsFromUser

▸ requestCorrectionsFromUser(msg: any): Promise‹FlatfileResults›

Defined in src/index.ts:169

This will display a dialog inside of the importer with an error icon and the message you pass. The user will be able to acknowledge the error and be returned to the import data spreadsheet to ideally fix any issues or attempt submitting again.

Parameters:

Name Type
msg any

Returns: Promise‹FlatfileResults›


requestDataFromUser

▸ requestDataFromUser(options: LoadOptionsObject): Promise‹FlatfileResults›

Defined in src/index.ts:137

Use requestDataFromUser() when you want a promise returned. This is necessary if you want to use async/await for an es6 implementation

Parameters:

Name Type Default
options LoadOptionsObject {}

Returns: Promise‹FlatfileResults›


setCustomer

▸ setCustomer(customer: CustomerObject): void

Defined in src/index.ts:202

Set the customer information for this import

Parameters:

Name Type
customer CustomerObject

Returns: void


Static setMountUrl

▸ setMountUrl(url: string): void

Defined in src/index.ts:64

This will by default always be https://www.flatfile.io/importer/:key unless you are an enterprise customer that is self-hosting the application. In which case, this will be the URL of your enterprise installd Flatfile importer index page

Parameters:

Name Type
url string

Returns: void


Static setVersion

▸ setVersion(version: 1 2): void

Defined in src/index.ts:71

This allows you to opt into or out of specific versions of the Flatfile SDK

Parameters:

Name Type
version 1 | 2

Returns: void