@mrfylke/contact-form 0.1.10 → 0.1.21
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/README.md +393 -2
- package/lib/ContactFormRoot.d.ts +11 -1
- package/lib/ContactFormRoot.d.ts.map +1 -1
- package/lib/ContactFormRoot.js +2 -2
- package/lib/commoneEvents.d.ts +1 -1
- package/lib/commoneEvents.d.ts.map +1 -1
- package/lib/components/form/date-selector.d.ts.map +1 -1
- package/lib/components/form/date-selector.js +5 -4
- package/lib/components/form/departure-time-field.d.ts +16 -0
- package/lib/components/form/departure-time-field.d.ts.map +1 -0
- package/lib/components/form/departure-time-field.js +28 -0
- package/lib/components/form/description-modal.d.ts.map +1 -1
- package/lib/components/form/description-modal.js +2 -1
- package/lib/components/form/file-input.d.ts.map +1 -1
- package/lib/components/form/file-input.js +2 -1
- package/lib/components/form/index.d.ts +1 -0
- package/lib/components/form/index.d.ts.map +1 -1
- package/lib/components/form/index.js +3 -1
- package/lib/components/form/input.d.ts.map +1 -1
- package/lib/components/form/input.js +2 -1
- package/lib/components/form/searchable-select/utils.js +6 -1
- package/lib/components/index.d.ts +1 -1
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +2 -1
- package/lib/contact.module.css +9 -0
- package/lib/error-content/error-content.d.ts.map +1 -1
- package/lib/error-content/error-content.js +2 -1
- package/lib/group-travel/index.d.ts.map +1 -1
- package/lib/group-travel/index.js +3 -1
- package/lib/index.d.ts +16 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +41 -1
- package/lib/journey-info/index.d.ts.map +1 -1
- package/lib/journey-info/index.js +14 -8
- package/lib/journey-info/journeyInfoStateMachine.d.ts +8 -8
- package/lib/layouts/contact-page-layout.d.ts +2 -2
- package/lib/layouts/contact-page-layout.d.ts.map +1 -1
- package/lib/layouts/contact-page-layout.js +29 -20
- package/lib/layouts/container.module.css +1 -1
- package/lib/layouts/layout.module.css +23 -2
- package/lib/lines/use-departures.d.ts +12 -0
- package/lib/lines/use-departures.d.ts.map +1 -0
- package/lib/lines/use-departures.js +35 -0
- package/lib/lines/use-lines.d.ts +5 -6
- package/lib/lines/use-lines.d.ts.map +1 -1
- package/lib/lines/use-lines.js +75 -42
- package/lib/lost-property/LostPropertyForm.d.ts +10 -0
- package/lib/lost-property/LostPropertyForm.d.ts.map +1 -0
- package/lib/lost-property/LostPropertyForm.js +65 -0
- package/lib/lost-property/LostPropertyMachine.d.ts +116 -0
- package/lib/lost-property/LostPropertyMachine.d.ts.map +1 -0
- package/lib/lost-property/LostPropertyMachine.js +187 -0
- package/lib/lost-property/index.d.ts.map +1 -1
- package/lib/lost-property/index.js +27 -3
- package/lib/means-of-transport/forms/delayForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/delayForm.js +26 -18
- package/lib/means-of-transport/forms/driverForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/driverForm.js +26 -18
- package/lib/means-of-transport/forms/injuryForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/injuryForm.js +26 -18
- package/lib/means-of-transport/forms/serviceOfferingForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/serviceOfferingForm.js +10 -10
- package/lib/means-of-transport/forms/stopForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/stopForm.js +13 -12
- package/lib/means-of-transport/forms/transportationForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/transportationForm.js +26 -18
- package/lib/means-of-transport/index.d.ts.map +1 -1
- package/lib/means-of-transport/index.js +13 -4
- package/lib/means-of-transport/means-of-transport-form-machine.d.ts +10 -8
- package/lib/means-of-transport/means-of-transport-form-machine.d.ts.map +1 -1
- package/lib/means-of-transport/means-of-transport-form-machine.js +6 -1
- package/lib/modules/config/types.d.ts +56 -1
- package/lib/modules/config/types.d.ts.map +1 -1
- package/lib/refund/events.d.ts +1 -1
- package/lib/refund/events.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/index.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/index.js +7 -5
- package/lib/refund/forms/refund-and-travel-guarantee/refundCarForm.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/refundCarForm.js +39 -29
- package/lib/refund/forms/refund-and-travel-guarantee/refundTaxiForm.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/refundTaxiForm.js +37 -28
- package/lib/refund/forms/refund-ticket/appTicketRefund.d.ts.map +1 -1
- package/lib/refund/forms/refund-ticket/appTicketRefund.js +46 -25
- package/lib/refund/forms/refund-ticket/index.d.ts.map +1 -1
- package/lib/refund/forms/refund-ticket/index.js +9 -6
- package/lib/refund/forms/refund-ticket/otherTicketRefund.d.ts.map +1 -1
- package/lib/refund/forms/refund-ticket/otherTicketRefund.js +56 -30
- package/lib/refund/forms/residualValueOnTravelCard/index.d.ts.map +1 -1
- package/lib/refund/forms/residualValueOnTravelCard/index.js +5 -3
- package/lib/refund/index.d.ts.map +1 -1
- package/lib/refund/index.js +39 -6
- package/lib/refund/refundFormMachine.d.ts +37 -13
- package/lib/refund/refundFormMachine.d.ts.map +1 -1
- package/lib/refund/refundFormMachine.js +107 -11
- package/lib/server/journey-planner/index.d.ts.map +1 -1
- package/lib/server/journey-planner/index.js +15 -6
- package/lib/server/journey-planner/validators.d.ts +2 -0
- package/lib/server/journey-planner/validators.d.ts.map +1 -1
- package/lib/server/journey-planner/validators.js +1 -0
- package/lib/success-content/success-content.d.ts.map +1 -1
- package/lib/success-content/success-content.js +2 -1
- package/lib/test-utils/setup.d.ts +2 -0
- package/lib/test-utils/setup.d.ts.map +1 -0
- package/lib/test-utils/setup.js +3 -0
- package/lib/ticket-control/events.d.ts +1 -1
- package/lib/ticket-control/events.d.ts.map +1 -1
- package/lib/ticket-control/forms/feeComplaintForm.d.ts.map +1 -1
- package/lib/ticket-control/forms/feeComplaintForm.js +39 -36
- package/lib/ticket-control/forms/feedbackForm.d.ts.map +1 -1
- package/lib/ticket-control/forms/feedbackForm.js +26 -14
- package/lib/ticket-control/forms/postponePayment.d.ts.map +1 -1
- package/lib/ticket-control/forms/postponePayment.js +8 -7
- package/lib/ticket-control/index.d.ts.map +1 -1
- package/lib/ticket-control/index.js +23 -8
- package/lib/ticket-control/ticket-control-form-machine.d.ts +19 -11
- package/lib/ticket-control/ticket-control-form-machine.d.ts.map +1 -1
- package/lib/ticket-control/ticket-control-form-machine.js +25 -5
- package/lib/ticketing/forms/app/appAccountForm.d.ts.map +1 -1
- package/lib/ticketing/forms/app/appAccountForm.js +9 -8
- package/lib/ticketing/forms/app/appTicketingForm.d.ts.map +1 -1
- package/lib/ticketing/forms/app/appTicketingForm.js +13 -12
- package/lib/ticketing/forms/app/appTravelSuggestionForm.d.ts.map +1 -1
- package/lib/ticketing/forms/app/appTravelSuggestionForm.js +6 -5
- package/lib/ticketing/forms/app/index.d.ts.map +1 -1
- package/lib/ticketing/forms/app/index.js +2 -1
- package/lib/ticketing/forms/priceAndTicketTypesForm.d.ts.map +1 -1
- package/lib/ticketing/forms/priceAndTicketTypesForm.js +6 -5
- package/lib/ticketing/forms/travel-card/index.d.ts.map +1 -1
- package/lib/ticketing/forms/travel-card/index.js +2 -1
- package/lib/ticketing/forms/travel-card/orderTravelCard.d.ts.map +1 -1
- package/lib/ticketing/forms/travel-card/orderTravelCard.js +2 -2
- package/lib/ticketing/forms/travel-card/travelCardQuestionForm.d.ts.map +1 -1
- package/lib/ticketing/forms/travel-card/travelCardQuestionForm.js +9 -8
- package/lib/ticketing/forms/webshop/index.d.ts.map +1 -1
- package/lib/ticketing/forms/webshop/index.js +2 -1
- package/lib/ticketing/forms/webshop/webshopAccountForm.d.ts.map +1 -1
- package/lib/ticketing/forms/webshop/webshopAccountForm.js +9 -8
- package/lib/ticketing/forms/webshop/webshopTicketingForm.d.ts.map +1 -1
- package/lib/ticketing/forms/webshop/webshopTicketingForm.js +12 -11
- package/lib/ticketing/index.d.ts.map +1 -1
- package/lib/ticketing/index.js +21 -6
- package/lib/ticketing/ticketingStateMachine.d.ts +12 -12
- package/lib/translations/index.d.ts +1 -1
- package/lib/translations/index.d.ts.map +1 -1
- package/lib/translations/index.js +2 -1
- package/lib/translations/merge-overrides.d.ts.map +1 -1
- package/lib/translations/merge-overrides.js +8 -1
- package/lib/translations/pages/contact.d.ts +61 -0
- package/lib/translations/pages/contact.d.ts.map +1 -1
- package/lib/translations/pages/contact.js +64 -2
- package/lib/translations/translations-context.d.ts +2 -0
- package/lib/translations/translations-context.d.ts.map +1 -1
- package/lib/translations/translations-context.js +39 -0
- package/lib/types/submit-payloads.d.ts +40 -11
- package/lib/types/submit-payloads.d.ts.map +1 -1
- package/lib/types/submit-payloads.js +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/url-form-type.d.ts +6 -0
- package/lib/url-form-type.d.ts.map +1 -0
- package/lib/url-form-type.js +21 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +10 -0
- package/lib/validation/validationRules.d.ts.map +1 -1
- package/lib/validation/validationRules.js +31 -0
- package/package.json +11 -3
|
@@ -15,6 +15,7 @@ const button_1 = require("../button");
|
|
|
15
15
|
const icon_1 = require("../icon");
|
|
16
16
|
const error_message_1 = require("../error-message");
|
|
17
17
|
const Input = ({ id, label, errorMessage, type, name, checked, value, modalContent, disabled, onChange, placeholder, isRequired, }) => {
|
|
18
|
+
const PageText = (0, translations_1.usePageText)();
|
|
18
19
|
const { t } = (0, translations_1.useTranslation)();
|
|
19
20
|
const [isModalOpen, setIsModalOpen] = (0, react_1.useState)(false);
|
|
20
21
|
const isModalContentProvided = hasModalContent(modalContent);
|
|
@@ -26,7 +27,7 @@ const Input = ({ id, label, errorMessage, type, name, checked, value, modalConte
|
|
|
26
27
|
[form_module_css_1.default.container]: true,
|
|
27
28
|
[form_module_css_1.default.rowDisplay]: type === 'checkbox' || type === 'submit',
|
|
28
29
|
}), children: [(0, jsx_runtime_1.jsxs)("div", { className: form_module_css_1.default.label_container, children: [(0, jsx_runtime_1.jsx)(form_component_label_1.default, { label: label, htmlFor: `input__${id}`, disabled: disabled, isRequired: isRequired }), isModalContentProvided && ((0, jsx_runtime_1.jsx)(button_1.Button, { className: form_module_css_1.default.iconButton, onClick: toggleModalState, icon: { right: (0, jsx_runtime_1.jsx)(icon_1.MonoIcon, { icon: 'status/Info' }) }, buttonProps: {
|
|
29
|
-
'aria-label': t(
|
|
30
|
+
'aria-label': t(PageText.Contact.components.modal.moreInformation(label)),
|
|
30
31
|
} }))] }), (0, jsx_runtime_1.jsx)("input", { id: `input__${id}`, type: type, name: name, className: (0, css_1.andIf)({
|
|
31
32
|
[form_module_css_1.default.input]: true,
|
|
32
33
|
[form_module_css_1.default.input__error]: !!errorMessage,
|
|
@@ -12,8 +12,13 @@ exports.getLineOptions = getLineOptions;
|
|
|
12
12
|
const getStopOptions = (stops) => {
|
|
13
13
|
return stops.map((stop) => ({
|
|
14
14
|
id: stop.id,
|
|
15
|
-
name: stop.name,
|
|
15
|
+
name: getStopOptionName(stop.name, stop.description),
|
|
16
16
|
value: stop,
|
|
17
17
|
}));
|
|
18
18
|
};
|
|
19
19
|
exports.getStopOptions = getStopOptions;
|
|
20
|
+
function getStopOptionName(name, description) {
|
|
21
|
+
if (!description)
|
|
22
|
+
return name;
|
|
23
|
+
return `${name} (${description})`;
|
|
24
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { FieldWrapperWithError, FileInput, Fieldset, Input, Radio, Select, Textarea, SearchableSelect, getLineOptions, getStopOptions, DateSelector, TimeSelector, } from './form';
|
|
1
|
+
export { DepartureTimeField, FieldWrapperWithError, FileInput, Fieldset, Input, Radio, Select, Textarea, SearchableSelect, getLineOptions, getStopOptions, DateSelector, TimeSelector, } from './form';
|
|
2
2
|
export { SectionCard } from './section-card';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,KAAK,EACL,MAAM,EACN,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,SAAS,EACT,QAAQ,EACR,KAAK,EACL,KAAK,EACL,MAAM,EACN,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
package/lib/components/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SectionCard = exports.TimeSelector = exports.DateSelector = exports.getStopOptions = exports.getLineOptions = exports.SearchableSelect = exports.Textarea = exports.Select = exports.Radio = exports.Input = exports.Fieldset = exports.FileInput = exports.FieldWrapperWithError = void 0;
|
|
3
|
+
exports.SectionCard = exports.TimeSelector = exports.DateSelector = exports.getStopOptions = exports.getLineOptions = exports.SearchableSelect = exports.Textarea = exports.Select = exports.Radio = exports.Input = exports.Fieldset = exports.FileInput = exports.FieldWrapperWithError = exports.DepartureTimeField = void 0;
|
|
4
4
|
var form_1 = require("./form");
|
|
5
|
+
Object.defineProperty(exports, "DepartureTimeField", { enumerable: true, get: function () { return form_1.DepartureTimeField; } });
|
|
5
6
|
Object.defineProperty(exports, "FieldWrapperWithError", { enumerable: true, get: function () { return form_1.FieldWrapperWithError; } });
|
|
6
7
|
Object.defineProperty(exports, "FileInput", { enumerable: true, get: function () { return form_1.FileInput; } });
|
|
7
8
|
Object.defineProperty(exports, "Fieldset", { enumerable: true, get: function () { return form_1.Fieldset; } });
|
package/lib/contact.module.css
CHANGED
|
@@ -19,6 +19,15 @@
|
|
|
19
19
|
padding: token('spacing.xSmall') 0;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
.link {
|
|
23
|
+
font-weight: bold;
|
|
24
|
+
text-decoration: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.link:hover {
|
|
28
|
+
text-decoration: underline;
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
.feedback {
|
|
23
32
|
composes: typo-body__s;
|
|
24
33
|
padding: token('spacing.small');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-content.d.ts","sourceRoot":"","sources":["../../src/error-content/error-content.tsx"],"names":[],"mappings":"AAOA,wBAAgB,YAAY,
|
|
1
|
+
{"version":3,"file":"error-content.d.ts","sourceRoot":"","sources":["../../src/error-content/error-content.tsx"],"names":[],"mappings":"AAOA,wBAAgB,YAAY,4CAoB3B"}
|
|
@@ -12,8 +12,9 @@ const icon_1 = require("../components/icon");
|
|
|
12
12
|
const typography_1 = require("../components/typography");
|
|
13
13
|
const config_1 = require("../modules/config");
|
|
14
14
|
function ErrorContent() {
|
|
15
|
+
const PageText = (0, translations_1.usePageText)();
|
|
15
16
|
const { t } = (0, translations_1.useTranslation)();
|
|
16
17
|
const { layout } = (0, config_1.useContactFormConfig)();
|
|
17
18
|
const backHref = layout?.basePath ?? '/contact';
|
|
18
|
-
return ((0, jsx_runtime_1.jsxs)("section", { className: error_content_module_css_1.default.container, children: [(0, jsx_runtime_1.jsx)(button_1.ButtonLink, { mode: "transparent", href: backHref, title: t(
|
|
19
|
+
return ((0, jsx_runtime_1.jsxs)("section", { className: error_content_module_css_1.default.container, children: [(0, jsx_runtime_1.jsx)(button_1.ButtonLink, { mode: "transparent", href: backHref, title: t(PageText.Contact.error.backButton), icon: { left: (0, jsx_runtime_1.jsx)(icon_1.MonoIcon, { icon: "navigation/ArrowLeft" }) } }), (0, jsx_runtime_1.jsx)(typography_1.Typo.h2, { textType: "heading__xl", children: t(PageText.Contact.error.title) }), (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(PageText.Contact.error.info) })] }));
|
|
19
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/group-travel/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/group-travel/index.tsx"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,UAAU,kBAAkB,4CAmBzC"}
|
|
@@ -5,11 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.default = GroupTravelContent;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const contact_module_css_1 = __importDefault(require("../contact.module.css"));
|
|
8
9
|
const components_1 = require("../components");
|
|
9
10
|
const link_1 = __importDefault(require("next/link"));
|
|
10
11
|
const translations_1 = require("../translations");
|
|
11
12
|
const typography_1 = require("../components/typography");
|
|
12
13
|
function GroupTravelContent() {
|
|
14
|
+
const PageText = (0, translations_1.usePageText)();
|
|
13
15
|
const { t } = (0, translations_1.useTranslation)();
|
|
14
|
-
return ((0, jsx_runtime_1.jsx)(components_1.SectionCard, { title: t(
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(components_1.SectionCard, { title: t(PageText.Contact.groupTravel.title), children: (0, jsx_runtime_1.jsxs)(typography_1.Typo.p, { textType: "body__m", children: [t(PageText.Contact.groupTravel.description.info), ' ', (0, jsx_runtime_1.jsx)(link_1.default, { className: contact_module_css_1.default.link, href: t(PageText.Contact.groupTravel.description.url), target: "_blank", rel: "noopener noreferrer", children: t(PageText.Contact.groupTravel.description.externalLink) })] }) }));
|
|
15
17
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
export { ContactFormConfigProvider, useContactFormConfig, useThemeConfig, useIconConfig, useOrgConfig, useApiConfig, } from './modules/config';
|
|
2
|
-
export type { TicketControlSubmitPayload, RefundSubmitPayload, MeansOfTransportSubmitPayload, TicketingSubmitPayload, JourneyInfoSubmitPayload, } from './types/submit-payloads';
|
|
2
|
+
export type { TicketControlSubmitPayload, RefundSubmitPayload, MeansOfTransportSubmitPayload, TicketingSubmitPayload, JourneyInfoSubmitPayload, LostPropertySubmitPayload, } from './types/submit-payloads';
|
|
3
3
|
export type { TransportModeType, ReasonForTransportFailure, TicketType, PurchasePlatformType, } from './types';
|
|
4
4
|
export { TicketTypeId } from './types';
|
|
5
5
|
export type { ContactFormConfig, IconComponent, IconName, IconSet, Theme, ThemeColors, ContrastColor, TransportColors, InteractiveColor, StatusColors, TypographyConfig, ApiConfig, OrgConfig, LayoutConfig, LayoutLinkLabel, PagesOverrides, FormSchemaOverrides, FormSchemaName, } from './modules/config';
|
|
6
6
|
export { ThemeProvider, useTheme, useDarkMode, useHtmlDarkMode, } from './modules/theme';
|
|
7
7
|
export { Icon } from './components/icon/icon-wrapper';
|
|
8
8
|
export { MonoIcon } from './components/icon/mono-icon-new';
|
|
9
|
-
export { ButtonLink } from './components/button';
|
|
10
|
-
export type { ButtonLinkProps } from './components/button';
|
|
9
|
+
export { ButtonLink, Button } from './components/button';
|
|
10
|
+
export type { ButtonLinkProps, ButtonProps } from './components/button';
|
|
11
|
+
export { Typo } from './components/typography';
|
|
12
|
+
export { default as ErrorMessage } from './components/error-message/error-message';
|
|
13
|
+
export type { ErrorMessageProps } from './components/error-message/error-message';
|
|
14
|
+
export { SectionCard } from './components/section-card';
|
|
15
|
+
export { FieldWrapperWithError, FileInput, Fieldset, Input, Radio, Select, Textarea, SearchableSelect, getLineOptions, getStopOptions, DateSelector, TimeSelector, DepartureTimeField, } from './components';
|
|
16
|
+
export { Checkbox } from './components/checkbox';
|
|
11
17
|
export { type Line } from './server/journey-planner/validators';
|
|
12
18
|
export { useLines, useTransportModeOptions } from './lines/use-lines';
|
|
13
|
-
export { shouldShowContactPage } from './utils';
|
|
19
|
+
export { shouldShowContactPage, scrollToFirstErrorMessage, findFirstErrorMessage, getLineName, findOrderFormFields, } from './utils';
|
|
20
|
+
export { commonInputValidator } from './validation';
|
|
21
|
+
export type { InputErrorMessages } from './validation';
|
|
14
22
|
export { ContactPageLayout, type ContactPageLayoutProps, getStandardContactPages, ContactFormContainer, type ContactFormContainerProps, } from './layouts';
|
|
15
23
|
export { ExternalLinkPage, type ExternalLinkPageProps, } from './components/external-link-page';
|
|
16
24
|
export { ErrorContent } from './error-content/error-content';
|
|
17
25
|
export { SuccessContent } from './success-content/success-content';
|
|
18
26
|
export { default as RefundContent } from './refund';
|
|
27
|
+
export type { RefundContextProps } from './refund/refundFormMachine';
|
|
28
|
+
export { FormType, RefundTicketForm } from './refund/refundFormMachine';
|
|
29
|
+
export { RefundFormEvents } from './refund/events';
|
|
30
|
+
export { default as AppTicketRefundContent } from './refund/forms/refund-ticket/appTicketRefund';
|
|
19
31
|
export { default as MeansOfTransportContent } from './means-of-transport';
|
|
20
32
|
export { default as TicketControlPageContent } from './ticket-control';
|
|
21
33
|
export { default as TicketingContent } from './ticketing';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,6BAA6B,EAC7B,sBAAsB,EACtB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/lib/index.js
CHANGED
|
@@ -17,7 +17,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
20
|
+
exports.RefundFormEvents = exports.RefundTicketForm = exports.FormType = exports.RefundContent = exports.SuccessContent = exports.ErrorContent = exports.ExternalLinkPage = exports.ContactFormContainer = exports.getStandardContactPages = exports.ContactPageLayout = exports.commonInputValidator = exports.findOrderFormFields = exports.getLineName = exports.findFirstErrorMessage = exports.scrollToFirstErrorMessage = exports.shouldShowContactPage = exports.useTransportModeOptions = exports.useLines = exports.Checkbox = exports.DepartureTimeField = exports.TimeSelector = exports.DateSelector = exports.getStopOptions = exports.getLineOptions = exports.SearchableSelect = exports.Textarea = exports.Select = exports.Radio = exports.Input = exports.Fieldset = exports.FileInput = exports.FieldWrapperWithError = exports.SectionCard = exports.ErrorMessage = exports.Typo = exports.Button = exports.ButtonLink = exports.MonoIcon = exports.Icon = exports.useHtmlDarkMode = exports.useDarkMode = exports.useTheme = exports.ThemeProvider = exports.TicketTypeId = exports.useApiConfig = exports.useOrgConfig = exports.useIconConfig = exports.useThemeConfig = exports.useContactFormConfig = exports.ContactFormConfigProvider = void 0;
|
|
21
|
+
exports.ContactFormRoot = exports.JourneyInfoContent = exports.TicketingContent = exports.TicketControlPageContent = exports.MeansOfTransportContent = exports.AppTicketRefundContent = void 0;
|
|
21
22
|
// Configuration system (NEW - required for setup)
|
|
22
23
|
var config_1 = require("./modules/config");
|
|
23
24
|
Object.defineProperty(exports, "ContactFormConfigProvider", { enumerable: true, get: function () { return config_1.ContactFormConfigProvider; } });
|
|
@@ -42,11 +43,43 @@ Object.defineProperty(exports, "MonoIcon", { enumerable: true, get: function ()
|
|
|
42
43
|
// Button components
|
|
43
44
|
var button_1 = require("./components/button");
|
|
44
45
|
Object.defineProperty(exports, "ButtonLink", { enumerable: true, get: function () { return button_1.ButtonLink; } });
|
|
46
|
+
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return button_1.Button; } });
|
|
47
|
+
// Typography
|
|
48
|
+
var typography_1 = require("./components/typography");
|
|
49
|
+
Object.defineProperty(exports, "Typo", { enumerable: true, get: function () { return typography_1.Typo; } });
|
|
50
|
+
// Error message
|
|
51
|
+
var error_message_1 = require("./components/error-message/error-message");
|
|
52
|
+
Object.defineProperty(exports, "ErrorMessage", { enumerable: true, get: function () { return __importDefault(error_message_1).default; } });
|
|
53
|
+
// Form components
|
|
54
|
+
var section_card_1 = require("./components/section-card");
|
|
55
|
+
Object.defineProperty(exports, "SectionCard", { enumerable: true, get: function () { return section_card_1.SectionCard; } });
|
|
56
|
+
var components_1 = require("./components");
|
|
57
|
+
Object.defineProperty(exports, "FieldWrapperWithError", { enumerable: true, get: function () { return components_1.FieldWrapperWithError; } });
|
|
58
|
+
Object.defineProperty(exports, "FileInput", { enumerable: true, get: function () { return components_1.FileInput; } });
|
|
59
|
+
Object.defineProperty(exports, "Fieldset", { enumerable: true, get: function () { return components_1.Fieldset; } });
|
|
60
|
+
Object.defineProperty(exports, "Input", { enumerable: true, get: function () { return components_1.Input; } });
|
|
61
|
+
Object.defineProperty(exports, "Radio", { enumerable: true, get: function () { return components_1.Radio; } });
|
|
62
|
+
Object.defineProperty(exports, "Select", { enumerable: true, get: function () { return components_1.Select; } });
|
|
63
|
+
Object.defineProperty(exports, "Textarea", { enumerable: true, get: function () { return components_1.Textarea; } });
|
|
64
|
+
Object.defineProperty(exports, "SearchableSelect", { enumerable: true, get: function () { return components_1.SearchableSelect; } });
|
|
65
|
+
Object.defineProperty(exports, "getLineOptions", { enumerable: true, get: function () { return components_1.getLineOptions; } });
|
|
66
|
+
Object.defineProperty(exports, "getStopOptions", { enumerable: true, get: function () { return components_1.getStopOptions; } });
|
|
67
|
+
Object.defineProperty(exports, "DateSelector", { enumerable: true, get: function () { return components_1.DateSelector; } });
|
|
68
|
+
Object.defineProperty(exports, "TimeSelector", { enumerable: true, get: function () { return components_1.TimeSelector; } });
|
|
69
|
+
Object.defineProperty(exports, "DepartureTimeField", { enumerable: true, get: function () { return components_1.DepartureTimeField; } });
|
|
70
|
+
var checkbox_1 = require("./components/checkbox");
|
|
71
|
+
Object.defineProperty(exports, "Checkbox", { enumerable: true, get: function () { return checkbox_1.Checkbox; } });
|
|
45
72
|
var use_lines_1 = require("./lines/use-lines");
|
|
46
73
|
Object.defineProperty(exports, "useLines", { enumerable: true, get: function () { return use_lines_1.useLines; } });
|
|
47
74
|
Object.defineProperty(exports, "useTransportModeOptions", { enumerable: true, get: function () { return use_lines_1.useTransportModeOptions; } });
|
|
48
75
|
var utils_1 = require("./utils");
|
|
49
76
|
Object.defineProperty(exports, "shouldShowContactPage", { enumerable: true, get: function () { return utils_1.shouldShowContactPage; } });
|
|
77
|
+
Object.defineProperty(exports, "scrollToFirstErrorMessage", { enumerable: true, get: function () { return utils_1.scrollToFirstErrorMessage; } });
|
|
78
|
+
Object.defineProperty(exports, "findFirstErrorMessage", { enumerable: true, get: function () { return utils_1.findFirstErrorMessage; } });
|
|
79
|
+
Object.defineProperty(exports, "getLineName", { enumerable: true, get: function () { return utils_1.getLineName; } });
|
|
80
|
+
Object.defineProperty(exports, "findOrderFormFields", { enumerable: true, get: function () { return utils_1.findOrderFormFields; } });
|
|
81
|
+
var validation_1 = require("./validation");
|
|
82
|
+
Object.defineProperty(exports, "commonInputValidator", { enumerable: true, get: function () { return validation_1.commonInputValidator; } });
|
|
50
83
|
var layouts_1 = require("./layouts");
|
|
51
84
|
Object.defineProperty(exports, "ContactPageLayout", { enumerable: true, get: function () { return layouts_1.ContactPageLayout; } });
|
|
52
85
|
Object.defineProperty(exports, "getStandardContactPages", { enumerable: true, get: function () { return layouts_1.getStandardContactPages; } });
|
|
@@ -59,6 +92,13 @@ var success_content_1 = require("./success-content/success-content");
|
|
|
59
92
|
Object.defineProperty(exports, "SuccessContent", { enumerable: true, get: function () { return success_content_1.SuccessContent; } });
|
|
60
93
|
var refund_1 = require("./refund");
|
|
61
94
|
Object.defineProperty(exports, "RefundContent", { enumerable: true, get: function () { return __importDefault(refund_1).default; } });
|
|
95
|
+
var refundFormMachine_1 = require("./refund/refundFormMachine");
|
|
96
|
+
Object.defineProperty(exports, "FormType", { enumerable: true, get: function () { return refundFormMachine_1.FormType; } });
|
|
97
|
+
Object.defineProperty(exports, "RefundTicketForm", { enumerable: true, get: function () { return refundFormMachine_1.RefundTicketForm; } });
|
|
98
|
+
var events_1 = require("./refund/events");
|
|
99
|
+
Object.defineProperty(exports, "RefundFormEvents", { enumerable: true, get: function () { return events_1.RefundFormEvents; } });
|
|
100
|
+
var appTicketRefund_1 = require("./refund/forms/refund-ticket/appTicketRefund");
|
|
101
|
+
Object.defineProperty(exports, "AppTicketRefundContent", { enumerable: true, get: function () { return __importDefault(appTicketRefund_1).default; } });
|
|
62
102
|
var means_of_transport_1 = require("./means-of-transport");
|
|
63
103
|
Object.defineProperty(exports, "MeansOfTransportContent", { enumerable: true, get: function () { return __importDefault(means_of_transport_1).default; } });
|
|
64
104
|
var ticket_control_1 = require("./ticket-control");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/journey-info/index.tsx"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/journey-info/index.tsx"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,kBAAkB,4CAkLzC"}
|
|
@@ -17,9 +17,10 @@ const button_1 = require("../components/button");
|
|
|
17
17
|
const icon_1 = require("../components/icon");
|
|
18
18
|
const error_message_1 = __importDefault(require("../components/error-message/error-message"));
|
|
19
19
|
function JourneyInfoContent() {
|
|
20
|
+
const PageText = (0, translations_1.usePageText)();
|
|
20
21
|
const { t } = (0, translations_1.useTranslation)();
|
|
21
22
|
const apiConfig = (0, config_1.useApiConfig)();
|
|
22
|
-
const { layout } = (0, config_1.useContactFormConfig)();
|
|
23
|
+
const { layout, org } = (0, config_1.useContactFormConfig)();
|
|
23
24
|
const successPath = layout?.successPath ??
|
|
24
25
|
(layout?.basePath ? `${layout.basePath}/success` : '/contact/success');
|
|
25
26
|
const errorPath = layout?.errorPath ??
|
|
@@ -33,9 +34,14 @@ function JourneyInfoContent() {
|
|
|
33
34
|
e.preventDefault();
|
|
34
35
|
send({ type: 'SUBMIT', orderedFormFieldNames: (0, utils_1.findOrderFormFields)(e) });
|
|
35
36
|
};
|
|
36
|
-
return ((0, jsx_runtime_1.jsxs)("form", { onSubmit: onSubmit, className: contact_module_css_1.default.form, children: [(0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)("form", { onSubmit: onSubmit, className: contact_module_css_1.default.form, children: [(0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.journeyInfo.input.question.title), isRequired: true, children: [(0, jsx_runtime_1.jsxs)("div", { className: contact_module_css_1.default.extraInfo, children: [(0, jsx_runtime_1.jsx)("p", { children: t(PageText.Contact.journeyInfo.info.useTravelSearch) }), (0, jsx_runtime_1.jsx)("div", { className: contact_module_css_1.default.extraInfo__buttonContainer, children: (0, jsx_runtime_1.jsx)(button_1.ButtonLink, { href: org.travelSearchHref ?? '/', mode: "interactive_0", title: t(PageText.Contact.journeyInfo.info.useTravelSearchLink), icon: {
|
|
37
38
|
right: ((0, jsx_runtime_1.jsx)(icon_1.MonoIcon, { icon: "navigation/ArrowRight", overrideMode: "dark" })),
|
|
38
|
-
}
|
|
39
|
+
}, aProps: { target: '_blank', rel: 'noreferrer' } }) }), org.contactHref &&
|
|
40
|
+
(() => {
|
|
41
|
+
const prefix = t(PageText.Contact.journeyInfo.info.contactInfoPrefix);
|
|
42
|
+
const linkText = t(PageText.Contact.journeyInfo.info.contactLinkText);
|
|
43
|
+
return ((0, jsx_runtime_1.jsxs)("p", { children: [prefix && `${prefix} `, (0, jsx_runtime_1.jsx)("a", { href: org.contactHref, target: "_blank", rel: "noreferrer", className: contact_module_css_1.default.link, children: linkText }), "."] }));
|
|
44
|
+
})()] }), (0, jsx_runtime_1.jsx)(components_1.Textarea, { id: "question", description: t(PageText.Contact.journeyInfo.input.question.info), value: state.context.question || '', onChange: (e) => send({
|
|
39
45
|
type: 'ON_INPUT_CHANGE',
|
|
40
46
|
inputName: 'question',
|
|
41
47
|
value: e.target.value,
|
|
@@ -44,7 +50,7 @@ function JourneyInfoContent() {
|
|
|
44
50
|
: undefined, fileInputProps: {
|
|
45
51
|
id: 'attachments',
|
|
46
52
|
name: 'attachments',
|
|
47
|
-
iconLabel: t(
|
|
53
|
+
iconLabel: t(PageText.Contact.journeyInfo.input.question.attachment),
|
|
48
54
|
onChange: (files) => {
|
|
49
55
|
send({
|
|
50
56
|
type: 'ON_INPUT_CHANGE',
|
|
@@ -52,17 +58,17 @@ function JourneyInfoContent() {
|
|
|
52
58
|
value: files,
|
|
53
59
|
});
|
|
54
60
|
},
|
|
55
|
-
} })] }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(
|
|
61
|
+
} })] }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.aboutYouInfo.title), children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "firstName", label: t(PageText.Contact.input.firstName.label), type: "text", autoComplete: "given-name additional-name", name: "firstName", value: state.context.firstName || '', isRequired: true, errorMessage: state.context?.errorMessages['firstName']?.[0], onChange: (e) => send({
|
|
56
62
|
type: 'ON_INPUT_CHANGE',
|
|
57
63
|
inputName: 'firstName',
|
|
58
64
|
value: e.target.value,
|
|
59
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "lastName", label: t(
|
|
65
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "lastName", label: t(PageText.Contact.input.lastName.label), type: "text", autoComplete: "family-name", name: "lastName", value: state.context.lastName || '', isRequired: true, errorMessage: state.context?.errorMessages['lastName']?.[0], onChange: (e) => send({
|
|
60
66
|
type: 'ON_INPUT_CHANGE',
|
|
61
67
|
inputName: 'lastName',
|
|
62
68
|
value: e.target.value,
|
|
63
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "email", label: t(
|
|
69
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "email", label: t(PageText.Contact.input.email.label), type: "email", autoComplete: "email", name: "email", value: state.context.email || '', isRequired: true, errorMessage: state.context?.errorMessages['email']?.[0], onChange: (e) => send({
|
|
64
70
|
type: 'ON_INPUT_CHANGE',
|
|
65
71
|
inputName: 'email',
|
|
66
72
|
value: e.target.value,
|
|
67
|
-
}) })] }), state.context.hasSubmissionError && ((0, jsx_runtime_1.jsx)(error_message_1.default, { message: t(
|
|
73
|
+
}) })] }), state.context.hasSubmissionError && ((0, jsx_runtime_1.jsx)(error_message_1.default, { message: t(PageText.Contact.error.info), id: "submission-error" })), (0, jsx_runtime_1.jsx)(button_1.Button, { title: t(PageText.Contact.submit), mode: 'interactive_0--bordered', buttonProps: { type: 'submit' }, state: state.matches('submitting') ? 'loading' : undefined, className: contact_module_css_1.default.submitButton })] }));
|
|
68
74
|
}
|
|
@@ -25,7 +25,7 @@ export declare function createJourneyInfoStateMachine(onSubmit: (schemaName: For
|
|
|
25
25
|
type: "VALIDATE";
|
|
26
26
|
} | {
|
|
27
27
|
type: "ON_INPUT_CHANGE";
|
|
28
|
-
inputName: "address" | "attachments" | "bankAccountNumber" | "city" | "date" | "email" | "firstName" | "feedback" | "IBAN" | "lastName" | "phoneNumber" | "postalCode" | "SWIFT" | "toStop" | "fromStop" | "plannedDepartureTime";
|
|
28
|
+
inputName: "address" | "attachments" | "bankAccountNumber" | "city" | "date" | "email" | "firstName" | "feedback" | "IBAN" | "lastName" | "phoneNumber" | "postalCode" | "SWIFT" | "toStop" | "fromStop" | "plannedDepartureTime" | "tripId";
|
|
29
29
|
value: any;
|
|
30
30
|
} | {
|
|
31
31
|
type: "ON_TRANSPORTMODE_CHANGE";
|
|
@@ -49,6 +49,9 @@ export declare function createJourneyInfoStateMachine(onSubmit: (schemaName: For
|
|
|
49
49
|
logic: import("xstate").PromiseActorLogic<true, SubmitInput, import("xstate").EventObject>;
|
|
50
50
|
id: string | undefined;
|
|
51
51
|
}, {
|
|
52
|
+
type: "onInputChange";
|
|
53
|
+
params: unknown;
|
|
54
|
+
} | {
|
|
52
55
|
type: "navigateToErrorPage";
|
|
53
56
|
params: unknown;
|
|
54
57
|
} | {
|
|
@@ -69,9 +72,6 @@ export declare function createJourneyInfoStateMachine(onSubmit: (schemaName: For
|
|
|
69
72
|
} | {
|
|
70
73
|
type: "clearSubmissionError";
|
|
71
74
|
params: unknown;
|
|
72
|
-
} | {
|
|
73
|
-
type: "onInputChange";
|
|
74
|
-
params: unknown;
|
|
75
75
|
}, {
|
|
76
76
|
type: "isFormValid";
|
|
77
77
|
params: unknown;
|
|
@@ -102,7 +102,7 @@ export declare const journeyInfoStateMachine: import("xstate").StateMachine<Jour
|
|
|
102
102
|
type: "VALIDATE";
|
|
103
103
|
} | {
|
|
104
104
|
type: "ON_INPUT_CHANGE";
|
|
105
|
-
inputName: "address" | "attachments" | "bankAccountNumber" | "city" | "date" | "email" | "firstName" | "feedback" | "IBAN" | "lastName" | "phoneNumber" | "postalCode" | "SWIFT" | "toStop" | "fromStop" | "plannedDepartureTime";
|
|
105
|
+
inputName: "address" | "attachments" | "bankAccountNumber" | "city" | "date" | "email" | "firstName" | "feedback" | "IBAN" | "lastName" | "phoneNumber" | "postalCode" | "SWIFT" | "toStop" | "fromStop" | "plannedDepartureTime" | "tripId";
|
|
106
106
|
value: any;
|
|
107
107
|
} | {
|
|
108
108
|
type: "ON_TRANSPORTMODE_CHANGE";
|
|
@@ -126,6 +126,9 @@ export declare const journeyInfoStateMachine: import("xstate").StateMachine<Jour
|
|
|
126
126
|
logic: import("xstate").PromiseActorLogic<true, SubmitInput, import("xstate").EventObject>;
|
|
127
127
|
id: string | undefined;
|
|
128
128
|
}, {
|
|
129
|
+
type: "onInputChange";
|
|
130
|
+
params: unknown;
|
|
131
|
+
} | {
|
|
129
132
|
type: "navigateToErrorPage";
|
|
130
133
|
params: unknown;
|
|
131
134
|
} | {
|
|
@@ -146,9 +149,6 @@ export declare const journeyInfoStateMachine: import("xstate").StateMachine<Jour
|
|
|
146
149
|
} | {
|
|
147
150
|
type: "clearSubmissionError";
|
|
148
151
|
params: unknown;
|
|
149
|
-
} | {
|
|
150
|
-
type: "onInputChange";
|
|
151
|
-
params: unknown;
|
|
152
152
|
}, {
|
|
153
153
|
type: "isFormValid";
|
|
154
154
|
params: unknown;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { TranslatedString } from '../translations';
|
|
2
|
+
import { TranslatedString, PageText as StaticPageText } from '../translations';
|
|
3
3
|
import { MonoIcons } from '../components/icon';
|
|
4
4
|
export type ContactPage = {
|
|
5
5
|
title: TranslatedString;
|
|
@@ -10,7 +10,7 @@ export type ContactPage = {
|
|
|
10
10
|
* Standard contact pages (tabs) as defined in the package.
|
|
11
11
|
* This is the default list used when no overrides are provided.
|
|
12
12
|
*/
|
|
13
|
-
export declare const getStandardContactPages: () => ContactPage[];
|
|
13
|
+
export declare const getStandardContactPages: (PageText?: typeof StaticPageText) => ContactPage[];
|
|
14
14
|
export declare const contactPages: ContactPage[];
|
|
15
15
|
export type ContactPageLayoutProps = PropsWithChildren<{
|
|
16
16
|
title: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-page-layout.d.ts","sourceRoot":"","sources":["../../src/layouts/contact-page-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAInD,OAAO,
|
|
1
|
+
{"version":3,"file":"contact-page-layout.d.ts","sourceRoot":"","sources":["../../src/layouts/contact-page-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAInD,OAAO,EACL,gBAAgB,EAGhB,QAAQ,IAAI,cAAc,EAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAY,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAMzD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,gBAAgB,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAClC,WAAU,OAAO,cAA+B,KAC/C,WAAW,EAyCb,CAAC;AAGF,eAAO,MAAM,YAAY,eAA4B,CAAC;AAYtD,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;CAC/E,CAAC,CAAC;AAEH,iBAAS,iBAAiB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,sBAAsB,2CA+FxE;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -19,39 +19,44 @@ const config_1 = require("../modules/config");
|
|
|
19
19
|
* Standard contact pages (tabs) as defined in the package.
|
|
20
20
|
* This is the default list used when no overrides are provided.
|
|
21
21
|
*/
|
|
22
|
-
const getStandardContactPages = () => [
|
|
22
|
+
const getStandardContactPages = (PageText = translations_1.PageText) => [
|
|
23
23
|
{
|
|
24
|
-
title:
|
|
24
|
+
title: PageText.Contact.ticketControl.title,
|
|
25
25
|
href: '/contact/ticket-control',
|
|
26
26
|
icon: 'ticketing/TicketInvalid',
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
title:
|
|
29
|
+
title: PageText.Contact.refund.title,
|
|
30
30
|
href: '/contact/refund',
|
|
31
31
|
icon: 'transportation-entur/Taxi',
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
|
-
title:
|
|
34
|
+
title: PageText.Contact.modeOfTransport.title,
|
|
35
35
|
href: '/contact/means-of-transport',
|
|
36
36
|
icon: 'transportation/BusFill',
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
|
-
title:
|
|
39
|
+
title: PageText.Contact.ticketing.title,
|
|
40
40
|
href: '/contact/ticketing',
|
|
41
41
|
icon: 'devices/Phone',
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
|
-
title:
|
|
44
|
+
title: PageText.Contact.skoleskyss.title,
|
|
45
|
+
href: '/contact/skoleskyss',
|
|
46
|
+
icon: 'ticketing/Student',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
title: PageText.Contact.lostProperty.title,
|
|
45
50
|
href: '/contact/lost-property',
|
|
46
51
|
icon: 'actions/Support',
|
|
47
52
|
},
|
|
48
53
|
{
|
|
49
|
-
title:
|
|
54
|
+
title: PageText.Contact.groupTravel.title,
|
|
50
55
|
href: '/contact/group-travel',
|
|
51
56
|
icon: 'ticketing/TicketMultiple',
|
|
52
57
|
},
|
|
53
58
|
{
|
|
54
|
-
title:
|
|
59
|
+
title: PageText.Contact.journeyInfo.title,
|
|
55
60
|
href: '/contact/journey-info',
|
|
56
61
|
icon: 'actions/Feedback',
|
|
57
62
|
},
|
|
@@ -59,10 +64,7 @@ const getStandardContactPages = () => [
|
|
|
59
64
|
exports.getStandardContactPages = getStandardContactPages;
|
|
60
65
|
// Keep contactPages export for backward compatibility
|
|
61
66
|
exports.contactPages = (0, exports.getStandardContactPages)();
|
|
62
|
-
const pagesWithoutPrivacyAndTerms = [
|
|
63
|
-
'/contact/lost-property',
|
|
64
|
-
'/contact/group-travel',
|
|
65
|
-
];
|
|
67
|
+
const pagesWithoutPrivacyAndTerms = ['/contact/group-travel'];
|
|
66
68
|
/**
|
|
67
69
|
* Extract page ID from href (e.g., '/contact/lost-property' -> 'lost-property')
|
|
68
70
|
*/
|
|
@@ -71,30 +73,37 @@ function getPageIdFromHref(href) {
|
|
|
71
73
|
return parts[parts.length - 1] || '';
|
|
72
74
|
}
|
|
73
75
|
function ContactPageLayout({ children, backLink }) {
|
|
76
|
+
const PageText = (0, translations_1.usePageText)();
|
|
74
77
|
const { t } = (0, translations_1.useTranslation)();
|
|
75
78
|
const pathname = (0, navigation_1.usePathname)();
|
|
76
79
|
const { pagesOverrides } = (0, config_1.useContactFormConfig)();
|
|
77
80
|
// Resolve visible pages: standard list minus hidden pages
|
|
78
81
|
const visiblePages = (0, react_1.useMemo)(() => {
|
|
79
|
-
const standard = (0, exports.getStandardContactPages)();
|
|
82
|
+
const standard = (0, exports.getStandardContactPages)(PageText);
|
|
80
83
|
const hidePageIds = pagesOverrides?.hidePageIds || [];
|
|
81
84
|
return standard.filter((page) => {
|
|
82
85
|
const pageId = getPageIdFromHref(page.href);
|
|
83
86
|
return !hidePageIds.includes(pageId);
|
|
84
87
|
});
|
|
85
|
-
}, [pagesOverrides]);
|
|
88
|
+
}, [pagesOverrides, PageText]);
|
|
86
89
|
const selectedContactPage = (0, react_1.useMemo)(() => visiblePages.find((contactPage) => pathname.includes(contactPage.href)), [pathname, visiblePages]);
|
|
87
90
|
const displayPrivacyAndTerms = (contactPage) => {
|
|
88
91
|
if (!contactPage)
|
|
89
92
|
return false;
|
|
90
93
|
return !pagesWithoutPrivacyAndTerms.includes(contactPage.href);
|
|
91
94
|
};
|
|
92
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: layout_module_css_1.default.layout, children: [(0, jsx_runtime_1.jsxs)("div", { children: [backLink && ((0, jsx_runtime_1.jsx)("div", { className: layout_module_css_1.default.homeLink__container, children: (0, jsx_runtime_1.jsx)(button_1.ButtonLink, { mode: "transparent", href: backLink.href, title: t(backLink.label), icon: { left: (0, jsx_runtime_1.jsx)(icon_1.MonoIcon, { icon: "navigation/ArrowLeft" }) } }) })), (0, jsx_runtime_1.jsxs)("div", { className: layout_module_css_1.default.layout__container, children: [(0, jsx_runtime_1.jsx)(typography_1.Typo.h2, { textType: "heading__2xl", children: t(
|
|
95
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: layout_module_css_1.default.layout, children: [(0, jsx_runtime_1.jsxs)("div", { children: [backLink && ((0, jsx_runtime_1.jsx)("div", { className: layout_module_css_1.default.homeLink__container, children: (0, jsx_runtime_1.jsx)(button_1.ButtonLink, { mode: "transparent", href: backLink.href, title: t(backLink.label), icon: { left: (0, jsx_runtime_1.jsx)(icon_1.MonoIcon, { icon: "navigation/ArrowLeft" }) } }) })), (0, jsx_runtime_1.jsxs)("div", { className: layout_module_css_1.default.layout__container, children: [(0, jsx_runtime_1.jsx)(typography_1.Typo.h2, { textType: "heading__2xl", children: t(PageText.Contact.contactPageLayout.title) }), (0, jsx_runtime_1.jsx)("nav", { className: layout_module_css_1.default.contact_page_navigator__container, children: visiblePages.map((contactPage, index) => {
|
|
93
96
|
const isActive = pathname.includes(contactPage.href);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
const pageId = getPageIdFromHref(contactPage.href);
|
|
98
|
+
const externalUrl = pagesOverrides?.externalUrlByPageId?.[pageId];
|
|
99
|
+
const linkClassName = (0, css_1.andIf)({
|
|
100
|
+
[layout_module_css_1.default.contact_page_navigator__link]: true,
|
|
101
|
+
[layout_module_css_1.default.contact_page_navigator__activePage]: isActive,
|
|
102
|
+
});
|
|
103
|
+
if (externalUrl) {
|
|
104
|
+
return ((0, jsx_runtime_1.jsxs)("a", { href: externalUrl, target: "_blank", rel: "noreferrer", className: linkClassName, children: [(0, jsx_runtime_1.jsx)(icon_1.MonoIcon, { size: "large", icon: contactPage.icon }), (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(contactPage.title) })] }, index));
|
|
105
|
+
}
|
|
106
|
+
return ((0, jsx_runtime_1.jsxs)(link_1.default, { shallow: true, href: contactPage.href, className: linkClassName, children: [(0, jsx_runtime_1.jsx)(icon_1.MonoIcon, { size: "large", icon: contactPage.icon }), (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(contactPage.title) })] }, index));
|
|
107
|
+
}) })] })] }), children, displayPrivacyAndTerms(selectedContactPage) && ((0, jsx_runtime_1.jsx)("div", { className: layout_module_css_1.default.privacyAndTerms, children: (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__s__strong", children: t(PageText.Contact.contactPageLayout.privacyAndTerms) }) }))] }));
|
|
99
108
|
}
|
|
100
109
|
exports.default = ContactPageLayout;
|
|
@@ -44,9 +44,30 @@
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
@media (max-width: 600px) {
|
|
47
|
+
.layout__container {
|
|
48
|
+
padding: token('spacing.medium') 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.contact_page_navigator__container {
|
|
52
|
+
display: grid;
|
|
53
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
54
|
+
gap: token('spacing.small');
|
|
55
|
+
}
|
|
56
|
+
|
|
47
57
|
.contact_page_navigator__link {
|
|
48
|
-
width:
|
|
49
|
-
|
|
58
|
+
width: 100%;
|
|
59
|
+
padding: token('spacing.large') token('spacing.medium');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.contact_page_navigator__link:last-child:nth-child(odd) {
|
|
63
|
+
grid-column: 1 / -1;
|
|
64
|
+
justify-self: center;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@media (max-width: 320px) {
|
|
69
|
+
.contact_page_navigator__container {
|
|
70
|
+
grid-template-columns: 1fr;
|
|
50
71
|
}
|
|
51
72
|
}
|
|
52
73
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Departure = {
|
|
2
|
+
departureTime: string;
|
|
3
|
+
tripId: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function formatDepartureTime(departureTime: string): string;
|
|
6
|
+
export declare function useDepartures(date?: string, lineId?: string, fromStopId?: string, toStopId?: string): {
|
|
7
|
+
departures: Departure[];
|
|
8
|
+
isLoading: boolean;
|
|
9
|
+
error: any;
|
|
10
|
+
};
|
|
11
|
+
export declare function useDeparturesEndpointConfigured(): boolean;
|
|
12
|
+
//# sourceMappingURL=use-departures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-departures.d.ts","sourceRoot":"","sources":["../../src/lines/use-departures.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAKjE;AAID,wBAAgB,aAAa,CAC3B,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM;;;;EAoBlB;AAED,wBAAgB,+BAA+B,IAAI,OAAO,CAGzD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.formatDepartureTime = formatDepartureTime;
|
|
7
|
+
exports.useDepartures = useDepartures;
|
|
8
|
+
exports.useDeparturesEndpointConfigured = useDeparturesEndpointConfigured;
|
|
9
|
+
const swr_1 = __importDefault(require("swr"));
|
|
10
|
+
const api_browser_1 = require("../modules/api-browser");
|
|
11
|
+
const config_1 = require("../modules/config");
|
|
12
|
+
function formatDepartureTime(departureTime) {
|
|
13
|
+
// GTFS departure_time is HH:MM:SS, possibly >24h for post-midnight trips
|
|
14
|
+
const parts = departureTime.split(':');
|
|
15
|
+
if (parts.length < 2)
|
|
16
|
+
return departureTime;
|
|
17
|
+
return `${parts[0]}:${parts[1]}`;
|
|
18
|
+
}
|
|
19
|
+
function useDepartures(date, lineId, fromStopId, toStopId) {
|
|
20
|
+
const apiConfig = (0, config_1.useApiConfig)();
|
|
21
|
+
const endpoint = apiConfig.endpoints.departures;
|
|
22
|
+
const key = endpoint && date && lineId && fromStopId && toStopId
|
|
23
|
+
? `${endpoint}?date=${encodeURIComponent(date)}&lineId=${encodeURIComponent(lineId)}&fromStopId=${encodeURIComponent(fromStopId)}&toStopId=${encodeURIComponent(toStopId)}`
|
|
24
|
+
: null;
|
|
25
|
+
const { data, error, isLoading } = (0, swr_1.default)(key, api_browser_1.swrFetcher);
|
|
26
|
+
return {
|
|
27
|
+
departures: data?.departures ?? [],
|
|
28
|
+
isLoading,
|
|
29
|
+
error,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function useDeparturesEndpointConfigured() {
|
|
33
|
+
const apiConfig = (0, config_1.useApiConfig)();
|
|
34
|
+
return !!apiConfig.endpoints.departures;
|
|
35
|
+
}
|