Commit graph

147 commits

Author SHA1 Message Date
Paul Chavard
12884e0242 cleanup(js): remove unused utils 2022-05-10 18:10:20 +02:00
Paul Chavard
59c6fd1763 refactor(ts): improuve utils types 2022-05-10 18:10:20 +02:00
simon lehericey
5040b877d1 remove unused franceconnect.js 2022-05-06 11:50:32 +02:00
Paul Chavard
9e0b3b642f cleanup(sendinblue): remove sendinblue tracking 2022-05-06 11:14:44 +02:00
Paul Chavard
4307445999 fix(js): prevent old Edge from crashing 2022-05-05 09:35:53 +02:00
Paul Chavard
2db892d876 refactor(turbo): champ siret and dossier_link use turbo 2022-05-04 14:11:43 +02:00
Paul Chavard
af363b721b refactor(js): use httpRequest instead of getJSON and ajax 2022-05-03 15:09:30 +02:00
Paul Chavard
229eb1a775 feat(js): add httpRequest 2022-05-03 15:09:30 +02:00
Paul Chavard
3f4004b188 fix(js): add DocumentFragment.children polyfill for IE 2022-05-03 12:38:17 +02:00
Paul Chavard
a16d07ef7c fix(js): fix IE 11 fucked template element support 2022-04-29 18:24:53 +02:00
Paul Chavard
1890c05974 fix(js): more polyfills for IE 2022-04-29 14:11:00 +02:00
Paul Chavard
20a78f08c9 fix(js): add turbo and stimulus polyfills 2022-04-28 11:14:26 +02:00
Paul Chavard
02f977fd8d refactor(champs): refactor champs components to use typescript 2022-04-26 13:56:26 +02:00
Paul Chavard
bca97268a8 fix(upload): errorFromDirectUploadMessage should take Error or string 2022-04-24 11:47:17 +02:00
Paul Chavard
62dca1c7b0 refactor(js): remove ds:page:update event 2022-04-22 10:24:39 +02:00
Paul Chavard
0dac59bffc refactor(js): use DOMContentLoaded instead of ds:page:update 2022-04-22 09:40:17 +02:00
Paul Chavard
64c599e208 refactor(stimulus): initiate react components via stimulus 2022-04-20 14:08:47 +02:00
Paul Chavard
2ce9c842a1 refactor(type_de_champs): use typescript in type de champs editor 2022-04-08 14:34:27 +02:00
Paul Chavard
44c64669e9 Revert "Merge pull request #6787 from tchak/use-vite"
This reverts commit 5d572727b5, reversing
changes made to 43be4482ee.
2022-03-31 12:07:52 +02:00
Paul Chavard
187e84a010 feat(assets): use vitejs to build javascript 2022-03-29 16:27:08 +02:00
Paul Chavard
a914950982 chore(eslint): fix getJSON reponse type 2022-02-23 15:28:51 +01:00
Paul Chavard
beafa21796 chore(eslint): fix isNumeric types 2022-02-23 15:28:51 +01:00
François Vantomme
cc6cb2ea30 feat(matomo): use env variables to set the domain 2022-02-15 09:25:23 +01:00
Paul Chavard
ea6aec8b1a chore(webpack): enable typescript 2022-02-09 10:29:00 +01:00
Pierre de La Morinerie
d4fada9f6c config: add MATOMO_HOST environment variable 2022-01-19 15:43:44 +01:00
Paul Chavard
6776a5e05a fix(react): remove register component cache 2022-01-03 19:41:23 +01:00
Pierre de La Morinerie
07230870d3 js: don't track external links
This fixes an issue where, by default, links to private attachments are
reported to Matomo.

This is benign: attachments URLs can be filtered out server-side, and
expire after one hour anyway. But we don't want to ship an insecure
configuration by default.
2021-12-23 09:50:21 +01:00
Paul Chavard
f8d245d2f8 refactor(js): use dynamic import 2021-12-21 17:09:49 +00:00
Pierre de La Morinerie
8dce7d59ed js: redirect to sign-in when a ujs link_to receives a 401
Before, when a 401 was received by a ujs-enabled link (like `link_to …,
method: :delete, data: { remote: true }`, rails-ujs tried to insert the
response text as a Javascript script.

As the script was something like `Please sign-in`, which is not valid
Javascript, the browser would throw an "Unexpected token" error.

The typical use-case is:

1. The user open a form in a tab,
2. The user disconnects in another tab,
3. In the first tab, the user clicks on a remote "Delete" link_to

In that case the browser raised an error in the console (and in Sentry),
but the user would see nothing.

With this commit, all 401 ujs errors are turned into redirects to the
sign-in page.

Fix https://sentry.io/organizations/demarches-simplifiees/issues/2522512693/activity/
2021-09-07 16:45:52 -05:00
Pierre de La Morinerie
255c00c174 js: ignore a new variant of the same warning 2021-09-07 16:45:52 -05:00
Pierre de La Morinerie
7808f6dd4f js: document utils.ajax() 2021-07-22 11:58:02 +02:00
Pierre de La Morinerie
071d9145ca js: don't attempt to log unexistent statusText 2021-07-22 11:58:01 +02:00
Pierre de La Morinerie
63cde95fc9 js: ignore errors generated by a Microsoft crawler
Sentry has a lot of Javacript errors stating:

> UnhandledRejection: Non-Error promise rejection captured with value: Object Not Found Matching Id:2 

This is apparently caused by a Microsoft crawler (maybe for scanning
targets of email links), and can be safely ignored.

See https://forum.sentry.io/t/unhandledrejection-non-error-promise-rejection-captured-with-value/14062/12
2021-07-20 09:21:59 +02:00
Christophe Robillard
6026793c1d focus to target after toggle 2021-03-17 11:31:51 +01:00
Christophe Robillard
df3bd3a1d2 handle focus during and after upload 2021-03-17 11:31:51 +01:00
Christophe Robillard
43039d1755 add aria-value min, max and now for progressbar upload 2021-03-17 11:31:51 +01:00
Paul Chavard
752ee78c49 Use fetch instead of jQuery 2020-10-13 10:55:10 +02:00
Paul Chavard
95eb907090 remove unused javascript 2020-10-07 11:39:57 +02:00
Pierre de La Morinerie
e033ec3404 js: ignore missing DOM element on ProgressBar
Currently ProgressBar is used to monitor upload progress of attachments.

But there's two cases where the associated DOM element may be removed:

- In the champs editor, when the list scrolls, DOM elements are removed
and added dynamically by React;
- In the user form, the user might start an upload on a repetition, and
then remove the associated row during the download.

In both those cases, we don't want the missing DOM element to trigger
an error.
2020-09-03 15:03:13 +02:00
Pierre de La Morinerie
5949266e89 javascript: silence Crisp warning in Javascript console 2020-06-26 15:57:14 +02:00
Paul Chavard
901b6e23a8 Remove legacy carto 2020-06-04 16:03:23 +02:00
Pierre de La Morinerie
833d7a3b59 javascript: ignore most common upload errors also in standard uploads
In #5149, we ignored most common upload errors, but only for
auto-uploads.

This PR ignores those errors also for standard uploads.
2020-05-18 11:50:29 +02:00
Pierre de La Morinerie
b5f1d97629 app: disable Turbolinks
Fix #5039
2020-05-13 11:04:16 +02:00
Paul Chavard
43a1ead1cb fix new prettier defaults 2020-05-12 18:18:37 +02:00
Paul Chavard
05e408225b Implement atomic operations on MapEditor 2020-05-06 16:46:14 +02:00
Pierre de La Morinerie
6f4075f38e javascript: fix FileUploadError stacktraces
When subclassing a JS error, most browsers include the constructor
stacktrace :/

This is an issue, because:
- The stacktrace is deeper than it should be
- The stacktrace reaches into a polyfill for which there is not source
map, which causes Sentry to infer the issue grouping from the JS file
name. And the fingerprinted name changes on each release. So for each
release, the stacktrace is different ; and Sentry can't group issues
properly.
2020-04-23 12:27:26 +02:00
Paul Chavard
bc8217e030 Carte Editor sends FeatureCollection to the server 2020-04-16 18:29:19 +02:00
Pierre de La Morinerie
769e98f63e javascript: fix the progress bar removal on success
When using auto-attach, the response HTML fragment replaces the progress
bar – so it doesn't need to be removed twice.
2020-04-16 17:02:23 +02:00
Pierre de La Morinerie
647ad3ba10 javascript: consider unknown upload errors as client errors 2020-04-16 12:59:14 +02:00
Pierre de La Morinerie
b006c33ebe javascript: parse the upload status code correctly
Previously the status was "Status: 422" instead of just 422.
2020-04-16 12:54:18 +02:00