Skip to content

Commit dd653f5

Browse files
committed
☄️Initial commit
0 parents  commit dd653f5

29 files changed

+11324
-0
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# 4 space indentation
2+
[*]
3+
end_of_line = lf
4+
insert_final_newline = true
5+
indent_style = space
6+
indent_size = 4

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto
2+
*.js text eol=lf
3+
*.ts text eol=lf

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"trailingComma": "all",
3+
"quoteProps": "preserve",
4+
"semi": true,
5+
"singleQuote": true,
6+
"tabWidth": 4,
7+
"vueIndentScriptAndStyle": true,
8+
"htmlWhitespaceSensitivity": "strict"
9+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Somus OÜ
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Vue Friendly Captcha
2+
3+
Wrapper component library for [Friendly Challenge][frc]. Works with Vue 2 and 3.
4+
5+
## Getting Started
6+
7+
**1. Install the package**
8+
9+
- Vue 2.x: `npm install --save @somushq/vue-friendly-captcha`
10+
- Vue 3.x: `npm install --save @somushq/vue3-friendly-captcha`
11+
12+
**2. Use it in your Vue app**
13+
14+
Vue 2.x:
15+
16+
```vue
17+
<template>
18+
<vue-friendly-captcha sitekey="your-site-key" />
19+
</template>
20+
21+
<script>
22+
import VueFriendlyCaptcha from '@somushq/vue-friendly-captcha';
23+
24+
export default {
25+
components: {
26+
VueFriendlyCaptcha,
27+
},
28+
};
29+
</script>
30+
```
31+
32+
Vue 3.x:
33+
34+
```vue
35+
<template>
36+
<vue-friendly-captcha sitekey="your-site-key" />
37+
</template>
38+
39+
<script setup>
40+
import VueFriendlyCaptcha from '@somushq/vue3-friendly-captcha';
41+
</script>
42+
```
43+
44+
## API
45+
46+
### Props
47+
48+
| Name | Type | Default value | Description |
49+
| :------------------ | :------ | :------------------------------------------------ | :--------------------------------------------------------- |
50+
| `sitekey`\* | String | N/A | The site key to be used for Friendly Captcha. |
51+
| `dark` | Boolean | `false` | Whether the widget should render in dark mode. |
52+
| `startMode` | String | `'focus'` | Specifies when the widget should start solving the puzzle. |
53+
| `language` | String | `'en'` | The language to be used for the widget. |
54+
| `solutionFieldName` | String | `'frc-captcha-solution'` | The name of the field that will contain the solution. |
55+
| `puzzleEndpoint` | String | `'https://api.friendlycaptcha.com/api/v1/puzzle'` | The endpoint to be used for the puzzle. |
56+
57+
_\* - Required_
58+
59+
### Methods
60+
61+
| Name | Params | Return type | Description |
62+
| :-------- | :----- | :---------- | :---------------------------------------------- |
63+
| `init` | N/A | `void` | Initializes the Friendly Challenge widget. |
64+
| `start` | N/A | `void` | Starts solving the captcha. |
65+
| `reset` | N/A | `void` | Resets the captcha. |
66+
| `destroy` | N/A | `void` | Destroys the captcha. |
67+
| `isValid` | N/A | `boolean` | Returns whether the captcha has been validated. |
68+
69+
### Events
70+
71+
| Name | Params | Description |
72+
| :-------- | :------- | :----------------------------------------------------------------- |
73+
| `ready` | N/A | The Friendly Captcha widget is ready. |
74+
| `started` | N/A | Solution has been initiated. |
75+
| `done` | `string` | The captcha was solved. Will contain the solution as a parameter. |
76+
| `error` | `string` | The captcha was not solved. Will contain the error as a parameter. |
77+
78+
## For Contributors
79+
80+
We publish separate modules for Vue 2 and 3. You can use Lerna to perform
81+
operations on both packages at once.
82+
83+
```
84+
npm i -g lerna
85+
```
86+
87+
The packages can be found in the following directories:
88+
89+
- `packages/vue2` for Vue 2.x
90+
- `packages/vue3` for Vue 3.x
91+
92+
Make sure to lint your changes before committing them by running
93+
94+
```
95+
npm run lint
96+
```
97+
98+
in the root directory.
99+
100+
Building can be done using `npm run build`.
101+
102+
## License
103+
104+
MIT. See the LICENSE file for more details.
105+
106+
[frc]: https://friendlycaptcha.com/

lerna.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"npmClient": "npm",
3+
"version": "independent",
4+
"command": {
5+
"publish": {
6+
"verifyAccess": false
7+
}
8+
}
9+
}

package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "vue-friendly-captcha",
3+
"version": "1.0.0",
4+
"description": "Friendly Captcha component for Vue 2 and 3.",
5+
"private": true,
6+
"workspaces": [
7+
"packages/*"
8+
],
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/SomusHQ/vue-friendly-captcha.git"
12+
},
13+
"author": "József Sallai <[email protected]>",
14+
"organization": "SomusHQ",
15+
"license": "MIT",
16+
"bugs": {
17+
"url": "https://github.com/SomusHQ/vue-friendly-captcha/issues"
18+
},
19+
"homepage": "https://github.com/SomusHQ/vue-friendly-captcha#readme",
20+
"scripts": {
21+
"build": "lerna run build --stream",
22+
"lint": "lerna run lint --stream"
23+
}
24+
}

packages/vue2/.browserslistrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
> 1%
2+
last 2 versions
3+
not dead

packages/vue2/.eslintrc.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
module.exports = {
2+
extends: ['plugin:vue/recommended', 'plugin:prettier/recommended'],
3+
4+
plugins: ['prettier'],
5+
6+
rules: {
7+
indent: 'off', // avoid conflicts with prettier
8+
9+
semi: ['error', 'always'],
10+
11+
'comma-dangle': ['error', 'always-multiline'],
12+
13+
camelcase: 'off',
14+
15+
'no-useless-constructor': 'off',
16+
17+
'no-console': 'off',
18+
19+
'require-await': 'off',
20+
21+
'dot-notation': 'off',
22+
23+
'no-case-declarations': 'off',
24+
25+
'import/no-named-as-default': 'off',
26+
27+
'space-before-function-paren': [
28+
'error',
29+
{
30+
anonymous: 'always',
31+
named: 'never',
32+
asyncArrow: 'always',
33+
},
34+
],
35+
36+
'vue/script-indent': 'off',
37+
38+
'vue/html-indent': 'off',
39+
},
40+
41+
overrides: [
42+
{
43+
files: ['*.vue'],
44+
rules: {
45+
'import/named': 'off', // fixes some weird conflicts with relfect-metadata
46+
},
47+
},
48+
],
49+
};

packages/vue2/.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
5+
# local env files
6+
.env.local
7+
.env.*.local
8+
9+
# Log files
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
pnpm-debug.log*
14+
15+
# Editor directories and files
16+
.idea
17+
.vscode
18+
*.suo
19+
*.ntvs*
20+
*.njsproj
21+
*.sln
22+
*.sw?

packages/vue2/.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
demo.html

packages/vue2/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 Somus OÜ
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

packages/vue2/babel.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [['@babel/preset-env']],
3+
};

0 commit comments

Comments
 (0)