@mrfylke/contact-form 0.1.33 → 0.1.35
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 +0 -22
- package/lib/commoneEvents.d.ts +1 -1
- package/lib/commoneEvents.d.ts.map +1 -1
- package/lib/components/form/date-selector.d.ts +4 -1
- package/lib/components/form/date-selector.d.ts.map +1 -1
- package/lib/components/form/date-selector.js +2 -2
- package/lib/components/form/form.module.css +0 -74
- package/lib/components/form/input.d.ts +2 -6
- package/lib/components/form/input.d.ts.map +1 -1
- package/lib/components/form/input.js +7 -22
- package/lib/components/form/time-selector.d.ts.map +1 -1
- package/lib/components/form/time-selector.js +1 -1
- package/lib/components/icon/generated-icons.js +8 -8
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/journey-info/journeyInfoStateMachine.d.ts +2 -2
- package/lib/layouts/contact-pages.d.ts.map +1 -1
- package/lib/layouts/contact-pages.js +7 -2
- package/lib/lines/use-lines.d.ts +1 -0
- package/lib/lines/use-lines.d.ts.map +1 -1
- package/lib/lines/use-lines.js +1 -0
- package/lib/lost-property/LostPropertyForm.d.ts +6 -0
- package/lib/lost-property/LostPropertyForm.d.ts.map +1 -1
- package/lib/lost-property/LostPropertyForm.js +54 -12
- package/lib/lost-property/LostPropertyMachine.d.ts +5 -4
- package/lib/lost-property/LostPropertyMachine.d.ts.map +1 -1
- package/lib/lost-property/LostPropertyMachine.js +5 -1
- package/lib/lost-property/index.d.ts.map +1 -1
- package/lib/lost-property/index.js +40 -3
- package/lib/means-of-transport/means-of-transport-form-machine.d.ts +2 -2
- package/lib/modules/api-browser/index.d.ts +1 -1
- package/lib/modules/api-browser/index.d.ts.map +1 -1
- package/lib/modules/api-browser/index.js +5 -1
- package/lib/modules/config/context.d.ts.map +1 -1
- package/lib/modules/config/context.js +1 -4
- package/lib/modules/config/theme-adapter.d.ts.map +1 -1
- package/lib/modules/config/theme-adapter.js +2 -0
- package/lib/modules/config/types.d.ts +33 -4
- package/lib/modules/config/types.d.ts.map +1 -1
- package/lib/modules/transport-mode/utils.d.ts +2 -2
- package/lib/modules/transport-mode/utils.d.ts.map +1 -1
- package/lib/refund/events.d.ts +3 -3
- 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 +9 -2
- package/lib/refund/forms/refund-and-travel-guarantee/pre-purchased-ticket-refund-form/index.d.ts +11 -0
- package/lib/refund/forms/refund-and-travel-guarantee/pre-purchased-ticket-refund-form/index.d.ts.map +1 -0
- package/lib/refund/forms/refund-and-travel-guarantee/pre-purchased-ticket-refund-form/index.js +159 -0
- package/lib/refund/forms/refund-and-travel-guarantee/pre-purchased-ticket-refund-form/pre-purchased-ticket-refund-form.module.css +73 -0
- package/lib/refund/forms/refund-and-travel-guarantee/refundCarForm.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/refundCarForm.js +2 -2
- package/lib/refund/forms/refund-and-travel-guarantee/refundTaxiForm.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/refundTaxiForm.js +2 -2
- package/lib/refund/forms/refund-ticket/appTicketRefund.d.ts.map +1 -1
- package/lib/refund/forms/refund-ticket/appTicketRefund.js +2 -7
- package/lib/refund/forms/refund-ticket/otherTicketRefund.d.ts.map +1 -1
- package/lib/refund/forms/refund-ticket/otherTicketRefund.js +4 -10
- package/lib/refund/refundFormMachine.d.ts +38 -7
- package/lib/refund/refundFormMachine.d.ts.map +1 -1
- package/lib/refund/refundFormMachine.js +46 -0
- package/lib/server/journey-planner/entur-client.d.ts +2 -1
- package/lib/server/journey-planner/entur-client.d.ts.map +1 -1
- package/lib/ticket-control/forms/feeComplaintForm.js +4 -10
- package/lib/ticket-control/forms/postponePayment.d.ts.map +1 -1
- package/lib/ticket-control/forms/postponePayment.js +2 -6
- package/lib/ticket-control/ticket-control-form-machine.d.ts +2 -2
- package/lib/ticketing/forms/app/appAccountForm.d.ts.map +1 -1
- package/lib/ticketing/forms/app/appAccountForm.js +1 -3
- package/lib/ticketing/forms/app/appTicketingForm.d.ts.map +1 -1
- package/lib/ticketing/forms/app/appTicketingForm.js +2 -8
- package/lib/ticketing/forms/travel-card/travelCardQuestionForm.d.ts.map +1 -1
- package/lib/ticketing/forms/travel-card/travelCardQuestionForm.js +5 -8
- package/lib/ticketing/forms/webshop/webshopAccountForm.d.ts.map +1 -1
- package/lib/ticketing/forms/webshop/webshopAccountForm.js +1 -3
- package/lib/ticketing/forms/webshop/webshopTicketingForm.d.ts.map +1 -1
- package/lib/ticketing/forms/webshop/webshopTicketingForm.js +2 -7
- package/lib/ticketing/ticketingStateMachine.d.ts +2 -2
- package/lib/translations/commons.d.ts +1 -1
- package/lib/translations/commons.d.ts.map +1 -1
- package/lib/translations/commons.js +3 -1
- package/lib/translations/language-context.js +1 -1
- package/lib/translations/pages/contact.d.ts +31 -9
- package/lib/translations/pages/contact.d.ts.map +1 -1
- package/lib/translations/pages/contact.js +36 -18
- package/lib/translations/translations-context.d.ts +11 -4
- package/lib/translations/translations-context.d.ts.map +1 -1
- package/lib/translations/translations-context.js +18 -11
- package/lib/types/submit-payloads.d.ts +12 -0
- package/lib/types/submit-payloads.d.ts.map +1 -1
- package/lib/utils/rich-text.d.ts +2 -2
- package/lib/utils/rich-text.js +8 -3
- package/lib/utils.d.ts +56 -3
- package/lib/utils.d.ts.map +1 -1
- package/lib/validation/commonInputValidator.d.ts +1 -1
- package/lib/validation/commonInputValidator.d.ts.map +1 -1
- package/lib/validation/commonInputValidator.js +3 -3
- package/lib/validation/validationRules.d.ts +2 -0
- package/lib/validation/validationRules.d.ts.map +1 -1
- package/lib/validation/validationRules.js +26 -1
- package/package.json +14 -8
- package/lib/components/form/description-modal.d.ts +0 -13
- package/lib/components/form/description-modal.d.ts.map +0 -1
- package/lib/components/form/description-modal.js +0 -44
package/README.md
CHANGED
|
@@ -108,28 +108,6 @@ const onSubmit = async (
|
|
|
108
108
|
};
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
-
See `FormSlug` for the full set of possible values.
|
|
112
|
-
|
|
113
|
-
### Routing submissions to different endpoints
|
|
114
|
-
|
|
115
|
-
```ts
|
|
116
|
-
const onSubmit = async (slug: FormSlug, state) => {
|
|
117
|
-
const endpointMap: Record<FormSlug, string> = {
|
|
118
|
-
'ticket-control': '/api/contact/ticket-control',
|
|
119
|
-
refund: '/api/contact/refund',
|
|
120
|
-
'means-of-transport': '/api/contact/means-of-transport',
|
|
121
|
-
ticketing: '/api/contact/ticketing',
|
|
122
|
-
'journey-info': '/api/contact/journey-info',
|
|
123
|
-
'lost-property': '/api/contact/lost-property',
|
|
124
|
-
};
|
|
125
|
-
return fetch(endpointMap[slug], {
|
|
126
|
-
method: 'POST',
|
|
127
|
-
headers: { 'Content-Type': 'application/json' },
|
|
128
|
-
body: JSON.stringify(state),
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
```
|
|
132
|
-
|
|
133
111
|
### Payload types
|
|
134
112
|
|
|
135
113
|
Import these in your API handlers to type-check incoming data:
|
package/lib/commoneEvents.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const commonEvents: {
|
|
|
5
5
|
} | {
|
|
6
6
|
type: "ON_INPUT_CHANGE";
|
|
7
7
|
inputName: "address" | "attachments" | "bankAccountNumber" | "city" | "date" | "email" | "firstName" | "feedback" | "IBAN" | "lastName" | "phoneNumber" | "postalCode" | "SWIFT" | "toStop" | "fromStop" | "plannedDepartureTime" | "tripId";
|
|
8
|
-
value:
|
|
8
|
+
value: unknown;
|
|
9
9
|
} | {
|
|
10
10
|
type: "ON_TRANSPORTMODE_CHANGE";
|
|
11
11
|
value: TransportModeType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commoneEvents.d.ts","sourceRoot":"","sources":["../src/commoneEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AAEzB,eAAO,MAAM,YAAY,EACrB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IACE,IAAI,EAAE,iBAAiB,CAAC;IACxB,SAAS,EACL,SAAS,GACT,aAAa,GACb,mBAAmB,GACnB,MAAM,GACN,MAAM,GACN,OAAO,GACP,WAAW,GACX,UAAU,GACV,MAAM,GACN,UAAU,GACV,aAAa,GACb,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,UAAU,GACV,sBAAsB,GACtB,QAAQ,CAAC;IACb,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"commoneEvents.d.ts","sourceRoot":"","sources":["../src/commoneEvents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AAEzB,eAAO,MAAM,YAAY,EACrB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IACE,IAAI,EAAE,iBAAiB,CAAC;IACxB,SAAS,EACL,SAAS,GACT,aAAa,GACb,mBAAmB,GACnB,MAAM,GACN,MAAM,GACN,OAAO,GACP,WAAW,GACX,UAAU,GACV,MAAM,GACN,UAAU,GACV,aAAa,GACb,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,UAAU,GACV,sBAAsB,GACtB,QAAQ,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,GACD;IACE,IAAI,EAAE,yBAAyB,CAAC;IAChC,KAAK,EAAE,iBAAiB,CAAC;CAC1B,GACD;IACE,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,IAAI,GAAG,SAAS,CAAC;CACzB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DateValue } from '@internationalized/date';
|
|
1
2
|
import { TranslatedString } from '../../translations';
|
|
2
3
|
export type DateSelectorProps = {
|
|
3
4
|
id: string;
|
|
@@ -5,7 +6,9 @@ export type DateSelectorProps = {
|
|
|
5
6
|
value?: string;
|
|
6
7
|
isRequired?: boolean;
|
|
7
8
|
errorMessage?: TranslatedString;
|
|
9
|
+
minValue?: DateValue;
|
|
10
|
+
maxValue?: DateValue;
|
|
8
11
|
onChange: (value: string) => void;
|
|
9
12
|
};
|
|
10
|
-
export default function DateSelector({ id, label, value, isRequired, errorMessage, onChange, }: DateSelectorProps): import("react").JSX.Element;
|
|
13
|
+
export default function DateSelector({ id, label, value, isRequired, errorMessage, minValue, maxValue, onChange, }: DateSelectorProps): import("react").JSX.Element;
|
|
11
14
|
//# sourceMappingURL=date-selector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-selector.d.ts","sourceRoot":"","sources":["../../../src/components/form/date-selector.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"date-selector.d.ts","sourceRoot":"","sources":["../../../src/components/form/date-selector.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAmB,MAAM,yBAAyB,CAAC;AAgBrE,OAAO,EAAE,gBAAgB,EAAkB,MAAM,oBAAoB,CAAC;AAItE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,EAAE,EACF,KAAK,EACL,KAAK,EACL,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,EAAE,iBAAiB,+BA4EnB"}
|
|
@@ -13,11 +13,11 @@ const form_component_label_1 = __importDefault(require("./form-component-label")
|
|
|
13
13
|
const translations_1 = require("../../translations");
|
|
14
14
|
const icon_1 = require("../icon");
|
|
15
15
|
const error_message_1 = require("../error-message");
|
|
16
|
-
function DateSelector({ id, label, value, isRequired, errorMessage, onChange, }) {
|
|
16
|
+
function DateSelector({ id, label, value, isRequired, errorMessage, minValue, maxValue, onChange, }) {
|
|
17
17
|
const { t } = (0, translations_1.useTranslation)();
|
|
18
18
|
const zonedDateTime = (0, react_1.useMemo)(() => (value ? (0, date_1.fromDate)(new Date(value), 'Europe/Oslo') : null), [value]);
|
|
19
19
|
return ((0, jsx_runtime_1.jsxs)("div", { className: form_module_css_1.default.dateSelectorContainer, children: [(0, jsx_runtime_1.jsxs)(react_aria_components_1.DatePicker, { granularity: "day", value: zonedDateTime, onChange: (e) => e && onChange(e.toString().slice(0, 10)), onOpenChange: (isOpen) => {
|
|
20
20
|
if (isOpen && !value)
|
|
21
21
|
onChange((0, date_1.today)('Europe/Oslo').toString());
|
|
22
|
-
}, className: form_module_css_1.default.dateSelector, shouldForceLeadingZeros: true, "aria-label": label, "aria-labelledby": `label-${id}`, children: [(0, jsx_runtime_1.jsx)(form_component_label_1.default, { label: label, id: `label-${id}`, isRequired: isRequired }), (0, jsx_runtime_1.jsxs)(react_aria_components_1.Group, { className: form_module_css_1.default.calendarSelectorGroup, children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.DateInput, { className: form_module_css_1.default.dateSelectorInput, children: (segment) => ((0, jsx_runtime_1.jsx)(react_aria_components_1.DateSegment, { segment: segment, className: form_module_css_1.default.dateSelectorSegment })) }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Button, { className: form_module_css_1.default.calendarButton, children: (0, jsx_runtime_1.jsx)(icon_1.MonoIcon, { icon: "time/Date" }) })] }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Popover, { className: form_module_css_1.default.calendarDialog, placement: "bottom right", children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Dialog, { children: (0, jsx_runtime_1.jsxs)(react_aria_components_1.Calendar, { children: [(0, jsx_runtime_1.jsxs)("header", { className: form_module_css_1.default.calendarDialog__header, children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Button, { slot: "previous", className: form_module_css_1.default.calendarDialog__headerButtons, children: (0, jsx_runtime_1.jsx)(icon_1.MonoIcon, { icon: "navigation/ArrowLeft" }) }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Heading, { className: form_module_css_1.default.calendarDialog__title }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Button, { slot: "next", className: form_module_css_1.default.calendarDialog__headerButtons, children: (0, jsx_runtime_1.jsx)(icon_1.MonoIcon, { icon: "navigation/ArrowRight" }) })] }), (0, jsx_runtime_1.jsx)(react_aria_components_1.CalendarGrid, { className: form_module_css_1.default.calendarGrid, children: (date) => ((0, jsx_runtime_1.jsx)(react_aria_components_1.CalendarCell, { date: date, className: form_module_css_1.default.calendarGrid__cell })) })] }) }) })] }), (0, jsx_runtime_1.jsx)("input", { id: `date_selector__${id}`, type: "hidden", value: value ?? '' }), errorMessage && (0, jsx_runtime_1.jsx)(error_message_1.ErrorMessage, { message: t(errorMessage) })] }));
|
|
22
|
+
}, minValue: minValue, maxValue: maxValue, className: form_module_css_1.default.dateSelector, shouldForceLeadingZeros: true, "aria-label": label, "aria-labelledby": `label-${id}`, children: [(0, jsx_runtime_1.jsx)(form_component_label_1.default, { label: label, id: `label-${id}`, isRequired: isRequired }), (0, jsx_runtime_1.jsxs)(react_aria_components_1.Group, { className: form_module_css_1.default.calendarSelectorGroup, children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.DateInput, { className: form_module_css_1.default.dateSelectorInput, children: (segment) => ((0, jsx_runtime_1.jsx)(react_aria_components_1.DateSegment, { segment: segment, className: form_module_css_1.default.dateSelectorSegment })) }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Button, { className: form_module_css_1.default.calendarButton, children: (0, jsx_runtime_1.jsx)(icon_1.MonoIcon, { icon: "time/Date" }) })] }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Popover, { className: form_module_css_1.default.calendarDialog, placement: "bottom right", children: (0, jsx_runtime_1.jsx)(react_aria_components_1.Dialog, { children: (0, jsx_runtime_1.jsxs)(react_aria_components_1.Calendar, { children: [(0, jsx_runtime_1.jsxs)("header", { className: form_module_css_1.default.calendarDialog__header, children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Button, { slot: "previous", className: form_module_css_1.default.calendarDialog__headerButtons, children: (0, jsx_runtime_1.jsx)(icon_1.MonoIcon, { icon: "navigation/ArrowLeft" }) }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Heading, { className: form_module_css_1.default.calendarDialog__title }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Button, { slot: "next", className: form_module_css_1.default.calendarDialog__headerButtons, children: (0, jsx_runtime_1.jsx)(icon_1.MonoIcon, { icon: "navigation/ArrowRight" }) })] }), (0, jsx_runtime_1.jsx)(react_aria_components_1.CalendarGrid, { className: form_module_css_1.default.calendarGrid, children: (date) => ((0, jsx_runtime_1.jsx)(react_aria_components_1.CalendarCell, { date: date, className: form_module_css_1.default.calendarGrid__cell })) })] }) }) })] }), (0, jsx_runtime_1.jsx)("input", { id: `date_selector__${id}`, type: "hidden", value: value ?? '' }), errorMessage && (0, jsx_runtime_1.jsx)(error_message_1.ErrorMessage, { message: t(errorMessage) })] }));
|
|
23
23
|
}
|
|
@@ -131,32 +131,6 @@
|
|
|
131
131
|
background: token('color.background.neutral.1.background');
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
.label_container {
|
|
135
|
-
display: flex;
|
|
136
|
-
justify-content: space-between;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/* Icon button */
|
|
140
|
-
.iconButton {
|
|
141
|
-
background: transparent;
|
|
142
|
-
padding: 0;
|
|
143
|
-
cursor: pointer;
|
|
144
|
-
display: flex;
|
|
145
|
-
align-items: center;
|
|
146
|
-
border: none;
|
|
147
|
-
border-radius: 50%;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
.iconButton:focus {
|
|
151
|
-
outline: 2px solid token('color.interactive.2.outline.background');
|
|
152
|
-
outline-offset: 2px;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.iconButton:hover {
|
|
156
|
-
background-color: token('color.interactive.2.hover.background');
|
|
157
|
-
color: token('color.interactive.2.hover.foreground.primary');
|
|
158
|
-
}
|
|
159
|
-
|
|
160
134
|
/* textare */
|
|
161
135
|
.textarea_container {
|
|
162
136
|
display: flex;
|
|
@@ -229,54 +203,6 @@
|
|
|
229
203
|
gap: token('spacing.small');
|
|
230
204
|
}
|
|
231
205
|
|
|
232
|
-
/* modal */
|
|
233
|
-
.modal_wrapper {
|
|
234
|
-
position: fixed;
|
|
235
|
-
z-index: 200;
|
|
236
|
-
top: 0;
|
|
237
|
-
left: 0;
|
|
238
|
-
bottom: 0;
|
|
239
|
-
right: 0;
|
|
240
|
-
background: rgba(0, 0, 0, 0.5);
|
|
241
|
-
display: flex;
|
|
242
|
-
flex-direction: column;
|
|
243
|
-
justify-content: center;
|
|
244
|
-
align-items: center;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
.modal_content {
|
|
248
|
-
position: relative;
|
|
249
|
-
display: flex;
|
|
250
|
-
flex-direction: column;
|
|
251
|
-
max-width: 32rem;
|
|
252
|
-
padding: token('spacing.large');
|
|
253
|
-
border: token('border.width.medium') solid
|
|
254
|
-
token('color.interactive.2.outline.background'); /* Use border property */
|
|
255
|
-
box-shadow: inset 0 0 0 token('border.width.medium')
|
|
256
|
-
token('color.interactive.2.outline.background');
|
|
257
|
-
color: token('color.background.neutral.0.foreground.primary');
|
|
258
|
-
background-color: token('color.background.neutral.0.background');
|
|
259
|
-
border-radius: token('border.radius.regular');
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
.modal_content > * + * {
|
|
263
|
-
margin-top: token('spacing.small');
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
.modal_header {
|
|
267
|
-
display: flex;
|
|
268
|
-
justify-content: space-between;
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
.modal__rules_list {
|
|
272
|
-
padding: token('spacing.medium');
|
|
273
|
-
padding-left: token('spacing.xLarge');
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
.modal__rules_list > li {
|
|
277
|
-
padding: token('spacing.xSmall') 0;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
206
|
/* select and searchable-select*/
|
|
281
207
|
.select__select_container,
|
|
282
208
|
.searchable_select__comboBox {
|
|
@@ -3,15 +3,11 @@ import { TranslatedString } from '../../translations';
|
|
|
3
3
|
type InputProps = {
|
|
4
4
|
id: string;
|
|
5
5
|
label: string;
|
|
6
|
-
|
|
7
|
-
description?: string;
|
|
8
|
-
instruction?: string;
|
|
9
|
-
bulletPoints?: string[];
|
|
10
|
-
};
|
|
6
|
+
description?: string;
|
|
11
7
|
isRequired?: boolean;
|
|
12
8
|
errorMessage?: TranslatedString;
|
|
13
9
|
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
14
10
|
} & React.JSX.IntrinsicElements['input'];
|
|
15
|
-
export declare const Input: ({ id, label, errorMessage, type, name, checked, value,
|
|
11
|
+
export declare const Input: ({ id, label, description, errorMessage, type, name, checked, value, disabled, onChange, placeholder, isRequired, }: InputProps) => React.JSX.Element;
|
|
16
12
|
export default Input;
|
|
17
13
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/components/form/input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/components/form/input.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAkB,MAAM,oBAAoB,CAAC;AAKtE,KAAK,UAAU,GAAG;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAC3D,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAEzC,eAAO,MAAM,KAAK,GAAI,oHAanB,UAAU,sBA+CZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -6,38 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Input = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const form_module_css_1 = __importDefault(require("./form.module.css"));
|
|
9
|
-
const react_1 = require("react");
|
|
10
|
-
const description_modal_1 = __importDefault(require("./description-modal"));
|
|
11
9
|
const form_component_label_1 = __importDefault(require("./form-component-label"));
|
|
12
10
|
const translations_1 = require("../../translations");
|
|
13
11
|
const css_1 = require("../../utils/css");
|
|
14
|
-
const button_1 = require("../button");
|
|
15
|
-
const icon_1 = require("../icon");
|
|
16
12
|
const error_message_1 = require("../error-message");
|
|
17
|
-
const
|
|
18
|
-
|
|
13
|
+
const typography_1 = require("../typography");
|
|
14
|
+
const Input = ({ id, label, description, errorMessage, type, name, checked, value, disabled, onChange, placeholder, isRequired, }) => {
|
|
19
15
|
const { t } = (0, translations_1.useTranslation)();
|
|
20
|
-
const [isModalOpen, setIsModalOpen] = (0, react_1.useState)(false);
|
|
21
|
-
const isModalContentProvided = hasModalContent(modalContent);
|
|
22
|
-
const displayDescriptionModal = isModalOpen && isModalContentProvided;
|
|
23
|
-
const toggleModalState = () => {
|
|
24
|
-
setIsModalOpen(!isModalOpen);
|
|
25
|
-
};
|
|
26
16
|
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, css_1.andIf)({
|
|
27
17
|
[form_module_css_1.default.container]: true,
|
|
28
18
|
[form_module_css_1.default.rowDisplay]: type === 'checkbox' || type === 'submit',
|
|
29
|
-
}), children: [(0, jsx_runtime_1.
|
|
30
|
-
'aria-label': t(PageText.Contact.components.modal.moreInformation(label)),
|
|
31
|
-
} }))] }), (0, jsx_runtime_1.jsx)("input", { id: `input__${id}`, type: type, name: name, className: (0, css_1.andIf)({
|
|
19
|
+
}), children: [(0, jsx_runtime_1.jsx)(form_component_label_1.default, { label: label, htmlFor: `input__${id}`, disabled: disabled, isRequired: isRequired }), description && ((0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__s", id: `description-input__${id}`, children: description })), (0, jsx_runtime_1.jsx)("input", { id: `input__${id}`, type: type, name: name, className: (0, css_1.andIf)({
|
|
32
20
|
[form_module_css_1.default.input]: true,
|
|
33
21
|
[form_module_css_1.default.input__error]: !!errorMessage,
|
|
34
|
-
}), checked: checked, value: value, disabled: disabled, onChange: onChange, placeholder: placeholder, "aria-invalid": !!errorMessage, "aria-describedby":
|
|
22
|
+
}), checked: checked, value: value, disabled: disabled, onChange: onChange, placeholder: placeholder, "aria-invalid": !!errorMessage, "aria-describedby": (0, css_1.andIf)({
|
|
23
|
+
[`description-input__${id}`]: !!description,
|
|
24
|
+
[`error-input__${id}`]: !!errorMessage,
|
|
25
|
+
}) || undefined }), errorMessage && ((0, jsx_runtime_1.jsx)(error_message_1.ErrorMessage, { message: t(errorMessage), id: `error-input__${id}` }))] }));
|
|
35
26
|
};
|
|
36
27
|
exports.Input = Input;
|
|
37
28
|
exports.default = exports.Input;
|
|
38
|
-
function hasModalContent(content) {
|
|
39
|
-
return !!(content &&
|
|
40
|
-
(content.description ||
|
|
41
|
-
content.instruction ||
|
|
42
|
-
(content.bulletPoints && content.bulletPoints?.length > 0)));
|
|
43
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-selector.d.ts","sourceRoot":"","sources":["../../../src/components/form/time-selector.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAkB,MAAM,oBAAoB,CAAC;AAGtE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,EAAE,EACF,KAAK,EACL,KAAK,EACL,UAAU,EACV,YAAY,EACZ,QAAQ,GACT,EAAE,iBAAiB,+
|
|
1
|
+
{"version":3,"file":"time-selector.d.ts","sourceRoot":"","sources":["../../../src/components/form/time-selector.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAkB,MAAM,oBAAoB,CAAC;AAGtE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,EAAE,EACF,KAAK,EACL,KAAK,EACL,UAAU,EACV,YAAY,EACZ,QAAQ,GACT,EAAE,iBAAiB,+BAuCnB"}
|
|
@@ -14,7 +14,7 @@ const translations_1 = require("../../translations");
|
|
|
14
14
|
const error_message_1 = require("../error-message");
|
|
15
15
|
function TimeSelector({ id, label, value, isRequired, errorMessage, onChange, }) {
|
|
16
16
|
const { t } = (0, translations_1.useTranslation)();
|
|
17
|
-
const parsedValue = (0, react_1.useMemo)(() => (value ? (0, date_1.parseTime)(value) :
|
|
17
|
+
const parsedValue = (0, react_1.useMemo)(() => (value ? (0, date_1.parseTime)(value) : null), [value]);
|
|
18
18
|
return ((0, jsx_runtime_1.jsxs)("div", { className: form_module_css_1.default.timeSelectorContainer, children: [(0, jsx_runtime_1.jsxs)(react_aria_components_1.TimeField, { value: parsedValue, onChange: (change) => {
|
|
19
19
|
if (!change)
|
|
20
20
|
return;
|
|
@@ -1793,32 +1793,32 @@ exports.icons = {
|
|
|
1793
1793
|
"id": "favicon"
|
|
1794
1794
|
},
|
|
1795
1795
|
"status/Check": {
|
|
1796
|
-
"relative": "colors/icons/status/
|
|
1797
|
-
"absolute": "/home/runner/work/mrfylke-contact-form/mrfylke-contact-form/packages/contact-form/.tmp-icon-assets/colors/icons/status/
|
|
1796
|
+
"relative": "colors/icons/status/dark/Check.svg",
|
|
1797
|
+
"absolute": "/home/runner/work/mrfylke-contact-form/mrfylke-contact-form/packages/contact-form/.tmp-icon-assets/colors/icons/status/dark/Check.svg",
|
|
1798
1798
|
"assetType": "colors",
|
|
1799
1799
|
"colorType": "icons",
|
|
1800
1800
|
"darkable": true,
|
|
1801
1801
|
"id": "status/Check"
|
|
1802
1802
|
},
|
|
1803
1803
|
"status/Error": {
|
|
1804
|
-
"relative": "colors/icons/status/
|
|
1805
|
-
"absolute": "/home/runner/work/mrfylke-contact-form/mrfylke-contact-form/packages/contact-form/.tmp-icon-assets/colors/icons/status/
|
|
1804
|
+
"relative": "colors/icons/status/dark/Error.svg",
|
|
1805
|
+
"absolute": "/home/runner/work/mrfylke-contact-form/mrfylke-contact-form/packages/contact-form/.tmp-icon-assets/colors/icons/status/dark/Error.svg",
|
|
1806
1806
|
"assetType": "colors",
|
|
1807
1807
|
"colorType": "icons",
|
|
1808
1808
|
"darkable": true,
|
|
1809
1809
|
"id": "status/Error"
|
|
1810
1810
|
},
|
|
1811
1811
|
"status/Info": {
|
|
1812
|
-
"relative": "colors/icons/status/
|
|
1813
|
-
"absolute": "/home/runner/work/mrfylke-contact-form/mrfylke-contact-form/packages/contact-form/.tmp-icon-assets/colors/icons/status/
|
|
1812
|
+
"relative": "colors/icons/status/dark/Info.svg",
|
|
1813
|
+
"absolute": "/home/runner/work/mrfylke-contact-form/mrfylke-contact-form/packages/contact-form/.tmp-icon-assets/colors/icons/status/dark/Info.svg",
|
|
1814
1814
|
"assetType": "colors",
|
|
1815
1815
|
"colorType": "icons",
|
|
1816
1816
|
"darkable": true,
|
|
1817
1817
|
"id": "status/Info"
|
|
1818
1818
|
},
|
|
1819
1819
|
"status/Warning": {
|
|
1820
|
-
"relative": "colors/icons/status/
|
|
1821
|
-
"absolute": "/home/runner/work/mrfylke-contact-form/mrfylke-contact-form/packages/contact-form/.tmp-icon-assets/colors/icons/status/
|
|
1820
|
+
"relative": "colors/icons/status/dark/Warning.svg",
|
|
1821
|
+
"absolute": "/home/runner/work/mrfylke-contact-form/mrfylke-contact-form/packages/contact-form/.tmp-icon-assets/colors/icons/status/dark/Warning.svg",
|
|
1822
1822
|
"assetType": "colors",
|
|
1823
1823
|
"colorType": "icons",
|
|
1824
1824
|
"darkable": true,
|
package/lib/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { useContactFormConfig, useThemeConfig, useApiConfig, buildEnabledPageIds
|
|
|
2
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
|
-
export type { ContactFormConfig, Theme, ThemeColors, ContrastColor, TransportColors, InteractiveColor, StatusColors, ApiConfig, LayoutConfig, LayoutLinkLabel, PagesConfig, FormSchemaOverrides, FormSlug, ContactPage, PageId, ExtraPageId, ExtraContactPage, EnabledPageIdsList, } from './modules/config';
|
|
5
|
+
export type { ContactFormConfig, Theme, ThemeColors, ContrastColor, TransportColors, InteractiveColor, StatusColors, ApiConfig, LayoutConfig, LayoutLinkLabel, PagesConfig, FormSchemaOverrides, LostPropertyMode, FormSlug, ContactPage, PageId, ExtraPageId, ExtraContactPage, EnabledPageIdsList, } from './modules/config';
|
|
6
6
|
export { ThemeProvider, useTheme, useHtmlDarkMode } from './modules/theme';
|
|
7
7
|
export type { MonoIcons } from './components/icon';
|
|
8
8
|
export { ButtonLink, Button } from './components/button';
|
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,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,6BAA6B,EAC7B,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,iBAAiB,EACjB,yBAAyB,EACzB,UAAU,EACV,oBAAoB,GACrB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,YAAY,EACV,iBAAiB,EACjB,KAAK,EACL,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,eAAe,EACf,WAAW,EACX,mBAAmB,EACnB,QAAQ,EACR,WAAW,EACX,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE3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ACf,uBAAuB,EACvB,yBAAyB,EACzB,oBAAoB,EACpB,KAAK,yBAAyB,GAC/B,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,UAAU,CAAC;AACpD,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACjG,OAAO,EAAE,OAAO,IAAI,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,cAAc,gBAAgB,CAAC;AAG/B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -26,7 +26,7 @@ export declare function createJourneyInfoStateMachine(onSubmit: (slug: FormSlug,
|
|
|
26
26
|
} | {
|
|
27
27
|
type: "ON_INPUT_CHANGE";
|
|
28
28
|
inputName: "address" | "attachments" | "bankAccountNumber" | "city" | "date" | "email" | "firstName" | "feedback" | "IBAN" | "lastName" | "phoneNumber" | "postalCode" | "SWIFT" | "toStop" | "fromStop" | "plannedDepartureTime" | "tripId";
|
|
29
|
-
value:
|
|
29
|
+
value: unknown;
|
|
30
30
|
} | {
|
|
31
31
|
type: "ON_TRANSPORTMODE_CHANGE";
|
|
32
32
|
value: import("..").TransportModeType;
|
|
@@ -103,7 +103,7 @@ export declare const journeyInfoStateMachine: import("xstate").StateMachine<Jour
|
|
|
103
103
|
} | {
|
|
104
104
|
type: "ON_INPUT_CHANGE";
|
|
105
105
|
inputName: "address" | "attachments" | "bankAccountNumber" | "city" | "date" | "email" | "firstName" | "feedback" | "IBAN" | "lastName" | "phoneNumber" | "postalCode" | "SWIFT" | "toStop" | "fromStop" | "plannedDepartureTime" | "tripId";
|
|
106
|
-
value:
|
|
106
|
+
value: unknown;
|
|
107
107
|
} | {
|
|
108
108
|
type: "ON_TRANSPORTMODE_CHANGE";
|
|
109
109
|
value: import("..").TransportModeType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contact-pages.d.ts","sourceRoot":"","sources":["../../src/layouts/contact-pages.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,IAAI,cAAc,EAC1B,gBAAgB,EAGjB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"contact-pages.d.ts","sourceRoot":"","sources":["../../src/layouts/contact-pages.ts"],"names":[],"mappings":"AACA,OAAO,EACL,QAAQ,IAAI,cAAc,EAC1B,gBAAgB,EAGjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUxE;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,WAAU,OAAO,cAA+B,KAC/C,WAAW,EAyDb,CAAC;AAEF,wBAAgB,eAAe,IAAI,WAAW,EAAE,CAI/C;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,EACjC,QAAQ,EAAE,OAAO,cAAc,GAC9B,WAAW,EAAE,CAMf;AAED,eAAO,MAAM,oBAAoB,GAAI,UAAU,MAAM,WACvB,CAAC;AAE/B,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,WAAW,EAAE,GAC1B,WAAW,GAAG,SAAS,CAGzB;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,iBAAiB,GACxB,gBAAgB,GAAG,SAAS,CAU9B;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,iBAAiB,GACxB,gBAAgB,GAAG,SAAS,CAG9B;AAID,eAAO,MAAM,sBAAsB,GAAI,cAAc,WAAW,YAG/D,CAAC"}
|
|
@@ -11,6 +11,7 @@ exports.getPageTitleForPathname = getPageTitleForPathname;
|
|
|
11
11
|
exports.useActiveContactPageTitle = useActiveContactPageTitle;
|
|
12
12
|
const navigation_1 = require("next/navigation");
|
|
13
13
|
const translations_1 = require("../translations");
|
|
14
|
+
const translations_context_1 = require("../translations/translations-context");
|
|
14
15
|
const config_1 = require("../modules/config");
|
|
15
16
|
const ticket_control_1 = __importDefault(require("../ticket-control"));
|
|
16
17
|
const refund_1 = __importDefault(require("../refund"));
|
|
@@ -102,11 +103,15 @@ function findMatchedPage(pathname, basePath, visiblePages) {
|
|
|
102
103
|
}
|
|
103
104
|
function getPageTitleForPathname(pathname, config) {
|
|
104
105
|
const basePath = config.layout?.basePath ?? '/contact';
|
|
105
|
-
const { PageText: mergedPageText } = (0, translations_1.mergeTranslationOverrides)({
|
|
106
|
+
const { PageText: mergedPageText, terms } = (0, translations_1.mergeTranslationOverrides)({
|
|
106
107
|
pages: config.translations?.pages,
|
|
108
|
+
terms: config.translations?.terms,
|
|
107
109
|
});
|
|
108
110
|
const visiblePages = getVisiblePages(config.pages, mergedPageText);
|
|
109
|
-
|
|
111
|
+
const title = findMatchedPage(pathname, basePath, visiblePages)?.title;
|
|
112
|
+
if (!title)
|
|
113
|
+
return undefined;
|
|
114
|
+
return (0, translations_context_1.fillTerms)(title, terms);
|
|
110
115
|
}
|
|
111
116
|
/**
|
|
112
117
|
* Title of the currently active contact page, reactive to client-side
|
package/lib/lines/use-lines.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { TransportModeType } from '../types';
|
|
|
2
2
|
import { Line } from '../server/journey-planner/validators';
|
|
3
3
|
export declare const DEFAULT_TRANSPORT_MODES: TransportModeType[];
|
|
4
4
|
export declare const useTransportModeOptions: () => TransportModeType[];
|
|
5
|
+
export declare function sortLinesByCode(lines: Line[]): Line[];
|
|
5
6
|
export declare function filterLinesByMode(lines: Line[], transportMode: TransportModeType, enabledModes: TransportModeType[]): Line[];
|
|
6
7
|
export declare const useLines: () => {
|
|
7
8
|
lines: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-lines.d.ts","sourceRoot":"","sources":["../../src/lines/use-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAK5D,eAAO,MAAM,uBAAuB,EAAE,iBAAiB,EAItD,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAO,iBAAiB,EACM,CAAC;
|
|
1
|
+
{"version":3,"file":"use-lines.d.ts","sourceRoot":"","sources":["../../src/lines/use-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AAK5D,eAAO,MAAM,uBAAuB,EAAE,iBAAiB,EAItD,CAAC;AAEF,eAAO,MAAM,uBAAuB,QAAO,iBAAiB,EACM,CAAC;AAiBnE,wBAAgB,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAmBrD;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,IAAI,EAAE,EACb,aAAa,EAAE,iBAAiB,EAChC,YAAY,EAAE,iBAAiB,EAAE,GAChC,IAAI,EAAE,CA6CR;AAED,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;oCAWoB,iBAAiB,KAAG,IAAI,EAAE;6BAUjC,MAAM,KAAG,IAAI,CAAC,OAAO,CAAC;CAYvD,CAAC"}
|
package/lib/lines/use-lines.js
CHANGED
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useLines = exports.useTransportModeOptions = exports.DEFAULT_TRANSPORT_MODES = void 0;
|
|
7
|
+
exports.sortLinesByCode = sortLinesByCode;
|
|
7
8
|
exports.filterLinesByMode = filterLinesByMode;
|
|
8
9
|
const immutable_1 = __importDefault(require("swr/immutable"));
|
|
9
10
|
const api_browser_1 = require("../modules/api-browser");
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type LostPropertyMode } from '../modules/config';
|
|
2
3
|
import type { LostPropertyContext, LostPropertyEvent } from './LostPropertyMachine';
|
|
4
|
+
/**
|
|
5
|
+
* The host's `lostProperty.modes`, or the global transport modes with the
|
|
6
|
+
* full form when unset.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useLostPropertyModes(): LostPropertyMode[];
|
|
3
9
|
type LostPropertyFormProps = {
|
|
4
10
|
state: {
|
|
5
11
|
context: LostPropertyContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LostPropertyForm.d.ts","sourceRoot":"","sources":["../../src/lost-property/LostPropertyForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LostPropertyForm.d.ts","sourceRoot":"","sources":["../../src/lost-property/LostPropertyForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAwB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAahF,OAAO,KAAK,EACV,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,gBAAgB,EAAE,CAezD;AAED,KAAK,qBAAqB,GAAG;IAC3B,KAAK,EAAE;QAAE,OAAO,EAAE,mBAAmB,CAAA;KAAE,CAAC;IACxC,IAAI,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,KAAK,EACL,IAAI,GACL,EAAE,qBAAqB,qBAgQvB"}
|
|
@@ -1,22 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLostPropertyModes = useLostPropertyModes;
|
|
3
4
|
exports.default = LostPropertyForm;
|
|
4
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
6
|
const translations_1 = require("../translations");
|
|
6
7
|
const use_lines_1 = require("../lines/use-lines");
|
|
8
|
+
const config_1 = require("../modules/config");
|
|
7
9
|
const components_1 = require("../components");
|
|
8
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The host's `lostProperty.modes`, or the global transport modes with the
|
|
12
|
+
* full form when unset.
|
|
13
|
+
*/
|
|
14
|
+
function useLostPropertyModes() {
|
|
15
|
+
const PageText = (0, translations_1.usePageText)();
|
|
16
|
+
const globalModes = (0, use_lines_1.useTransportModeOptions)();
|
|
17
|
+
const hostModes = (0, config_1.useContactFormConfig)().formSchemaOverrides?.lostProperty?.modes;
|
|
18
|
+
const { getLinesByMode } = (0, use_lines_1.useLines)();
|
|
19
|
+
if (hostModes)
|
|
20
|
+
return hostModes;
|
|
21
|
+
return globalModes.map((mode) => {
|
|
22
|
+
const modeLines = new Set(getLinesByMode(mode).map((line) => line.id));
|
|
23
|
+
return {
|
|
24
|
+
id: mode,
|
|
25
|
+
label: PageText.Contact.input.transportMode.modes[mode],
|
|
26
|
+
lines: (line) => modeLines.has(line.id),
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
}
|
|
9
30
|
function LostPropertyForm({ state, send, }) {
|
|
10
31
|
const PageText = (0, translations_1.usePageText)();
|
|
11
|
-
const { t } = (0, translations_1.useTranslation)();
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
32
|
+
const { t, tRich } = (0, translations_1.useTranslation)();
|
|
33
|
+
const modes = useLostPropertyModes();
|
|
34
|
+
const { lines, getQuaysByLine } = (0, use_lines_1.useLines)();
|
|
35
|
+
const selectedMode = modes.find((mode) => mode.id === state.context.transportMode);
|
|
36
|
+
const modeLines = selectedMode?.lines
|
|
37
|
+
? (0, use_lines_1.sortLinesByCode)((lines ?? []).filter(selectedMode.lines))
|
|
38
|
+
: [];
|
|
39
|
+
const transportModeSelect = ((0, jsx_runtime_1.jsx)(components_1.Select, { id: "transportMode", label: t(PageText.Contact.input.transportMode.label), value: state.context.transportMode || '', onChange: (value) => send({
|
|
40
|
+
type: 'ON_TRANSPORTMODE_CHANGE',
|
|
41
|
+
value: value ?? '',
|
|
42
|
+
}), isRequired: true, error: state.context.errorMessages['transportMode']?.[0]
|
|
43
|
+
? t(state.context.errorMessages['transportMode']?.[0])
|
|
44
|
+
: undefined, valueToId: (val) => val, valueToText: (val) => {
|
|
45
|
+
const label = modes.find((mode) => mode.id === val)?.label;
|
|
46
|
+
return label ? t(label) : val;
|
|
47
|
+
}, options: modes.map((mode) => mode.id), placeholder: t(PageText.Contact.input.transportMode.optionLabel) }));
|
|
48
|
+
const introSection = ((0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.lostAndFound.title), children: [tRich(PageText.Contact.lostAndFound.info), transportModeSelect, selectedMode?.info && tRich(selectedMode.info)] }));
|
|
49
|
+
// The rest of the form only shows once a mode with a form is picked.
|
|
50
|
+
if (!selectedMode?.lines)
|
|
51
|
+
return introSection;
|
|
52
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [introSection, (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.lostAndFound.about.title), children: [(0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "line", label: t(PageText.Contact.input.line.label), value: state.context.line, placeholder: t(PageText.Contact.input.line.optionLabel), isDisabled: !state.context.transportMode, options: (0, components_1.getLineOptions)(modeLines), onChange: (value) => {
|
|
20
53
|
send({ type: 'ON_LINE_CHANGE', value });
|
|
21
54
|
}, isRequired: true, error: state.context.errorMessages['line']?.[0]
|
|
22
55
|
? t(state.context.errorMessages['line']?.[0])
|
|
@@ -39,13 +72,22 @@ function LostPropertyForm({ state, send, }) {
|
|
|
39
72
|
inputName: 'tripId',
|
|
40
73
|
value: tripId,
|
|
41
74
|
});
|
|
42
|
-
}, isRequired: true, errorMessage: state.context.errorMessages['plannedDepartureTime']?.[0] })] }), (0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.lostAndFound.itemDescription.title), isRequired: true, children: (0, jsx_runtime_1.jsx)(components_1.Textarea, { id: "feedback", value: state.context.feedback || '', onChange: (e) => send({
|
|
75
|
+
}, isRequired: true, errorMessage: state.context.errorMessages['plannedDepartureTime']?.[0] })] }), (0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.lostAndFound.itemDescription.title), isRequired: true, children: (0, jsx_runtime_1.jsx)(components_1.Textarea, { id: "feedback", description: t(PageText.Contact.lostAndFound.itemDescription.description), value: state.context.feedback || '', onChange: (e) => send({
|
|
43
76
|
type: 'ON_INPUT_CHANGE',
|
|
44
77
|
inputName: 'feedback',
|
|
45
78
|
value: e.target.value,
|
|
46
79
|
}), error: state.context.errorMessages['feedback']?.[0]
|
|
47
80
|
? t(state.context.errorMessages['feedback']?.[0])
|
|
48
|
-
: undefined
|
|
81
|
+
: undefined, fileInputProps: {
|
|
82
|
+
id: 'attachments',
|
|
83
|
+
name: 'attachments',
|
|
84
|
+
iconLabel: t(PageText.Contact.input.feedback.attachment.generic),
|
|
85
|
+
onChange: (files) => send({
|
|
86
|
+
type: 'ON_INPUT_CHANGE',
|
|
87
|
+
inputName: 'attachments',
|
|
88
|
+
value: files,
|
|
89
|
+
}),
|
|
90
|
+
} }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.lostAndFound.contactInfo.title), isRequired: true, children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "firstName", label: t(PageText.Contact.input.firstName.label), type: "text", name: "firstName", isRequired: true, value: state.context.firstName || '', errorMessage: state.context.errorMessages['firstName']?.[0], onChange: (e) => send({
|
|
49
91
|
type: 'ON_INPUT_CHANGE',
|
|
50
92
|
inputName: 'firstName',
|
|
51
93
|
value: e.target.value,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { InputErrorMessages } from '../validation';
|
|
2
|
-
import type { TransportModeType } from '../types';
|
|
3
2
|
import type { Line } from '../server/journey-planner/validators';
|
|
4
3
|
import type { FormSlug } from '../modules/config/types';
|
|
5
4
|
export type LostPropertyContext = {
|
|
6
|
-
transportMode?:
|
|
5
|
+
transportMode?: string;
|
|
7
6
|
line?: Line;
|
|
8
7
|
fromStop?: Line['quays'][0];
|
|
9
8
|
toStop?: Line['quays'][0];
|
|
@@ -15,6 +14,7 @@ export type LostPropertyContext = {
|
|
|
15
14
|
lastName?: string;
|
|
16
15
|
email?: string;
|
|
17
16
|
phoneNumber?: string;
|
|
17
|
+
attachments?: File[];
|
|
18
18
|
errorMessages: InputErrorMessages;
|
|
19
19
|
firstErrorMessage?: string;
|
|
20
20
|
hasSubmissionError?: boolean;
|
|
@@ -25,7 +25,7 @@ export type LostPropertyEvent = {
|
|
|
25
25
|
value: unknown;
|
|
26
26
|
} | {
|
|
27
27
|
type: 'ON_TRANSPORTMODE_CHANGE';
|
|
28
|
-
value:
|
|
28
|
+
value: string;
|
|
29
29
|
} | {
|
|
30
30
|
type: 'ON_LINE_CHANGE';
|
|
31
31
|
value: Line | undefined;
|
|
@@ -50,6 +50,7 @@ type SubmitInput = {
|
|
|
50
50
|
lastName?: string;
|
|
51
51
|
email?: string;
|
|
52
52
|
phoneNumber?: string;
|
|
53
|
+
attachments?: File[];
|
|
53
54
|
};
|
|
54
55
|
export declare function createLostPropertyMachine(onSubmit: (slug: FormSlug, state: Record<string, unknown>) => Promise<Response>, paths?: MachinePaths): import("xstate").StateMachine<LostPropertyContext, {
|
|
55
56
|
type: "ON_INPUT_CHANGE";
|
|
@@ -57,7 +58,7 @@ export declare function createLostPropertyMachine(onSubmit: (slug: FormSlug, sta
|
|
|
57
58
|
value: unknown;
|
|
58
59
|
} | {
|
|
59
60
|
type: "ON_TRANSPORTMODE_CHANGE";
|
|
60
|
-
value:
|
|
61
|
+
value: string;
|
|
61
62
|
} | {
|
|
62
63
|
type: "ON_LINE_CHANGE";
|
|
63
64
|
value: Line | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LostPropertyMachine.d.ts","sourceRoot":"","sources":["../../src/lost-property/LostPropertyMachine.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,kBAAkB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"LostPropertyMachine.d.ts","sourceRoot":"","sources":["../../src/lost-property/LostPropertyMachine.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAOzE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,MAAM,mBAAmB,GAAG;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,MAAM,CAAC,EAAE,IAAI,CAAC,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AC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,IAAI,EAAE,CAAC;CACtB,CAAC;AAEF,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,CACR,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC3B,OAAO,CAAC,QAAQ,CAAC,EACtB,KAAK,CAAC,EAAE,YAAY;UA5BV,iBAAiB;eAAa,MAAM;WAAS,OAAO;;UACpD,yBAAyB;WAAS,MAAM;;UACxC,gBAAgB;WAAS,IAAI,GAAG,SAAS;;UACzC,QAAQ;2BAAyB,MAAM,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiOpD"}
|
|
@@ -129,7 +129,10 @@ function createLostPropertyMachine(onSubmit, paths) {
|
|
|
129
129
|
},
|
|
130
130
|
actors: {
|
|
131
131
|
submit: (0, xstate_1.fromPromise)(async ({ input }) => {
|
|
132
|
-
const response = await onSubmit('lost-property',
|
|
132
|
+
const response = await onSubmit('lost-property', {
|
|
133
|
+
...input,
|
|
134
|
+
attachments: await (0, utils_1.convertFilesToBase64)(input.attachments ?? []),
|
|
135
|
+
});
|
|
133
136
|
if (!response.ok)
|
|
134
137
|
throw new Error('Failed to submit');
|
|
135
138
|
return response.ok;
|
|
@@ -173,6 +176,7 @@ function createLostPropertyMachine(onSubmit, paths) {
|
|
|
173
176
|
lastName: context.lastName,
|
|
174
177
|
email: context.email,
|
|
175
178
|
phoneNumber: context.phoneNumber,
|
|
179
|
+
attachments: context.attachments,
|
|
176
180
|
}),
|
|
177
181
|
onDone: { target: 'success' },
|
|
178
182
|
onError: {
|