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

vue-captcha-switcher

v1.0.11

Published

A Vue.js component to switch between different CAPTCHA services.

Downloads

22

Readme

Vue Captcha Switcher

A Vue 3 component that allows you to easily switch between different CAPTCHA services such as Google reCAPTCHA, hCaptcha, and Cloudflare Turnstile.

Table of Contents

Features

  • Supports Google reCAPTCHA v2, hCaptcha, and Cloudflare Turnstile.
  • Simple integration with Vue 3.
  • Dynamic CAPTCHA switching based on the selected service.
  • Customizable options such as theme and size.

Installation

You can install vue-captcha-switcher using npm or yarn.

Using npm

npm install vue-captcha-switcher

Using yarn

yarn add vue-captcha-switcher

Usage

Here’s an example of how to use the VueCaptchaSwitcher component in your Vue 3 project.

<template>
    <VueCaptchaSwitcher
            :captchaName="captchaName"
            :publicKey="publicKey"
            v-model="captchaResponse"
    />
</template>

<script setup>
    import { ref } from 'vue';
    import VueCaptchaSwitcher from 'vue-captcha-switcher';

    const captchaName = ref('recaptcha'); // Options: 'recaptcha', 'hcaptcha', 'turnstile'
    const publicKey = 'your-site-key';
    const captchaResponse = ref('');
</script>

Switching Between CAPTCHA Providers

You can switch between Google reCAPTCHA, hCaptcha, and Cloudflare Turnstile by changing the captchaName prop. The possible values are:

  • recaptcha
  • hcaptcha
  • turnstile

For example:

<template>
  <VueCaptchaSwitcher
    :captchaName="'hcaptcha'"
    :publicKey="yourHcaptchaKey"
    v-model="captchaResponse"
  />
</template>

Props

| Prop | Type | Required | Description | |--------------------|---------|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | captchaName | String | Yes | Name of the CAPTCHA service to use ('recaptcha', 'hcaptcha', 'turnstile'). | | publicKey | String | Yes | Public site key for the respective CAPTCHA service. | | captchaScriptIds | Object | No | (Optional) Object to customize the script tag IDs for each CAPTCHA service. Defaults: { recaptcha: 'recaptcha-script', hcaptcha: 'hcaptcha-script', turnstile: 'turnstile-script' }. | | captchaReset | Boolean | No | (Optional) Boolean value to manually trigger a reset of the CAPTCHA. Defaults to false. | | loadingTimeout | Number | No | (Optional) Timeout in milliseconds to wait before the CAPTCHA fails to load. Defaults to 0 (no timeout). |

Events

| Event | Description | |----------------|-------------------------------------------------------------------------------------| | verify | Emitted when CAPTCHA verification is successful. Passes the CAPTCHA response token. | | expire | Emitted when the CAPTCHA expires and requires re-verification. | | fail | Emitted when CAPTCHA fails to load or there's an error during verification. | | captchaReset | Emitted when the CAPTCHA is reset using the captchaReset prop. |

Contributing

Contributions are welcome! If you'd like to contribute to the project, follow these steps:

Fork the repository. Create a new branch for your feature or bugfix.

  • Make your changes and commit them with descriptive messages.
  • Push your changes to your fork.
  • Submit a pull request. For major changes, please open an issue first to discuss what you would like to change.

Setting Up the Project Locally

  1. Clone the repository:
git clone https://github.com/saidurbhuiyan/vue-captcha-switcher.git
  1. Install the dependencies:
npm install
  1. Build the package:
npm run build

License

This project is licensed under the MIT License. See the LICENSE file for more details.