@sumup/collector
Advanced tools
Comparing version 1.0.0-alpha.2 to 1.0.0-alpha.3
{ | ||
"name": "@sumup/collector", | ||
"sideEffects": false, | ||
"version": "1.0.0-alpha.2", | ||
"version": "1.0.0-alpha.3", | ||
"main": "build/index.js", | ||
@@ -6,0 +6,0 @@ "module": "build/index.es.js", |
@@ -24,2 +24,3 @@ <div align="center"> | ||
- [useClickTrigger](#useclicktrigger) | ||
- [useSubmitTrigger](#usesubmittrigger) | ||
- [usePageViewTrigger](#usepageviewtrigger) | ||
@@ -267,2 +268,37 @@ - [Code of Conduct (CoC)](#code-of-conduct-coc) | ||
### useSubmitTrigger | ||
`useSubmitTrigger` provides you a dispatch function for any kind of form submission event. | ||
The dispatch function accepts the following interface: | ||
```jsx | ||
interface Options { | ||
component?: string; | ||
label?: string; | ||
customParameters?: { | ||
[key: string]: any | ||
}; | ||
event: 'submit'; // Added internally by the hook | ||
timestamp: number; // Added internally when the dispatch function is called | ||
} | ||
``` | ||
```jsx | ||
import React from 'react'; | ||
import { useSubmitTrigger } from '@sumup/collector'; | ||
function Form({ children }) { | ||
const dispatch = useSubmitTrigger(); | ||
const submitHandler = (e) => { | ||
e.preventDefault(); | ||
dispatch({ component: 'form' }); | ||
}; | ||
return <form onSubmit={handler}>{children}</form>; | ||
} | ||
``` | ||
### usePageViewTrigger | ||
@@ -269,0 +305,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
54673
39
608
386