@mrfylke/contact-form 0.1.10 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +393 -2
- package/lib/ContactFormRoot.d.ts +11 -1
- package/lib/ContactFormRoot.d.ts.map +1 -1
- package/lib/ContactFormRoot.js +2 -2
- package/lib/commoneEvents.d.ts +1 -1
- package/lib/commoneEvents.d.ts.map +1 -1
- package/lib/components/form/date-selector.d.ts.map +1 -1
- package/lib/components/form/date-selector.js +5 -4
- package/lib/components/form/departure-time-field.d.ts +16 -0
- package/lib/components/form/departure-time-field.d.ts.map +1 -0
- package/lib/components/form/departure-time-field.js +28 -0
- package/lib/components/form/description-modal.d.ts.map +1 -1
- package/lib/components/form/description-modal.js +2 -1
- package/lib/components/form/file-input.d.ts.map +1 -1
- package/lib/components/form/file-input.js +2 -1
- package/lib/components/form/index.d.ts +1 -0
- package/lib/components/form/index.d.ts.map +1 -1
- package/lib/components/form/index.js +3 -1
- package/lib/components/form/input.d.ts.map +1 -1
- package/lib/components/form/input.js +2 -1
- package/lib/components/form/searchable-select/utils.js +6 -1
- package/lib/components/index.d.ts +1 -1
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +2 -1
- package/lib/contact.module.css +9 -0
- package/lib/error-content/error-content.d.ts.map +1 -1
- package/lib/error-content/error-content.js +2 -1
- package/lib/group-travel/index.d.ts.map +1 -1
- package/lib/group-travel/index.js +3 -1
- package/lib/index.d.ts +16 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +41 -1
- package/lib/journey-info/index.d.ts.map +1 -1
- package/lib/journey-info/index.js +14 -8
- package/lib/journey-info/journeyInfoStateMachine.d.ts +8 -8
- package/lib/layouts/contact-page-layout.d.ts +2 -2
- package/lib/layouts/contact-page-layout.d.ts.map +1 -1
- package/lib/layouts/contact-page-layout.js +29 -20
- package/lib/layouts/container.module.css +1 -1
- package/lib/layouts/layout.module.css +23 -2
- package/lib/lines/use-departures.d.ts +12 -0
- package/lib/lines/use-departures.d.ts.map +1 -0
- package/lib/lines/use-departures.js +35 -0
- package/lib/lines/use-lines.d.ts +5 -6
- package/lib/lines/use-lines.d.ts.map +1 -1
- package/lib/lines/use-lines.js +75 -42
- package/lib/lost-property/LostPropertyForm.d.ts +10 -0
- package/lib/lost-property/LostPropertyForm.d.ts.map +1 -0
- package/lib/lost-property/LostPropertyForm.js +65 -0
- package/lib/lost-property/LostPropertyMachine.d.ts +116 -0
- package/lib/lost-property/LostPropertyMachine.d.ts.map +1 -0
- package/lib/lost-property/LostPropertyMachine.js +187 -0
- package/lib/lost-property/index.d.ts.map +1 -1
- package/lib/lost-property/index.js +27 -3
- package/lib/means-of-transport/forms/delayForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/delayForm.js +26 -18
- package/lib/means-of-transport/forms/driverForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/driverForm.js +26 -18
- package/lib/means-of-transport/forms/injuryForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/injuryForm.js +26 -18
- package/lib/means-of-transport/forms/serviceOfferingForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/serviceOfferingForm.js +10 -10
- package/lib/means-of-transport/forms/stopForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/stopForm.js +13 -12
- package/lib/means-of-transport/forms/transportationForm.d.ts.map +1 -1
- package/lib/means-of-transport/forms/transportationForm.js +26 -18
- package/lib/means-of-transport/index.d.ts.map +1 -1
- package/lib/means-of-transport/index.js +13 -4
- package/lib/means-of-transport/means-of-transport-form-machine.d.ts +10 -8
- package/lib/means-of-transport/means-of-transport-form-machine.d.ts.map +1 -1
- package/lib/means-of-transport/means-of-transport-form-machine.js +6 -1
- package/lib/modules/config/types.d.ts +56 -1
- package/lib/modules/config/types.d.ts.map +1 -1
- package/lib/refund/events.d.ts +1 -1
- package/lib/refund/events.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/index.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/index.js +7 -5
- package/lib/refund/forms/refund-and-travel-guarantee/refundCarForm.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/refundCarForm.js +39 -29
- package/lib/refund/forms/refund-and-travel-guarantee/refundTaxiForm.d.ts.map +1 -1
- package/lib/refund/forms/refund-and-travel-guarantee/refundTaxiForm.js +37 -28
- package/lib/refund/forms/refund-ticket/appTicketRefund.d.ts.map +1 -1
- package/lib/refund/forms/refund-ticket/appTicketRefund.js +46 -25
- package/lib/refund/forms/refund-ticket/index.d.ts.map +1 -1
- package/lib/refund/forms/refund-ticket/index.js +9 -6
- package/lib/refund/forms/refund-ticket/otherTicketRefund.d.ts.map +1 -1
- package/lib/refund/forms/refund-ticket/otherTicketRefund.js +56 -30
- package/lib/refund/forms/residualValueOnTravelCard/index.d.ts.map +1 -1
- package/lib/refund/forms/residualValueOnTravelCard/index.js +5 -3
- package/lib/refund/index.d.ts.map +1 -1
- package/lib/refund/index.js +39 -6
- package/lib/refund/refundFormMachine.d.ts +37 -13
- package/lib/refund/refundFormMachine.d.ts.map +1 -1
- package/lib/refund/refundFormMachine.js +107 -11
- package/lib/server/journey-planner/index.d.ts.map +1 -1
- package/lib/server/journey-planner/index.js +15 -6
- package/lib/server/journey-planner/validators.d.ts +2 -0
- package/lib/server/journey-planner/validators.d.ts.map +1 -1
- package/lib/server/journey-planner/validators.js +1 -0
- package/lib/success-content/success-content.d.ts.map +1 -1
- package/lib/success-content/success-content.js +2 -1
- package/lib/test-utils/setup.d.ts +2 -0
- package/lib/test-utils/setup.d.ts.map +1 -0
- package/lib/test-utils/setup.js +3 -0
- package/lib/ticket-control/events.d.ts +1 -1
- package/lib/ticket-control/events.d.ts.map +1 -1
- package/lib/ticket-control/forms/feeComplaintForm.d.ts.map +1 -1
- package/lib/ticket-control/forms/feeComplaintForm.js +39 -36
- package/lib/ticket-control/forms/feedbackForm.d.ts.map +1 -1
- package/lib/ticket-control/forms/feedbackForm.js +26 -14
- package/lib/ticket-control/forms/postponePayment.d.ts.map +1 -1
- package/lib/ticket-control/forms/postponePayment.js +8 -7
- package/lib/ticket-control/index.d.ts.map +1 -1
- package/lib/ticket-control/index.js +23 -8
- package/lib/ticket-control/ticket-control-form-machine.d.ts +19 -11
- package/lib/ticket-control/ticket-control-form-machine.d.ts.map +1 -1
- package/lib/ticket-control/ticket-control-form-machine.js +25 -5
- package/lib/ticketing/forms/app/appAccountForm.d.ts.map +1 -1
- package/lib/ticketing/forms/app/appAccountForm.js +9 -8
- package/lib/ticketing/forms/app/appTicketingForm.d.ts.map +1 -1
- package/lib/ticketing/forms/app/appTicketingForm.js +13 -12
- package/lib/ticketing/forms/app/appTravelSuggestionForm.d.ts.map +1 -1
- package/lib/ticketing/forms/app/appTravelSuggestionForm.js +6 -5
- package/lib/ticketing/forms/app/index.d.ts.map +1 -1
- package/lib/ticketing/forms/app/index.js +2 -1
- package/lib/ticketing/forms/priceAndTicketTypesForm.d.ts.map +1 -1
- package/lib/ticketing/forms/priceAndTicketTypesForm.js +6 -5
- package/lib/ticketing/forms/travel-card/index.d.ts.map +1 -1
- package/lib/ticketing/forms/travel-card/index.js +2 -1
- package/lib/ticketing/forms/travel-card/orderTravelCard.d.ts.map +1 -1
- package/lib/ticketing/forms/travel-card/orderTravelCard.js +2 -2
- package/lib/ticketing/forms/travel-card/travelCardQuestionForm.d.ts.map +1 -1
- package/lib/ticketing/forms/travel-card/travelCardQuestionForm.js +9 -8
- package/lib/ticketing/forms/webshop/index.d.ts.map +1 -1
- package/lib/ticketing/forms/webshop/index.js +2 -1
- package/lib/ticketing/forms/webshop/webshopAccountForm.d.ts.map +1 -1
- package/lib/ticketing/forms/webshop/webshopAccountForm.js +9 -8
- package/lib/ticketing/forms/webshop/webshopTicketingForm.d.ts.map +1 -1
- package/lib/ticketing/forms/webshop/webshopTicketingForm.js +12 -11
- package/lib/ticketing/index.d.ts.map +1 -1
- package/lib/ticketing/index.js +21 -6
- package/lib/ticketing/ticketingStateMachine.d.ts +12 -12
- package/lib/translations/index.d.ts +1 -1
- package/lib/translations/index.d.ts.map +1 -1
- package/lib/translations/index.js +2 -1
- package/lib/translations/merge-overrides.d.ts.map +1 -1
- package/lib/translations/merge-overrides.js +8 -1
- package/lib/translations/pages/contact.d.ts +61 -0
- package/lib/translations/pages/contact.d.ts.map +1 -1
- package/lib/translations/pages/contact.js +64 -2
- package/lib/translations/translations-context.d.ts +2 -0
- package/lib/translations/translations-context.d.ts.map +1 -1
- package/lib/translations/translations-context.js +39 -0
- package/lib/types/submit-payloads.d.ts +40 -11
- package/lib/types/submit-payloads.d.ts.map +1 -1
- package/lib/types/submit-payloads.js +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/types.d.ts.map +1 -1
- package/lib/url-form-type.d.ts +6 -0
- package/lib/url-form-type.d.ts.map +1 -0
- package/lib/url-form-type.js +21 -0
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +10 -0
- package/lib/validation/validationRules.d.ts.map +1 -1
- package/lib/validation/validationRules.js +31 -0
- package/package.json +11 -3
|
@@ -261,6 +261,29 @@ const rulesOrderId = [
|
|
|
261
261
|
errorMessage: translations_1.PageText.Contact.input.orderId.errorMessages.invalidFormat.multipleIds,
|
|
262
262
|
},
|
|
263
263
|
];
|
|
264
|
+
const rulesReferenceNumber = [
|
|
265
|
+
{
|
|
266
|
+
validate: isNonEmptyString,
|
|
267
|
+
errorMessage: translations_1.PageText.Contact.input.referenceNumber.errorMessages.empty,
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
validate: (val) => {
|
|
271
|
+
if (val.includes(','))
|
|
272
|
+
return true;
|
|
273
|
+
return hasExpectedLength(6, 8)(removeWhitespace(val));
|
|
274
|
+
},
|
|
275
|
+
errorMessage: translations_1.PageText.Contact.input.referenceNumber.errorMessages.invalidFormat
|
|
276
|
+
.singleId,
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
validate: (val) => {
|
|
280
|
+
const ids = removeWhitespace(val).split(',');
|
|
281
|
+
return ids.every((id) => hasExpectedLength(6, 8)(id));
|
|
282
|
+
},
|
|
283
|
+
errorMessage: translations_1.PageText.Contact.input.referenceNumber.errorMessages.invalidFormat
|
|
284
|
+
.multipleIds,
|
|
285
|
+
},
|
|
286
|
+
];
|
|
264
287
|
const rulesRefundReason = [
|
|
265
288
|
{
|
|
266
289
|
validate: isNonEmptyString,
|
|
@@ -331,6 +354,12 @@ const rulesIsResponseWanted = [
|
|
|
331
354
|
errorMessage: translations_1.PageText.Contact.input.wantedResponse.errorMessages.undefined,
|
|
332
355
|
},
|
|
333
356
|
];
|
|
357
|
+
const rulesBankCardDetails = [
|
|
358
|
+
{
|
|
359
|
+
validate: isNonEmptyString,
|
|
360
|
+
errorMessage: translations_1.PageText.Contact.input.bankCardDetails.errorMessages.empty,
|
|
361
|
+
},
|
|
362
|
+
];
|
|
334
363
|
exports.validationRules = {
|
|
335
364
|
firstName: rulesFirstName,
|
|
336
365
|
lastName: rulesLastName,
|
|
@@ -360,6 +389,7 @@ exports.validationRules = {
|
|
|
360
389
|
toAddress: rulesToAddress,
|
|
361
390
|
question: rulesQuestion,
|
|
362
391
|
orderId: rulesOrderId,
|
|
392
|
+
referenceNumber: rulesReferenceNumber,
|
|
363
393
|
refundReason: rulesRefundReason,
|
|
364
394
|
amount: rulesAmount,
|
|
365
395
|
ticketType: rulesTicketType,
|
|
@@ -369,4 +399,5 @@ exports.validationRules = {
|
|
|
369
399
|
customerNumber: rulesCustomerNumber,
|
|
370
400
|
travelCardNumber: rulesTravelCardNumber,
|
|
371
401
|
isResponseWanted: rulesIsResponseWanted,
|
|
402
|
+
bankCardDetails: rulesBankCardDetails,
|
|
372
403
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrfylke/contact-form",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -34,6 +34,11 @@
|
|
|
34
34
|
"import": "./lib/modules/config/index.js",
|
|
35
35
|
"require": "./lib/modules/config/index.js"
|
|
36
36
|
},
|
|
37
|
+
"./config/data": {
|
|
38
|
+
"types": "./lib/modules/config/data.d.ts",
|
|
39
|
+
"import": "./lib/modules/config/data.js",
|
|
40
|
+
"require": "./lib/modules/config/data.js"
|
|
41
|
+
},
|
|
37
42
|
"./server": {
|
|
38
43
|
"types": "./lib/server/index.d.ts",
|
|
39
44
|
"import": "./lib/server/index.js",
|
|
@@ -45,7 +50,9 @@
|
|
|
45
50
|
"clean": "rm -rf lib",
|
|
46
51
|
"lint": "eslint \"src/**/*.{ts,tsx}\"",
|
|
47
52
|
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
|
|
48
|
-
"format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\""
|
|
53
|
+
"format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
|
|
54
|
+
"test": "vitest run",
|
|
55
|
+
"test:watch": "vitest"
|
|
49
56
|
},
|
|
50
57
|
"devDependencies": {
|
|
51
58
|
"@graphql-codegen/cli": "^5.0.7",
|
|
@@ -57,11 +64,13 @@
|
|
|
57
64
|
"@testing-library/jest-dom": "^6.7.0",
|
|
58
65
|
"@testing-library/react": "^16.3.2",
|
|
59
66
|
"@testing-library/user-event": "^14.6.1",
|
|
67
|
+
"@types/jsdom": "^28.0.0",
|
|
60
68
|
"@types/react": "19.1.10",
|
|
61
69
|
"@types/react-dom": "19.1.7",
|
|
62
70
|
"eslint": "^9",
|
|
63
71
|
"eslint-plugin-react": "^7.37.0",
|
|
64
72
|
"eslint-plugin-react-hooks": "^7.0.0",
|
|
73
|
+
"jsdom": "^28.1.0",
|
|
65
74
|
"prettier": "^3.0.0",
|
|
66
75
|
"typescript-eslint": "^8.54.0",
|
|
67
76
|
"vitest": "^4.0.18"
|
|
@@ -82,7 +91,6 @@
|
|
|
82
91
|
"xstate": "^5.26.0"
|
|
83
92
|
},
|
|
84
93
|
"peerDependencies": {
|
|
85
|
-
"@atb-as/components": "^15.0.0",
|
|
86
94
|
"@atb-as/generate-assets": "^18.7.0",
|
|
87
95
|
"@atb-as/theme": "^15.0.0",
|
|
88
96
|
"@atb-as/token": "^0.0.4",
|