demarches-normaliennes/app/javascript/packs/application.js

103 lines
3.4 KiB
JavaScript
Raw Normal View History

import '../shared/polyfills';
import Rails from '@rails/ujs';
import * as ActiveStorage from '@rails/activestorage';
import 'whatwg-fetch'; // window.fetch polyfill
import { Application } from '@hotwired/stimulus';
import * as Turbo from '@hotwired/turbo';
2019-02-13 14:16:22 +01:00
import '../shared/activestorage/ujs';
2020-01-29 12:16:38 +01:00
import '../shared/remote-poller';
2018-08-31 12:56:56 +02:00
import '../shared/safari-11-file-xhr-workaround';
import '../shared/franceconnect';
import '../shared/toggle-target';
import '../shared/ujs-error-handling';
import {
ReactController,
registerComponents
} from '../controllers/react_controller';
2022-04-14 20:46:28 +02:00
import { TurboEventController } from '../controllers/turbo_event_controller';
import { GeoAreaController } from '../controllers/geo_area_controller';
import { TurboInputController } from '../controllers/turbo_input_controller';
import '../new_design/dropdown';
import '../new_design/form-validation';
import '../new_design/procedure-context';
import '../new_design/procedure-form';
2019-02-21 17:50:18 +01:00
import '../new_design/spinner';
import '../new_design/support';
2021-05-20 11:20:28 +02:00
import '../new_design/messagerie';
import '../new_design/dossiers/auto-save';
import '../new_design/dossiers/auto-upload';
import '../new_design/champs/linked-drop-down-list';
2019-01-30 16:14:15 +01:00
import '../new_design/champs/repetition';
import '../new_design/champs/drop-down-list';
2020-10-06 17:10:34 +02:00
import {
toggleCondidentielExplanation,
replaceSemicolonByComma
} from '../new_design/avis';
import {
showMotivation,
motivationCancel,
showImportJustificatif
} from '../new_design/state-button';
2019-12-02 14:20:26 +01:00
import {
acceptEmailSuggestion,
discardEmailSuggestionBox
} from '../new_design/user-sign_up';
import {
2021-10-13 09:26:54 +02:00
showFusion,
2021-10-13 01:08:57 +02:00
showNewAccount,
showNewAccountPasswordConfirmation
} from '../new_design/fc-fusion';
registerComponents({
Chartkick: () => import('../components/Chartkick'),
ComboAdresseSearch: () => import('../components/ComboAdresseSearch'),
ComboAnnuaireEducationSearch: () =>
import('../components/ComboAnnuaireEducationSearch'),
ComboCommunesSearch: () => import('../components/ComboCommunesSearch'),
ComboDepartementsSearch: () =>
import('../components/ComboDepartementsSearch'),
ComboMultipleDropdownList: () =>
import('../components/ComboMultipleDropdownList'),
ComboMultiple: () => import('../components/ComboMultiple'),
ComboPaysSearch: () => import('../components/ComboPaysSearch'),
ComboRegionsSearch: () => import('../components/ComboRegionsSearch'),
MapEditor: () => import('../components/MapEditor'),
MapReader: () => import('../components/MapReader'),
Trix: () => import('../components/Trix'),
TypesDeChampEditor: () => import('../components/TypesDeChampEditor')
2021-12-21 16:30:29 +01:00
});
// This is the global application namespace where we expose helpers used from rails views
const DS = {
2018-11-14 16:28:02 +01:00
fire: (eventName, data) => Rails.fire(document, eventName, data),
toggleCondidentielExplanation,
showMotivation,
motivationCancel,
showImportJustificatif,
showFusion,
2021-10-13 09:26:54 +02:00
showNewAccount,
2021-10-13 01:08:57 +02:00
showNewAccountPasswordConfirmation,
replaceSemicolonByComma,
acceptEmailSuggestion,
discardEmailSuggestionBox
};
// Start Rails helpers
Rails.start();
ActiveStorage.start();
2022-04-20 14:17:40 +02:00
Turbo.session.drive = false;
const Stimulus = Application.start();
Stimulus.register('react', ReactController);
2022-04-14 20:46:28 +02:00
Stimulus.register('turbo-event', TurboEventController);
Stimulus.register('geo-area', GeoAreaController);
Stimulus.register('turbo-input', TurboInputController);
// Expose globals
window.DS = window.DS || DS;