@mrfylke/contact-form 0.1.11 → 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/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 +13 -7
- 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 +19 -16
- 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 +4 -3
- package/lib/lines/use-lines.d.ts.map +1 -1
- package/lib/lines/use-lines.js +43 -10
- 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 -9
- 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 -0
- package/lib/modules/config/types.d.ts +48 -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 +2 -2
- package/lib/refund/forms/refund-and-travel-guarantee/refundCarForm.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/refundCarForm.js +15 -8
- package/lib/refund/forms/refund-and-travel-guarantee/refundTaxiForm.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/refundTaxiForm.js +15 -8
- package/lib/refund/forms/refund-ticket/appTicketRefund.d.ts.map +1 -1
- package/lib/refund/forms/refund-ticket/appTicketRefund.js +46 -11
- package/lib/refund/forms/refund-ticket/index.d.ts.map +1 -1
- package/lib/refund/forms/refund-ticket/index.js +8 -7
- package/lib/refund/forms/refund-ticket/otherTicketRefund.d.ts.map +1 -1
- package/lib/refund/forms/refund-ticket/otherTicketRefund.js +53 -19
- 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 +96 -3
- 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/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 +28 -25
- package/lib/ticket-control/forms/feedbackForm.d.ts.map +1 -1
- package/lib/ticket-control/forms/feedbackForm.js +22 -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 +15 -6
- package/lib/ticket-control/ticket-control-form-machine.d.ts +14 -10
- package/lib/ticket-control/ticket-control-form-machine.d.ts.map +1 -1
- package/lib/ticket-control/ticket-control-form-machine.js +17 -2
- 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/pages/contact.d.ts +46 -0
- package/lib/translations/pages/contact.d.ts.map +1 -1
- package/lib/translations/pages/contact.js +50 -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 +19 -0
- package/lib/types/submit-payloads.d.ts.map +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 +7 -0
- package/package.json +1 -2
|
@@ -5,13 +5,16 @@ exports.default = AppTicketRefundContent;
|
|
|
5
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
6
|
const components_1 = require("../../../components");
|
|
7
7
|
const translations_1 = require("../../../translations");
|
|
8
|
+
const context_1 = require("../../../modules/config/context");
|
|
9
|
+
const use_lines_1 = require("../../../lines/use-lines");
|
|
8
10
|
const AppTicketRefund = ({ state, send }) => {
|
|
11
|
+
const PageText = (0, translations_1.usePageText)();
|
|
9
12
|
const { t } = (0, translations_1.useTranslation)();
|
|
10
|
-
return ((0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.ticketing.refund.appTicketRefund.label), children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "orderId", label: t(PageText.Contact.input.referenceNumber.label), type: "text", name: "orderId", value: state.context.orderId || '', isRequired: true, errorMessage: state.context?.errorMessages['orderId']?.[0], onChange: (e) => send({
|
|
11
14
|
type: 'ON_INPUT_CHANGE',
|
|
12
15
|
inputName: 'orderId',
|
|
13
16
|
value: e.target.value,
|
|
14
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Textarea, { id: "refundReason", description: t(
|
|
17
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Textarea, { id: "refundReason", description: t(PageText.Contact.input.refundReason.question), value: state.context.refundReason || '', isRequired: true, onChange: (e) => send({
|
|
15
18
|
type: 'ON_INPUT_CHANGE',
|
|
16
19
|
inputName: 'refundReason',
|
|
17
20
|
value: e.target.value,
|
|
@@ -19,7 +22,7 @@ const AppTicketRefund = ({ state, send }) => {
|
|
|
19
22
|
? t(state.context.errorMessages['refundReason']?.[0])
|
|
20
23
|
: undefined, fileInputProps: {
|
|
21
24
|
id: 'attachments',
|
|
22
|
-
iconLabel: t(
|
|
25
|
+
iconLabel: t(PageText.Contact.input.feedback.attachment.receipt),
|
|
23
26
|
name: 'attachments',
|
|
24
27
|
onChange: (files) => {
|
|
25
28
|
send({
|
|
@@ -31,38 +34,70 @@ const AppTicketRefund = ({ state, send }) => {
|
|
|
31
34
|
} })] }));
|
|
32
35
|
};
|
|
33
36
|
exports.AppTicketRefund = AppTicketRefund;
|
|
37
|
+
const DepartureSection = ({ state, send }) => {
|
|
38
|
+
const PageText = (0, translations_1.usePageText)();
|
|
39
|
+
const { t } = (0, translations_1.useTranslation)();
|
|
40
|
+
const { getLinesByMode, getQuaysByLine } = (0, use_lines_1.useLines)();
|
|
41
|
+
const transportModeOptions = (0, use_lines_1.useTransportModeOptions)();
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.refund.refundTaxi.aboutYourTrip.title), children: [(0, jsx_runtime_1.jsx)(components_1.Select, { id: "transportMode", label: t(PageText.Contact.input.transportMode.label), value: state.context.transportMode || '', onChange: (value) => send({
|
|
43
|
+
type: 'ON_TRANSPORTMODE_CHANGE',
|
|
44
|
+
value: value,
|
|
45
|
+
}), isRequired: true, error: state.context?.errorMessages['transportMode']?.[0]
|
|
46
|
+
? t(state.context?.errorMessages['transportMode']?.[0])
|
|
47
|
+
: undefined, valueToId: (val) => val, valueToText: (val) => t(PageText.Contact.input.transportMode.modes[val]), options: transportModeOptions, placeholder: t(PageText.Contact.input.transportMode.optionLabel) }), (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)(getLinesByMode(state.context.transportMode)), onChange: (value) => {
|
|
48
|
+
send({ type: 'ON_LINE_CHANGE', value });
|
|
49
|
+
}, isRequired: true, error: state.context?.errorMessages['line']?.[0] &&
|
|
50
|
+
t(state.context?.errorMessages['line']?.[0]) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "fromStop", label: t(PageText.Contact.input.fromStop.label), value: state.context.fromStop, isDisabled: !state.context.line, onChange: (value) => send({ type: 'ON_INPUT_CHANGE', inputName: 'fromStop', value }), options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), placeholder: t(PageText.Contact.input.fromStop.optionLabel), isRequired: true, error: state.context?.errorMessages['fromStop']?.[0]
|
|
51
|
+
? t(state.context?.errorMessages['fromStop']?.[0])
|
|
52
|
+
: undefined }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "toStop", label: t(PageText.Contact.input.toStop.label), value: state.context.toStop, isDisabled: !state.context.line, onChange: (value) => send({ type: 'ON_INPUT_CHANGE', inputName: 'toStop', value }), options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), placeholder: t(PageText.Contact.input.toStop.optionLabel), isRequired: true, error: state.context?.errorMessages['toStop']?.[0]
|
|
53
|
+
? t(state.context?.errorMessages['toStop']?.[0])
|
|
54
|
+
: undefined }), (0, jsx_runtime_1.jsx)(components_1.DateSelector, { id: "date", label: t(PageText.Contact.input.date.label), isRequired: true, value: state.context.date, onChange: (date) => send({ type: 'ON_INPUT_CHANGE', inputName: 'date', value: date }), errorMessage: state.context?.errorMessages['date']?.[0] }), (0, jsx_runtime_1.jsx)(components_1.DepartureTimeField, { date: state.context.date, lineId: state.context.line?.id, fromStopId: state.context.fromStop?.id, toStopId: state.context.toStop?.id, selectedTripId: state.context.tripId, plannedDepartureTime: state.context.plannedDepartureTime, onChange: (time, tripId) => {
|
|
55
|
+
send({
|
|
56
|
+
type: 'ON_INPUT_CHANGE',
|
|
57
|
+
inputName: 'plannedDepartureTime',
|
|
58
|
+
value: time,
|
|
59
|
+
});
|
|
60
|
+
send({
|
|
61
|
+
type: 'ON_INPUT_CHANGE',
|
|
62
|
+
inputName: 'tripId',
|
|
63
|
+
value: tripId,
|
|
64
|
+
});
|
|
65
|
+
}, isRequired: true, errorMessage: state.context.errorMessages['plannedDepartureTime']?.[0] })] }));
|
|
66
|
+
};
|
|
34
67
|
const AboutYouSection = ({ state, send }) => {
|
|
68
|
+
const PageText = (0, translations_1.usePageText)();
|
|
35
69
|
const { t } = (0, translations_1.useTranslation)();
|
|
36
|
-
return ((0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(
|
|
70
|
+
return ((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({
|
|
37
71
|
type: 'ON_INPUT_CHANGE',
|
|
38
72
|
inputName: 'firstName',
|
|
39
73
|
value: e.target.value,
|
|
40
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "lastName", label: t(
|
|
74
|
+
}) }), (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({
|
|
41
75
|
type: 'ON_INPUT_CHANGE',
|
|
42
76
|
inputName: 'lastName',
|
|
43
77
|
value: e.target.value,
|
|
44
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "address", label: t(
|
|
78
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "address", label: t(PageText.Contact.input.address.label), type: "text", autoComplete: "street-address", name: "address", value: state.context.address || '', isRequired: true, errorMessage: state.context?.errorMessages['address']?.[0], onChange: (e) => send({
|
|
45
79
|
type: 'ON_INPUT_CHANGE',
|
|
46
80
|
inputName: 'address',
|
|
47
81
|
value: e.target.value,
|
|
48
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "postalCode", label: t(
|
|
82
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "postalCode", label: t(PageText.Contact.input.postalCode.label), type: "text", autoComplete: "postal-code", name: "postalCode", value: state.context.postalCode || '', isRequired: true, errorMessage: state.context?.errorMessages['postalCode']?.[0], onChange: (e) => send({
|
|
49
83
|
type: 'ON_INPUT_CHANGE',
|
|
50
84
|
inputName: 'postalCode',
|
|
51
85
|
value: e.target.value,
|
|
52
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "city", label: t(
|
|
86
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "city", label: t(PageText.Contact.input.city.label), type: "text", name: "city", value: state.context.city || '', isRequired: true, errorMessage: state.context?.errorMessages['city']?.[0], onChange: (e) => send({
|
|
53
87
|
type: 'ON_INPUT_CHANGE',
|
|
54
88
|
inputName: 'city',
|
|
55
89
|
value: e.target.value,
|
|
56
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "email", label: t(
|
|
90
|
+
}) }), (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({
|
|
57
91
|
type: 'ON_INPUT_CHANGE',
|
|
58
92
|
inputName: 'email',
|
|
59
93
|
value: e.target.value,
|
|
60
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "phoneNumber", label: t(
|
|
94
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "phoneNumber", label: t(PageText.Contact.input.phoneNumber.label), type: "tel", name: "phoneNumber", value: state.context.phoneNumber || '', isRequired: true, errorMessage: state.context?.errorMessages['phoneNumber']?.[0], onChange: (e) => send({
|
|
61
95
|
type: 'ON_INPUT_CHANGE',
|
|
62
96
|
inputName: 'phoneNumber',
|
|
63
97
|
value: e.target.value,
|
|
64
98
|
}) })] }));
|
|
65
99
|
};
|
|
66
100
|
function AppTicketRefundContent({ state, send, }) {
|
|
67
|
-
|
|
101
|
+
const { features } = (0, context_1.useContactFormConfig)();
|
|
102
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(exports.AppTicketRefund, { state: state, send: send }), (0, jsx_runtime_1.jsx)(AboutYouSection, { state: state, send: send }), features?.includeRefundDepartureInfo && ((0, jsx_runtime_1.jsx)(DepartureSection, { state: state, send: send }))] }));
|
|
68
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/refund/forms/refund-ticket/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/refund/forms/refund-ticket/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAUnC,OAAO,EAAE,kBAAkB,EAAoB,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAIhD,KAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,SAAS,CAAC,OAAO,kBAAkB,CAAC,CAAC;IAC5C,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,gBAAgB,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,iBAAiB,sBAAsB,4CAmIxE,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -15,23 +15,24 @@ const refundFormMachine_1 = require("../../refundFormMachine");
|
|
|
15
15
|
const otherTicketRefund_1 = __importDefault(require("./otherTicketRefund"));
|
|
16
16
|
const checkbox_1 = require("../../../components/checkbox");
|
|
17
17
|
const RefundTicketForms = ({ state, send }) => {
|
|
18
|
+
const PageText = (0, translations_1.usePageText)();
|
|
18
19
|
const { t } = (0, translations_1.useTranslation)();
|
|
19
|
-
const { initialAgreement } =
|
|
20
|
+
const { initialAgreement } = PageText.Contact.ticketing.refund;
|
|
20
21
|
const { refundableTicketTypes, nonRefundableTicketTypes } = initialAgreement;
|
|
21
22
|
const displayAppTicketRefund = state.context.isInitialAgreementChecked &&
|
|
22
23
|
state.context.formType === 'appTicketRefund';
|
|
23
24
|
const displayOtherTicketRefund = state.context.isInitialAgreementChecked &&
|
|
24
25
|
state.context.formType === 'otherTicketRefund';
|
|
25
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(
|
|
26
|
-
.ticketRefundAvailability.title), children: (0, jsx_runtime_1.jsx)("ul", { className: contact_module_css_1.default.rules__list, children:
|
|
27
|
-
.refundableTicketTypes.title), children: [(0, jsx_runtime_1.jsx)("ul", { className: contact_module_css_1.default.rules__list, children: refundableTicketTypes.rules.map((rule, index) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(rule) }) }, index))) }), (0, jsx_runtime_1.jsxs)(typography_1.Typo.p, { textType: "body__m", children: [t(
|
|
28
|
-
.refundableTicketTypes.info.text), ' ', (0, jsx_runtime_1.jsx)(link_1.default, { href: '
|
|
29
|
-
.refundableTicketTypes.info.link) })] }), nonRefundableTicketTypes.rules.length > 0 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "heading__m", children: t(nonRefundableTicketTypes.title) }), (0, jsx_runtime_1.jsx)("ul", { className: contact_module_css_1.default.rules__list, children: nonRefundableTicketTypes.rules.map((rule, index) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(rule) }) }, index))) })] })), (0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { label: t(
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.ticketing.refund.initialAgreement
|
|
27
|
+
.ticketRefundAvailability.title), children: (0, jsx_runtime_1.jsx)("ul", { className: contact_module_css_1.default.rules__list, children: PageText.Contact.ticketing.refund.initialAgreement.ticketRefundAvailability.rules.map((rule, index) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(rule) }) }, index))) }) }), (0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.ticketing.refund.initialAgreement
|
|
28
|
+
.refundableTicketTypes.title), children: [(0, jsx_runtime_1.jsx)("ul", { className: contact_module_css_1.default.rules__list, children: refundableTicketTypes.rules.map((rule, index) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(rule) }) }, index))) }), (0, jsx_runtime_1.jsxs)(typography_1.Typo.p, { textType: "body__m", children: [t(PageText.Contact.ticketing.refund.initialAgreement
|
|
29
|
+
.refundableTicketTypes.info.text), ' ', (0, jsx_runtime_1.jsx)(link_1.default, { className: contact_module_css_1.default.link, href: '?type=refundAndTravelGuarantee&agreed=true', target: "_blank", rel: "noopener noreferrer", children: t(PageText.Contact.ticketing.refund.initialAgreement
|
|
30
|
+
.refundableTicketTypes.info.link) })] }), t(refundableTicketTypes.info.note) && ((0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(refundableTicketTypes.info.note) })), nonRefundableTicketTypes.rules.length > 0 && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "heading__m", children: t(nonRefundableTicketTypes.title) }), (0, jsx_runtime_1.jsx)("ul", { className: contact_module_css_1.default.rules__list, children: nonRefundableTicketTypes.rules.map((rule, index) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(rule) }) }, index))) })] })), (0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { label: t(PageText.Contact.ticketing.refund.initialAgreement
|
|
30
31
|
.refundableTicketTypes.checkbox), checked: state.context.isInitialAgreementChecked, onChange: () => send({
|
|
31
32
|
type: 'ON_INPUT_CHANGE',
|
|
32
33
|
inputName: 'isInitialAgreementChecked',
|
|
33
34
|
value: !state.context.isInitialAgreementChecked,
|
|
34
|
-
}) })] }), state.context.isInitialAgreementChecked && ((0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(
|
|
35
|
+
}) })] }), state.context.isInitialAgreementChecked && ((0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.ticketing.refund.description), children: (0, jsx_runtime_1.jsx)("ul", { className: contact_module_css_1.default.form_options__list, children: Object.values(refundFormMachine_1.RefundTicketForm).map((refundTicketForm) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(PageText.Contact.ticketing.refund[refundTicketForm].label), checked: state.context.formType === refundTicketForm, onChange: () => send({
|
|
35
36
|
type: 'SELECT_REFUND_TICKET_FORM',
|
|
36
37
|
refundTicketForm: refundTicketForm,
|
|
37
38
|
}) }) }, refundTicketForm))) }) })), displayAppTicketRefund && (0, jsx_runtime_1.jsx)(appTicketRefund_1.default, { state: state, send: send }), displayOtherTicketRefund && ((0, jsx_runtime_1.jsx)(otherTicketRefund_1.default, { state: state, send: send }))] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otherTicketRefund.d.ts","sourceRoot":"","sources":["../../../../src/refund/forms/refund-ticket/otherTicketRefund.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"otherTicketRefund.d.ts","sourceRoot":"","sources":["../../../../src/refund/forms/refund-ticket/otherTicketRefund.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAahD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAO7D,KAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE;QAAE,OAAO,EAAE,kBAAkB,CAAA;KAAE,CAAC;IACvC,IAAI,EAAE,CAAC,KAAK,EAAE,OAAO,gBAAgB,KAAK,IAAI,CAAC;CAChD,CAAC;AAmcF,eAAO,MAAM,iBAAiB,GAAI,iBAAiB,sBAAsB,4CAWxE,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -7,12 +7,14 @@ const components_1 = require("../../../components");
|
|
|
7
7
|
const checkbox_1 = require("../../../components/checkbox");
|
|
8
8
|
const types_1 = require("../../../types");
|
|
9
9
|
const context_1 = require("../../../modules/config/context");
|
|
10
|
+
const use_lines_1 = require("../../../lines/use-lines");
|
|
10
11
|
const RefundSection = ({ state, send }) => {
|
|
12
|
+
const PageText = (0, translations_1.usePageText)();
|
|
11
13
|
const { t } = (0, translations_1.useTranslation)();
|
|
12
14
|
const { features } = (0, context_1.useContactFormConfig)();
|
|
13
|
-
const ticketTypeOptions =
|
|
15
|
+
const ticketTypeOptions = PageText.Contact.input.ticketType.options.filter((option) => option.id == types_1.TicketTypeId.SingleTicket ||
|
|
14
16
|
option.id == types_1.TicketTypeId.PeriodTicket);
|
|
15
|
-
return ((0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.ticketing.refund.otherTicketRefund.label), children: [state.context.includeOtherTicketTypeSelector && ((0, jsx_runtime_1.jsx)(components_1.Select, { id: "ticketType", label: t(PageText.Contact.input.ticketType.labelRefund), value: state.context.ticketType, valueToId: (option) => option.id, valueToText: (option) => t(option.name), onChange: (value) => {
|
|
16
18
|
if (!value)
|
|
17
19
|
return;
|
|
18
20
|
send({
|
|
@@ -20,23 +22,23 @@ const RefundSection = ({ state, send }) => {
|
|
|
20
22
|
inputName: 'ticketType',
|
|
21
23
|
value: value,
|
|
22
24
|
});
|
|
23
|
-
}, placeholder: t(
|
|
25
|
+
}, placeholder: t(PageText.Contact.input.ticketType.optionLabelRefund), options: ticketTypeOptions, isRequired: true, error: state.context?.errorMessages['ticketType']?.[0]
|
|
24
26
|
? t(state.context?.errorMessages['ticketType'][0])
|
|
25
|
-
: undefined }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "orderId", label: t(
|
|
27
|
+
: undefined })), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "orderId", label: t(PageText.Contact.input.orderId.label(false)), type: "text", name: "orderId", value: state.context.orderId || '', isRequired: true, errorMessage: state.context?.errorMessages['orderId']?.[0], onChange: (e) => send({
|
|
26
28
|
type: 'ON_INPUT_CHANGE',
|
|
27
29
|
inputName: 'orderId',
|
|
28
30
|
value: e.target.value,
|
|
29
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "travelCardNumber", label: t(
|
|
31
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "travelCardNumber", label: t(PageText.Contact.input.travelCardNumber.label), type: "text", name: "travelCardNumber", value: state.context.travelCardNumber || '', errorMessage: state.context.errorMessages['travelCardNumber']?.[0], onChange: (e) => send({
|
|
30
32
|
type: 'ON_INPUT_CHANGE',
|
|
31
33
|
inputName: 'travelCardNumber',
|
|
32
34
|
value: e.target.value,
|
|
33
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Textarea, { id: "refundReason", description: t(
|
|
35
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Textarea, { id: "refundReason", description: t(PageText.Contact.input.refundReason.question), value: state.context.refundReason || '', isRequired: true, onChange: (e) => send({
|
|
34
36
|
type: 'ON_INPUT_CHANGE',
|
|
35
37
|
inputName: 'refundReason',
|
|
36
38
|
value: e.target.value,
|
|
37
39
|
}), error: state.context.errorMessages['refundReason']?.[0]
|
|
38
40
|
? t(state.context.errorMessages['refundReason']?.[0])
|
|
39
|
-
: undefined }), features?.enableFileUploads && ((0, jsx_runtime_1.jsx)(components_1.FileInput, { id: "attachments", label: t(
|
|
41
|
+
: undefined }), features?.enableFileUploads && ((0, jsx_runtime_1.jsx)(components_1.FileInput, { id: "attachments", label: t(PageText.Contact.refund.refundTaxi.taxiReceipt.info), iconLabel: t(PageText.Contact.input.feedback.attachment.receipt), name: "attachments", onChange: (files) => {
|
|
40
42
|
send({
|
|
41
43
|
type: 'ON_INPUT_CHANGE',
|
|
42
44
|
inputName: 'attachments',
|
|
@@ -47,55 +49,87 @@ const RefundSection = ({ state, send }) => {
|
|
|
47
49
|
: undefined }))] }));
|
|
48
50
|
};
|
|
49
51
|
const AboutYouSection = ({ state, send }) => {
|
|
52
|
+
const PageText = (0, translations_1.usePageText)();
|
|
50
53
|
const { t } = (0, translations_1.useTranslation)();
|
|
51
|
-
return ((0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(
|
|
54
|
+
return ((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({
|
|
52
55
|
type: 'ON_INPUT_CHANGE',
|
|
53
56
|
inputName: 'firstName',
|
|
54
57
|
value: e.target.value,
|
|
55
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "lastName", label: t(
|
|
58
|
+
}) }), (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({
|
|
56
59
|
type: 'ON_INPUT_CHANGE',
|
|
57
60
|
inputName: 'lastName',
|
|
58
61
|
value: e.target.value,
|
|
59
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "address", label: t(
|
|
62
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "address", label: t(PageText.Contact.input.address.label), type: "text", autoComplete: "street-address", name: "address", value: state.context.address || '', isRequired: true, errorMessage: state.context?.errorMessages['address']?.[0], onChange: (e) => send({
|
|
60
63
|
type: 'ON_INPUT_CHANGE',
|
|
61
64
|
inputName: 'address',
|
|
62
65
|
value: e.target.value,
|
|
63
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "postalCode", label: t(
|
|
66
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "postalCode", label: t(PageText.Contact.input.postalCode.label), type: "text", autoComplete: "postal-code", name: "postalCode", value: state.context.postalCode || '', isRequired: true, errorMessage: state.context?.errorMessages['postalCode']?.[0], onChange: (e) => send({
|
|
64
67
|
type: 'ON_INPUT_CHANGE',
|
|
65
68
|
inputName: 'postalCode',
|
|
66
69
|
value: e.target.value,
|
|
67
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "city", label: t(
|
|
70
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "city", label: t(PageText.Contact.input.city.label), type: "text", name: "city", value: state.context.city || '', isRequired: true, errorMessage: state.context?.errorMessages['city']?.[0], onChange: (e) => send({
|
|
68
71
|
type: 'ON_INPUT_CHANGE',
|
|
69
72
|
inputName: 'city',
|
|
70
73
|
value: e.target.value,
|
|
71
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "email", label: t(
|
|
74
|
+
}) }), (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({
|
|
72
75
|
type: 'ON_INPUT_CHANGE',
|
|
73
76
|
inputName: 'email',
|
|
74
77
|
value: e.target.value,
|
|
75
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "phoneNumber", label: t(
|
|
78
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "phoneNumber", label: t(PageText.Contact.input.phoneNumber.label), type: "tel", name: "phoneNumber", value: state.context.phoneNumber || '', isRequired: true, errorMessage: state.context?.errorMessages['phoneNumber']?.[0], onChange: (e) => send({
|
|
76
79
|
type: 'ON_INPUT_CHANGE',
|
|
77
80
|
inputName: 'phoneNumber',
|
|
78
81
|
value: e.target.value,
|
|
79
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "bankAccountNumber", label: t(
|
|
82
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "bankAccountNumber", label: t(PageText.Contact.input.bankInformation.bankAccountNumber.label), placeholder: t(PageText.Contact.input.bankInformation.bankAccountNumber.placeholder), type: "text", name: "bankAccountNumber", value: state.context.bankAccountNumber || '', disabled: state.context.hasInternationalBankAccount, isRequired: true, errorMessage: state.context?.errorMessages['bankAccountNumber']?.[0], onChange: (e) => send({
|
|
80
83
|
type: 'ON_INPUT_CHANGE',
|
|
81
84
|
inputName: 'bankAccountNumber',
|
|
82
85
|
value: e.target.value,
|
|
83
|
-
}) }), (0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { label: t(
|
|
86
|
+
}) }), (0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { label: t(PageText.Contact.input.bankInformation.checkbox), checked: state.context.hasInternationalBankAccount, onChange: () => send({
|
|
84
87
|
type: 'ON_INPUT_CHANGE',
|
|
85
88
|
inputName: 'hasInternationalBankAccount',
|
|
86
89
|
value: !state.context.hasInternationalBankAccount,
|
|
87
|
-
}) }), state.context.hasInternationalBankAccount && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "IBAN", label: t(
|
|
90
|
+
}) }), state.context.hasInternationalBankAccount && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Input, { id: "IBAN", label: t(PageText.Contact.input.bankInformation.IBAN.label), type: "string", name: "IBAN", value: state.context.IBAN || '', isRequired: true, errorMessage: state.context?.errorMessages['IBAN']?.[0], onChange: (e) => send({
|
|
88
91
|
type: 'ON_INPUT_CHANGE',
|
|
89
92
|
inputName: 'IBAN',
|
|
90
93
|
value: e.target.value,
|
|
91
|
-
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "SWIFT", label: t(
|
|
94
|
+
}) }), (0, jsx_runtime_1.jsx)(components_1.Input, { id: "SWIFT", label: t(PageText.Contact.input.bankInformation.SWIFT.label), type: "string", name: "SWIFT", value: state.context.SWIFT || '', isRequired: true, errorMessage: state.context?.errorMessages['SWIFT']?.[0], onChange: (e) => send({
|
|
92
95
|
type: 'ON_INPUT_CHANGE',
|
|
93
96
|
inputName: 'SWIFT',
|
|
94
97
|
value: e.target.value,
|
|
95
98
|
}) })] }))] }));
|
|
96
99
|
};
|
|
100
|
+
const DepartureSection = ({ state, send }) => {
|
|
101
|
+
const PageText = (0, translations_1.usePageText)();
|
|
102
|
+
const { t } = (0, translations_1.useTranslation)();
|
|
103
|
+
const { getLinesByMode, getQuaysByLine } = (0, use_lines_1.useLines)();
|
|
104
|
+
const transportModeOptions = (0, use_lines_1.useTransportModeOptions)();
|
|
105
|
+
return ((0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.refund.refundTaxi.aboutYourTrip.title), children: [(0, jsx_runtime_1.jsx)(components_1.Select, { id: "transportMode", label: t(PageText.Contact.input.transportMode.label), value: state.context.transportMode || '', onChange: (value) => send({
|
|
106
|
+
type: 'ON_TRANSPORTMODE_CHANGE',
|
|
107
|
+
value: value,
|
|
108
|
+
}), isRequired: true, error: state.context?.errorMessages['transportMode']?.[0]
|
|
109
|
+
? t(state.context?.errorMessages['transportMode']?.[0])
|
|
110
|
+
: undefined, valueToId: (val) => val, valueToText: (val) => t(PageText.Contact.input.transportMode.modes[val]), options: transportModeOptions, placeholder: t(PageText.Contact.input.transportMode.optionLabel) }), (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)(getLinesByMode(state.context.transportMode)), onChange: (value) => {
|
|
111
|
+
send({ type: 'ON_LINE_CHANGE', value });
|
|
112
|
+
}, isRequired: true, error: state.context?.errorMessages['line']?.[0] &&
|
|
113
|
+
t(state.context?.errorMessages['line']?.[0]) }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "fromStop", label: t(PageText.Contact.input.fromStop.label), value: state.context.fromStop, isDisabled: !state.context.line, onChange: (value) => send({ type: 'ON_INPUT_CHANGE', inputName: 'fromStop', value }), options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), placeholder: t(PageText.Contact.input.fromStop.optionLabel), isRequired: true, error: state.context?.errorMessages['fromStop']?.[0]
|
|
114
|
+
? t(state.context?.errorMessages['fromStop']?.[0])
|
|
115
|
+
: undefined }), (0, jsx_runtime_1.jsx)(components_1.SearchableSelect, { id: "toStop", label: t(PageText.Contact.input.toStop.label), value: state.context.toStop, isDisabled: !state.context.line, onChange: (value) => send({ type: 'ON_INPUT_CHANGE', inputName: 'toStop', value }), options: (0, components_1.getStopOptions)(getQuaysByLine(state.context.line?.id ?? '')), placeholder: t(PageText.Contact.input.toStop.optionLabel), isRequired: true, error: state.context?.errorMessages['toStop']?.[0]
|
|
116
|
+
? t(state.context?.errorMessages['toStop']?.[0])
|
|
117
|
+
: undefined }), (0, jsx_runtime_1.jsx)(components_1.DateSelector, { id: "date", label: t(PageText.Contact.input.date.label), isRequired: true, value: state.context.date, onChange: (date) => send({ type: 'ON_INPUT_CHANGE', inputName: 'date', value: date }), errorMessage: state.context?.errorMessages['date']?.[0] }), (0, jsx_runtime_1.jsx)(components_1.DepartureTimeField, { date: state.context.date, lineId: state.context.line?.id, fromStopId: state.context.fromStop?.id, toStopId: state.context.toStop?.id, selectedTripId: state.context.tripId, plannedDepartureTime: state.context.plannedDepartureTime, onChange: (time, tripId) => {
|
|
118
|
+
send({
|
|
119
|
+
type: 'ON_INPUT_CHANGE',
|
|
120
|
+
inputName: 'plannedDepartureTime',
|
|
121
|
+
value: time,
|
|
122
|
+
});
|
|
123
|
+
send({
|
|
124
|
+
type: 'ON_INPUT_CHANGE',
|
|
125
|
+
inputName: 'tripId',
|
|
126
|
+
value: tripId,
|
|
127
|
+
});
|
|
128
|
+
}, isRequired: true, errorMessage: state.context.errorMessages['plannedDepartureTime']?.[0] })] }));
|
|
129
|
+
};
|
|
97
130
|
const OtherTicketRefund = ({ state, send }) => {
|
|
98
|
-
|
|
131
|
+
const { features } = (0, context_1.useContactFormConfig)();
|
|
132
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(RefundSection, { state: state, send: send }), (0, jsx_runtime_1.jsx)(AboutYouSection, { state: state, send: send }), features?.includeRefundDepartureInfo && ((0, jsx_runtime_1.jsx)(DepartureSection, { state: state, send: send }))] }));
|
|
99
133
|
};
|
|
100
134
|
exports.OtherTicketRefund = OtherTicketRefund;
|
|
101
135
|
exports.default = exports.OtherTicketRefund;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/refund/forms/residualValueOnTravelCard/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/refund/forms/residualValueOnTravelCard/index.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,yBAAyB,GAAI,MAAE,4CAyC3C,CAAC"}
|
|
@@ -5,15 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ResidualValueOnTravelCard = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const contact_module_css_1 = __importDefault(require("../../../contact.module.css"));
|
|
8
9
|
const link_1 = __importDefault(require("next/link"));
|
|
9
10
|
const typography_1 = require("../../../components/typography");
|
|
10
11
|
const translations_1 = require("../../../translations");
|
|
11
12
|
const components_1 = require("../../../components");
|
|
12
13
|
const ResidualValueOnTravelCard = ({}) => {
|
|
14
|
+
const PageText = (0, translations_1.usePageText)();
|
|
13
15
|
const { t } = (0, translations_1.useTranslation)();
|
|
14
|
-
return ((0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(
|
|
15
|
-
.monthlyPayoutDetails) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m__strong", children: t(
|
|
16
|
-
.automatedProcessNotice.note) }), (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)(components_1.Fieldset, { title: t(PageText.Contact.refund.residualValueOnTravelCard.title), children: [(0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: (0, jsx_runtime_1.jsx)(link_1.default, { className: contact_module_css_1.default.link, href: t(PageText.Contact.refund.residualValueOnTravelCard.link.href), target: "_blank", rel: "noopener noreferrer", children: t(PageText.Contact.refund.residualValueOnTravelCard.link.text) }) }), (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(PageText.Contact.refund.residualValueOnTravelCard
|
|
17
|
+
.monthlyPayoutDetails) }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m__strong", children: t(PageText.Contact.refund.residualValueOnTravelCard
|
|
18
|
+
.automatedProcessNotice.note) }), (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: t(PageText.Contact.refund.residualValueOnTravelCard
|
|
17
19
|
.automatedProcessNotice.text) })] })] }));
|
|
18
20
|
};
|
|
19
21
|
exports.ResidualValueOnTravelCard = ResidualValueOnTravelCard;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/refund/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/refund/index.tsx"],"names":[],"mappings":"AAgBA,QAAA,MAAM,aAAa,+CA+HlB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/lib/refund/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const react_1 = require("@xstate/react");
|
|
|
8
8
|
const react_2 = require("react");
|
|
9
9
|
const config_1 = require("../modules/config");
|
|
10
10
|
const refundFormMachine_1 = require("./refundFormMachine");
|
|
11
|
+
const url_form_type_1 = require("../url-form-type");
|
|
11
12
|
const contact_module_css_1 = __importDefault(require("../contact.module.css"));
|
|
12
13
|
const components_1 = require("../components");
|
|
13
14
|
const refund_and_travel_guarantee_1 = __importDefault(require("./forms/refund-and-travel-guarantee"));
|
|
@@ -18,9 +19,11 @@ const translations_1 = require("../translations");
|
|
|
18
19
|
const button_1 = require("../components/button");
|
|
19
20
|
const error_message_1 = __importDefault(require("../components/error-message/error-message"));
|
|
20
21
|
const RefundContent = () => {
|
|
22
|
+
const PageText = (0, translations_1.usePageText)();
|
|
21
23
|
const { t } = (0, translations_1.useTranslation)();
|
|
22
24
|
const apiConfig = (0, config_1.useApiConfig)();
|
|
23
|
-
const { formSchemaOverrides, layout } = (0, config_1.useContactFormConfig)();
|
|
25
|
+
const { formSchemaOverrides, layout, features } = (0, config_1.useContactFormConfig)();
|
|
26
|
+
const customFormRenderers = formSchemaOverrides?.refund?.customFormRenderers;
|
|
24
27
|
const successPath = layout?.successPath ??
|
|
25
28
|
(layout?.basePath ? `${layout.basePath}/success` : '/contact/success');
|
|
26
29
|
const errorPath = layout?.errorPath ??
|
|
@@ -28,7 +31,15 @@ const RefundContent = () => {
|
|
|
28
31
|
const machine = (0, react_2.useMemo)(() => (0, refundFormMachine_1.createRefundStateMachine)(apiConfig.onSubmit, {
|
|
29
32
|
successPath,
|
|
30
33
|
errorPath,
|
|
31
|
-
|
|
34
|
+
includeOtherTicketTypeSelector: features?.includeOtherTicketTypeSelector !== false,
|
|
35
|
+
includeRefundDepartureInfo: features?.includeRefundDepartureInfo === true,
|
|
36
|
+
}), [
|
|
37
|
+
apiConfig.onSubmit,
|
|
38
|
+
successPath,
|
|
39
|
+
errorPath,
|
|
40
|
+
features?.includeOtherTicketTypeSelector,
|
|
41
|
+
features?.includeRefundDepartureInfo,
|
|
42
|
+
]);
|
|
32
43
|
const [state, send] = (0, react_1.useMachine)(machine);
|
|
33
44
|
const displaySubmitButton = state.context.formType &&
|
|
34
45
|
state.context.formType !== 'residualValueOnTravelCard';
|
|
@@ -40,13 +51,35 @@ const RefundContent = () => {
|
|
|
40
51
|
return allCategories;
|
|
41
52
|
return allCategories.filter((category) => override.includes(category));
|
|
42
53
|
}, [formSchemaOverrides]);
|
|
54
|
+
const enabledFormCategoriesRef = (0, react_2.useRef)(enabledFormCategories);
|
|
55
|
+
(0, react_2.useEffect)(() => {
|
|
56
|
+
const { type, agreed } = (0, url_form_type_1.readFormTypeParam)(enabledFormCategoriesRef.current);
|
|
57
|
+
if (type) {
|
|
58
|
+
send({
|
|
59
|
+
type: 'SELECT_FORM_CATEGORY',
|
|
60
|
+
formCategory: type,
|
|
61
|
+
});
|
|
62
|
+
if (agreed && type !== 'residualValueOnTravelCard') {
|
|
63
|
+
send({
|
|
64
|
+
type: 'ON_INPUT_CHANGE',
|
|
65
|
+
inputName: 'isInitialAgreementChecked',
|
|
66
|
+
value: true,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, [send]);
|
|
43
71
|
const onSubmit = async (e) => {
|
|
44
72
|
e.preventDefault();
|
|
45
73
|
send({ type: 'SUBMIT', orderedFormFieldNames: (0, utils_1.findOrderFormFields)(e) });
|
|
46
74
|
};
|
|
47
|
-
return ((0, jsx_runtime_1.jsxs)("form", { onSubmit: onSubmit, className: contact_module_css_1.default.form, children: [(0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
75
|
+
return ((0, jsx_runtime_1.jsxs)("form", { onSubmit: onSubmit, className: contact_module_css_1.default.form, children: [(0, jsx_runtime_1.jsx)(components_1.Fieldset, { title: t(PageText.Contact.refund.title), children: (0, jsx_runtime_1.jsx)("ul", { className: contact_module_css_1.default.form_options__list, children: enabledFormCategories.map((formCategory) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)(components_1.Radio, { label: t(PageText.Contact.refund[formCategory].description), checked: state.matches({ editing: formCategory }), onChange: () => {
|
|
76
|
+
(0, url_form_type_1.setFormTypeParam)(formCategory);
|
|
77
|
+
send({
|
|
78
|
+
type: 'SELECT_FORM_CATEGORY',
|
|
79
|
+
formCategory: formCategory,
|
|
80
|
+
});
|
|
81
|
+
} }) }, formCategory))) }) }), state.matches({ editing: 'refundOfTicket' }) && ((0, jsx_runtime_1.jsx)(refund_ticket_1.default, { state: state, send: send })), state.matches({ editing: 'refundAndTravelGuarantee' }) && ((0, jsx_runtime_1.jsx)(refund_and_travel_guarantee_1.default, { state: state, send: send })), state.matches({ editing: 'residualValueOnTravelCard' }) &&
|
|
82
|
+
(customFormRenderers?.residualValueOnTravelCard ? (customFormRenderers.residualValueOnTravelCard(state, send)) : ((0, jsx_runtime_1.jsx)(residualValueOnTravelCard_1.ResidualValueOnTravelCard, {}))), state.matches({ editing: 'ticketBoughtOnBus' }) &&
|
|
83
|
+
customFormRenderers?.ticketBoughtOnBus?.(state, send), state.context.hasSubmissionError && ((0, jsx_runtime_1.jsx)(error_message_1.default, { message: t(PageText.Contact.error.info), id: "submission-error" })), displaySubmitButton && ((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 }))] }));
|
|
51
84
|
};
|
|
52
85
|
exports.default = RefundContent;
|