@akinon/next 1.73.0-rc.2 → 1.73.0-rc.3

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,11 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.73.0-rc.3
4
+
5
+ ### Minor Changes
6
+
7
+ - 07b2298e: ZERO-3074: Exclude url schemes to init url without locales
8
+
3
9
  ## 1.73.0-rc.2
4
10
 
5
11
  ### Minor Changes
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { useLocalization } from '@akinon/next/hooks';
4
4
  import { LocaleUrlStrategy } from '@akinon/next/localization';
5
- import { urlLocaleMatcherRegex } from '@akinon/next/utils';
5
+ import { urlLocaleMatcherRegex, urlSchemes } from '@akinon/next/utils';
6
6
  import NextLink, { LinkProps as NextLinkProps } from 'next/link';
7
7
  import { useMemo } from 'react';
8
8
 
@@ -21,6 +21,13 @@ export const Link = ({ children, href, ...rest }: LinkProps) => {
21
21
  return '#';
22
22
  }
23
23
 
24
+ if (
25
+ typeof href !== 'string' ||
26
+ urlSchemes.some((scheme) => href.startsWith(scheme))
27
+ ) {
28
+ return href;
29
+ }
30
+
24
31
  if (typeof href === 'string' && !href.startsWith('http')) {
25
32
  const pathnameWithoutLocale = href.replace(urlLocaleMatcherRegex, '');
26
33
  const hrefWithLocale = `/${locale}${pathnameWithoutLocale}`;
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.73.0-rc.2",
4
+ "version": "1.73.0-rc.3",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -30,7 +30,7 @@
30
30
  "set-cookie-parser": "2.6.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@akinon/eslint-plugin-projectzero": "1.73.0-rc.2",
33
+ "@akinon/eslint-plugin-projectzero": "1.73.0-rc.3",
34
34
  "@types/react-redux": "7.1.30",
35
35
  "@types/set-cookie-parser": "2.4.7",
36
36
  "@typescript-eslint/eslint-plugin": "6.7.4",
package/utils/index.ts CHANGED
@@ -174,3 +174,37 @@ export const getPosError = () => {
174
174
 
175
175
  return error;
176
176
  };
177
+
178
+ export const urlSchemes = [
179
+ 'http',
180
+ 'tel:',
181
+ 'mailto:',
182
+ 'sms:',
183
+ 'whatsapp:',
184
+ 'skype:',
185
+ 'ftp:',
186
+ 'file:',
187
+ '//',
188
+ '#',
189
+ 'viber:',
190
+ 'tg:',
191
+ 'slack:',
192
+ 'data:',
193
+ 'market:',
194
+ 'intent:',
195
+ 'webcal:',
196
+ 'geo:',
197
+ 'maps:',
198
+ 'news:',
199
+ 'facetime:',
200
+ 'facetime-audio:',
201
+ 'spotify:',
202
+ 'steam:',
203
+ 'ms-settings:',
204
+ 'zoommtg:',
205
+ 'zoomus:',
206
+ 'blob:',
207
+ 'wss:',
208
+ 'sftp:',
209
+ 'magnet:'
210
+ ] as const;