@akinon/next 1.25.0-rc.4 → 1.25.0-rc.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.25.0-rc.5
4
+
5
+ ### Minor Changes
6
+
7
+ - 6d4aadb: ZERO-2476: Auto install recommendenent extension
8
+ - eae7644: ZERO-2479: optimize Link component with useMemo for href formatting
9
+ - e20b27f: ZERO-2454:add otp login
10
+ - e0a945e: ZERO-2494:Add LiveCommerce for managing basket and product actions
11
+ - a4674c6: ZERO-2461: add optional chaining for referrer header and add locale value for redirect url
12
+ - 1ec9775: ZERO-2462:add custom span to logs
13
+ - 7e41bdc: BRDG-9158: Remove redirect-three-d page endpoint
14
+ - 1289982: ZERO-2521: Add x-forwarded-for header to requests
15
+ - ab5a493: ZERO-2475:add types [key: string]: any; for unknown attributes
16
+ - 3690d3b: ZERO-2485: Check ESLint peerDependency version
17
+ - 92094d4: ZERO-2477: Update Sentry version and add hideSourceMaps option
18
+ - b4452e9: ZERO-2463: Refactor Sentry initialization and add Sentry DSN option to settings
19
+ - b2da5e4: Revert ZERO-2435
20
+ - d3edd3a: ZERO-2499:add style prop in link component
21
+ - f76f079: ZERO-2493: Add redirect util function
22
+
23
+ ### Patch Changes
24
+
25
+ - da1e501: ZERO-2296: Fix ROUTES import
26
+ - 2e44646: ZERO-2434: Fix category URL in getCategoryDataHandler function
27
+ - 183674f: BRDG-9158: Handle locale prefix
28
+ - 8c7f5bc: ZERO-2440: Pipeline test
29
+ - @akinon/eslint-plugin-projectzero@1.25.0-rc.5
30
+
3
31
  ## 1.25.0-rc.4
4
32
 
5
33
  ### Patch Changes
@@ -4,7 +4,7 @@ import { useLocalization } from '@akinon/next/hooks';
4
4
  import { LocaleUrlStrategy } from '@akinon/next/localization';
5
5
  import { urlLocaleMatcherRegex } from '@akinon/next/utils';
6
6
  import NextLink, { LinkProps as NextLinkProps } from 'next/link';
7
- import { useEffect, useState } from 'react';
7
+ import { useMemo } from 'react';
8
8
 
9
9
  type LinkProps = Omit<
10
10
  React.AnchorHTMLAttributes<HTMLAnchorElement>,
@@ -14,23 +14,24 @@ type LinkProps = Omit<
14
14
 
15
15
  export const Link = ({ children, href, ...rest }: LinkProps) => {
16
16
  const { locale, defaultLocaleValue, localeUrlStrategy } = useLocalization();
17
- const [formattedHref, setFormattedHref] = useState(href ?? '#');
18
-
19
- useEffect(() => {
20
- if (typeof href !== 'string') return;
21
- if (href.startsWith('http')) return;
17
+ const formattedHref = useMemo(() => {
18
+ if (typeof href !== 'string' || href.startsWith('http')) {
19
+ return href;
20
+ }
22
21
 
23
22
  const pathnameWithoutLocale = href.replace(urlLocaleMatcherRegex, '');
24
23
  const hrefWithLocale = `/${locale}${pathnameWithoutLocale}`;
25
24
 
26
25
  if (localeUrlStrategy === LocaleUrlStrategy.ShowAllLocales) {
27
- setFormattedHref(hrefWithLocale);
26
+ return hrefWithLocale;
28
27
  } else if (
29
28
  localeUrlStrategy === LocaleUrlStrategy.HideDefaultLocale &&
30
29
  locale !== defaultLocaleValue
31
30
  ) {
32
- setFormattedHref(hrefWithLocale);
31
+ return hrefWithLocale;
33
32
  }
33
+
34
+ return href || '#';
34
35
  }, [href, defaultLocaleValue, locale, localeUrlStrategy]);
35
36
 
36
37
  return (
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/next",
3
3
  "description": "Core package for Project Zero Next",
4
- "version": "1.25.0-rc.4",
4
+ "version": "1.25.0-rc.5",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {