@citygross/components 0.9.0 → 0.9.1
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/build/cjs/components/src/components/CartCard/assets/fallback_grocery.svg.js +1 -1
- package/build/cjs/components/src/components/ListItem/assets/fallback_grocery.svg.js +1 -1
- package/build/cjs/components/src/components/Pagination/Pagination.js +5 -4
- package/build/cjs/components/src/components/Pagination/Pagination.js.map +1 -1
- package/build/cjs/design-tokens/build/index.js +268 -268
- package/build/cjs/design-tokens/build/index.js.map +1 -1
- package/build/cjs/utils/build/index.js +476 -476
- package/build/cjs/utils/build/index.js.map +1 -1
- package/build/es/components/src/components/CartCard/assets/fallback_grocery.svg.js +1 -1
- package/build/es/components/src/components/ListItem/assets/fallback_grocery.svg.js +1 -1
- package/build/es/components/src/components/Pagination/Pagination.js +5 -4
- package/build/es/components/src/components/Pagination/Pagination.js.map +1 -1
- package/build/es/design-tokens/build/index.js +268 -268
- package/build/es/design-tokens/build/index.js.map +1 -1
- package/build/es/utils/build/index.js +476 -476
- package/build/es/utils/build/index.js.map +1 -1
- package/package.json +78 -79
|
@@ -11,486 +11,486 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
|
|
12
12
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
13
13
|
|
|
14
|
-
var formatPrice = function (price, withParenthesis) {
|
|
15
|
-
if (price === null || price === undefined) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
var formattedPrice = price === 0
|
|
19
|
-
? 0
|
|
20
|
-
: (Math.round(price * 100) / 100)
|
|
21
|
-
.toFixed(2)
|
|
22
|
-
.replace('.', ',')
|
|
23
|
-
.replace(',00', '');
|
|
24
|
-
return "".concat(withParenthesis ? "(".concat(formattedPrice, " kr)") : "".concat(formattedPrice, " kr"));
|
|
14
|
+
var formatPrice = function (price, withParenthesis) {
|
|
15
|
+
if (price === null || price === undefined) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
var formattedPrice = price === 0
|
|
19
|
+
? 0
|
|
20
|
+
: (Math.round(price * 100) / 100)
|
|
21
|
+
.toFixed(2)
|
|
22
|
+
.replace('.', ',')
|
|
23
|
+
.replace(',00', '');
|
|
24
|
+
return "".concat(withParenthesis ? "(".concat(formattedPrice, " kr)") : "".concat(formattedPrice, " kr"));
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
var formatPriceWithDecimalsReduced = function (price) {
|
|
28
|
-
if ((price !== 0 && !price) || isNaN(price)) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
var priceArr = price && price.toString().split('.');
|
|
32
|
-
var decimalCount = priceArr && priceArr[1] ? priceArr[1].length : 0;
|
|
33
|
-
//Remove decimals
|
|
34
|
-
var priceInteger = Math.trunc(price);
|
|
35
|
-
// Avoid rounding errors, since JS can't do math
|
|
36
|
-
var priceDecimals = (price - priceInteger).toFixed(2).toString();
|
|
37
|
-
var decimalsArr = priceDecimals.split('.');
|
|
38
|
-
priceDecimals = decimalsArr.length > 1 ? decimalsArr[1] : priceDecimals;
|
|
39
|
-
// Pad with leading 0 if single number
|
|
40
|
-
var priceDecimalsReduced = priceDecimals.length < 2 ? '0' + priceDecimals : priceDecimals;
|
|
41
|
-
return {
|
|
42
|
-
value: priceInteger,
|
|
43
|
-
decimal: priceDecimalsReduced,
|
|
44
|
-
decimalCount: decimalCount
|
|
45
|
-
};
|
|
27
|
+
var formatPriceWithDecimalsReduced = function (price) {
|
|
28
|
+
if ((price !== 0 && !price) || isNaN(price)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
var priceArr = price && price.toString().split('.');
|
|
32
|
+
var decimalCount = priceArr && priceArr[1] ? priceArr[1].length : 0;
|
|
33
|
+
//Remove decimals
|
|
34
|
+
var priceInteger = Math.trunc(price);
|
|
35
|
+
// Avoid rounding errors, since JS can't do math
|
|
36
|
+
var priceDecimals = (price - priceInteger).toFixed(2).toString();
|
|
37
|
+
var decimalsArr = priceDecimals.split('.');
|
|
38
|
+
priceDecimals = decimalsArr.length > 1 ? decimalsArr[1] : priceDecimals;
|
|
39
|
+
// Pad with leading 0 if single number
|
|
40
|
+
var priceDecimalsReduced = priceDecimals.length < 2 ? '0' + priceDecimals : priceDecimals;
|
|
41
|
+
return {
|
|
42
|
+
value: priceInteger,
|
|
43
|
+
decimal: priceDecimalsReduced,
|
|
44
|
+
decimalCount: decimalCount
|
|
45
|
+
};
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
var formatPriceWithNoZero = function (price) {
|
|
49
|
-
if ((price !== 0 && !price) || isNaN(price)) {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
var formattedPrice = formatPriceWithDecimalsReduced(price);
|
|
53
|
-
return "".concat(formattedPrice === null || formattedPrice === void 0 ? void 0 : formattedPrice.value).concat("".concat((formattedPrice === null || formattedPrice === void 0 ? void 0 : formattedPrice.decimal) !== '00' ? ",".concat(formattedPrice === null || formattedPrice === void 0 ? void 0 : formattedPrice.decimal) : ''));
|
|
48
|
+
var formatPriceWithNoZero = function (price) {
|
|
49
|
+
if ((price !== 0 && !price) || isNaN(price)) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
var formattedPrice = formatPriceWithDecimalsReduced(price);
|
|
53
|
+
return "".concat(formattedPrice === null || formattedPrice === void 0 ? void 0 : formattedPrice.value).concat("".concat((formattedPrice === null || formattedPrice === void 0 ? void 0 : formattedPrice.decimal) !== '00' ? ",".concat(formattedPrice === null || formattedPrice === void 0 ? void 0 : formattedPrice.decimal) : ''));
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
var capitalizeFirstLetter = function (string) {
|
|
57
|
-
if (string.length > 1) {
|
|
58
|
-
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
59
|
-
}
|
|
60
|
-
if (string[0]) {
|
|
61
|
-
return string.toUpperCase();
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
var capitalizedAllWords = function (string) {
|
|
65
|
-
return string.replace(/(^\w|\s\w)/g, function (match) { return match.toUpperCase(); });
|
|
56
|
+
var capitalizeFirstLetter = function (string) {
|
|
57
|
+
if (string.length > 1) {
|
|
58
|
+
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
59
|
+
}
|
|
60
|
+
if (string[0]) {
|
|
61
|
+
return string.toUpperCase();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var capitalizedAllWords = function (string) {
|
|
65
|
+
return string.replace(/(^\w|\s\w)/g, function (match) { return match.toUpperCase(); });
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
var languageCodeToCountryMap = {
|
|
69
|
-
AD: 'Andorra',
|
|
70
|
-
AE: 'Förenade Arabemiraten',
|
|
71
|
-
AF: 'Afghanistan',
|
|
72
|
-
AG: 'Antigua och Barbuda',
|
|
73
|
-
AI: 'Anguilla',
|
|
74
|
-
AL: 'Albanien',
|
|
75
|
-
AM: 'Armenien',
|
|
76
|
-
AO: 'Angola',
|
|
77
|
-
AQ: 'Antarktis',
|
|
78
|
-
AR: 'Argentina',
|
|
79
|
-
AS: 'Amerikanska Samoa',
|
|
80
|
-
AT: 'Österrike',
|
|
81
|
-
AU: 'Australien',
|
|
82
|
-
AW: 'Aruba',
|
|
83
|
-
AX: 'Åland',
|
|
84
|
-
AZ: 'Azerbajdzjan',
|
|
85
|
-
BA: 'Bosnien och Hercegovina',
|
|
86
|
-
BB: 'Barbados',
|
|
87
|
-
BD: 'Bangladesh',
|
|
88
|
-
BE: 'Belgien',
|
|
89
|
-
BF: 'Burkina Faso',
|
|
90
|
-
BG: 'Bulgarien',
|
|
91
|
-
BH: 'Bahrain',
|
|
92
|
-
BI: 'Burundi',
|
|
93
|
-
BJ: 'Benin',
|
|
94
|
-
BL: 'Saint-Barthélemy',
|
|
95
|
-
BM: 'Bermuda',
|
|
96
|
-
BN: 'Brunei',
|
|
97
|
-
BO: 'Bolivia',
|
|
98
|
-
BQ: 'Bonaire, Sint Eustatius and Saba',
|
|
99
|
-
BR: 'Brasilien',
|
|
100
|
-
BS: 'Bahamas',
|
|
101
|
-
BT: 'Bhutan',
|
|
102
|
-
BV: 'Bouvetön',
|
|
103
|
-
BW: 'Botswana',
|
|
104
|
-
BY: 'Belarus',
|
|
105
|
-
BZ: 'Belize',
|
|
106
|
-
CA: 'Kanada',
|
|
107
|
-
CC: 'Kokosöarna',
|
|
108
|
-
CD: 'Kongo-Kinshasa',
|
|
109
|
-
CF: 'Centralafrikanska republiken',
|
|
110
|
-
CG: 'Kongo-Brazzaville',
|
|
111
|
-
CH: 'Schweiz',
|
|
112
|
-
CI: 'Elfenbenskusten',
|
|
113
|
-
CK: 'Cooköarna',
|
|
114
|
-
CL: 'Chile',
|
|
115
|
-
CM: 'Kamerun',
|
|
116
|
-
CN: 'Kina',
|
|
117
|
-
CO: 'Colombia',
|
|
118
|
-
CR: 'Costa Rica',
|
|
119
|
-
CU: 'Kuba',
|
|
120
|
-
CV: 'Kap Verde',
|
|
121
|
-
CW: 'Curaçao',
|
|
122
|
-
CX: 'Julön',
|
|
123
|
-
CY: 'Cypern',
|
|
124
|
-
CZ: 'Tjeckien',
|
|
125
|
-
DE: 'Tyskland',
|
|
126
|
-
DJ: 'Djibouti',
|
|
127
|
-
DK: 'Danmark',
|
|
128
|
-
DM: 'Dominica',
|
|
129
|
-
DO: 'Dominikanska republiken',
|
|
130
|
-
DZ: 'Algeriet',
|
|
131
|
-
EC: 'Ecuador',
|
|
132
|
-
EE: 'Estland',
|
|
133
|
-
EG: 'Egypten',
|
|
134
|
-
EH: 'Västsahara',
|
|
135
|
-
ER: 'Eritrea',
|
|
136
|
-
ES: 'Spanien',
|
|
137
|
-
ET: 'Etiopien',
|
|
138
|
-
FI: 'Finland',
|
|
139
|
-
FJ: 'Fiji',
|
|
140
|
-
FK: 'Falklandsöarna',
|
|
141
|
-
FM: 'Mikronesiska federationen',
|
|
142
|
-
FO: 'Färöarna',
|
|
143
|
-
FR: 'Frankrike',
|
|
144
|
-
GA: 'Gabon',
|
|
145
|
-
GB: 'Storbritannien',
|
|
146
|
-
GD: 'Grenada',
|
|
147
|
-
GE: 'Georgien',
|
|
148
|
-
GF: 'Franska Guyana',
|
|
149
|
-
GG: 'Guernsey',
|
|
150
|
-
GH: 'Ghana',
|
|
151
|
-
GI: 'Gibraltar',
|
|
152
|
-
GL: 'Grönland',
|
|
153
|
-
GM: 'Gambia',
|
|
154
|
-
GN: 'Guinea',
|
|
155
|
-
GP: 'Guadeloupe',
|
|
156
|
-
GQ: 'Ekvatorialguinea',
|
|
157
|
-
GR: 'Grekland',
|
|
158
|
-
GS: 'Sydgeorgien',
|
|
159
|
-
GT: 'Guatemala',
|
|
160
|
-
GU: 'Guam',
|
|
161
|
-
GW: 'Guinea-Bissau',
|
|
162
|
-
GY: 'Guyana',
|
|
163
|
-
HK: 'Hongkong',
|
|
164
|
-
HM: 'Heard- och McDonaldöarna',
|
|
165
|
-
HN: 'Honduras',
|
|
166
|
-
HR: 'Kroatien',
|
|
167
|
-
HT: 'Haiti',
|
|
168
|
-
HU: 'Ungern',
|
|
169
|
-
ID: 'Indonesien',
|
|
170
|
-
IE: 'Irland',
|
|
171
|
-
IL: 'Israel',
|
|
172
|
-
IM: 'Isle of Man',
|
|
173
|
-
IN: 'Indien',
|
|
174
|
-
IO: 'Brittiska territoriet i Indiska Oceanen',
|
|
175
|
-
IQ: 'Irak',
|
|
176
|
-
IR: 'Iran',
|
|
177
|
-
IS: 'Island',
|
|
178
|
-
IT: 'Italien',
|
|
179
|
-
JE: 'Jersey',
|
|
180
|
-
JM: 'Jamaica',
|
|
181
|
-
JO: 'Jordanien',
|
|
182
|
-
JP: 'Japan',
|
|
183
|
-
KE: 'Kenya',
|
|
184
|
-
KG: 'Kirgizistan',
|
|
185
|
-
KH: 'Kambodja',
|
|
186
|
-
KI: 'Kiribati',
|
|
187
|
-
KM: 'Komorerna',
|
|
188
|
-
KN: 'Saint Kitts och Nevis',
|
|
189
|
-
KP: 'Nordkorea',
|
|
190
|
-
KR: 'Sydkorea',
|
|
191
|
-
KW: 'Kuwait',
|
|
192
|
-
KY: 'Caymanöarna',
|
|
193
|
-
KZ: 'Kazakstan',
|
|
194
|
-
LA: 'Laos',
|
|
195
|
-
LB: 'Libanon',
|
|
196
|
-
LC: 'Saint Lucia',
|
|
197
|
-
LI: 'Liechtenstein',
|
|
198
|
-
LK: 'Sri Lanka',
|
|
199
|
-
LR: 'Liberia',
|
|
200
|
-
LS: 'Lesotho',
|
|
201
|
-
LT: 'Litauen',
|
|
202
|
-
LU: 'Luxemburg',
|
|
203
|
-
LV: 'Lettland',
|
|
204
|
-
LY: 'Libyen',
|
|
205
|
-
MA: 'Marocko',
|
|
206
|
-
MC: 'Monaco',
|
|
207
|
-
MD: 'Moldavien',
|
|
208
|
-
ME: 'Montenegro',
|
|
209
|
-
MF: 'Saint-Martin',
|
|
210
|
-
MG: 'Madagaskar',
|
|
211
|
-
MH: 'Marshallöarna',
|
|
212
|
-
MK: 'Nordmakedonien',
|
|
213
|
-
ML: 'Mali',
|
|
214
|
-
MM: 'Myanmar',
|
|
215
|
-
MN: 'Mongoliet',
|
|
216
|
-
MO: 'Macao',
|
|
217
|
-
MP: 'Nordmarianerna',
|
|
218
|
-
MQ: 'Martinique',
|
|
219
|
-
MR: 'Mauretanien',
|
|
220
|
-
MS: 'Montserrat',
|
|
221
|
-
MT: 'Malta',
|
|
222
|
-
MU: 'Mauritius',
|
|
223
|
-
MV: 'Maldiverna',
|
|
224
|
-
MW: 'Malawi',
|
|
225
|
-
MX: 'Mexiko',
|
|
226
|
-
MY: 'Malaysia',
|
|
227
|
-
MZ: 'Moçambique',
|
|
228
|
-
NA: 'Namibia',
|
|
229
|
-
NC: 'Nya Kaledonien',
|
|
230
|
-
NE: 'Niger',
|
|
231
|
-
NF: 'Norfolkön',
|
|
232
|
-
NG: 'Nigeria',
|
|
233
|
-
NI: 'Nicaragua',
|
|
234
|
-
NL: 'Nederländerna',
|
|
235
|
-
NO: 'Norge',
|
|
236
|
-
NP: 'Nepal',
|
|
237
|
-
NR: 'Nauru',
|
|
238
|
-
NU: 'Niue',
|
|
239
|
-
NZ: 'Nya Zeeland',
|
|
240
|
-
OM: 'Oman',
|
|
241
|
-
PA: 'Panama',
|
|
242
|
-
PE: 'Peru',
|
|
243
|
-
PF: 'Franska Polynesien',
|
|
244
|
-
PG: 'Papua Nya Guinea',
|
|
245
|
-
PH: 'Filippinerna',
|
|
246
|
-
PK: 'Pakistan',
|
|
247
|
-
PL: 'Polen',
|
|
248
|
-
PM: 'Saint-Pierre och Miquelon',
|
|
249
|
-
PN: 'Pitcairnöarna',
|
|
250
|
-
PR: 'Puerto Rico',
|
|
251
|
-
PS: 'Palestina',
|
|
252
|
-
PT: 'Portugal',
|
|
253
|
-
PW: 'Palau',
|
|
254
|
-
PY: 'Paraguay',
|
|
255
|
-
QA: 'Qatar',
|
|
256
|
-
RE: 'Réunion',
|
|
257
|
-
RO: 'Rumänien',
|
|
258
|
-
RS: 'Serbien',
|
|
259
|
-
RU: 'Ryssland',
|
|
260
|
-
RW: 'Rwanda',
|
|
261
|
-
SA: 'Saudiarabien',
|
|
262
|
-
SB: 'Salomonöarna',
|
|
263
|
-
SC: 'Seychellerna',
|
|
264
|
-
SD: 'Sudan',
|
|
265
|
-
SE: 'Sverige',
|
|
266
|
-
SG: 'Singapore',
|
|
267
|
-
SH: 'Sankta Helena',
|
|
268
|
-
SI: 'Slovenien',
|
|
269
|
-
SJ: 'Svalbard och Jan Mayen',
|
|
270
|
-
SK: 'Slovakien',
|
|
271
|
-
SL: 'Sierra Leone',
|
|
272
|
-
SM: 'San Marino',
|
|
273
|
-
SN: 'Senegal',
|
|
274
|
-
SO: 'Somalia',
|
|
275
|
-
SR: 'Surinam',
|
|
276
|
-
SS: 'Sydsudan',
|
|
277
|
-
ST: 'São Tomé och Príncipe',
|
|
278
|
-
SV: 'El Salvador',
|
|
279
|
-
SX: 'Sint Maarten',
|
|
280
|
-
SY: 'Syrien',
|
|
281
|
-
SZ: 'Swaziland',
|
|
282
|
-
TC: 'Turks- och Caicosöarna',
|
|
283
|
-
TD: 'Tchad',
|
|
284
|
-
TF: 'Franska södra territorierna',
|
|
285
|
-
TG: 'Togo',
|
|
286
|
-
TH: 'Thailand',
|
|
287
|
-
TJ: 'Tadzjikistan',
|
|
288
|
-
TK: 'Tokelauöarna',
|
|
289
|
-
TL: 'Östtimor',
|
|
290
|
-
TM: 'Turkmenistan',
|
|
291
|
-
TN: 'Tunisien',
|
|
292
|
-
TO: 'Tonga',
|
|
293
|
-
TR: 'Turkiet',
|
|
294
|
-
TT: 'Trinidad och Tobago',
|
|
295
|
-
TV: 'Tuvalu',
|
|
296
|
-
TW: 'Taiwan',
|
|
297
|
-
TZ: 'Tanzania',
|
|
298
|
-
UA: 'Ukraina',
|
|
299
|
-
UG: 'Uganda',
|
|
300
|
-
UM: 'Förenta staternas mindre öar i Oceanien och Västindien',
|
|
301
|
-
US: 'USA',
|
|
302
|
-
UY: 'Uruguay',
|
|
303
|
-
UZ: 'Uzbekistan',
|
|
304
|
-
VA: 'Vatikanstaten',
|
|
305
|
-
VC: 'Saint Vincent och Grenadinerna',
|
|
306
|
-
VE: 'Venezuela',
|
|
307
|
-
VG: 'Brittiska Jungfruöarna',
|
|
308
|
-
VI: 'Amerikanska Jungfruöarna',
|
|
309
|
-
VN: 'Vietnam',
|
|
310
|
-
VU: 'Vanuatu',
|
|
311
|
-
WF: 'Wallis- och Futunaöarna',
|
|
312
|
-
WS: 'Samoa',
|
|
313
|
-
YE: 'Jemen',
|
|
314
|
-
YT: 'Mayotte',
|
|
315
|
-
ZA: 'Sydafrika',
|
|
316
|
-
ZM: 'Zambia',
|
|
317
|
-
ZW: 'Zimbabwe'
|
|
318
|
-
};
|
|
319
|
-
var getCountryFromLanguageCode = function (languageCode) {
|
|
320
|
-
return languageCodeToCountryMap[languageCode] || '';
|
|
68
|
+
var languageCodeToCountryMap = {
|
|
69
|
+
AD: 'Andorra',
|
|
70
|
+
AE: 'Förenade Arabemiraten',
|
|
71
|
+
AF: 'Afghanistan',
|
|
72
|
+
AG: 'Antigua och Barbuda',
|
|
73
|
+
AI: 'Anguilla',
|
|
74
|
+
AL: 'Albanien',
|
|
75
|
+
AM: 'Armenien',
|
|
76
|
+
AO: 'Angola',
|
|
77
|
+
AQ: 'Antarktis',
|
|
78
|
+
AR: 'Argentina',
|
|
79
|
+
AS: 'Amerikanska Samoa',
|
|
80
|
+
AT: 'Österrike',
|
|
81
|
+
AU: 'Australien',
|
|
82
|
+
AW: 'Aruba',
|
|
83
|
+
AX: 'Åland',
|
|
84
|
+
AZ: 'Azerbajdzjan',
|
|
85
|
+
BA: 'Bosnien och Hercegovina',
|
|
86
|
+
BB: 'Barbados',
|
|
87
|
+
BD: 'Bangladesh',
|
|
88
|
+
BE: 'Belgien',
|
|
89
|
+
BF: 'Burkina Faso',
|
|
90
|
+
BG: 'Bulgarien',
|
|
91
|
+
BH: 'Bahrain',
|
|
92
|
+
BI: 'Burundi',
|
|
93
|
+
BJ: 'Benin',
|
|
94
|
+
BL: 'Saint-Barthélemy',
|
|
95
|
+
BM: 'Bermuda',
|
|
96
|
+
BN: 'Brunei',
|
|
97
|
+
BO: 'Bolivia',
|
|
98
|
+
BQ: 'Bonaire, Sint Eustatius and Saba',
|
|
99
|
+
BR: 'Brasilien',
|
|
100
|
+
BS: 'Bahamas',
|
|
101
|
+
BT: 'Bhutan',
|
|
102
|
+
BV: 'Bouvetön',
|
|
103
|
+
BW: 'Botswana',
|
|
104
|
+
BY: 'Belarus',
|
|
105
|
+
BZ: 'Belize',
|
|
106
|
+
CA: 'Kanada',
|
|
107
|
+
CC: 'Kokosöarna',
|
|
108
|
+
CD: 'Kongo-Kinshasa',
|
|
109
|
+
CF: 'Centralafrikanska republiken',
|
|
110
|
+
CG: 'Kongo-Brazzaville',
|
|
111
|
+
CH: 'Schweiz',
|
|
112
|
+
CI: 'Elfenbenskusten',
|
|
113
|
+
CK: 'Cooköarna',
|
|
114
|
+
CL: 'Chile',
|
|
115
|
+
CM: 'Kamerun',
|
|
116
|
+
CN: 'Kina',
|
|
117
|
+
CO: 'Colombia',
|
|
118
|
+
CR: 'Costa Rica',
|
|
119
|
+
CU: 'Kuba',
|
|
120
|
+
CV: 'Kap Verde',
|
|
121
|
+
CW: 'Curaçao',
|
|
122
|
+
CX: 'Julön',
|
|
123
|
+
CY: 'Cypern',
|
|
124
|
+
CZ: 'Tjeckien',
|
|
125
|
+
DE: 'Tyskland',
|
|
126
|
+
DJ: 'Djibouti',
|
|
127
|
+
DK: 'Danmark',
|
|
128
|
+
DM: 'Dominica',
|
|
129
|
+
DO: 'Dominikanska republiken',
|
|
130
|
+
DZ: 'Algeriet',
|
|
131
|
+
EC: 'Ecuador',
|
|
132
|
+
EE: 'Estland',
|
|
133
|
+
EG: 'Egypten',
|
|
134
|
+
EH: 'Västsahara',
|
|
135
|
+
ER: 'Eritrea',
|
|
136
|
+
ES: 'Spanien',
|
|
137
|
+
ET: 'Etiopien',
|
|
138
|
+
FI: 'Finland',
|
|
139
|
+
FJ: 'Fiji',
|
|
140
|
+
FK: 'Falklandsöarna',
|
|
141
|
+
FM: 'Mikronesiska federationen',
|
|
142
|
+
FO: 'Färöarna',
|
|
143
|
+
FR: 'Frankrike',
|
|
144
|
+
GA: 'Gabon',
|
|
145
|
+
GB: 'Storbritannien',
|
|
146
|
+
GD: 'Grenada',
|
|
147
|
+
GE: 'Georgien',
|
|
148
|
+
GF: 'Franska Guyana',
|
|
149
|
+
GG: 'Guernsey',
|
|
150
|
+
GH: 'Ghana',
|
|
151
|
+
GI: 'Gibraltar',
|
|
152
|
+
GL: 'Grönland',
|
|
153
|
+
GM: 'Gambia',
|
|
154
|
+
GN: 'Guinea',
|
|
155
|
+
GP: 'Guadeloupe',
|
|
156
|
+
GQ: 'Ekvatorialguinea',
|
|
157
|
+
GR: 'Grekland',
|
|
158
|
+
GS: 'Sydgeorgien',
|
|
159
|
+
GT: 'Guatemala',
|
|
160
|
+
GU: 'Guam',
|
|
161
|
+
GW: 'Guinea-Bissau',
|
|
162
|
+
GY: 'Guyana',
|
|
163
|
+
HK: 'Hongkong',
|
|
164
|
+
HM: 'Heard- och McDonaldöarna',
|
|
165
|
+
HN: 'Honduras',
|
|
166
|
+
HR: 'Kroatien',
|
|
167
|
+
HT: 'Haiti',
|
|
168
|
+
HU: 'Ungern',
|
|
169
|
+
ID: 'Indonesien',
|
|
170
|
+
IE: 'Irland',
|
|
171
|
+
IL: 'Israel',
|
|
172
|
+
IM: 'Isle of Man',
|
|
173
|
+
IN: 'Indien',
|
|
174
|
+
IO: 'Brittiska territoriet i Indiska Oceanen',
|
|
175
|
+
IQ: 'Irak',
|
|
176
|
+
IR: 'Iran',
|
|
177
|
+
IS: 'Island',
|
|
178
|
+
IT: 'Italien',
|
|
179
|
+
JE: 'Jersey',
|
|
180
|
+
JM: 'Jamaica',
|
|
181
|
+
JO: 'Jordanien',
|
|
182
|
+
JP: 'Japan',
|
|
183
|
+
KE: 'Kenya',
|
|
184
|
+
KG: 'Kirgizistan',
|
|
185
|
+
KH: 'Kambodja',
|
|
186
|
+
KI: 'Kiribati',
|
|
187
|
+
KM: 'Komorerna',
|
|
188
|
+
KN: 'Saint Kitts och Nevis',
|
|
189
|
+
KP: 'Nordkorea',
|
|
190
|
+
KR: 'Sydkorea',
|
|
191
|
+
KW: 'Kuwait',
|
|
192
|
+
KY: 'Caymanöarna',
|
|
193
|
+
KZ: 'Kazakstan',
|
|
194
|
+
LA: 'Laos',
|
|
195
|
+
LB: 'Libanon',
|
|
196
|
+
LC: 'Saint Lucia',
|
|
197
|
+
LI: 'Liechtenstein',
|
|
198
|
+
LK: 'Sri Lanka',
|
|
199
|
+
LR: 'Liberia',
|
|
200
|
+
LS: 'Lesotho',
|
|
201
|
+
LT: 'Litauen',
|
|
202
|
+
LU: 'Luxemburg',
|
|
203
|
+
LV: 'Lettland',
|
|
204
|
+
LY: 'Libyen',
|
|
205
|
+
MA: 'Marocko',
|
|
206
|
+
MC: 'Monaco',
|
|
207
|
+
MD: 'Moldavien',
|
|
208
|
+
ME: 'Montenegro',
|
|
209
|
+
MF: 'Saint-Martin',
|
|
210
|
+
MG: 'Madagaskar',
|
|
211
|
+
MH: 'Marshallöarna',
|
|
212
|
+
MK: 'Nordmakedonien',
|
|
213
|
+
ML: 'Mali',
|
|
214
|
+
MM: 'Myanmar',
|
|
215
|
+
MN: 'Mongoliet',
|
|
216
|
+
MO: 'Macao',
|
|
217
|
+
MP: 'Nordmarianerna',
|
|
218
|
+
MQ: 'Martinique',
|
|
219
|
+
MR: 'Mauretanien',
|
|
220
|
+
MS: 'Montserrat',
|
|
221
|
+
MT: 'Malta',
|
|
222
|
+
MU: 'Mauritius',
|
|
223
|
+
MV: 'Maldiverna',
|
|
224
|
+
MW: 'Malawi',
|
|
225
|
+
MX: 'Mexiko',
|
|
226
|
+
MY: 'Malaysia',
|
|
227
|
+
MZ: 'Moçambique',
|
|
228
|
+
NA: 'Namibia',
|
|
229
|
+
NC: 'Nya Kaledonien',
|
|
230
|
+
NE: 'Niger',
|
|
231
|
+
NF: 'Norfolkön',
|
|
232
|
+
NG: 'Nigeria',
|
|
233
|
+
NI: 'Nicaragua',
|
|
234
|
+
NL: 'Nederländerna',
|
|
235
|
+
NO: 'Norge',
|
|
236
|
+
NP: 'Nepal',
|
|
237
|
+
NR: 'Nauru',
|
|
238
|
+
NU: 'Niue',
|
|
239
|
+
NZ: 'Nya Zeeland',
|
|
240
|
+
OM: 'Oman',
|
|
241
|
+
PA: 'Panama',
|
|
242
|
+
PE: 'Peru',
|
|
243
|
+
PF: 'Franska Polynesien',
|
|
244
|
+
PG: 'Papua Nya Guinea',
|
|
245
|
+
PH: 'Filippinerna',
|
|
246
|
+
PK: 'Pakistan',
|
|
247
|
+
PL: 'Polen',
|
|
248
|
+
PM: 'Saint-Pierre och Miquelon',
|
|
249
|
+
PN: 'Pitcairnöarna',
|
|
250
|
+
PR: 'Puerto Rico',
|
|
251
|
+
PS: 'Palestina',
|
|
252
|
+
PT: 'Portugal',
|
|
253
|
+
PW: 'Palau',
|
|
254
|
+
PY: 'Paraguay',
|
|
255
|
+
QA: 'Qatar',
|
|
256
|
+
RE: 'Réunion',
|
|
257
|
+
RO: 'Rumänien',
|
|
258
|
+
RS: 'Serbien',
|
|
259
|
+
RU: 'Ryssland',
|
|
260
|
+
RW: 'Rwanda',
|
|
261
|
+
SA: 'Saudiarabien',
|
|
262
|
+
SB: 'Salomonöarna',
|
|
263
|
+
SC: 'Seychellerna',
|
|
264
|
+
SD: 'Sudan',
|
|
265
|
+
SE: 'Sverige',
|
|
266
|
+
SG: 'Singapore',
|
|
267
|
+
SH: 'Sankta Helena',
|
|
268
|
+
SI: 'Slovenien',
|
|
269
|
+
SJ: 'Svalbard och Jan Mayen',
|
|
270
|
+
SK: 'Slovakien',
|
|
271
|
+
SL: 'Sierra Leone',
|
|
272
|
+
SM: 'San Marino',
|
|
273
|
+
SN: 'Senegal',
|
|
274
|
+
SO: 'Somalia',
|
|
275
|
+
SR: 'Surinam',
|
|
276
|
+
SS: 'Sydsudan',
|
|
277
|
+
ST: 'São Tomé och Príncipe',
|
|
278
|
+
SV: 'El Salvador',
|
|
279
|
+
SX: 'Sint Maarten',
|
|
280
|
+
SY: 'Syrien',
|
|
281
|
+
SZ: 'Swaziland',
|
|
282
|
+
TC: 'Turks- och Caicosöarna',
|
|
283
|
+
TD: 'Tchad',
|
|
284
|
+
TF: 'Franska södra territorierna',
|
|
285
|
+
TG: 'Togo',
|
|
286
|
+
TH: 'Thailand',
|
|
287
|
+
TJ: 'Tadzjikistan',
|
|
288
|
+
TK: 'Tokelauöarna',
|
|
289
|
+
TL: 'Östtimor',
|
|
290
|
+
TM: 'Turkmenistan',
|
|
291
|
+
TN: 'Tunisien',
|
|
292
|
+
TO: 'Tonga',
|
|
293
|
+
TR: 'Turkiet',
|
|
294
|
+
TT: 'Trinidad och Tobago',
|
|
295
|
+
TV: 'Tuvalu',
|
|
296
|
+
TW: 'Taiwan',
|
|
297
|
+
TZ: 'Tanzania',
|
|
298
|
+
UA: 'Ukraina',
|
|
299
|
+
UG: 'Uganda',
|
|
300
|
+
UM: 'Förenta staternas mindre öar i Oceanien och Västindien',
|
|
301
|
+
US: 'USA',
|
|
302
|
+
UY: 'Uruguay',
|
|
303
|
+
UZ: 'Uzbekistan',
|
|
304
|
+
VA: 'Vatikanstaten',
|
|
305
|
+
VC: 'Saint Vincent och Grenadinerna',
|
|
306
|
+
VE: 'Venezuela',
|
|
307
|
+
VG: 'Brittiska Jungfruöarna',
|
|
308
|
+
VI: 'Amerikanska Jungfruöarna',
|
|
309
|
+
VN: 'Vietnam',
|
|
310
|
+
VU: 'Vanuatu',
|
|
311
|
+
WF: 'Wallis- och Futunaöarna',
|
|
312
|
+
WS: 'Samoa',
|
|
313
|
+
YE: 'Jemen',
|
|
314
|
+
YT: 'Mayotte',
|
|
315
|
+
ZA: 'Sydafrika',
|
|
316
|
+
ZM: 'Zambia',
|
|
317
|
+
ZW: 'Zimbabwe'
|
|
318
|
+
};
|
|
319
|
+
var getCountryFromLanguageCode = function (languageCode) {
|
|
320
|
+
return languageCodeToCountryMap[languageCode] || '';
|
|
321
321
|
};
|
|
322
322
|
|
|
323
|
-
var useDetectDevice = function () {
|
|
324
|
-
var _a = React__default["default"].useState(false), isMobile = _a[0], setMobile = _a[1];
|
|
325
|
-
React__default["default"].useEffect(function () {
|
|
326
|
-
var userAgent = typeof window.navigator === 'undefined' ? '' : navigator.userAgent;
|
|
327
|
-
var mobile = Boolean(userAgent.match(/Android|BlackBerry|iPhone|iPod|Opera Mini|IEMobile|WPDesktop/i) || window.screen.width < 1024);
|
|
328
|
-
setMobile(mobile);
|
|
329
|
-
}, []);
|
|
330
|
-
return { isMobile: isMobile };
|
|
323
|
+
var useDetectDevice = function () {
|
|
324
|
+
var _a = React__default["default"].useState(false), isMobile = _a[0], setMobile = _a[1];
|
|
325
|
+
React__default["default"].useEffect(function () {
|
|
326
|
+
var userAgent = typeof window.navigator === 'undefined' ? '' : navigator.userAgent;
|
|
327
|
+
var mobile = Boolean(userAgent.match(/Android|BlackBerry|iPhone|iPod|Opera Mini|IEMobile|WPDesktop/i) || window.screen.width < 1024);
|
|
328
|
+
setMobile(mobile);
|
|
329
|
+
}, []);
|
|
330
|
+
return { isMobile: isMobile };
|
|
331
331
|
};
|
|
332
332
|
|
|
333
|
-
function useWindowSize() {
|
|
334
|
-
var _a = React.useState({
|
|
335
|
-
width: typeof window !== 'undefined' ? window.innerWidth : 0,
|
|
336
|
-
height: typeof window !== 'undefined' ? window.innerHeight : 0
|
|
337
|
-
}), windowSize = _a[0], setWindowSize = _a[1];
|
|
338
|
-
React.useEffect(function () {
|
|
339
|
-
function handleResize() {
|
|
340
|
-
setWindowSize({
|
|
341
|
-
width: window.innerWidth,
|
|
342
|
-
height: window.innerHeight
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
window.addEventListener('resize', handleResize);
|
|
346
|
-
handleResize();
|
|
347
|
-
// Remove event listener on cleanup
|
|
348
|
-
return function () { return window.removeEventListener('resize', handleResize); };
|
|
349
|
-
}, []);
|
|
350
|
-
return { width: windowSize.width, height: windowSize.height };
|
|
333
|
+
function useWindowSize() {
|
|
334
|
+
var _a = React.useState({
|
|
335
|
+
width: typeof window !== 'undefined' ? window.innerWidth : 0,
|
|
336
|
+
height: typeof window !== 'undefined' ? window.innerHeight : 0
|
|
337
|
+
}), windowSize = _a[0], setWindowSize = _a[1];
|
|
338
|
+
React.useEffect(function () {
|
|
339
|
+
function handleResize() {
|
|
340
|
+
setWindowSize({
|
|
341
|
+
width: window.innerWidth,
|
|
342
|
+
height: window.innerHeight
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
window.addEventListener('resize', handleResize);
|
|
346
|
+
handleResize();
|
|
347
|
+
// Remove event listener on cleanup
|
|
348
|
+
return function () { return window.removeEventListener('resize', handleResize); };
|
|
349
|
+
}, []);
|
|
350
|
+
return { width: windowSize.width, height: windowSize.height };
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
var useOutsideClick = function (ref, callback) {
|
|
354
|
-
var handleClick = function (e) {
|
|
355
|
-
if ((ref === null || ref === void 0 ? void 0 : ref.current) && !ref.current.contains(e.target)) {
|
|
356
|
-
callback();
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
React.useEffect(function () {
|
|
360
|
-
document === null || document === void 0 ? void 0 : document.addEventListener('click', handleClick);
|
|
361
|
-
return function () {
|
|
362
|
-
document === null || document === void 0 ? void 0 : document.removeEventListener('click', handleClick);
|
|
363
|
-
};
|
|
364
|
-
});
|
|
353
|
+
var useOutsideClick = function (ref, callback) {
|
|
354
|
+
var handleClick = function (e) {
|
|
355
|
+
if ((ref === null || ref === void 0 ? void 0 : ref.current) && !ref.current.contains(e.target)) {
|
|
356
|
+
callback();
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
React.useEffect(function () {
|
|
360
|
+
document === null || document === void 0 ? void 0 : document.addEventListener('click', handleClick);
|
|
361
|
+
return function () {
|
|
362
|
+
document === null || document === void 0 ? void 0 : document.removeEventListener('click', handleClick);
|
|
363
|
+
};
|
|
364
|
+
});
|
|
365
365
|
};
|
|
366
366
|
|
|
367
|
-
var useFixedModalScroll = function (active, querySelector) {
|
|
368
|
-
var _a = React.useState(0), prevPosition = _a[0], setPrevPosition = _a[1];
|
|
369
|
-
React.useEffect(function () {
|
|
370
|
-
var pos = window === null || window === void 0 ? void 0 : window.scrollY;
|
|
371
|
-
var selector = querySelector || (document === null || document === void 0 ? void 0 : document.body);
|
|
372
|
-
if (active && selector) {
|
|
373
|
-
setPrevPosition(pos);
|
|
374
|
-
selector.style.overflowY = 'scroll';
|
|
375
|
-
selector.style.position = 'fixed';
|
|
376
|
-
selector.style.top = -pos + 'px';
|
|
377
|
-
}
|
|
378
|
-
else {
|
|
379
|
-
selector.style.removeProperty('top');
|
|
380
|
-
selector.style.overflowY = 'auto';
|
|
381
|
-
selector.style.position = 'relative';
|
|
382
|
-
if (prevPosition) {
|
|
383
|
-
window.scrollTo(0, prevPosition);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}, [active, querySelector]);
|
|
367
|
+
var useFixedModalScroll = function (active, querySelector) {
|
|
368
|
+
var _a = React.useState(0), prevPosition = _a[0], setPrevPosition = _a[1];
|
|
369
|
+
React.useEffect(function () {
|
|
370
|
+
var pos = window === null || window === void 0 ? void 0 : window.scrollY;
|
|
371
|
+
var selector = querySelector || (document === null || document === void 0 ? void 0 : document.body);
|
|
372
|
+
if (active && selector) {
|
|
373
|
+
setPrevPosition(pos);
|
|
374
|
+
selector.style.overflowY = 'scroll';
|
|
375
|
+
selector.style.position = 'fixed';
|
|
376
|
+
selector.style.top = -pos + 'px';
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
selector.style.removeProperty('top');
|
|
380
|
+
selector.style.overflowY = 'auto';
|
|
381
|
+
selector.style.position = 'relative';
|
|
382
|
+
if (prevPosition) {
|
|
383
|
+
window.scrollTo(0, prevPosition);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}, [active, querySelector]);
|
|
387
387
|
};
|
|
388
388
|
|
|
389
|
-
function comparisonTypes(type) {
|
|
390
|
-
if (!type) {
|
|
391
|
-
return '';
|
|
392
|
-
}
|
|
393
|
-
switch (type) {
|
|
394
|
-
case 'KGM':
|
|
395
|
-
return 'kg';
|
|
396
|
-
case 'G':
|
|
397
|
-
return 'g';
|
|
398
|
-
case 'LTR':
|
|
399
|
-
return 'l';
|
|
400
|
-
case 'PCE':
|
|
401
|
-
return 'st';
|
|
402
|
-
case 'H87':
|
|
403
|
-
return 'st';
|
|
404
|
-
case 'm':
|
|
405
|
-
return 'm';
|
|
406
|
-
case 'MM':
|
|
407
|
-
return 'm';
|
|
408
|
-
case 'MTR':
|
|
409
|
-
return 'm';
|
|
410
|
-
case 'DSK':
|
|
411
|
-
return 'disk';
|
|
412
|
-
case 'TVA':
|
|
413
|
-
return 'tvätt';
|
|
414
|
-
}
|
|
389
|
+
function comparisonTypes(type) {
|
|
390
|
+
if (!type) {
|
|
391
|
+
return '';
|
|
392
|
+
}
|
|
393
|
+
switch (type) {
|
|
394
|
+
case 'KGM':
|
|
395
|
+
return 'kg';
|
|
396
|
+
case 'G':
|
|
397
|
+
return 'g';
|
|
398
|
+
case 'LTR':
|
|
399
|
+
return 'l';
|
|
400
|
+
case 'PCE':
|
|
401
|
+
return 'st';
|
|
402
|
+
case 'H87':
|
|
403
|
+
return 'st';
|
|
404
|
+
case 'm':
|
|
405
|
+
return 'm';
|
|
406
|
+
case 'MM':
|
|
407
|
+
return 'm';
|
|
408
|
+
case 'MTR':
|
|
409
|
+
return 'm';
|
|
410
|
+
case 'DSK':
|
|
411
|
+
return 'disk';
|
|
412
|
+
case 'TVA':
|
|
413
|
+
return 'tvätt';
|
|
414
|
+
}
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
-
var phoneRegex = /^[0-9]{7,14}$/;
|
|
418
|
-
var nameRegex = /^[a-ö, A-Ö]$/;
|
|
419
|
-
var zipRegex = /(^\d{5}$)|(^\d{3} \d{2}$)/;
|
|
420
|
-
// Taken from https://stackoverflow.com/a/46181
|
|
421
|
-
var emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
417
|
+
var phoneRegex = /^[0-9]{7,14}$/;
|
|
418
|
+
var nameRegex = /^[a-ö, A-Ö]$/;
|
|
419
|
+
var zipRegex = /(^\d{5}$)|(^\d{3} \d{2}$)/;
|
|
420
|
+
// Taken from https://stackoverflow.com/a/46181
|
|
421
|
+
var emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
422
422
|
var validateInput = function (input, regex) { return regex.test(input); };
|
|
423
423
|
|
|
424
|
-
var makeCateringPortionsString = function (variant, cartItem, unit) {
|
|
425
|
-
var _a, _b;
|
|
426
|
-
if (unit !== 'per person')
|
|
427
|
-
return;
|
|
428
|
-
var qString = '';
|
|
429
|
-
if ((variant === null || variant === void 0 ? void 0 : variant.quantityFrom) || (variant === null || variant === void 0 ? void 0 : variant.quantityTo)) {
|
|
430
|
-
if (variant === null || variant === void 0 ? void 0 : variant.quantityFrom)
|
|
431
|
-
qString += variant === null || variant === void 0 ? void 0 : variant.quantityFrom;
|
|
432
|
-
if (variant === null || variant === void 0 ? void 0 : variant.quantityTo)
|
|
433
|
-
qString += " - ".concat(variant === null || variant === void 0 ? void 0 : variant.quantityTo);
|
|
434
|
-
}
|
|
435
|
-
else {
|
|
436
|
-
qString = (variant === null || variant === void 0 ? void 0 : variant.quantityFrom)
|
|
437
|
-
? (_a = variant === null || variant === void 0 ? void 0 : variant.quantityFrom) === null || _a === void 0 ? void 0 : _a.toString()
|
|
438
|
-
: (_b = cartItem === null || cartItem === void 0 ? void 0 : cartItem.value) === null || _b === void 0 ? void 0 : _b.toString();
|
|
439
|
-
}
|
|
440
|
-
return qString;
|
|
424
|
+
var makeCateringPortionsString = function (variant, cartItem, unit) {
|
|
425
|
+
var _a, _b;
|
|
426
|
+
if (unit !== 'per person')
|
|
427
|
+
return;
|
|
428
|
+
var qString = '';
|
|
429
|
+
if ((variant === null || variant === void 0 ? void 0 : variant.quantityFrom) || (variant === null || variant === void 0 ? void 0 : variant.quantityTo)) {
|
|
430
|
+
if (variant === null || variant === void 0 ? void 0 : variant.quantityFrom)
|
|
431
|
+
qString += variant === null || variant === void 0 ? void 0 : variant.quantityFrom;
|
|
432
|
+
if (variant === null || variant === void 0 ? void 0 : variant.quantityTo)
|
|
433
|
+
qString += " - ".concat(variant === null || variant === void 0 ? void 0 : variant.quantityTo);
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
qString = (variant === null || variant === void 0 ? void 0 : variant.quantityFrom)
|
|
437
|
+
? (_a = variant === null || variant === void 0 ? void 0 : variant.quantityFrom) === null || _a === void 0 ? void 0 : _a.toString()
|
|
438
|
+
: (_b = cartItem === null || cartItem === void 0 ? void 0 : cartItem.value) === null || _b === void 0 ? void 0 : _b.toString();
|
|
439
|
+
}
|
|
440
|
+
return qString;
|
|
441
441
|
};
|
|
442
442
|
|
|
443
|
-
var focusTrap = function (_a) {
|
|
444
|
-
var _b;
|
|
445
|
-
var exitFunction = _a.exitFunction, ref = _a.ref;
|
|
446
|
-
var elements = 'button:not([disabled]), [href]:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
447
|
-
var focusableElements = (_b = ref.current) === null || _b === void 0 ? void 0 : _b.querySelectorAll(elements);
|
|
448
|
-
if (focusableElements &&
|
|
449
|
-
focusableElements.length > 0 &&
|
|
450
|
-
focusableElements[0] instanceof HTMLElement) {
|
|
451
|
-
focusableElements[0].focus();
|
|
452
|
-
}
|
|
453
|
-
var handleKeyDown = function (e) {
|
|
454
|
-
if (!ref.current)
|
|
455
|
-
return;
|
|
456
|
-
var focusable = Array.from(ref.current.querySelectorAll(elements));
|
|
457
|
-
if (focusable.length === 0)
|
|
458
|
-
return;
|
|
459
|
-
var firstElement = focusable[0];
|
|
460
|
-
var lastElement = focusable[focusable.length - 1];
|
|
461
|
-
if (e.key === 'Tab') {
|
|
462
|
-
if (e.shiftKey && document.activeElement === firstElement) {
|
|
463
|
-
e.preventDefault();
|
|
464
|
-
lastElement.focus();
|
|
465
|
-
}
|
|
466
|
-
else if (!e.shiftKey && document.activeElement === lastElement) {
|
|
467
|
-
e.preventDefault();
|
|
468
|
-
firstElement.focus();
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
else if (e.key === 'Escape')
|
|
472
|
-
exitFunction();
|
|
473
|
-
};
|
|
474
|
-
if (ref.current)
|
|
475
|
-
ref.current.addEventListener('keydown', handleKeyDown);
|
|
476
|
-
return function () {
|
|
477
|
-
if (ref.current)
|
|
478
|
-
ref.current.removeEventListener('keydown', handleKeyDown);
|
|
479
|
-
};
|
|
443
|
+
var focusTrap = function (_a) {
|
|
444
|
+
var _b;
|
|
445
|
+
var exitFunction = _a.exitFunction, ref = _a.ref;
|
|
446
|
+
var elements = 'button:not([disabled]), [href]:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
447
|
+
var focusableElements = (_b = ref.current) === null || _b === void 0 ? void 0 : _b.querySelectorAll(elements);
|
|
448
|
+
if (focusableElements &&
|
|
449
|
+
focusableElements.length > 0 &&
|
|
450
|
+
focusableElements[0] instanceof HTMLElement) {
|
|
451
|
+
focusableElements[0].focus();
|
|
452
|
+
}
|
|
453
|
+
var handleKeyDown = function (e) {
|
|
454
|
+
if (!ref.current)
|
|
455
|
+
return;
|
|
456
|
+
var focusable = Array.from(ref.current.querySelectorAll(elements));
|
|
457
|
+
if (focusable.length === 0)
|
|
458
|
+
return;
|
|
459
|
+
var firstElement = focusable[0];
|
|
460
|
+
var lastElement = focusable[focusable.length - 1];
|
|
461
|
+
if (e.key === 'Tab') {
|
|
462
|
+
if (e.shiftKey && document.activeElement === firstElement) {
|
|
463
|
+
e.preventDefault();
|
|
464
|
+
lastElement.focus();
|
|
465
|
+
}
|
|
466
|
+
else if (!e.shiftKey && document.activeElement === lastElement) {
|
|
467
|
+
e.preventDefault();
|
|
468
|
+
firstElement.focus();
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
else if (e.key === 'Escape')
|
|
472
|
+
exitFunction();
|
|
473
|
+
};
|
|
474
|
+
if (ref.current)
|
|
475
|
+
ref.current.addEventListener('keydown', handleKeyDown);
|
|
476
|
+
return function () {
|
|
477
|
+
if (ref.current)
|
|
478
|
+
ref.current.removeEventListener('keydown', handleKeyDown);
|
|
479
|
+
};
|
|
480
480
|
};
|
|
481
481
|
|
|
482
482
|
var formatLeadingZero = function (day) { return day.replace(/^0+/, ''); };
|
|
483
483
|
|
|
484
|
-
var formatPostalCode = function (postalCode, spaceIndex) {
|
|
485
|
-
var _a;
|
|
486
|
-
if (!(postalCode === null || postalCode === void 0 ? void 0 : postalCode.length))
|
|
487
|
-
return null;
|
|
488
|
-
return (_a = postalCode.split('')) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, curr, index) {
|
|
489
|
-
if (index === (spaceIndex || 3)) {
|
|
490
|
-
return "".concat(acc, " ").concat(curr);
|
|
491
|
-
}
|
|
492
|
-
return "".concat(acc).concat(curr);
|
|
493
|
-
});
|
|
484
|
+
var formatPostalCode = function (postalCode, spaceIndex) {
|
|
485
|
+
var _a;
|
|
486
|
+
if (!(postalCode === null || postalCode === void 0 ? void 0 : postalCode.length))
|
|
487
|
+
return null;
|
|
488
|
+
return (_a = postalCode.split('')) === null || _a === void 0 ? void 0 : _a.reduce(function (acc, curr, index) {
|
|
489
|
+
if (index === (spaceIndex || 3)) {
|
|
490
|
+
return "".concat(acc, " ").concat(curr);
|
|
491
|
+
}
|
|
492
|
+
return "".concat(acc).concat(curr);
|
|
493
|
+
});
|
|
494
494
|
};
|
|
495
495
|
|
|
496
496
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof commonjsGlobal$1 !== 'undefined' ? commonjsGlobal$1 : typeof self !== 'undefined' ? self : {};
|
|
@@ -18765,17 +18765,17 @@ locales.exports;
|
|
|
18765
18765
|
|
|
18766
18766
|
locales.exports;
|
|
18767
18767
|
|
|
18768
|
-
var Locale;
|
|
18769
|
-
(function (Locale) {
|
|
18770
|
-
Locale["swedish"] = "sv";
|
|
18771
|
-
Locale["english"] = "en-gb";
|
|
18772
|
-
Locale["american"] = "en-us";
|
|
18773
|
-
})(Locale || (Locale = {}));
|
|
18768
|
+
var Locale;
|
|
18769
|
+
(function (Locale) {
|
|
18770
|
+
Locale["swedish"] = "sv";
|
|
18771
|
+
Locale["english"] = "en-gb";
|
|
18772
|
+
Locale["american"] = "en-us";
|
|
18773
|
+
})(Locale || (Locale = {}));
|
|
18774
18774
|
moment.locale(Locale.swedish);
|
|
18775
18775
|
|
|
18776
|
-
var formatDateToLocale = function (date, withYear) {
|
|
18777
|
-
var _a, _b;
|
|
18778
|
-
return (_b = (_a = moment(new Date(date))) === null || _a === void 0 ? void 0 : _a.format("dddd D MMMM ".concat(withYear ? 'YYYY' : ''))) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase();
|
|
18776
|
+
var formatDateToLocale = function (date, withYear) {
|
|
18777
|
+
var _a, _b;
|
|
18778
|
+
return (_b = (_a = moment(new Date(date))) === null || _a === void 0 ? void 0 : _a.format("dddd D MMMM ".concat(withYear ? 'YYYY' : ''))) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase();
|
|
18779
18779
|
};
|
|
18780
18780
|
|
|
18781
18781
|
var sv = {exports: {}};
|
|
@@ -18859,21 +18859,21 @@ sv.exports;
|
|
|
18859
18859
|
|
|
18860
18860
|
sv.exports;
|
|
18861
18861
|
|
|
18862
|
-
moment.locale('sv');
|
|
18863
|
-
function getDateInfo(dateStr) {
|
|
18864
|
-
var date = moment(dateStr);
|
|
18865
|
-
return {
|
|
18866
|
-
day: {
|
|
18867
|
-
name: date.format('dddd'),
|
|
18868
|
-
number: date.format('D')
|
|
18869
|
-
},
|
|
18870
|
-
isTomorrow: date.isSame(moment().add(1, 'day'), 'day'),
|
|
18871
|
-
month: {
|
|
18872
|
-
name: date.format('MMMM'),
|
|
18873
|
-
number: date.format('M')
|
|
18874
|
-
},
|
|
18875
|
-
year: date.format('YYYY')
|
|
18876
|
-
};
|
|
18862
|
+
moment.locale('sv');
|
|
18863
|
+
function getDateInfo(dateStr) {
|
|
18864
|
+
var date = moment(dateStr);
|
|
18865
|
+
return {
|
|
18866
|
+
day: {
|
|
18867
|
+
name: date.format('dddd'),
|
|
18868
|
+
number: date.format('D')
|
|
18869
|
+
},
|
|
18870
|
+
isTomorrow: date.isSame(moment().add(1, 'day'), 'day'),
|
|
18871
|
+
month: {
|
|
18872
|
+
name: date.format('MMMM'),
|
|
18873
|
+
number: date.format('M')
|
|
18874
|
+
},
|
|
18875
|
+
year: date.format('YYYY')
|
|
18876
|
+
};
|
|
18877
18877
|
}
|
|
18878
18878
|
|
|
18879
18879
|
build.capitalizeFirstLetter = capitalizeFirstLetter;
|