@luxfi/ui 5.5.3 → 5.6.0
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/accordion.cjs +213 -0
- package/dist/accordion.js +186 -0
- package/dist/alert.cjs +553 -0
- package/dist/alert.js +531 -0
- package/dist/avatar.cjs +149 -0
- package/dist/avatar.js +125 -0
- package/dist/badge.cjs +611 -0
- package/dist/badge.js +589 -0
- package/dist/button.cjs +689 -0
- package/dist/button.js +664 -0
- package/dist/checkbox.cjs +265 -0
- package/dist/checkbox.js +241 -0
- package/dist/close-button.cjs +73 -0
- package/dist/close-button.js +51 -0
- package/dist/collapsible.cjs +702 -0
- package/dist/collapsible.js +679 -0
- package/dist/color-mode.cjs +96 -0
- package/dist/color-mode.js +72 -0
- package/dist/dialog.cjs +279 -0
- package/dist/dialog.js +246 -0
- package/dist/drawer.cjs +207 -0
- package/dist/drawer.js +175 -0
- package/dist/empty-state.cjs +93 -0
- package/dist/empty-state.js +71 -0
- package/dist/field.cjs +183 -0
- package/dist/field.js +160 -0
- package/dist/heading.cjs +46 -0
- package/dist/heading.js +40 -0
- package/dist/icon-button.cjs +491 -0
- package/dist/icon-button.js +470 -0
- package/dist/image.cjs +572 -0
- package/dist/image.js +551 -0
- package/dist/index.cjs +5779 -0
- package/dist/index.js +5619 -0
- package/dist/input-group.cjs +155 -0
- package/dist/input-group.js +133 -0
- package/dist/input.cjs +65 -0
- package/dist/input.js +59 -0
- package/dist/link.cjs +630 -0
- package/dist/link.js +606 -0
- package/dist/menu.cjs +305 -0
- package/dist/menu.js +269 -0
- package/dist/pin-input.cjs +182 -0
- package/dist/pin-input.js +160 -0
- package/dist/popover.cjs +327 -0
- package/dist/popover.js +294 -0
- package/dist/progress-circle.cjs +152 -0
- package/dist/progress-circle.js +128 -0
- package/dist/progress.cjs +117 -0
- package/dist/progress.js +94 -0
- package/dist/provider.cjs +62 -0
- package/dist/provider.js +40 -0
- package/dist/radio.cjs +177 -0
- package/dist/radio.js +153 -0
- package/dist/rating.cjs +80 -0
- package/dist/rating.js +58 -0
- package/dist/select.cjs +791 -0
- package/dist/select.js +757 -0
- package/dist/separator.cjs +57 -0
- package/dist/separator.js +51 -0
- package/dist/skeleton.cjs +370 -0
- package/dist/skeleton.js +346 -0
- package/dist/slider.cjs +138 -0
- package/dist/slider.js +115 -0
- package/dist/switch.cjs +163 -0
- package/dist/switch.js +140 -0
- package/dist/table.cjs +1044 -0
- package/dist/table.js +1013 -0
- package/dist/tabs.cjs +240 -0
- package/dist/tabs.js +213 -0
- package/dist/tag.cjs +651 -0
- package/dist/tag.js +628 -0
- package/dist/textarea.cjs +65 -0
- package/dist/textarea.js +59 -0
- package/dist/toaster.cjs +99 -0
- package/dist/toaster.js +96 -0
- package/dist/tooltip.cjs +171 -0
- package/dist/tooltip.js +148 -0
- package/dist/utils.cjs +11 -0
- package/dist/utils.js +9 -0
- package/package.json +270 -65
- package/src/accordion.tsx +285 -0
- package/src/alert.tsx +221 -0
- package/src/avatar.tsx +174 -0
- package/src/badge.tsx +158 -0
- package/src/button.tsx +411 -0
- package/src/checkbox.tsx +307 -0
- package/src/close-button.tsx +51 -0
- package/src/collapsible.tsx +126 -0
- package/src/color-mode.tsx +125 -0
- package/src/dialog.tsx +356 -0
- package/src/drawer.tsx +186 -0
- package/src/empty-state.tsx +97 -0
- package/src/field.tsx +202 -0
- package/src/heading.tsx +55 -0
- package/src/icon-button.tsx +192 -0
- package/src/image.tsx +280 -0
- package/src/index.ts +192 -0
- package/src/input-group.tsx +159 -0
- package/src/input.tsx +60 -0
- package/src/link.tsx +326 -0
- package/src/menu.tsx +471 -0
- package/src/pin-input.tsx +187 -0
- package/src/popover.tsx +400 -0
- package/src/progress-circle.tsx +180 -0
- package/src/progress.tsx +109 -0
- package/src/provider.tsx +12 -0
- package/src/radio.tsx +175 -0
- package/src/rating.tsx +79 -0
- package/src/select.tsx +696 -0
- package/src/separator.tsx +59 -0
- package/src/skeleton.tsx +302 -0
- package/src/slider.tsx +152 -0
- package/src/switch.tsx +158 -0
- package/src/table.tsx +621 -0
- package/src/tabs.tsx +354 -0
- package/src/tag.tsx +159 -0
- package/src/textarea.tsx +60 -0
- package/src/toaster.tsx +117 -0
- package/src/tokens.css +438 -0
- package/src/tooltip.tsx +184 -0
- package/src/utils/cn.ts +7 -0
- package/src/utils.ts +6 -0
- package/tokens.css +438 -0
- package/commerce/ui/conf.ts +0 -13
- package/commerce/ui/context.tsx +0 -123
- package/commerce/ui/store.ts +0 -295
- package/components/access-code-input.tsx +0 -71
- package/components/analytics.tsx +0 -23
- package/components/auth/auth-listener.tsx +0 -29
- package/components/auth/auth-token/clear-auth-token.tsx +0 -12
- package/components/auth/auth-token/set-auth-token.tsx +0 -16
- package/components/auth/common-auth-domains.ts +0 -17
- package/components/auth/login-panel.tsx +0 -111
- package/components/auth/mobile-login-button.tsx +0 -107
- package/components/auth/signup-panel.tsx +0 -113
- package/components/back-button.tsx +0 -49
- package/components/chat-widget.tsx +0 -85
- package/components/commerce/bag-button.tsx +0 -98
- package/components/commerce/buy-button.tsx +0 -34
- package/components/commerce/checkout-button.tsx +0 -129
- package/components/commerce/checkout-panel/cart-accordian.tsx +0 -66
- package/components/commerce/checkout-panel/checkout-panel-props.ts +0 -10
- package/components/commerce/checkout-panel/desktop-bag-carousel.tsx +0 -36
- package/components/commerce/checkout-panel/desktop-cp.tsx +0 -83
- package/components/commerce/checkout-panel/index.tsx +0 -126
- package/components/commerce/checkout-panel/mobile-cp.tsx +0 -67
- package/components/commerce/checkout-panel/policy-links.tsx +0 -29
- package/components/commerce/checkout-panel/steps-indicator.tsx +0 -39
- package/components/commerce/checkout-panel/thank-you.tsx +0 -18
- package/components/commerce/desktop-bag-popup.tsx +0 -78
- package/components/commerce/drawer/index.tsx +0 -88
- package/components/commerce/drawer/micro.tsx +0 -145
- package/components/commerce/drawer/shell.tsx +0 -85
- package/components/contact-dialog/contact-form.tsx +0 -116
- package/components/contact-dialog/disclaimer.tsx +0 -13
- package/components/contact-dialog/index.tsx +0 -64
- package/components/copyright.tsx +0 -21
- package/components/drawer-margin.tsx +0 -28
- package/components/footer.tsx +0 -78
- package/components/header/desktop-nav-menu.tsx +0 -204
- package/components/header/desktop.tsx +0 -65
- package/components/header/index.tsx +0 -50
- package/components/header/mobile-bag-drawer.tsx +0 -51
- package/components/header/mobile-menu-toggle-button.tsx +0 -35
- package/components/header/mobile-nav-menu-ai.tsx +0 -51
- package/components/header/mobile-nav-menu-item.tsx +0 -47
- package/components/header/mobile-nav-menu.tsx +0 -102
- package/components/header/mobile.tsx +0 -170
- package/components/header/theme-toggle.tsx +0 -26
- package/components/icons/avatar.tsx +0 -11
- package/components/icons/bag-icon.tsx +0 -10
- package/components/icons/index.ts +0 -6
- package/components/icons/left-arrow.tsx +0 -11
- package/components/icons/lux-logo.tsx +0 -10
- package/components/icons/right-arrow.tsx +0 -10
- package/components/icons/social-icon.tsx +0 -35
- package/components/icons/social-svg.css +0 -3
- package/components/index.ts +0 -26
- package/components/logo.tsx +0 -92
- package/components/main.tsx +0 -27
- package/components/mini-chart/index.tsx +0 -8
- package/components/mini-chart/mini-chart-props.ts +0 -44
- package/components/mini-chart/mini-chart.tsx +0 -85
- package/components/mini-chart/wrapper.tsx +0 -23
- package/components/not-found/index.tsx +0 -28
- package/components/not-found/not-found-content.mdx +0 -5
- package/components/tooltip.tsx +0 -31
- package/environment.d.ts +0 -6
- package/next/analytics/fpixel.ts +0 -16
- package/next/analytics/google-analytics.ts +0 -14
- package/next/analytics/index.ts +0 -3
- package/next/analytics/pixel-analytics.tsx +0 -55
- package/next/font/get-app-router-font-classes.ts +0 -17
- package/next/font/load-and-return-lux-next-fonts-on-import.ts +0 -68
- package/next/font/local/Druk-Wide-Bold.ttf +0 -0
- package/next/font/local/Druk-Wide-Medium.ttf +0 -0
- package/next/font/local/InterVariable-Italic.ttf +0 -0
- package/next/font/local/InterVariable-Italic.woff2 +0 -0
- package/next/font/local/InterVariable.ttf +0 -0
- package/next/font/local/InterVariable.woff2 +0 -0
- package/next/font/next-font-desc.ts +0 -28
- package/next/font/pages-router-font-vars.tsx +0 -18
- package/next/head-metadata/from-next/metadata-types.ts +0 -158
- package/next/head-metadata/from-next/opengraph-types.ts +0 -267
- package/next/head-metadata/from-next/twitter-types.ts +0 -92
- package/next/head-metadata/index.tsx +0 -208
- package/next/index.ts +0 -2
- package/next/middleware/determine-device-mw.ts +0 -29
- package/root-layout/WHY_THIS_IS_SEPARATE.txt +0 -2
- package/root-layout/index.tsx +0 -112
- package/site-def/footer/community.tsx +0 -61
- package/site-def/footer/company.ts +0 -37
- package/site-def/footer/ecosystem.ts +0 -37
- package/site-def/footer/index.tsx +0 -26
- package/site-def/footer/legal.ts +0 -28
- package/site-def/footer/network.ts +0 -45
- package/site-def/footer/svg/warpcast-logo.svg +0 -12
- package/site-def/index.ts +0 -4
- package/site-def/main-nav.tsx +0 -460
- package/style/cart-animation.css +0 -29
- package/style/checkout-animation.css +0 -23
- package/style/drawer-handle-overrides.css +0 -160
- package/style/fonts/COPY_TO_PUBLIC_FOR_NON_NEXT.txt +0 -0
- package/style/fonts/Druk-Wide-Bold.ttf +0 -0
- package/style/fonts/Druk-Wide-Medium.ttf +0 -0
- package/style/fonts/InterVariable-Italic.ttf +0 -0
- package/style/fonts/InterVariable-Italic.woff2 +0 -0
- package/style/fonts/InterVariable.ttf +0 -0
- package/style/fonts/InterVariable.woff2 +0 -0
- package/style/lux-colors.css +0 -85
- package/style/lux-fonts.css +0 -30
- package/style/lux-global-non-next.css +0 -52
- package/style/lux-global.css +0 -51
- package/tailwind/fontFamily.tailwind.lux.ts +0 -18
- package/tailwind/index.ts +0 -2
- package/tailwind/lux-tw-fonts.ts +0 -40
- package/tailwind/tailwind.config.lux-preset.ts +0 -10
- package/tsconfig.json +0 -15
- package/types/chatbot-config.ts +0 -7
- package/types/chatbot-suggested-question.ts +0 -7
- package/types/contact-info.ts +0 -11
- package/types/index.ts +0 -4
- package/types/site-def.ts +0 -46
package/commerce/ui/store.ts
DELETED
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
action,
|
|
3
|
-
autorun,
|
|
4
|
-
computed,
|
|
5
|
-
makeObservable,
|
|
6
|
-
observable,
|
|
7
|
-
reaction,
|
|
8
|
-
type IReactionDisposer,
|
|
9
|
-
} from 'mobx'
|
|
10
|
-
|
|
11
|
-
import type { CommerceService } from '@hanzo/commerce/types'
|
|
12
|
-
|
|
13
|
-
const LOG = true ////////////////////
|
|
14
|
-
const log = (s: string) => {
|
|
15
|
-
if (LOG) {
|
|
16
|
-
console.log('COMMERCE_UI ' + s)
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
type SnapPoint = number | string
|
|
21
|
-
|
|
22
|
-
type SnapPoints = {
|
|
23
|
-
full: SnapPoint
|
|
24
|
-
micro: SnapPoint
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
type SnapPointsConfig = {
|
|
28
|
-
mb: SnapPoints
|
|
29
|
-
dt: SnapPoints
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
type DrawerState = 'closed' | 'micro' | 'full'
|
|
33
|
-
|
|
34
|
-
interface SelectAndBuy {
|
|
35
|
-
showVariants: (skuPath: string) => void
|
|
36
|
-
showRecentVariants: () => void
|
|
37
|
-
hideVariants: () => void
|
|
38
|
-
get currentSkuPath(): string | undefined
|
|
39
|
-
newRoute: () => void
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
interface CommerceDrawer {
|
|
43
|
-
|
|
44
|
-
get open(): boolean
|
|
45
|
-
get state(): DrawerState
|
|
46
|
-
get closedByUser(): boolean
|
|
47
|
-
setClosedByUser(b: boolean): void
|
|
48
|
-
get modal(): boolean
|
|
49
|
-
get points(): SnapPoint[]
|
|
50
|
-
get activePoint(): SnapPoint | null
|
|
51
|
-
// Called by UI Gesture
|
|
52
|
-
onActivePointChanged: (p: SnapPoint | null) => void
|
|
53
|
-
get showCheckout(): boolean
|
|
54
|
-
get showRecent(): boolean
|
|
55
|
-
get showBuy(): boolean
|
|
56
|
-
|
|
57
|
-
get microHeight(): SnapPoint
|
|
58
|
-
get isMobile(): boolean
|
|
59
|
-
get snapPointPx(): number
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
class CommerceUIStore implements
|
|
63
|
-
SelectAndBuy,
|
|
64
|
-
CommerceDrawer
|
|
65
|
-
{
|
|
66
|
-
_vHeight: number = 0
|
|
67
|
-
_routeChangedTime = 0
|
|
68
|
-
|
|
69
|
-
_currentSkuPath: string | undefined = undefined
|
|
70
|
-
_closedByUser: boolean = false
|
|
71
|
-
_checkingOut: boolean | undefined = undefined
|
|
72
|
-
_ignoreStateChange: boolean = false
|
|
73
|
-
_activePoint: SnapPoint | null = null
|
|
74
|
-
|
|
75
|
-
_reactionDisposers: IReactionDisposer[] = []
|
|
76
|
-
_service: CommerceService
|
|
77
|
-
_pointsConfig: SnapPointsConfig
|
|
78
|
-
_points: SnapPoints // points to either this._pointsConfig.md or this._pointsConfig.dt
|
|
79
|
-
|
|
80
|
-
constructor(s: CommerceService, conf: SnapPointsConfig) {
|
|
81
|
-
this._service = s
|
|
82
|
-
this._pointsConfig = conf
|
|
83
|
-
this._points = this._pointsConfig.dt
|
|
84
|
-
|
|
85
|
-
makeObservable(this, {
|
|
86
|
-
_currentSkuPath: observable,
|
|
87
|
-
_closedByUser: observable,
|
|
88
|
-
_checkingOut: observable,
|
|
89
|
-
_activePoint: observable,
|
|
90
|
-
_points: observable.ref,
|
|
91
|
-
_vHeight: observable,
|
|
92
|
-
_routeChangedTime: observable,
|
|
93
|
-
|
|
94
|
-
showVariants: action,
|
|
95
|
-
showRecentVariants: action,
|
|
96
|
-
hideVariants: action,
|
|
97
|
-
setClosedByUser: action,
|
|
98
|
-
setCheckingOut: action,
|
|
99
|
-
setActivePoint: action,
|
|
100
|
-
setMobile: action,
|
|
101
|
-
setViewportHeight: action,
|
|
102
|
-
setRouteChangedTime: action,
|
|
103
|
-
|
|
104
|
-
activePoint: computed,
|
|
105
|
-
checkingOut: computed,
|
|
106
|
-
closedByUser: computed,
|
|
107
|
-
currentSkuPath: computed,
|
|
108
|
-
microHeight: computed,
|
|
109
|
-
modal: computed,
|
|
110
|
-
points: computed,
|
|
111
|
-
showRecent: computed,
|
|
112
|
-
showBuy: computed,
|
|
113
|
-
showCheckout: computed,
|
|
114
|
-
snapPointPx: computed,
|
|
115
|
-
state: computed,
|
|
116
|
-
open: computed
|
|
117
|
-
})
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
initialize = (): void => {
|
|
121
|
-
|
|
122
|
-
this._reactionDisposers.push(reaction(
|
|
123
|
-
() => ( this.state ),
|
|
124
|
-
(s) => {
|
|
125
|
-
if (this.ignoreStateChange) {
|
|
126
|
-
log(`STATE CHANGE to "${s}" (IGNORED)`) // ===========
|
|
127
|
-
this.setIgnoreStateChange(false)
|
|
128
|
-
return
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
log(`STATE CHANGE to "${s}" (UI REACTED)`) // ===========
|
|
132
|
-
this._syncUIToState(s)
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
))
|
|
136
|
-
/*
|
|
137
|
-
this._reactionDisposers.push(autorun(() => {
|
|
138
|
-
log('AUTORUN: OPEN: ' + this.open)
|
|
139
|
-
log('AUTORUN:' + // ===============
|
|
140
|
-
'[showCheckout: ' + this.showCheckout +
|
|
141
|
-
'], [showRecent: ' + this.showRecent +
|
|
142
|
-
'], [showBuy: ' + this.showBuy +
|
|
143
|
-
'], [closedByUser: ' + this._closedByUser +
|
|
144
|
-
'], [checkingOut: ' + this._checkingOut + ']'
|
|
145
|
-
) // ===========
|
|
146
|
-
}))
|
|
147
|
-
*/
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
newRoute = () => {
|
|
151
|
-
this.setRouteChangedTime(new Date().getTime())
|
|
152
|
-
this.hideVariants()
|
|
153
|
-
this.setClosedByUser(false)
|
|
154
|
-
// DO NOT reset _checkingOut!
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
onActivePointChanged = (newPoint: SnapPoint | null): void => {
|
|
158
|
-
log("ON onActivePointChanged: " + newPoint) // ===========
|
|
159
|
-
if (newPoint === this._points.micro && this.activePoint === this._points.full) {
|
|
160
|
-
log("ON onActivePointChanged: to MICRO") // ===========
|
|
161
|
-
this.setIgnoreStateChange(true)
|
|
162
|
-
this.hideVariants()
|
|
163
|
-
}
|
|
164
|
-
else if (newPoint === this._points.full && this.activePoint === this._points.micro) {
|
|
165
|
-
log("ON onActivePointChanged: to FULL") // ===========
|
|
166
|
-
this.setIgnoreStateChange(true)
|
|
167
|
-
this.showRecentVariants()
|
|
168
|
-
}
|
|
169
|
-
this.setActivePoint(newPoint)
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
showVariants = (skuPath: string): void => {
|
|
173
|
-
this._service.setCurrentItem(undefined)
|
|
174
|
-
this._currentSkuPath = skuPath
|
|
175
|
-
this._closedByUser = false
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
showRecentVariants = (): void => {
|
|
179
|
-
const recentItemInfo = this._service.recentItem
|
|
180
|
-
if (recentItemInfo) {
|
|
181
|
-
this._service.setCurrentItem(undefined)
|
|
182
|
-
this._currentSkuPath = recentItemInfo.item.sku
|
|
183
|
-
this._closedByUser = false
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
hideVariants = (): void => { this._currentSkuPath = undefined }
|
|
188
|
-
get currentSkuPath(): string | undefined { return this._currentSkuPath }
|
|
189
|
-
|
|
190
|
-
get closedByUser(): boolean { return this._closedByUser }
|
|
191
|
-
setClosedByUser = (b: boolean): void => { this._closedByUser = b}
|
|
192
|
-
|
|
193
|
-
get ignoreStateChange(): boolean { return this._ignoreStateChange }
|
|
194
|
-
setIgnoreStateChange = (b: boolean): void => { this._ignoreStateChange = b}
|
|
195
|
-
|
|
196
|
-
get checkingOut(): boolean | undefined { return this._checkingOut }
|
|
197
|
-
setCheckingOut = (b: boolean): void => { this._checkingOut = b }
|
|
198
|
-
|
|
199
|
-
get activePoint(): SnapPoint | null { return this._activePoint }
|
|
200
|
-
setActivePoint = (pt: SnapPoint | null): void => { this._activePoint = pt}
|
|
201
|
-
|
|
202
|
-
setRouteChangedTime = (t: number): void => {this._routeChangedTime = t}
|
|
203
|
-
|
|
204
|
-
get points(): SnapPoint[] {
|
|
205
|
-
return [this._points.micro, this._points.full]
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
_syncUIToState = (s: DrawerState) => {
|
|
209
|
-
log("_syncUIToState: " + s) // ===========
|
|
210
|
-
if (s === 'micro') {
|
|
211
|
-
this.setActivePoint(this.points[0])
|
|
212
|
-
}
|
|
213
|
-
else if (s === 'full') {
|
|
214
|
-
this.setActivePoint(this.points[this.points.length - 1])
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
this.setActivePoint(null)
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
get open(): boolean {
|
|
222
|
-
|
|
223
|
-
log('open():' + // ===============
|
|
224
|
-
' showCheckout: ' + this.showCheckout +
|
|
225
|
-
' showRecent: ' + this.showRecent +
|
|
226
|
-
' showBuy: ' + this.showBuy
|
|
227
|
-
) // ===========
|
|
228
|
-
|
|
229
|
-
return (
|
|
230
|
-
this._checkingOut !== undefined
|
|
231
|
-
&&
|
|
232
|
-
!this._checkingOut
|
|
233
|
-
&&
|
|
234
|
-
!this.closedByUser
|
|
235
|
-
&&
|
|
236
|
-
(this.showCheckout || this.showRecent || this.showBuy)
|
|
237
|
-
)
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
get state(): DrawerState {
|
|
241
|
-
if (!this.closedByUser && !this._checkingOut) {
|
|
242
|
-
if (this.showBuy) {
|
|
243
|
-
return 'full'
|
|
244
|
-
}
|
|
245
|
-
else if (this.showRecent || this.showCheckout) {
|
|
246
|
-
return 'micro'
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
return 'closed'
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
get showRecent(): boolean {
|
|
253
|
-
|
|
254
|
-
const recentInfo = this._service.recentItem
|
|
255
|
-
return !!recentInfo && recentInfo.modified > this._routeChangedTime
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
get showBuy(): boolean {return !!this.currentSkuPath}
|
|
259
|
-
get showCheckout(): boolean { return !this._service.cartEmpty}
|
|
260
|
-
get modal(): boolean { return this.state !== 'micro'}
|
|
261
|
-
|
|
262
|
-
get microHeight(): SnapPoint {
|
|
263
|
-
return this._points.micro
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
get isMobile(): boolean { return this._pointsConfig.mb === this._points }
|
|
267
|
-
setMobile = (b: boolean): void => {
|
|
268
|
-
log("setMobile: " + b) // ===========
|
|
269
|
-
this._points = b ? this._pointsConfig.mb : this._pointsConfig.dt
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
setViewportHeight = (v: number) => {this._vHeight = v}
|
|
273
|
-
get snapPointPx(): number {
|
|
274
|
-
if (!this._activePoint || this._vHeight === 0) return 0
|
|
275
|
-
|
|
276
|
-
if (typeof this._activePoint === 'string') {
|
|
277
|
-
return parseInt(this._activePoint)
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return this._vHeight * this._activePoint as number
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
dispose = () => {
|
|
284
|
-
this._reactionDisposers.forEach((d) => {d()})
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
export {
|
|
289
|
-
CommerceUIStore,
|
|
290
|
-
type CommerceDrawer,
|
|
291
|
-
type SelectAndBuy,
|
|
292
|
-
type SnapPointsConfig,
|
|
293
|
-
type SnapPoints,
|
|
294
|
-
type SnapPoint
|
|
295
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { useState } from 'react'
|
|
4
|
-
import { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot } from '@hanzo/ui/primitives'
|
|
5
|
-
import { cn } from '@hanzo/ui/util'
|
|
6
|
-
|
|
7
|
-
const AccessCodeInput: React.FC<{
|
|
8
|
-
onSuccess?: () => void
|
|
9
|
-
onFail?: () => void
|
|
10
|
-
validCodes?: string[]
|
|
11
|
-
className?: string
|
|
12
|
-
}> = ({
|
|
13
|
-
onSuccess,
|
|
14
|
-
onFail,
|
|
15
|
-
validCodes,
|
|
16
|
-
className
|
|
17
|
-
}) => {
|
|
18
|
-
const [status, setStatus] = useState<'valid' | 'invalid' | 'checking' | undefined>()
|
|
19
|
-
|
|
20
|
-
const checkAccessCode = (code: string) => {
|
|
21
|
-
setStatus(undefined)
|
|
22
|
-
if (code.length === 6) {
|
|
23
|
-
setStatus('checking')
|
|
24
|
-
setTimeout(() => {
|
|
25
|
-
if (validCodes?.includes(code) && onSuccess) {
|
|
26
|
-
setStatus('valid')
|
|
27
|
-
onSuccess()
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
setStatus('invalid')
|
|
31
|
-
onFail && onFail()
|
|
32
|
-
}
|
|
33
|
-
}, 1000)
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<div className={cn('flex flex-col gap-2 mx-auto w-full text-center items-center', className)}>
|
|
39
|
-
<InputOTP
|
|
40
|
-
className='mx-auto'
|
|
41
|
-
maxLength={6}
|
|
42
|
-
onInput={(event) => checkAccessCode((event.target as HTMLInputElement).value)}
|
|
43
|
-
render={({ slots }) => (
|
|
44
|
-
<>
|
|
45
|
-
<InputOTPGroup>
|
|
46
|
-
{slots.slice(0, 3).map((slot, index) => (
|
|
47
|
-
<InputOTPSlot key={index} {...slot} />
|
|
48
|
-
))}{" "}
|
|
49
|
-
</InputOTPGroup>
|
|
50
|
-
<InputOTPSeparator />
|
|
51
|
-
<InputOTPGroup>
|
|
52
|
-
{slots.slice(3).map((slot, index) => (
|
|
53
|
-
<InputOTPSlot key={index + 3} {...slot} />
|
|
54
|
-
))}
|
|
55
|
-
</InputOTPGroup>
|
|
56
|
-
</>
|
|
57
|
-
)}
|
|
58
|
-
/>
|
|
59
|
-
<p className='h-[3rem]'>
|
|
60
|
-
{
|
|
61
|
-
status === 'checking' ? 'Checking access code...' :
|
|
62
|
-
status === 'invalid' ? <span className='text-destructive'>Invalid access code!</span> :
|
|
63
|
-
status === 'valid' ? <span>Access code is valid! Redirecting...</span> :
|
|
64
|
-
null
|
|
65
|
-
}
|
|
66
|
-
</p>
|
|
67
|
-
</div>
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export default AccessCodeInput
|
package/components/analytics.tsx
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { useEffect } from 'react'
|
|
4
|
-
import { GoogleAnalytics } from '@next/third-parties/google'
|
|
5
|
-
import { FacebookPixel } from '../next/analytics'
|
|
6
|
-
|
|
7
|
-
const Analytics = () => {
|
|
8
|
-
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
document.body.style.display = 'flex'
|
|
11
|
-
}, [])
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<>
|
|
15
|
-
<FacebookPixel />
|
|
16
|
-
<GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID ?? ''} />
|
|
17
|
-
</>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export {
|
|
22
|
-
Analytics as default
|
|
23
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import { useEffect } from 'react'
|
|
4
|
-
import { useAuth } from '@hanzo/auth/service'
|
|
5
|
-
import { getCookie } from 'cookies-next'
|
|
6
|
-
|
|
7
|
-
const AuthListener = () => {
|
|
8
|
-
const auth = useAuth()
|
|
9
|
-
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
fetch(`${process.env.NEXT_PUBLIC_LOGIN_SITE_URL}/api/auth/get-auth-token`, {
|
|
12
|
-
method: 'GET',
|
|
13
|
-
credentials: 'include',
|
|
14
|
-
})
|
|
15
|
-
.then(response => response.json())
|
|
16
|
-
.then((data: any) => {
|
|
17
|
-
const token = data.reqToken
|
|
18
|
-
console.log(data)
|
|
19
|
-
console.log(token)
|
|
20
|
-
if (!!token) {
|
|
21
|
-
auth.loginWithCustomToken(token)
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
}, [auth])
|
|
25
|
-
|
|
26
|
-
return ( <></> )
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default AuthListener
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import domains from '../common-auth-domains'
|
|
2
|
-
|
|
3
|
-
const ClearAuthToken = () => {
|
|
4
|
-
return (<>
|
|
5
|
-
{domains.map(({url}) => (
|
|
6
|
-
/* Clear auth-token cookie across all Lux domains */
|
|
7
|
-
<img src={`${url}/api/auth/clear-auth-token`} className='absolute hidden'/>
|
|
8
|
-
))}
|
|
9
|
-
</>)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default ClearAuthToken
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import domains from '../common-auth-domains'
|
|
2
|
-
|
|
3
|
-
const SetAuthToken: React.FC<{
|
|
4
|
-
authToken: string
|
|
5
|
-
}> = ({
|
|
6
|
-
authToken,
|
|
7
|
-
}) => {
|
|
8
|
-
return (<>
|
|
9
|
-
{!!authToken && domains.map(({url}) => (
|
|
10
|
-
/* Set auth-token cookie across all Lux domains */
|
|
11
|
-
<img src={`${url}/api/auth/set-auth-token?token=${authToken}`} className='absolute hidden'/>
|
|
12
|
-
))}
|
|
13
|
-
</>)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default SetAuthToken
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const domains = [
|
|
2
|
-
{ id: 'lux.market', url: 'https://lux.market' },
|
|
3
|
-
{ id: 'lux.shop', url: 'https://lux.shop' },
|
|
4
|
-
{ id: 'lux.credit', url: 'https://lux.credit' },
|
|
5
|
-
{ id: 'lux.network', url: 'https://lux.network' },
|
|
6
|
-
{ id: 'wallet.lux.network', url: 'https://wallet.lux.network' },
|
|
7
|
-
{ id: 'safe.lux.network', url: 'https://safe.lux.network' },
|
|
8
|
-
{ id: 'lux.finance', url: 'https://lux.finance' },
|
|
9
|
-
{ id: 'lux.exchange', url: 'https://lux.exchange' },
|
|
10
|
-
{ id: 'lux.quest', url: 'https://lux.quest' },
|
|
11
|
-
{ id: 'lux.id', url: 'https://lux.id' },
|
|
12
|
-
{ id: 'lux.chat', url: 'https://lux.chat' }
|
|
13
|
-
]
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
domains as default
|
|
17
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
|
|
3
|
-
import Link from 'next/link'
|
|
4
|
-
import { useRouter } from 'next/navigation'
|
|
5
|
-
import { setCookie } from 'cookies-next'
|
|
6
|
-
|
|
7
|
-
import { cn } from '@hanzo/ui/util'
|
|
8
|
-
import { Button, Carousel, CarouselContent, CarouselItem } from '@hanzo/ui/primitives'
|
|
9
|
-
import { LoginPanel as Login } from '@hanzo/auth/components'
|
|
10
|
-
|
|
11
|
-
import { LuxLogo } from '../icons'
|
|
12
|
-
import Logo from '../logo'
|
|
13
|
-
import { EmblaAutoplay } from '..'
|
|
14
|
-
import { legal } from '../../site-def/footer'
|
|
15
|
-
|
|
16
|
-
const LoginPanel: React.FC<{
|
|
17
|
-
close: () => void
|
|
18
|
-
getStartedUrl?: string
|
|
19
|
-
redirectUrl?: string
|
|
20
|
-
className?: string
|
|
21
|
-
reviews: { text: string, author: string, href: string }[]
|
|
22
|
-
setIsLogin?: React.Dispatch<React.SetStateAction<boolean>>
|
|
23
|
-
}> = ({
|
|
24
|
-
close,
|
|
25
|
-
getStartedUrl = '/',
|
|
26
|
-
redirectUrl,
|
|
27
|
-
className = '',
|
|
28
|
-
reviews,
|
|
29
|
-
setIsLogin
|
|
30
|
-
}) => {
|
|
31
|
-
const router = useRouter()
|
|
32
|
-
|
|
33
|
-
const termsOfServiceUrl = legal.find(({ title }) => title === 'Terms and Conditions')?.href || ''
|
|
34
|
-
const privacyPolicyUrl = legal.find(({ title }) => title === 'Privacy Policy')?.href || ''
|
|
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
|
-
// TODO :aa shouldn't this happen in @hanzo/auth: components/LoginPanel ??
|
|
37
|
-
// Otherwise, the functionality is split across modules! (and client/fw!)
|
|
38
|
-
// (This was never my intent w the onLoginChanged callback.)
|
|
39
|
-
const onLogin = (token: string) => {
|
|
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
|
-
}
|
|
50
|
-
|
|
51
|
-
redirectUrl && router.push(redirectUrl)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<div className={cn('grid grid-cols-1 md:grid-cols-2', className)}>
|
|
56
|
-
<div className='hidden md:flex w-full h-full bg-[radial-gradient(circle_at_24.1%_68.8%_,_rgba(15,14,14,0)_,_rgba(9,9,9,99.4))] flex-row items-end justify-end overflow-y-auto min-h-screen'>
|
|
57
|
-
<div className='h-full w-full max-w-[750px] px-8 pt-0'>
|
|
58
|
-
<div className='h-full w-full max-w-[550px] mx-auto flex flex-col justify-between min-h-screen py-10'>
|
|
59
|
-
<Button
|
|
60
|
-
variant='ghost'
|
|
61
|
-
onClick={close}
|
|
62
|
-
className='w-fit !min-w-0 p-2'
|
|
63
|
-
>
|
|
64
|
-
<Logo size='md' textClx='!cursor-pointer' variant='text-only' />
|
|
65
|
-
</Button>
|
|
66
|
-
<Carousel
|
|
67
|
-
options={{ align: 'center', loop: true }}
|
|
68
|
-
className='w-full'
|
|
69
|
-
plugins={[EmblaAutoplay({ delay: 5000, stopOnInteraction: true })]}
|
|
70
|
-
>
|
|
71
|
-
<CarouselContent>
|
|
72
|
-
{reviews.map(({ text, author, href }, index) => (
|
|
73
|
-
<CarouselItem key={index}>
|
|
74
|
-
<Link href={href} className='flex flex-col gap-3 cursor-pointer'>
|
|
75
|
-
<p>“{text}“</p>
|
|
76
|
-
<p className='text-sm'>{author}</p>
|
|
77
|
-
</Link>
|
|
78
|
-
</CarouselItem>
|
|
79
|
-
))}
|
|
80
|
-
</CarouselContent>
|
|
81
|
-
</Carousel>
|
|
82
|
-
</div>
|
|
83
|
-
</div>
|
|
84
|
-
</div>
|
|
85
|
-
<div className='w-full h-full bg-background flex flex-row items-center'>
|
|
86
|
-
<div className='w-full max-w-[750px] relative flex flex-col items-center px-8 pt-0 text-center'>
|
|
87
|
-
<div className='relative h-full w-full max-w-[400px] mx-auto flex flex-col gap-4 items-center py-10'>
|
|
88
|
-
<Button
|
|
89
|
-
variant='ghost'
|
|
90
|
-
onClick={close}
|
|
91
|
-
className='block md:hidden absolute rounded-full p-2 left-0 h-auto hover:bg-background'
|
|
92
|
-
>
|
|
93
|
-
<LuxLogo className='w-5 h-5' />
|
|
94
|
-
</Button>
|
|
95
|
-
<Login
|
|
96
|
-
getStartedUrl={getStartedUrl}
|
|
97
|
-
redirectUrl={redirectUrl}
|
|
98
|
-
className='w-full max-w-sm'
|
|
99
|
-
termsOfServiceUrl={termsOfServiceUrl}
|
|
100
|
-
privacyPolicyUrl={privacyPolicyUrl}
|
|
101
|
-
onLoginChanged={onLogin}
|
|
102
|
-
setIsLogin={setIsLogin}
|
|
103
|
-
/>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export default LoginPanel
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import React from "react"
|
|
3
|
-
import { observer } from "mobx-react-lite"
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
Button,
|
|
7
|
-
LinkElement,
|
|
8
|
-
Popover,
|
|
9
|
-
PopoverContent,
|
|
10
|
-
PopoverTrigger,
|
|
11
|
-
Separator
|
|
12
|
-
} from '@hanzo/ui/primitives'
|
|
13
|
-
|
|
14
|
-
import type { LinkDef } from '@hanzo/ui/types'
|
|
15
|
-
import { cn } from '@hanzo/ui/util'
|
|
16
|
-
|
|
17
|
-
import { useAuth } from "@hanzo/auth/service"
|
|
18
|
-
|
|
19
|
-
import { Ethereum } from "@hanzo/auth/icons"
|
|
20
|
-
|
|
21
|
-
const MobileAuthWidget: React.FC<{
|
|
22
|
-
noLogin?: boolean
|
|
23
|
-
className?: string
|
|
24
|
-
handleLogin?: () => void
|
|
25
|
-
}> = observer(({
|
|
26
|
-
noLogin = false,
|
|
27
|
-
className
|
|
28
|
-
}) => {
|
|
29
|
-
const auth = useAuth()
|
|
30
|
-
const handleLogin = () => {
|
|
31
|
-
window.location.href = "https://lux.id";
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
if (!auth) {
|
|
35
|
-
return null
|
|
36
|
-
}
|
|
37
|
-
if (!auth.loggedIn && typeof window !== 'undefined') {
|
|
38
|
-
return (noLogin ? null : (
|
|
39
|
-
(handleLogin) ? (
|
|
40
|
-
<div className="flex items-center py-1 px-1 gap-1">
|
|
41
|
-
<Button
|
|
42
|
-
variant='primary'
|
|
43
|
-
className='text-base font-semibold !min-w-0 self-center flex-1'
|
|
44
|
-
onClick={handleLogin}
|
|
45
|
-
>
|
|
46
|
-
Sign Up
|
|
47
|
-
</Button>
|
|
48
|
-
<Button
|
|
49
|
-
variant='outline'
|
|
50
|
-
className=' text-base font-semibold !min-w-0 self-center flex-1'
|
|
51
|
-
onClick={handleLogin}
|
|
52
|
-
>
|
|
53
|
-
Log In
|
|
54
|
-
</Button>
|
|
55
|
-
</div>
|
|
56
|
-
) : (
|
|
57
|
-
<LinkElement
|
|
58
|
-
def={{
|
|
59
|
-
href: `${process.env.NEXT_PUBLIC_LOGIN_SITE_URL}?redirectUrl=${window.location.href}`,
|
|
60
|
-
title: 'Login',
|
|
61
|
-
variant: 'primary',
|
|
62
|
-
newTab: false
|
|
63
|
-
} satisfies LinkDef}
|
|
64
|
-
className='h-8 w-fit !min-w-0'
|
|
65
|
-
/>
|
|
66
|
-
)
|
|
67
|
-
))
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return (
|
|
71
|
-
<Popover>
|
|
72
|
-
<PopoverTrigger asChild>
|
|
73
|
-
<Button
|
|
74
|
-
variant="outline"
|
|
75
|
-
size='icon'
|
|
76
|
-
className={cn('rounded-full text-muted border-2 border-muted bg-level-1 hover:bg-level-2 hover:border-foreground hover:text-foreground uppercase w-8 h-8', className)}
|
|
77
|
-
>{auth.user?.email[0]}</Button>
|
|
78
|
-
</PopoverTrigger>
|
|
79
|
-
<PopoverContent className='bg-level-0'>
|
|
80
|
-
<div className="grid gap-4">
|
|
81
|
-
<div className="space-y-2 truncate">
|
|
82
|
-
{auth.user?.displayName ? (
|
|
83
|
-
<>
|
|
84
|
-
<h4 className="font-medium leading-none truncate">{auth.user.displayName}</h4>
|
|
85
|
-
<p className="text-sm opacity-50 truncate">{auth.user.email}</p>
|
|
86
|
-
</>
|
|
87
|
-
) : (
|
|
88
|
-
<h4 className="font-medium leading-none truncate">{auth.user?.email}</h4>
|
|
89
|
-
)}
|
|
90
|
-
{auth.user?.walletAddress ? (
|
|
91
|
-
<p className="text-sm opacity-50 truncate">{auth.user.walletAddress}</p>
|
|
92
|
-
) : (
|
|
93
|
-
<Button variant="outline" className='w-full flex items-center gap-2' onClick={auth.associateWallet.bind(auth)}>
|
|
94
|
-
<Ethereum height={20} />Connect your wallet
|
|
95
|
-
</Button>
|
|
96
|
-
)}
|
|
97
|
-
</div>
|
|
98
|
-
<Separator />
|
|
99
|
-
<Button variant="outline" onClick={auth.logout.bind(auth)}>Logout</Button>
|
|
100
|
-
</div>
|
|
101
|
-
</PopoverContent>
|
|
102
|
-
</Popover>
|
|
103
|
-
)
|
|
104
|
-
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
export default MobileAuthWidget
|