@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/lib/utils.d.ts
CHANGED
|
@@ -8,13 +8,66 @@ export declare const convertFilesToBase64: (attachments: File[]) => Promise<{
|
|
|
8
8
|
filename: string;
|
|
9
9
|
body: string;
|
|
10
10
|
}[]>;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
type ContextWithErrors = {
|
|
12
|
+
errorMessages: InputErrorMessages;
|
|
13
|
+
};
|
|
14
|
+
export declare const setTransportModeAndResetLineAndStops: <C extends ContextWithErrors>(context: C, transporMode: TransportModeType) => C & {
|
|
15
|
+
transportMode: TransportModeType;
|
|
16
|
+
line: undefined;
|
|
17
|
+
fromStop: undefined;
|
|
18
|
+
toStop: undefined;
|
|
19
|
+
plannedDepartureTime: undefined;
|
|
20
|
+
timeOfTicketControl: undefined;
|
|
21
|
+
tripId: undefined;
|
|
22
|
+
errorMessages: {
|
|
23
|
+
transportMode: never[];
|
|
24
|
+
line: never[];
|
|
25
|
+
fromStop: never[];
|
|
26
|
+
toStop: never[];
|
|
27
|
+
plannedDepartureTime: never[];
|
|
28
|
+
timeOfTicketControl: never[];
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export declare const setLineAndResetStops: <C extends ContextWithErrors>(context: C, line: Line | undefined) => C & {
|
|
32
|
+
line: {
|
|
33
|
+
id: string;
|
|
34
|
+
name: string;
|
|
35
|
+
publicCode: string | null;
|
|
36
|
+
transportMode: "bicycle" | "foot" | "scooter" | "air" | "bus" | "cableway" | "car" | "carpool" | "coach" | "funicular" | "lift" | "metro" | "monorail" | "rail" | "taxi" | "tram" | "trolleybus" | "snowAndIce" | "unknown" | "water" | null;
|
|
37
|
+
transportSubmode: "undefined" | "funicular" | "lift" | "metro" | "unknown" | "escooter" | "ebicycle" | "SchengenAreaFlight" | "airportBoatLink" | "airportLinkBus" | "airportLinkRail" | "airshipService" | "allFunicularServices" | "allHireVehicles" | "allTaxiServices" | "bikeTaxi" | "blackCab" | "cableCar" | "cableFerry" | "canalBarge" | "carTransportRailService" | "chairLift" | "charterTaxi" | "cityTram" | "communalTaxi" | "commuterCoach" | "crossCountryRail" | "dedicatedLaneBus" | "demandAndResponseBus" | "domesticCharterFlight" | "domesticFlight" | "domesticScheduledFlight" | "dragLift" | "expressBus" | "helicopterService" | "highFrequencyBus" | "highSpeedPassengerService" | "highSpeedRail" | "highSpeedVehicleService" | "hireCar" | "hireCycle" | "hireMotorbike" | "hireVan" | "intercontinentalCharterFlight" | "intercontinentalFlight" | "international" | "internationalCarFerry" | "internationalCharterFlight" | "internationalCoach" | "internationalFlight" | "internationalPassengerFerry" | "interregionalRail" | "local" | "localBus" | "localCarFerry" | "localPassengerFerry" | "localTram" | "longDistance" | "miniCab" | "mobilityBus" | "mobilityBusForRegisteredDisabled" | "nationalCarFerry" | "nationalCoach" | "nationalPassengerFerry" | "nightBus" | "nightRail" | "postBoat" | "postBus" | "rackAndPinionRailway" | "railReplacementBus" | "railShuttle" | "railTaxi" | "regionalBus" | "regionalCarFerry" | "regionalCoach" | "regionalPassengerFerry" | "regionalRail" | "regionalTram" | "replacementRailService" | "riverBus" | "roadFerryLink" | "roundTripCharterFlight" | "scheduledFerry" | "schoolAndPublicServiceBus" | "schoolBoat" | "schoolBus" | "schoolCoach" | "shortHaulInternationalFlight" | "shuttleBus" | "shuttleCoach" | "shuttleFerryService" | "shuttleFlight" | "shuttleTram" | "sightseeingBus" | "sightseeingCoach" | "sightseeingFlight" | "sightseeingService" | "sightseeingTram" | "sleeperRailService" | "specialCoach" | "specialNeedsBus" | "specialTrain" | "streetCableCar" | "suburbanRailway" | "telecabin" | "telecabinLink" | "touristCoach" | "touristRailway" | "trainFerry" | "trainTram" | "tube" | "undefinedFunicular" | "urbanRailway" | "waterTaxi" | null;
|
|
38
|
+
quays: {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
description: string | null;
|
|
42
|
+
}[];
|
|
43
|
+
} | undefined;
|
|
44
|
+
fromStop: undefined;
|
|
45
|
+
toStop: undefined;
|
|
46
|
+
plannedDepartureTime: undefined;
|
|
47
|
+
timeOfTicketControl: undefined;
|
|
48
|
+
tripId: undefined;
|
|
49
|
+
errorMessages: {
|
|
50
|
+
line: never[];
|
|
51
|
+
fromStop: never[];
|
|
52
|
+
toStop: never[];
|
|
53
|
+
plannedDepartureTime: never[];
|
|
54
|
+
timeOfTicketControl: never[];
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export declare const setBankAccountStatusAndResetBankInformation: <C extends ContextWithErrors>(context: C, hasInternationalBankAccount: boolean) => C & {
|
|
58
|
+
hasInternationalBankAccount: boolean;
|
|
59
|
+
bankAccountNumber: undefined;
|
|
60
|
+
IBAN: undefined;
|
|
61
|
+
SWIFT: undefined;
|
|
62
|
+
errorMessages: {
|
|
63
|
+
bankAccountNumber: never[];
|
|
64
|
+
};
|
|
65
|
+
};
|
|
14
66
|
export declare const findOrderFormFields: (e: FormEvent<HTMLFormElement>) => string[];
|
|
15
67
|
export declare const scrollToFirstErrorMessage: (id: string | undefined) => void;
|
|
16
68
|
export declare const findFirstErrorMessage: (formFields: string[] | undefined, errors: InputErrorMessages) => string | undefined;
|
|
17
69
|
export declare function getLineName(line: Line | undefined): string | undefined;
|
|
18
70
|
export declare function warnDev(message: string): void;
|
|
19
71
|
export declare function warnDevMissingTranslation(key: string): void;
|
|
72
|
+
export {};
|
|
20
73
|
//# sourceMappingURL=utils.d.ts.map
|
package/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAY,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,eAAO,MAAM,mBAAmB,GAC9B,WAAW,gBAAgB,KAC1B,gBAAgB,EAIlB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,aAAa,IAAI,EAAE,KAClB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAsB9C,CAAC;AAEF,eAAO,MAAM,oCAAoC,GAC/C,SAAS,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAY,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAE5D,eAAO,MAAM,mBAAmB,GAC9B,WAAW,gBAAgB,KAC1B,gBAAgB,EAIlB,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,aAAa,IAAI,EAAE,KAClB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,CAsB9C,CAAC;AAEF,KAAK,iBAAiB,GAAG;IAAE,aAAa,EAAE,kBAAkB,CAAA;CAAE,CAAC;AAE/D,eAAO,MAAM,oCAAoC,GAC/C,CAAC,SAAS,iBAAiB,EAE3B,SAAS,CAAC,EACV,cAAc,iBAAiB;;;;;;;;;;;;;;;;CAqBhC,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,iBAAiB,EAC9D,SAAS,CAAC,EACV,MAAM,IAAI,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;CAmBvB,CAAC;AAEF,eAAO,MAAM,2CAA2C,GACtD,CAAC,SAAS,iBAAiB,EAE3B,SAAS,CAAC,EACV,6BAA6B,OAAO;;;;;;;;CAUrC,CAAC;AAYF,eAAO,MAAM,mBAAmB,GAAI,GAAG,SAAS,CAAC,eAAe,CAAC,KAAG,MAAM,EAOpC,CAAC;AAEvC,eAAO,MAAM,yBAAyB,GAAI,IAAI,MAAM,GAAG,SAAS,KAAG,IA4BlE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,YAAY,MAAM,EAAE,GAAG,SAAS,EAChC,QAAQ,kBAAkB,KACzB,MAAM,GAAG,SAQX,CAAC;AAEF,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAEtE;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAI7C;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAI3D"}
|
|
@@ -2,6 +2,6 @@ import { TranslatedString } from '../translations';
|
|
|
2
2
|
export type InputErrorMessages = {
|
|
3
3
|
[key: string]: TranslatedString[];
|
|
4
4
|
};
|
|
5
|
-
export declare const commonInputValidator: (context
|
|
5
|
+
export declare const commonInputValidator: (context?: object) => InputErrorMessages;
|
|
6
6
|
export default commonInputValidator;
|
|
7
7
|
//# sourceMappingURL=commonInputValidator.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonInputValidator.d.ts","sourceRoot":"","sources":["../../src/validation/commonInputValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGnD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"commonInputValidator.d.ts","sourceRoot":"","sources":["../../src/validation/commonInputValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAGnD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAC;CACnC,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,UAAS,MAAW,KACnB,kBAiBF,CAAC;AAaF,eAAe,oBAAoB,CAAC"}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.commonInputValidator = void 0;
|
|
4
4
|
const validationRules_1 = require("./validationRules");
|
|
5
|
-
const commonInputValidator = (context) => {
|
|
5
|
+
const commonInputValidator = (context = {}) => {
|
|
6
6
|
const inputErrorMessages = {};
|
|
7
|
-
Object.
|
|
7
|
+
Object.entries(context).forEach(([inputName, value]) => {
|
|
8
8
|
const rules = validationRules_1.validationRules[inputName];
|
|
9
9
|
if (!rules)
|
|
10
10
|
return;
|
|
11
11
|
for (const { validate, errorMessage } of rules) {
|
|
12
|
-
const isValid = validate(
|
|
12
|
+
const isValid = validate(value);
|
|
13
13
|
if (!isValid) {
|
|
14
14
|
addErrorMessage(inputName, errorMessage, inputErrorMessages);
|
|
15
15
|
return; // Stop the loop after the first error is found
|
|
@@ -3,6 +3,8 @@ type ValidationRule = {
|
|
|
3
3
|
validate: (value: any) => boolean;
|
|
4
4
|
errorMessage: TranslatedString;
|
|
5
5
|
};
|
|
6
|
+
export declare const PRE_PURCHASED_TICKET_MIN_DELAYED_DEPARTURES = 4;
|
|
7
|
+
export declare const isWithinOneMonth: (dates: string[]) => boolean;
|
|
6
8
|
type ValidationRulesMap = {
|
|
7
9
|
[inputName: string]: ValidationRule[];
|
|
8
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validationRules.d.ts","sourceRoot":"","sources":["../../src/validation/validationRules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validationRules.d.ts","sourceRoot":"","sources":["../../src/validation/validationRules.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAyD7D,KAAK,cAAc,GAAG;IAEpB,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC;IAClC,YAAY,EAAE,gBAAgB,CAAC;CAChC,CAAC;AAyXF,eAAO,MAAM,2CAA2C,IAAI,CAAC;AAG7D,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,EAAE,KAAG,OAMlD,CAAC;AA0BF,KAAK,kBAAkB,GAAG;IAAE,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,EAAE,CAAA;CAAE,CAAC;AAEpE,eAAO,MAAM,eAAe,EAAE,kBA4C7B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validationRules = void 0;
|
|
3
|
+
exports.validationRules = exports.isWithinOneMonth = exports.PRE_PURCHASED_TICKET_MIN_DELAYED_DEPARTURES = void 0;
|
|
4
|
+
const date_1 = require("@internationalized/date");
|
|
4
5
|
const translations_1 = require("../translations");
|
|
5
6
|
const isDefined = (value) => value !== undefined;
|
|
6
7
|
const removeWhitespace = (value) => {
|
|
@@ -360,6 +361,29 @@ const rulesIsResponseWanted = [
|
|
|
360
361
|
errorMessage: translations_1.PageText.Contact.input.wantedResponse.errorMessages.undefined,
|
|
361
362
|
},
|
|
362
363
|
];
|
|
364
|
+
exports.PRE_PURCHASED_TICKET_MIN_DELAYED_DEPARTURES = 4;
|
|
365
|
+
// Latest departure must be less than one month after the earliest.
|
|
366
|
+
const isWithinOneMonth = (dates) => {
|
|
367
|
+
if (dates.length === 0)
|
|
368
|
+
return true;
|
|
369
|
+
const sorted = [...dates].sort();
|
|
370
|
+
const earliest = (0, date_1.parseDate)(sorted[0]);
|
|
371
|
+
const latest = (0, date_1.parseDate)(sorted[sorted.length - 1]);
|
|
372
|
+
return latest.compare(earliest.add({ months: 1 })) < 0;
|
|
373
|
+
};
|
|
374
|
+
exports.isWithinOneMonth = isWithinOneMonth;
|
|
375
|
+
const rulesPrePurchasedTicketDelayedDepartures = [
|
|
376
|
+
{
|
|
377
|
+
validate: (departures) => (departures?.length ?? 0) >= exports.PRE_PURCHASED_TICKET_MIN_DELAYED_DEPARTURES,
|
|
378
|
+
errorMessage: translations_1.PageText.Contact.refund.prePurchasedTicketRefund.delayedDepartures
|
|
379
|
+
.errorMessages.tooFew,
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
validate: (departures) => (0, exports.isWithinOneMonth)((departures ?? []).map((d) => d.date)),
|
|
383
|
+
errorMessage: translations_1.PageText.Contact.refund.prePurchasedTicketRefund.delayedDepartures
|
|
384
|
+
.errorMessages.notWithinOneMonth,
|
|
385
|
+
},
|
|
386
|
+
];
|
|
363
387
|
const rulesBankCardDetails = [
|
|
364
388
|
{
|
|
365
389
|
validate: isNonEmptyString,
|
|
@@ -409,4 +433,5 @@ exports.validationRules = {
|
|
|
409
433
|
travelCardNumber: rulesTravelCardNumber,
|
|
410
434
|
isResponseWanted: rulesIsResponseWanted,
|
|
411
435
|
bankCardDetails: rulesBankCardDetails,
|
|
436
|
+
prePurchasedTicketDelayedDepartures: rulesPrePurchasedTicketDelayedDepartures,
|
|
412
437
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrfylke/contact-form",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.35",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"generate-icons-manifest": "generate-assets all atb -o ./.tmp-icon-assets/ -ts -ts-o ./src/components/icon && rm -rf ./.tmp-icon-assets",
|
|
55
|
-
"prebuild": "
|
|
55
|
+
"prebuild": "pnpm run generate-icons-manifest",
|
|
56
56
|
"build": "tsc -p tsconfig.build.json && node scripts/copy-css.cjs",
|
|
57
57
|
"clean": "rm -rf lib",
|
|
58
58
|
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
59
59
|
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
|
|
60
60
|
"format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
|
|
61
|
-
"pretest": "
|
|
61
|
+
"pretest": "pnpm run generate-icons-manifest",
|
|
62
62
|
"test": "vitest run",
|
|
63
63
|
"test:watch": "vitest"
|
|
64
64
|
},
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"@testing-library/react": "^16.3.3",
|
|
75
75
|
"@testing-library/user-event": "^14.6.6",
|
|
76
76
|
"@types/jsdom": "^28.0.3",
|
|
77
|
+
"@types/node": "^26",
|
|
77
78
|
"@types/react": "19.2.18",
|
|
78
79
|
"@types/react-dom": "19.2.5",
|
|
79
80
|
"eslint": "^9",
|
|
@@ -81,7 +82,12 @@
|
|
|
81
82
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
82
83
|
"jiti": "^2",
|
|
83
84
|
"jsdom": "^28.1.0",
|
|
85
|
+
"next": "16.3.4",
|
|
84
86
|
"prettier": "^3.9.6",
|
|
87
|
+
"react": "19.2.8",
|
|
88
|
+
"react-dom": "19.2.8",
|
|
89
|
+
"swr": "^2.5.1",
|
|
90
|
+
"typescript": "^5",
|
|
85
91
|
"typescript-eslint": "^8.69.0",
|
|
86
92
|
"vitest": "^4.1.11"
|
|
87
93
|
},
|
|
@@ -93,14 +99,14 @@
|
|
|
93
99
|
"@atb-as/token": "^0.0.4",
|
|
94
100
|
"@internationalized/date": "^3.12.3",
|
|
95
101
|
"@leile/lobo-t": "^1.0.5",
|
|
96
|
-
"@react-aria/focus": "^3.22.1",
|
|
97
102
|
"@xstate/react": "^6.1.0",
|
|
98
103
|
"detect-nearest-browser-locale": "^19.0.0",
|
|
99
104
|
"detect-nearest-locale": "^1.0.1",
|
|
100
|
-
"framer-motion": "^12.43.0",
|
|
101
105
|
"graphql": "^16.14.2",
|
|
102
|
-
"
|
|
103
|
-
"
|
|
106
|
+
"graphql-tag": "^2.12.6",
|
|
107
|
+
"react-aria-components": "^1.21.0",
|
|
108
|
+
"xstate": "^5.32.6",
|
|
109
|
+
"zod": "^4.3.6"
|
|
104
110
|
},
|
|
105
111
|
"peerDependencies": {
|
|
106
112
|
"@atb-as/theme": "^15.3.0",
|
|
@@ -109,7 +115,7 @@
|
|
|
109
115
|
"lodash": "^4.18.1",
|
|
110
116
|
"next": ">=15.0.0",
|
|
111
117
|
"react": "^18.3.1",
|
|
112
|
-
"react-aria-components": "^1.
|
|
118
|
+
"react-aria-components": "^1.21.0",
|
|
113
119
|
"react-dom": "^18.3.1",
|
|
114
120
|
"swr": "^2.5.1",
|
|
115
121
|
"uuid": "^13.0.2"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
type DescriptionModalProps = {
|
|
2
|
-
title: string;
|
|
3
|
-
modalContent: {
|
|
4
|
-
description?: string;
|
|
5
|
-
instruction?: string;
|
|
6
|
-
bulletPoints?: string[];
|
|
7
|
-
};
|
|
8
|
-
isModalOpen: boolean;
|
|
9
|
-
closeModal: () => void;
|
|
10
|
-
};
|
|
11
|
-
declare const DescriptionModal: ({ title, modalContent, isModalOpen, closeModal, }: DescriptionModalProps) => import("react").JSX.Element | null;
|
|
12
|
-
export default DescriptionModal;
|
|
13
|
-
//# sourceMappingURL=description-modal.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"description-modal.d.ts","sourceRoot":"","sources":["../../../src/components/form/description-modal.tsx"],"names":[],"mappings":"AASA,KAAK,qBAAqB,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;KACzB,CAAC;IACF,WAAW,EAAE,OAAO,CAAC;IACrB,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF,QAAA,MAAM,gBAAgB,GAAI,mDAKvB,qBAAqB,uCA2FvB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const form_module_css_1 = __importDefault(require("./form.module.css"));
|
|
8
|
-
const framer_motion_1 = require("framer-motion");
|
|
9
|
-
const focus_1 = require("@react-aria/focus");
|
|
10
|
-
const react_1 = require("react");
|
|
11
|
-
const translations_1 = require("../../translations");
|
|
12
|
-
const typography_1 = require("../typography");
|
|
13
|
-
const button_1 = require("../button");
|
|
14
|
-
const icon_1 = require("../icon");
|
|
15
|
-
const DescriptionModal = ({ title, modalContent, isModalOpen, closeModal, }) => {
|
|
16
|
-
const PageText = (0, translations_1.usePageText)();
|
|
17
|
-
const { t } = (0, translations_1.useTranslation)();
|
|
18
|
-
const modalRef = (0, react_1.useRef)(null);
|
|
19
|
-
const { description, instruction, bulletPoints } = modalContent;
|
|
20
|
-
const handleEscapeOrClickOutside = (0, react_1.useCallback)((event) => {
|
|
21
|
-
if (event instanceof KeyboardEvent && event.key === 'Escape') {
|
|
22
|
-
closeModal();
|
|
23
|
-
}
|
|
24
|
-
else if (event instanceof MouseEvent &&
|
|
25
|
-
modalRef.current &&
|
|
26
|
-
!modalRef.current.contains(event.target)) {
|
|
27
|
-
closeModal();
|
|
28
|
-
}
|
|
29
|
-
}, [closeModal]);
|
|
30
|
-
(0, react_1.useEffect)(() => {
|
|
31
|
-
document.addEventListener('keydown', handleEscapeOrClickOutside);
|
|
32
|
-
document.addEventListener('mousedown', handleEscapeOrClickOutside);
|
|
33
|
-
return () => {
|
|
34
|
-
document.removeEventListener('keydown', handleEscapeOrClickOutside);
|
|
35
|
-
document.removeEventListener('mousedown', handleEscapeOrClickOutside);
|
|
36
|
-
};
|
|
37
|
-
}, [handleEscapeOrClickOutside]);
|
|
38
|
-
if (!isModalOpen)
|
|
39
|
-
return null;
|
|
40
|
-
return ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { className: form_module_css_1.default.modal_wrapper, initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { ease: 'easeInOut', duration: 0.15 }, children: (0, jsx_runtime_1.jsx)(focus_1.FocusScope, { contain: true, restoreFocus: true, autoFocus: true, children: (0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, { ref: modalRef, initial: { opacity: 0, y: -30 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: 0 }, transition: { ease: 'backOut', delay: 0.1, duration: 0.15 }, children: (0, jsx_runtime_1.jsxs)("dialog", { "aria-modal": "true", "aria-labelledby": "title", tabIndex: 0, className: form_module_css_1.default.modal_content, children: [(0, jsx_runtime_1.jsxs)("div", { className: form_module_css_1.default.modal_header, children: [(0, jsx_runtime_1.jsx)(typography_1.Typo.h2, { id: "title", textType: "body__m", autoFocus: true, children: title }), (0, jsx_runtime_1.jsx)(button_1.Button, { className: form_module_css_1.default.iconButton, onClick: closeModal, icon: { right: (0, jsx_runtime_1.jsx)(icon_1.MonoIcon, { icon: 'actions/Close' }) }, buttonProps: {
|
|
41
|
-
'aria-label': t(PageText.Contact.components.modal.close()),
|
|
42
|
-
} })] }), description && (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: description }), bulletPoints && ((0, jsx_runtime_1.jsx)("ul", { className: form_module_css_1.default.modal__rules_list, children: bulletPoints.map((desc, index) => ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m", children: desc }, index) }, index))) })), instruction && ((0, jsx_runtime_1.jsx)(typography_1.Typo.p, { textType: "body__m__strong", children: instruction }))] }) }) }) }));
|
|
43
|
-
};
|
|
44
|
-
exports.default = DescriptionModal;
|