@mrfylke/contact-form 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ContactFormRoot.d.ts +37 -0
- package/lib/ContactFormRoot.d.ts.map +1 -0
- package/lib/ContactFormRoot.js +53 -0
- package/lib/commoneEvents.d.ts +16 -0
- package/lib/commoneEvents.d.ts.map +1 -0
- package/lib/commoneEvents.js +4 -0
- package/lib/components/button/button.d.ts +17 -0
- package/lib/components/button/button.d.ts.map +1 -0
- package/lib/components/button/button.js +15 -0
- package/lib/components/button/button.module.css +399 -0
- package/lib/components/button/index.d.ts +5 -0
- package/lib/components/button/index.d.ts.map +1 -0
- package/lib/components/button/index.js +10 -0
- package/lib/components/button/link.d.ts +27 -0
- package/lib/components/button/link.d.ts.map +1 -0
- package/lib/components/button/link.js +19 -0
- package/lib/components/button/utils.d.ts +69 -0
- package/lib/components/button/utils.d.ts.map +1 -0
- package/lib/components/button/utils.js +33 -0
- package/lib/components/checkbox/checkbox.d.ts +13 -0
- package/lib/components/checkbox/checkbox.d.ts.map +1 -0
- package/lib/components/checkbox/checkbox.js +23 -0
- package/lib/components/checkbox/checkbox.module.css +96 -0
- package/lib/components/checkbox/index.d.ts +3 -0
- package/lib/components/checkbox/index.d.ts.map +1 -0
- package/lib/components/checkbox/index.js +8 -0
- package/lib/components/error-message/error-message.d.ts +6 -0
- package/lib/components/error-message/error-message.d.ts.map +1 -0
- package/lib/components/error-message/error-message.js +13 -0
- package/lib/components/error-message/error-message.module.css +6 -0
- package/lib/components/error-message/index.d.ts +3 -0
- package/lib/components/error-message/index.d.ts.map +1 -0
- package/lib/components/error-message/index.js +8 -0
- package/lib/components/external-link-page.d.ts +14 -0
- package/lib/components/external-link-page.d.ts.map +1 -0
- package/lib/components/external-link-page.js +27 -0
- package/lib/components/external-link-page.module.css +29 -0
- package/lib/components/form/date-selector.d.ts +11 -0
- package/lib/components/form/date-selector.d.ts.map +1 -0
- package/lib/components/form/date-selector.js +21 -0
- package/lib/components/form/description-modal.d.ts +13 -0
- package/lib/components/form/description-modal.d.ts.map +1 -0
- package/lib/components/form/description-modal.js +43 -0
- package/lib/components/form/field-wrapper-with-error/index.d.ts +8 -0
- package/lib/components/form/field-wrapper-with-error/index.d.ts.map +1 -0
- package/lib/components/form/field-wrapper-with-error/index.js +12 -0
- package/lib/components/form/fieldset/fieldset.module.css +26 -0
- package/lib/components/form/fieldset/index.d.ts +8 -0
- package/lib/components/form/fieldset/index.d.ts.map +1 -0
- package/lib/components/form/fieldset/index.js +17 -0
- package/lib/components/form/file-input.d.ts +10 -0
- package/lib/components/form/file-input.d.ts.map +1 -0
- package/lib/components/form/file-input.js +68 -0
- package/lib/components/form/form-component-label/form-component-label.module.css +10 -0
- package/lib/components/form/form-component-label/index.d.ts +9 -0
- package/lib/components/form/form-component-label/index.d.ts.map +1 -0
- package/lib/components/form/form-component-label/index.js +18 -0
- package/lib/components/form/form.module.css +573 -0
- package/lib/components/form/index.d.ts +11 -0
- package/lib/components/form/index.d.ts.map +1 -0
- package/lib/components/form/index.js +28 -0
- package/lib/components/form/input.d.ts +17 -0
- package/lib/components/form/input.d.ts.map +1 -0
- package/lib/components/form/input.js +42 -0
- package/lib/components/form/radio.d.ts +7 -0
- package/lib/components/form/radio.d.ts.map +1 -0
- package/lib/components/form/radio.js +14 -0
- package/lib/components/form/searchable-select/index.d.ts +3 -0
- package/lib/components/form/searchable-select/index.d.ts.map +1 -0
- package/lib/components/form/searchable-select/index.js +11 -0
- package/lib/components/form/searchable-select/searchable-select.d.ts +18 -0
- package/lib/components/form/searchable-select/searchable-select.d.ts.map +1 -0
- package/lib/components/form/searchable-select/searchable-select.js +55 -0
- package/lib/components/form/searchable-select/utils.d.ts +5 -0
- package/lib/components/form/searchable-select/utils.d.ts.map +1 -0
- package/lib/components/form/searchable-select/utils.js +19 -0
- package/lib/components/form/select.d.ts +15 -0
- package/lib/components/form/select.d.ts.map +1 -0
- package/lib/components/form/select.js +22 -0
- package/lib/components/form/textarea.d.ts +11 -0
- package/lib/components/form/textarea.d.ts.map +1 -0
- package/lib/components/form/textarea.js +17 -0
- package/lib/components/form/time-selector.d.ts +11 -0
- package/lib/components/form/time-selector.d.ts.map +1 -0
- package/lib/components/form/time-selector.js +22 -0
- package/lib/components/icon/checkbox-icon.d.ts +14 -0
- package/lib/components/icon/checkbox-icon.d.ts.map +1 -0
- package/lib/components/icon/checkbox-icon.js +18 -0
- package/lib/components/icon/color-icon.d.ts +17 -0
- package/lib/components/icon/color-icon.d.ts.map +1 -0
- package/lib/components/icon/color-icon.js +27 -0
- package/lib/components/icon/generated-icons.d.ts +1797 -0
- package/lib/components/icon/generated-icons.d.ts.map +1 -0
- package/lib/components/icon/generated-icons.js +1782 -0
- package/lib/components/icon/icon-wrapper.d.ts +30 -0
- package/lib/components/icon/icon-wrapper.d.ts.map +1 -0
- package/lib/components/icon/icon-wrapper.js +39 -0
- package/lib/components/icon/illustration.d.ts +7 -0
- package/lib/components/icon/illustration.d.ts.map +1 -0
- package/lib/components/icon/illustration.js +25 -0
- package/lib/components/icon/image.d.ts +7 -0
- package/lib/components/icon/image.d.ts.map +1 -0
- package/lib/components/icon/image.js +26 -0
- package/lib/components/icon/index.d.ts +6 -0
- package/lib/components/icon/index.d.ts.map +1 -0
- package/lib/components/icon/index.js +20 -0
- package/lib/components/icon/mono-icon-new.d.ts +32 -0
- package/lib/components/icon/mono-icon-new.d.ts.map +1 -0
- package/lib/components/icon/mono-icon-new.js +43 -0
- package/lib/components/icon/mono-icon.d.ts +29 -0
- package/lib/components/icon/mono-icon.d.ts.map +1 -0
- package/lib/components/icon/mono-icon.js +39 -0
- package/lib/components/icon/utils.d.ts +3 -0
- package/lib/components/icon/utils.d.ts.map +1 -0
- package/lib/components/icon/utils.js +12 -0
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +18 -0
- package/lib/components/loading/index.d.ts +15 -0
- package/lib/components/loading/index.d.ts.map +1 -0
- package/lib/components/loading/index.js +19 -0
- package/lib/components/loading/loading.module.css +17 -0
- package/lib/components/section-card/index.d.ts +2 -0
- package/lib/components/section-card/index.d.ts.map +1 -0
- package/lib/components/section-card/index.js +8 -0
- package/lib/components/section-card/section-card.d.ts +7 -0
- package/lib/components/section-card/section-card.d.ts.map +1 -0
- package/lib/components/section-card/section-card.js +14 -0
- package/lib/components/section-card/section-card.module.css +15 -0
- package/lib/components/typography/index.d.ts +19 -0
- package/lib/components/typography/index.d.ts.map +1 -0
- package/lib/components/typography/index.js +27 -0
- package/lib/components/typography/utils.d.ts +2 -0
- package/lib/components/typography/utils.d.ts.map +1 -0
- package/lib/components/typography/utils.js +4 -0
- package/lib/contact.module.css +76 -0
- package/lib/error-content/error-content.d.ts +2 -0
- package/lib/error-content/error-content.d.ts.map +1 -0
- package/lib/error-content/error-content.js +19 -0
- package/lib/error-content/error-content.module.css +11 -0
- package/lib/group-travel/index.d.ts +2 -0
- package/lib/group-travel/index.d.ts.map +1 -0
- package/lib/group-travel/index.js +15 -0
- package/lib/index.d.ts +25 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +73 -0
- package/lib/journey-info/events.d.ts +14 -0
- package/lib/journey-info/events.d.ts.map +1 -0
- package/lib/journey-info/events.js +5 -0
- package/lib/journey-info/index.d.ts +2 -0
- package/lib/journey-info/index.d.ts.map +1 -0
- package/lib/journey-info/index.js +66 -0
- package/lib/journey-info/journeyInfoStateMachine.d.ts +179 -0
- package/lib/journey-info/journeyInfoStateMachine.d.ts.map +1 -0
- package/lib/journey-info/journeyInfoStateMachine.js +160 -0
- package/lib/layouts/contact-form-container.d.ts +10 -0
- package/lib/layouts/contact-form-container.d.ts.map +1 -0
- package/lib/layouts/contact-form-container.js +12 -0
- package/lib/layouts/contact-form-footer.d.ts +5 -0
- package/lib/layouts/contact-form-footer.d.ts.map +1 -0
- package/lib/layouts/contact-form-footer.js +59 -0
- package/lib/layouts/contact-form-header.d.ts +9 -0
- package/lib/layouts/contact-form-header.d.ts.map +1 -0
- package/lib/layouts/contact-form-header.js +45 -0
- package/lib/layouts/contact-page-layout.d.ts +24 -0
- package/lib/layouts/contact-page-layout.d.ts.map +1 -0
- package/lib/layouts/contact-page-layout.js +104 -0
- package/lib/layouts/container.module.css +15 -0
- package/lib/layouts/footer.module.css +109 -0
- package/lib/layouts/header.module.css +39 -0
- package/lib/layouts/index.d.ts +3 -0
- package/lib/layouts/index.d.ts.map +1 -0
- package/lib/layouts/index.js +11 -0
- package/lib/layouts/layout.module.css +80 -0
- package/lib/lines/use-lines.d.ts +25 -0
- package/lib/lines/use-lines.d.ts.map +1 -0
- package/lib/lines/use-lines.js +77 -0
- package/lib/lost-property/index.d.ts +2 -0
- package/lib/lost-property/index.d.ts.map +1 -0
- package/lib/lost-property/index.js +11 -0
- package/lib/means-of-transport/events.d.ts +17 -0
- package/lib/means-of-transport/events.d.ts.map +1 -0
- package/lib/means-of-transport/events.js +5 -0
- package/lib/means-of-transport/forms/delayForm.d.ts +11 -0
- package/lib/means-of-transport/forms/delayForm.d.ts.map +1 -0
- package/lib/means-of-transport/forms/delayForm.js +88 -0
- package/lib/means-of-transport/forms/driverForm.d.ts +11 -0
- package/lib/means-of-transport/forms/driverForm.d.ts.map +1 -0
- package/lib/means-of-transport/forms/driverForm.js +88 -0
- package/lib/means-of-transport/forms/index.d.ts +7 -0
- package/lib/means-of-transport/forms/index.d.ts.map +1 -0
- package/lib/means-of-transport/forms/index.js +18 -0
- package/lib/means-of-transport/forms/injuryForm.d.ts +11 -0
- package/lib/means-of-transport/forms/injuryForm.d.ts.map +1 -0
- package/lib/means-of-transport/forms/injuryForm.js +88 -0
- package/lib/means-of-transport/forms/serviceOfferingForm.d.ts +11 -0
- package/lib/means-of-transport/forms/serviceOfferingForm.d.ts.map +1 -0
- package/lib/means-of-transport/forms/serviceOfferingForm.js +64 -0
- package/lib/means-of-transport/forms/stopForm.d.ts +11 -0
- package/lib/means-of-transport/forms/stopForm.d.ts.map +1 -0
- package/lib/means-of-transport/forms/stopForm.js +76 -0
- package/lib/means-of-transport/forms/transportationForm.d.ts +11 -0
- package/lib/means-of-transport/forms/transportationForm.d.ts.map +1 -0
- package/lib/means-of-transport/forms/transportationForm.js +88 -0
- package/lib/means-of-transport/index.d.ts +3 -0
- package/lib/means-of-transport/index.d.ts.map +1 -0
- package/lib/means-of-transport/index.js +47 -0
- package/lib/means-of-transport/means-of-transport-form-machine.d.ts +291 -0
- package/lib/means-of-transport/means-of-transport-form-machine.d.ts.map +1 -0
- package/lib/means-of-transport/means-of-transport-form-machine.js +287 -0
- package/lib/modules/api-browser/index.d.ts +8 -0
- package/lib/modules/api-browser/index.d.ts.map +1 -0
- package/lib/modules/api-browser/index.js +54 -0
- package/lib/modules/api-server/external-client.d.ts +22 -0
- package/lib/modules/api-server/external-client.d.ts.map +1 -0
- package/lib/modules/api-server/external-client.js +86 -0
- package/lib/modules/api-server/index.d.ts +9 -0
- package/lib/modules/api-server/index.d.ts.map +1 -0
- package/lib/modules/api-server/index.js +24 -0
- package/lib/modules/api-server/requesters/graphql-requester.d.ts +6 -0
- package/lib/modules/api-server/requesters/graphql-requester.d.ts.map +1 -0
- package/lib/modules/api-server/requesters/graphql-requester.js +63 -0
- package/lib/modules/api-server/requesters/http-requester.d.ts +3 -0
- package/lib/modules/api-server/requesters/http-requester.d.ts.map +1 -0
- package/lib/modules/api-server/requesters/http-requester.js +110 -0
- package/lib/modules/api-server/requesters/types.d.ts +37 -0
- package/lib/modules/api-server/requesters/types.d.ts.map +1 -0
- package/lib/modules/api-server/requesters/types.js +34 -0
- package/lib/modules/api-server/requesters/utils.d.ts +17 -0
- package/lib/modules/api-server/requesters/utils.d.ts.map +1 -0
- package/lib/modules/api-server/requesters/utils.js +75 -0
- package/lib/modules/config/context.d.ts +54 -0
- package/lib/modules/config/context.d.ts.map +1 -0
- package/lib/modules/config/context.js +112 -0
- package/lib/modules/config/index.d.ts +4 -0
- package/lib/modules/config/index.d.ts.map +1 -0
- package/lib/modules/config/index.js +19 -0
- package/lib/modules/config/theme-adapter.d.ts +20 -0
- package/lib/modules/config/theme-adapter.d.ts.map +1 -0
- package/lib/modules/config/theme-adapter.js +56 -0
- package/lib/modules/config/types.d.ts +348 -0
- package/lib/modules/config/types.d.ts.map +1 -0
- package/lib/modules/config/types.js +6 -0
- package/lib/modules/cookies/constants.d.ts +4 -0
- package/lib/modules/cookies/constants.d.ts.map +1 -0
- package/lib/modules/cookies/constants.js +6 -0
- package/lib/modules/cookies/cookies-context.d.ts +17 -0
- package/lib/modules/cookies/cookies-context.d.ts.map +1 -0
- package/lib/modules/cookies/cookies-context.js +61 -0
- package/lib/modules/cookies/index.d.ts +15 -0
- package/lib/modules/cookies/index.d.ts.map +1 -0
- package/lib/modules/cookies/index.js +22 -0
- package/lib/modules/firebase/analytics.d.ts +3 -0
- package/lib/modules/firebase/analytics.d.ts.map +1 -0
- package/lib/modules/firebase/analytics.js +40 -0
- package/lib/modules/firebase/firebase.d.ts +4 -0
- package/lib/modules/firebase/firebase.d.ts.map +1 -0
- package/lib/modules/firebase/firebase.js +19 -0
- package/lib/modules/firebase/index.d.ts +5 -0
- package/lib/modules/firebase/index.d.ts.map +1 -0
- package/lib/modules/firebase/index.js +25 -0
- package/lib/modules/firebase/preassigned-fare-products.d.ts +8 -0
- package/lib/modules/firebase/preassigned-fare-products.d.ts.map +1 -0
- package/lib/modules/firebase/preassigned-fare-products.js +35 -0
- package/lib/modules/firebase/tariff-zones.d.ts +17 -0
- package/lib/modules/firebase/tariff-zones.d.ts.map +1 -0
- package/lib/modules/firebase/tariff-zones.js +32 -0
- package/lib/modules/firebase/transport-mode-filter.d.ts +27 -0
- package/lib/modules/firebase/transport-mode-filter.d.ts.map +1 -0
- package/lib/modules/firebase/transport-mode-filter.js +27 -0
- package/lib/modules/firebase/types.d.ts +19 -0
- package/lib/modules/firebase/types.d.ts.map +1 -0
- package/lib/modules/firebase/types.js +15 -0
- package/lib/modules/graphql-types/index.d.ts +1998 -0
- package/lib/modules/graphql-types/index.d.ts.map +1 -0
- package/lib/modules/graphql-types/index.js +442 -0
- package/lib/modules/graphql-types/journeyplanner-types_v3.generated.d.ts +2419 -0
- package/lib/modules/graphql-types/journeyplanner-types_v3.generated.d.ts.map +1 -0
- package/lib/modules/graphql-types/journeyplanner-types_v3.generated.js +524 -0
- package/lib/modules/logging/index.d.ts +6 -0
- package/lib/modules/logging/index.d.ts.map +1 -0
- package/lib/modules/logging/index.js +13 -0
- package/lib/modules/logging/log-api-response.d.ts +15 -0
- package/lib/modules/logging/log-api-response.d.ts.map +1 -0
- package/lib/modules/logging/log-api-response.js +52 -0
- package/lib/modules/logging/log-page-access.d.ts +20 -0
- package/lib/modules/logging/log-page-access.d.ts.map +1 -0
- package/lib/modules/logging/log-page-access.js +60 -0
- package/lib/modules/logging/logger.d.ts +3 -0
- package/lib/modules/logging/logger.d.ts.map +1 -0
- package/lib/modules/logging/logger.js +32 -0
- package/lib/modules/logging/timer.d.ts +6 -0
- package/lib/modules/logging/timer.d.ts.map +1 -0
- package/lib/modules/logging/timer.js +13 -0
- package/lib/modules/logging/with-access-logging.d.ts +5 -0
- package/lib/modules/logging/with-access-logging.d.ts.map +1 -0
- package/lib/modules/logging/with-access-logging.js +20 -0
- package/lib/modules/org-data/compat-layer.d.ts +8 -0
- package/lib/modules/org-data/compat-layer.d.ts.map +1 -0
- package/lib/modules/org-data/compat-layer.js +8 -0
- package/lib/modules/org-data/index.d.ts +12 -0
- package/lib/modules/org-data/index.d.ts.map +1 -0
- package/lib/modules/org-data/index.js +27 -0
- package/lib/modules/theme/index.d.ts +3 -0
- package/lib/modules/theme/index.d.ts.map +1 -0
- package/lib/modules/theme/index.js +9 -0
- package/lib/modules/theme/theme-context.d.ts +43 -0
- package/lib/modules/theme/theme-context.d.ts.map +1 -0
- package/lib/modules/theme/theme-context.js +73 -0
- package/lib/modules/transport-mode/filter/filter.d.ts +9 -0
- package/lib/modules/transport-mode/filter/filter.d.ts.map +1 -0
- package/lib/modules/transport-mode/filter/filter.js +64 -0
- package/lib/modules/transport-mode/filter/filter.module.css +98 -0
- package/lib/modules/transport-mode/filter/index.d.ts +3 -0
- package/lib/modules/transport-mode/filter/index.d.ts.map +1 -0
- package/lib/modules/transport-mode/filter/index.js +11 -0
- package/lib/modules/transport-mode/filter/types.d.ts +2 -0
- package/lib/modules/transport-mode/filter/types.d.ts.map +1 -0
- package/lib/modules/transport-mode/filter/types.js +2 -0
- package/lib/modules/transport-mode/filter/utils.d.ts +9 -0
- package/lib/modules/transport-mode/filter/utils.d.ts.map +1 -0
- package/lib/modules/transport-mode/filter/utils.js +21 -0
- package/lib/modules/transport-mode/icon/icon.module.css +33 -0
- package/lib/modules/transport-mode/icon/index.d.ts +29 -0
- package/lib/modules/transport-mode/icon/index.d.ts.map +1 -0
- package/lib/modules/transport-mode/icon/index.js +116 -0
- package/lib/modules/transport-mode/icon/transport-icon-new.d.ts +28 -0
- package/lib/modules/transport-mode/icon/transport-icon-new.d.ts.map +1 -0
- package/lib/modules/transport-mode/icon/transport-icon-new.js +114 -0
- package/lib/modules/transport-mode/index.d.ts +5 -0
- package/lib/modules/transport-mode/index.d.ts.map +1 -0
- package/lib/modules/transport-mode/index.js +29 -0
- package/lib/modules/transport-mode/types.d.ts +10 -0
- package/lib/modules/transport-mode/types.d.ts.map +1 -0
- package/lib/modules/transport-mode/types.js +141 -0
- package/lib/modules/transport-mode/utils.d.ts +9 -0
- package/lib/modules/transport-mode/utils.d.ts.map +1 -0
- package/lib/modules/transport-mode/utils.js +53 -0
- package/lib/refund/events.d.ts +32 -0
- package/lib/refund/events.d.ts.map +1 -0
- package/lib/refund/events.js +5 -0
- package/lib/refund/forms/refund-and-travel-guarantee/index.d.ts +10 -0
- package/lib/refund/forms/refund-and-travel-guarantee/index.d.ts.map +1 -0
- package/lib/refund/forms/refund-and-travel-guarantee/index.js +37 -0
- package/lib/refund/forms/refund-and-travel-guarantee/refundCarForm.d.ts +11 -0
- package/lib/refund/forms/refund-and-travel-guarantee/refundCarForm.d.ts.map +1 -0
- package/lib/refund/forms/refund-and-travel-guarantee/refundCarForm.js +133 -0
- package/lib/refund/forms/refund-and-travel-guarantee/refundTaxiForm.d.ts +11 -0
- package/lib/refund/forms/refund-and-travel-guarantee/refundTaxiForm.d.ts.map +1 -0
- package/lib/refund/forms/refund-and-travel-guarantee/refundTaxiForm.js +133 -0
- package/lib/refund/forms/refund-ticket/appTicketRefund.d.ts +12 -0
- package/lib/refund/forms/refund-ticket/appTicketRefund.d.ts.map +1 -0
- package/lib/refund/forms/refund-ticket/appTicketRefund.js +82 -0
- package/lib/refund/forms/refund-ticket/index.d.ts +10 -0
- package/lib/refund/forms/refund-ticket/index.d.ts.map +1 -0
- package/lib/refund/forms/refund-ticket/index.js +38 -0
- package/lib/refund/forms/refund-ticket/otherTicketRefund.d.ts +11 -0
- package/lib/refund/forms/refund-ticket/otherTicketRefund.d.ts.map +1 -0
- package/lib/refund/forms/refund-ticket/otherTicketRefund.js +109 -0
- package/lib/refund/forms/residualValueOnTravelCard/index.d.ts +2 -0
- package/lib/refund/forms/residualValueOnTravelCard/index.d.ts.map +1 -0
- package/lib/refund/forms/residualValueOnTravelCard/index.js +19 -0
- package/lib/refund/index.d.ts +3 -0
- package/lib/refund/index.d.ts.map +1 -0
- package/lib/refund/index.js +50 -0
- package/lib/refund/refundFormMachine.d.ts +406 -0
- package/lib/refund/refundFormMachine.d.ts.map +1 -0
- package/lib/refund/refundFormMachine.js +404 -0
- package/lib/server/contact/index.d.ts +11 -0
- package/lib/server/contact/index.d.ts.map +1 -0
- package/lib/server/contact/index.js +47 -0
- package/lib/server/index.d.ts +9 -0
- package/lib/server/index.d.ts.map +1 -0
- package/lib/server/index.js +14 -0
- package/lib/server/journey-planner/authority.d.ts +26 -0
- package/lib/server/journey-planner/authority.d.ts.map +1 -0
- package/lib/server/journey-planner/authority.js +48 -0
- package/lib/server/journey-planner/entur-client.d.ts +7 -0
- package/lib/server/journey-planner/entur-client.d.ts.map +1 -0
- package/lib/server/journey-planner/entur-client.js +46 -0
- package/lib/server/journey-planner/index.d.ts +11 -0
- package/lib/server/journey-planner/index.d.ts.map +1 -0
- package/lib/server/journey-planner/index.js +63 -0
- package/lib/server/journey-planner/journey-gql/lines.generated.d.ts +25 -0
- package/lib/server/journey-planner/journey-gql/lines.generated.d.ts.map +1 -0
- package/lib/server/journey-planner/journey-gql/lines.generated.js +30 -0
- package/lib/server/journey-planner/validators.d.ts +25 -0
- package/lib/server/journey-planner/validators.d.ts.map +1 -0
- package/lib/server/journey-planner/validators.js +17 -0
- package/lib/server/types.d.ts +5 -0
- package/lib/server/types.d.ts.map +1 -0
- package/lib/server/types.js +2 -0
- package/lib/success-content/success-content.d.ts +2 -0
- package/lib/success-content/success-content.d.ts.map +1 -0
- package/lib/success-content/success-content.js +19 -0
- package/lib/success-content/success-content.module.css +11 -0
- package/lib/ticket-control/events.d.ts +16 -0
- package/lib/ticket-control/events.d.ts.map +1 -0
- package/lib/ticket-control/events.js +5 -0
- package/lib/ticket-control/forms/feeComplaintForm.d.ts +11 -0
- package/lib/ticket-control/forms/feeComplaintForm.d.ts.map +1 -0
- package/lib/ticket-control/forms/feeComplaintForm.js +130 -0
- package/lib/ticket-control/forms/feedbackForm.d.ts +11 -0
- package/lib/ticket-control/forms/feedbackForm.d.ts.map +1 -0
- package/lib/ticket-control/forms/feedbackForm.js +75 -0
- package/lib/ticket-control/forms/postponePayment.d.ts +11 -0
- package/lib/ticket-control/forms/postponePayment.d.ts.map +1 -0
- package/lib/ticket-control/forms/postponePayment.js +37 -0
- package/lib/ticket-control/index.d.ts +3 -0
- package/lib/ticket-control/index.d.ts.map +1 -0
- package/lib/ticket-control/index.js +53 -0
- package/lib/ticket-control/ticket-control-form-machine.d.ts +277 -0
- package/lib/ticket-control/ticket-control-form-machine.d.ts.map +1 -0
- package/lib/ticket-control/ticket-control-form-machine.js +262 -0
- package/lib/ticketing/events.d.ts +28 -0
- package/lib/ticketing/events.d.ts.map +1 -0
- package/lib/ticketing/events.js +5 -0
- package/lib/ticketing/forms/app/appAccountForm.d.ts +11 -0
- package/lib/ticketing/forms/app/appAccountForm.d.ts.map +1 -0
- package/lib/ticketing/forms/app/appAccountForm.js +51 -0
- package/lib/ticketing/forms/app/appTicketingForm.d.ts +11 -0
- package/lib/ticketing/forms/app/appTicketingForm.d.ts.map +1 -0
- package/lib/ticketing/forms/app/appTicketingForm.js +59 -0
- package/lib/ticketing/forms/app/appTravelSuggestionForm.d.ts +11 -0
- package/lib/ticketing/forms/app/appTravelSuggestionForm.d.ts.map +1 -0
- package/lib/ticketing/forms/app/appTravelSuggestionForm.js +41 -0
- package/lib/ticketing/forms/app/index.d.ts +10 -0
- package/lib/ticketing/forms/app/index.d.ts.map +1 -0
- package/lib/ticketing/forms/app/index.js +23 -0
- package/lib/ticketing/forms/priceAndTicketTypesForm.d.ts +11 -0
- package/lib/ticketing/forms/priceAndTicketTypesForm.d.ts.map +1 -0
- package/lib/ticketing/forms/priceAndTicketTypesForm.js +41 -0
- package/lib/ticketing/forms/travel-card/index.d.ts +10 -0
- package/lib/ticketing/forms/travel-card/index.d.ts.map +1 -0
- package/lib/ticketing/forms/travel-card/index.js +24 -0
- package/lib/ticketing/forms/travel-card/orderTravelCard.d.ts +3 -0
- package/lib/ticketing/forms/travel-card/orderTravelCard.d.ts.map +1 -0
- package/lib/ticketing/forms/travel-card/orderTravelCard.js +21 -0
- package/lib/ticketing/forms/travel-card/travelCardQuestionForm.d.ts +11 -0
- package/lib/ticketing/forms/travel-card/travelCardQuestionForm.d.ts.map +1 -0
- package/lib/ticketing/forms/travel-card/travelCardQuestionForm.js +52 -0
- package/lib/ticketing/forms/webshop/index.d.ts +10 -0
- package/lib/ticketing/forms/webshop/index.d.ts.map +1 -0
- package/lib/ticketing/forms/webshop/index.js +22 -0
- package/lib/ticketing/forms/webshop/webshopAccountForm.d.ts +11 -0
- package/lib/ticketing/forms/webshop/webshopAccountForm.d.ts.map +1 -0
- package/lib/ticketing/forms/webshop/webshopAccountForm.js +51 -0
- package/lib/ticketing/forms/webshop/webshopTicketingForm.d.ts +11 -0
- package/lib/ticketing/forms/webshop/webshopTicketingForm.d.ts.map +1 -0
- package/lib/ticketing/forms/webshop/webshopTicketingForm.js +58 -0
- package/lib/ticketing/index.d.ts +3 -0
- package/lib/ticketing/index.d.ts.map +1 -0
- package/lib/ticketing/index.js +52 -0
- package/lib/ticketing/ticketingStateMachine.d.ts +438 -0
- package/lib/ticketing/ticketingStateMachine.d.ts.map +1 -0
- package/lib/ticketing/ticketingStateMachine.js +435 -0
- package/lib/translations/__tests__/utils.test.d.ts +2 -0
- package/lib/translations/__tests__/utils.test.d.ts.map +1 -0
- package/lib/translations/__tests__/utils.test.js +35 -0
- package/lib/translations/common/index.d.ts +3 -0
- package/lib/translations/common/index.d.ts.map +1 -0
- package/lib/translations/common/index.js +7 -0
- package/lib/translations/common/layout.d.ts +8 -0
- package/lib/translations/common/layout.d.ts.map +1 -0
- package/lib/translations/common/layout.js +39 -0
- package/lib/translations/common/titles.d.ts +4 -0
- package/lib/translations/common/titles.d.ts.map +1 -0
- package/lib/translations/common/titles.js +25 -0
- package/lib/translations/commons.d.ts +21 -0
- package/lib/translations/commons.d.ts.map +1 -0
- package/lib/translations/commons.js +39 -0
- package/lib/translations/components/clear-button.d.ts +4 -0
- package/lib/translations/components/clear-button.d.ts.map +1 -0
- package/lib/translations/components/clear-button.js +7 -0
- package/lib/translations/components/departure-date-selector.d.ts +8 -0
- package/lib/translations/components/departure-date-selector.d.ts.map +1 -0
- package/lib/translations/components/departure-date-selector.js +11 -0
- package/lib/translations/components/departure-time.d.ts +8 -0
- package/lib/translations/components/departure-time.d.ts.map +1 -0
- package/lib/translations/components/departure-time.js +11 -0
- package/lib/translations/components/empty-search.d.ts +18 -0
- package/lib/translations/components/empty-search.d.ts.map +1 -0
- package/lib/translations/components/empty-search.js +21 -0
- package/lib/translations/components/geolocation-button.d.ts +10 -0
- package/lib/translations/components/geolocation-button.d.ts.map +1 -0
- package/lib/translations/components/geolocation-button.js +13 -0
- package/lib/translations/components/index.d.ts +14 -0
- package/lib/translations/components/index.d.ts.map +1 -0
- package/lib/translations/components/index.js +29 -0
- package/lib/translations/components/loading.d.ts +4 -0
- package/lib/translations/components/loading.d.ts.map +1 -0
- package/lib/translations/components/loading.js +7 -0
- package/lib/translations/components/map.d.ts +19 -0
- package/lib/translations/components/map.d.ts.map +1 -0
- package/lib/translations/components/map.js +22 -0
- package/lib/translations/components/search.d.ts +9 -0
- package/lib/translations/components/search.d.ts.map +1 -0
- package/lib/translations/components/search.js +12 -0
- package/lib/translations/components/swap-button.d.ts +4 -0
- package/lib/translations/components/swap-button.d.ts.map +1 -0
- package/lib/translations/components/swap-button.js +7 -0
- package/lib/translations/components/tab-link.d.ts +5 -0
- package/lib/translations/components/tab-link.d.ts.map +1 -0
- package/lib/translations/components/tab-link.js +8 -0
- package/lib/translations/components/transport-mode-filter.d.ts +6 -0
- package/lib/translations/components/transport-mode-filter.d.ts.map +1 -0
- package/lib/translations/components/transport-mode-filter.js +9 -0
- package/lib/translations/components/transport-mode.d.ts +3 -0
- package/lib/translations/components/transport-mode.d.ts.map +1 -0
- package/lib/translations/components/transport-mode.js +28 -0
- package/lib/translations/components/venue-icon.d.ts +9 -0
- package/lib/translations/components/venue-icon.d.ts.map +1 -0
- package/lib/translations/components/venue-icon.js +12 -0
- package/lib/translations/dictionary.d.ts +33 -0
- package/lib/translations/dictionary.d.ts.map +1 -0
- package/lib/translations/dictionary.js +59 -0
- package/lib/translations/index.d.ts +16 -0
- package/lib/translations/index.d.ts.map +1 -0
- package/lib/translations/index.js +65 -0
- package/lib/translations/json-to-override.d.ts +19 -0
- package/lib/translations/json-to-override.d.ts.map +1 -0
- package/lib/translations/json-to-override.js +61 -0
- package/lib/translations/language-context.d.ts +37 -0
- package/lib/translations/language-context.d.ts.map +1 -0
- package/lib/translations/language-context.js +98 -0
- package/lib/translations/load-org-translations.d.ts +19 -0
- package/lib/translations/load-org-translations.d.ts.map +1 -0
- package/lib/translations/load-org-translations.js +23 -0
- package/lib/translations/merge-overrides.d.ts +28 -0
- package/lib/translations/merge-overrides.d.ts.map +1 -0
- package/lib/translations/merge-overrides.js +126 -0
- package/lib/translations/modules/index.d.ts +4 -0
- package/lib/translations/modules/index.d.ts.map +1 -0
- package/lib/translations/modules/index.js +9 -0
- package/lib/translations/modules/layout.d.ts +73 -0
- package/lib/translations/modules/layout.d.ts.map +1 -0
- package/lib/translations/modules/layout.js +106 -0
- package/lib/translations/modules/search-time.d.ts +8 -0
- package/lib/translations/modules/search-time.d.ts.map +1 -0
- package/lib/translations/modules/search-time.js +11 -0
- package/lib/translations/modules/situation.d.ts +8 -0
- package/lib/translations/modules/situation.d.ts.map +1 -0
- package/lib/translations/modules/situation.js +11 -0
- package/lib/translations/pages/assistant.d.ts +2 -0
- package/lib/translations/pages/assistant.d.ts.map +1 -0
- package/lib/translations/pages/assistant.js +303 -0
- package/lib/translations/pages/contact.d.ts +589 -0
- package/lib/translations/pages/contact.d.ts.map +1 -0
- package/lib/translations/pages/contact.js +679 -0
- package/lib/translations/pages/departures.d.ts +64 -0
- package/lib/translations/pages/departures.d.ts.map +1 -0
- package/lib/translations/pages/departures.js +75 -0
- package/lib/translations/pages/error.d.ts +8 -0
- package/lib/translations/pages/error.d.ts.map +1 -0
- package/lib/translations/pages/error.js +11 -0
- package/lib/translations/pages/index.d.ts +4 -0
- package/lib/translations/pages/index.d.ts.map +1 -0
- package/lib/translations/pages/index.js +9 -0
- package/lib/translations/server/endpoints.d.ts +67 -0
- package/lib/translations/server/endpoints.d.ts.map +1 -0
- package/lib/translations/server/endpoints.js +146 -0
- package/lib/translations/server/index.d.ts +2 -0
- package/lib/translations/server/index.d.ts.map +1 -0
- package/lib/translations/server/index.js +5 -0
- package/lib/translations/translations-context.d.ts +10 -0
- package/lib/translations/translations-context.d.ts.map +1 -0
- package/lib/translations/translations-context.js +20 -0
- package/lib/translations/types.d.ts +41 -0
- package/lib/translations/types.d.ts.map +1 -0
- package/lib/translations/types.js +24 -0
- package/lib/translations/utils.d.ts +16 -0
- package/lib/translations/utils.d.ts.map +1 -0
- package/lib/translations/utils.js +56 -0
- package/lib/types/submit-payloads.d.ts +119 -0
- package/lib/types/submit-payloads.d.ts.map +1 -0
- package/lib/types/submit-payloads.js +7 -0
- package/lib/types.d.ts +20 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +12 -0
- package/lib/utils/color.d.ts +2 -0
- package/lib/utils/color.d.ts.map +1 -0
- package/lib/utils/color.js +50 -0
- package/lib/utils/css.d.ts +3 -0
- package/lib/utils/css.d.ts.map +1 -0
- package/lib/utils/css.js +15 -0
- package/lib/utils/date.d.ts +4 -0
- package/lib/utils/date.d.ts.map +1 -0
- package/lib/utils/date.js +21 -0
- package/lib/utils/enum-from-string.d.ts +4 -0
- package/lib/utils/enum-from-string.d.ts.map +1 -0
- package/lib/utils/enum-from-string.js +9 -0
- package/lib/utils/env.d.ts +10 -0
- package/lib/utils/env.d.ts.map +1 -0
- package/lib/utils/env.js +49 -0
- package/lib/utils/only-uniques.d.ts +3 -0
- package/lib/utils/only-uniques.d.ts.map +1 -0
- package/lib/utils/only-uniques.js +7 -0
- package/lib/utils/org-theme-definitions.d.ts +5 -0
- package/lib/utils/org-theme-definitions.d.ts.map +1 -0
- package/lib/utils/org-theme-definitions.js +13 -0
- package/lib/utils/presence.d.ts +2 -0
- package/lib/utils/presence.d.ts.map +1 -0
- package/lib/utils/presence.js +5 -0
- package/lib/utils/reference-data.d.ts +15 -0
- package/lib/utils/reference-data.d.ts.map +1 -0
- package/lib/utils/reference-data.js +15 -0
- package/lib/utils/use-client-width.d.ts +2 -0
- package/lib/utils/use-client-width.d.ts.map +1 -0
- package/lib/utils/use-client-width.js +18 -0
- package/lib/utils/use-debounce.d.ts +3 -0
- package/lib/utils/use-debounce.d.ts.map +1 -0
- package/lib/utils/use-debounce.js +14 -0
- package/lib/utils/use-interval.d.ts +2 -0
- package/lib/utils/use-interval.d.ts.map +1 -0
- package/lib/utils/use-interval.js +22 -0
- package/lib/utils/use-localstorage.d.ts +2 -0
- package/lib/utils/use-localstorage.d.ts.map +1 -0
- package/lib/utils/use-localstorage.js +40 -0
- package/lib/utils/use-now.d.ts +2 -0
- package/lib/utils/use-now.d.ts.map +1 -0
- package/lib/utils/use-now.js +13 -0
- package/lib/utils/user-media-query.d.ts +2 -0
- package/lib/utils/user-media-query.d.ts.map +1 -0
- package/lib/utils/user-media-query.js +36 -0
- package/lib/utils.d.ts +19 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/utils.js +126 -0
- package/lib/validation/commonInputValidator.d.ts +7 -0
- package/lib/validation/commonInputValidator.d.ts.map +1 -0
- package/lib/validation/commonInputValidator.js +28 -0
- package/lib/validation/index.d.ts +2 -0
- package/lib/validation/index.d.ts.map +1 -0
- package/lib/validation/index.js +8 -0
- package/lib/validation/validationRules.d.ts +11 -0
- package/lib/validation/validationRules.d.ts.map +1 -0
- package/lib/validation/validationRules.js +372 -0
- package/package.json +99 -0
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.refundStateMachine = exports.FormType = exports.RefundAndTravelGuarantee = exports.RefundTicketForm = exports.FormCategory = void 0;
|
|
4
|
+
exports.createRefundStateMachine = createRefundStateMachine;
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
const xstate_1 = require("xstate");
|
|
7
|
+
const validation_1 = require("../validation");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const events_1 = require("./events");
|
|
10
|
+
var FormCategory;
|
|
11
|
+
(function (FormCategory) {
|
|
12
|
+
FormCategory["RefundOfTicket"] = "refundOfTicket";
|
|
13
|
+
FormCategory["RefundAndTravelGuarantee"] = "refundAndTravelGuarantee";
|
|
14
|
+
FormCategory["ResidualValueOnTravelCard"] = "residualValueOnTravelCard";
|
|
15
|
+
})(FormCategory || (exports.FormCategory = FormCategory = {}));
|
|
16
|
+
var RefundTicketForm;
|
|
17
|
+
(function (RefundTicketForm) {
|
|
18
|
+
RefundTicketForm["AppTicketRefund"] = "appTicketRefund";
|
|
19
|
+
RefundTicketForm["OtherTicketRefund"] = "otherTicketRefund";
|
|
20
|
+
})(RefundTicketForm || (exports.RefundTicketForm = RefundTicketForm = {}));
|
|
21
|
+
var RefundAndTravelGuarantee;
|
|
22
|
+
(function (RefundAndTravelGuarantee) {
|
|
23
|
+
RefundAndTravelGuarantee["RefundTaxi"] = "refundTaxi";
|
|
24
|
+
RefundAndTravelGuarantee["RefundCar"] = "refundCar";
|
|
25
|
+
})(RefundAndTravelGuarantee || (exports.RefundAndTravelGuarantee = RefundAndTravelGuarantee = {}));
|
|
26
|
+
var FormType;
|
|
27
|
+
(function (FormType) {
|
|
28
|
+
FormType["RefundTaxi"] = "refundTaxi";
|
|
29
|
+
FormType["RefundCar"] = "refundCar";
|
|
30
|
+
FormType["AppTicketRefund"] = "appTicketRefund";
|
|
31
|
+
FormType["OtherTicketRefund"] = "otherTicketRefund";
|
|
32
|
+
FormType["ResidualValueOnTravelCard"] = "residualValueOnTravelCard";
|
|
33
|
+
})(FormType || (exports.FormType = FormType = {}));
|
|
34
|
+
const setFormTypeAndInitialContext = (context, formType) => {
|
|
35
|
+
return { ...context, formType: formType, errorMessages: {} };
|
|
36
|
+
};
|
|
37
|
+
const setInitialAgreementAndFormType = (context, isChecked) => {
|
|
38
|
+
return {
|
|
39
|
+
...context,
|
|
40
|
+
isInitialAgreementChecked: isChecked,
|
|
41
|
+
formType: undefined,
|
|
42
|
+
errorMessages: {},
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const setInputToValidate = (context) => {
|
|
46
|
+
const { formType, firstName, lastName, email, phoneNumber, address, postalCode, city, hasInternationalBankAccount, bankAccountNumber, IBAN, SWIFT, transportMode, line, fromStop, toStop, date, kilometersDriven, fromAddress, toAddress, plannedDepartureTime, reasonForTransportFailure, amount, attachments, customerNumber, orderId, ticketType, travelCardNumber, refundReason, purchasePlatform, } = context;
|
|
47
|
+
const commonFields = {
|
|
48
|
+
formType,
|
|
49
|
+
transportMode,
|
|
50
|
+
line,
|
|
51
|
+
fromStop,
|
|
52
|
+
toStop,
|
|
53
|
+
date,
|
|
54
|
+
plannedDepartureTime,
|
|
55
|
+
reasonForTransportFailure,
|
|
56
|
+
firstName,
|
|
57
|
+
lastName,
|
|
58
|
+
email,
|
|
59
|
+
address,
|
|
60
|
+
postalCode,
|
|
61
|
+
city,
|
|
62
|
+
phoneNumber,
|
|
63
|
+
...(hasInternationalBankAccount ? { IBAN, SWIFT } : { bankAccountNumber }),
|
|
64
|
+
};
|
|
65
|
+
switch (formType) {
|
|
66
|
+
case FormType.RefundTaxi:
|
|
67
|
+
return { ...commonFields, attachments, amount };
|
|
68
|
+
case FormType.RefundCar:
|
|
69
|
+
return { ...commonFields, kilometersDriven, fromAddress, toAddress };
|
|
70
|
+
case FormType.AppTicketRefund:
|
|
71
|
+
return {
|
|
72
|
+
formType,
|
|
73
|
+
customerNumber,
|
|
74
|
+
orderId,
|
|
75
|
+
refundReason,
|
|
76
|
+
purchasePlatform,
|
|
77
|
+
firstName,
|
|
78
|
+
lastName,
|
|
79
|
+
address,
|
|
80
|
+
postalCode,
|
|
81
|
+
city,
|
|
82
|
+
email,
|
|
83
|
+
phoneNumber,
|
|
84
|
+
};
|
|
85
|
+
case FormType.OtherTicketRefund:
|
|
86
|
+
return {
|
|
87
|
+
formType,
|
|
88
|
+
ticketType,
|
|
89
|
+
refundReason,
|
|
90
|
+
amount,
|
|
91
|
+
firstName,
|
|
92
|
+
lastName,
|
|
93
|
+
address,
|
|
94
|
+
postalCode,
|
|
95
|
+
city,
|
|
96
|
+
email,
|
|
97
|
+
phoneNumber,
|
|
98
|
+
orderId,
|
|
99
|
+
attachments,
|
|
100
|
+
...(ticketType &&
|
|
101
|
+
ticketType.id === types_1.TicketTypeId.PeriodTicket && { travelCardNumber }),
|
|
102
|
+
...(hasInternationalBankAccount
|
|
103
|
+
? { IBAN, SWIFT }
|
|
104
|
+
: { bankAccountNumber }),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
function createRefundStateMachine(onSubmit, paths) {
|
|
109
|
+
const successPath = paths?.successPath ?? '/contact/success';
|
|
110
|
+
const errorPath = paths?.errorPath ?? '/contact/error';
|
|
111
|
+
return (0, xstate_1.setup)({
|
|
112
|
+
types: { context: {}, events: events_1.RefundFormEvents },
|
|
113
|
+
guards: {
|
|
114
|
+
isFormValid: ({ context }) => {
|
|
115
|
+
const inputsToValidate = setInputToValidate(context);
|
|
116
|
+
const errors = (0, validation_1.commonInputValidator)(inputsToValidate);
|
|
117
|
+
return Object.keys(errors).length === 0;
|
|
118
|
+
},
|
|
119
|
+
isRefundOfTicket: ({ event }) => event.type === 'SELECT_FORM_CATEGORY' &&
|
|
120
|
+
event.formCategory === FormCategory.RefundOfTicket,
|
|
121
|
+
isRefundAndTravelGuarantee: ({ event }) => event.type === 'SELECT_FORM_CATEGORY' &&
|
|
122
|
+
event.formCategory === FormCategory.RefundAndTravelGuarantee,
|
|
123
|
+
isResidualValueOnTravelCard: ({ event }) => event.type === 'SELECT_FORM_CATEGORY' &&
|
|
124
|
+
event.formCategory === FormCategory.ResidualValueOnTravelCard,
|
|
125
|
+
isAppTicketRefund: ({ event }) => event.type === 'SELECT_REFUND_TICKET_FORM' &&
|
|
126
|
+
event.refundTicketForm === RefundTicketForm.AppTicketRefund,
|
|
127
|
+
isOtherTicketRefund: ({ event }) => event.type === 'SELECT_REFUND_TICKET_FORM' &&
|
|
128
|
+
event.refundTicketForm === RefundTicketForm.OtherTicketRefund,
|
|
129
|
+
isRefundCar: ({ event }) => event.type === 'SELECT_REFUND_AND_TRAVEL_GUARANTEE_FORM' &&
|
|
130
|
+
event.refundAndTravelGuarantee === RefundAndTravelGuarantee.RefundCar,
|
|
131
|
+
isRefundTaxi: ({ event }) => event.type === 'SELECT_REFUND_AND_TRAVEL_GUARANTEE_FORM' &&
|
|
132
|
+
event.refundAndTravelGuarantee === RefundAndTravelGuarantee.RefundTaxi,
|
|
133
|
+
},
|
|
134
|
+
actions: {
|
|
135
|
+
navigateToErrorPage: () => {
|
|
136
|
+
window.location.href = errorPath;
|
|
137
|
+
},
|
|
138
|
+
navigateToSuccessPage: () => {
|
|
139
|
+
window.location.href = successPath;
|
|
140
|
+
},
|
|
141
|
+
setFormTypeToUndefined: (0, xstate_1.assign)({ formType: () => undefined }),
|
|
142
|
+
setInitialAgreementAndFormType: (0, xstate_1.assign)(({ context }) => {
|
|
143
|
+
return setInitialAgreementAndFormType(context, false);
|
|
144
|
+
}),
|
|
145
|
+
clearValidationErrors: (0, xstate_1.assign)({ errorMessages: {} }),
|
|
146
|
+
setValidationErrors: (0, xstate_1.assign)(({ context, event }) => {
|
|
147
|
+
if (event.type === 'SUBMIT') {
|
|
148
|
+
const inputsToValidate = setInputToValidate(context);
|
|
149
|
+
const errors = (0, validation_1.commonInputValidator)(inputsToValidate);
|
|
150
|
+
return {
|
|
151
|
+
firstIncorrectErrorMessage: (0, utils_1.findFirstErrorMessage)(event.orderedFormFieldNames, errors),
|
|
152
|
+
errorMessages: { ...errors },
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
return context;
|
|
156
|
+
}),
|
|
157
|
+
scrollToFirstErrorMessage: (0, xstate_1.assign)(({ context }) => {
|
|
158
|
+
(0, utils_1.scrollToFirstErrorMessage)(context.firstIncorrectErrorMessage);
|
|
159
|
+
return context;
|
|
160
|
+
}),
|
|
161
|
+
setSubmissionError: (0, xstate_1.assign)({
|
|
162
|
+
hasSubmissionError: () => true,
|
|
163
|
+
}),
|
|
164
|
+
clearSubmissionError: (0, xstate_1.assign)({
|
|
165
|
+
hasSubmissionError: () => undefined,
|
|
166
|
+
}),
|
|
167
|
+
onInputChange: (0, xstate_1.assign)(({ context, event }) => {
|
|
168
|
+
if (event.type === 'ON_INPUT_CHANGE') {
|
|
169
|
+
let { inputName, value } = event;
|
|
170
|
+
if (inputName === 'formType') {
|
|
171
|
+
const updatedContext = setFormTypeAndInitialContext(context, value);
|
|
172
|
+
return {
|
|
173
|
+
...updatedContext,
|
|
174
|
+
hasSubmissionError: undefined,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
if (inputName === 'isInitialAgreementChecked') {
|
|
178
|
+
const updatedContext = setInitialAgreementAndFormType(context, value);
|
|
179
|
+
return {
|
|
180
|
+
...updatedContext,
|
|
181
|
+
hasSubmissionError: undefined,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
if (inputName === 'hasInternationalBankAccount') {
|
|
185
|
+
const updatedContext = (0, utils_1.setBankAccountStatusAndResetBankInformation)(context, value);
|
|
186
|
+
return {
|
|
187
|
+
...updatedContext,
|
|
188
|
+
hasSubmissionError: undefined,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
context.errorMessages[inputName] = [];
|
|
192
|
+
return { ...context, [inputName]: value, hasSubmissionError: undefined };
|
|
193
|
+
}
|
|
194
|
+
return context;
|
|
195
|
+
}),
|
|
196
|
+
onTransportModeChange: (0, xstate_1.assign)(({ context, event }) => {
|
|
197
|
+
if (event.type === 'ON_TRANSPORTMODE_CHANGE')
|
|
198
|
+
return (0, utils_1.setTransportModeAndResetLineAndStops)(context, event.value);
|
|
199
|
+
return context;
|
|
200
|
+
}),
|
|
201
|
+
onLineChange: (0, xstate_1.assign)(({ context, event }) => {
|
|
202
|
+
if (event.type === 'ON_LINE_CHANGE')
|
|
203
|
+
return (0, utils_1.setLineAndResetStops)(context, event.value);
|
|
204
|
+
return context;
|
|
205
|
+
}),
|
|
206
|
+
onPurchasePlatformChange: (0, xstate_1.assign)(({ context, event }) => {
|
|
207
|
+
if (event.type === 'ON_PURCHASE_PLATFORM_CHANGE')
|
|
208
|
+
return {
|
|
209
|
+
...context,
|
|
210
|
+
purchasePlatform: event.value,
|
|
211
|
+
errorMessages: { ...context.errorMessages },
|
|
212
|
+
};
|
|
213
|
+
return context;
|
|
214
|
+
}),
|
|
215
|
+
},
|
|
216
|
+
actors: {
|
|
217
|
+
submit: (0, xstate_1.fromPromise)(async ({ input }) => {
|
|
218
|
+
const base64EncodedAttachments = await (0, utils_1.convertFilesToBase64)(input.attachments || []);
|
|
219
|
+
const state = {
|
|
220
|
+
...input,
|
|
221
|
+
attachments: base64EncodedAttachments,
|
|
222
|
+
};
|
|
223
|
+
const response = await onSubmit('refund', state);
|
|
224
|
+
if (!response.ok)
|
|
225
|
+
throw new Error('Failed to call API');
|
|
226
|
+
return response.ok;
|
|
227
|
+
}),
|
|
228
|
+
},
|
|
229
|
+
}).createMachine({
|
|
230
|
+
id: 'refundStateMachine',
|
|
231
|
+
initial: 'editing',
|
|
232
|
+
context: {
|
|
233
|
+
isInitialAgreementChecked: false,
|
|
234
|
+
hasInternationalBankAccount: false,
|
|
235
|
+
errorMessages: {},
|
|
236
|
+
},
|
|
237
|
+
on: {
|
|
238
|
+
ON_INPUT_CHANGE: { actions: 'onInputChange' },
|
|
239
|
+
ON_TRANSPORTMODE_CHANGE: { actions: 'onTransportModeChange' },
|
|
240
|
+
ON_LINE_CHANGE: { actions: 'onLineChange' },
|
|
241
|
+
ON_PURCHASE_PLATFORM_CHANGE: { actions: 'onPurchasePlatformChange' },
|
|
242
|
+
SELECT_FORM_CATEGORY: { target: '#formCategoryHandler' },
|
|
243
|
+
SELECT_REFUND_TICKET_FORM: { target: '#refundTicketFormHandler' },
|
|
244
|
+
SELECT_REFUND_AND_TRAVEL_GUARANTEE_FORM: {
|
|
245
|
+
target: '#refundAndTravelGuaranteeFormHandler',
|
|
246
|
+
},
|
|
247
|
+
SUBMIT: { target: '#validating' },
|
|
248
|
+
},
|
|
249
|
+
states: {
|
|
250
|
+
formCategoryHandler: {
|
|
251
|
+
id: 'formCategoryHandler',
|
|
252
|
+
entry: 'setInitialAgreementAndFormType',
|
|
253
|
+
always: [
|
|
254
|
+
{
|
|
255
|
+
guard: 'isRefundOfTicket',
|
|
256
|
+
target: `#${FormCategory.RefundOfTicket}`,
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
guard: 'isRefundAndTravelGuarantee',
|
|
260
|
+
target: `#${FormCategory.RefundAndTravelGuarantee}`,
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
guard: 'isResidualValueOnTravelCard',
|
|
264
|
+
target: `#${FormCategory.ResidualValueOnTravelCard}`,
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
},
|
|
268
|
+
refundTicketFormHandler: {
|
|
269
|
+
id: 'refundTicketFormHandler',
|
|
270
|
+
always: [
|
|
271
|
+
{
|
|
272
|
+
guard: 'isAppTicketRefund',
|
|
273
|
+
target: `#${RefundTicketForm.AppTicketRefund}`,
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
guard: 'isOtherTicketRefund',
|
|
277
|
+
target: `#${RefundTicketForm.OtherTicketRefund}`,
|
|
278
|
+
},
|
|
279
|
+
],
|
|
280
|
+
},
|
|
281
|
+
refundAndTravelGuaranteeFormHandler: {
|
|
282
|
+
id: 'refundAndTravelGuaranteeFormHandler',
|
|
283
|
+
always: [
|
|
284
|
+
{
|
|
285
|
+
guard: 'isRefundCar',
|
|
286
|
+
target: `#${RefundAndTravelGuarantee.RefundCar}`,
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
guard: 'isRefundTaxi',
|
|
290
|
+
target: `#${RefundAndTravelGuarantee.RefundTaxi}`,
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
},
|
|
294
|
+
editing: {
|
|
295
|
+
initial: 'selectFormCategory',
|
|
296
|
+
states: {
|
|
297
|
+
selectFormCategory: {},
|
|
298
|
+
refundOfTicket: {
|
|
299
|
+
id: 'refundOfTicket',
|
|
300
|
+
initial: 'selectRefundOfTicketForm',
|
|
301
|
+
entry: 'setFormTypeToUndefined',
|
|
302
|
+
exit: 'clearValidationErrors',
|
|
303
|
+
states: {
|
|
304
|
+
selectRefundOfTicketForm: {},
|
|
305
|
+
appTicketRefund: {
|
|
306
|
+
id: 'appTicketRefund',
|
|
307
|
+
entry: (0, xstate_1.assign)({ formType: () => FormType.AppTicketRefund }),
|
|
308
|
+
exit: 'clearValidationErrors',
|
|
309
|
+
},
|
|
310
|
+
otherTicketRefund: {
|
|
311
|
+
id: 'otherTicketRefund',
|
|
312
|
+
entry: (0, xstate_1.assign)({ formType: () => FormType.OtherTicketRefund }),
|
|
313
|
+
exit: 'clearValidationErrors',
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
refundAndTravelGuarantee: {
|
|
318
|
+
id: 'refundAndTravelGuarantee',
|
|
319
|
+
initial: 'selectRefundAndTravelGuaranteeForm',
|
|
320
|
+
entry: 'setFormTypeToUndefined',
|
|
321
|
+
exit: 'clearValidationErrors',
|
|
322
|
+
states: {
|
|
323
|
+
selectRefundAndTravelGuaranteeForm: {},
|
|
324
|
+
refundCar: {
|
|
325
|
+
id: 'refundCar',
|
|
326
|
+
entry: (0, xstate_1.assign)({ formType: () => FormType.RefundCar }),
|
|
327
|
+
exit: 'clearValidationErrors',
|
|
328
|
+
},
|
|
329
|
+
refundTaxi: {
|
|
330
|
+
id: 'refundTaxi',
|
|
331
|
+
entry: (0, xstate_1.assign)({ formType: () => FormType.RefundTaxi }),
|
|
332
|
+
exit: 'clearValidationErrors',
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
residualValueOnTravelCard: {
|
|
337
|
+
id: 'residualValueOnTravelCard',
|
|
338
|
+
entry: (0, xstate_1.assign)({ formType: () => FormType.ResidualValueOnTravelCard }),
|
|
339
|
+
},
|
|
340
|
+
history: { type: 'history', history: 'deep' },
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
validating: {
|
|
344
|
+
id: 'validating',
|
|
345
|
+
always: [
|
|
346
|
+
{ guard: 'isFormValid', target: '#submitting' },
|
|
347
|
+
{
|
|
348
|
+
actions: ['setValidationErrors', 'scrollToFirstErrorMessage'],
|
|
349
|
+
target: 'editing.history',
|
|
350
|
+
},
|
|
351
|
+
],
|
|
352
|
+
},
|
|
353
|
+
submitting: {
|
|
354
|
+
id: 'submitting',
|
|
355
|
+
invoke: {
|
|
356
|
+
src: 'submit',
|
|
357
|
+
input: ({ context }) => ({
|
|
358
|
+
transportMode: context?.transportMode,
|
|
359
|
+
line: (0, utils_1.getLineName)(context.line),
|
|
360
|
+
fromStop: context.fromStop?.name,
|
|
361
|
+
toStop: context.toStop?.name,
|
|
362
|
+
date: context?.date,
|
|
363
|
+
plannedDepartureTime: context?.plannedDepartureTime,
|
|
364
|
+
kilometersDriven: context?.kilometersDriven,
|
|
365
|
+
fromAddress: context?.fromAddress,
|
|
366
|
+
toAddress: context?.toAddress,
|
|
367
|
+
reasonForTransportFailure: context?.reasonForTransportFailure?.name.no,
|
|
368
|
+
additionalInfo: context?.feedback,
|
|
369
|
+
attachments: context.attachments,
|
|
370
|
+
firstName: context?.firstName,
|
|
371
|
+
lastName: context?.lastName,
|
|
372
|
+
address: context?.address,
|
|
373
|
+
postalCode: context?.postalCode,
|
|
374
|
+
city: context?.city,
|
|
375
|
+
email: context?.email,
|
|
376
|
+
phoneNumber: context?.phoneNumber,
|
|
377
|
+
bankAccountNumber: context?.bankAccountNumber,
|
|
378
|
+
IBAN: context?.IBAN,
|
|
379
|
+
SWIFT: context?.SWIFT,
|
|
380
|
+
amount: context?.amount,
|
|
381
|
+
customerNumber: context?.customerNumber,
|
|
382
|
+
orderId: context?.orderId,
|
|
383
|
+
ticketType: context?.ticketType?.name.no,
|
|
384
|
+
travelCardNumber: context?.travelCardNumber,
|
|
385
|
+
refundReason: context?.refundReason,
|
|
386
|
+
purchasePlatform: context?.purchasePlatform,
|
|
387
|
+
}),
|
|
388
|
+
onDone: { target: 'success' },
|
|
389
|
+
onError: {
|
|
390
|
+
target: 'editing.history',
|
|
391
|
+
actions: 'setSubmissionError',
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
success: { entry: 'navigateToSuccessPage', type: 'final' },
|
|
396
|
+
},
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
exports.refundStateMachine = createRefundStateMachine(async (data) => {
|
|
400
|
+
return fetch('/api/contact/refund', {
|
|
401
|
+
method: 'POST',
|
|
402
|
+
body: JSON.stringify(data),
|
|
403
|
+
});
|
|
404
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HttpRequester } from '../../modules/api-server';
|
|
2
|
+
import { ContactApiReturnType } from '../types';
|
|
3
|
+
export type ContactApi = {
|
|
4
|
+
submitTicketControlForm(formData: any): Promise<ContactApiReturnType>;
|
|
5
|
+
submitRefundForm(formData: any): Promise<ContactApiReturnType>;
|
|
6
|
+
submitMeansOfTransportForm(formData: any): Promise<ContactApiReturnType>;
|
|
7
|
+
submitTicketingForm(formData: any): Promise<ContactApiReturnType>;
|
|
8
|
+
submitJourneyInfoForm(formData: any): Promise<ContactApiReturnType>;
|
|
9
|
+
};
|
|
10
|
+
export declare function createContactApi(request: HttpRequester<'http-contact-api'>): ContactApi;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/contact/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAC,oBAAoB,EAAC,MAAM,UAAU,CAAC;AAE9C,MAAM,MAAM,UAAU,GAAG;IACrB,uBAAuB,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACtE,gBAAgB,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC/D,0BAA0B,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACzE,mBAAmB,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAClE,qBAAqB,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACvE,CAAC;AAEF,wBAAgB,gBAAgB,CAC5B,OAAO,EAAE,aAAa,CAAC,kBAAkB,CAAC,GAC3C,UAAU,CA+CZ"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createContactApi = createContactApi;
|
|
4
|
+
function createContactApi(request) {
|
|
5
|
+
return {
|
|
6
|
+
async submitTicketControlForm(formData) {
|
|
7
|
+
const response = await request('/ticket-control', {
|
|
8
|
+
method: 'POST',
|
|
9
|
+
body: formData,
|
|
10
|
+
});
|
|
11
|
+
const data = await response.json();
|
|
12
|
+
return data;
|
|
13
|
+
},
|
|
14
|
+
async submitRefundForm(formData) {
|
|
15
|
+
const response = await request('/refund', {
|
|
16
|
+
method: 'POST',
|
|
17
|
+
body: formData,
|
|
18
|
+
});
|
|
19
|
+
const data = await response.json();
|
|
20
|
+
return data;
|
|
21
|
+
},
|
|
22
|
+
async submitMeansOfTransportForm(formData) {
|
|
23
|
+
const response = await request('/means-of-transport', {
|
|
24
|
+
method: 'POST',
|
|
25
|
+
body: formData,
|
|
26
|
+
});
|
|
27
|
+
const data = await response.json();
|
|
28
|
+
return data;
|
|
29
|
+
},
|
|
30
|
+
async submitTicketingForm(formData) {
|
|
31
|
+
const response = await request('/ticketing', {
|
|
32
|
+
method: 'POST',
|
|
33
|
+
body: formData,
|
|
34
|
+
});
|
|
35
|
+
const data = await response.json();
|
|
36
|
+
return data;
|
|
37
|
+
},
|
|
38
|
+
async submitJourneyInfoForm(formData) {
|
|
39
|
+
const response = await request('/journey-info', {
|
|
40
|
+
method: 'POST',
|
|
41
|
+
body: formData,
|
|
42
|
+
});
|
|
43
|
+
const data = await response.json();
|
|
44
|
+
return data;
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-side utilities for the contact-form package.
|
|
3
|
+
*
|
|
4
|
+
* This module provides server-side functions that can be used in Next.js
|
|
5
|
+
* API route handlers or server components.
|
|
6
|
+
*/
|
|
7
|
+
export { getLines } from './journey-planner';
|
|
8
|
+
export { getEnturAuthorityId, EnturAuthority } from './journey-planner/authority';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAC,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Server-side utilities for the contact-form package.
|
|
4
|
+
*
|
|
5
|
+
* This module provides server-side functions that can be used in Next.js
|
|
6
|
+
* API route handlers or server components.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.EnturAuthority = exports.getEnturAuthorityId = exports.getLines = void 0;
|
|
10
|
+
var journey_planner_1 = require("./journey-planner");
|
|
11
|
+
Object.defineProperty(exports, "getLines", { enumerable: true, get: function () { return journey_planner_1.getLines; } });
|
|
12
|
+
var authority_1 = require("./journey-planner/authority");
|
|
13
|
+
Object.defineProperty(exports, "getEnturAuthorityId", { enumerable: true, get: function () { return authority_1.getEnturAuthorityId; } });
|
|
14
|
+
Object.defineProperty(exports, "EnturAuthority", { enumerable: true, get: function () { return authority_1.EnturAuthority; } });
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entur Authority ID configuration
|
|
3
|
+
*
|
|
4
|
+
* The package reads the Entur authority ID from:
|
|
5
|
+
* 1. Environment variable: ENTUR_AUTHORITY_ID (or NEXT_PUBLIC_ENTUR_AUTHORITY_ID)
|
|
6
|
+
* 2. Fallback to org.authorityId from ContactFormConfig (if available)
|
|
7
|
+
*
|
|
8
|
+
* Host apps should set ENTUR_AUTHORITY_ID in their .env file.
|
|
9
|
+
*/
|
|
10
|
+
export declare enum EnturAuthority {
|
|
11
|
+
ATB = "ATB:Authority:2",
|
|
12
|
+
NFK = "NOR:Authority:12",
|
|
13
|
+
FRAM = "MOR:Authority:MOR",
|
|
14
|
+
VKT = "VKT:Authority:VKT_ID",
|
|
15
|
+
TROMS = "TRO:Authority:1",
|
|
16
|
+
FARTE = "TEL:Authority:TFK_ID"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get the Entur authority ID from environment variable or fallback.
|
|
20
|
+
*
|
|
21
|
+
* @param fallbackAuthorityId - Optional fallback from org config
|
|
22
|
+
* @returns The authority ID string
|
|
23
|
+
* @throws Error if neither env var nor fallback is provided
|
|
24
|
+
*/
|
|
25
|
+
export declare function getEnturAuthorityId(fallbackAuthorityId?: string): string;
|
|
26
|
+
//# sourceMappingURL=authority.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authority.d.ts","sourceRoot":"","sources":["../../../src/server/journey-planner/authority.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,oBAAY,cAAc;IACtB,GAAG,oBAAoB;IACvB,GAAG,qBAAqB;IACxB,IAAI,sBAAsB;IAC1B,GAAG,yBAAyB;IAC5B,KAAK,oBAAoB;IACzB,KAAK,yBAAyB;CACjC;AAID;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,MAAM,CAwBxE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Entur Authority ID configuration
|
|
4
|
+
*
|
|
5
|
+
* The package reads the Entur authority ID from:
|
|
6
|
+
* 1. Environment variable: ENTUR_AUTHORITY_ID (or NEXT_PUBLIC_ENTUR_AUTHORITY_ID)
|
|
7
|
+
* 2. Fallback to org.authorityId from ContactFormConfig (if available)
|
|
8
|
+
*
|
|
9
|
+
* Host apps should set ENTUR_AUTHORITY_ID in their .env file.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EnturAuthority = void 0;
|
|
13
|
+
exports.getEnturAuthorityId = getEnturAuthorityId;
|
|
14
|
+
var EnturAuthority;
|
|
15
|
+
(function (EnturAuthority) {
|
|
16
|
+
EnturAuthority["ATB"] = "ATB:Authority:2";
|
|
17
|
+
EnturAuthority["NFK"] = "NOR:Authority:12";
|
|
18
|
+
EnturAuthority["FRAM"] = "MOR:Authority:MOR";
|
|
19
|
+
EnturAuthority["VKT"] = "VKT:Authority:VKT_ID";
|
|
20
|
+
EnturAuthority["TROMS"] = "TRO:Authority:1";
|
|
21
|
+
EnturAuthority["FARTE"] = "TEL:Authority:TFK_ID";
|
|
22
|
+
})(EnturAuthority || (exports.EnturAuthority = EnturAuthority = {}));
|
|
23
|
+
let cachedAuthorityId = null;
|
|
24
|
+
/**
|
|
25
|
+
* Get the Entur authority ID from environment variable or fallback.
|
|
26
|
+
*
|
|
27
|
+
* @param fallbackAuthorityId - Optional fallback from org config
|
|
28
|
+
* @returns The authority ID string
|
|
29
|
+
* @throws Error if neither env var nor fallback is provided
|
|
30
|
+
*/
|
|
31
|
+
function getEnturAuthorityId(fallbackAuthorityId) {
|
|
32
|
+
if (cachedAuthorityId) {
|
|
33
|
+
return cachedAuthorityId;
|
|
34
|
+
}
|
|
35
|
+
const envAuthority = process.env.ENTUR_AUTHORITY_ID ||
|
|
36
|
+
process.env.NEXT_PUBLIC_ENTUR_AUTHORITY_ID;
|
|
37
|
+
if (envAuthority) {
|
|
38
|
+
cachedAuthorityId = envAuthority;
|
|
39
|
+
return envAuthority;
|
|
40
|
+
}
|
|
41
|
+
if (fallbackAuthorityId) {
|
|
42
|
+
cachedAuthorityId = fallbackAuthorityId;
|
|
43
|
+
return fallbackAuthorityId;
|
|
44
|
+
}
|
|
45
|
+
throw new Error('ENTUR_AUTHORITY_ID environment variable must be set. ' +
|
|
46
|
+
'Set it in your .env file (e.g., ENTUR_AUTHORITY_ID=ATB:Authority:2) ' +
|
|
47
|
+
'or provide org.authorityId in ContactFormConfig.');
|
|
48
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ApolloClient } from '@apollo/client/core';
|
|
2
|
+
/**
|
|
3
|
+
* Get or create the Entur GraphQL client instance.
|
|
4
|
+
* This is a singleton that can be reused across requests.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getEnturClient(): ApolloClient<any>;
|
|
7
|
+
//# sourceMappingURL=entur-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entur-client.d.ts","sourceRoot":"","sources":["../../../src/server/journey-planner/entur-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAuC,MAAM,qBAAqB,CAAC;AAqBvF;;;GAGG;AACH,wBAAgB,cAAc,IAAI,YAAY,CAAC,GAAG,CAAC,CA2BlD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEnturClient = getEnturClient;
|
|
4
|
+
const cache_1 = require("@apollo/client/cache");
|
|
5
|
+
const core_1 = require("@apollo/client/core");
|
|
6
|
+
const error_1 = require("@apollo/client/link/error");
|
|
7
|
+
const defaultOptions = {
|
|
8
|
+
watchQuery: {
|
|
9
|
+
fetchPolicy: 'no-cache',
|
|
10
|
+
errorPolicy: 'ignore',
|
|
11
|
+
},
|
|
12
|
+
query: {
|
|
13
|
+
fetchPolicy: 'no-cache',
|
|
14
|
+
errorPolicy: 'all',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const ENTUR_GRAPHQL_URL = `${process.env.ENTUR_BASE_URL ?? 'https://api.entur.io'}/journey-planner/v3/graphql`;
|
|
18
|
+
const cache = new cache_1.InMemoryCache();
|
|
19
|
+
let clientInstance = null;
|
|
20
|
+
/**
|
|
21
|
+
* Get or create the Entur GraphQL client instance.
|
|
22
|
+
* This is a singleton that can be reused across requests.
|
|
23
|
+
*/
|
|
24
|
+
function getEnturClient() {
|
|
25
|
+
if (clientInstance) {
|
|
26
|
+
return clientInstance;
|
|
27
|
+
}
|
|
28
|
+
const httpLink = new core_1.HttpLink({
|
|
29
|
+
uri: ENTUR_GRAPHQL_URL,
|
|
30
|
+
headers: {
|
|
31
|
+
'ET-Client-Name': 'contact-form-web',
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
const errorLink = (0, error_1.onError)((error) => {
|
|
35
|
+
if (process.env.NODE_ENV === 'development') {
|
|
36
|
+
console.error('Entur GraphQL Error:', JSON.stringify(error));
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const link = core_1.ApolloLink.from([errorLink, httpLink]);
|
|
40
|
+
clientInstance = new core_1.ApolloClient({
|
|
41
|
+
link,
|
|
42
|
+
cache,
|
|
43
|
+
defaultOptions,
|
|
44
|
+
});
|
|
45
|
+
return clientInstance;
|
|
46
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Line } from './validators';
|
|
2
|
+
/**
|
|
3
|
+
* Fetch lines from Entur for the configured authority.
|
|
4
|
+
* The authority ID is read from ENTUR_AUTHORITY_ID environment variable
|
|
5
|
+
* or from the provided fallback.
|
|
6
|
+
*
|
|
7
|
+
* @param fallbackAuthorityId - Optional fallback authority ID from org config
|
|
8
|
+
* @returns Array of Line objects
|
|
9
|
+
*/
|
|
10
|
+
export declare function getLines(fallbackAuthorityId?: string): Promise<Line[]>;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/journey-planner/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,IAAI,EAAc,MAAM,cAAc,CAAC;AAgB/C;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAmD5E"}
|