Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(TU-13163): Add the duplicate-detected callback #660

Merged
merged 4 commits into from
Aug 26, 2024

Conversation

gierlas
Copy link
Contributor

@gierlas gierlas commented Aug 14, 2024

What

Typeform supports duplicate prevention. A callback is added to allow developers react to the duplicate-detected event.

@gierlas gierlas requested a review from a team as a code owner August 14, 2024 10:10
Copy link

gitstream-cm bot commented Aug 14, 2024

🥷 Code experts: mathio

mathio, Thr44 have most 👩‍💻 activity in the files.
mathio has most 🧠 knowledge in the files.

See details

packages/embed/README.md

Activity based on git-commit:

mathio Thr44
AUG
JUL 2 additions & 2 deletions
JUN
MAY
APR
MAR

Knowledge based on git-blame:
mathio: 97%

packages/embed/src/base/actionable-options.ts

Activity based on git-commit:

mathio Thr44
AUG
JUL
JUN
MAY
APR
MAR

Knowledge based on git-blame:
mathio: 66%

packages/embed/src/utils/create-iframe/create-iframe.ts

Activity based on git-commit:

mathio Thr44
AUG
JUL
JUN
MAY
APR
MAR

Knowledge based on git-blame:
mathio: 53%

packages/embed/src/utils/create-iframe/get-form-event-handler.ts

Activity based on git-commit:

mathio Thr44
AUG
JUL
JUN
MAY
APR
MAR

Knowledge based on git-blame:
mathio: 58%

To learn more about /:\ gitStream - Visit our Docs

@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@gierlas gierlas marked this pull request as draft August 14, 2024 11:02
@@ -159,6 +159,7 @@ Closing and opening a typeform in modal window will restart the progress from th
| [onQuestionChanged](https://codesandbox.io/s/github/Typeform/embed-demo/tree/main/demo-html/callbacks) | function | fires when user navigates between form questions | `undefined` |
| [onHeightChanged](https://codesandbox.io/s/github/Typeform/embed-demo/tree/main/demo-html/callbacks) | function | fires when form question height changes (eg. on navigation between questions or on error message) | `undefined` |
| [onEndingButtonClick](https://codesandbox.io/s/github/Typeform/embed-demo/tree/main/demo-html/callbacks) | function | fires when button on ending screen is clicked, disables button redirect functionality | `undefined` |
| onDuplicateDetected | function | fires when the responder reaches the quota of submission defined in the duplicate prevention setting | `undefined` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would include a link to the help center page here: https://www.typeform.com/help/a/prevent-duplicate-responses-27917825492244/ and also slightly reword it ( respondent is the correct term):

fires when a respondent reaches the submission quota defined in duplicate prevention setting

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update docs in the repo as well. It is deployed to https://developer.typeform.com/ automatically to update the docs in that place too.

@@ -255,6 +256,9 @@ You can listen to form events by providing callback methods:

// for plans with "Redirect from ending screen" feature you also receive `ref`:
console.log(`Ending button clicked in end screen ${ref}`)
},
onDuplicateDetected: ({ formId }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding an example here 👍

Please add one to the packages/demo-html/public/callbacks.html as well, so we have a runnable example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mathio Do you happen to have access to the test form? We'd need to enable the duplicate prevention feature there.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think I do :( Actually, it might be better to create a new form and new HTML page for demo purposes, since this feature would affect other demos when enabled.

@typeform-ops-gha
Copy link

[BOT] Preview available with hash bc7d4775371a588ae4e59bcb7686bb71590a40dc here.

Copy link

sonarcloud bot commented Aug 26, 2024

@gierlas gierlas marked this pull request as ready for review August 26, 2024 16:20
@gierlas gierlas merged commit 90135e7 into main Aug 26, 2024
13 of 14 checks passed
@gierlas gierlas deleted the feat/TU-13163/duplicate-prevention-postMessage branch August 26, 2024 16:20
typeform-ops-gha pushed a commit that referenced this pull request Aug 26, 2024
# [@typeform/embed-v5.1.0](https://github.com/Typeform/embed/compare/@typeform/embed-v5.0.0...@typeform/embed-v5.1.0) (2024-08-26)

### Features

* **TU-13163:** Add the duplicate-detected callback ([#660](#660)) ([90135e7](90135e7))
@typeform-ops-gha
Copy link

🎉 This PR is included in version @typeform/embed-v5.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants