@luxfi/ui 5.3.8 → 5.3.9

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.
@@ -32,19 +32,21 @@ const LoginPanel: React.FC<{
32
32
 
33
33
  const termsOfServiceUrl = legal.find(({ title }) => title === 'Terms and Conditions')?.href || ''
34
34
  const privacyPolicyUrl = legal.find(({ title }) => title === 'Privacy Policy')?.href || ''
35
-
35
+ const domains = ['lux.id', 'lux.credit', 'lux.market', 'lux.network', 'lux.shop', 'wallet.lux.network', 'safe.lux.network', 'lux.finance', 'lux.exchange', 'lux.quest']
36
36
  // TODO :aa shouldn't this happen in @hanzo/auth: components/LoginPanel ??
37
37
  // Otherwise, the functionality is split across modules! (and client/fw!)
38
38
  // (This was never my intent w the onLoginChanged callback.)
39
39
  const onLogin = (token: string) => {
40
- setCookie('auth-token', token, {
41
- domain: 'lux.id',
42
- path: '/',
43
- sameSite: 'none',
44
- secure: true,
45
- httpOnly: false,
46
- expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30), // 30 days
47
- })
40
+ for (let i = 0; i < domains.length; i ++) {
41
+ setCookie('auth-token', token, {
42
+ domain: domains[i],
43
+ path: '/',
44
+ sameSite: 'none',
45
+ secure: true,
46
+ httpOnly: false,
47
+ expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30), // 30 days
48
+ })
49
+ }
48
50
 
49
51
  let url = new URL(redirectUrl ?? '')
50
52
  let params = new URLSearchParams(url.search)
@@ -33,19 +33,22 @@ const SignupPanel: React.FC<{
33
33
 
34
34
  const termsOfServiceUrl = legal.find(({ title }) => title === 'Terms and Conditions')?.href || ''
35
35
  const privacyPolicyUrl = legal.find(({ title }) => title === 'Privacy Policy')?.href || ''
36
+ const domains = ['lux.id', 'lux.credit', 'lux.market', 'lux.network', 'lux.shop', 'wallet.lux.network', 'safe.lux.network', 'lux.finance', 'lux.exchange', 'lux.quest']
36
37
 
37
38
  // TODO :aa shouldn't this happen in @hanzo/auth: components/LoginPanel ??
38
39
  // Otherwise, the functionality is split across modules! (and client/fw!)
39
40
  // (This was never my intent w the onLoginChanged callback.)
40
41
  const onLogin = (token: string) => {
41
- setCookie('auth-token', token, {
42
- domain: 'lux.id',
43
- path: '/',
44
- sameSite: 'none',
45
- secure: true,
46
- httpOnly: false,
47
- expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30), // 30 days
48
- })
42
+ for (let i = 0; i < domains.length; i++) {
43
+ setCookie('auth-token', token, {
44
+ domain: domains[i],
45
+ path: '/',
46
+ sameSite: 'none',
47
+ secure: true,
48
+ httpOnly: false,
49
+ expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30), // 30 days
50
+ })
51
+ }
49
52
 
50
53
  let url = new URL(redirectUrl ?? '')
51
54
  let params = new URLSearchParams(url.search)
@@ -2,17 +2,22 @@ import { NextRequest, NextResponse, userAgent } from 'next/server'
2
2
  import { getSelectorsByUserAgent } from 'react-device-detect'
3
3
  import { setCookie } from 'cookies-next'
4
4
 
5
- // writed this way so they can be chained :)
5
+ // writed this way so they can be chained :)
6
6
  const determineDeviceMW = async (request: NextRequest) => {
7
7
 
8
8
  const ua = userAgent(request)
9
9
  const { isMobileOnly, isTablet, isDesktop } = getSelectorsByUserAgent(ua.ua)
10
- const agent = isMobileOnly ? 'phone' : (isTablet ? 'tablet' : (isDesktop ? 'desktop' : 'unknown'))
10
+ const agent = isMobileOnly ? 'phone' : (isTablet ? 'tablet' : (isDesktop ? 'desktop' : 'unknown'))
11
11
  const { nextUrl: url } = request
12
12
  //console.log(`\n=== from ${url.href} on a *${agent && agent.toUpperCase()}* device. ===\n`)
13
13
  const auth_token = url.searchParams.get('auth-token')
14
14
  if (auth_token) {
15
15
  setCookie('auth-token', auth_token, {
16
+ domain: url.hostname,
17
+ path: '/',
18
+ sameSite: 'none',
19
+ secure: true,
20
+ httpOnly: false,
16
21
  expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30), // 30 days
17
22
  })
18
23
  url.searchParams.delete('auth-token')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luxfi/ui",
3
- "version": "5.3.8",
3
+ "version": "5.3.9",
4
4
  "description": "Library that contains shared UI primitives, support for a common design system, and other boilerplate support.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",