npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@marcusball/flatfile-button-vue

v1.0.1

Published

Vue.js flatfile adapter

Downloads

28

Readme

Flatfile Vue.js Component [Vue 3 Fork]

npm Minzipped Size NPM Downloads MIT License

Fork Details

This is a version of the official Flatfile button package to add support for Vue 3. This should behave similarly to the original version of the package, except that it has been upgraded to use Vue events instead of passing callback functions via props.

<flatfile-button
  :token="token"
  @init="onFlatfileInit"
  @launch="onFlatfileLaunch"
  @complete="onFlatfileComplete"
  @error="onFlatfileError"
  @close="onFlatfileClose"
  class="ff-button"
>
  Upload to Flatfile!
</flatfile-button>

<script>
  import { FlatfileButton } from "@flatfile/vuejs";

  export default {
    name: "App",
    components: {
      FlatfileButton,
    },
    data: () => ({
      token: "Your_Token_You_Received_From_Your_Backend",
    }),
    methods: {
      onInit: function (data) {
        console.log("onInit");
        console.log(data);
      },
      onUpload: function (data) {
        console.log("onUpload");
        console.log(data);
      },
      onLaunch: function (data) {
        console.log("onLaunch");
        console.log(data);
      },
      onClose: function (data) {
        console.log("onClose");
        console.log(data);
      },
      onComplete: async function (payload) {
        const data = await payload.data();
        console.log("onComplete");
        console.log(data);
      },
      onError: function (error) {
        console.log("onError");
        console.log(error);
      },
    },
  };
</script>

Original Docs:

NOTE: If you upgrading from previous versions (0.x), v3+ comes with some updates & breaking changes

BREAKING CHANGES:

Note that the latest version of @flatfile/vuejs 3+ uses the new @flatfile/sdk underneath which changes the API surface of interacting with the flatfile adapter entirely.

Read more about these changes here

There is now only 1 required input, and that is :token (which you must receive from your backend).

Read more about generating a Token here


Getting Started with Flatfile & Vue.js

We've made it really simple for you to get started with Flatfile with our new Flatfile Component. Here's what you'll need to know to get started.

First, install the dependency via npm:

npm install @flatfile/vuejs@3

This will give you access to the <flatfile-button /> component as well as the same basic functionality as our new SDK.

Simply add the import to a component where you want to include the Flatfile vuejs adapter via

import { FlatfileButton } from '@flatfile/vuejs'; export default { name:
'DemoComponent', components: { FlatfileButton, }, // ... }

Now in your application simply utilize this new <flatfile-button> component, but make sure to pass in the 1 required prop, (and/or any optional ones you may need for your application).

The 1 required property is

  • :token (String) [ which you need to get from your backend ]

Read more here on how to implement a secure token.

<flatfile-button :token="token"> Upload to Flatfile! </flatfile-button>

<script>
  import { FlatfileButton } from "@flatfile/vuejs";

  export default {
    name: "App",
    components: {
      FlatfileButton,
    },
    data: () => ({
      token: "Your_Token_You_Received_From_Your_Backend",
    }),
  };
</script>

Here's an example passing down many of the other optional parameters/methods available to the adapter.

<flatfile-button
  :token="token"
  :onInit="onInit"
  :onUpload="onUpload"
  :onLaunch="onLaunch"
  :onClose="onClose"
  :onComplete="onComplete"
  :onError="onError"
  class="ff-button"
>
  Upload to Flatfile!
</flatfile-button>

<script>
  import { FlatfileButton } from "@flatfile/vuejs";

  export default {
    name: "App",
    components: {
      FlatfileButton,
    },
    data: () => ({
      token: "Your_Token_You_Received_From_Your_Backend",
    }),
    methods: {
      onInit: function (data) {
        console.log("onInit");
        console.log(data);
      },
      onUpload: function (data) {
        console.log("onUpload");
        console.log("data");
      },
      onLaunch: function (data) {
        console.log("onLaunch");
        console.log("data");
      },
      onClose: function (data) {
        console.log("onClose");
        console.log("data");
      },
      onComplete: function (data) {
        console.log("onComplete");
        console.log("data");
      },
      onError: function (error) {
        console.log("onError");
        console.log(error);
      },
    },
  };
</script>

Additional options

You can also pass down mountUrl and apiUrl to the <flatfile-button>.

<flatfile-button :token="token" :mountUrl="mountUrl" :apiUrl="apiUrl">
  Upload to Flatfile!
</flatfile-button>

<script>
  import { FlatfileButton } from "@flatfile/vuejs";

  export default {
    name: "App",
    components: {
      FlatfileButton,
    },
    data: () => ({
      token: "Your_Token_You_Received_From_Your_Backend",
      mountUrl: "mountUrl",
      apiUrl: "",
    }),
    // ... everything else
  };
</script>

Publishing

Update changelog (if needed), update package.json version (semver), add any updates needed for README (if needed), then run the following scripts:

npm run build:lib
npm publish