@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.
Files changed (28) hide show
  1. package/dist/index.d.ts +85 -36
  2. package/dist/index.js +239 -194
  3. package/dist/src/algolia/{algolia-product-hit-type.d.ts → algolia-hit-type.d.ts} +17 -2
  4. package/dist/src/algolia/algolia-hits-provider.d.ts +6 -0
  5. package/dist/src/algolia/use-algolia-hits.d.ts +10 -0
  6. package/dist/src/algolia/use-algolia-search.d.ts +3 -3
  7. package/dist/src/carousel/card-carousel/card-carousel.d.ts +10 -0
  8. package/dist/src/carousel/{product-carousel/product-carousel.stories.d.ts → card-carousel/product-card-carousel.stories.d.ts} +3 -3
  9. package/dist/src/carousel/card-carousel/promo-card-carousel.stories.d.ts +20 -0
  10. package/dist/src/carousel/promo-card-carousel/promo-card-carousel.d.ts +10 -0
  11. package/dist/src/config.d.ts +1 -0
  12. package/dist/src/global-search/types.d.ts +1 -1
  13. package/dist/src/index.d.ts +1 -1
  14. package/dist/src/pages/product-listing-page/product-listing-page-data-types.d.ts +3 -3
  15. package/dist/src/promos/promo-banner/promo-banner.d.ts +7 -0
  16. package/dist/src/promos/promo-banner/promo-banner.stories.d.ts +19 -0
  17. package/dist/src/promos/promo-banners/promo-banners.d.ts +8 -0
  18. package/dist/src/promos/{promo-cards/promo-cards.stories.d.ts → promo-banners/promo-banners.stories.d.ts} +3 -3
  19. package/dist/src/promos/promo-card/promo-card.d.ts +5 -5
  20. package/dist/src/promos/promo-card/promo-card.stories.d.ts +1 -8
  21. package/dist/src/shared/api/bff/model/bff.model.d.ts +4 -4
  22. package/dist/src/shared/model/{product-hit.d.ts → hit.d.ts} +12 -1
  23. package/dist/styles.css +97 -66
  24. package/package.json +1 -1
  25. package/dist/src/algolia/algolia-products-hits-provider.d.ts +0 -6
  26. package/dist/src/algolia/use-algolia-product-hits.d.ts +0 -10
  27. package/dist/src/carousel/product-carousel/product-carousel.d.ts +0 -10
  28. 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
- interface AlgoliaProduct {
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: 'promo' | 'product';
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,6 @@
1
+ import { AlgoliaHit } from './algolia-hit-type';
2
+ export interface AlgoliaHitsGlobalState {
3
+ isLoading: boolean | undefined;
4
+ items: AlgoliaHit[];
5
+ }
6
+ export declare function AlgoliaHitsProvider(): null;
@@ -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 { AlgoliaProductHit } from './algolia-product-hit-type';
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/product-hit").ProductHit[];
22
- source: InternalAutocompleteSource<AlgoliaProductHit>;
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 { ProductCarousel } from './product-carousel';
2
+ import { CardCarousel } from './card-carousel';
3
3
  declare const meta: {
4
4
  args: {
5
- productCards: import("react/jsx-runtime").JSX.Element[];
5
+ cards: import("react/jsx-runtime").JSX.Element[];
6
6
  };
7
- component: typeof ProductCarousel;
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 {};
@@ -4,6 +4,7 @@ interface Config {
4
4
  ALGOLIA_APP_ID: string;
5
5
  ALGOLIA_HOST: string;
6
6
  BFF_API_URL: string;
7
+ COOKIE_DOMAIN?: string;
7
8
  SHOP_API_URL: string;
8
9
  }
9
10
  export declare const configPerEnvironment: Record<Environment, Config>;
@@ -1,5 +1,5 @@
1
1
  import { AutocompleteApi, AutocompleteState as _AutocompleteState } from '@algolia/autocomplete-core';
2
- import { AlgoliaProductHit } from 'algolia/algolia-product-hit-type';
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';
@@ -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/product-hit';
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 PromoCard {
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
- promoCards?: {
21
- top: PromoCard[] | undefined;
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 { PromoCards } from './promo-cards';
2
+ import { PromoBanners } from './promo-banners';
3
3
  declare const meta: {
4
- component: typeof PromoCards;
4
+ component: typeof PromoBanners;
5
5
  parameters: {
6
6
  layout: string;
7
7
  };
8
- render: (args: import("./promo-cards").PromoCardsProps) => import("react/jsx-runtime").JSX.Element;
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 { ResponsiveImage } from 'shared/model/image';
1
+ import { Image as ImageType } from 'shared/model/image';
2
2
  export interface PromoCardProps {
3
- href?: string;
4
- image: ResponsiveImage;
5
- variant: 'sm' | 'lg';
3
+ href: string;
4
+ image: ImageType;
5
+ onClick?: () => void;
6
6
  }
7
- export declare function PromoCard({ href, image, variant }: PromoCardProps): import("react/jsx-runtime").JSX.Element;
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 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;
12
+ export declare const Default: Story;
@@ -26,12 +26,12 @@ interface Category {
26
26
  uri: null;
27
27
  urlSegment: string;
28
28
  }
29
- interface PromoCard {
29
+ interface PromoBanner {
30
30
  href: string;
31
31
  image: ResponsiveImage;
32
32
  }
33
- interface PromoCards {
34
- top: PromoCard[] | null;
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
- promoCards: PromoCards | null;
144
+ promoBanners: PromoBanners | null;
145
145
  }
146
146
  export {};
@@ -1,6 +1,15 @@
1
- import { AlgoliaProductHit } from 'algolia/algolia-product-hit-type';
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;