@sonic-equipment/ui 0.0.89 → 0.0.91
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 +85 -36
- package/dist/index.js +239 -194
- package/dist/src/algolia/{algolia-product-hit-type.d.ts → algolia-hit-type.d.ts} +17 -2
- package/dist/src/algolia/algolia-hits-provider.d.ts +6 -0
- package/dist/src/algolia/use-algolia-hits.d.ts +10 -0
- package/dist/src/algolia/use-algolia-search.d.ts +3 -3
- package/dist/src/carousel/card-carousel/card-carousel.d.ts +10 -0
- package/dist/src/carousel/{product-carousel/product-carousel.stories.d.ts → card-carousel/product-card-carousel.stories.d.ts} +3 -3
- package/dist/src/carousel/card-carousel/promo-card-carousel.stories.d.ts +20 -0
- package/dist/src/carousel/promo-card-carousel/promo-card-carousel.d.ts +10 -0
- package/dist/src/config.d.ts +1 -0
- package/dist/src/global-search/types.d.ts +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/pages/product-listing-page/product-listing-page-data-types.d.ts +3 -3
- package/dist/src/promos/promo-banner/promo-banner.d.ts +7 -0
- package/dist/src/promos/promo-banner/promo-banner.stories.d.ts +19 -0
- package/dist/src/promos/promo-banners/promo-banners.d.ts +8 -0
- package/dist/src/promos/{promo-cards/promo-cards.stories.d.ts → promo-banners/promo-banners.stories.d.ts} +3 -3
- package/dist/src/promos/promo-card/promo-card.d.ts +5 -5
- package/dist/src/promos/promo-card/promo-card.stories.d.ts +1 -8
- package/dist/src/shared/api/bff/model/bff.model.d.ts +4 -4
- package/dist/src/shared/model/{product-hit.d.ts → hit.d.ts} +12 -1
- package/dist/styles.css +97 -66
- package/package.json +1 -1
- package/dist/src/algolia/algolia-products-hits-provider.d.ts +0 -6
- package/dist/src/algolia/use-algolia-product-hits.d.ts +0 -10
- package/dist/src/carousel/product-carousel/product-carousel.d.ts +0 -10
- package/dist/src/promos/promo-cards/promo-cards.d.ts +0 -8
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { Hit } from '@algolia/client-search';
|
|
2
|
-
|
|
2
|
+
import { Image } from 'shared/model/image';
|
|
3
|
+
interface AlgoliaHitBase {
|
|
3
4
|
[key: string]: any;
|
|
5
|
+
type: 'promo' | 'product';
|
|
6
|
+
}
|
|
7
|
+
export interface AlgoliaPromo extends AlgoliaHitBase {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
image: Image;
|
|
10
|
+
isExternal: boolean;
|
|
11
|
+
type: 'promo';
|
|
12
|
+
url: string;
|
|
13
|
+
}
|
|
14
|
+
export interface AlgoliaProduct extends AlgoliaHitBase {
|
|
15
|
+
[key: string]: unknown;
|
|
4
16
|
alternativeNumber: string;
|
|
5
17
|
categories: string[];
|
|
6
18
|
categoryPageId: string[];
|
|
@@ -32,9 +44,12 @@ interface AlgoliaProduct {
|
|
|
32
44
|
slug: string;
|
|
33
45
|
storefrontId: string;
|
|
34
46
|
storefrontSlug: string;
|
|
35
|
-
type: '
|
|
47
|
+
type: 'product';
|
|
36
48
|
weight: number;
|
|
37
49
|
width: number;
|
|
38
50
|
}
|
|
51
|
+
export declare function isAlgoliaProductHit(hit: AlgoliaHit): hit is AlgoliaProductHit;
|
|
52
|
+
export type AlgoliaPromoHit = Hit<AlgoliaPromo>;
|
|
39
53
|
export type AlgoliaProductHit = Hit<AlgoliaProduct>;
|
|
54
|
+
export type AlgoliaHit = AlgoliaPromoHit | AlgoliaProductHit;
|
|
40
55
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ProductHit, PromoHit } from 'shared/model/hit';
|
|
2
|
+
import { AlgoliaHit } from './algolia-hit-type';
|
|
3
|
+
export declare const useAlgoliaHitsItems: () => [AlgoliaHit[], import("shared/providers/global-state-provider").UpdateGlobalState<AlgoliaHit[]>];
|
|
4
|
+
export declare const useAlgoliaHitsLoading: () => [boolean | undefined, import("shared/providers/global-state-provider").UpdateGlobalState<boolean | undefined>];
|
|
5
|
+
interface UseHitsReturnType {
|
|
6
|
+
hits: (ProductHit | PromoHit)[];
|
|
7
|
+
isLoading: boolean | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function useAlgoliaHits(): UseHitsReturnType;
|
|
10
|
+
export {};
|
|
@@ -5,7 +5,7 @@ import { PopularSearchHit } from 'global-search/plugins/popular-searches-plugin'
|
|
|
5
5
|
import { QuerySuggestionHit } from 'global-search/plugins/query-suggestions-plugin';
|
|
6
6
|
import { QuickAccessHit } from 'global-search/plugins/quick-access-plugin';
|
|
7
7
|
import { RecentSearchHit } from 'global-search/plugins/recent-searches-plugin';
|
|
8
|
-
import {
|
|
8
|
+
import { AlgoliaHit } from './algolia-hit-type';
|
|
9
9
|
interface ExtendedAutoCompleteCollection<T extends BaseItem> extends AutocompleteCollection<T> {
|
|
10
10
|
source: ExtendedInternalAutocompleteSource<T>;
|
|
11
11
|
}
|
|
@@ -18,8 +18,8 @@ export declare function useAlgoliaSearch(): {
|
|
|
18
18
|
popularCategories: AutocompleteCollection<PopularCategoryHit> | undefined;
|
|
19
19
|
popularSearches: AutocompleteCollection<PopularSearchHit> | undefined;
|
|
20
20
|
products: {
|
|
21
|
-
items: import("shared/model/
|
|
22
|
-
source: InternalAutocompleteSource<
|
|
21
|
+
items: (import("shared/model/hit").PromoHit | import("shared/model/hit").ProductHit)[];
|
|
22
|
+
source: InternalAutocompleteSource<AlgoliaHit>;
|
|
23
23
|
} | undefined;
|
|
24
24
|
querySuggestions: AutocompleteCollection<QuerySuggestionHit> | undefined;
|
|
25
25
|
quickAccess: AutocompleteCollection<QuickAccessHit> | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CarouselProps } from 'carousel/carousel';
|
|
3
|
+
export interface CardCarouselProps {
|
|
4
|
+
allowExpandToGrid?: boolean;
|
|
5
|
+
cardWidth?: 'normal' | 'narrow' | 'auto';
|
|
6
|
+
cards: ReactNode[];
|
|
7
|
+
cardsPerView?: CarouselProps['slidesPerView'];
|
|
8
|
+
hasOverflow?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function CardCarousel({ allowExpandToGrid, cards, cardsPerView, cardWidth, hasOverflow, }: CardCarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { StoryObj } from '@storybook/react';
|
|
2
|
-
import {
|
|
2
|
+
import { CardCarousel } from './card-carousel';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
args: {
|
|
5
|
-
|
|
5
|
+
cards: import("react/jsx-runtime").JSX.Element[];
|
|
6
6
|
};
|
|
7
|
-
component: typeof
|
|
7
|
+
component: typeof CardCarousel;
|
|
8
8
|
parameters: {
|
|
9
9
|
layout: string;
|
|
10
10
|
tags: string[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import { CardCarousel } from './card-carousel';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
args: {
|
|
5
|
+
cards: import("react/jsx-runtime").JSX.Element[];
|
|
6
|
+
};
|
|
7
|
+
component: typeof CardCarousel;
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: string;
|
|
10
|
+
tags: string[];
|
|
11
|
+
};
|
|
12
|
+
title: string;
|
|
13
|
+
};
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
export declare const Small: Story;
|
|
17
|
+
export declare const Medium: Story;
|
|
18
|
+
export declare const Large: Story;
|
|
19
|
+
export declare const Narrow: Story;
|
|
20
|
+
export declare const Hover: Story;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CarouselProps } from 'carousel/carousel';
|
|
3
|
+
interface PromoCardCarouselProps {
|
|
4
|
+
cardWidth?: 'normal' | 'narrow' | 'auto';
|
|
5
|
+
hasOverflow?: boolean;
|
|
6
|
+
promoCards: ReactNode[];
|
|
7
|
+
promosPerView?: CarouselProps['slidesPerView'];
|
|
8
|
+
}
|
|
9
|
+
export declare function PromoCardCarousel({ promoCards }: PromoCardCarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
package/dist/src/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AutocompleteApi, AutocompleteState as _AutocompleteState } from '@algolia/autocomplete-core';
|
|
2
|
-
import { AlgoliaProductHit } from 'algolia/algolia-
|
|
2
|
+
import { AlgoliaProductHit } from 'algolia/algolia-hit-type';
|
|
3
3
|
import { SearchClient } from 'algoliasearch';
|
|
4
4
|
import { CategoryHit } from './plugins/categories-plugin';
|
|
5
5
|
import { PopularCategoryHit } from './plugins/popular-categories-plugin';
|
package/dist/src/index.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export * from './shared/providers/global-state-provider';
|
|
|
34
34
|
export * from './shared/routing/route-provider';
|
|
35
35
|
export * from './shared/routing/route-link';
|
|
36
36
|
export * from './shared/routing/route-button';
|
|
37
|
-
export * from './shared/model/
|
|
37
|
+
export * from './shared/model/hit';
|
|
38
38
|
export * from './breadcrumbs/breadcrumb';
|
|
39
39
|
export * from './buttons/button/button';
|
|
40
40
|
export * from './buttons/favorite/favorite-button';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Image, ResponsiveImage } from 'shared/model/image';
|
|
2
|
-
export interface
|
|
2
|
+
export interface PromoBanner {
|
|
3
3
|
href: string;
|
|
4
4
|
image: ResponsiveImage;
|
|
5
5
|
}
|
|
@@ -17,8 +17,8 @@ export interface ProductListingPageData {
|
|
|
17
17
|
category: Category | undefined;
|
|
18
18
|
categoryPages: string;
|
|
19
19
|
hierarchicalCategories: string[];
|
|
20
|
-
|
|
21
|
-
top:
|
|
20
|
+
promoBanners?: {
|
|
21
|
+
top: PromoBanner[] | undefined;
|
|
22
22
|
};
|
|
23
23
|
subcategories: Category[] | undefined;
|
|
24
24
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ResponsiveImage } from 'shared/model/image';
|
|
2
|
+
export interface PromoBannerProps {
|
|
3
|
+
href?: string;
|
|
4
|
+
image: ResponsiveImage;
|
|
5
|
+
variant: 'sm' | 'lg';
|
|
6
|
+
}
|
|
7
|
+
export declare function PromoBanner({ href, image, variant }: PromoBannerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
import { PromoBanner } from './promo-banner';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
component: typeof PromoBanner;
|
|
5
|
+
parameters: {
|
|
6
|
+
layout: string;
|
|
7
|
+
};
|
|
8
|
+
tags: string[];
|
|
9
|
+
title: string;
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
export declare const SmallSVP: Story;
|
|
14
|
+
export declare const SmallMVP: Story;
|
|
15
|
+
export declare const SmallLVP: Story;
|
|
16
|
+
export declare const LargeSVP: Story;
|
|
17
|
+
export declare const LargeMVP: Story;
|
|
18
|
+
export declare const LargeLVP: Story;
|
|
19
|
+
export declare const NoLink: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ResponsiveImage } from 'shared/model/image';
|
|
2
|
+
export interface PromoBannersProps {
|
|
3
|
+
promoBannersData?: Array<{
|
|
4
|
+
href: string;
|
|
5
|
+
image: ResponsiveImage;
|
|
6
|
+
}>;
|
|
7
|
+
}
|
|
8
|
+
export declare function PromoBanners({ promoBannersData }: PromoBannersProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react';
|
|
2
|
-
import {
|
|
2
|
+
import { PromoBanners } from './promo-banners';
|
|
3
3
|
declare const meta: {
|
|
4
|
-
component: typeof
|
|
4
|
+
component: typeof PromoBanners;
|
|
5
5
|
parameters: {
|
|
6
6
|
layout: string;
|
|
7
7
|
};
|
|
8
|
-
render: (args: import("./promo-
|
|
8
|
+
render: (args: import("./promo-banners").PromoBannersProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
tags: string[];
|
|
10
10
|
title: string;
|
|
11
11
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Image as ImageType } from 'shared/model/image';
|
|
2
2
|
export interface PromoCardProps {
|
|
3
|
-
href
|
|
4
|
-
image:
|
|
5
|
-
|
|
3
|
+
href: string;
|
|
4
|
+
image: ImageType;
|
|
5
|
+
onClick?: () => void;
|
|
6
6
|
}
|
|
7
|
-
export declare function PromoCard({ href, image,
|
|
7
|
+
export declare function PromoCard({ href, image, onClick }: PromoCardProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,15 +5,8 @@ declare const meta: {
|
|
|
5
5
|
parameters: {
|
|
6
6
|
layout: string;
|
|
7
7
|
};
|
|
8
|
-
tags: string[];
|
|
9
8
|
title: string;
|
|
10
9
|
};
|
|
11
10
|
export default meta;
|
|
12
11
|
type Story = StoryObj<typeof meta>;
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const SmallMVP: Story;
|
|
15
|
-
export declare const SmallLVP: Story;
|
|
16
|
-
export declare const LargeSVP: Story;
|
|
17
|
-
export declare const LargeMVP: Story;
|
|
18
|
-
export declare const LargeLVP: Story;
|
|
19
|
-
export declare const NoLink: Story;
|
|
12
|
+
export declare const Default: Story;
|
|
@@ -26,12 +26,12 @@ interface Category {
|
|
|
26
26
|
uri: null;
|
|
27
27
|
urlSegment: string;
|
|
28
28
|
}
|
|
29
|
-
interface
|
|
29
|
+
interface PromoBanner {
|
|
30
30
|
href: string;
|
|
31
31
|
image: ResponsiveImage;
|
|
32
32
|
}
|
|
33
|
-
interface
|
|
34
|
-
top:
|
|
33
|
+
interface PromoBanners {
|
|
34
|
+
top: PromoBanner[] | null;
|
|
35
35
|
}
|
|
36
36
|
interface BreadCrumb {
|
|
37
37
|
href: string;
|
|
@@ -141,6 +141,6 @@ export interface ProductListingPageDataResponse {
|
|
|
141
141
|
categories: Category | null;
|
|
142
142
|
categoryPages: string;
|
|
143
143
|
hierarchicalCategories: string[];
|
|
144
|
-
|
|
144
|
+
promoBanners: PromoBanners | null;
|
|
145
145
|
}
|
|
146
146
|
export {};
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
import { AlgoliaProductHit } from 'algolia/algolia-
|
|
1
|
+
import { AlgoliaProductHit, AlgoliaPromoHit } from 'algolia/algolia-hit-type';
|
|
2
2
|
import { Image } from 'shared/model/image';
|
|
3
|
+
export declare function transformAlgoliaPromoHitToPromoHit(algoliaPromoHit: AlgoliaPromoHit): PromoHit;
|
|
3
4
|
export declare function transformAlgoliaProductHitToProductHit(algoliaProductHit: AlgoliaProductHit): ProductHit;
|
|
5
|
+
export interface PromoHit {
|
|
6
|
+
hit: AlgoliaPromoHit;
|
|
7
|
+
href: string;
|
|
8
|
+
id: string;
|
|
9
|
+
image: Image;
|
|
10
|
+
isExternal: boolean;
|
|
11
|
+
type: 'promo';
|
|
12
|
+
}
|
|
4
13
|
export interface ProductHit {
|
|
5
14
|
hit: AlgoliaProductHit;
|
|
6
15
|
id: string;
|
|
@@ -15,4 +24,6 @@ export interface ProductHit {
|
|
|
15
24
|
queryId: string | undefined;
|
|
16
25
|
storefrontId: string;
|
|
17
26
|
storefrontSlug: string;
|
|
27
|
+
type: 'product';
|
|
18
28
|
}
|
|
29
|
+
export declare function isProductHit(hit: ProductHit | PromoHit): hit is ProductHit;
|