@sonic-equipment/ui 0.0.84 → 0.0.86

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 CHANGED
@@ -126,8 +126,9 @@ declare const request: Request;
126
126
 
127
127
  declare const features: {
128
128
  readonly pdp: "pdpV2";
129
- readonly plp: "plpV2";
130
- readonly search: "searchV2";
129
+ readonly pdpv1: "pdpV1";
130
+ readonly plpv1: "plpV1";
131
+ readonly searchv1: "searchV1";
131
132
  };
132
133
  type FeatureKeys = keyof typeof features;
133
134
  type FeatureValues = (typeof features)[FeatureKeys];
@@ -4198,6 +4199,7 @@ interface AlgoliaProduct$1 {
4198
4199
  slug: string
4199
4200
  storefrontId: string
4200
4201
  storefrontSlug: string
4202
+ type: 'promo' | 'product'
4201
4203
  weight: number
4202
4204
  width: number
4203
4205
  }
@@ -4899,6 +4901,7 @@ interface AlgoliaProduct {
4899
4901
  slug: string;
4900
4902
  storefrontId: string;
4901
4903
  storefrontSlug: string;
4904
+ type: 'promo' | 'product';
4902
4905
  weight: number;
4903
4906
  width: number;
4904
4907
  }
package/dist/index.js CHANGED
@@ -364,8 +364,9 @@ const request = (function createRequestFunction() {
364
364
 
365
365
  const features = {
366
366
  pdp: 'pdpV2',
367
- plp: 'plpV2',
368
- search: 'searchV2',
367
+ pdpv1: 'pdpV1',
368
+ plpv1: 'plpV1',
369
+ searchv1: 'searchV1',
369
370
  };
370
371
  const HAS_LOCAL_STORAGE_SUPPORT = typeof localStorage !== 'undefined';
371
372
  function useFeatureFlags() {
@@ -376,9 +377,8 @@ function useFeatureFlags() {
376
377
  };
377
378
  return useMemo(() => {
378
379
  const queryParams = qs.parse(search);
379
- const showNewPageQueryValue = String(queryParams['new']).toLowerCase() === 'true';
380
- const hasQueryStringFeatures = Boolean(queryParams['features']);
381
- if (!showNewPageQueryValue && !hasQueryStringFeatures) {
380
+ const hasQueryStringFeatures = queryParams['features'] !== undefined && queryParams['features'] !== null;
381
+ if (!hasQueryStringFeatures) {
382
382
  /* When no new feature flags are set get them from localStorage */
383
383
  return Object.entries(features).reduce((acc, [, value]) => ({
384
384
  ...acc,
@@ -392,7 +392,7 @@ function useFeatureFlags() {
392
392
  .split(',');
393
393
  const featureResults = Object.entries(features).map(([key, value]) => ({
394
394
  key: key,
395
- selected: showNewPageQueryValue || queryStringFeatures.includes(key),
395
+ selected: queryStringFeatures.includes(key),
396
396
  value: value,
397
397
  }));
398
398
  featureResults.forEach(({ selected, value }) => {
@@ -8753,7 +8753,9 @@ function useAlgoliaProductHits() {
8753
8753
  const [isLoading] = useAlgoliaProductHitsLoading();
8754
8754
  return {
8755
8755
  isLoading,
8756
- products: items.map(transformAlgoliaProductHitToProductHit),
8756
+ products: items
8757
+ .map(transformAlgoliaProductHitToProductHit)
8758
+ .filter(product => product.hit.type === 'product'),
8757
8759
  };
8758
8760
  }
8759
8761
 
@@ -32,6 +32,7 @@ interface AlgoliaProduct {
32
32
  slug: string;
33
33
  storefrontId: string;
34
34
  storefrontSlug: string;
35
+ type: 'promo' | 'product';
35
36
  weight: number;
36
37
  width: number;
37
38
  }
@@ -1,7 +1,8 @@
1
1
  declare const features: {
2
2
  readonly pdp: "pdpV2";
3
- readonly plp: "plpV2";
4
- readonly search: "searchV2";
3
+ readonly pdpv1: "pdpV1";
4
+ readonly plpv1: "plpV1";
5
+ readonly searchv1: "searchV1";
5
6
  };
6
7
  type FeatureKeys = keyof typeof features;
7
8
  type FeatureValues = (typeof features)[FeatureKeys];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonic-equipment/ui",
3
- "version": "0.0.84",
3
+ "version": "0.0.86",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "engines": {