@tet/tet-components 1.4.1-staging → 1.4.2-staging
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/dist/cjs/{phone-ed64bd26.js → phone-99b69770.js} +13 -29
- package/dist/cjs/required-253932be.js +32 -0
- package/dist/cjs/tet-address-offers_4.cjs.entry.js +4 -4
- package/dist/cjs/tet-b2b-check-out-form_5.cjs.entry.js +160 -25
- package/dist/cjs/tet-contact-form.cjs.entry.js +4 -4
- package/dist/collection/components/advanced/forms/tet-b2b-check-out-form/tet-b2b-check-out-form.js +28 -23
- package/dist/collection/services/validators/index.js +4 -1
- package/dist/collection/services/validators/validators/company-registration-number.js +38 -0
- package/dist/collection/services/validators/validators/e-mail.js +14 -1
- package/dist/collection/services/validators/validators/name.js +43 -0
- package/dist/collection/services/validators/validators/phone_v2.js +35 -0
- package/dist/components/{p-c47caf67.js → p-307c9553.js} +2 -2
- package/dist/{esm/phone-4b016684.js → components/p-58928b72.js} +13 -29
- package/dist/components/{p-dcf5c661.js → p-8972916d.js} +159 -24
- package/dist/components/p-e1259b83.js +30 -0
- package/dist/components/tet-address-offers-view.js +1 -1
- package/dist/components/tet-availability-contact-form.js +1 -1
- package/dist/components/tet-b2b-check-out-form.js +1 -1
- package/dist/components/tet-b2b-configurator.js +1 -1
- package/dist/components/tet-contact-form.js +2 -2
- package/dist/{components/p-12649d6e.js → esm/phone-4acf2597.js} +13 -29
- package/dist/esm/required-189b5861.js +30 -0
- package/dist/esm/tet-address-offers_4.entry.js +2 -2
- package/dist/esm/tet-b2b-check-out-form_5.entry.js +159 -24
- package/dist/esm/tet-contact-form.entry.js +2 -2
- package/dist/tet-components/p-09c27a34.entry.js +1 -0
- package/dist/tet-components/{p-2a346803.entry.js → p-3de2172f.entry.js} +1 -1
- package/dist/tet-components/p-46ca1eab.js +1 -0
- package/dist/tet-components/p-e1259b83.js +1 -0
- package/dist/tet-components/p-f263f970.entry.js +1 -0
- package/dist/tet-components/tet-components.esm.js +1 -1
- package/dist/types/components/advanced/forms/tet-b2b-check-out-form/tet-b2b-check-out-form.d.ts +3 -1
- package/dist/types/services/validators/index.d.ts +4 -1
- package/dist/types/services/validators/validators/company-registration-number.d.ts +28 -0
- package/dist/types/services/validators/validators/name.d.ts +34 -0
- package/dist/types/services/validators/validators/phone_v2.d.ts +29 -0
- package/package.json +1 -1
- package/dist/cjs/tasks-57ad40ae.js +0 -16
- package/dist/components/p-0e0dcb37.js +0 -14
- package/dist/esm/tasks-770dc32d.js +0 -14
- package/dist/tet-components/p-12649d6e.js +0 -1
- package/dist/tet-components/p-8aecb130.entry.js +0 -1
- package/dist/tet-components/p-cba8d001.js +0 -1
- package/dist/tet-components/p-e87f981c.entry.js +0 -1
|
@@ -1,33 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Returns validation error message.
|
|
18
|
-
*/
|
|
19
|
-
getErrorMessage() {
|
|
20
|
-
return this.errorMessage;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Validation logic.
|
|
24
|
-
*
|
|
25
|
-
* @param value
|
|
26
|
-
*/
|
|
27
|
-
validate(value) {
|
|
28
|
-
return !!value?.trim();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
3
|
+
const httpCodes = require('./http-codes-38914116.js');
|
|
4
|
+
const asyncRequest = require('./async-request-77d8e0b8.js');
|
|
5
|
+
|
|
6
|
+
const createCallCenterTask = (options) => {
|
|
7
|
+
const url = httpCodes.endpoints.createCallCenterTask;
|
|
8
|
+
const asyncRequest$1 = new asyncRequest.AsyncApiRequest()
|
|
9
|
+
.setUrl(url)
|
|
10
|
+
.setData(options)
|
|
11
|
+
.setOptions({ method: 'POST' })
|
|
12
|
+
.setErrorFallbackValue({ TaskId: null });
|
|
13
|
+
return asyncRequest$1.execute();
|
|
14
|
+
};
|
|
31
15
|
|
|
32
16
|
/**
|
|
33
17
|
* The phone validator class.
|
|
@@ -74,4 +58,4 @@ class PhoneNumberValidator {
|
|
|
74
58
|
}
|
|
75
59
|
|
|
76
60
|
exports.PhoneNumberValidator = PhoneNumberValidator;
|
|
77
|
-
exports.
|
|
61
|
+
exports.createCallCenterTask = createCallCenterTask;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Required field validator class.
|
|
5
|
+
*/
|
|
6
|
+
class RequiredValidator {
|
|
7
|
+
errorMessage;
|
|
8
|
+
/**
|
|
9
|
+
* Constructor.
|
|
10
|
+
*
|
|
11
|
+
* @param errorMessage
|
|
12
|
+
*/
|
|
13
|
+
constructor(errorMessage) {
|
|
14
|
+
this.errorMessage = errorMessage;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Returns validation error message.
|
|
18
|
+
*/
|
|
19
|
+
getErrorMessage() {
|
|
20
|
+
return this.errorMessage;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Validation logic.
|
|
24
|
+
*
|
|
25
|
+
* @param value
|
|
26
|
+
*/
|
|
27
|
+
validate(value) {
|
|
28
|
+
return !!value?.trim();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
exports.RequiredValidator = RequiredValidator;
|
|
@@ -8,8 +8,8 @@ const httpCodes = require('./http-codes-38914116.js');
|
|
|
8
8
|
const translations = require('./translations-2637e1f9.js');
|
|
9
9
|
const buildFormUrl = require('./build-form-url-323431e4.js');
|
|
10
10
|
const assets = require('./assets-39f8cd2c.js');
|
|
11
|
-
const
|
|
12
|
-
const
|
|
11
|
+
const phone = require('./phone-99b69770.js');
|
|
12
|
+
const required = require('./required-253932be.js');
|
|
13
13
|
require('./typecheck-d48810dc.js');
|
|
14
14
|
require('./async-request-77d8e0b8.js');
|
|
15
15
|
|
|
@@ -1099,7 +1099,7 @@ const TetAvailabilityContactForm = class {
|
|
|
1099
1099
|
/** The list of validators to apply to the input field. */
|
|
1100
1100
|
validators = [
|
|
1101
1101
|
new phone.PhoneNumberValidator('components-validation-incorrect-phone'),
|
|
1102
|
-
new
|
|
1102
|
+
new required.RequiredValidator('components-validation-required')
|
|
1103
1103
|
];
|
|
1104
1104
|
/**
|
|
1105
1105
|
* The watch to update translations.
|
|
@@ -1158,7 +1158,7 @@ const TetAvailabilityContactForm = class {
|
|
|
1158
1158
|
return;
|
|
1159
1159
|
}
|
|
1160
1160
|
try {
|
|
1161
|
-
const data = await
|
|
1161
|
+
const data = await phone.createCallCenterTask(this.getTaskOptions(phoneInputElement.value));
|
|
1162
1162
|
if (data && data.TaskId) {
|
|
1163
1163
|
this.taskCreationSuccess.emit(data.TaskId);
|
|
1164
1164
|
}
|
|
@@ -4,11 +4,47 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-28359ea5.js');
|
|
6
6
|
const translations = require('./translations-2637e1f9.js');
|
|
7
|
-
const
|
|
7
|
+
const required = require('./required-253932be.js');
|
|
8
8
|
const a11y = require('./a11y-bd966702.js');
|
|
9
9
|
require('./typecheck-d48810dc.js');
|
|
10
10
|
require('./http-codes-38914116.js');
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* The phone validator class.
|
|
14
|
+
* Use this validator together with tet-input with isPhoneNumber=true which adds a +371 prefix to the input.
|
|
15
|
+
* Therefore, this validator only checks for 8-digit phone numbers starting with 2 or 6.
|
|
16
|
+
*/
|
|
17
|
+
class PhoneNumberValidatorV2 {
|
|
18
|
+
errorMessage;
|
|
19
|
+
/**
|
|
20
|
+
* The regex for the phone validation.
|
|
21
|
+
*/
|
|
22
|
+
phoneNumberRegex = '^[26][0-9]{7}$';
|
|
23
|
+
/**
|
|
24
|
+
* Constructor.
|
|
25
|
+
*
|
|
26
|
+
* @param errorMessage
|
|
27
|
+
*/
|
|
28
|
+
constructor(errorMessage) {
|
|
29
|
+
this.errorMessage = errorMessage;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns validation error message.
|
|
33
|
+
*/
|
|
34
|
+
getErrorMessage() {
|
|
35
|
+
return this.errorMessage;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Validation logic.
|
|
39
|
+
*
|
|
40
|
+
* @param value
|
|
41
|
+
*/
|
|
42
|
+
validate(value) {
|
|
43
|
+
const validateValue = value.trim();
|
|
44
|
+
return RegExp(this.phoneNumberRegex).test(validateValue);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
12
48
|
/**
|
|
13
49
|
* The email validator class.
|
|
14
50
|
*/
|
|
@@ -17,7 +53,9 @@ class EMailAddressValidator {
|
|
|
17
53
|
/**
|
|
18
54
|
* The regex for the email validation.
|
|
19
55
|
*/
|
|
20
|
-
emailAddressRegex = '^[
|
|
56
|
+
emailAddressRegex = '^(([a-zA-Z0-9!#$%&\'*+/=?^_`{|}~-]+(\\.[a-zA-Z0-9!#$%&\'*+/=?^_`{|}~-]+)*)|(".+"))@' +
|
|
57
|
+
'((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|' +
|
|
58
|
+
'(([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,}))$';
|
|
21
59
|
/**
|
|
22
60
|
* Constructor.
|
|
23
61
|
*
|
|
@@ -39,11 +77,103 @@ class EMailAddressValidator {
|
|
|
39
77
|
*/
|
|
40
78
|
validate(value) {
|
|
41
79
|
const validateValue = value?.trim();
|
|
80
|
+
if (!validateValue) {
|
|
81
|
+
return false;
|
|
82
|
+
}
|
|
83
|
+
// Check length of local part (max 64 chars)
|
|
84
|
+
const atIndex = validateValue.lastIndexOf('@');
|
|
85
|
+
if (atIndex !== -1) {
|
|
86
|
+
const localPart = validateValue.substring(0, atIndex);
|
|
87
|
+
if (localPart.length > 64) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
42
91
|
// A generic email address must meet pattern with @ and dot.
|
|
43
92
|
return RegExp(this.emailAddressRegex).test(validateValue);
|
|
44
93
|
}
|
|
45
94
|
}
|
|
46
95
|
|
|
96
|
+
/**
|
|
97
|
+
* Validator to check if value consists of exactly 11 digits.
|
|
98
|
+
*/
|
|
99
|
+
class CompanyRegistrationNumberValidator {
|
|
100
|
+
errorMessage;
|
|
101
|
+
/**
|
|
102
|
+
* The regex for the company registration number validation.
|
|
103
|
+
*/
|
|
104
|
+
companyRegistrationNumberRegex = '^\\d{11}$';
|
|
105
|
+
/**
|
|
106
|
+
* Constructor.
|
|
107
|
+
*
|
|
108
|
+
* @param errorMessage
|
|
109
|
+
*/
|
|
110
|
+
constructor(errorMessage) {
|
|
111
|
+
this.errorMessage = errorMessage;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Returns validation error message.
|
|
115
|
+
*/
|
|
116
|
+
getErrorMessage() {
|
|
117
|
+
return this.errorMessage;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Validation logic.
|
|
121
|
+
*
|
|
122
|
+
* @param value
|
|
123
|
+
*/
|
|
124
|
+
validate(value) {
|
|
125
|
+
// Allow empty values (RequiredValidator handles mandatory check).
|
|
126
|
+
if (!value) {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
// Check if the value is exactly 11 digits.
|
|
130
|
+
return RegExp(this.companyRegistrationNumberRegex).test(value);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The name/surname validator class.
|
|
136
|
+
*/
|
|
137
|
+
class NameValidator {
|
|
138
|
+
errorMessage;
|
|
139
|
+
/**
|
|
140
|
+
* The regex for the name validation.
|
|
141
|
+
* Allows:
|
|
142
|
+
* - Letters in any language (\p{L})
|
|
143
|
+
* - Spaces
|
|
144
|
+
* - Hyphens, En-dashes, Em-dashes
|
|
145
|
+
* - Commas
|
|
146
|
+
* - Dots
|
|
147
|
+
*/
|
|
148
|
+
nameRegex = '^[\\p{L} \\-–—,.]+$';
|
|
149
|
+
/**
|
|
150
|
+
* Constructor.
|
|
151
|
+
*
|
|
152
|
+
* @param errorMessage
|
|
153
|
+
*/
|
|
154
|
+
constructor(errorMessage) {
|
|
155
|
+
this.errorMessage = errorMessage;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Returns validation error message.
|
|
159
|
+
*/
|
|
160
|
+
getErrorMessage() {
|
|
161
|
+
return this.errorMessage;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Validation logic.
|
|
165
|
+
*
|
|
166
|
+
* @param value
|
|
167
|
+
*/
|
|
168
|
+
validate(value) {
|
|
169
|
+
const validateValue = value?.trim();
|
|
170
|
+
if (!validateValue) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
return new RegExp(this.nameRegex, 'u').test(validateValue);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
47
177
|
const tetB2bCheckOutFormCss = "@font-face{font-family:Avenir Next;src:url(assets/fonts/8e7462a9501f48c43c58f870188b3fb2.eot?#iefix);src:url(assets/fonts/8e7462a9501f48c43c58f870188b3fb2.eot?#iefix) format(\"eot\"),url(assets/fonts/3c3e10968ffc97c2a52c5830f9886d1f.woff2) format(\"woff2\"),url(assets/fonts/660fbf858d30d7685fa4b166080f5980.woff) format(\"woff\"),url(assets/fonts/2b7748589092fd1a10b806abdfb562ff.ttf) format(\"truetype\");font-weight:400;font-style:normal;font-display:swap}@font-face{font-family:Avenir Next;src:url(assets/fonts/d5e25ad69d0ea31f3b8f66d634ca40fe.eot?#iefix);src:url(assets/fonts/d5e25ad69d0ea31f3b8f66d634ca40fe.eot?#iefix) format(\"eot\"),url(assets/fonts/aad36ecead30948bb30fe0ef818b749c.woff2) format(\"woff2\"),url(assets/fonts/c437d7752feaf3f056bbf8613e898d3a.woff) format(\"woff\"),url(assets/fonts/b8df4d02ef5de13a813917a85bc4a9c4.ttf) format(\"truetype\");font-weight:400;font-style:italic;font-display:swap}@font-face{font-family:Avenir Next;src:url(assets/fonts/046190c9a2f724b925df848737b03819.eot?#iefix);src:url(assets/fonts/046190c9a2f724b925df848737b03819.eot?#iefix) format(\"eot\"),url(assets/fonts/4d52f8276a74ea8efbad833ed790367c.woff2) format(\"woff2\"),url(assets/fonts/a067695dd1b87e927f4056c040d84669.woff) format(\"woff\"),url(assets/fonts/510a664af9771b72d4ce5e637109ca3c.ttf) format(\"truetype\");font-weight:500;font-style:normal;font-display:swap}@font-face{font-family:Avenir Next;src:url(assets/fonts/0715de188f56c99aa615905f7e06292e.eot?#iefix);src:url(assets/fonts/0715de188f56c99aa615905f7e06292e.eot?#iefix) format(\"eot\"),url(assets/fonts/63f5acc71d9852468683a4bfe824a28f.woff2) format(\"woff2\"),url(assets/fonts/ed94c737da267752ce0abd79bb003ff6.woff) format(\"woff\"),url(assets/fonts/6302f55a6dc6b12365177dc89b7d63cf.ttf) format(\"truetype\");font-weight:500;font-style:italic;font-display:swap}@font-face{font-family:Avenir Next;src:url(assets/fonts/3f76abc23eef0596c499840db84213bb.eot?#iefix);src:url(assets/fonts/3f76abc23eef0596c499840db84213bb.eot?#iefix) format(\"eot\"),url(assets/fonts/1fe7da97fe9dbe1349aca9b54b5fdf69.woff2) format(\"woff2\"),url(assets/fonts/dacc6a84278e221422902af99579ada5.woff) format(\"woff\"),url(assets/fonts/e530c573663a3a07243d303fbf7db508.ttf) format(\"truetype\");font-weight:600;font-style:normal;font-display:swap}@font-face{font-family:Avenir Next;src:url(assets/fonts/75f8489ba53f19968feaa3e2eb78c569.eot?#iefix);src:url(assets/fonts/75f8489ba53f19968feaa3e2eb78c569.eot?#iefix) format(\"eot\"),url(assets/fonts/93ec0034623fc696601ab99aba652d4c.woff2) format(\"woff2\"),url(assets/fonts/d73c8eb1c13abe1237366aa3ee829a59.woff) format(\"woff\"),url(assets/fonts/7b6dcef99f3f4b23346e23925ec8678f.ttf) format(\"truetype\");font-weight:600;font-style:italic;font-display:swap}.tet-icon{font-family:Tet Icons;font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;speak:none;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}@font-face{font-family:Tet Icons;src:url(assets/fonts/d2ce51cdcd0b9707af186f8d50023d23.eot);src:url(assets/fonts/d2ce51cdcd0b9707af186f8d50023d23.eot?#iefix) format(\"embedded-opentype\"),url(assets/fonts/25f10ef322a1220b2e9e11db38b73892.woff2) format(\"woff2\"),url(assets/fonts/fed75ac1edcf1c25cdd8612d2c365f9a.woff) format(\"woff\"),url(assets/fonts/df7fbe67cabb13cb837172a73c46378a.ttf) format(\"truetype\"),url(assets/fonts/5486d8c87e2abc6c13ed952a6cc96658.svg#tet-icons) format(\"svg\");font-weight:400;font-style:normal}.tet-icon:before{content:\"\\E84E\"}.tet-icon--sm{font-size:1.125rem}.tet-icon--md{font-size:1.5rem}.tet-icon--lg{font-size:2.25rem}.tet-icon--xl{font-size:3rem}.tet-icon--xxl{font-size:4rem}.tet-icon--0{font-size:0}.tet-icon--1{font-size:.0625rem}.tet-icon--2{font-size:.125rem}.tet-icon--3{font-size:.1875rem}.tet-icon--4{font-size:.25rem}.tet-icon--5{font-size:.3125rem}.tet-icon--6{font-size:.375rem}.tet-icon--7{font-size:.4375rem}.tet-icon--8{font-size:.5rem}.tet-icon--9{font-size:.5625rem}.tet-icon--10{font-size:.625rem}.tet-icon--11{font-size:.6875rem}.tet-icon--12{font-size:.75rem}.tet-icon--13{font-size:.8125rem}.tet-icon--14{font-size:.875rem}.tet-icon--15{font-size:.9375rem}.tet-icon--16{font-size:1rem}.tet-icon--17{font-size:1.0625rem}.tet-icon--18{font-size:1.125rem}.tet-icon--19{font-size:1.1875rem}.tet-icon--20{font-size:1.25rem}.tet-icon--21{font-size:1.3125rem}.tet-icon--22{font-size:1.375rem}.tet-icon--23{font-size:1.4375rem}.tet-icon--24{font-size:1.5rem}.tet-icon--25{font-size:1.5625rem}.tet-icon--26{font-size:1.625rem}.tet-icon--27{font-size:1.6875rem}.tet-icon--28{font-size:1.75rem}.tet-icon--29{font-size:1.8125rem}.tet-icon--30{font-size:1.875rem}.tet-icon--31{font-size:1.9375rem}.tet-icon--32{font-size:2rem}.tet-icon--33{font-size:2.0625rem}.tet-icon--34{font-size:2.125rem}.tet-icon--35{font-size:2.1875rem}.tet-icon--36{font-size:2.25rem}.tet-icon--37{font-size:2.3125rem}.tet-icon--38{font-size:2.375rem}.tet-icon--39{font-size:2.4375rem}.tet-icon--40{font-size:2.5rem}.tet-icon--41{font-size:2.5625rem}.tet-icon--42{font-size:2.625rem}.tet-icon--43{font-size:2.6875rem}.tet-icon--44{font-size:2.75rem}.tet-icon--45{font-size:2.8125rem}.tet-icon--46{font-size:2.875rem}.tet-icon--47{font-size:2.9375rem}.tet-icon--48{font-size:3rem}.tet-icon--49{font-size:3.0625rem}.tet-icon--50{font-size:3.125rem}.tet-icon--51{font-size:3.1875rem}.tet-icon--52{font-size:3.25rem}.tet-icon--53{font-size:3.3125rem}.tet-icon--54{font-size:3.375rem}.tet-icon--55{font-size:3.4375rem}.tet-icon--56{font-size:3.5rem}.tet-icon--57{font-size:3.5625rem}.tet-icon--58{font-size:3.625rem}.tet-icon--59{font-size:3.6875rem}.tet-icon--60{font-size:3.75rem}.tet-icon--61{font-size:3.8125rem}.tet-icon--62{font-size:3.875rem}.tet-icon--63{font-size:3.9375rem}.tet-icon--64{font-size:4rem}.tet-icon--65{font-size:4.0625rem}.tet-icon--66{font-size:4.125rem}.tet-icon--67{font-size:4.1875rem}.tet-icon--68{font-size:4.25rem}.tet-icon--69{font-size:4.3125rem}.tet-icon--70{font-size:4.375rem}.tet-icon--71{font-size:4.4375rem}.tet-icon--72{font-size:4.5rem}.tet-icon--73{font-size:4.5625rem}.tet-icon--74{font-size:4.625rem}.tet-icon--75{font-size:4.6875rem}.tet-icon--76{font-size:4.75rem}.tet-icon--77{font-size:4.8125rem}.tet-icon--78{font-size:4.875rem}.tet-icon--79{font-size:4.9375rem}.tet-icon--80{font-size:5rem}.tet-icon--81{font-size:5.0625rem}.tet-icon--82{font-size:5.125rem}.tet-icon--83{font-size:5.1875rem}.tet-icon--84{font-size:5.25rem}.tet-icon--85{font-size:5.3125rem}.tet-icon--86{font-size:5.375rem}.tet-icon--87{font-size:5.4375rem}.tet-icon--88{font-size:5.5rem}.tet-icon--89{font-size:5.5625rem}.tet-icon--90{font-size:5.625rem}.tet-icon--91{font-size:5.6875rem}.tet-icon--92{font-size:5.75rem}.tet-icon--93{font-size:5.8125rem}.tet-icon--94{font-size:5.875rem}.tet-icon--95{font-size:5.9375rem}.tet-icon--96{font-size:6rem}.tet-icon--97{font-size:6.0625rem}.tet-icon--98{font-size:6.125rem}.tet-icon--99{font-size:6.1875rem}.tet-icon--100{font-size:6.25rem}.tet-icon--101{font-size:6.3125rem}.tet-icon__add:before{content:\"\\E800\"}.tet-icon__alert-circled:before{content:\"\\E801\"}.tet-icon__alert:before{content:\"\\E802\"}.tet-icon__bank:before{content:\"\\E803\"}.tet-icon__box:before{content:\"\\E804\"}.tet-icon__download:before{content:\"\\E805\"}.tet-icon__burger:before{content:\"\\E806\"}.tet-icon__cancel:before{content:\"\\E807\"}.tet-icon__printer:before{content:\"\\E808\"}.tet-icon__cart-add:before{content:\"\\E809\"}.tet-icon__cart-remove:before{content:\"\\E80A\"}.tet-icon__cart:before{content:\"\\E80B\"}.tet-icon__chat:before{content:\"\\E80C\"}.tet-icon__arrow-up:before{content:\"\\E80D\"}.tet-icon__calendar:before{content:\"\\E80E\"}.tet-icon__help-circled:before{content:\"\\E80F\"}.tet-icon__edit:before{content:\"\\E810\"}.tet-icon__external-link:before{content:\"\\E811\"}.tet-icon__gift:before{content:\"\\E812\"}.tet-icon__person:before{content:\"\\E813\"}.tet-icon__heart:before{content:\"\\E814\"}.tet-icon__language:before{content:\"\\E815\"}.tet-icon__help:before{content:\"\\E816\"}.tet-icon__home-1:before{content:\"\\E817\"}.tet-icon__location:before{content:\"\\E818\"}.tet-icon__home-3:before{content:\"\\E819\"}.tet-icon__chart-even:before{content:\"\\E81A\"}.tet-icon__info-2:before{content:\"\\E81B\"}.tet-icon__key:before{content:\"\\E81C\"}.tet-icon__info:before{content:\"\\E81D\"}.tet-icon__lock-opened:before{content:\"\\E81E\"}.tet-icon__lock-outlined:before{content:\"\\E81F\"}.tet-icon__lock:before{content:\"\\E820\"}.tet-icon__laptop-filled:before{content:\"\\E821\"}.tet-icon__mail:before{content:\"\\E822\"}.tet-icon__options:before{content:\"\\E823\"}.tet-icon__chart-uneven:before{content:\"\\E824\"}.tet-icon__mail-2:before{content:\"\\E825\"}.tet-icon__remove:before{content:\"\\E826\"}.tet-icon__mobile-filled:before{content:\"\\E827\"}.tet-icon__ilu-calendar-check:before{content:\"\\E828\"}.tet-icon__settings-outlined:before{content:\"\\E829\"}.tet-icon__tablet:before{content:\"\\E82A\"}.tet-icon__thumb-up:before{content:\"\\E82B\"}.tet-icon__ilu-purchase:before{content:\"\\E82C\"}.tet-icon__chart-even-outlined:before{content:\"\\E82D\"}.tet-icon__movie:before{content:\"\\E82E\"}.tet-icon__percent:before{content:\"\\E82F\"}.tet-icon__ilu-change-whenever:before{content:\"\\E830\"}.tet-icon__truck:before{content:\"\\E831\"}.tet-icon__zero:before{content:\"\\E832\"}.tet-icon__attach:before{content:\"\\E833\"}.tet-icon__cloud-done:before{content:\"\\E834\"}.tet-icon__cloud-download:before{content:\"\\E835\"}.tet-icon__cloud-upload:before{content:\"\\E836\"}.tet-icon__cloud:before{content:\"\\E837\"}.tet-icon__folder:before{content:\"\\E838\"}.tet-icon__remote:before{content:\"\\E839\"}.tet-icon__router:before{content:\"\\E83A\"}.tet-icon__shield-filled:before{content:\"\\E83B\"}.tet-icon__shield:before{content:\"\\E83C\"}.tet-icon__ilu-devices:before{content:\"\\E83D\"}.tet-icon__ilu-get-points:before{content:\"\\E83E\"}.tet-icon__tv:before{content:\"\\E83F\"}.tet-icon__ilu-internet:before{content:\"\\E840\"}.tet-icon__wifi-outlined:before{content:\"\\E841\"}.tet-icon__wifi:before{content:\"\\E842\"}.tet-icon__description-outlined:before{content:\"\\E843\"}.tet-icon__laptop:before{content:\"\\E844\"}.tet-icon__chart-uneven-outlined:before{content:\"\\E845\"}.tet-icon__meter:before{content:\"\\E846\"}.tet-icon__mobile:before{content:\"\\E847\"}.tet-icon__phone:before{content:\"\\E848\"}.tet-icon__plug-filled:before{content:\"\\E849\"}.tet-icon__plug:before{content:\"\\E84A\"}.tet-icon__print:before{content:\"\\E84B\"}.tet-icon__camera:before{content:\"\\E84C\"}.tet-icon__clock:before{content:\"\\E84D\"}.tet-icon__placeholder:before{content:\"\\E84E\"}.tet-icon__tv-filled:before{content:\"\\E84F\"}.tet-icon__arrow-down:before{content:\"\\E850\"}.tet-icon__arrow-left:before{content:\"\\E851\"}.tet-icon__arrow-right:before{content:\"\\E852\"}.tet-icon__description:before{content:\"\\E853\"}.tet-icon__login:before{content:\"\\E854\"}.tet-icon__check:before{content:\"\\E855\"}.tet-icon__chevron-down:before{content:\"\\E856\"}.tet-icon__chevron-left:before{content:\"\\E857\"}.tet-icon__chevron-right:before{content:\"\\E858\"}.tet-icon__chevron-up:before{content:\"\\E859\"}.tet-icon__close-circled:before{content:\"\\E85A\"}.tet-icon__close:before{content:\"\\E85B\"}.tet-icon__more-horizontal:before{content:\"\\E85C\"}.tet-icon__more-vertical:before{content:\"\\E85D\"}.tet-icon__refresh:before{content:\"\\E85E\"}.tet-icon__facebook:before{content:\"\\E85F\"}.tet-icon__instagram:before{content:\"\\E860\"}.tet-icon__linkedin:before{content:\"\\E861\"}.tet-icon__people:before{content:\"\\E862\"}.tet-icon__logout:before{content:\"\\E863\"}.tet-icon__share:before{content:\"\\E864\"}.tet-icon__twitter:before{content:\"\\E865\"}.tet-icon__cancel-filled:before{content:\"\\E866\"}.tet-icon__done:before{content:\"\\E867\"}.tet-icon__star-filled:before{content:\"\\E868\"}.tet-icon__star:before{content:\"\\E869\"}.tet-icon__clipboard:before{content:\"\\E86A\"}.tet-icon__ilu-calendar:before{content:\"\\E86B\"}.tet-icon__check-circled:before{content:\"\\E86C\"}.tet-icon__ilu-choose-channels:before{content:\"\\E86D\"}.tet-icon__search:before{content:\"\\E86E\"}.tet-icon__warning:before{content:\"\\E86F\"}.tet-icon__ilu-clock-1:before{content:\"\\E870\"}.tet-icon__ilu-fold:before{content:\"\\E871\"}.tet-icon__ilu-letter:before{content:\"\\E872\"}.tet-icon__ilu-pay:before{content:\"\\E873\"}.tet-icon__ilu-meter:before{content:\"\\E874\"}.tet-icon__ilu-sign:before{content:\"\\E875\"}.tet-icon__smart-watch-filled:before{content:\"\\E876\"}.tet-icon__washing-machine-filled:before{content:\"\\E877\"}.tet-icon__bullet:before{content:\"\\E878\"}.tet-icon__sound:before{content:\"\\E879\"}.tet-icon__dropdown:before{content:\"\\E87A\"}.tet-icon__mask-pass:before{content:\"\\E87B\"}.tet-icon__select:before{content:\"\\E87C\"}.tet-icon__text-area-sizing:before{content:\"\\E87D\"}.tet-icon__unmask-pass:before{content:\"\\E87E\"}.tet-icon__bullet-small:before{content:\"\\E882\"}.tet-icon__electric-bolt:before{content:\"\\E880\"}.tet-icon__sun:before{content:\"\\E881\"}:host{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit;padding:0;margin:0}:host{--color-gray-light:#cdd2de;--color-ta070:#f5f6f8;--color-ta080:#e6e8ee;--color-ta100:#cdd2de;--color-ta200:#9ba5be;--color-ta300:#69789c;--color-ta500:#1e356a;--color-ta600:#051d59;--color-tc090:#d6e6fd;--color-tc100:#d1dffe;--color-tc300:#75a1fb;--color-tc500:#1a70f6;--color-tc600:#0060f5;--color-td500:#00F1F2;--color-td600:#01cbe0;--color-tf600:#f53b2a;--color-tg300:#2b3036;--color-tg400:#1d2128;--color-tg500:#12171e;--color-tg600:#01050c;--color-th500:#f5f5f5;--color-ti500:#869198;--color-ti600:#aeb7bc;--text-font:Gilroy, serif;--text-color-darker:var(--color-ta600);--text-color-dark:var(--color-ta500);--text-color-dark-theme:var(--color-th500);--icons-font:Tet Icons, serif}.icon.tet-search{font-family:var(--icons-font);font-weight:400;font-style:normal;font-size:1.25rem;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;speak:none;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}.icon.tet-search::before{content:\"\\e86e\"}.icon.tet-close-circled{font-family:var(--icons-font);font-weight:400;font-style:normal;font-size:1.25rem;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;speak:none;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}.icon.tet-close-circled::before{content:\"\\e85a\"}.icon.tet-close{font-family:var(--icons-font);font-weight:400;font-style:normal;font-size:1.25rem;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;speak:none;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}.icon.tet-close::before{content:\"\\e85b\"}.icon.tet-check-circled{font-family:var(--icons-font);font-weight:400;font-style:normal;font-size:1.25rem;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;speak:none;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}.icon.tet-check-circled::before{content:\"\\e86c\"}.icon.tet-check{font-family:var(--icons-font);font-weight:400;font-style:normal;font-size:1.25rem;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;speak:none;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}.icon.tet-check::before{content:\"\\e855\"}.icon.tet-chevron-up{font-family:var(--icons-font);font-weight:400;font-style:normal;font-size:1.25rem;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;speak:none;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}.icon.tet-chevron-up::before{content:\"\\e859\"}.icon.tet-chevron-down{font-family:var(--icons-font);font-weight:400;font-style:normal;font-size:1.25rem;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;speak:none;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}.icon.tet-chevron-down::before{content:\"\\e856\"}.icon.tet-clipboard{font-family:var(--icons-font);font-weight:400;font-style:normal;font-size:1.25rem;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;speak:none;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}.icon.tet-clipboard::before{content:\"\\e86a\"}.icon.tet-info{font-family:var(--icons-font);font-weight:400;font-style:normal;font-size:1.25rem;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;speak:none;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}.icon.tet-info::before{content:\"\\e81d\"}.icon.tet-done{font-family:var(--icons-font);font-weight:400;font-style:normal;font-size:1.25rem;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;speak:none;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale}.icon.tet-done::before{content:\"\\e867\"}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:400;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Medium.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Medium.woff\") format(\"woff\")}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:500;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Medium.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Medium.woff\") format(\"woff\")}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:600;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Semibold.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Semibold.woff\") format(\"woff\")}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:700;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Bold.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Bold.woff\") format(\"woff\")}@font-face{font-family:\"Inter\";font-style:normal;font-weight:400;font-display:swap;src:url(\"assets/fonts/Inter-Regular.woff2?v=3.19\") format(\"woff2\"), url(\"assets/fonts/Inter-Regular.woff?v=3.19\") format(\"woff\")}@font-face{font-family:\"Inter\";font-style:normal;font-weight:500;font-display:swap;src:url(\"assets/fonts/Inter-Medium.woff2?v=3.19\") format(\"woff2\"), url(\"assets/fonts/Inter-Medium.woff?v=3.19\") format(\"woff\")}@font-face{font-family:\"Inter\";font-style:normal;font-weight:600;font-display:swap;src:url(\"assets/fonts/Inter-SemiBold.woff2?v=3.19\") format(\"woff2\"), url(\"assets/fonts/Inter-SemiBold.woff?v=3.19\") format(\"woff\")}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:400;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Medium.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Medium.woff\") format(\"woff\")}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:500;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Medium.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Medium.woff\") format(\"woff\")}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:600;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Semibold.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Semibold.woff\") format(\"woff\")}@font-face{font-family:\"Gilroy\";font-style:normal;font-weight:700;font-display:swap;src:url(\"assets/fonts/Gilroy-W05-Bold.woff2\") format(\"woff2\"), url(\"assets/fonts/Gilroy-W05-Bold.woff\") format(\"woff\")}@font-face{font-family:\"Inter\";font-style:normal;font-weight:400;font-display:swap;src:url(\"assets/fonts/Inter-Regular.woff2?v=3.19\") format(\"woff2\"), url(\"assets/fonts/Inter-Regular.woff?v=3.19\") format(\"woff\")}@font-face{font-family:\"Inter\";font-style:normal;font-weight:500;font-display:swap;src:url(\"assets/fonts/Inter-Medium.woff2?v=3.19\") format(\"woff2\"), url(\"assets/fonts/Inter-Medium.woff?v=3.19\") format(\"woff\")}@font-face{font-family:\"Inter\";font-style:normal;font-weight:600;font-display:swap;src:url(\"assets/fonts/Inter-SemiBold.woff2?v=3.19\") format(\"woff2\"), url(\"assets/fonts/Inter-SemiBold.woff?v=3.19\") format(\"woff\")}:host{--font-family-fallback:Gilroy, Arial, sans-serif;--font-family-headline:Gilroy;--font-family-content:Inter, var(--font-family-fallback);font-family:var(--font-family-content)}:host{display:flex;align-items:center}.modal-form-card{border-radius:1rem;height:fit-content;box-shadow:var(--b2b-check-out-form-border-shadow);display:flex;flex-direction:column;border:none;--dialog-header-padding:1rem 1.125rem 0.5rem 1.5rem;--dialog-body-padding:0.5rem 1.5rem 2rem;--dialog-width:53rem;--dialog-title-font-size:1.5rem}@media screen and (max-width: 46.25rem){.modal-form-card{--dialog-body-padding:0.5rem 1rem 1.5rem}}.modal-form-card-content{display:flex;flex-direction:column;height:fit-content}.modal-form-card-content.light{--b2b-check-out-form-text-color:var(--tc-text-primary);--b2b-check-out-form-input-border-color:var(--tc-border-secondary);--b2b-check-out-form-accordion-border-color:var(--tc-border-quaternary);--b2b-check-out-form-border-shadow:var(--tc-elevation-six);--b2b-check-out-form-footer-border-color:var(--tc-border-quaternary);--b2b-check-out-form-accordion-background-color:var(--tc-layer-secondary);--b2b-check-out-form-icon-background-color:var(--tc-layer-inverse-primary);--b2b-check-out-form-icon-color:var(--tc-layer-primary)}.modal-form-card-content.dark{--b2b-check-out-form-text-color:var(--tc-text-primary-dark);--b2b-check-out-form-input-border-color:var(--tc-border-secondary-dark);--b2b-check-out-form-accordion-border-color:var(--tc-border-quaternary-dark);--b2b-check-out-form-border-shadow:var(--tc-elevation-six-dark);--b2b-check-out-form-footer-border-color:var(--tc-border-quaternary-dark);--b2b-check-out-form-accordion-background-color:var(--tc-layer-secondary-dark);--b2b-check-out-form-icon-background-color:var(--tc-layer-inverse-primary-dark);--b2b-check-out-form-icon-color:var(--tc-layer-primary-dark)}.modal-form-card-content-header{display:flex;flex-direction:column;justify-content:center;align-items:center;padding-bottom:1.5rem}.modal-form-card-content-header__title{font:600 1.5rem/1.75rem \"Gilroy\", \"Gilroy, Arial, sans-serif\";padding-top:1rem}.modal-form-card-content-header__description{font:400 1rem/1.5rem \"Inter\", \"Gilroy, Arial, sans-serif\"}.modal-form-card-content-accordion-wrapper{border:1px solid var(--b2b-check-out-form-accordion-border-color);border-radius:1rem}.modal-form-card-content-checkbox{--tet-link-color:var(--b2b-check-out-form-text-color)}.modal-form-card-footer{display:flex;align-items:center;justify-content:flex-end;gap:1rem;border-top:1px solid var(--b2b-check-out-form-footer-border-color)}@media screen and (max-width: 46.25rem){.modal-form-card-footer{justify-content:space-between;gap:0;width:100%}}.modal-form-card-form{display:flex;flex-direction:column;gap:1.5rem;padding-top:2rem}@media screen and (max-width: 46.25rem){.modal-form-card-form{gap:1rem;padding-top:1.5rem}}.modal-form-card-input__row{display:flex;flex-direction:row;gap:1.5rem;width:100%}@media screen and (max-width: 46.25rem){.modal-form-card-input__row{gap:1rem;flex-direction:column}}.modal-form-card__input{width:100%;--input-border-radius:0.625rem;--input-border-color:var(--b2b-check-out-form-input-border-color);--accordion-background-color:var(--b2b-check-out-form-input-border-color)}.modal-form-card .cart-header{display:flex;flex-direction:row;justify-content:space-between}.modal-form-card .icon-wrapper{display:flex;border-radius:50%;background-color:var(--b2b-check-out-form-icon-background-color)}.modal-form-card .icon{--icon-color:var(--b2b-check-out-form-icon-color)}";
|
|
48
178
|
const TetB2bCheckOutFormStyle0 = tetB2bCheckOutFormCss;
|
|
49
179
|
|
|
@@ -87,13 +217,15 @@ const TetAvailabilityContactForm = class {
|
|
|
87
217
|
/**
|
|
88
218
|
* Get validators for each input form and set error messages.
|
|
89
219
|
*/
|
|
90
|
-
getValidators(label,
|
|
220
|
+
getValidators(label, type = 'text') {
|
|
91
221
|
const cleanLabel = label.trim().toLowerCase().replace(',', ' un');
|
|
92
222
|
let errorText = '';
|
|
93
223
|
switch (cleanLabel.charAt(cleanLabel.length - 1)) {
|
|
94
224
|
case 's':
|
|
95
225
|
{
|
|
96
|
-
|
|
226
|
+
type === 'phone'
|
|
227
|
+
? (errorText = cleanLabel.replace('is', 'i'))
|
|
228
|
+
: (errorText = cleanLabel.replace(/[s]\b/g, 'u'));
|
|
97
229
|
}
|
|
98
230
|
break;
|
|
99
231
|
case 'e':
|
|
@@ -105,32 +237,36 @@ const TetAvailabilityContactForm = class {
|
|
|
105
237
|
errorText = cleanLabel;
|
|
106
238
|
}
|
|
107
239
|
const errorMessage = `${translations.translate('components-b2b-check-out-form-validation-error')} ${this.language === 'lv' ? errorText : cleanLabel}`;
|
|
108
|
-
let validators = [new
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
new
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
new
|
|
118
|
-
|
|
119
|
-
|
|
240
|
+
let validators = [new required.RequiredValidator(errorMessage)];
|
|
241
|
+
switch (type) {
|
|
242
|
+
case 'email':
|
|
243
|
+
validators.push(new EMailAddressValidator('components-b2b-check-out-form-email-validation-error'));
|
|
244
|
+
return validators;
|
|
245
|
+
case 'phone':
|
|
246
|
+
validators.push(new PhoneNumberValidatorV2('components-validation-incorrect-phone'));
|
|
247
|
+
return validators;
|
|
248
|
+
case 'company-reg':
|
|
249
|
+
validators.push(new CompanyRegistrationNumberValidator('components-b2b-check-out-form-company-registration-number-validation-error'));
|
|
250
|
+
return validators;
|
|
251
|
+
case 'name':
|
|
252
|
+
validators.push(new NameValidator('components-b2b-check-out-form-name-validation-error'));
|
|
253
|
+
return validators;
|
|
254
|
+
default:
|
|
255
|
+
return validators;
|
|
120
256
|
}
|
|
121
|
-
return validators;
|
|
122
257
|
}
|
|
123
258
|
/**
|
|
124
259
|
* Render Input 'tet-input' element.
|
|
125
260
|
* @param {string} id
|
|
126
261
|
* @param {string} label
|
|
127
262
|
* @param {string} placeholder
|
|
128
|
-
* @param {
|
|
263
|
+
* @param {InputType} type
|
|
264
|
+
* @param {string} maxLength
|
|
129
265
|
* @returns {HTMLTetInputElement}
|
|
130
266
|
* @private
|
|
131
267
|
*/
|
|
132
|
-
renderInput(id, label, placeholder,
|
|
133
|
-
return (index.h("tet-input", { id: id, class: "modal-form-card__input", theme: this.theme, label: `${label} *`, placeholder: placeholder || label, ...(
|
|
268
|
+
renderInput(id, label, placeholder, type = 'text', maxLength) {
|
|
269
|
+
return (index.h("tet-input", { id: id, class: "modal-form-card__input", theme: this.theme, label: `${label} *`, placeholder: placeholder || label, maxlength: maxLength, ...(type === 'phone' && { isPhoneNumber: true }), validators: this.getValidators(label, type) }));
|
|
134
270
|
}
|
|
135
271
|
/** Validates all input fields and returns whether all of them are valid or not. */
|
|
136
272
|
async validateInputFields() {
|
|
@@ -164,8 +300,7 @@ const TetAvailabilityContactForm = class {
|
|
|
164
300
|
get extraFieldsElements() {
|
|
165
301
|
return this.extraFieldsSlotElement
|
|
166
302
|
.assignedElements()
|
|
167
|
-
.flatMap((parentElement) => Array.from(parentElement.querySelectorAll('input[id], tet-input[id]'))
|
|
168
|
-
.filter((element) => element instanceof HTMLInputElement || 'value' in element));
|
|
303
|
+
.flatMap((parentElement) => Array.from(parentElement.querySelectorAll('input[id], tet-input[id]')).filter((element) => element instanceof HTMLInputElement || 'value' in element));
|
|
169
304
|
}
|
|
170
305
|
/** Returns the submission data of all extra fields elements with a provided id attribute. */
|
|
171
306
|
get extraFieldsSubmissionData() {
|
|
@@ -190,11 +325,11 @@ const TetAvailabilityContactForm = class {
|
|
|
190
325
|
}
|
|
191
326
|
render() {
|
|
192
327
|
const { theme } = this;
|
|
193
|
-
return (index.h("tet-dialog", { key: '
|
|
328
|
+
return (index.h("tet-dialog", { key: 'f4bb1850730d7a0084cf2ca41e3ab815fd04ae61', class: "modal-form-card", headerTitle: translations.translate('components-b2b-check-out-form-header'), theme: theme, closeOnOverlayClick: false, footerDisplay: "right", ref: (el) => {
|
|
194
329
|
this.dialogElement = el;
|
|
195
|
-
} }, index.h("div", { key: '
|
|
330
|
+
} }, index.h("div", { key: '5c23c0ef1f40eefb8a4bb37e3fff838d6f599053', class: { 'modal-form-card-content': true, [`${theme}`]: true } }, index.h("div", { key: 'ebd1d26f3253c726f7f3ec47dbf4b81c7622171e', class: "modal-form-card-content-header" }, index.h("div", { key: 'b6f9cb2373f14f0cb7ef74d1ee35762c8011873c', class: "icon-wrapper" }, index.h("tet-icon", { key: '5c84a9bdd23a0650bb8adde0f7e0486143f58d27', class: "icon", name: "tc-company-1" })), index.h("span", { key: '1ffbc45a95d93bea491d781744a75075246e4081', class: "modal-form-card-content-header__title" }, translations.translate('components-b2b-check-out-form-title')), index.h("span", { key: '86b83e78dc06f2a8881717c83b5955bf1d6940cb', class: "modal-form-card-content-header__description" }, translations.translate('components-b2b-check-out-form-description'))), index.h("div", { key: '0219825c05711b402d3b85379345c26e1d280f05', class: "modal-form-card-content-accordion-wrapper" }, index.h("slot", { key: 'b387acbdba8121eb8dd8a6b9005852220895d40e', name: "cart" })), index.h("form", { key: '3f547c73473e5c735df4c816e1237e83435ec355', id: "checkOutForm", class: "modal-form-card-form", ref: (ref) => (this.checkOutForm = ref) }, index.h("div", { key: '944453791b28bbe5744213f60c683863d2e11968', class: "modal-form-card-input__row" }, this.renderInput('companyRegNr', translations.translate('components-b2b-check-out-form-company-registration-number-input-label'), '40000000001', 'company-reg', '11'), this.renderInput('companyName', translations.translate('components-b2b-check-out-form-company-name-input-label'))), this.renderInput('address', translations.translate('components-b2b-check-out-form-address-input-label'), translations.translate('components-b2b-check-out-form-address-input-placeholder')), this.renderInput('nameSurname', translations.translate('components-b2b-check-out-form-name-input-label'), '', 'name'), index.h("div", { key: '287e329884ed596a0fe471f1e56ae3aeb2f65ad7', class: "modal-form-card-input__row" }, this.renderInput('email', translations.translate('components-b2b-check-out-form-email-input-label'), 'contact@company.com', 'email'), this.renderInput('phoneNr', translations.translate('components-b2b-check-out-form-phone-number-input-label'), '22222222', 'phone', '8')), index.h("tet-checkbox", { key: 'b34856f42ef282ac2fa0c771f6ebe241a47d3ae9', class: "modal-form-card-content-checkbox", label: translations.translate('components-check-out-form-privacy-policy'), theme: theme }), index.h("slot", { key: '01d82f672d1a924cb40e7af5b5132cef7f4fb7ce', name: "extra-fields", ref: (element) => (this.extraFieldsSlotElement = element) }))), index.h("div", { key: '13b4790fbe9e886299216e171040173ce46bdde5', slot: "footer", class: "modal-form-card-footer" }, index.h("tet-button", { key: '02045e393c906dbc8670b33271e557c00130599d', type: "secondary", size: "medium", theme: theme, onClick: () => {
|
|
196
331
|
this.dialogElement.close();
|
|
197
|
-
} }, translations.translate('components-b2b-check-out-form-close-button-label')), index.h("tet-button", { key: '
|
|
332
|
+
} }, translations.translate('components-b2b-check-out-form-close-button-label')), index.h("tet-button", { key: 'e277872842c8f9b87c2dd3e4a7fe7cd0dd83cc61', type: "primary", size: "medium", theme: theme, onClick: () => this.handleSubmit() }, translations.translate('components-b2b-check-out-form-submit-button-label')))));
|
|
198
333
|
}
|
|
199
334
|
static get watchers() { return {
|
|
200
335
|
"language": ["onLanguageChange"]
|
|
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-28359ea5.js');
|
|
6
6
|
const translations = require('./translations-2637e1f9.js');
|
|
7
7
|
require('./http-codes-38914116.js');
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const phone = require('./phone-99b69770.js');
|
|
9
|
+
const required = require('./required-253932be.js');
|
|
10
10
|
require('./typecheck-d48810dc.js');
|
|
11
11
|
require('./async-request-77d8e0b8.js');
|
|
12
12
|
|
|
@@ -33,7 +33,7 @@ const TetContactForm = class {
|
|
|
33
33
|
/** The list of validators to apply to the input field. */
|
|
34
34
|
validators = [
|
|
35
35
|
new phone.PhoneNumberValidator('components-validation-incorrect-phone'),
|
|
36
|
-
new
|
|
36
|
+
new required.RequiredValidator('components-validation-required')
|
|
37
37
|
];
|
|
38
38
|
onLanguageChange(language) {
|
|
39
39
|
translations.processTranslations('tet-components', language).then(() => index.forceUpdate(this));
|
|
@@ -54,7 +54,7 @@ const TetContactForm = class {
|
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
try {
|
|
57
|
-
const data = await
|
|
57
|
+
const data = await phone.createCallCenterTask(this.getTaskOptions(phoneInputElement.value));
|
|
58
58
|
if (data?.TaskId) {
|
|
59
59
|
this.taskCreationSuccess.emit(data.TaskId);
|
|
60
60
|
}
|
package/dist/collection/components/advanced/forms/tet-b2b-check-out-form/tet-b2b-check-out-form.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h, forceUpdate } from "@stencil/core";
|
|
2
2
|
import { processTranslations, t } from "../../../../services/translations/index";
|
|
3
|
-
import { EMailAddressValidator,
|
|
3
|
+
import { EMailAddressValidator, PhoneNumberValidatorV2, CompanyRegistrationNumberValidator, RequiredValidator, NameValidator } from "../../../../services/validators/index";
|
|
4
4
|
/**
|
|
5
5
|
* A simple contact form for submitting company details and cart details.'
|
|
6
6
|
*/
|
|
@@ -42,13 +42,15 @@ export class TetAvailabilityContactForm {
|
|
|
42
42
|
/**
|
|
43
43
|
* Get validators for each input form and set error messages.
|
|
44
44
|
*/
|
|
45
|
-
getValidators(label,
|
|
45
|
+
getValidators(label, type = 'text') {
|
|
46
46
|
const cleanLabel = label.trim().toLowerCase().replace(',', ' un');
|
|
47
47
|
let errorText = '';
|
|
48
48
|
switch (cleanLabel.charAt(cleanLabel.length - 1)) {
|
|
49
49
|
case 's':
|
|
50
50
|
{
|
|
51
|
-
|
|
51
|
+
type === 'phone'
|
|
52
|
+
? (errorText = cleanLabel.replace('is', 'i'))
|
|
53
|
+
: (errorText = cleanLabel.replace(/[s]\b/g, 'u'));
|
|
52
54
|
}
|
|
53
55
|
break;
|
|
54
56
|
case 'e':
|
|
@@ -61,31 +63,35 @@ export class TetAvailabilityContactForm {
|
|
|
61
63
|
}
|
|
62
64
|
const errorMessage = `${t('components-b2b-check-out-form-validation-error')} ${this.language === 'lv' ? errorText : cleanLabel}`;
|
|
63
65
|
let validators = [new RequiredValidator(errorMessage)];
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
new
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
new
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
switch (type) {
|
|
67
|
+
case 'email':
|
|
68
|
+
validators.push(new EMailAddressValidator('components-b2b-check-out-form-email-validation-error'));
|
|
69
|
+
return validators;
|
|
70
|
+
case 'phone':
|
|
71
|
+
validators.push(new PhoneNumberValidatorV2('components-validation-incorrect-phone'));
|
|
72
|
+
return validators;
|
|
73
|
+
case 'company-reg':
|
|
74
|
+
validators.push(new CompanyRegistrationNumberValidator('components-b2b-check-out-form-company-registration-number-validation-error'));
|
|
75
|
+
return validators;
|
|
76
|
+
case 'name':
|
|
77
|
+
validators.push(new NameValidator('components-b2b-check-out-form-name-validation-error'));
|
|
78
|
+
return validators;
|
|
79
|
+
default:
|
|
80
|
+
return validators;
|
|
75
81
|
}
|
|
76
|
-
return validators;
|
|
77
82
|
}
|
|
78
83
|
/**
|
|
79
84
|
* Render Input 'tet-input' element.
|
|
80
85
|
* @param {string} id
|
|
81
86
|
* @param {string} label
|
|
82
87
|
* @param {string} placeholder
|
|
83
|
-
* @param {
|
|
88
|
+
* @param {InputType} type
|
|
89
|
+
* @param {string} maxLength
|
|
84
90
|
* @returns {HTMLTetInputElement}
|
|
85
91
|
* @private
|
|
86
92
|
*/
|
|
87
|
-
renderInput(id, label, placeholder,
|
|
88
|
-
return (h("tet-input", { id: id, class: "modal-form-card__input", theme: this.theme, label: `${label} *`, placeholder: placeholder || label, ...(
|
|
93
|
+
renderInput(id, label, placeholder, type = 'text', maxLength) {
|
|
94
|
+
return (h("tet-input", { id: id, class: "modal-form-card__input", theme: this.theme, label: `${label} *`, placeholder: placeholder || label, maxlength: maxLength, ...(type === 'phone' && { isPhoneNumber: true }), validators: this.getValidators(label, type) }));
|
|
89
95
|
}
|
|
90
96
|
/** Validates all input fields and returns whether all of them are valid or not. */
|
|
91
97
|
async validateInputFields() {
|
|
@@ -119,8 +125,7 @@ export class TetAvailabilityContactForm {
|
|
|
119
125
|
get extraFieldsElements() {
|
|
120
126
|
return this.extraFieldsSlotElement
|
|
121
127
|
.assignedElements()
|
|
122
|
-
.flatMap((parentElement) => Array.from(parentElement.querySelectorAll('input[id], tet-input[id]'))
|
|
123
|
-
.filter((element) => element instanceof HTMLInputElement || 'value' in element));
|
|
128
|
+
.flatMap((parentElement) => Array.from(parentElement.querySelectorAll('input[id], tet-input[id]')).filter((element) => element instanceof HTMLInputElement || 'value' in element));
|
|
124
129
|
}
|
|
125
130
|
/** Returns the submission data of all extra fields elements with a provided id attribute. */
|
|
126
131
|
get extraFieldsSubmissionData() {
|
|
@@ -145,11 +150,11 @@ export class TetAvailabilityContactForm {
|
|
|
145
150
|
}
|
|
146
151
|
render() {
|
|
147
152
|
const { theme } = this;
|
|
148
|
-
return (h("tet-dialog", { key: '
|
|
153
|
+
return (h("tet-dialog", { key: 'f4bb1850730d7a0084cf2ca41e3ab815fd04ae61', class: "modal-form-card", headerTitle: t('components-b2b-check-out-form-header'), theme: theme, closeOnOverlayClick: false, footerDisplay: "right", ref: (el) => {
|
|
149
154
|
this.dialogElement = el;
|
|
150
|
-
} }, h("div", { key: '
|
|
155
|
+
} }, h("div", { key: '5c23c0ef1f40eefb8a4bb37e3fff838d6f599053', class: { 'modal-form-card-content': true, [`${theme}`]: true } }, h("div", { key: 'ebd1d26f3253c726f7f3ec47dbf4b81c7622171e', class: "modal-form-card-content-header" }, h("div", { key: 'b6f9cb2373f14f0cb7ef74d1ee35762c8011873c', class: "icon-wrapper" }, h("tet-icon", { key: '5c84a9bdd23a0650bb8adde0f7e0486143f58d27', class: "icon", name: "tc-company-1" })), h("span", { key: '1ffbc45a95d93bea491d781744a75075246e4081', class: "modal-form-card-content-header__title" }, t('components-b2b-check-out-form-title')), h("span", { key: '86b83e78dc06f2a8881717c83b5955bf1d6940cb', class: "modal-form-card-content-header__description" }, t('components-b2b-check-out-form-description'))), h("div", { key: '0219825c05711b402d3b85379345c26e1d280f05', class: "modal-form-card-content-accordion-wrapper" }, h("slot", { key: 'b387acbdba8121eb8dd8a6b9005852220895d40e', name: "cart" })), h("form", { key: '3f547c73473e5c735df4c816e1237e83435ec355', id: "checkOutForm", class: "modal-form-card-form", ref: (ref) => (this.checkOutForm = ref) }, h("div", { key: '944453791b28bbe5744213f60c683863d2e11968', class: "modal-form-card-input__row" }, this.renderInput('companyRegNr', t('components-b2b-check-out-form-company-registration-number-input-label'), '40000000001', 'company-reg', '11'), this.renderInput('companyName', t('components-b2b-check-out-form-company-name-input-label'))), this.renderInput('address', t('components-b2b-check-out-form-address-input-label'), t('components-b2b-check-out-form-address-input-placeholder')), this.renderInput('nameSurname', t('components-b2b-check-out-form-name-input-label'), '', 'name'), h("div", { key: '287e329884ed596a0fe471f1e56ae3aeb2f65ad7', class: "modal-form-card-input__row" }, this.renderInput('email', t('components-b2b-check-out-form-email-input-label'), 'contact@company.com', 'email'), this.renderInput('phoneNr', t('components-b2b-check-out-form-phone-number-input-label'), '22222222', 'phone', '8')), h("tet-checkbox", { key: 'b34856f42ef282ac2fa0c771f6ebe241a47d3ae9', class: "modal-form-card-content-checkbox", label: t('components-check-out-form-privacy-policy'), theme: theme }), h("slot", { key: '01d82f672d1a924cb40e7af5b5132cef7f4fb7ce', name: "extra-fields", ref: (element) => (this.extraFieldsSlotElement = element) }))), h("div", { key: '13b4790fbe9e886299216e171040173ce46bdde5', slot: "footer", class: "modal-form-card-footer" }, h("tet-button", { key: '02045e393c906dbc8670b33271e557c00130599d', type: "secondary", size: "medium", theme: theme, onClick: () => {
|
|
151
156
|
this.dialogElement.close();
|
|
152
|
-
} }, t('components-b2b-check-out-form-close-button-label')), h("tet-button", { key: '
|
|
157
|
+
} }, t('components-b2b-check-out-form-close-button-label')), h("tet-button", { key: 'e277872842c8f9b87c2dd3e4a7fe7cd0dd83cc61', type: "primary", size: "medium", theme: theme, onClick: () => this.handleSubmit() }, t('components-b2b-check-out-form-submit-button-label')))));
|
|
153
158
|
}
|
|
154
159
|
static get is() { return "tet-b2b-check-out-form"; }
|
|
155
160
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { validate } from "./validator-group";
|
|
2
2
|
import { RequiredValidator } from "./validators/required";
|
|
3
3
|
import { PhoneNumberValidator } from "./validators/phone";
|
|
4
|
+
import { PhoneNumberValidatorV2 } from "./validators/phone_v2";
|
|
4
5
|
import { EMailAddressValidator } from "./validators/e-mail";
|
|
6
|
+
import { CompanyRegistrationNumberValidator } from "./validators/company-registration-number";
|
|
7
|
+
import { NameValidator } from "./validators/name";
|
|
5
8
|
export { validate,
|
|
6
9
|
// Specific validators.
|
|
7
|
-
PhoneNumberValidator, RequiredValidator, EMailAddressValidator };
|
|
10
|
+
PhoneNumberValidator, PhoneNumberValidatorV2, RequiredValidator, EMailAddressValidator, CompanyRegistrationNumberValidator, NameValidator, };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validator to check if value consists of exactly 11 digits.
|
|
3
|
+
*/
|
|
4
|
+
class CompanyRegistrationNumberValidator {
|
|
5
|
+
errorMessage;
|
|
6
|
+
/**
|
|
7
|
+
* The regex for the company registration number validation.
|
|
8
|
+
*/
|
|
9
|
+
companyRegistrationNumberRegex = '^\\d{11}$';
|
|
10
|
+
/**
|
|
11
|
+
* Constructor.
|
|
12
|
+
*
|
|
13
|
+
* @param errorMessage
|
|
14
|
+
*/
|
|
15
|
+
constructor(errorMessage) {
|
|
16
|
+
this.errorMessage = errorMessage;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Returns validation error message.
|
|
20
|
+
*/
|
|
21
|
+
getErrorMessage() {
|
|
22
|
+
return this.errorMessage;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Validation logic.
|
|
26
|
+
*
|
|
27
|
+
* @param value
|
|
28
|
+
*/
|
|
29
|
+
validate(value) {
|
|
30
|
+
// Allow empty values (RequiredValidator handles mandatory check).
|
|
31
|
+
if (!value) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
// Check if the value is exactly 11 digits.
|
|
35
|
+
return RegExp(this.companyRegistrationNumberRegex).test(value);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
export { CompanyRegistrationNumberValidator };
|