@sonic-equipment/ui 0.0.63 → 0.0.65
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/index.d.ts +925 -380
- package/dist/index.js +889 -441
- package/dist/src/algolia/algolia-insight-instant-search-provider.d.ts +4 -0
- package/dist/src/algolia/algolia-pagination.d.ts +1 -1
- package/dist/src/algolia/algolia-products-hits-provider.d.ts +6 -0
- package/dist/src/algolia/algolia-provider.d.ts +2 -4
- package/dist/src/algolia/algolia-query-string-routing.d.ts +2 -2
- package/dist/src/algolia/use-algolia-instant-search-state.d.ts +17 -0
- package/dist/src/algolia/use-algolia-product-hits.d.ts +6 -1
- package/dist/src/breadcrumbs/breadcrumb.d.ts +2 -2
- package/dist/src/buttons/button/button.d.ts +4 -2
- package/dist/src/buttons/button/button.stories.d.ts +1 -0
- package/dist/src/buttons/favorite/connected-favorite-button.d.ts +1 -1
- package/dist/src/buttons/link/link.d.ts +14 -0
- package/dist/src/buttons/link/link.stories.d.ts +23 -0
- package/dist/src/cards/product-card/product-card.d.ts +2 -2
- package/dist/src/config.d.ts +1 -2
- package/dist/src/global-search/search-input/search-input.d.ts +3 -1
- package/dist/src/global-search/search-result-panel/search-result-panel.d.ts +0 -8
- package/dist/src/index.d.ts +20 -1
- package/dist/src/intl/translation-id.d.ts +1 -1
- package/dist/src/intl/types.d.ts +2 -0
- package/dist/src/loading/blank-page-spacer.d.ts +4 -0
- package/dist/src/pages/page/page.d.ts +2 -2
- package/dist/src/pages/product-listing-page/no-results/no-results.d.ts +7 -0
- package/dist/src/pages/product-listing-page/product-listing-page-data-types.d.ts +3 -2
- package/dist/src/shared/api/bff/model/bff.model.d.ts +3 -2
- package/dist/src/shared/api/shop/hooks/authentication/use-sign-in.d.ts +1 -7
- package/dist/src/shared/api/shop/hooks/cart/cart.stories.d.ts +2 -4
- package/dist/src/shared/api/shop/hooks/cart/use-add-product-to-current-cart.d.ts +1 -5
- package/dist/src/shared/api/shop/hooks/cart/use-delete-cart-line-by-id.d.ts +3 -1
- package/dist/src/shared/api/shop/hooks/translation/translations.stories.d.ts +9 -0
- package/dist/src/shared/api/shop/hooks/translation/use-fetch-translations.d.ts +1 -0
- package/dist/src/shared/api/shop/services/authentication-service.d.ts +25 -0
- package/dist/src/shared/api/shop/services/cart-service.d.ts +16 -0
- package/dist/src/shared/api/shop/services/translation-service.d.ts +2 -0
- package/dist/src/shared/feature-flags/use-feature-flags.d.ts +6 -0
- package/dist/src/shared/fetch/constants.d.ts +6 -0
- package/dist/src/shared/fetch/request.d.ts +7 -1
- package/dist/src/shared/routing/route-button.d.ts +2 -4
- package/dist/src/shared/routing/route-button.stories.d.ts +16 -0
- package/dist/src/shared/routing/route-link.d.ts +2 -11
- package/dist/src/shared/routing/route-link.stories.d.ts +16 -0
- package/dist/src/shared/utils/environment.d.ts +2 -2
- package/dist/src/typography/heading/heading.d.ts +2 -1
- package/dist/styles.css +193 -145
- package/package.json +1 -1
- package/dist/src/buttons/link-button/link-button.d.ts +0 -15
- package/dist/src/buttons/link-button/link-button.stories.d.ts +0 -19
- package/dist/src/shared/routing/route-provider.stories.d.ts +0 -16
package/dist/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { useQuery, useQueryClient, useMutation, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
2
1
|
import qs from 'query-string';
|
|
3
|
-
import React, { useState, useCallback, useEffect, useRef, createContext, useContext, forwardRef, useLayoutEffect, Children, cloneElement, createElement as createElement$1,
|
|
2
|
+
import React, { useMemo, useState, useCallback, useEffect, useRef, createContext, useContext, forwardRef, useLayoutEffect, Children, cloneElement, createElement as createElement$1, Fragment as Fragment$1 } from 'react';
|
|
3
|
+
import { useQuery, useQueryClient, useMutation, QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
4
4
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
5
|
-
import { Link, Button as Button$1, Breadcrumbs, Breadcrumb as Breadcrumb$1, FieldError as FieldError$1, useContextProps, InputContext, Input as Input$1, Label as Label$1, NumberField as NumberField$1, Checkbox as Checkbox$1, Select as Select$1, SelectValue, Popover, ListBox, Section, Header, ListBoxItem, TextAreaContext, TextArea as TextArea$1, TextField as TextField$1, ModalOverlay, Modal as Modal$1, Dialog as Dialog$1, Form } from 'react-aria-components';
|
|
5
|
+
import { Link as Link$1, Button as Button$1, Breadcrumbs, Breadcrumb as Breadcrumb$1, FieldError as FieldError$1, useContextProps, InputContext, Input as Input$1, Label as Label$1, NumberField as NumberField$1, Checkbox as Checkbox$1, Select as Select$1, SelectValue, Popover, ListBox, Section, Header, ListBoxItem, TextAreaContext, TextArea as TextArea$1, TextField as TextField$1, ModalOverlay, Modal as Modal$1, Dialog as Dialog$1, Form } from 'react-aria-components';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
import { useHierarchicalMenu, useCurrentRefinements, useClearRefinements, useRefinementList, useHits, useDynamicWidgets, usePagination, useInstantSearch
|
|
8
|
-
import { useInstantSearch } from 'react-instantsearch-core';
|
|
7
|
+
import { useHierarchicalMenu, useCurrentRefinements, useClearRefinements, useRefinementList, useHits, useDynamicWidgets, usePagination, useInstantSearch, InstantSearch, Configure, useSortBy } from 'react-instantsearch';
|
|
9
8
|
import aa from 'search-insights';
|
|
10
9
|
import { history } from 'instantsearch.js/es/lib/routers/index.js';
|
|
11
10
|
import { simple } from 'instantsearch.js/es/lib/stateMappings/index.js';
|
|
@@ -17,6 +16,7 @@ import { createQuerySuggestionsPlugin } from '@algolia/autocomplete-plugin-query
|
|
|
17
16
|
import { createLocalStorageRecentSearchesPlugin, search } from '@algolia/autocomplete-plugin-recent-searches';
|
|
18
17
|
import { TransitionGroup, Transition } from 'react-transition-group';
|
|
19
18
|
|
|
19
|
+
const localUrls = /sonic.local.com/i;
|
|
20
20
|
const sandboxUrls = /local|insitesandbox.com|azurestaticapps|ui.sonic-equipment.com|sandbox|accept|test/i;
|
|
21
21
|
const productionUrls = /sonic-equipment.com|production/i;
|
|
22
22
|
let environmentUrl;
|
|
@@ -35,7 +35,10 @@ function getEnvironment() {
|
|
|
35
35
|
console.error('Unable to detect environment url');
|
|
36
36
|
}
|
|
37
37
|
let environment;
|
|
38
|
-
if (environmentUrl.match(
|
|
38
|
+
if (environmentUrl.match(localUrls)) {
|
|
39
|
+
environment = 'local';
|
|
40
|
+
}
|
|
41
|
+
else if (environmentUrl.match(sandboxUrls)) {
|
|
39
42
|
environment = 'sandbox';
|
|
40
43
|
}
|
|
41
44
|
else if (environmentUrl.match(productionUrls)) {
|
|
@@ -51,21 +54,28 @@ function getEnvironment() {
|
|
|
51
54
|
const environment = getEnvironment();
|
|
52
55
|
|
|
53
56
|
const configPerEnvironment = {
|
|
57
|
+
local: {
|
|
58
|
+
ALGOLIA_API_KEY: 'e0edf30798a6b2e4e44fd25f0f2f9646',
|
|
59
|
+
ALGOLIA_APP_ID: 'testing9VXJ0U4GSV',
|
|
60
|
+
ALGOLIA_HOST: 'sonicequipment.commerce.insitesandbox.com',
|
|
61
|
+
BFF_API_URL: 'https://sonicequipment.commerce.insitesandbox.com/api/v1/bff',
|
|
62
|
+
SHOP_API_URL:
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
64
|
+
'https://sonic.local.com:4443',
|
|
65
|
+
},
|
|
54
66
|
production: {
|
|
55
67
|
ALGOLIA_API_KEY: 'e31a3a53449eceb4d0f9273b9bcd9759',
|
|
56
68
|
ALGOLIA_APP_ID: '14CUFCVMAD',
|
|
57
|
-
ALGOLIA_HOST: '
|
|
58
|
-
|
|
59
|
-
PROXY_API_URL: 'https://shop.sonic-equipment.com/api/v1/bff',
|
|
69
|
+
ALGOLIA_HOST: 'shop.sonic-equipment.com',
|
|
70
|
+
BFF_API_URL: 'https://shop.sonic-equipment.com/api/v1/bff',
|
|
60
71
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
61
72
|
SHOP_API_URL: 'https://shop.sonic-equipment.com',
|
|
62
73
|
},
|
|
63
74
|
sandbox: {
|
|
64
75
|
ALGOLIA_API_KEY: 'e0edf30798a6b2e4e44fd25f0f2f9646',
|
|
65
76
|
ALGOLIA_APP_ID: 'testing9VXJ0U4GSV',
|
|
66
|
-
ALGOLIA_HOST: '
|
|
67
|
-
|
|
68
|
-
PROXY_API_URL: 'https://sonicequipment.commerce.insitesandbox.com/api/v1/bff',
|
|
77
|
+
ALGOLIA_HOST: 'sonicequipment.commerce.insitesandbox.com',
|
|
78
|
+
BFF_API_URL: 'https://sonicequipment.commerce.insitesandbox.com/api/v1/bff',
|
|
69
79
|
SHOP_API_URL:
|
|
70
80
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
71
81
|
'https://sonicequipment.commerce.insitesandbox.com',
|
|
@@ -264,92 +274,152 @@ const createHeaders = (...headers) => {
|
|
|
264
274
|
}
|
|
265
275
|
return allHeaders;
|
|
266
276
|
};
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
277
|
+
/* Because of a bug in the rollup dts package the following code must be put inside of a IIFE.
|
|
278
|
+
* The bug occurs when assigning properties to the request function at the top level of this file.
|
|
279
|
+
* request.headers = {}
|
|
280
|
+
* TODO: Remove the DTS dependency
|
|
281
|
+
*/
|
|
282
|
+
const request = (function createRequestFunction() {
|
|
283
|
+
const request = async (options) => {
|
|
284
|
+
let response;
|
|
285
|
+
let body;
|
|
286
|
+
let error;
|
|
287
|
+
let isTimeout = false;
|
|
288
|
+
try {
|
|
289
|
+
options = request._beforeHandlers.reduce((options, handler) => handler(options) || options, options);
|
|
290
|
+
options.timeout = options.timeout || 1000 * 60 * 2;
|
|
291
|
+
const url = qs.stringifyUrl({ query: options.params, url: options.url });
|
|
292
|
+
const controller = new AbortController();
|
|
293
|
+
const id = options.timeout
|
|
294
|
+
? setTimeout(() => {
|
|
295
|
+
isTimeout = true;
|
|
296
|
+
controller.abort();
|
|
297
|
+
}, options.timeout)
|
|
298
|
+
: -1;
|
|
299
|
+
response = await fetch(url, {
|
|
300
|
+
body: createBody(options),
|
|
301
|
+
credentials: 'include', // 'include' sends cookies and HTTP authentication to the server
|
|
302
|
+
headers: createHeaders(request.headers, options.headers),
|
|
303
|
+
method: options.method || 'GET',
|
|
304
|
+
signal: controller.signal,
|
|
305
|
+
});
|
|
306
|
+
clearTimeout(id);
|
|
307
|
+
const contentType = response.headers.get('content-type');
|
|
308
|
+
if (contentType?.includes('json')) {
|
|
309
|
+
body = (await response.json());
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
body = (await response.text());
|
|
313
|
+
}
|
|
314
|
+
if (!response.ok)
|
|
315
|
+
throw response;
|
|
316
|
+
const result = {
|
|
317
|
+
body,
|
|
318
|
+
headers: response.headers,
|
|
319
|
+
status: response.status,
|
|
320
|
+
statusText: response.statusText,
|
|
321
|
+
};
|
|
322
|
+
return result;
|
|
294
323
|
}
|
|
295
|
-
|
|
296
|
-
|
|
324
|
+
catch (err) {
|
|
325
|
+
error = createRequestError(err, { body, options }, { isTimeout });
|
|
326
|
+
throw error;
|
|
297
327
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
request
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
328
|
+
finally {
|
|
329
|
+
request._afterHandlers.forEach(handler => handler({ body, error, options, response }));
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
request.headers = {};
|
|
333
|
+
request._afterHandlers = [];
|
|
334
|
+
request._beforeHandlers = [];
|
|
335
|
+
request.after = (handler) => {
|
|
336
|
+
request._afterHandlers.push(handler);
|
|
337
|
+
};
|
|
338
|
+
request.before = (handler) => {
|
|
339
|
+
request._beforeHandlers.push(handler);
|
|
340
|
+
};
|
|
341
|
+
return request;
|
|
342
|
+
})();
|
|
343
|
+
|
|
344
|
+
function useFeatureFlags() {
|
|
345
|
+
const { search } = typeof window !== 'undefined'
|
|
346
|
+
? window.location
|
|
347
|
+
: {
|
|
348
|
+
search: '',
|
|
349
|
+
};
|
|
350
|
+
const queryParams = qs.parse(search);
|
|
351
|
+
const hasNewQueryParam = Boolean(queryParams['new']);
|
|
352
|
+
const hasFeaturesQueryParam = Boolean(queryParams['features']);
|
|
353
|
+
const showNewPageQueryValue = String(queryParams['new']).toLowerCase() === 'true';
|
|
354
|
+
const features = String(queryParams['features']).toLowerCase().split(',');
|
|
355
|
+
const plpV2QueryStringParam = hasNewQueryParam
|
|
356
|
+
? showNewPageQueryValue
|
|
357
|
+
: features.includes('plp');
|
|
358
|
+
const searchV2QueryStringParam = hasNewQueryParam
|
|
359
|
+
? showNewPageQueryValue
|
|
360
|
+
: features.includes('search');
|
|
361
|
+
const hasLocalStorageSupport = typeof localStorage !== 'undefined';
|
|
362
|
+
if (hasLocalStorageSupport && (hasFeaturesQueryParam || hasNewQueryParam)) {
|
|
363
|
+
localStorage.setItem('plpV2', plpV2QueryStringParam.toString());
|
|
364
|
+
localStorage.setItem('searchV2', searchV2QueryStringParam.toString());
|
|
365
|
+
}
|
|
366
|
+
const plpV2 = useMemo(() => hasLocalStorageSupport
|
|
367
|
+
? localStorage.getItem('plpV2') === 'true'
|
|
368
|
+
: plpV2QueryStringParam,
|
|
369
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
370
|
+
[plpV2QueryStringParam]);
|
|
371
|
+
const searchV2 = useMemo(() => hasLocalStorageSupport
|
|
372
|
+
? localStorage.getItem('searchV2') === 'true'
|
|
373
|
+
: searchV2QueryStringParam,
|
|
374
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
375
|
+
[searchV2QueryStringParam]);
|
|
376
|
+
return { plpV2, searchV2 };
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
var TIME;
|
|
380
|
+
(function (TIME) {
|
|
381
|
+
TIME[TIME["SECOND"] = 1000] = "SECOND";
|
|
382
|
+
TIME[TIME["MINUTE"] = 60000] = "MINUTE";
|
|
383
|
+
TIME[TIME["HOUR"] = 3600000] = "HOUR";
|
|
384
|
+
TIME[TIME["DAY"] = 86400000] = "DAY";
|
|
385
|
+
})(TIME || (TIME = {}));
|
|
319
386
|
|
|
320
387
|
function useFetchProductListingPageData({ languageCode, pageUrl, }) {
|
|
321
388
|
return useQuery({
|
|
322
|
-
gcTime:
|
|
389
|
+
gcTime: 1 * TIME.DAY,
|
|
323
390
|
queryFn: async () => {
|
|
324
391
|
return request({
|
|
325
392
|
headers: { 'Current-Language-Id': languageCode },
|
|
326
|
-
url: `${config.
|
|
393
|
+
url: `${config.BFF_API_URL}/plp/?pageUrl=${pageUrl}`,
|
|
327
394
|
});
|
|
328
395
|
},
|
|
329
396
|
queryKey: ['product-listing-page-data', pageUrl, languageCode],
|
|
330
|
-
select: (
|
|
397
|
+
select: ({ body }) => {
|
|
331
398
|
return {
|
|
332
|
-
breadCrumb:
|
|
399
|
+
breadCrumb: body.breadCrumb.map(breadCrumb => ({
|
|
333
400
|
href: breadCrumb.url,
|
|
334
401
|
label: breadCrumb.text,
|
|
335
402
|
})),
|
|
336
|
-
category:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
403
|
+
category: body.categories
|
|
404
|
+
? {
|
|
405
|
+
href: body.categories.path,
|
|
406
|
+
image: {
|
|
407
|
+
1: body.categories.smallImagePath,
|
|
408
|
+
2: body.categories.smallImagePath,
|
|
409
|
+
3: body.categories.smallImagePath,
|
|
410
|
+
altText: body.categories.imageAltText,
|
|
411
|
+
},
|
|
412
|
+
title: body.categories.shortDescription,
|
|
413
|
+
}
|
|
414
|
+
: undefined,
|
|
415
|
+
categoryPages: body.categoryPages,
|
|
416
|
+
hierarchicalCategories: body.hierarchicalCategories,
|
|
417
|
+
promoCards: body.promoCards
|
|
348
418
|
? {
|
|
349
|
-
top:
|
|
419
|
+
top: body.promoCards.top || undefined,
|
|
350
420
|
}
|
|
351
421
|
: undefined,
|
|
352
|
-
subcategories:
|
|
422
|
+
subcategories: body.categories?.subCategories?.map(subcategory => ({
|
|
353
423
|
href: subcategory.path,
|
|
354
424
|
image: {
|
|
355
425
|
1: subcategory.smallImagePath,
|
|
@@ -361,7 +431,7 @@ function useFetchProductListingPageData({ languageCode, pageUrl, }) {
|
|
|
361
431
|
})),
|
|
362
432
|
};
|
|
363
433
|
},
|
|
364
|
-
staleTime:
|
|
434
|
+
staleTime: 1 * TIME.DAY,
|
|
365
435
|
});
|
|
366
436
|
}
|
|
367
437
|
|
|
@@ -406,22 +476,252 @@ var BadgeStyleValues;
|
|
|
406
476
|
BadgeStyleValues["Round"] = "Round";
|
|
407
477
|
})(BadgeStyleValues || (BadgeStyleValues = {}));
|
|
408
478
|
|
|
479
|
+
async function getSession() {
|
|
480
|
+
const { body } = await request({
|
|
481
|
+
credentials: 'include',
|
|
482
|
+
url: `${config.SHOP_API_URL}/api/v1/sessions/current`,
|
|
483
|
+
});
|
|
484
|
+
return body;
|
|
485
|
+
}
|
|
486
|
+
async function signIn({ password, userName, }) {
|
|
487
|
+
const params = new URLSearchParams();
|
|
488
|
+
params.append('grant_type', 'password');
|
|
489
|
+
params.append('username', userName);
|
|
490
|
+
params.append('password', password);
|
|
491
|
+
params.append('scope', 'iscapi offline_access');
|
|
492
|
+
const { body } = await request({
|
|
493
|
+
body: params.toString(),
|
|
494
|
+
headers: {
|
|
495
|
+
Authorization: `Basic ${btoa('isc:009AC476-B28E-4E33-8BAE-B5F103A142BC')}`,
|
|
496
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
497
|
+
},
|
|
498
|
+
method: 'POST',
|
|
499
|
+
url: `${config.SHOP_API_URL}/identity/connect/token`,
|
|
500
|
+
});
|
|
501
|
+
return body;
|
|
502
|
+
}
|
|
503
|
+
async function createSession({ accessToken, password, userName, }) {
|
|
504
|
+
await request({
|
|
505
|
+
body: {
|
|
506
|
+
isGuest: false,
|
|
507
|
+
password,
|
|
508
|
+
rememberMe: true,
|
|
509
|
+
userName,
|
|
510
|
+
},
|
|
511
|
+
headers: {
|
|
512
|
+
Accept: 'application/json, text/plain, */*',
|
|
513
|
+
Authorization: `Bearer ${accessToken}`,
|
|
514
|
+
'Content-Type': 'application/json',
|
|
515
|
+
},
|
|
516
|
+
method: 'POST',
|
|
517
|
+
url: `${config.SHOP_API_URL}/api/v1/sessions`,
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
async function signOut() {
|
|
521
|
+
await request({
|
|
522
|
+
method: 'DELETE',
|
|
523
|
+
url: `${config.SHOP_API_URL}/api/v1/sessions/current`,
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
async function fetchCurrentCartLines() {
|
|
528
|
+
const { body: { cartLines }, } = await request({
|
|
529
|
+
credentials: 'include',
|
|
530
|
+
url: `${config.SHOP_API_URL}/api/v1/carts/current/cartlines?page=1&pageSize=999`,
|
|
531
|
+
});
|
|
532
|
+
return cartLines;
|
|
533
|
+
}
|
|
534
|
+
async function updateCartLineById({ cartLine, cartLineId, }) {
|
|
535
|
+
await request({
|
|
536
|
+
body: JSON.stringify(cartLine),
|
|
537
|
+
credentials: 'include',
|
|
538
|
+
headers: {
|
|
539
|
+
'Content-Type': 'application/json',
|
|
540
|
+
},
|
|
541
|
+
method: 'PATCH',
|
|
542
|
+
url: `${config.SHOP_API_URL}/api/v1/carts/current/cartlines/${cartLineId}`,
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
async function deleteCartLineById({ cartLineId, }) {
|
|
546
|
+
await request({
|
|
547
|
+
credentials: 'include',
|
|
548
|
+
headers: {
|
|
549
|
+
'Content-Type': 'application/json',
|
|
550
|
+
},
|
|
551
|
+
method: 'DELETE',
|
|
552
|
+
url: `${config.SHOP_API_URL}/api/v1/carts/current/cartlines/${cartLineId}`,
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
async function addProductToCurrentCart(productOrderData) {
|
|
556
|
+
const { body } = await request({
|
|
557
|
+
body: JSON.stringify(productOrderData),
|
|
558
|
+
credentials: 'include',
|
|
559
|
+
headers: {
|
|
560
|
+
'Content-Type': 'application/json',
|
|
561
|
+
},
|
|
562
|
+
method: 'POST',
|
|
563
|
+
url: `${config.SHOP_API_URL}/api/v1/carts/current/cartlines`,
|
|
564
|
+
});
|
|
565
|
+
return body;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
async function fetchTranslations() {
|
|
569
|
+
const translations = {};
|
|
570
|
+
const { body } = await request({
|
|
571
|
+
credentials: 'include',
|
|
572
|
+
url: `${config.SHOP_API_URL}/api/v1/translationdictionaries?page=1&pageSize=9999`,
|
|
573
|
+
});
|
|
574
|
+
body.translationDictionaries?.forEach(dictionary => {
|
|
575
|
+
translations[dictionary.keyword] = dictionary.translation;
|
|
576
|
+
});
|
|
577
|
+
return translations;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
async function createWishList() {
|
|
581
|
+
const { body } = await request({
|
|
582
|
+
body: '{}',
|
|
583
|
+
headers: {
|
|
584
|
+
'Content-Type': 'application/json',
|
|
585
|
+
},
|
|
586
|
+
method: 'POST',
|
|
587
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists`,
|
|
588
|
+
});
|
|
589
|
+
return body;
|
|
590
|
+
}
|
|
591
|
+
async function addWishListItemToWishList({ productId, wishListId, }) {
|
|
592
|
+
await request({
|
|
593
|
+
body: { productId, qtyOrdered: 1, unitOfMeasure: '' },
|
|
594
|
+
headers: {
|
|
595
|
+
'Content-Type': 'application/json',
|
|
596
|
+
},
|
|
597
|
+
method: 'POST',
|
|
598
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists/${wishListId}/wishlistlines`,
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
async function removeWishListItemFromWishList({ wishListId, wishListItemId, }) {
|
|
602
|
+
await request({
|
|
603
|
+
method: 'DELETE',
|
|
604
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists/${wishListId}/wishlistlines/${wishListItemId}`,
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
class WishListNameAlreadyExistsError extends Error {
|
|
608
|
+
constructor() {
|
|
609
|
+
super('List name already exists');
|
|
610
|
+
this.name = 'AddWishListError';
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
async function addWishList({ name, }) {
|
|
614
|
+
try {
|
|
615
|
+
const { body } = await request({
|
|
616
|
+
body: { name },
|
|
617
|
+
headers: {
|
|
618
|
+
'Content-Type': 'application/json',
|
|
619
|
+
},
|
|
620
|
+
method: 'POST',
|
|
621
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists`,
|
|
622
|
+
});
|
|
623
|
+
return body;
|
|
624
|
+
}
|
|
625
|
+
catch (error) {
|
|
626
|
+
if (error instanceof BadRequestError &&
|
|
627
|
+
error.body?.message === 'Name already exists') {
|
|
628
|
+
throw new WishListNameAlreadyExistsError();
|
|
629
|
+
}
|
|
630
|
+
throw error;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
async function deleteWishListItemFromWishList({ wishListId, wishListItemId, }) {
|
|
634
|
+
await request({
|
|
635
|
+
method: 'DELETE',
|
|
636
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists/${wishListId}/wishlistlines/${wishListItemId}`,
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
async function deleteWishList({ wishListId, }) {
|
|
640
|
+
await request({
|
|
641
|
+
method: 'DELETE',
|
|
642
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists/${wishListId}`,
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
async function getWishLists() {
|
|
646
|
+
const { body } = await request({
|
|
647
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists?page=1&pageSize=999`,
|
|
648
|
+
});
|
|
649
|
+
return body;
|
|
650
|
+
}
|
|
651
|
+
async function getWishList({ wishListId, }) {
|
|
652
|
+
const { body } = await request({
|
|
653
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists/${wishListId}`,
|
|
654
|
+
});
|
|
655
|
+
return body;
|
|
656
|
+
}
|
|
657
|
+
async function getWishListItemsByWishListId({ wishListId, }) {
|
|
658
|
+
const { body } = await request({
|
|
659
|
+
url: `${config.SHOP_API_URL}/api/v1/wishlists/${wishListId}/wishlistlines?page=1&pageSize=999`,
|
|
660
|
+
});
|
|
661
|
+
return body;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
function useSession() {
|
|
665
|
+
return useQuery({
|
|
666
|
+
queryFn: async () => {
|
|
667
|
+
return await getSession();
|
|
668
|
+
},
|
|
669
|
+
queryKey: ['session'],
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
function useIsAuthenticated() {
|
|
674
|
+
const { data } = useSession();
|
|
675
|
+
return data?.isAuthenticated;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
function useSignIn() {
|
|
679
|
+
const queryClient = useQueryClient();
|
|
680
|
+
return useMutation({
|
|
681
|
+
mutationFn: async ({ password, userName }) => {
|
|
682
|
+
queryClient.clear();
|
|
683
|
+
const body = await signIn({ password, userName });
|
|
684
|
+
await createSession({
|
|
685
|
+
accessToken: body.access_token,
|
|
686
|
+
password,
|
|
687
|
+
userName,
|
|
688
|
+
});
|
|
689
|
+
return body;
|
|
690
|
+
},
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
function useSignOut() {
|
|
695
|
+
const queryClient = useQueryClient();
|
|
696
|
+
return useMutation({
|
|
697
|
+
mutationFn: async () => {
|
|
698
|
+
try {
|
|
699
|
+
await signOut();
|
|
700
|
+
}
|
|
701
|
+
catch (error) {
|
|
702
|
+
if (error instanceof UnauthorizedRequestError)
|
|
703
|
+
return;
|
|
704
|
+
throw error;
|
|
705
|
+
}
|
|
706
|
+
finally {
|
|
707
|
+
queryClient.clear();
|
|
708
|
+
}
|
|
709
|
+
},
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
|
|
409
713
|
function useAddProductToCurrentCart() {
|
|
410
714
|
const queryClient = useQueryClient();
|
|
411
715
|
const queryKey = ['carts', 'current', 'cartlines'];
|
|
412
716
|
return useMutation({
|
|
413
|
-
mutationFn: async (
|
|
414
|
-
const cartLine = await
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
'Content-Type': 'application/json',
|
|
419
|
-
},
|
|
420
|
-
method: 'POST',
|
|
421
|
-
url: `${config.SHOP_API_URL}/api/v1/carts/current/cartlines`,
|
|
717
|
+
mutationFn: async ({ productId, qtyOrdered, unitOfMeasure, }) => {
|
|
718
|
+
const cartLine = await addProductToCurrentCart({
|
|
719
|
+
productId,
|
|
720
|
+
qtyOrdered,
|
|
721
|
+
unitOfMeasure,
|
|
422
722
|
});
|
|
423
|
-
if (cartLine.productId !==
|
|
424
|
-
throw new Error(`Product ${
|
|
723
|
+
if (cartLine.productId !== productId)
|
|
724
|
+
throw new Error(`Product ${productId} has not been added to the current cart`);
|
|
425
725
|
const cartLines = queryClient.getQueryData(queryKey) ||
|
|
426
726
|
[];
|
|
427
727
|
queryClient.setQueryData(queryKey, cartLines.some(cl => cl.id === cartLine.id)
|
|
@@ -441,15 +741,8 @@ function useDeleteCartLineById() {
|
|
|
441
741
|
const queryClient = useQueryClient();
|
|
442
742
|
const queryKey = ['carts', 'current', 'cartlines'];
|
|
443
743
|
return useMutation({
|
|
444
|
-
mutationFn: async (cartLineId) => {
|
|
445
|
-
await
|
|
446
|
-
credentials: 'include',
|
|
447
|
-
headers: {
|
|
448
|
-
'Content-Type': 'application/json',
|
|
449
|
-
},
|
|
450
|
-
method: 'DELETE',
|
|
451
|
-
url: `${config.SHOP_API_URL}/api/v1/carts/current/cartlines/${cartLineId}`,
|
|
452
|
-
});
|
|
744
|
+
mutationFn: async ({ cartLineId, }) => {
|
|
745
|
+
await deleteCartLineById({ cartLineId });
|
|
453
746
|
const cartLines = queryClient.getQueryData(queryKey);
|
|
454
747
|
queryClient.setQueryData(queryKey, cartLines?.filter(line => line.id !== cartLineId));
|
|
455
748
|
// Invalidate the related current cart query cache
|
|
@@ -464,11 +757,7 @@ function useDeleteCartLineById() {
|
|
|
464
757
|
function useFetchCurrentCartLines() {
|
|
465
758
|
return useQuery({
|
|
466
759
|
queryFn: async () => {
|
|
467
|
-
|
|
468
|
-
credentials: 'include',
|
|
469
|
-
url: `${config.SHOP_API_URL}/api/v1/carts/current/cartlines?page=1&pageSize=999`,
|
|
470
|
-
});
|
|
471
|
-
return cartLines;
|
|
760
|
+
return fetchCurrentCartLines();
|
|
472
761
|
},
|
|
473
762
|
queryKey: ['carts', 'current', 'cartlines'],
|
|
474
763
|
});
|
|
@@ -479,15 +768,7 @@ function useUpdateCartLineById() {
|
|
|
479
768
|
const queryKey = ['carts', 'current', 'cartlines'];
|
|
480
769
|
return useMutation({
|
|
481
770
|
mutationFn: async ({ cartLine: _cartLine, cartLineId }) => {
|
|
482
|
-
await
|
|
483
|
-
body: JSON.stringify(_cartLine),
|
|
484
|
-
credentials: 'include',
|
|
485
|
-
headers: {
|
|
486
|
-
'Content-Type': 'application/json',
|
|
487
|
-
},
|
|
488
|
-
method: 'PATCH',
|
|
489
|
-
url: `${config.SHOP_API_URL}/api/v1/carts/current/cartlines/${cartLineId}`,
|
|
490
|
-
});
|
|
771
|
+
await updateCartLineById({ cartLine: _cartLine, cartLineId });
|
|
491
772
|
// Invalidate the related current cart query cache
|
|
492
773
|
queryClient.invalidateQueries({ queryKey: ['carts', 'current'] });
|
|
493
774
|
},
|
|
@@ -508,6 +789,131 @@ function useUpdateCartLineById() {
|
|
|
508
789
|
});
|
|
509
790
|
}
|
|
510
791
|
|
|
792
|
+
function useFetchTranslations() {
|
|
793
|
+
return useQuery({
|
|
794
|
+
gcTime: 1 * TIME.DAY,
|
|
795
|
+
queryFn: fetchTranslations,
|
|
796
|
+
queryKey: ['translations'],
|
|
797
|
+
staleTime: 1 * TIME.DAY,
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
function useAddWishListItemToCurrentWishList() {
|
|
802
|
+
const queryClient = useQueryClient();
|
|
803
|
+
return useMutation({
|
|
804
|
+
mutationFn: async ({ productId }) => {
|
|
805
|
+
let wishList = queryClient.getQueryData([
|
|
806
|
+
'wishlist',
|
|
807
|
+
'current',
|
|
808
|
+
]);
|
|
809
|
+
if (!wishList) {
|
|
810
|
+
wishList = await createWishList();
|
|
811
|
+
queryClient.removeQueries({ queryKey: ['wishlists'] });
|
|
812
|
+
queryClient.setQueryData(['wishlist', 'current'], wishList);
|
|
813
|
+
}
|
|
814
|
+
await addWishListItemToWishList({
|
|
815
|
+
productId,
|
|
816
|
+
wishListId: wishList.id,
|
|
817
|
+
});
|
|
818
|
+
queryClient.removeQueries({
|
|
819
|
+
queryKey: ['wishlists', '*', 'wishlistlines'],
|
|
820
|
+
});
|
|
821
|
+
},
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
function useAddWishListItemToWishList() {
|
|
826
|
+
const queryClient = useQueryClient();
|
|
827
|
+
return useMutation({
|
|
828
|
+
mutationFn: async ({ productId, wishListId }) => {
|
|
829
|
+
await addWishListItemToWishList({ productId, wishListId });
|
|
830
|
+
queryClient.removeQueries({ queryKey: ['wishlists'] });
|
|
831
|
+
},
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
function useAddWishList() {
|
|
836
|
+
const queryClient = useQueryClient();
|
|
837
|
+
return useMutation({
|
|
838
|
+
mutationFn: async ({ name }) => {
|
|
839
|
+
const wishList = await addWishList({ name });
|
|
840
|
+
queryClient.removeQueries({ queryKey: ['wishlists'] });
|
|
841
|
+
return wishList.id;
|
|
842
|
+
},
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
function useCreateCurrentWishList() {
|
|
847
|
+
const queryClient = useQueryClient();
|
|
848
|
+
return useMutation({
|
|
849
|
+
mutationFn: async () => {
|
|
850
|
+
const currentWishList = queryClient.getQueryData([
|
|
851
|
+
'wishlist',
|
|
852
|
+
'current',
|
|
853
|
+
]);
|
|
854
|
+
if (currentWishList)
|
|
855
|
+
return currentWishList.id;
|
|
856
|
+
const wishList = await createWishList();
|
|
857
|
+
queryClient.removeQueries({ queryKey: ['wishlists'] });
|
|
858
|
+
queryClient.setQueryData(['wishlist', 'current'], wishList);
|
|
859
|
+
return wishList.id;
|
|
860
|
+
},
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
function useDeleteWishListItemFromWishList() {
|
|
865
|
+
const queryClient = useQueryClient();
|
|
866
|
+
return useMutation({
|
|
867
|
+
mutationFn: async ({ wishListId, wishListItemId }) => {
|
|
868
|
+
await deleteWishListItemFromWishList({ wishListId, wishListItemId });
|
|
869
|
+
queryClient.removeQueries({ queryKey: ['wishlists'] });
|
|
870
|
+
},
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
function useFetchAllWishListsItems({ enabled = true } = { enabled: true }) {
|
|
875
|
+
const queryClient = useQueryClient();
|
|
876
|
+
return useQuery({
|
|
877
|
+
enabled,
|
|
878
|
+
queryFn: async () => {
|
|
879
|
+
const body =
|
|
880
|
+
// Reuse existing data if available
|
|
881
|
+
queryClient.getQueryData(['wishlists']) ||
|
|
882
|
+
// Otherwise fetch the data
|
|
883
|
+
(await getWishLists());
|
|
884
|
+
// Update the cache with the new or existing data
|
|
885
|
+
queryClient.setQueryData(['wishlists'], body);
|
|
886
|
+
const wishListLines = await Promise.all((body.wishListCollection || []).map(async (wishList) => {
|
|
887
|
+
return ((await getWishListItemsByWishListId({ wishListId: wishList.id }))
|
|
888
|
+
.wishListLines || []).map(wishListItem => ({
|
|
889
|
+
wishList,
|
|
890
|
+
wishListItem,
|
|
891
|
+
}));
|
|
892
|
+
}));
|
|
893
|
+
return wishListLines.flatMap(wishListDetails => wishListDetails);
|
|
894
|
+
},
|
|
895
|
+
queryKey: ['wishlists', '*', 'wishlistlines'],
|
|
896
|
+
});
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
function useFetchWishLists() {
|
|
900
|
+
return useQuery({
|
|
901
|
+
queryFn: getWishLists,
|
|
902
|
+
queryKey: ['wishlists'],
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
function useRemoveWishListItemFromCurrentWishList() {
|
|
907
|
+
const queryClient = useQueryClient();
|
|
908
|
+
return useMutation({
|
|
909
|
+
mutationFn: async ({ wishListId, wishListItemId }) => {
|
|
910
|
+
await removeWishListItemFromWishList({ wishListId, wishListItemId });
|
|
911
|
+
queryClient.removeQueries({ queryKey: ['wishlists'] });
|
|
912
|
+
queryClient.removeQueries({ queryKey: ['wishlist'] });
|
|
913
|
+
},
|
|
914
|
+
});
|
|
915
|
+
}
|
|
916
|
+
|
|
511
917
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
512
918
|
const breakpoints$1 = {
|
|
513
919
|
sm: 0,
|
|
@@ -663,6 +1069,8 @@ class State extends EventEmitter {
|
|
|
663
1069
|
return this._state;
|
|
664
1070
|
}
|
|
665
1071
|
set value(newState) {
|
|
1072
|
+
if (this._state === newState)
|
|
1073
|
+
return;
|
|
666
1074
|
this._state = newState;
|
|
667
1075
|
this.trigger('stateChanged', this._state);
|
|
668
1076
|
}
|
|
@@ -724,85 +1132,6 @@ function useCartEvents() {
|
|
|
724
1132
|
return state;
|
|
725
1133
|
}
|
|
726
1134
|
|
|
727
|
-
function useSession() {
|
|
728
|
-
return useQuery({
|
|
729
|
-
queryFn: async () => {
|
|
730
|
-
return await request({
|
|
731
|
-
credentials: 'include',
|
|
732
|
-
url: `${config.SHOP_API_URL}/api/v1/sessions/current`,
|
|
733
|
-
});
|
|
734
|
-
},
|
|
735
|
-
queryKey: ['session'],
|
|
736
|
-
});
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
function useIsAuthenticated() {
|
|
740
|
-
const { data } = useSession();
|
|
741
|
-
return data?.isAuthenticated;
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
async function createWishList() {
|
|
745
|
-
return await request({
|
|
746
|
-
body: '{}',
|
|
747
|
-
headers: {
|
|
748
|
-
'Content-Type': 'application/json',
|
|
749
|
-
},
|
|
750
|
-
method: 'POST',
|
|
751
|
-
url: `${config.SHOP_API_URL}/api/v1/wishlists`,
|
|
752
|
-
});
|
|
753
|
-
}
|
|
754
|
-
async function addWishListItemToWishList({ productId, wishListId, }) {
|
|
755
|
-
return await request({
|
|
756
|
-
body: { productId, qtyOrdered: 1, unitOfMeasure: '' },
|
|
757
|
-
headers: {
|
|
758
|
-
'Content-Type': 'application/json',
|
|
759
|
-
},
|
|
760
|
-
method: 'POST',
|
|
761
|
-
url: `${config.SHOP_API_URL}/api/v1/wishlists/${wishListId}/wishlistlines`,
|
|
762
|
-
});
|
|
763
|
-
}
|
|
764
|
-
async function removeWishListItemFromWishList({ wishListId, wishListItemId, }) {
|
|
765
|
-
return await request({
|
|
766
|
-
method: 'DELETE',
|
|
767
|
-
url: `${config.SHOP_API_URL}/api/v1/wishlists/${wishListId}/wishlistlines/${wishListItemId}`,
|
|
768
|
-
});
|
|
769
|
-
}
|
|
770
|
-
async function getWishLists() {
|
|
771
|
-
return await request({
|
|
772
|
-
url: `${config.SHOP_API_URL}/api/v1/wishlists?page=1&pageSize=999`,
|
|
773
|
-
});
|
|
774
|
-
}
|
|
775
|
-
async function getWishListItemsByWishListId({ wishListId, }) {
|
|
776
|
-
return await request({
|
|
777
|
-
url: `${config.SHOP_API_URL}/api/v1/wishlists/${wishListId}/wishlistlines?page=1&pageSize=999`,
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
function useFetchAllWishListsItems({ enabled = true } = { enabled: true }) {
|
|
782
|
-
const queryClient = useQueryClient();
|
|
783
|
-
return useQuery({
|
|
784
|
-
enabled,
|
|
785
|
-
queryFn: async () => {
|
|
786
|
-
const body =
|
|
787
|
-
// Reuse existing data if available
|
|
788
|
-
queryClient.getQueryData(['wishlists']) ||
|
|
789
|
-
// Otherwise fetch the data
|
|
790
|
-
(await getWishLists());
|
|
791
|
-
// Update the cache with the new or existing data
|
|
792
|
-
queryClient.setQueryData(['wishlists'], body);
|
|
793
|
-
const wishListLines = await Promise.all((body.wishListCollection || []).map(async (wishList) => {
|
|
794
|
-
return ((await getWishListItemsByWishListId({ wishListId: wishList.id }))
|
|
795
|
-
.wishListLines || []).map(wishListItem => ({
|
|
796
|
-
wishList,
|
|
797
|
-
wishListItem,
|
|
798
|
-
}));
|
|
799
|
-
}));
|
|
800
|
-
return wishListLines.flatMap(wishListDetails => wishListDetails);
|
|
801
|
-
},
|
|
802
|
-
queryKey: ['wishlists', '*', 'wishlistlines'],
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
|
-
|
|
806
1135
|
function FavoriteProvider(props) {
|
|
807
1136
|
const [, updateState] = useGlobalState('favorite-provider', props);
|
|
808
1137
|
useEffect(() => {
|
|
@@ -838,7 +1167,28 @@ function useNavigate() {
|
|
|
838
1167
|
if (!state) {
|
|
839
1168
|
throw new Error('RouteProvider not found');
|
|
840
1169
|
}
|
|
841
|
-
return
|
|
1170
|
+
return (href, options) => {
|
|
1171
|
+
if (href.toLowerCase().startsWith('http')) {
|
|
1172
|
+
return (window.location.href = href);
|
|
1173
|
+
}
|
|
1174
|
+
return state.navigate(href, options);
|
|
1175
|
+
};
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
var styles$S = {"link":"link-module-xLqBn","primary":"link-module-bGD6u","secondary":"link-module-v31wH","has-underline":"link-module-UuCEp"};
|
|
1179
|
+
|
|
1180
|
+
function Link({ children, className, color = 'primary', hasUnderline, onClick: _onClick, ...props }) {
|
|
1181
|
+
function onClick(e) {
|
|
1182
|
+
_onClick?.(e);
|
|
1183
|
+
if (props.href)
|
|
1184
|
+
return;
|
|
1185
|
+
e.preventDefault();
|
|
1186
|
+
}
|
|
1187
|
+
return (jsx(Link$1, { className: clsx({ [styles$S['has-underline']]: hasUnderline }, styles$S['link'], styles$S[color], className),
|
|
1188
|
+
// Workaround for adobe/react-spectrum #963
|
|
1189
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1190
|
+
// @ts-ignore
|
|
1191
|
+
onClick: onClick, ...props, children: children }));
|
|
842
1192
|
}
|
|
843
1193
|
|
|
844
1194
|
function RouteLink({ children, onClick: _onClick, ...props }) {
|
|
@@ -848,33 +1198,46 @@ function RouteLink({ children, onClick: _onClick, ...props }) {
|
|
|
848
1198
|
if (!props.href)
|
|
849
1199
|
return;
|
|
850
1200
|
e.preventDefault();
|
|
1201
|
+
if (props.isDisabled)
|
|
1202
|
+
return;
|
|
851
1203
|
navigate(props.href, props.route);
|
|
852
1204
|
}
|
|
853
|
-
|
|
1205
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1206
|
+
function onHoverStart(e) {
|
|
854
1207
|
// TODO: Implement prefetch
|
|
1208
|
+
props.onHoverStart?.(e);
|
|
855
1209
|
}
|
|
856
|
-
return (jsx(Link
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
, {
|
|
1210
|
+
return (jsx(Link, { onClick: onClick, onHoverStart: onHoverStart, ...props, children: children }));
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
function GlyphsArrowBoldCapsRightIcon(props) {
|
|
1214
|
+
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", ...props, fill: "currentColor", height: "11", viewBox: "0 0 11 11", width: "11", children: jsx("path", { d: "M2.31124163,11 C2.06716529,11 1.91839241,10.7730596 2.04771379,10.5980857 L6.08820761,5.13116556 C6.42092595,4.68081431 6.37243043,4.10595375 5.96732409,3.70073526 L2.70240329,0.432177991 C2.53178078,0.261409485 2.67540212,0 2.93972934,0 L5.48361239,0 C5.57518542,0 5.6619622,0.0340936243 5.72102726,0.0931942463 L8.14882304,2.52367916 C9.1607451,3.53657521 9.28198389,4.9729381 8.45036569,6.09787751 L4.91836426,10.876542 C4.86160851,10.9533653 4.7620417,11 4.65492523,11 L2.31124163,11 Z", fillRule: "evenodd" }) }));
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
var buttonStyles = {"button":"button-module-V4meK","icon":"button-module-XaNWz","sm":"button-module-Pbwz7","md":"button-module-GVTEW","condensed":"button-module-GKHQc","lg":"button-module-nyNY8","primary":"button-module-tmyk8","outline":"button-module-vq9GI","solid":"button-module-AjvlY","hover":"button-module-YzPAr","focus":"button-module--xzsY","active":"button-module-XMFzj","ghost":"button-module-f4UVe","right-arrow-icon":"button-module-ydQAo","secondary":"button-module--1bCH"};
|
|
1218
|
+
|
|
1219
|
+
function Button({ _pseudo = 'none', children, className, color = 'primary', condensed, href, icon, iconPosition = 'left', isDisabled, onClick: _onClick, onPress, size = 'lg', type = 'button', variant = 'solid', withArrow = false, }) {
|
|
1220
|
+
const showIconOnLeft = icon && iconPosition === 'left';
|
|
1221
|
+
const showIconOnRight = icon && iconPosition === 'right';
|
|
1222
|
+
const onClick = (e) => {
|
|
1223
|
+
if (_onClick)
|
|
1224
|
+
_onClick(e);
|
|
1225
|
+
if (e.isDefaultPrevented())
|
|
1226
|
+
return;
|
|
1227
|
+
if (href)
|
|
1228
|
+
window.location.href = href;
|
|
1229
|
+
e.preventDefault();
|
|
1230
|
+
};
|
|
1231
|
+
return (jsxs(Button$1, { className: clsx({ [buttonStyles.condensed]: condensed }, { [buttonStyles.icon]: icon }, buttonStyles.button, buttonStyles[variant], buttonStyles[size], buttonStyles[color], buttonStyles[_pseudo], className), isDisabled: isDisabled,
|
|
861
1232
|
// Workaround for adobe/react-spectrum #963
|
|
862
1233
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
863
1234
|
// @ts-ignore
|
|
864
|
-
onClick: onClick,
|
|
1235
|
+
onClick: onClick, onPress: onPress, type: type, children: [jsx(Fragment, { children: showIconOnLeft && jsx("span", { className: buttonStyles.icon, children: icon }) }), children, withArrow && (jsx(GlyphsArrowBoldCapsRightIcon, { className: buttonStyles['right-arrow-icon'] })), showIconOnRight && jsx("span", { className: buttonStyles.icon, children: icon })] }));
|
|
865
1236
|
}
|
|
866
1237
|
|
|
867
1238
|
function RouteButton({ children, ...props }) {
|
|
868
1239
|
const navigate = useNavigate();
|
|
869
|
-
return (jsx(Button
|
|
870
|
-
// Workaround for adobe/react-spectrum #963
|
|
871
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
872
|
-
// @ts-ignore
|
|
873
|
-
, {
|
|
874
|
-
// Workaround for adobe/react-spectrum #963
|
|
875
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
876
|
-
// @ts-ignore
|
|
877
|
-
onClick: e => {
|
|
1240
|
+
return (jsx(Button, { onClick: e => {
|
|
878
1241
|
if (!props.href)
|
|
879
1242
|
return;
|
|
880
1243
|
e.preventDefault();
|
|
@@ -916,22 +1279,22 @@ function SolidHomeIcon(props) {
|
|
|
916
1279
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", ...props, fill: "currentColor", height: "24", viewBox: "0 0 24 24", width: "24", children: jsx("path", { d: "M15.039782,22 C14.6690193,22 14.3684378,21.6994185 14.3684378,21.3286559 L14.3684378,15.6029043 L9.34495251,15.6029043 L9.34495251,21.3286559 C9.34495251,21.6994185 9.04437101,22 8.67345678,22 L3.67134415,22 C3.3005815,22 3,21.6994185 3,21.3286559 L3,9.79560307 C3,9.60127857 3.08412644,9.41665514 3.23055192,9.28917706 L11.4158271,2.16495603 C11.6686612,1.94501466 12.0447291,1.94501466 12.2975632,2.16495603 L20.4828384,9.28917706 C20.6292639,9.41665514 20.7133903,9.60127857 20.7133903,9.79560307 L20.7133903,21.3286559 C20.7133903,21.6994185 20.4128088,22 20.0418946,22 L15.039782,22 Z", fillRule: "evenodd" }) }));
|
|
917
1280
|
}
|
|
918
1281
|
|
|
919
|
-
var styles$
|
|
1282
|
+
var styles$R = {"breadcrumbs":"breadcrumb-module-CQGse","breadcrumb":"breadcrumb-module-hxhDY","link":"breadcrumb-module-fp2Q6","icon":"breadcrumb-module-uIn3w","previous-icon":"breadcrumb-module-K-wMJ"};
|
|
920
1283
|
|
|
921
1284
|
function BreadcrumbShort({ links }) {
|
|
922
1285
|
const homeLink = links[0];
|
|
923
1286
|
const previousLink = links[links.length - 2];
|
|
924
|
-
return (jsx(Breadcrumbs, { className: styles$
|
|
1287
|
+
return (jsx(Breadcrumbs, { className: styles$R.breadcrumbs, children: jsx(Breadcrumb$1, { className: styles$R.breadcrumb, children: jsxs(RouteLink, { className: styles$R.link, isDisabled: false, children: [jsx(GlyphsChevronsSlimLeftIcon, { className: styles$R.icon }), previousLink === undefined || previousLink === homeLink ? (jsx(SolidHomeIcon, { className: styles$R.icon })) : (jsx("span", { children: previousLink.label }))] }) }) }));
|
|
925
1288
|
}
|
|
926
1289
|
function BreadcrumbLongItem({ index, isDisabled, link, }) {
|
|
927
|
-
return (jsx(Breadcrumb$1, { className: styles$
|
|
1290
|
+
return (jsx(Breadcrumb$1, { className: styles$R.breadcrumb, children: jsxs(RouteLink, { className: styles$R.link, color: "secondary", href: link.href, isDisabled: isDisabled, children: [jsx(GlyphsChevronsSlimLeftIcon, { className: clsx(styles$R['previous-icon'], styles$R.icon) }), link.label] }) }, index));
|
|
928
1291
|
}
|
|
929
1292
|
function BreadcrumbLong({ links }) {
|
|
930
1293
|
const linksWithoutFirst = links.slice(1);
|
|
931
1294
|
const homeLink = links[0];
|
|
932
1295
|
if (!homeLink)
|
|
933
1296
|
return null;
|
|
934
|
-
return (jsxs(Breadcrumbs, { className: styles$
|
|
1297
|
+
return (jsxs(Breadcrumbs, { className: styles$R.breadcrumbs, children: [jsx(Breadcrumb$1, { className: styles$R.breadcrumb, children: jsx(RouteLink, { className: styles$R.link, href: homeLink.href, children: jsx(SolidHomeIcon, { className: clsx(styles$R['home-icon'], styles$R.icon) }) }) }), linksWithoutFirst.map((link, index) => (jsx(BreadcrumbLongItem, { index: index, isDisabled: linksWithoutFirst.length - 1 === index, link: link }, index)))] }));
|
|
935
1298
|
}
|
|
936
1299
|
function Breadcrumb({ links }) {
|
|
937
1300
|
const { lg } = useBreakpoint();
|
|
@@ -940,24 +1303,10 @@ function Breadcrumb({ links }) {
|
|
|
940
1303
|
return lg ? BreadcrumbLong({ links }) : BreadcrumbShort({ links });
|
|
941
1304
|
}
|
|
942
1305
|
|
|
943
|
-
|
|
944
|
-
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", ...props, fill: "currentColor", height: "11", viewBox: "0 0 11 11", width: "11", children: jsx("path", { d: "M2.31124163,11 C2.06716529,11 1.91839241,10.7730596 2.04771379,10.5980857 L6.08820761,5.13116556 C6.42092595,4.68081431 6.37243043,4.10595375 5.96732409,3.70073526 L2.70240329,0.432177991 C2.53178078,0.261409485 2.67540212,0 2.93972934,0 L5.48361239,0 C5.57518542,0 5.6619622,0.0340936243 5.72102726,0.0931942463 L8.14882304,2.52367916 C9.1607451,3.53657521 9.28198389,4.9729381 8.45036569,6.09787751 L4.91836426,10.876542 C4.86160851,10.9533653 4.7620417,11 4.65492523,11 L2.31124163,11 Z", fillRule: "evenodd" }) }));
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
var buttonStyles = {"button":"button-module-V4meK","icon":"button-module-XaNWz","sm":"button-module-Pbwz7","md":"button-module-GVTEW","condensed":"button-module-GKHQc","lg":"button-module-nyNY8","primary":"button-module-tmyk8","outline":"button-module-vq9GI","solid":"button-module-AjvlY","hover":"button-module-YzPAr","focus":"button-module--xzsY","active":"button-module-XMFzj","ghost":"button-module-f4UVe","right-arrow-icon":"button-module-ydQAo","secondary":"button-module--1bCH"};
|
|
948
|
-
|
|
949
|
-
function Button({ _pseudo = 'none', children, className, color = 'primary', condensed, icon, iconPosition = 'left', isDisabled, onPress, size = 'lg', type = 'button', variant = 'solid', withArrow = false, }) {
|
|
950
|
-
return (jsxs(Button$1, { className: clsx(className, buttonStyles.button, buttonStyles[variant], buttonStyles[size], buttonStyles[color], { [buttonStyles.condensed]: condensed }, { [buttonStyles.icon]: icon }, buttonStyles[_pseudo]), isDisabled: isDisabled,
|
|
951
|
-
// Workaround for adobe/react-spectrum #963
|
|
952
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
953
|
-
// @ts-ignore
|
|
954
|
-
onClick: e => e.preventDefault(), onPress: onPress, type: type, children: [icon && iconPosition === 'left' && (jsx("span", { className: buttonStyles.icon, children: icon })), children, withArrow && (jsx(GlyphsArrowBoldCapsRightIcon, { className: buttonStyles['right-arrow-icon'] })), icon && iconPosition === 'right' && (jsx("span", { className: buttonStyles.icon, children: icon }))] }));
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
var styles$P = {"icon-button":"icon-button-module-4PDK-","md":"icon-button-module-k3s9J","lg":"icon-button-module-agk6Y","primary":"icon-button-module-fTeP4","secondary":"icon-button-module-dM0eo"};
|
|
1306
|
+
var styles$Q = {"icon-button":"icon-button-module-4PDK-","md":"icon-button-module-k3s9J","lg":"icon-button-module-agk6Y","primary":"icon-button-module-fTeP4","secondary":"icon-button-module-dM0eo"};
|
|
958
1307
|
|
|
959
1308
|
function IconButton({ children, className, color = 'primary', isDisabled, onPress, size = 'md', type = 'button', }) {
|
|
960
|
-
return (jsx(Button$1, { className: clsx(styles$
|
|
1309
|
+
return (jsx(Button$1, { className: clsx(styles$Q['icon-button'], styles$Q[size], styles$Q[color], className), isDisabled: isDisabled,
|
|
961
1310
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
962
1311
|
// @ts-expect-error
|
|
963
1312
|
onClick: e => e.preventDefault(), onPress: onPress, type: type, children: children }));
|
|
@@ -971,34 +1320,21 @@ function StrokeFavoriteIcon(props) {
|
|
|
971
1320
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", ...props, fill: "currentColor", height: "24", viewBox: "0 0 24 24", width: "24", children: jsx("path", { d: "M7.33319295,3.33090958 C5.12714802,3.33090958 3.33232058,5.12348359 3.33232058,7.32679321 C3.33232058,8.18447047 3.64878056,9.03643889 4.29989998,9.93107334 L11.9997744,20.2227497 L19.7053643,9.92401241 C20.351069,9.03643889 20.6673786,8.1846207 20.6673786,7.32679321 C20.6673786,5.12348359 18.8727016,3.33090958 16.6666566,3.33090958 C14.8537801,3.33090958 13.1222748,4.56251549 12.6388611,6.19569283 C12.5552338,6.47843037 12.2951771,6.67253074 11.9999248,6.67253074 C11.7046724,6.67253074 11.4447662,6.47843037 11.3609885,6.19569283 C10.8775748,4.56251549 9.14606944,3.33090958 7.33319295,3.33090958 M11.9997744,22 L11.9997744,22 C11.7898038,22 11.5918659,21.9008466 11.4662746,21.7327364 L3.22718487,10.720545 C2.41106707,9.59905954 2,8.45954615 2,7.32679321 C2,4.3895979 4.39240135,2 7.33319295,2 C9.22488362,2 11.0018124,2.98206975 11.9999248,4.46786903 C12.9978868,2.98206975 14.774966,2 16.6666566,2 C19.6072978,2 22,4.3895979 22,7.32679321 C22,8.45969638 21.5887825,9.59920978 20.777929,10.7136343 L12.5334246,21.7327364 C12.4076829,21.9008466 12.2098954,22 11.9997744,22", fillRule: "evenodd" }) }));
|
|
972
1321
|
}
|
|
973
1322
|
|
|
974
|
-
var styles$
|
|
1323
|
+
var styles$P = {"favorite-button":"favorite-button-module-tXSS3","is-favorite":"favorite-button-module-l557q","favorite-on":"favorite-button-module-6Tsmy","favorite-off":"favorite-button-module-LQauU"};
|
|
975
1324
|
|
|
976
1325
|
function FavoriteButton({ isDisabled, isFavorite, onPress, }) {
|
|
977
|
-
return (jsx(IconButton, { className: clsx(styles$
|
|
978
|
-
[styles$
|
|
1326
|
+
return (jsx(IconButton, { className: clsx(styles$P['favorite-button'], {
|
|
1327
|
+
[styles$P['is-favorite']]: isFavorite,
|
|
979
1328
|
}), color: "secondary", isDisabled: isDisabled, onPress: onPress, children: isFavorite ? jsx(SolidFavoriteIcon, {}) : jsx(StrokeFavoriteIcon, {}) }));
|
|
980
1329
|
}
|
|
981
1330
|
|
|
982
|
-
var styles$
|
|
983
|
-
|
|
984
|
-
function LinkButton({ children, className, href, isDisabled, onPress, route, hasUnderline = false, target, color = 'primary', type = href ? 'link' : 'button', }) {
|
|
985
|
-
if (type === 'link') {
|
|
986
|
-
return (jsx(RouteLink, { className: clsx(styles$N['link-button'], styles$N[color], { [styles$N['has-underline']]: hasUnderline }, className), href: href, isDisabled: isDisabled, onPress: onPress, route: route, target: target, children: children }));
|
|
987
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
988
|
-
}
|
|
989
|
-
else if (type === 'button') {
|
|
990
|
-
return (jsx(RouteButton, { className: clsx(styles$N['link-button'], styles$N[color], { [styles$N['has-underline']]: hasUnderline }, styles$N[color], className), href: href, isDisabled: isDisabled, onPress: onPress, route: route, type: "button", children: children }));
|
|
991
|
-
}
|
|
992
|
-
throw new Error('Invalid type ${type} for LinkButton component');
|
|
993
|
-
}
|
|
994
|
-
|
|
995
|
-
var styles$M = {"field-error":"field-error-module-FXnIg"};
|
|
1331
|
+
var styles$O = {"field-error":"field-error-module-FXnIg"};
|
|
996
1332
|
|
|
997
1333
|
function FieldError({ children }) {
|
|
998
|
-
return (jsx(FieldError$1, { className: styles$
|
|
1334
|
+
return (jsx(FieldError$1, { className: styles$O['field-error'], children: children }));
|
|
999
1335
|
}
|
|
1000
1336
|
|
|
1001
|
-
var styles$
|
|
1337
|
+
var styles$N = {"input-container":"input-module-2woJR","shadow-input":"input-module-pNKEt","lg":"input-module-Dx2qC","md":"input-module-sH6e7","focus":"input-module-hEEuy","growing-input":"input-module-6HwY4"};
|
|
1002
1338
|
|
|
1003
1339
|
/**
|
|
1004
1340
|
* This component is used to create an input that grows as the user types.
|
|
@@ -1013,20 +1349,20 @@ const Input = forwardRef(({ _pseudo = 'none', autoGrow, size = 'lg', ...inputPro
|
|
|
1013
1349
|
const handleChange = (event) => isControlled
|
|
1014
1350
|
? onChange?.(event)
|
|
1015
1351
|
: setUncontrolledValue(event.target.value);
|
|
1016
|
-
return (jsx("div", { className: clsx(styles$
|
|
1352
|
+
return (jsx("div", { className: clsx(styles$N['input-container'], styles$N[size], styles$N[_pseudo]), children: jsxs("div", { className: clsx({ [styles$N['growing-input']]: autoGrow }), children: [jsx(Input$1, { size: autoGrow ? 1 : undefined, ...props, ref: ref, onChange: handleChange, onClick: e => {
|
|
1017
1353
|
e.preventDefault();
|
|
1018
1354
|
e.stopPropagation();
|
|
1019
1355
|
e.target.focus();
|
|
1020
|
-
} }), autoGrow && jsx("span", { className: styles$
|
|
1356
|
+
} }), autoGrow && jsx("span", { className: styles$N['shadow-input'], children: value })] }) }));
|
|
1021
1357
|
});
|
|
1022
1358
|
Input.displayName = 'Input';
|
|
1023
1359
|
|
|
1024
|
-
var styles$
|
|
1360
|
+
var styles$M = {"label":"label-module-LGfJt","required":"label-module-oTWaS"};
|
|
1025
1361
|
|
|
1026
1362
|
function Label({ children, isRequired }) {
|
|
1027
1363
|
if (!children)
|
|
1028
1364
|
return null;
|
|
1029
|
-
return (jsxs(Label$1, { className: styles$
|
|
1365
|
+
return (jsxs(Label$1, { className: styles$M.label, children: [children, isRequired && jsx("span", { className: styles$M.required, children: "*" })] }));
|
|
1030
1366
|
}
|
|
1031
1367
|
|
|
1032
1368
|
function StrokeCollapseIcon(props) {
|
|
@@ -1041,7 +1377,7 @@ function StrokeTrashIcon(props) {
|
|
|
1041
1377
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", ...props, fill: "currentColor", height: "24", viewBox: "0 0 24 24", width: "24", children: jsx("path", { d: "M7.77273912,6.04398453 L9.07201126,6.04398453 L9.07201126,4.11757519 C9.07201126,3.84748949 9.15880324,3.63104347 9.33238719,3.46823712 C9.50597114,3.30543077 9.73570292,3.22402759 10.0215825,3.22402759 L13.3263825,3.22402759 C13.6186194,3.22402759 13.850313,3.30543077 14.0214633,3.46823712 C14.1926136,3.63104347 14.2781888,3.84748949 14.2781888,4.11757519 L14.2781888,6.04398453 L15.5846129,6.04398453 L15.5846129,4.04352264 C15.5846129,3.40769382 15.3900697,2.90814951 15.0009834,2.5448897 C14.6118971,2.1816299 14.0799703,2 13.405203,2 L9.942762,2 C9.26869007,2 8.73850162,2.1816299 8.35219662,2.5448897 C7.96589162,2.90814951 7.77273912,3.40769382 7.77273912,4.04352264 L7.77273912,6.04398453 Z M3.60955531,6.6940676 L19.7561406,6.6940676 C19.9248076,6.6940676 20.0683931,6.6332263 20.186897,6.51154371 C20.305401,6.38986111 20.3646529,6.242352 20.3646529,6.06901638 C20.3646529,5.9003494 20.3052023,5.75537328 20.186301,5.63408801 C20.0673997,5.51280275 19.9240129,5.45216011 19.7561406,5.45216011 L3.60955531,5.45216011 C3.44734496,5.45216011 3.30519982,5.51300141 3.18311989,5.63468401 C3.06103996,5.75636661 3,5.90114406 3,6.06901638 C3,6.24314666 3.06103996,6.39085444 3.18311989,6.5121397 C3.30519982,6.63342497 3.44734496,6.6940676 3.60955531,6.6940676 Z M7.56920636,22 L15.8049825,22 C16.4210441,22 16.9252074,21.8108208 17.3174724,21.4324624 C17.7097373,21.0541041 17.9209684,20.5545101 17.9511655,19.9336805 L18.6066126,6.5283806 L17.2870766,6.5283806 L16.6578534,19.8059883 C16.6444435,20.0808419 16.5455825,20.3084381 16.3612707,20.4887766 C16.1769588,20.6691152 15.9469787,20.7592845 15.6713303,20.7592845 L7.68497866,20.7592845 C7.41479362,20.7592845 7.18757,20.6677246 7.00330778,20.4846047 C6.81904556,20.3014848 6.72015983,20.0752793 6.70665057,19.8059883 L6.05358753,6.5295726 L4.76996029,6.5295726 L5.41587138,19.9420245 C5.4468632,20.562854 5.65806942,21.0610573 6.04949005,21.4366344 C6.44091068,21.8122115 6.94748278,22 7.56920636,22 Z M9.00213069,19.1375783 C9.15957307,19.1375783 9.2862223,19.0920591 9.38207839,19.0010206 C9.47793448,18.9099822 9.5230812,18.7917017 9.51751857,18.6461793 L9.2314403,8.86811345 C9.22587767,8.72338566 9.17618647,8.60729053 9.0823667,8.51982806 C8.98854694,8.43236558 8.86649184,8.38863435 8.71620142,8.38863435 C8.55945437,8.38863435 8.43436962,8.43395491 8.34094719,8.52459603 C8.24752475,8.61523714 8.20081354,8.73371626 8.20081354,8.88003338 L8.48555081,18.6485633 C8.49121278,18.7988537 8.54055631,18.9179288 8.63358142,19.0057886 C8.72660652,19.0936484 8.84945628,19.1375783 9.00213069,19.1375783 Z M11.6876904,19.1375783 C11.8451328,19.1375783 11.9717821,19.0922578 12.0676381,19.0016166 C12.1634942,18.9109755 12.2114223,18.7924964 12.2114223,18.6461793 L12.2114223,8.88003338 C12.2114223,8.73451092 12.1634942,8.61623047 12.0676381,8.52519202 C11.9717821,8.43415357 11.8451328,8.38863435 11.6876904,8.38863435 C11.5310427,8.38863435 11.4032015,8.43415357 11.3041668,8.52519202 C11.205132,8.61623047 11.1556147,8.73451092 11.1556147,8.88003338 L11.1556147,18.6461793 C11.1556147,18.7924964 11.205132,18.9109755 11.3041668,19.0016166 C11.4032015,19.0922578 11.5310427,19.1375783 11.6876904,19.1375783 Z M14.3635653,19.1387703 C14.516339,19.1387703 14.6392384,19.0948404 14.7322635,19.0069806 C14.8252886,18.9191208 14.8745825,18.802827 14.8801451,18.6580992 L15.1662234,8.88122537 C15.1662234,8.73490825 15.1194873,8.6166278 15.0260152,8.52638402 C14.9325431,8.43614023 14.8070859,8.39101833 14.6496435,8.39101833 C14.4993531,8.39101833 14.3772732,8.4345509 14.2834037,8.52161604 C14.1895343,8.60868118 14.1398183,8.7277563 14.1342556,8.87884138 L13.8483264,18.6485633 C13.8483264,18.7932911 13.8948389,18.9111742 13.987864,19.0022126 C14.0808891,19.0932511 14.2061229,19.1387703 14.3635653,19.1387703 Z" }) }));
|
|
1042
1378
|
}
|
|
1043
1379
|
|
|
1044
|
-
var styles$
|
|
1380
|
+
var styles$L = {"field":"number-field-module-gmnog","button-input-container":"number-field-module-8Lvgh","zoom-in-text":"number-field-module-OlEoa"};
|
|
1045
1381
|
|
|
1046
1382
|
/**
|
|
1047
1383
|
* This component is used to create a number field.
|
|
@@ -1049,7 +1385,7 @@ var styles$J = {"field":"number-field-module-gmnog","button-input-container":"nu
|
|
|
1049
1385
|
*/
|
|
1050
1386
|
function NumberField({ autoFocus, autoGrow, defaultValue, formatOptions = { style: 'decimal', useGrouping: false }, isDisabled, isInvalid, isReadOnly, isRequired, label, maxLength, maxValue, minValue, name, onChange, onInput, onKeyUp, placeholder, showLabel = false, size = 'lg', value, withButtons, }) {
|
|
1051
1387
|
const inputRef = useRef(null);
|
|
1052
|
-
return (jsxs(NumberField$1, { "aria-label": label, autoFocus: autoFocus, className: clsx(styles$
|
|
1388
|
+
return (jsxs(NumberField$1, { "aria-label": label, autoFocus: autoFocus, className: clsx(styles$L.field, styles$L[size]), defaultValue: defaultValue, formatOptions: formatOptions, isDisabled: isDisabled, isInvalid: isInvalid, isReadOnly: isReadOnly, isRequired: isRequired, maxValue: maxValue, minValue: minValue, name: name, onChange: onChange, onInput: onInput, value: value, children: [showLabel && jsx(Label, { isRequired: isRequired, children: label }), jsxs("div", { className: styles$L['button-input-container'], children: [withButtons && (jsx(Button$1, { isDisabled: isDisabled,
|
|
1053
1389
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1054
1390
|
// @ts-expect-error
|
|
1055
1391
|
onClick: e => e.preventDefault(), onPressStart: e => e.target.focus(), slot: "decrement", children: (value || 0) <= 1 ? jsx(StrokeTrashIcon, {}) : jsx(StrokeCollapseIcon, {}) })), jsx(Input, { ref: inputRef, autoGrow: autoGrow, maxLength: maxLength, onFocus: e => (e.target.selectionStart = e.target.value.length || 0), onKeyUp: e => onKeyUp?.(e), placeholder: placeholder, size: size }), withButtons && (jsx(Button$1, { isDisabled: isDisabled,
|
|
@@ -1062,7 +1398,7 @@ function SolidCartIcon(props) {
|
|
|
1062
1398
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", ...props, fill: "currentColor", height: "24", viewBox: "0 0 24 24", width: "24", children: jsx("path", { d: "M7.89619008,16.6656848 C9.33405626,16.6656848 10.4996925,17.831321 10.4996925,19.2690253 C10.4996925,20.7068915 9.33405626,21.8725278 7.89619008,21.8725278 C6.45832389,21.8725278 5.29268766,20.7068915 5.29268766,19.2690253 C5.29268766,17.831321 6.45832389,16.6656848 7.89619008,16.6656848 Z M16.8207199,16.6656848 C18.2585861,16.6656848 19.4242223,17.831321 19.4242223,19.2690253 C19.4242223,20.7068915 18.2585861,21.8725278 16.8207199,21.8725278 C15.3828537,21.8725278 14.2172175,20.7068915 14.2172175,19.2690253 C14.2172175,17.831321 15.3828537,16.6656848 16.8207199,16.6656848 Z M7.89619008,18.0995047 C7.25122196,18.0995047 6.72650762,18.6242191 6.72650762,19.2690253 C6.72650762,19.9139935 7.25122196,20.4387078 7.89619008,20.4387078 C8.54115819,20.4387078 9.06587253,19.9139935 9.06587253,19.2690253 C9.06587253,18.6242191 8.54115819,18.0995047 7.89619008,18.0995047 Z M16.8207199,18.0995047 C16.1757518,18.0995047 15.6510375,18.6242191 15.6510375,19.2690253 C15.6510375,19.9139935 16.1757518,20.4387078 16.8207199,20.4387078 C17.465688,20.4387078 17.9904024,19.9139935 17.9904024,19.2690253 C17.9904024,18.6242191 17.465688,18.0995047 16.8207199,18.0995047 Z M4.58909785,3 C4.6054446,3 4.6206584,3.00372253 4.63668145,3.00485547 C4.65869291,3.00631211 4.68038067,3.0079306 4.70174473,3.01132943 C4.72958275,3.0158612 4.75628783,3.02233516 4.78299291,3.02994206 C4.8001489,3.03479753 4.81698119,3.03949115 4.83365164,3.04564141 C4.8622989,3.05616159 4.88948953,3.06862396 4.91619461,3.08254297 L4.956495,3.10439258 C4.98287638,3.12025378 5.00763927,3.13789532 5.03175477,3.15699349 L5.06736154,3.18645 C5.08921115,3.20603373 5.10911857,3.22707409 5.1283786,3.2492474 C5.13986987,3.26251902 5.1511993,3.27562878 5.16171948,3.28970964 C5.17806623,3.31155925 5.19230894,3.33421811 5.2060661,3.35768621 C5.21626258,3.37500405 5.22597352,3.39216004 5.23455152,3.41028712 C5.24555725,3.43326967 5.25462079,3.45706147 5.26319878,3.48150066 C5.27032014,3.50205548 5.27711779,3.52244845 5.28245881,3.54381251 C5.28860907,3.56825171 5.29249345,3.59317645 5.29605412,3.61858673 C5.29799631,3.63299129 5.30252808,3.64642476 5.30382287,3.66115301 L5.510504,6.30738355 L21.2869744,6.30772748 C21.3139222,6.30835464 21.3370666,6.31256272 21.3603729,6.3151523 C21.3861069,6.31790373 21.4120027,6.31936037 21.4369275,6.32486324 C21.4591008,6.32923316 21.4726961,6.33603082 21.4875862,6.34056259 C21.5163953,6.34914058 21.5452044,6.35723303 21.5722332,6.36920985 C21.5918169,6.37778785 21.6092966,6.38911728 21.6275855,6.39931376 C21.6497588,6.41145243 21.6722559,6.42278186 21.6928107,6.43718642 C21.711747,6.45029618 21.7280937,6.46583368 21.7455734,6.48072379 C21.763215,6.49577574 21.7815039,6.51001845 21.7976888,6.52668889 C21.8132263,6.54287379 21.8261742,6.56067718 21.8400932,6.57815686 C21.8551452,6.59676949 21.8706827,6.61473473 21.8836306,6.634804 C21.8954456,6.65293108 21.9043473,6.67251481 21.9145437,6.69161299 C21.9258732,6.71330075 21.9381737,6.73434111 21.9473991,6.75716182 C21.9559771,6.77868773 21.9614799,6.80134658 21.9679539,6.82368174 C21.9744279,6.8456932 21.9820348,6.86705726 21.9864047,6.89003981 C21.9915839,6.91658304 21.9925549,6.94393552 21.994659,6.97128799 C21.9959538,6.98909138 22,7.00608552 22,7.0242126 C21.9988671,7.05496391 21.994659,7.07794646 21.9922312,7.10109086 C21.9894798,7.1269867 21.9880232,7.15320623 21.9825203,7.17813097 L20.5915903,13.2322533 L20.587706,13.2487619 C20.5797754,13.2835594 20.5681222,13.3164147 20.555498,13.3486227 C20.5524229,13.3567151 20.5499951,13.3651313 20.5465963,13.3730619 C20.5299259,13.4117438 20.5096948,13.4483216 20.4870359,13.4827955 C20.4797527,13.4938012 20.4710129,13.5031884 20.4632441,13.5137086 C20.445117,13.5381478 20.4265044,13.5619396 20.4056259,13.5836274 C20.3944583,13.5952805 20.3823196,13.605477 20.3705046,13.6163208 C20.3505972,13.6344479 20.3302043,13.6517658 20.3083546,13.6674651 C20.2941119,13.6778235 20.2795455,13.6872107 20.2646554,13.6964361 C20.2424821,13.7101932 20.2198233,13.7223319 20.1963552,13.7334995 L20.148286,13.7550254 C20.1214191,13.7655456 20.0935811,13.7734762 20.0654194,13.7807594 C20.0513385,13.7843201 20.037905,13.7888518 20.0235005,13.7916033 C19.9798012,13.8000194 19.9351309,13.8053604 19.8898132,13.8053604 L6.09623539,13.8051986 L6.20774933,15.2317353 L19.411064,15.2317353 C19.8069466,15.2317353 20.1278931,15.5528437 20.1278931,15.9487262 C20.1278931,16.3446088 19.8069466,16.6657172 19.411064,16.6657172 L5.54384488,16.6657172 C5.49593759,16.6657172 5.44932509,16.660538 5.40384553,16.6514744 C5.38863173,16.6483993 5.37471272,16.6425728 5.35998446,16.6386884 C5.33052795,16.6307578 5.30090959,16.6231509 5.27290972,16.6116596 C5.25543003,16.6043764 5.23940699,16.5945036 5.22257469,16.5859256 C5.19910659,16.5741106 5.17547665,16.5627812 5.15362704,16.5485385 C5.13711844,16.5376946 5.12255203,16.5249086 5.10701453,16.5127699 C5.08694526,16.4972324 5.06687599,16.4821804 5.04874891,16.4647007 C5.03434435,16.4509436 5.02204383,16.4357298 5.00893406,16.4208397 C4.99226362,16.4019033 4.97575503,16.3834526 4.96118862,16.3628977 C4.94937364,16.3463891 4.93966271,16.3285858 4.92930437,16.3111061 C4.91668015,16.2899039 4.90437963,16.2688635 4.8940213,16.2462046 C4.88511961,16.2267828 4.87832195,16.2065516 4.87103875,16.1861587 C4.86310815,16.163338 4.8553394,16.1406791 4.84967468,16.1168873 C4.84433367,16.0950377 4.84109669,16.0728644 4.83785971,16.0502055 L4.82992911,16.0045641 L3.92600265,4.43381996 L2.7169909,4.43381996 C2.32110834,4.43381996 2,4.11287347 2,3.7169909 C2,3.32094649 2.32110834,3 2.7169909,3 Z", fillRule: "evenodd" }) }));
|
|
1063
1399
|
}
|
|
1064
1400
|
|
|
1065
|
-
var styles$
|
|
1401
|
+
var styles$K = {"manual-input-container":"add-to-cart-button-module-AWFvQ","left-button-spacer":"add-to-cart-button-module-SS7WM"};
|
|
1066
1402
|
|
|
1067
1403
|
function AddToCartButton({ initialState = 'initial', isDisabled = false, onChange, quantity, }) {
|
|
1068
1404
|
const [currentState, setState] = useState(initialState);
|
|
@@ -1150,7 +1486,7 @@ function ManualInputState({ isDisabled, onCancel, onConfirm, quantity, }) {
|
|
|
1150
1486
|
e.key === 'Enter' && onConfirm(ensureNumber(updatedQuantity));
|
|
1151
1487
|
e.key === 'Escape' && onCancel();
|
|
1152
1488
|
};
|
|
1153
|
-
return (jsxs("div", { className: styles$
|
|
1489
|
+
return (jsxs("div", { className: styles$K['manual-input-container'], children: [jsx("div", { className: styles$K['left-button-spacer'] }), jsx(NumberField, { autoFocus: true, autoGrow: true, defaultValue: quantity ? ensureNumber(quantity) : undefined, formatOptions: {
|
|
1154
1490
|
maximumFractionDigits: 0,
|
|
1155
1491
|
style: 'decimal',
|
|
1156
1492
|
useGrouping: false,
|
|
@@ -1168,7 +1504,7 @@ const ConnectedAddToCartButton = ({ onAddToCart, productId }) => {
|
|
|
1168
1504
|
const handleChange = (quantity) => {
|
|
1169
1505
|
if (cartLine) {
|
|
1170
1506
|
if (quantity === 0) {
|
|
1171
|
-
deleteCartLine(cartLine.id, {
|
|
1507
|
+
deleteCartLine({ cartLineId: cartLine.id }, {
|
|
1172
1508
|
onError: error => onCartLineError?.(error, cartLine),
|
|
1173
1509
|
onSuccess: () => {
|
|
1174
1510
|
onCartLineRemoved?.(cartLine);
|
|
@@ -1200,12 +1536,12 @@ const ConnectedAddToCartButton = ({ onAddToCart, productId }) => {
|
|
|
1200
1536
|
return (jsx(AddToCartButton, { isDisabled: isPendingDeleteCartLine || isLoadingCartLines || isPendingAddToCart, onChange: handleChange, quantity: quantity }));
|
|
1201
1537
|
};
|
|
1202
1538
|
|
|
1203
|
-
var styles$
|
|
1539
|
+
var styles$J = {"tag":"tag-module-B7r15","body":"tag-module-4cfCf","shape":"tag-module-c7CRb"};
|
|
1204
1540
|
|
|
1205
1541
|
function Tag({ children }) {
|
|
1206
1542
|
if (!children)
|
|
1207
1543
|
return null;
|
|
1208
|
-
return (jsxs("div", { className: styles$
|
|
1544
|
+
return (jsxs("div", { className: styles$J.tag, children: [jsx("div", { className: styles$J.body, children: children }), jsx("svg", { className: styles$J.shape, height: "16", viewBox: "0 0 9 16", width: "9", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M1.92461763,0 L0,0 L0,16 L1.92461763,16 L6.4117887,16 L8.87489381,7.57121588 C9.23711515,6.3325062 8.79482383,4.99454094 7.78060408,4.2560794 L1.92461763,0 Z", fill: "currentColor" }) })] }));
|
|
1209
1545
|
}
|
|
1210
1546
|
|
|
1211
1547
|
const IntlContext = createContext({
|
|
@@ -1241,7 +1577,7 @@ function useFormattedMessage() {
|
|
|
1241
1577
|
|
|
1242
1578
|
const FormattedMessage = ({ fallbackValue, id, optional, replacementValues, }) => useFormattedMessage()(id, { fallbackValue, optional, replacementValues });
|
|
1243
1579
|
|
|
1244
|
-
var styles$
|
|
1580
|
+
var styles$I = {"product-price":"product-price-module-oIU1K","original-price":"product-price-module-til0s","is-hidden":"product-price-module-V1NCf","current-price-wrapper":"product-price-module-FfVhl","current-price":"product-price-module-pvy2w","wholes":"product-price-module-GCw07","dot":"product-price-module-N56iV","decimals":"product-price-module-eWOOF","vat":"product-price-module-96DoG"};
|
|
1245
1581
|
|
|
1246
1582
|
const formatPrice = (price) => new Intl.NumberFormat('en-US', {
|
|
1247
1583
|
maximumFractionDigits: 2,
|
|
@@ -1254,22 +1590,22 @@ function ProductPrice({ className, isVatIncluded, originalPrice, price, }) {
|
|
|
1254
1590
|
const priceWithCurrency = formatPrice(price);
|
|
1255
1591
|
const [wholes, decimals] = priceWithCurrency.split('.');
|
|
1256
1592
|
const showOriginalPrice = priceWithCurrency !== originalPriceWithCurrency;
|
|
1257
|
-
return (jsxs("div", { className: clsx(className, styles$
|
|
1258
|
-
[styles$
|
|
1259
|
-
}), children: originalPriceWithCurrency }), jsxs("div", { className: styles$
|
|
1593
|
+
return (jsxs("div", { className: clsx(className, styles$I['product-price']), children: [jsx("span", { className: clsx(styles$I['original-price'], {
|
|
1594
|
+
[styles$I['is-hidden']]: !showOriginalPrice,
|
|
1595
|
+
}), children: originalPriceWithCurrency }), jsxs("div", { className: styles$I['current-price-wrapper'], children: [jsxs("div", { className: styles$I['current-price'], children: [jsx("span", { className: styles$I.wholes, children: wholes }), jsx("span", { className: styles$I.dot, children: "." }), jsx("span", { className: styles$I.decimals, children: decimals })] }), jsx("span", { className: styles$I.vat, children: isVatIncluded ? (jsx(FormattedMessage, { id: "Incl. VAT" })) : (jsx(FormattedMessage, { id: "Excl. VAT" })) })] })] }));
|
|
1260
1596
|
}
|
|
1261
1597
|
|
|
1262
|
-
var styles$
|
|
1598
|
+
var styles$H = {"product-sku":"product-sku-module-ITb8x"};
|
|
1263
1599
|
|
|
1264
1600
|
function ProductSku({ sku }) {
|
|
1265
|
-
return (jsx("p", { className: styles$
|
|
1601
|
+
return (jsx("p", { className: styles$H['product-sku'], "data-test-selector": "productNumber", children: sku }));
|
|
1266
1602
|
}
|
|
1267
1603
|
|
|
1268
1604
|
function isResponsiveImage(image) {
|
|
1269
1605
|
return Boolean(image.lg);
|
|
1270
1606
|
}
|
|
1271
1607
|
|
|
1272
|
-
var styles$
|
|
1608
|
+
var styles$G = {"image":"image-module-lg7Kj","contain":"image-module-KFEgG","cover":"image-module-tVKFe","has-error":"image-module-LM93B","picture":"image-module-pNYjR"};
|
|
1273
1609
|
|
|
1274
1610
|
function Image({ className, fallbackSrc = 'https://res.cloudinary.com/dkz9eknwh/image/upload/v1716545808/images/product-card/fallback_p6ngjz.svg', fit = 'cover', height, image, loading = 'eager', title, width, }) {
|
|
1275
1611
|
const [hasError, setHasError] = useState(false);
|
|
@@ -1296,22 +1632,22 @@ function ImageComponent({ className, fallbackSrc, fit = 'cover', hasError, image
|
|
|
1296
1632
|
const srcSet = !hasError
|
|
1297
1633
|
? `${image[1]} 1x, ${image[2]} 2x, ${image[3]} 3x`
|
|
1298
1634
|
: undefined;
|
|
1299
|
-
return (jsx("img", { alt: image.altText, className: clsx(styles$
|
|
1300
|
-
[styles$
|
|
1635
|
+
return (jsx("img", { alt: image.altText, className: clsx(styles$G.image, className, styles$G[fit], {
|
|
1636
|
+
[styles$G['has-error']]: hasError,
|
|
1301
1637
|
}), src: !hasError ? image[3] : fallbackSrc, srcSet: srcSet, ...rest }));
|
|
1302
1638
|
}
|
|
1303
1639
|
function PictureComponent({ className, fallbackSrc, fit = 'cover', hasError, image, ...rest }) {
|
|
1304
1640
|
if (!isResponsiveImage(image))
|
|
1305
1641
|
return null;
|
|
1306
|
-
return (jsxs("picture", { className: clsx(styles$
|
|
1307
|
-
[styles$
|
|
1642
|
+
return (jsxs("picture", { className: clsx(styles$G.picture, className), children: [jsx("source", { media: "(max-width: 768px)", srcSet: `${image.sm[1]} 1x, ${image.sm[2]} 2x, ${image.sm[3]} 3x` }), jsx("source", { media: "(max-width: 1439px)", srcSet: `${image.md[1]} 1x, ${image.md[2]} 2x, ${image.md[3]} 3x` }), jsx("source", { media: "(min-width: 1440px)", srcSet: `${image.lg[1]} 1x, ${image.lg[2]} 2x, ${image.lg[3]} 3x` }), jsx("img", { className: clsx(styles$G[fit], {
|
|
1643
|
+
[styles$G['has-error']]: hasError,
|
|
1308
1644
|
}), src: !hasError ? image.lg[3] : fallbackSrc, ...rest })] }));
|
|
1309
1645
|
}
|
|
1310
1646
|
|
|
1311
|
-
var styles$
|
|
1647
|
+
var styles$F = {"product-card":"product-card-module-pLaiB","favorite-button":"product-card-module-tvEdz","content":"product-card-module-e0kMu","top":"product-card-module-Q0VvF","tag":"product-card-module-HkWBE","title":"product-card-module-CStNi","bottom":"product-card-module-kD2tU","image":"product-card-module-p-zoi","price":"product-card-module-irW0D","add-to-cart-button":"product-card-module-SnCvX"};
|
|
1312
1648
|
|
|
1313
1649
|
function ProductCard({ addToCartButton: AddToCartButton, areaSelected, favoriteButton: FavoriteButton, href, id, image, onClick, onMouseDown, onMouseMove, onPress, price, role, sku, tags, title, }) {
|
|
1314
|
-
return (jsxs(RouteLink, { "aria-selected": areaSelected, className: styles$
|
|
1650
|
+
return (jsxs(RouteLink, { "aria-selected": areaSelected, className: styles$F['product-card'], "data-product-id": sku, href: href, id: id, onClick: onClick, onMouseDown: onMouseDown, onMouseMove: onMouseMove, onPress: onPress, role: role, children: [jsx("div", { className: styles$F.image, children: jsx(Image, { ...image }) }), jsx("div", { className: styles$F['favorite-button'], children: FavoriteButton && FavoriteButton }), jsxs("div", { className: styles$F.content, children: [jsxs("div", { className: styles$F.top, children: [jsx("div", { className: styles$F.tag, children: tags?.map(tag => (jsx(Tag, { children: jsx(FormattedMessage, { optional: true, fallbackValue: tag, id: `tag.${tag.toLowerCase()}` }) }, tag))) }), jsx("h2", { className: styles$F.title, children: title }), jsx(ProductSku, { sku: sku })] }), jsxs("div", { className: styles$F.bottom, children: [jsx("div", { className: styles$F.price, children: jsx(ProductPrice, { isVatIncluded: price.isVatIncluded, originalPrice: price.originalPrice, price: price.price }) }), jsx("div", { className: styles$F['add-to-cart-button'], children: AddToCartButton })] })] })] }));
|
|
1315
1651
|
}
|
|
1316
1652
|
|
|
1317
1653
|
/**
|
|
@@ -2564,7 +2900,7 @@ function updateSlides() {
|
|
|
2564
2900
|
allSlidesSize += slideSizeValue + (spaceBetween || 0);
|
|
2565
2901
|
});
|
|
2566
2902
|
allSlidesSize -= spaceBetween;
|
|
2567
|
-
const maxSnap = allSlidesSize - swiperSize;
|
|
2903
|
+
const maxSnap = allSlidesSize > swiperSize ? allSlidesSize - swiperSize : 0;
|
|
2568
2904
|
snapGrid = snapGrid.map(snap => {
|
|
2569
2905
|
if (snap <= 0) return -offsetBefore;
|
|
2570
2906
|
if (snap > maxSnap) return maxSnap + offsetAfter;
|
|
@@ -3411,8 +3747,11 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
|
|
|
3411
3747
|
let direction;
|
|
3412
3748
|
if (slideIndex > activeIndex) direction = 'next';else if (slideIndex < activeIndex) direction = 'prev';else direction = 'reset';
|
|
3413
3749
|
|
|
3750
|
+
// initial virtual
|
|
3751
|
+
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
|
|
3752
|
+
const isInitialVirtual = isVirtual && initial;
|
|
3414
3753
|
// Update Index
|
|
3415
|
-
if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) {
|
|
3754
|
+
if (!isInitialVirtual && (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate)) {
|
|
3416
3755
|
swiper.updateActiveIndex(slideIndex);
|
|
3417
3756
|
// Update Height
|
|
3418
3757
|
if (params.autoHeight) {
|
|
@@ -3432,7 +3771,6 @@ function slideTo(index, speed, runCallbacks, internal, initial) {
|
|
|
3432
3771
|
const isH = swiper.isHorizontal();
|
|
3433
3772
|
const t = rtl ? translate : -translate;
|
|
3434
3773
|
if (speed === 0) {
|
|
3435
|
-
const isVirtual = swiper.virtual && swiper.params.virtual.enabled;
|
|
3436
3774
|
if (isVirtual) {
|
|
3437
3775
|
swiper.wrapperEl.style.scrollSnapType = 'none';
|
|
3438
3776
|
swiper._immediateVirtual = true;
|
|
@@ -6232,7 +6570,7 @@ const updateOnVirtualData = swiper => {
|
|
|
6232
6570
|
};
|
|
6233
6571
|
|
|
6234
6572
|
/**
|
|
6235
|
-
* Swiper React 11.1.
|
|
6573
|
+
* Swiper React 11.1.12
|
|
6236
6574
|
* Most modern mobile touch slider and framework with hardware accelerated transitions
|
|
6237
6575
|
* https://swiperjs.com
|
|
6238
6576
|
*
|
|
@@ -6240,7 +6578,7 @@ const updateOnVirtualData = swiper => {
|
|
|
6240
6578
|
*
|
|
6241
6579
|
* Released under the MIT License
|
|
6242
6580
|
*
|
|
6243
|
-
* Released on:
|
|
6581
|
+
* Released on: September 1, 2024
|
|
6244
6582
|
*/
|
|
6245
6583
|
|
|
6246
6584
|
|
|
@@ -6621,7 +6959,7 @@ function GlyphsArrowBoldCapsLeftIcon(props) {
|
|
|
6621
6959
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", ...props, fill: "currentColor", height: "11", viewBox: "0 0 11 11", width: "11", children: jsx("path", { d: "M2.31124163,11 C2.06716529,11 1.91839241,10.7730596 2.04771379,10.5980857 L6.08820761,5.13116556 C6.42092595,4.68081431 6.37243043,4.10595375 5.96732409,3.70073526 L2.70240329,0.432177991 C2.53178078,0.261409485 2.67540212,0 2.93972934,0 L5.48361239,0 C5.57518542,0 5.6619622,0.0340936243 5.72102726,0.0931942463 L8.14882304,2.52367916 C9.1607451,3.53657521 9.28198389,4.9729381 8.45036569,6.09787751 L4.91836426,10.876542 C4.86160851,10.9533653 4.7620417,11 4.65492523,11 L2.31124163,11 Z", fillRule: "evenodd", transform: "matrix(-1 0 0 1 11 0)" }) }));
|
|
6622
6960
|
}
|
|
6623
6961
|
|
|
6624
|
-
var styles$
|
|
6962
|
+
var styles$E = {"carousel":"carousel-module-ealh-","swiper":"carousel-module-IftbN","has-overflow":"carousel-module-tPg7k","slide":"carousel-module-bUMlb","navigation-button":"carousel-module-kcqEE","is-locked":"carousel-module-uCrOA","navigation-button-next":"carousel-module-T7bTr","is-dragging":"carousel-module-34OWD","navigation-button-prev":"carousel-module-984Rr","navigation-buttons":"carousel-module-k7Z4S","navigation-button-wrapper":"carousel-module-Hi-0z","top":"carousel-module-nL-O8","center":"carousel-module-5SGYn"};
|
|
6625
6963
|
|
|
6626
6964
|
function CarouselNavigationButton({ direction, isDisabled = false, }) {
|
|
6627
6965
|
const swiper = useSwiper();
|
|
@@ -6633,8 +6971,8 @@ function CarouselNavigationButton({ direction, isDisabled = false, }) {
|
|
|
6633
6971
|
swiper.slidePrev();
|
|
6634
6972
|
}
|
|
6635
6973
|
}
|
|
6636
|
-
return (jsx(Button$1, { className: clsx(styles$
|
|
6637
|
-
[styles$
|
|
6974
|
+
return (jsx(Button$1, { className: clsx(styles$E['navigation-button'], {
|
|
6975
|
+
[styles$E['is-locked']]: swiper.isLocked,
|
|
6638
6976
|
}), isDisabled: isDisabled, onPress: handleNavigation, children: direction === 'previous' ? (jsx(GlyphsArrowBoldCapsLeftIcon, {})) : (jsx(GlyphsArrowBoldCapsRightIcon, {})) }));
|
|
6639
6977
|
}
|
|
6640
6978
|
|
|
@@ -6649,13 +6987,13 @@ function Carousel({ breakpoints, className, hasNavigation = true, hasOverflow =
|
|
|
6649
6987
|
setIsBeginning(swiper.activeIndex === 0);
|
|
6650
6988
|
}
|
|
6651
6989
|
const showNavigation = hasNavigation && !isLocked;
|
|
6652
|
-
return (jsx("div", { className: clsx(styles$
|
|
6653
|
-
[styles$
|
|
6654
|
-
[styles$
|
|
6990
|
+
return (jsx("div", { className: clsx(styles$E.carousel, className), children: jsxs(Swiper, { breakpoints: breakpoints, className: clsx(styles$E.swiper, {
|
|
6991
|
+
[styles$E['is-dragging']]: isDragging,
|
|
6992
|
+
[styles$E['has-overflow']]: hasOverflow,
|
|
6655
6993
|
}), freeMode: {
|
|
6656
6994
|
enabled: true,
|
|
6657
6995
|
sticky: true,
|
|
6658
|
-
}, modules: [freeMode], onSlideChange: swiper => handleSlideChange(swiper), onSwiper: swiper => setIsLocked(swiper.isLocked), onTouchEnd: () => setIsDragging(false), onTouchStart: () => setIsDragging(true), onUpdate: swiper => handleSlideChange(swiper), slidesPerView: slidesPerView, spaceBetween: spaceBetween, children: [slides.map((slide, index) => (jsx(SwiperSlide, { className: clsx(styles$
|
|
6996
|
+
}, modules: [freeMode], onSlideChange: swiper => handleSlideChange(swiper), onSwiper: swiper => setIsLocked(swiper.isLocked), onTouchEnd: () => setIsDragging(false), onTouchStart: () => setIsDragging(true), onUpdate: swiper => handleSlideChange(swiper), slidesPerView: slidesPerView, spaceBetween: spaceBetween, children: [slides.map((slide, index) => (jsx(SwiperSlide, { className: clsx(styles$E.slide, slideClasses), children: slide }, index))), showNavigation && (jsxs("div", { className: clsx(styles$E['navigation-buttons'], styles$E[navigationButtonsPosition]), children: [jsx("div", { className: clsx(styles$E['navigation-button-wrapper'], styles$E['navigation-button-prev']), children: jsx(CarouselNavigationButton, { direction: "previous", isDisabled: isBeginning }) }), jsx("div", { className: clsx(styles$E['navigation-button-wrapper'], styles$E['navigation-button-next']), children: jsx(CarouselNavigationButton, { direction: "next", isDisabled: isEnd }) })] }))] }) }));
|
|
6659
6997
|
}
|
|
6660
6998
|
|
|
6661
6999
|
function CategoryCarousel({ categoryCards }) {
|
|
@@ -6669,10 +7007,10 @@ function CategoryCarousel({ categoryCards }) {
|
|
|
6669
7007
|
}, slides: categoryCards, spaceBetween: 8 }));
|
|
6670
7008
|
}
|
|
6671
7009
|
|
|
6672
|
-
var styles$
|
|
7010
|
+
var styles$D = {"accordion":"accordion-module-9WvAH","white":"accordion-module-CaVdG","accordion-item":"accordion-module-lf9d-","lg":"accordion-module-0qnae","with-seperators":"accordion-module-yOLrW","indented":"accordion-module-6CcEH","button":"accordion-module--Rwpb","icon":"accordion-module-Y50uq","focus":"accordion-module-M4BZs","panel":"accordion-module-KZjMo","content":"accordion-module-ejMH3","is-open":"accordion-module-W0F1z"};
|
|
6673
7011
|
|
|
6674
7012
|
function Accordion({ children, color = 'black', hasLineSeparator = true, indented, size = 'md', }) {
|
|
6675
|
-
return (jsx("div", { className: clsx({ [styles$
|
|
7013
|
+
return (jsx("div", { className: clsx({ [styles$D.indented]: indented }, styles$D.accordion, styles$D[color], styles$D[size], hasLineSeparator && styles$D['with-seperators']), children: children &&
|
|
6676
7014
|
Children.map(children, child => {
|
|
6677
7015
|
return cloneElement(child, { size });
|
|
6678
7016
|
}) }));
|
|
@@ -6682,7 +7020,7 @@ function GlyphsChevronsSlimDownIcon(props) {
|
|
|
6682
7020
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", ...props, fill: "currentColor", height: "12", viewBox: "0 0 12 12", width: "12", children: jsx("path", { d: "M6,9 L1,4.06645029 C1.08169007,3.87890406 1.19817561,3.69487412 1.34945663,3.51436046 C1.50073764,3.3338468 1.68216803,3.16239331 1.89374779,3 L5.98800959,7.08347812 L9.9960307,3 C10.2121071,3.16649238 10.4031847,3.33794587 10.5692635,3.51436046 C10.7353424,3.69077505 10.8789212,3.87480499 11,4.06645029 L6,9 Z", fillRule: "evenodd" }) }));
|
|
6683
7021
|
}
|
|
6684
7022
|
|
|
6685
|
-
var styles$
|
|
7023
|
+
var styles$C = {"show-all":"show-all-module-BDp21","panel":"show-all-module-bEdda","content":"show-all-module-RF--F","has-transparency":"show-all-module-30y7l","button":"show-all-module-58e7Q","icon":"show-all-module-fqncI","is-open":"show-all-module-hQeGI"};
|
|
6686
7024
|
|
|
6687
7025
|
const ShowAll = ({ children, hasTransparency = true, initialHeight = 0, isOpen, onToggle, }) => {
|
|
6688
7026
|
const showAllRef = useRef(null);
|
|
@@ -6691,14 +7029,14 @@ const ShowAll = ({ children, hasTransparency = true, initialHeight = 0, isOpen,
|
|
|
6691
7029
|
return;
|
|
6692
7030
|
showAllRef.current.style.setProperty('--initital-height', `${initialHeight}px`);
|
|
6693
7031
|
}, [initialHeight]);
|
|
6694
|
-
return (jsxs("div", { ref: showAllRef, className: clsx(styles$
|
|
6695
|
-
[styles$
|
|
6696
|
-
}), children: [jsx("div", { className: styles$
|
|
6697
|
-
[styles$
|
|
6698
|
-
}), children: children }) }), jsxs(
|
|
7032
|
+
return (jsxs("div", { ref: showAllRef, className: clsx(styles$C['show-all'], {
|
|
7033
|
+
[styles$C['is-open']]: isOpen,
|
|
7034
|
+
}), children: [jsx("div", { className: styles$C.panel, children: jsx("div", { className: clsx(styles$C.content, {
|
|
7035
|
+
[styles$C['has-transparency']]: hasTransparency,
|
|
7036
|
+
}), children: children }) }), jsxs(RouteLink, { className: styles$C.button, color: "secondary", onPress: () => onToggle(!isOpen), children: [jsx(GlyphsChevronsSlimDownIcon, { className: styles$C.icon }), isOpen ? (jsx(FormattedMessage, { id: "Show less" })) : (jsx(FormattedMessage, { id: "Show all" }))] })] }));
|
|
6699
7037
|
};
|
|
6700
7038
|
|
|
6701
|
-
var styles$
|
|
7039
|
+
var styles$B = {"multi-select":"multi-select-module-DC7Ix","filter-items":"multi-select-module-cwVFb","hidden":"multi-select-module-o7yHU","filter-item":"multi-select-module-OW-NK"};
|
|
6702
7040
|
|
|
6703
7041
|
function MultiSelect({ amountShown = 3, onChange, options, render, }) {
|
|
6704
7042
|
const shownOptions = options.slice(0, amountShown);
|
|
@@ -6709,28 +7047,28 @@ function MultiSelect({ amountShown = 3, onChange, options, render, }) {
|
|
|
6709
7047
|
options.filter(option => option.isSelected).length === 0) {
|
|
6710
7048
|
return null;
|
|
6711
7049
|
}
|
|
6712
|
-
return (jsxs("div", { className: styles$
|
|
7050
|
+
return (jsxs("div", { className: styles$B['multi-select'], children: [jsx("div", { className: styles$B['filter-items'], children: shownOptions
|
|
6713
7051
|
.concat(isOpen ? [] : hiddenSelectedOptions)
|
|
6714
|
-
.map(option => (jsxs("div", { className: styles$
|
|
7052
|
+
.map(option => (jsxs("div", { className: styles$B['filter-item'], children: [render({ onChange: () => onChange(option), option }), jsxs("span", { children: ["(", option.amount, ")"] })] }, option.value))) }), hiddenOptions.length > 0 && (jsx(ShowAll, { hasTransparency: false, isOpen: isOpen, onToggle: toggle, children: jsx("div", { className: clsx(styles$B['filter-items'], styles$B['hidden']), children: hiddenOptions.map(option => (jsxs("div", { className: styles$B['filter-item'], children: [render({ onChange: () => onChange(option), option }), jsxs("span", { children: ["(", option.amount, ")"] })] }, option.value))) }) }))] }));
|
|
6715
7053
|
}
|
|
6716
7054
|
|
|
6717
|
-
var styles$
|
|
7055
|
+
var styles$A = {"checkbox":"checkbox-module-YNVdd","box":"checkbox-module-UKoyf","checkmark":"checkbox-module-pHIwh","focus":"checkbox-module-v23jy","active":"checkbox-module-7UG-b","color-checkbox":"checkbox-module-nEhvW"};
|
|
6718
7056
|
|
|
6719
7057
|
function Checkbox({ _pseudo = 'none', children, className, isDisabled, isSelected, onChange, value, }) {
|
|
6720
|
-
return (jsxs(Checkbox$1, { className: clsx(className, styles$
|
|
7058
|
+
return (jsxs(Checkbox$1, { className: clsx(className, styles$A.checkbox, styles$A[_pseudo]), isDisabled: isDisabled, isSelected: isSelected, onChange: onChange, value: value, children: [jsx("div", { className: styles$A.box, children: jsx("svg", { "aria-hidden": "true", className: styles$A.checkmark, viewBox: "0 0 18 18", children: jsx("polyline", { points: "1 9 7 14 15 4" }) }) }), children] }));
|
|
6721
7059
|
}
|
|
6722
7060
|
|
|
6723
7061
|
function ColorCheckbox({ _pseudo = 'none', children, className, color, isDisabled, isSelected, onChange, value, }) {
|
|
6724
|
-
return (jsxs(Checkbox$1, { className: clsx(className, styles$
|
|
7062
|
+
return (jsxs(Checkbox$1, { className: clsx(className, styles$A.checkbox, styles$A['color-checkbox'], styles$A[_pseudo]), isDisabled: isDisabled, isSelected: isSelected, onChange: onChange, style: {
|
|
6725
7063
|
'--selected-color': color,
|
|
6726
|
-
}, value: value, children: [jsx("div", { className: styles$
|
|
7064
|
+
}, value: value, children: [jsx("div", { className: styles$A.box }), children] }));
|
|
6727
7065
|
}
|
|
6728
7066
|
|
|
6729
7067
|
function StrokeCheckmarkIcon(props) {
|
|
6730
7068
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", ...props, fill: "currentColor", height: "24", viewBox: "0 0 24 24", width: "24", children: jsx("path", { d: "M10.8641425,17 C10.6636971,17 10.4855234,16.9548533 10.3296214,16.8645598 C10.1737194,16.7742664 10.0252413,16.6388262 9.88418708,16.4582393 L6.27839644,12.2189616 C6.09279881,11.9857035 6,11.744921 6,11.496614 C6,11.2332581 6.08723088,11.0094056 6.26169265,10.8250564 C6.43615442,10.6407073 6.65330364,10.5485327 6.91314031,10.5485327 C7.06904232,10.5485327 7.21195249,10.5823928 7.34187082,10.6501129 C7.47178916,10.717833 7.59985152,10.8382242 7.72605791,11.0112867 L10.8195991,14.7200903 L16.2405345,6.53047404 C16.4558278,6.17682468 16.7230883,6 17.0423163,6 C17.2873051,6 17.5081663,6.08088789 17.7048998,6.24266366 C17.9016333,6.40443943 18,6.61700527 18,6.88036117 C18,7.00075245 17.9721604,7.12302483 17.9164811,7.24717833 C17.8608018,7.37133183 17.7958426,7.48984199 17.7216036,7.6027088 L11.7884187,16.4469526 C11.5582777,16.8156509 11.2501856,17 10.8641425,17 Z", fillRule: "evenodd" }) }));
|
|
6731
7069
|
}
|
|
6732
7070
|
|
|
6733
|
-
var styles$
|
|
7071
|
+
var styles$z = {"select":"select-module-ui-Wc","sm":"select-module-44a1l","md":"select-module-QUm-8","solid":"select-module-IRd4F","button":"select-module-aMQIQ","chevron":"select-module-00uRU","focus":"select-module-XMc0P","popover":"select-module-z8cWq","listbox":"select-module-S21ba","header":"select-module-4Bm2j","item":"select-module-LgEJO","check":"select-module-lQFw3"};
|
|
6734
7072
|
|
|
6735
7073
|
function Select({ isDisabled = false, label, onChange, options, placeholder, selectedOption, showLabel = true, size = 'md', variant = 'outline', }) {
|
|
6736
7074
|
const selectRef = useRef(null);
|
|
@@ -6747,12 +7085,12 @@ function Select({ isDisabled = false, label, onChange, options, placeholder, sel
|
|
|
6747
7085
|
window.addEventListener('resize', updateWidth);
|
|
6748
7086
|
return () => window.removeEventListener('resize', updateWidth);
|
|
6749
7087
|
}, []);
|
|
6750
|
-
return (jsxs(Select$1, { ref: selectRef, "aria-label": label, className: clsx(styles$
|
|
7088
|
+
return (jsxs(Select$1, { ref: selectRef, "aria-label": label, className: clsx(styles$z.select, styles$z[size], styles$z[variant]), isDisabled: isDisabled, onSelectionChange: selected => onChange(selected), placeholder: placeholder || label, selectedKey: String(selectedOption), children: [showLabel && jsx(Label, { children: label }), jsxs(Button$1, { className: styles$z.button, children: [jsx(SelectValue, {}), jsx(GlyphsChevronsSlimDownIcon, { "aria-hidden": "true", className: styles$z.chevron })] }), jsx(Popover, { ref: ref =>
|
|
6751
7089
|
// Workaround for react/react-aria #1513
|
|
6752
|
-
ref?.addEventListener('touchend', e => e.preventDefault()), className: clsx(styles$
|
|
7090
|
+
ref?.addEventListener('touchend', e => e.preventDefault()), className: clsx(styles$z.popover, styles$z[variant]), placement: "bottom left", triggerRef: selectRef, children: jsx(ListBox, { className: styles$z.listbox, children: jsxs(Section, { children: [jsx(Header, { className: styles$z.header, children: placeholder || label }), Object.entries(options).map(([key, value]) => (jsxs(ListBoxItem, { "aria-label": value, className: styles$z.item, id: key, textValue: value, children: [selectedOption === key && (jsx("span", { slot: "description", children: jsx(StrokeCheckmarkIcon, { className: styles$z.check }) })), jsx("span", { slot: "label", children: value })] }, key)))] }) }) })] }));
|
|
6753
7091
|
}
|
|
6754
7092
|
|
|
6755
|
-
var styles$
|
|
7093
|
+
var styles$y = {"input-container":"textarea-module-C6Xr1","lg":"textarea-module-vksG-","md":"textarea-module-6JrQJ"};
|
|
6756
7094
|
|
|
6757
7095
|
/**
|
|
6758
7096
|
* This component is used to create a textarea that can grow as the user types.
|
|
@@ -6787,7 +7125,7 @@ const TextArea = forwardRef(({ autoGrow, size, ...textAreaProps }, _ref) => {
|
|
|
6787
7125
|
}
|
|
6788
7126
|
updateHeight();
|
|
6789
7127
|
}, [ref, autoGrow, updateHeight, size]);
|
|
6790
|
-
return (jsx("div", { className: styles$
|
|
7128
|
+
return (jsx("div", { className: styles$y['input-container'], children: jsx(TextArea$1, { ...textAreaProps, ref: node => {
|
|
6791
7129
|
ref.current =
|
|
6792
7130
|
node;
|
|
6793
7131
|
textAreaRef.current = node;
|
|
@@ -6798,7 +7136,7 @@ const TextArea = forwardRef(({ autoGrow, size, ...textAreaProps }, _ref) => {
|
|
|
6798
7136
|
});
|
|
6799
7137
|
TextArea.displayName = 'TextArea';
|
|
6800
7138
|
|
|
6801
|
-
var styles$
|
|
7139
|
+
var styles$x = {"field":"text-field-module-JeaK0"};
|
|
6802
7140
|
|
|
6803
7141
|
/**
|
|
6804
7142
|
* This component is used to create a text field.
|
|
@@ -6806,7 +7144,7 @@ var styles$v = {"field":"text-field-module-JeaK0"};
|
|
|
6806
7144
|
* This field can also grow when a user types in text.
|
|
6807
7145
|
*/
|
|
6808
7146
|
function TextField({ autoFocus, autoGrow, defaultValue, isDisabled, isInvalid, isMultiline, isReadOnly, isRequired, label, maxLength, name, onChange, onInput, onKeyUp, placeholder, rows, showLabel = false, size = 'lg', value, }) {
|
|
6809
|
-
return (jsxs(TextField$1, { "aria-label": label, autoFocus: autoFocus, className: clsx(styles$
|
|
7147
|
+
return (jsxs(TextField$1, { "aria-label": label, autoFocus: autoFocus, className: clsx(styles$x.field, styles$x[size]), defaultValue: defaultValue, isDisabled: isDisabled, isInvalid: isInvalid, isReadOnly: isReadOnly, isRequired: isRequired, maxLength: maxLength, name: name, onChange: value => {
|
|
6810
7148
|
onChange?.(value);
|
|
6811
7149
|
}, onInput: onInput, onKeyUp: e => onKeyUp?.(e), value: value, children: [showLabel && jsx(Label, { isRequired: isRequired, children: label }), isMultiline ? (jsx(TextArea, { autoGrow: autoGrow, placeholder: placeholder, rows: rows, size: size })) : (jsx(Input, { autoGrow: autoGrow, placeholder: placeholder, size: size })), jsx(FieldError, {})] }));
|
|
6812
7150
|
}
|
|
@@ -6816,31 +7154,31 @@ function IntlProvider({ children, formatMessage, languageCode: _languageCode, })
|
|
|
6816
7154
|
return (jsx(IntlContext.Provider, { value: { formatMessage, languageCode, updateLanguageCode }, children: children }));
|
|
6817
7155
|
}
|
|
6818
7156
|
|
|
6819
|
-
var styles$
|
|
7157
|
+
var styles$w = {"progress-circle":"progress-circle-module-4nweP","spin":"progress-circle-module-kCf7K"};
|
|
6820
7158
|
|
|
6821
7159
|
function ProgressCircle({ className }) {
|
|
6822
|
-
return (jsxs("svg", { className: clsx(styles$
|
|
7160
|
+
return (jsxs("svg", { className: clsx(styles$w['progress-circle'], className), viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", children: [jsx("title", { children: "Spinner" }), jsxs("defs", { children: [jsx("pattern", { height: "100%", id: "pattern-1", patternUnits: "objectBoundingBox", width: "100%", children: jsx("use", { xlinkHref: "#image-2" }) }), jsx("image", { height: "24", id: "image-2", width: "24", xlinkHref: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAGKADAAQAAAABAAAAGAAAAADiNXWtAAAB7UlEQVRIDZ2VSaoCQQyG01rOoBtBr+YZXXsFL+BGEHcqDuCE89SPL480hdpiGYil3an/S1KDUavViq/Xq1wul8RPp5Ocz2dhPB6PiR8OB42RAHO5XE7D4zgW/PF4CM/u97tks1n1TCYjURSpB2hraALglw8BQGXOuQQSKk68y+fzL9lRBQAqAUIlVkUoxBUKBZ3sC1irbrdbUoX/PgTyAqDXmFVBBVRCFfYuGMBk67UvRCUA2FFAfgKUSiWhFTgQA9ESjLVgC7NWwEPNFYtFFUEICJnigAxCFbvd7jcAFVi/gbDoCALmOzCMAzebzUILEFculxVgOwcIDqRSqaiTBDadToMhziYDwBgNRmW0rdFoSLPZ1PeDwUDHbz+iTqejyv5VYHuekbVggavVqkLq9fq32hqnLTJxdgmijPQeYSqs1Woa3G63g8QJ1haZKMJkjDgLjLi/Nbvd7m8ARCxry9x2jyn2ej2ZTCb28+tRK/Azpy3vrN/vy2azeffq4zM9aLTFP1jPM4bDoWbPH06o6WXn9/lZgDMxGo1kuVwG/5uhlfkkTsB4PJb5fC7b7VYPH89C7P9GS5nBLYr4er2W/X6vhy4lNPXxR8BisdDWkD13Ee0KtVQAgqvVSncO2XNlc3WEWirAxLmmgf0K+ANZ6DTlvO5jwwAAAABJRU5ErkJggg==" })] }), jsx("g", { fill: "none", fillRule: "evenodd", id: "Page-1", stroke: "none", strokeWidth: "1", children: jsx("path", { d: "M12,0 C18.627417,0 24,5.372583 24,12 C24,14.7277828 23.0855773,17.3196292 21.4324752,19.4188392 C19.1717866,22.2895997 15.7255176,24 12,24 C11.2636203,24 10.6666667,23.4030463 10.6666667,22.6666667 C10.6666667,21.930287 11.2636203,21.3333333 12,21.3333333 C14.8994206,21.3333333 17.5771113,20.0043823 19.3374325,17.7690188 C20.6234737,16.1359252 21.3333333,14.1238938 21.3333333,12 C21.3333333,6.84534234 17.1546577,2.66666667 12,2.66666667 C6.84534234,2.66666667 2.66666667,6.84534234 2.66666667,12 C2.66666667,14.4546154 3.61656005,16.756214 5.28844833,18.485859 C5.80023235,19.015323 5.78589988,19.8594213 5.25643588,20.3712053 C4.72697187,20.8829893 3.88287357,20.8686569 3.37108955,20.3391928 C1.22326178,18.1171666 0,15.1531945 0,12 C0,5.372583 5.372583,0 12,0 Z", fill: "url(#pattern-1)", fillRule: "nonzero", id: "Spinner" }) })] }));
|
|
6823
7161
|
}
|
|
6824
7162
|
|
|
6825
|
-
var styles$
|
|
7163
|
+
var styles$v = {"product-grid":"product-overview-grid-module-bzys-","loading-panel":"product-overview-grid-module-XikkF","fade-in":"product-overview-grid-module-A6CS7","progress-circle":"product-overview-grid-module-DWnnI","fade-in-spinner":"product-overview-grid-module-r-wvY","grid-item":"product-overview-grid-module-MlUVA"};
|
|
6826
7164
|
|
|
6827
7165
|
function ProductOverviewGrid({ children, isLoading, }) {
|
|
6828
|
-
return (jsxs("div", { className: styles$
|
|
7166
|
+
return (jsxs("div", { className: styles$v['product-grid'], children: [Children.map(children, (child, index) => (jsx("div", { className: styles$v['grid-item'], children: child }, index))), isLoading && (jsx("div", { className: styles$v['loading-panel'], children: jsx(ProgressCircle, { className: styles$v['progress-circle'] }) }))] }));
|
|
6829
7167
|
}
|
|
6830
7168
|
|
|
6831
|
-
var styles$
|
|
7169
|
+
var styles$u = {"loading-overlay":"loading-overlay-module-L67Gy"};
|
|
6832
7170
|
|
|
6833
7171
|
function LoadingOverlay() {
|
|
6834
|
-
return (jsx("div", { className: styles$
|
|
7172
|
+
return (jsx("div", { className: styles$u['loading-overlay'], children: jsx(ProgressCircle, {}) }));
|
|
6835
7173
|
}
|
|
6836
7174
|
|
|
6837
|
-
var styles$
|
|
7175
|
+
var styles$t = {"page-container":"page-container-module-PYmbC","inner-page-container":"page-container-module-uD8GF"};
|
|
6838
7176
|
|
|
6839
7177
|
function PageContainer({ children, className, }) {
|
|
6840
|
-
return (jsx("div", { className: styles$
|
|
7178
|
+
return (jsx("div", { className: styles$t['page-container'], children: jsx("div", { className: clsx(styles$t['inner-page-container'], className), children: children }) }));
|
|
6841
7179
|
}
|
|
6842
7180
|
|
|
6843
|
-
var styles$
|
|
7181
|
+
var styles$s = {"heading":"heading-module-pMC65","uppercase":"heading-module-6spgX","italic":"heading-module-XXMDM","bold":"heading-module-xvrxo","xxl":"heading-module-Kn3ZN","xl":"heading-module--hZs-","l":"heading-module-WrJRY","m":"heading-module-hTexc","s":"heading-module-7W29m","xs":"heading-module-SgaLB","xxs":"heading-module-33en7"};
|
|
6844
7182
|
|
|
6845
7183
|
const sizeToTag = {
|
|
6846
7184
|
l: 'h3',
|
|
@@ -6851,23 +7189,24 @@ const sizeToTag = {
|
|
|
6851
7189
|
xxl: 'h1',
|
|
6852
7190
|
xxs: 'h6',
|
|
6853
7191
|
};
|
|
6854
|
-
function Heading({ children, className, italic, size = 'xxl', tag, uppercase, }) {
|
|
7192
|
+
function Heading({ bold = true, children, className, italic, size = 'xxl', tag, uppercase, }) {
|
|
6855
7193
|
return createElement$1(tag || sizeToTag[size], {
|
|
6856
|
-
className: clsx(className, styles$
|
|
6857
|
-
[styles$
|
|
6858
|
-
[styles$
|
|
7194
|
+
className: clsx(className, styles$s.heading, styles$s[size], {
|
|
7195
|
+
[styles$s.uppercase]: uppercase,
|
|
7196
|
+
[styles$s.italic]: italic,
|
|
7197
|
+
[styles$s.bold]: bold,
|
|
6859
7198
|
}),
|
|
6860
7199
|
}, children);
|
|
6861
7200
|
}
|
|
6862
7201
|
|
|
6863
|
-
var styles$
|
|
7202
|
+
var styles$r = {"page":"page-module-XtZ9Y","breadcrumb":"page-module-ohh9z","title":"page-module-TEmve"};
|
|
6864
7203
|
|
|
6865
7204
|
function PageTitle({ children }) {
|
|
6866
7205
|
const { lg, xxl } = useBreakpoint();
|
|
6867
|
-
return (jsx(Heading, { italic: true, uppercase: true, className: styles$
|
|
7206
|
+
return (jsx(Heading, { italic: true, uppercase: true, className: styles$r.title, size: xxl ? 'xl' : lg ? 'm' : 's', tag: "h1", children: children }));
|
|
6868
7207
|
}
|
|
6869
7208
|
function Page({ breadCrumb, children, className, title }) {
|
|
6870
|
-
return (jsxs(PageContainer, { className: clsx(styles$
|
|
7209
|
+
return (jsxs(PageContainer, { className: clsx(styles$r.page, className), children: [jsx("div", { className: styles$r.breadcrumb, children: jsx(Breadcrumb, { links: breadCrumb }) }), title && jsx(PageTitle, { children: title }), children] }));
|
|
6871
7210
|
}
|
|
6872
7211
|
|
|
6873
7212
|
const useSidebar = () => {
|
|
@@ -6909,12 +7248,12 @@ function GlyphsChevronsBoldDownIcon(props) {
|
|
|
6909
7248
|
function AccordionItem({ _pseudo = 'none', children, className, id, initialIsOpen = false, isDisabled = false, size, title, }) {
|
|
6910
7249
|
const { isOpen, toggle } = useDisclosure(initialIsOpen);
|
|
6911
7250
|
const panelId = `panel-${id}`;
|
|
6912
|
-
return (jsxs("div", { className: clsx(className, styles$
|
|
6913
|
-
[styles$
|
|
6914
|
-
}), children: [jsx("h3", { children: jsxs("button", { "aria-controls": panelId, "aria-expanded": isOpen, className: clsx(styles$
|
|
7251
|
+
return (jsxs("div", { className: clsx(className, styles$D['accordion-item'], {
|
|
7252
|
+
[styles$D['is-open']]: isOpen,
|
|
7253
|
+
}), children: [jsx("h3", { children: jsxs("button", { "aria-controls": panelId, "aria-expanded": isOpen, className: clsx(styles$D.button, styles$D[_pseudo]), disabled: isDisabled, id: id, onClick: toggle, type: "button", children: [title, jsx("span", { className: styles$D.icon, children: size === 'lg' ? (jsx(GlyphsChevronsBoldDownIcon, {})) : (jsx(GlyphsChevronsSlimDownIcon, {})) })] }) }), jsx("div", { "aria-labelledby": id, className: styles$D.panel, id: panelId, role: "region", children: jsx("div", { className: styles$D.content, children: children }) })] }));
|
|
6915
7254
|
}
|
|
6916
7255
|
|
|
6917
|
-
var styles$
|
|
7256
|
+
var styles$q = {"filter-section":"filter-section-module-q1Ob8","default":"filter-section-module-JkP09","with-action":"filter-section-module-9qc6L","header":"filter-section-module-zi2ZE","title":"filter-section-module-hWVv-","content":"filter-section-module-15-YW"};
|
|
6918
7257
|
|
|
6919
7258
|
function FilterSection({ ...props }) {
|
|
6920
7259
|
const variant = props.variant;
|
|
@@ -6932,16 +7271,16 @@ function FilterSection({ ...props }) {
|
|
|
6932
7271
|
/* eslint-enable @typescript-eslint/no-unnecessary-condition */
|
|
6933
7272
|
}
|
|
6934
7273
|
function CollapsibleFilterSection({ children, initialIsOpen = true, title, variant, }) {
|
|
6935
|
-
return (jsx("section", { className: clsx(styles$
|
|
7274
|
+
return (jsx("section", { className: clsx(styles$q['filter-section'], styles$q[variant]), children: jsx(Accordion, { children: jsx(AccordionItem, { id: title, initialIsOpen: initialIsOpen, title: jsx("span", { className: styles$q['accordion-title'], children: jsx(FormattedMessage, { optional: true, fallbackValue: title, id: `facet.${title.toLowerCase()}` }) }), children: children }) }) }));
|
|
6936
7275
|
}
|
|
6937
7276
|
function WithActionFilterSection({ button, children, title, variant, }) {
|
|
6938
|
-
return (jsxs("section", { className: clsx(styles$
|
|
7277
|
+
return (jsxs("section", { className: clsx(styles$q['filter-section'], styles$q[variant]), children: [jsxs("div", { className: styles$q.header, children: [jsx("h3", { className: styles$q.title, children: title }), jsx("div", { children: button })] }), jsx("div", { className: styles$q.content, children: children })] }));
|
|
6939
7278
|
}
|
|
6940
7279
|
function DefaultFilterSection({ children, title, variant, }) {
|
|
6941
|
-
return (jsxs("section", { className: clsx(styles$
|
|
7280
|
+
return (jsxs("section", { className: clsx(styles$q['filter-section'], styles$q[variant]), children: [jsx("h3", { className: styles$q.title, children: title }), jsx("div", { className: styles$q.content, children: children })] }));
|
|
6942
7281
|
}
|
|
6943
7282
|
|
|
6944
|
-
var styles$
|
|
7283
|
+
var styles$p = {"filter-panel":"algolia-filter-panel-module-GfhOO","scroll-container":"algolia-filter-panel-module-4ubB1","category":"algolia-filter-panel-module-LKet3","is-active":"algolia-filter-panel-module-yf8kI","count":"algolia-filter-panel-module-uAHPx","button":"algolia-filter-panel-module-ABOYv"};
|
|
6945
7284
|
|
|
6946
7285
|
function AlgoliaActiveCategories() {
|
|
6947
7286
|
const { items: categories } = useHierarchicalMenu({
|
|
@@ -6962,8 +7301,8 @@ function Categories({ categories, path: _path, }) {
|
|
|
6962
7301
|
.map(category => {
|
|
6963
7302
|
const path = _path + '/' + category.label;
|
|
6964
7303
|
const isActive = !category.data || !category.data.some(c => c.isRefined);
|
|
6965
|
-
return (jsxs(Fragment, { children: [jsx(RouteLink, { className: clsx(styles$
|
|
6966
|
-
[styles$
|
|
7304
|
+
return (jsxs(Fragment, { children: [jsx(RouteLink, { hasUnderline: true, className: clsx(styles$p.category, {
|
|
7305
|
+
[styles$p['is-active']]: isActive,
|
|
6967
7306
|
}), href: path, isDisabled: isActive, children: category.label }), category.data && (jsx(Categories, { categories: category.data, path: path }))] }, category.value));
|
|
6968
7307
|
});
|
|
6969
7308
|
}
|
|
@@ -6972,12 +7311,13 @@ function StrokeCloseboxIcon(props) {
|
|
|
6972
7311
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", ...props, height: "24", viewBox: "0 0 24 24", width: "24", children: jsx("path", { d: "M8,8 L16,16 M16,8 L8,16", fill: "currentColor", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.4" }) }));
|
|
6973
7312
|
}
|
|
6974
7313
|
|
|
6975
|
-
var styles$
|
|
7314
|
+
var styles$o = {"active-filter-item":"active-filters-module-Rrmhy","category":"active-filters-module-u9TTE","active-filter-value":"active-filters-module-CIuPU"};
|
|
6976
7315
|
|
|
6977
7316
|
const ActiveFilters = ({ onClearAllFilters, onClearFilter, selectedFilterCategories, }) => {
|
|
7317
|
+
const t = useFormattedMessage();
|
|
6978
7318
|
if (selectedFilterCategories.length === 0)
|
|
6979
7319
|
return null;
|
|
6980
|
-
return (jsx(FilterSection, { button: jsx(
|
|
7320
|
+
return (jsx(FilterSection, { button: jsx(RouteLink, { onPress: onClearAllFilters, children: jsx(FormattedMessage, { id: "Clear filters" }) }), title: t('Chosen filters'), variant: "with-action", children: selectedFilterCategories.map((category, index) => (jsx("section", { className: styles$o.category, children: category.filters.map(filter => (jsxs("div", { className: styles$o['active-filter-item'], children: [jsxs("span", { children: [jsxs("span", { children: [jsx(FormattedMessage, { id: `facet.${category.label.toLowerCase()}` }), jsx("span", { children: ": " })] }), jsx("span", { className: styles$o['active-filter-value'], children: filter.label })] }), jsx(IconButton, { color: "secondary", onPress: () => onClearFilter(category.label, filter), children: jsx(StrokeCloseboxIcon, {}) })] }, `${category.label}-${filter.value}`))) }, `${category.label}-${index}`))) }));
|
|
6981
7321
|
};
|
|
6982
7322
|
|
|
6983
7323
|
function AlgoliaActiveFilters() {
|
|
@@ -7018,9 +7358,9 @@ function AlgoliaCategoriesFilters() {
|
|
|
7018
7358
|
const t = useFormattedMessage();
|
|
7019
7359
|
if (categories.length <= 0)
|
|
7020
7360
|
return null;
|
|
7021
|
-
return (jsx(FilterSection, { title: t('facet.categories'), variant: "default", children: categories.map(({ count, isRefined, value }) => (jsxs(
|
|
7022
|
-
[styles$
|
|
7023
|
-
}), onClick: () => refine(value),
|
|
7361
|
+
return (jsx(FilterSection, { title: t('facet.categories'), variant: "default", children: categories.map(({ count, isRefined, value }) => (jsxs(Link, { className: clsx(styles$p.category, {
|
|
7362
|
+
[styles$p['is-active']]: isRefined,
|
|
7363
|
+
}), isDisabled: isRefined, onClick: () => refine(value), children: [jsx("span", { children: value }), " ", jsxs("span", { className: styles$p.count, children: ["(", count, ")"] })] }, value))) }));
|
|
7024
7364
|
}
|
|
7025
7365
|
|
|
7026
7366
|
function AlgoliaMultiSelectFilterSection({ attribute, }) {
|
|
@@ -7052,23 +7392,23 @@ function AlgoliaResultsCount() {
|
|
|
7052
7392
|
|
|
7053
7393
|
function PanelCloseButton() {
|
|
7054
7394
|
const { toggle } = useSidebarActions();
|
|
7055
|
-
return (jsx("div", { className: styles$
|
|
7395
|
+
return (jsx("div", { className: styles$p.button, children: jsxs(Button, { withArrow: true, onPress: toggle, size: "md", children: [jsx(FormattedMessage, { id: "Show" }), " ", jsx(AlgoliaResultsCount, {})] }) }));
|
|
7056
7396
|
}
|
|
7057
7397
|
function AlgoliaFilterPanel({ showActiveCategories = false, showCategoriesFilters = false, }) {
|
|
7058
7398
|
const { attributesToRender } = useDynamicWidgets({
|
|
7059
7399
|
maxValuesPerFacet: 100,
|
|
7060
7400
|
});
|
|
7061
|
-
return (jsx("div", { className: styles$
|
|
7401
|
+
return (jsx("div", { className: styles$p['filter-panel'], children: jsxs("div", { className: styles$p['scroll-container'], children: [showActiveCategories && jsx(AlgoliaActiveCategories, {}), showCategoriesFilters && jsx(AlgoliaCategoriesFilters, {}), jsx(AlgoliaActiveFilters, {}), attributesToRender.length > 0 && (jsx("section", { children: attributesToRender.map((attribute, index) => (jsx(AlgoliaMultiSelectFilterSection, { attribute: attribute }, `attribute-${index}`))) })), jsx(PanelCloseButton, {})] }) }));
|
|
7062
7402
|
}
|
|
7063
7403
|
|
|
7064
7404
|
function GlyphsChevronsSlimRightIcon(props) {
|
|
7065
7405
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", ...props, fill: "currentColor", height: "12", viewBox: "0 0 12 12", width: "12", children: jsx("path", { d: "M9,6 L4.06645029,1 C3.87890406,1.08169007 3.69487412,1.19817561 3.51436046,1.34945663 C3.3338468,1.50073764 3.16239331,1.68216803 3,1.89374779 L7.08347812,5.98800959 L3,9.9960307 C3.16649238,10.2121071 3.33794587,10.4031847 3.51436046,10.5692635 C3.69077505,10.7353424 3.87480499,10.8789212 4.06645029,11 L9,6 Z", fillRule: "evenodd" }) }));
|
|
7066
7406
|
}
|
|
7067
7407
|
|
|
7068
|
-
var styles$
|
|
7408
|
+
var styles$n = {"pagination":"pagination-module-k4OgY","page-number-container":"pagination-module-oq89A"};
|
|
7069
7409
|
|
|
7070
7410
|
function Pagination({ currentPage, onChange, totalPages, }) {
|
|
7071
|
-
return (jsxs("div", { className: styles$
|
|
7411
|
+
return (jsxs("div", { className: styles$n.pagination, children: [jsx(IconButton, { isDisabled: currentPage === 1, onPress: () => onChange(currentPage - 1), children: jsx(GlyphsChevronsSlimLeftIcon, {}) }), jsxs("div", { className: styles$n['page-number-container'], children: [jsx(NumberField, { autoGrow: true, label: "current-page", maxValue: totalPages, minValue: 1, onChange: onChange, value: currentPage }), jsx(FormattedMessage, { id: "of" }), jsx("div", { children: totalPages })] }), jsx(IconButton, { isDisabled: currentPage >= totalPages, onPress: () => onChange(currentPage + 1), children: jsx(GlyphsChevronsSlimRightIcon, {}) })] }));
|
|
7072
7412
|
}
|
|
7073
7413
|
|
|
7074
7414
|
function AlgoliaPagination({ onChange }) {
|
|
@@ -7077,6 +7417,9 @@ function AlgoliaPagination({ onChange }) {
|
|
|
7077
7417
|
refine(pageNumber - 1);
|
|
7078
7418
|
onChange(pageNumber);
|
|
7079
7419
|
}
|
|
7420
|
+
if (nbPages === 0) {
|
|
7421
|
+
return null;
|
|
7422
|
+
}
|
|
7080
7423
|
return (jsx(Pagination, { currentPage: currentRefinement + 1, onChange: pageNumber => handlePageChange(pageNumber), totalPages: nbPages }));
|
|
7081
7424
|
}
|
|
7082
7425
|
|
|
@@ -7229,60 +7572,25 @@ function useAlgoliaInsights() {
|
|
|
7229
7572
|
sendEvents: Parameters<ReturnType<typeof makeSendEvents>>;
|
|
7230
7573
|
*/
|
|
7231
7574
|
|
|
7232
|
-
var styles$
|
|
7575
|
+
var styles$m = {"modal-overlay":"modal-module-rVFJc","modal-fade":"modal-module-63Uyl","modal":"modal-module-6vlFt","modal-zoom":"modal-module-aPJ7X"};
|
|
7233
7576
|
|
|
7234
7577
|
function Modal({ children, className, isDismissable, isKeyboardDismissDisabled, isOpen, onOpenChange, }) {
|
|
7235
|
-
return (jsx(ModalOverlay, { className: clsx(styles$
|
|
7578
|
+
return (jsx(ModalOverlay, { className: clsx(styles$m['modal-overlay'], className), isDismissable: isDismissable, isKeyboardDismissDisabled: isKeyboardDismissDisabled, isOpen: isOpen, onOpenChange: onOpenChange, children: jsx(Modal$1, { className: styles$m.modal, children: children }) }));
|
|
7236
7579
|
}
|
|
7237
7580
|
|
|
7238
|
-
var styles$
|
|
7581
|
+
var styles$l = {"header":"dialog-module-ZnsAe","heading":"dialog-module-SwpuZ","close":"dialog-module-Y7Tqg","content":"dialog-module-Koqia","footer":"dialog-module-y7Axm"};
|
|
7239
7582
|
|
|
7240
7583
|
function Footer({ close }) {
|
|
7241
7584
|
return (jsx(Button, { onPress: close, size: "md", children: "Close" }));
|
|
7242
7585
|
}
|
|
7243
7586
|
function Dialog({ allowClose = true, children, className, footer = Footer, hideTitle, isDismissable, isKeyboardDismissDisabled, isOpen, onOpenChange, onSubmit, title, validationErrors, }) {
|
|
7244
|
-
return (jsx(Modal, { className: clsx(styles$
|
|
7587
|
+
return (jsx(Modal, { className: clsx(styles$l['modal-overlay'], className), isDismissable: isDismissable, isKeyboardDismissDisabled: isKeyboardDismissDisabled, isOpen: isOpen, onOpenChange: onOpenChange, children: jsx(Dialog$1, { "aria-label": title, children: ({ close }) => (jsxs(Form, { onSubmit: onSubmit || (e => e.preventDefault), validationErrors: validationErrors, children: [jsxs("header", { className: styles$l.header, children: [!hideTitle && (jsx(Heading, { className: styles$l.heading, size: "xs", children: title })), jsx("div", { className: styles$l.close, children: jsx(IconButton, { color: "secondary", isDisabled: !allowClose, onPress: close, children: jsx(StrokeCloseboxIcon, {}) }) })] }), jsx("div", { className: styles$l.content, children: children instanceof Function ? children({ close }) : children }), jsx("footer", { className: styles$l.footer, children: footer instanceof Function ? footer({ close }) : footer })] })) }) }));
|
|
7245
7588
|
}
|
|
7246
7589
|
|
|
7247
7590
|
function SignInDialog({ isOpen, onOpenChange }) {
|
|
7248
7591
|
const t = useFormattedMessage();
|
|
7249
7592
|
const { signInUrl } = useFavorite();
|
|
7250
|
-
return (jsxs(Dialog, { isDismissable: true, isOpen: isOpen, onOpenChange: onOpenChange, title: t('Please Sign In'), children: [t('You must '), jsx(
|
|
7251
|
-
}
|
|
7252
|
-
|
|
7253
|
-
function useAddWishListItemToCurrentWishList() {
|
|
7254
|
-
const queryClient = useQueryClient();
|
|
7255
|
-
return useMutation({
|
|
7256
|
-
mutationFn: async ({ productId }) => {
|
|
7257
|
-
let wishList = queryClient.getQueryData([
|
|
7258
|
-
'wishlist',
|
|
7259
|
-
'current',
|
|
7260
|
-
]);
|
|
7261
|
-
if (!wishList) {
|
|
7262
|
-
wishList = await createWishList();
|
|
7263
|
-
queryClient.removeQueries({ queryKey: ['wishlists'] });
|
|
7264
|
-
queryClient.setQueryData(['wishlist', 'current'], wishList);
|
|
7265
|
-
}
|
|
7266
|
-
await addWishListItemToWishList({
|
|
7267
|
-
productId,
|
|
7268
|
-
wishListId: wishList.id,
|
|
7269
|
-
});
|
|
7270
|
-
queryClient.removeQueries({
|
|
7271
|
-
queryKey: ['wishlists', '*', 'wishlistlines'],
|
|
7272
|
-
});
|
|
7273
|
-
},
|
|
7274
|
-
});
|
|
7275
|
-
}
|
|
7276
|
-
|
|
7277
|
-
function useRemoveWishListItemFromCurrentWishList() {
|
|
7278
|
-
const queryClient = useQueryClient();
|
|
7279
|
-
return useMutation({
|
|
7280
|
-
mutationFn: async ({ wishListId, wishListItemId }) => {
|
|
7281
|
-
await removeWishListItemFromWishList({ wishListId, wishListItemId });
|
|
7282
|
-
queryClient.removeQueries({ queryKey: ['wishlists'] });
|
|
7283
|
-
queryClient.removeQueries({ queryKey: ['wishlist'] });
|
|
7284
|
-
},
|
|
7285
|
-
});
|
|
7593
|
+
return (jsxs(Dialog, { isDismissable: true, isOpen: isOpen, onOpenChange: onOpenChange, title: t('Please Sign In'), children: [t('You must '), jsx(RouteLink, { color: "secondary", href: `${signInUrl}?returnUrl=${encodeURIComponent(window.location.pathname + window.location.search)}`, onPress: () => onOpenChange(false), children: t('sign in') }), t(' to your account to manage your lists.')] }));
|
|
7286
7594
|
}
|
|
7287
7595
|
|
|
7288
7596
|
function ConnectedFavoriteButton({ productId }) {
|
|
@@ -7305,6 +7613,8 @@ function ConnectedFavoriteButton({ productId }) {
|
|
|
7305
7613
|
addWishListItemToCurrentWishList({ productId });
|
|
7306
7614
|
}
|
|
7307
7615
|
}
|
|
7616
|
+
if (isFetching)
|
|
7617
|
+
return null;
|
|
7308
7618
|
return (jsxs(Fragment, { children: [jsx(FavoriteButton, { isDisabled: isFetching, isFavorite: isFavorite, onPress: onFavorite }), jsx(SignInDialog, { isOpen: showSignInDialog, onOpenChange: setShowSignInDialog })] }));
|
|
7309
7619
|
}
|
|
7310
7620
|
|
|
@@ -7314,15 +7624,16 @@ function ConnectedProductCard({ onAddToCart, productId, ...props }) {
|
|
|
7314
7624
|
favoriteButton: jsx(ConnectedFavoriteButton, { productId: productId }) }));
|
|
7315
7625
|
}
|
|
7316
7626
|
|
|
7317
|
-
function
|
|
7318
|
-
const { items } =
|
|
7319
|
-
return
|
|
7627
|
+
function useAlgoliaProductHits() {
|
|
7628
|
+
const [{ isLoading, items }] = useGlobalState('algolia-product-hits', { isLoading: undefined, items: [] });
|
|
7629
|
+
return {
|
|
7630
|
+
isLoading,
|
|
7631
|
+
products: items.map(transformAlgoliaProductHitToProductHit),
|
|
7632
|
+
};
|
|
7320
7633
|
}
|
|
7321
7634
|
|
|
7322
7635
|
function ProductOverview() {
|
|
7323
|
-
const {
|
|
7324
|
-
const isLoading = status !== 'idle';
|
|
7325
|
-
const products = useProductHits();
|
|
7636
|
+
const { isLoading, products } = useAlgoliaProductHits();
|
|
7326
7637
|
const { sendAddToCartFromProductListPageEvent, sendProductClickFromProductListPageEvent, } = useAlgoliaInsights();
|
|
7327
7638
|
return (jsx(ProductOverviewGrid, { isLoading: isLoading, children: products.map(product => (jsx(ConnectedProductCard, { href: product.storefrontSlug, image: {
|
|
7328
7639
|
fit: 'contain',
|
|
@@ -7345,6 +7656,28 @@ const defaultLanguageCodes = {
|
|
|
7345
7656
|
};
|
|
7346
7657
|
const getLanguageForAlgoliaIndex = (languageCode) => defaultLanguageCodes[languageCode] || languageCode;
|
|
7347
7658
|
const algoliaIndexesPerEnvironment = {
|
|
7659
|
+
local: {
|
|
7660
|
+
default: 'dev_sonic_products_<languageCode>',
|
|
7661
|
+
sort: [
|
|
7662
|
+
{
|
|
7663
|
+
index: 'dev_sonic_products_<languageCode>',
|
|
7664
|
+
name: 'relevance',
|
|
7665
|
+
},
|
|
7666
|
+
{
|
|
7667
|
+
index: 'dev_sonic_products_<languageCode>_is-new_desc',
|
|
7668
|
+
name: 'newest',
|
|
7669
|
+
},
|
|
7670
|
+
{
|
|
7671
|
+
index: 'dev_sonic_products_<languageCode>_price_asc',
|
|
7672
|
+
name: 'price_asc',
|
|
7673
|
+
},
|
|
7674
|
+
{
|
|
7675
|
+
index: 'dev_sonic_products_<languageCode>_price_desc',
|
|
7676
|
+
name: 'price_desc',
|
|
7677
|
+
},
|
|
7678
|
+
],
|
|
7679
|
+
suggestions: 'dev_sonic_products_<languageCode>_query_suggestions',
|
|
7680
|
+
},
|
|
7348
7681
|
production: {
|
|
7349
7682
|
default: 'prod_sonic_products_<languageCode>',
|
|
7350
7683
|
sort: [
|
|
@@ -7408,7 +7741,82 @@ const getAlgoliaIndex = (environment, languageCode) => {
|
|
|
7408
7741
|
};
|
|
7409
7742
|
};
|
|
7410
7743
|
|
|
7411
|
-
function
|
|
7744
|
+
function useAlgoliaInstantSearchState(initialState) {
|
|
7745
|
+
const [state, setState] = useGlobalState('algolia-global-state', {
|
|
7746
|
+
online: initialState?.online ?? true,
|
|
7747
|
+
status: initialState?.status ?? 'idle',
|
|
7748
|
+
});
|
|
7749
|
+
const setStatus = useCallback((status) => {
|
|
7750
|
+
setState(state => {
|
|
7751
|
+
if (state.status === status)
|
|
7752
|
+
return state;
|
|
7753
|
+
return { ...state, status };
|
|
7754
|
+
});
|
|
7755
|
+
}, [setState]);
|
|
7756
|
+
const setIndex = useCallback((index) => {
|
|
7757
|
+
setState(state => {
|
|
7758
|
+
if (state.index === index)
|
|
7759
|
+
return state;
|
|
7760
|
+
return { ...state, index };
|
|
7761
|
+
});
|
|
7762
|
+
}, [setState]);
|
|
7763
|
+
const setQueryId = useCallback((queryId) => {
|
|
7764
|
+
setState(state => {
|
|
7765
|
+
if (state.queryId === queryId)
|
|
7766
|
+
return state;
|
|
7767
|
+
return { ...state, queryId };
|
|
7768
|
+
});
|
|
7769
|
+
}, [setState]);
|
|
7770
|
+
return {
|
|
7771
|
+
setIndex,
|
|
7772
|
+
setQueryId,
|
|
7773
|
+
setStatus,
|
|
7774
|
+
...state,
|
|
7775
|
+
};
|
|
7776
|
+
}
|
|
7777
|
+
function AlgoliaGlobalStateProvider() {
|
|
7778
|
+
const { results: { index, queryID }, status, } = useInstantSearch();
|
|
7779
|
+
const { setIndex, setQueryId, setStatus } = useAlgoliaInstantSearchState();
|
|
7780
|
+
useEffect(() => {
|
|
7781
|
+
setStatus(status);
|
|
7782
|
+
}, [status, setStatus]);
|
|
7783
|
+
useEffect(() => {
|
|
7784
|
+
setIndex(index);
|
|
7785
|
+
}, [index, setIndex]);
|
|
7786
|
+
useEffect(() => {
|
|
7787
|
+
setQueryId(queryID);
|
|
7788
|
+
}, [queryID, setQueryId]);
|
|
7789
|
+
return null;
|
|
7790
|
+
}
|
|
7791
|
+
|
|
7792
|
+
function AlgoliaInsightInstantSearchProvider({ children, }) {
|
|
7793
|
+
const { index, queryId } = useAlgoliaInstantSearchState();
|
|
7794
|
+
return (jsx(AlgoliaInsightsProvider, { value: {
|
|
7795
|
+
index,
|
|
7796
|
+
queryId,
|
|
7797
|
+
}, children: children }));
|
|
7798
|
+
}
|
|
7799
|
+
|
|
7800
|
+
function AlgoliaProductHitsProvider() {
|
|
7801
|
+
const { status } = useAlgoliaInstantSearchState();
|
|
7802
|
+
const [, setState] = useGlobalState('algolia-product-hits', {
|
|
7803
|
+
isLoading: undefined,
|
|
7804
|
+
items: [],
|
|
7805
|
+
});
|
|
7806
|
+
const { items, results } = useHits();
|
|
7807
|
+
useEffect(() => {
|
|
7808
|
+
setState(state => {
|
|
7809
|
+
// @ts-expect-error -- params is not officially exposed but is included in results
|
|
7810
|
+
const isLoading = status !== 'idle' || !results || results.params === '';
|
|
7811
|
+
if (state.items === items && state.isLoading === isLoading)
|
|
7812
|
+
return state;
|
|
7813
|
+
return { ...state, isLoading, items };
|
|
7814
|
+
});
|
|
7815
|
+
}, [setState, items, status, results]);
|
|
7816
|
+
return null;
|
|
7817
|
+
}
|
|
7818
|
+
|
|
7819
|
+
function createQueryStringRouting({ algoliaIndex, hierarchicalCategories, }) {
|
|
7412
7820
|
return {
|
|
7413
7821
|
router: history({
|
|
7414
7822
|
cleanUrlOnDispose: true,
|
|
@@ -7434,7 +7842,7 @@ function createQueryStringRouting({ algoliaIndex, categoryPages, }) {
|
|
|
7434
7842
|
else {
|
|
7435
7843
|
delete queryString.page;
|
|
7436
7844
|
}
|
|
7437
|
-
if (!
|
|
7845
|
+
if (!hierarchicalCategories &&
|
|
7438
7846
|
state.hierarchicalMenu?.['hierarchicalCategories.lvl0']) {
|
|
7439
7847
|
queryString.category =
|
|
7440
7848
|
state.hierarchicalMenu['hierarchicalCategories.lvl0'].join('+');
|
|
@@ -7455,9 +7863,9 @@ function createQueryStringRouting({ algoliaIndex, categoryPages, }) {
|
|
|
7455
7863
|
refinementList[filter] = [].concat(queryString.filters?.[filter]);
|
|
7456
7864
|
return refinementList;
|
|
7457
7865
|
}, {});
|
|
7458
|
-
const hierarchicalMenu =
|
|
7866
|
+
const hierarchicalMenu = hierarchicalCategories
|
|
7459
7867
|
? {
|
|
7460
|
-
'hierarchicalCategories.lvl0':
|
|
7868
|
+
'hierarchicalCategories.lvl0': hierarchicalCategories,
|
|
7461
7869
|
}
|
|
7462
7870
|
: queryString.category
|
|
7463
7871
|
? typeof queryString.category === 'string'
|
|
@@ -7488,7 +7896,7 @@ function createQueryStringRouting({ algoliaIndex, categoryPages, }) {
|
|
|
7488
7896
|
}),
|
|
7489
7897
|
stateMapping: {
|
|
7490
7898
|
routeToState(routeState) {
|
|
7491
|
-
return simple().routeToState(!
|
|
7899
|
+
return simple().routeToState(!hierarchicalCategories
|
|
7492
7900
|
? routeState
|
|
7493
7901
|
: Object.keys(routeState).reduce((newRouteState, indexName) => {
|
|
7494
7902
|
if (!routeState[indexName])
|
|
@@ -7498,7 +7906,7 @@ function createQueryStringRouting({ algoliaIndex, categoryPages, }) {
|
|
|
7498
7906
|
[indexName]: {
|
|
7499
7907
|
...routeState[indexName],
|
|
7500
7908
|
hierarchicalMenu: {
|
|
7501
|
-
'hierarchicalCategories.lvl0':
|
|
7909
|
+
'hierarchicalCategories.lvl0': hierarchicalCategories,
|
|
7502
7910
|
},
|
|
7503
7911
|
},
|
|
7504
7912
|
};
|
|
@@ -7509,20 +7917,19 @@ function createQueryStringRouting({ algoliaIndex, categoryPages, }) {
|
|
|
7509
7917
|
};
|
|
7510
7918
|
}
|
|
7511
7919
|
|
|
7512
|
-
function
|
|
7513
|
-
const {
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
queryId: results.queryID,
|
|
7517
|
-
}, children: children }));
|
|
7518
|
-
}
|
|
7519
|
-
function AlgoliaProvider({ categoryPages, children, languageCode, offlineSearchClient, online: _online = true, query, routing, searchClient, }) {
|
|
7520
|
-
const [online] = useGlobalState('algolia', _online);
|
|
7920
|
+
function AlgoliaProvider({ categoryPages, children, hierarchicalCategories, languageCode, offlineSearchClient, online: _online = true, query, routing, searchClient, }) {
|
|
7921
|
+
const { online } = useAlgoliaInstantSearchState({
|
|
7922
|
+
online: _online,
|
|
7923
|
+
});
|
|
7521
7924
|
const algoliaIndex = getAlgoliaIndex(environment, languageCode);
|
|
7522
7925
|
return (jsxs(InstantSearch, { future: {
|
|
7523
7926
|
persistHierarchicalRootCount: true,
|
|
7524
7927
|
preserveSharedStateOnUnmount: true,
|
|
7525
|
-
}, indexName: algoliaIndex.default, insights: true, routing: routing ||
|
|
7928
|
+
}, indexName: algoliaIndex.default, insights: true, routing: routing ||
|
|
7929
|
+
createQueryStringRouting({ algoliaIndex, hierarchicalCategories }), searchClient: online ? searchClient : offlineSearchClient || searchClient, children: [jsx(Configure, { analytics: true, filters: categoryPages
|
|
7930
|
+
? // Replace double quotes with escaped double quotes to avoid breaking the query
|
|
7931
|
+
`categoryPages: "${categoryPages.replace(/"/g, '\\"')}"`
|
|
7932
|
+
: undefined, maxValuesPerFacet: 100, query: query, ruleContexts: ['storefront'] }), jsx(AlgoliaGlobalStateProvider, {}), jsx(AlgoliaProductHitsProvider, {}), jsx(AlgoliaInsightInstantSearchProvider, { children: children })] }, algoliaIndex.default));
|
|
7526
7933
|
}
|
|
7527
7934
|
function useAlgolia() {
|
|
7528
7935
|
const [online, setOnline] = useGlobalState('algolia', false);
|
|
@@ -7583,12 +7990,12 @@ function AlgoliaSortBy() {
|
|
|
7583
7990
|
return (jsx(Select, { label: t('Sort by'), onChange: value => refine(String(value)), options: options, selectedOption: currentRefinement, showLabel: false, size: "sm" }));
|
|
7584
7991
|
}
|
|
7585
7992
|
|
|
7586
|
-
var styles$
|
|
7993
|
+
var styles$k = {"category-card":"category-card-module-4NUjH","title":"category-card-module-LEhh3","arrow":"category-card-module-hL4-A","is-selected":"category-card-module-vJ7vB","image-container":"category-card-module-oNTrK"};
|
|
7587
7994
|
|
|
7588
7995
|
function CategoryCard({ href, image, isSelected = false, onClick, title, withArrow = false, }) {
|
|
7589
7996
|
return (jsxs(RouteLink, { className: clsx({
|
|
7590
|
-
[styles$
|
|
7591
|
-
}, styles$
|
|
7997
|
+
[styles$k['is-selected']]: isSelected,
|
|
7998
|
+
}, styles$k['category-card']), href: href, onClick: onClick, children: [jsx("div", { className: styles$k['image-container'], children: jsx(Image, { ...image, fit: "contain" }) }), jsxs("p", { className: styles$k.title, children: [jsx("span", { children: title }), withArrow && jsx(GlyphsArrowBoldCapsRightIcon, { className: styles$k.arrow })] })] }));
|
|
7592
7999
|
}
|
|
7593
8000
|
|
|
7594
8001
|
const ProductListingPageContext = createContext({
|
|
@@ -7617,20 +8024,26 @@ function ConnectedCategoryCarousel() {
|
|
|
7617
8024
|
}, title: category.title }, index))) }));
|
|
7618
8025
|
}
|
|
7619
8026
|
|
|
7620
|
-
var styles$
|
|
8027
|
+
var styles$j = {"blank-page-spacer":"blank-page-spacer-module-lXxle","loading-overlay":"blank-page-spacer-module-hbxDP"};
|
|
8028
|
+
|
|
8029
|
+
function BlankPageSpacer({ children }) {
|
|
8030
|
+
return jsx("div", { className: styles$j['blank-page-spacer'], children: children });
|
|
8031
|
+
}
|
|
8032
|
+
|
|
8033
|
+
var styles$i = {"promo-card":"promo-card-module-e2oii","sm":"promo-card-module-1-jT0","lg":"promo-card-module-zIYDh"};
|
|
7621
8034
|
|
|
7622
8035
|
function PromoCard({ href, image, variant }) {
|
|
7623
|
-
return (jsx(RouteLink, { className: clsx(styles$
|
|
8036
|
+
return (jsx(RouteLink, { className: clsx(styles$i['promo-card'], styles$i[variant]), href: href, children: jsx(Image, { fit: "cover", image: image, title: image.altText }) }));
|
|
7624
8037
|
}
|
|
7625
8038
|
|
|
7626
|
-
var styles$
|
|
8039
|
+
var styles$h = {"promos":"promo-cards-module-Dy4p3"};
|
|
7627
8040
|
|
|
7628
8041
|
function PromoCards({ promoCardsData = [], }) {
|
|
7629
8042
|
const { lg } = useBreakpoint();
|
|
7630
8043
|
const promoCards = promoCardsData.map((promoCard, index) => (jsx(PromoCard, { href: promoCard.href, image: promoCard.image, variant: index % 2 === 0 ? 'lg' : 'sm' }, `promo-card-${index}`)));
|
|
7631
8044
|
if (promoCardsData.length === 0)
|
|
7632
8045
|
return null;
|
|
7633
|
-
return (jsx("div", { className: styles$
|
|
8046
|
+
return (jsx("div", { className: styles$h.promos, children: lg ? (jsx(Fragment, { children: promoCards })) : (jsx(Carousel, { hasNavigation: false, hasOverflow: false, slides: promoCards, spaceBetween: 16 })) }));
|
|
7634
8047
|
}
|
|
7635
8048
|
|
|
7636
8049
|
const scrollToTop = (scrollOptions) => {
|
|
@@ -7640,17 +8053,17 @@ const scrollToTop = (scrollOptions) => {
|
|
|
7640
8053
|
});
|
|
7641
8054
|
};
|
|
7642
8055
|
|
|
7643
|
-
var styles$
|
|
8056
|
+
var styles$g = {"sidebar":"sidebar-module-fSa9Q","is-docked":"sidebar-module-AIq0M","transition":"sidebar-module-LEZgg","is-open":"sidebar-module-lV7wp","is-closed":"sidebar-module-dGDrr","close":"sidebar-module-2puGC","is-not-docked":"sidebar-module-Scw7D"};
|
|
7644
8057
|
|
|
7645
8058
|
function InnerSidebar({ children }) {
|
|
7646
8059
|
const { isDocked, isOpen, toggle, transition } = useSidebar();
|
|
7647
|
-
return (jsxs("aside", { className: clsx(styles$
|
|
7648
|
-
[styles$
|
|
7649
|
-
[styles$
|
|
7650
|
-
[styles$
|
|
7651
|
-
[styles$
|
|
7652
|
-
[styles$
|
|
7653
|
-
}), children: [jsx("div", { className: styles$
|
|
8060
|
+
return (jsxs("aside", { className: clsx(styles$g.sidebar, {
|
|
8061
|
+
[styles$g['transition']]: transition,
|
|
8062
|
+
[styles$g['is-open']]: isOpen,
|
|
8063
|
+
[styles$g['is-closed']]: !isOpen,
|
|
8064
|
+
[styles$g['is-docked']]: isDocked,
|
|
8065
|
+
[styles$g['is-not-docked']]: !isDocked,
|
|
8066
|
+
}), children: [jsx("div", { className: styles$g.close, children: jsx(IconButton, { color: "secondary", onPress: toggle, children: jsx(StrokeCloseboxIcon, {}) }) }), children] }));
|
|
7654
8067
|
}
|
|
7655
8068
|
function Sidebar({ children }) {
|
|
7656
8069
|
return jsx(InnerSidebar, { children: children });
|
|
@@ -7665,6 +8078,13 @@ const ToggleSidebarButton = () => {
|
|
|
7665
8078
|
return (jsx(Button, { color: "secondary", icon: jsx(StrokeFilterIcon, {}), onPress: toggle, size: "sm", variant: "outline", children: isOpen ? (jsx(FormattedMessage, { id: "Hide filters" })) : (jsx(FormattedMessage, { id: "Show filters" })) }));
|
|
7666
8079
|
};
|
|
7667
8080
|
|
|
8081
|
+
var styles$f = {"no-results":"no-results-module-T1cti","title":"no-results-module-mZ8TQ","body":"no-results-module-FQGhC","buttons":"no-results-module-QGZsD"};
|
|
8082
|
+
|
|
8083
|
+
function NoResults$1({ content, title }) {
|
|
8084
|
+
const { lg } = useBreakpoint();
|
|
8085
|
+
return (jsxs("div", { className: styles$f['no-results'], children: [jsx(Heading, { bold: false, className: styles$f.title, size: lg ? 's' : 'xs', tag: "h2", children: title }), jsx("p", { className: styles$f.body, children: content }), jsx("div", { className: styles$f.buttons, children: jsx(RouteButton, { withArrow: true, href: `${config.SHOP_API_URL}`, size: "md", children: jsx(FormattedMessage, { id: "Continue shopping" }) }) })] }));
|
|
8086
|
+
}
|
|
8087
|
+
|
|
7668
8088
|
var styles$e = {"product-listing":"product-listing-page-module-dmIHF","header":"product-listing-page-module-Oz76Z","promos":"product-listing-page-module-iY1yj","action-bar":"product-listing-page-module-XxGrr","sidebar-toggle":"product-listing-page-module-F7bxy","sort":"product-listing-page-module-aQzHr","count":"product-listing-page-module-zx79v","categories":"product-listing-page-module-R4aOl","product-grid-container":"product-listing-page-module-ICkKg","product-grid":"product-listing-page-module-LHE7z","pagination":"product-listing-page-module-xsRaj"};
|
|
7669
8089
|
|
|
7670
8090
|
function ProductListingPage({ pageUrl, searchClient: _searchClient, }) {
|
|
@@ -7677,7 +8097,7 @@ function ProductListingPage({ pageUrl, searchClient: _searchClient, }) {
|
|
|
7677
8097
|
createSonicSearchClient({
|
|
7678
8098
|
apiKey: config.ALGOLIA_API_KEY,
|
|
7679
8099
|
appId: config.ALGOLIA_APP_ID,
|
|
7680
|
-
host: config.
|
|
8100
|
+
host: config.ALGOLIA_HOST,
|
|
7681
8101
|
}), [_searchClient]);
|
|
7682
8102
|
if (isError) {
|
|
7683
8103
|
if (!isRequestError(error))
|
|
@@ -7686,17 +8106,22 @@ function ProductListingPage({ pageUrl, searchClient: _searchClient, }) {
|
|
|
7686
8106
|
return (jsxs("h1", { children: [error.status, " - ", error.statusText] }));
|
|
7687
8107
|
}
|
|
7688
8108
|
if (!data || isFetching) {
|
|
7689
|
-
return jsx(LoadingOverlay, {});
|
|
8109
|
+
return (jsx(BlankPageSpacer, { children: jsx(LoadingOverlay, {}) }));
|
|
7690
8110
|
}
|
|
7691
8111
|
const category = data.breadCrumb.slice(1).map(breadCrumb => breadCrumb.label);
|
|
7692
|
-
return (jsx(ProductListingPageProvider, { data: data, error: error, isError: isError, isLoading: isFetching, children: jsx(AlgoliaProvider, { categoryPages: data.categoryPages, languageCode: languageCode, offlineSearchClient: offlineSearchClient, searchClient: searchClient, children: jsx(Page, { breadCrumb: data.breadCrumb, className: styles$e['product-listing'], title: category.slice().pop(), children: jsx(ProductListingPageContent, { promoCards: data.promoCards?.top }) }) }) }));
|
|
8112
|
+
return (jsx(ProductListingPageProvider, { data: data, error: error, isError: isError, isLoading: isFetching, children: jsx(AlgoliaProvider, { categoryPages: data.categoryPages, hierarchicalCategories: data.hierarchicalCategories, languageCode: languageCode, offlineSearchClient: offlineSearchClient, searchClient: searchClient, children: jsx(Page, { breadCrumb: data.breadCrumb, className: styles$e['product-listing'], title: category.slice().pop(), children: jsx(ProductListingPageContent, { promoCards: data.promoCards?.top }) }) }) }));
|
|
7693
8113
|
}
|
|
7694
8114
|
function ProductListingPageContent({ promoCards, }) {
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
8115
|
+
const { isLoading, products } = useAlgoliaProductHits();
|
|
8116
|
+
const hasProducts = products.length > 0;
|
|
8117
|
+
const t = useFormattedMessage();
|
|
8118
|
+
return (jsxs(Fragment, { children: [isLoading !== false && !hasProducts && jsx(LoadingOverlay, {}), isLoading === false && !hasProducts && (jsx(NoResults$1, { content: jsxs("p", { children: [jsx(FormattedMessage, { id: "You could try exploring our products by category" }), ' ', jsx("br", {}), jsx(FormattedMessage, { id: "Try 'Search' and try to find the product you're looking for" })] }), title: t('Sorry, there are no products found') })), jsxs("div", { style: {
|
|
8119
|
+
display: !hasProducts ? 'none' : undefined,
|
|
8120
|
+
}, children: [promoCards?.length && (jsx("section", { className: styles$e.promos, children: jsx(PromoCards, { promoCardsData: promoCards }) })), jsx("section", { className: styles$e.categories, children: jsx(ConnectedCategoryCarousel, {}) }), jsxs("section", { className: styles$e['action-bar'], children: [jsx("div", { className: styles$e['sidebar-toggle'], children: jsx(ToggleSidebarButton, {}) }), jsx("span", { className: styles$e.count, children: jsx(AlgoliaResultsCount, {}) }), jsx("div", { className: styles$e.sort, children: jsx(AlgoliaSortBy, {}) })] }), jsx("section", { children: jsxs("div", { className: styles$e['product-grid-container'], children: [jsx(Sidebar, { children: jsx(AlgoliaFilterPanel, { showActiveCategories: true }) }), jsxs("div", { className: styles$e['product-grid'], children: [jsx(ProductOverview, {}), jsx("div", { className: styles$e.pagination, children: jsx(AlgoliaPagination, { onChange: () => {
|
|
8121
|
+
setTimeout(() => {
|
|
8122
|
+
scrollToTop();
|
|
8123
|
+
}, 100);
|
|
8124
|
+
} }) })] })] }) })] })] }));
|
|
7700
8125
|
}
|
|
7701
8126
|
|
|
7702
8127
|
var styles$d = {"search-results":"search-results-page-module-M7SIu","header":"search-results-page-module-DpNT-","action-bar":"search-results-page-module-RJoMk","sidebar-toggle":"search-results-page-module-SzLQb","sort":"search-results-page-module-cgonp","count":"search-results-page-module-hunZp","categories":"search-results-page-module-n2lSj","product-grid-container":"search-results-page-module-TK-iE","product-grid":"search-results-page-module-HWUnk","pagination":"search-results-page-module-SZYiA"};
|
|
@@ -7710,10 +8135,21 @@ function SearchResultsPage({ location, searchClient, }) {
|
|
|
7710
8135
|
return jsx("h1", { children: "No search results...." });
|
|
7711
8136
|
return (jsx(AlgoliaProvider, { languageCode: languageCode, query: keyword, searchClient: searchClient, children: jsx(Page, { breadCrumb: [], className: styles$d['search-results'], title: t("'{0}' in all products", {
|
|
7712
8137
|
replacementValues: { 0: keyword },
|
|
7713
|
-
}), children: jsx(SearchResultsPageContent, {}) }) }));
|
|
8138
|
+
}), children: jsx(SearchResultsPageContent, { keyword: keyword }) }) }));
|
|
7714
8139
|
}
|
|
7715
|
-
function SearchResultsPageContent() {
|
|
7716
|
-
|
|
8140
|
+
function SearchResultsPageContent({ keyword }) {
|
|
8141
|
+
const { isLoading, products } = useAlgoliaProductHits();
|
|
8142
|
+
const hasProducts = products.length > 0;
|
|
8143
|
+
const t = useFormattedMessage();
|
|
8144
|
+
return (jsxs(Fragment, { children: [isLoading !== false && !hasProducts && jsx(LoadingOverlay, {}), isLoading === false && !hasProducts && (jsx(NoResults$1, { content: jsxs("p", { children: [jsx(FormattedMessage, { id: "You could try checking the spelling of your search query" }), jsx("br", {}), jsx(FormattedMessage, { id: "Try another search" }), jsx("br", {}), jsx(FormattedMessage, { id: "Are you looking for information about our service? Please visit our customer support page" })] }), title: t("Unfortnately, We found no articles for your search '{0}'", {
|
|
8145
|
+
replacementValues: { 0: keyword },
|
|
8146
|
+
}) })), jsxs("div", { style: {
|
|
8147
|
+
display: !hasProducts ? 'none' : undefined,
|
|
8148
|
+
}, children: [jsxs("section", { className: styles$d['action-bar'], children: [jsx("div", { className: styles$d['sidebar-toggle'], children: jsx(ToggleSidebarButton, {}) }), jsx("span", { className: styles$d.count, children: jsx(AlgoliaResultsCount, {}) }), jsx("div", { className: styles$d.sort, children: jsx(AlgoliaSortBy, {}) })] }), jsx("section", { children: jsxs("div", { className: styles$d['product-grid-container'], children: [jsx(Sidebar, { children: jsx(AlgoliaFilterPanel, { showCategoriesFilters: true }) }), jsxs("div", { className: styles$d['product-grid'], children: [jsx(ProductOverview, {}), jsx("div", { className: styles$d.pagination, children: jsx(AlgoliaPagination, { onChange: () => {
|
|
8149
|
+
setTimeout(() => {
|
|
8150
|
+
scrollToTop();
|
|
8151
|
+
}, 100);
|
|
8152
|
+
} }) })] })] }) })] })] }));
|
|
7717
8153
|
}
|
|
7718
8154
|
|
|
7719
8155
|
var styles$c = {"overlay-background":"overlay-background-module-j7R7T","open":"overlay-background-module-DZWsP","close":"overlay-background-module-8pcWN"};
|
|
@@ -7980,7 +8416,7 @@ function AlgoliaSearchProvider({ children, searchClient: _searchClient, }) {
|
|
|
7980
8416
|
createSonicSearchClient({
|
|
7981
8417
|
apiKey: config.ALGOLIA_API_KEY,
|
|
7982
8418
|
appId: config.ALGOLIA_APP_ID,
|
|
7983
|
-
host: config.
|
|
8419
|
+
host: config.ALGOLIA_HOST,
|
|
7984
8420
|
}), [_searchClient]);
|
|
7985
8421
|
const languageCode = useLanguageCode();
|
|
7986
8422
|
const index = getAlgoliaIndex(environment, languageCode);
|
|
@@ -7991,6 +8427,7 @@ function AlgoliaSearchProvider({ children, searchClient: _searchClient, }) {
|
|
|
7991
8427
|
* https://www.algolia.com/doc/ui-libraries/autocomplete/guides/creating-a-renderer/#mirror-a-native-mobile-experience
|
|
7992
8428
|
*/
|
|
7993
8429
|
const autocomplete = useMemo(() => createAutocomplete({
|
|
8430
|
+
autoFocus: true,
|
|
7994
8431
|
insights: {
|
|
7995
8432
|
onSelect({ insightsEvents }) {
|
|
7996
8433
|
insightsEvents.forEach(event => {
|
|
@@ -8134,7 +8571,7 @@ function StrokeSearchIcon(props) {
|
|
|
8134
8571
|
|
|
8135
8572
|
var styles$9 = {"form":"search-input-module-xCCzd","input-container":"search-input-module-okP8k","icon":"search-input-module-GZbhK","label":"search-input-module-vKCm4","reset-btn":"search-input-module-lYseZ","input":"search-input-module-bELFK"};
|
|
8136
8573
|
|
|
8137
|
-
function SearchInput({ autocomplete, formRef, inputRef, onCancel, }) {
|
|
8574
|
+
function SearchInput({ autocomplete, formRef, inputRef, onCancel, onSubmit, placeholder, }) {
|
|
8138
8575
|
const formProps = autocomplete?.getFormProps({
|
|
8139
8576
|
inputElement: inputRef.current,
|
|
8140
8577
|
});
|
|
@@ -8142,16 +8579,27 @@ function SearchInput({ autocomplete, formRef, inputRef, onCancel, }) {
|
|
|
8142
8579
|
inputElement: inputRef.current,
|
|
8143
8580
|
});
|
|
8144
8581
|
const labelProps = autocomplete?.getLabelProps({});
|
|
8145
|
-
|
|
8582
|
+
function handleSubmit(e) {
|
|
8583
|
+
if (!inputProps?.value)
|
|
8584
|
+
return;
|
|
8585
|
+
formProps?.onSubmit(e);
|
|
8586
|
+
onSubmit?.();
|
|
8587
|
+
}
|
|
8588
|
+
return (jsx("form", { ref: formRef, className: styles$9.form, ...formProps, onSubmit: handleSubmit, children: jsxs("div", { className: styles$9['input-container'], children: [jsx("label", { className: styles$9.label, ...labelProps, children: jsx(StrokeSearchIcon, { className: clsx(styles$9['icon-search'], styles$9.icon) }) }), jsx("input", { ref: inputRef, onKeyUp: e => {
|
|
8146
8589
|
if (e.key === 'Escape')
|
|
8147
8590
|
onCancel?.();
|
|
8148
|
-
}, ...inputProps, className: styles$9.input }), inputProps?.value && (jsx(IconButton, { className: styles$9['reset-btn'], color: "secondary", onPress: () => formRef.current?.reset(), type: "reset", children: jsx(SolidCloseIcon, {}) }))] }) }));
|
|
8591
|
+
}, ...inputProps, className: styles$9.input, placeholder: placeholder }), inputProps?.value && (jsx(IconButton, { className: styles$9['reset-btn'], color: "secondary", onPress: () => formRef.current?.reset(), type: "reset", children: jsx(SolidCloseIcon, {}) }))] }) }));
|
|
8149
8592
|
}
|
|
8150
8593
|
|
|
8151
8594
|
function ConnectedSearchInput() {
|
|
8152
8595
|
const { autocomplete, formRef, inputRef } = useAlgoliaSearch();
|
|
8153
8596
|
const { close } = useGlobalSearchDisclosure();
|
|
8154
|
-
|
|
8597
|
+
const t = useFormattedMessage();
|
|
8598
|
+
const navigate = useNavigate();
|
|
8599
|
+
return (jsx(SearchInput, { autocomplete: autocomplete, formRef: formRef, inputRef: inputRef, onCancel: close, onSubmit: () => {
|
|
8600
|
+
navigate(`/search?keyword=${inputRef.current?.value}`);
|
|
8601
|
+
return close();
|
|
8602
|
+
}, placeholder: t('Search tools, toolsets, boxes and more') }));
|
|
8155
8603
|
}
|
|
8156
8604
|
|
|
8157
8605
|
var styles$8 = {"categories-grid":"categories-grid-module-C751R","category":"categories-grid-module-7OZS1"};
|
|
@@ -8173,7 +8621,7 @@ function SearchSection({ button, children, className, title, }) {
|
|
|
8173
8621
|
var styles$6 = {"section-container":"search-content-module-ZMwlB","content":"search-content-module-KIok6","left":"search-content-module-YRLIf","right":"search-content-module-qK5sg","button-container":"search-content-module-w-ORq","show-all-button":"search-content-module-bO1Q0","product-results":"search-content-module-bcFCH","no-results-text":"search-content-module-H-FX2","query":"search-content-module-LbQnK","suggestions":"search-content-module-mhiBZ","list":"search-content-module-coPAt"};
|
|
8174
8622
|
|
|
8175
8623
|
function SectionContainer({ buttons, leftContent, rightContent, }) {
|
|
8176
|
-
return (
|
|
8624
|
+
return (jsx("div", { className: styles$6['section-container'], children: jsxs("div", { className: styles$6['content'], children: [jsx("div", { className: styles$6['left'], children: leftContent }), jsxs("div", { className: styles$6['right'], children: [rightContent, jsx("div", { className: styles$6['button-container'], children: buttons })] })] }) }));
|
|
8177
8625
|
}
|
|
8178
8626
|
|
|
8179
8627
|
function NoResults() {
|
|
@@ -8240,7 +8688,7 @@ function RecentSearchesSection() {
|
|
|
8240
8688
|
return null;
|
|
8241
8689
|
}
|
|
8242
8690
|
const { items, source } = collection;
|
|
8243
|
-
return (jsx(SearchSection, { button: jsx(
|
|
8691
|
+
return (jsx(SearchSection, { button: jsx(RouteLink, { hasUnderline: true, onPress: () => items.forEach(item => source.onRemove(item.id)), children: jsx(FormattedMessage, { id: "Clear" }) }), title: t('Recent searches'), children: jsx(SearchList, { ...autocomplete.getListProps({ source }), children: items.map(item => (jsx(SearchListItem, { ...autocomplete.getItemProps({
|
|
8244
8692
|
item,
|
|
8245
8693
|
source: source,
|
|
8246
8694
|
}), icon: jsx(StrokeSearchIcon, {}), isRemovable: true, onRemove: () => source.onRemove(item.id), text: jsx(Highlight, { attribute: "label", hit: item }) }, item.id))) }) }));
|
|
@@ -8369,9 +8817,9 @@ const queryClient = new QueryClient({
|
|
|
8369
8817
|
defaultOptions: {
|
|
8370
8818
|
queries: {
|
|
8371
8819
|
/* Set gcTime and staleTime to 0 to disable react query cache */
|
|
8372
|
-
gcTime:
|
|
8820
|
+
gcTime: 1 * TIME.DAY,
|
|
8373
8821
|
retry: false,
|
|
8374
|
-
staleTime:
|
|
8822
|
+
staleTime: 1 * TIME.DAY,
|
|
8375
8823
|
},
|
|
8376
8824
|
},
|
|
8377
8825
|
});
|
|
@@ -8379,4 +8827,4 @@ function ReactQueryContainer({ children }) {
|
|
|
8379
8827
|
return (jsx(QueryClientProvider, { client: queryClient, children: children }));
|
|
8380
8828
|
}
|
|
8381
8829
|
|
|
8382
|
-
export { Accordion, AddToCartButton, AlgoliaActiveCategories, AlgoliaCategoriesFilters, AlgoliaFilterPanel,
|
|
8830
|
+
export { Accordion, AddToCartButton, AlgoliaActiveCategories, AlgoliaCategoriesFilters, AlgoliaFilterPanel, AlgoliaInsightsProvider, AlgoliaInsightsProviderContext, AlgoliaMultiSelectFilterSection, AlgoliaPagination, AlgoliaProvider, AlgoliaResultsCount, AlgoliaSortBy, AvailabilityMessageType, BadRequestError, BadgeImagePlacementValues, BadgeStyleValues, BadgeTypeValues, Breadcrumb, Button, CartProvider, CategoryCarousel, Checkbox, ColorCheckbox, ConnectedAddToCartButton, CurrencyPositioningType, FavoriteButton, FavoriteProvider, FilterSection, ForbiddenRequestError, FormattedMessage, GlobalSearch, GlobalSearchContainer, GlobalSearchDisclosureContext, GlobalStateProvider, GlobalStateProviderContext, IconButton, Image, InternalServerErrorRequest, IntlProvider, Link, LoadingOverlay, MultiSelect, NotFoundRequestError, NumberField, Page, PageContainer, ProductCard, ProductListingPage, ProductOverviewGrid, ProductPrice, ProductSku, ProgressCircle, ReactQueryContainer, RequestError, RouteButton, RouteLink, RouteProvider, SearchResultsPage, Select, ShowAll, Sidebar, SidebarDetectBreakpoint, SidebarProvider, TextField, TimeoutRequestError, UnauthorizedRequestError, UnprocessableContentRequestError, VariantDisplayTypeValues, WishListNameAlreadyExistsError, addProductToCurrentCart, addWishList, addWishListItemToWishList, config, configPerEnvironment, createSession, createSonicSearchClient, createWishList, deleteCartLineById, deleteWishList, deleteWishListItemFromWishList, fetchCurrentCartLines, fetchTranslations, getSession, getWishList, getWishListItemsByWishListId, getWishLists, isRequestError, removeWishListItemFromWishList, request, signIn, signOut, transformAlgoliaProductHitToProductHit, updateCartLineById, useAddProductToCurrentCart, useAddWishList, useAddWishListItemToCurrentWishList, useAddWishListItemToWishList, useAlgolia, useAlgoliaInsights, useAlgoliaSearch, useBreakpoint, useCartEvents, useCreateCurrentWishList, useDebouncedCallback, useDeleteCartLineById, useDeleteWishListItemFromWishList, useDisclosure, useFavorite, useFavoriteProduct, useFeatureFlags, useFetchAllWishListsItems, useFetchCurrentCartLines, useFetchProductListingPageData, useFetchTranslations, useFetchWishLists, useFormattedMessage, useGlobalSearchDisclosure, useGlobalState, useIsAuthenticated, useNavigate, useRemoveWishListItemFromCurrentWishList, useScrollLock, useSession, useSignIn, useSignOut, useUpdateCartLineById, userToken, userTokenEventEmitter };
|