@luxfi/core 5.3.7 → 10.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. package/package.json +9 -53
  2. package/tsconfig.json +3 -8
  3. package/types/asset.ts +28 -0
  4. package/types/contract.ts +13 -0
  5. package/types/deposit-address.ts +9 -0
  6. package/types/exchange.ts +25 -0
  7. package/types/index.ts +21 -4
  8. package/types/network-type.ts +16 -0
  9. package/types/network.ts +58 -0
  10. package/types/swap-status.ts +58 -0
  11. package/types/transaction-type.ts +5 -0
  12. package/types/utila.ts +36 -0
  13. package/commerce/ui/conf.ts +0 -13
  14. package/commerce/ui/context.tsx +0 -123
  15. package/commerce/ui/store.ts +0 -290
  16. package/components/access-code-input.tsx +0 -71
  17. package/components/auth/auth-listener.tsx +0 -29
  18. package/components/auth/auth-token/clear-auth-token.tsx +0 -12
  19. package/components/auth/auth-token/set-auth-token.tsx +0 -16
  20. package/components/auth/common-auth-domains.ts +0 -16
  21. package/components/auth/login-panel.tsx +0 -107
  22. package/components/back-button.tsx +0 -49
  23. package/components/chat-widget.tsx +0 -85
  24. package/components/commerce/_to_deprecate_checkout-widget/const.ts +0 -13
  25. package/components/commerce/_to_deprecate_checkout-widget/index.tsx_ +0 -188
  26. package/components/commerce/_to_deprecate_checkout-widget/obs-string-set.ts +0 -48
  27. package/components/commerce/_to_deprecate_checkout-widget/use-anim-clx-set.ts +0 -59
  28. package/components/commerce/bag-button.tsx +0 -98
  29. package/components/commerce/buy-button.tsx +0 -34
  30. package/components/commerce/checkout-button.tsx +0 -129
  31. package/components/commerce/checkout-panel/cart-accordian.tsx +0 -66
  32. package/components/commerce/checkout-panel/checkout-panel-props.ts +0 -10
  33. package/components/commerce/checkout-panel/desktop-bag-carousel.tsx +0 -36
  34. package/components/commerce/checkout-panel/desktop-cp.tsx +0 -83
  35. package/components/commerce/checkout-panel/index.tsx +0 -126
  36. package/components/commerce/checkout-panel/mobile-cp.tsx +0 -67
  37. package/components/commerce/checkout-panel/policy-links.tsx +0 -29
  38. package/components/commerce/checkout-panel/steps-indicator.tsx +0 -39
  39. package/components/commerce/checkout-panel/thank-you.tsx +0 -18
  40. package/components/commerce/desktop-bag-popup.tsx +0 -78
  41. package/components/commerce/desktop-nav-menu.tsx +0 -194
  42. package/components/commerce/drawer/index.tsx +0 -88
  43. package/components/commerce/drawer/micro.tsx +0 -145
  44. package/components/commerce/drawer/shell.tsx +0 -85
  45. package/components/commerce/mobile-bag-drawer.tsx +0 -51
  46. package/components/commerce/mobile-login-button.tsx +0 -108
  47. package/components/commerce/mobile-menu-toggle-button.tsx +0 -35
  48. package/components/commerce/mobile-nav-menu-ai.tsx +0 -51
  49. package/components/commerce/mobile-nav-menu-item.tsx +0 -50
  50. package/components/commerce/mobile-nav-menu.tsx +0 -102
  51. package/components/contact-dialog/contact-form.tsx +0 -113
  52. package/components/contact-dialog/disclaimer.tsx +0 -13
  53. package/components/contact-dialog/index.tsx +0 -64
  54. package/components/copyright.tsx +0 -21
  55. package/components/drawer-margin.tsx +0 -28
  56. package/components/footer.tsx +0 -78
  57. package/components/header/desktop.tsx +0 -51
  58. package/components/header/index.tsx +0 -50
  59. package/components/header/mobile.tsx +0 -163
  60. package/components/header/theme-toggle.tsx +0 -26
  61. package/components/icons/24k-gold-card.tsx +0 -43
  62. package/components/icons/ai-chat-act.tsx +0 -47
  63. package/components/icons/ai-chat.tsx +0 -29
  64. package/components/icons/anodized-titanium.tsx +0 -45
  65. package/components/icons/avatar.tsx +0 -11
  66. package/components/icons/bag-icon.tsx +0 -10
  67. package/components/icons/blog-act.tsx +0 -14
  68. package/components/icons/blog.tsx +0 -20
  69. package/components/icons/bridge-act.tsx +0 -18
  70. package/components/icons/bridge.tsx +0 -68
  71. package/components/icons/changelog-act.tsx +0 -15
  72. package/components/icons/changelog.tsx +0 -21
  73. package/components/icons/chrome.tsx +0 -45
  74. package/components/icons/coins-act.tsx +0 -29
  75. package/components/icons/coins.tsx +0 -20
  76. package/components/icons/compare-cards-act.tsx +0 -30
  77. package/components/icons/compare-cards.tsx +0 -21
  78. package/components/icons/credit-act.tsx +0 -29
  79. package/components/icons/credit.tsx +0 -20
  80. package/components/icons/customer-support-act.tsx +0 -27
  81. package/components/icons/customer-support.tsx +0 -21
  82. package/components/icons/customers-act.tsx +0 -65
  83. package/components/icons/customers.tsx +0 -33
  84. package/components/icons/developer-docs-act.tsx +0 -26
  85. package/components/icons/developer-docs.tsx +0 -20
  86. package/components/icons/exchange-act.tsx +0 -27
  87. package/components/icons/exchange.tsx +0 -21
  88. package/components/icons/explorer-act.tsx +0 -27
  89. package/components/icons/explorer.tsx +0 -22
  90. package/components/icons/faqs-act.tsx +0 -27
  91. package/components/icons/faqs.tsx +0 -21
  92. package/components/icons/github.tsx +0 -14
  93. package/components/icons/guides-act.tsx +0 -26
  94. package/components/icons/guides.tsx +0 -21
  95. package/components/icons/gun-metal.tsx +0 -44
  96. package/components/icons/index.tsx +0 -43
  97. package/components/icons/integrations-act.tsx +0 -41
  98. package/components/icons/integrations.tsx +0 -25
  99. package/components/icons/irradescent.tsx +0 -41
  100. package/components/icons/launch-subnet.tsx +0 -21
  101. package/components/icons/launchsubnet-act.tsx +0 -29
  102. package/components/icons/left-arrow.tsx +0 -11
  103. package/components/icons/lux-finance-act.tsx +0 -34
  104. package/components/icons/lux-finance.tsx +0 -23
  105. package/components/icons/lux-logo.tsx +0 -10
  106. package/components/icons/lux-pass-act.tsx +0 -41
  107. package/components/icons/lux-pass.tsx +0 -25
  108. package/components/icons/lux-quests-act.tsx +0 -15
  109. package/components/icons/lux-quests.tsx +0 -21
  110. package/components/icons/market-act.tsx +0 -39
  111. package/components/icons/market.tsx +0 -24
  112. package/components/icons/mirrored-titanium.tsx +0 -46
  113. package/components/icons/more-benefits-act.tsx +0 -29
  114. package/components/icons/more-benefits.tsx +0 -21
  115. package/components/icons/open-source-act.tsx +0 -41
  116. package/components/icons/open-source.tsx +0 -26
  117. package/components/icons/right-arrow.tsx +0 -10
  118. package/components/icons/safe-act.tsx +0 -77
  119. package/components/icons/safe.tsx +0 -37
  120. package/components/icons/search.tsx +0 -12
  121. package/components/icons/secure-delivery.tsx +0 -13
  122. package/components/icons/shop-act.tsx +0 -29
  123. package/components/icons/shop.tsx +0 -20
  124. package/components/icons/social-icon.tsx +0 -35
  125. package/components/icons/social-svg.css +0 -3
  126. package/components/icons/sterling-silver-card.tsx +0 -44
  127. package/components/icons/templates-act.tsx +0 -29
  128. package/components/icons/templates.tsx +0 -21
  129. package/components/icons/validators-act.tsx +0 -42
  130. package/components/icons/validators.tsx +0 -41
  131. package/components/icons/view-all-card-act.tsx +0 -28
  132. package/components/icons/view-all-card.tsx +0 -20
  133. package/components/icons/wallet-act.tsx +0 -29
  134. package/components/icons/wallet.tsx +0 -20
  135. package/components/icons/warpcast.tsx +0 -58
  136. package/components/icons/youtube-logo.tsx +0 -59
  137. package/components/index.ts +0 -25
  138. package/components/logo.tsx +0 -89
  139. package/components/main.tsx +0 -27
  140. package/components/mini-chart/index.tsx +0 -8
  141. package/components/mini-chart/mini-chart-props.ts +0 -44
  142. package/components/mini-chart/mini-chart.tsx +0 -85
  143. package/components/mini-chart/wrapper.tsx +0 -23
  144. package/components/not-found/index.tsx +0 -28
  145. package/components/not-found/not-found-content.mdx +0 -5
  146. package/components/scripts.tsx +0 -24
  147. package/components/tooltip.tsx +0 -31
  148. package/environment.d.ts +0 -6
  149. package/next/analytics/fpixel.ts +0 -16
  150. package/next/analytics/google-analytics.ts +0 -14
  151. package/next/analytics/index.ts +0 -3
  152. package/next/analytics/pixel-analytics.tsx +0 -55
  153. package/next/font/get-app-router-font-classes.ts +0 -12
  154. package/next/font/load-and-return-lux-next-fonts-on-import.ts +0 -68
  155. package/next/font/local/Druk-Wide-Bold.ttf +0 -0
  156. package/next/font/local/Druk-Wide-Medium.ttf +0 -0
  157. package/next/font/local/InterVariable-Italic.ttf +0 -0
  158. package/next/font/local/InterVariable-Italic.woff2 +0 -0
  159. package/next/font/local/InterVariable.ttf +0 -0
  160. package/next/font/local/InterVariable.woff2 +0 -0
  161. package/next/font/next-font-desc.ts +0 -28
  162. package/next/font/pages-router-font-vars.tsx +0 -18
  163. package/next/head-metadata/from-next/metadata-types.ts +0 -158
  164. package/next/head-metadata/from-next/opengraph-types.ts +0 -267
  165. package/next/head-metadata/from-next/twitter-types.ts +0 -92
  166. package/next/head-metadata/index.tsx +0 -208
  167. package/next/index.ts +0 -1
  168. package/next/middleware/determine-device-mw.ts +0 -16
  169. package/root-layout/WHY_THIS_IS_SEPARATE.txt +0 -2
  170. package/root-layout/index.tsx +0 -112
  171. package/server-actions/TO-DO.txt +0 -1
  172. package/server-actions/firebase-app.ts +0 -14
  173. package/server-actions/index.ts +0 -5
  174. package/server-actions/store-contact.ts +0 -51
  175. package/site-def/footer/community.tsx +0 -67
  176. package/site-def/footer/company.ts +0 -37
  177. package/site-def/footer/ecosystem.ts +0 -37
  178. package/site-def/footer/index.tsx +0 -26
  179. package/site-def/footer/legal.ts +0 -28
  180. package/site-def/footer/network.ts +0 -45
  181. package/site-def/footer/svg/warpcast-logo.svg +0 -12
  182. package/site-def/index.ts +0 -3
  183. package/site-def/main-nav.tsx +0 -458
  184. package/style/cart-animation.css +0 -29
  185. package/style/checkout-animation.css +0 -23
  186. package/style/drawer-handle-overrides.css +0 -160
  187. package/style/lux-colors.css +0 -85
  188. package/style/lux-global.css +0 -51
  189. package/tailwind/fontFamily.tailwind.lux.ts +0 -18
  190. package/tailwind/index.ts +0 -2
  191. package/tailwind/lux-tw-fonts.ts +0 -40
  192. package/tailwind/tailwind.config.lux-preset.ts +0 -10
  193. package/types/chatbot-config.ts +0 -7
  194. package/types/chatbot-suggested-question.ts +0 -7
  195. package/types/contact-info.ts +0 -11
  196. package/types/site-def.ts +0 -43
@@ -1,267 +0,0 @@
1
- import type { AbsoluteTemplateString, TemplateString } from './metadata-types'
2
-
3
- export type OpenGraphType =
4
- | 'article'
5
- | 'book'
6
- | 'music.song'
7
- | 'music.album'
8
- | 'music.playlist'
9
- | 'music.radio_station'
10
- | 'profile'
11
- | 'website'
12
- | 'video.tv_show'
13
- | 'video.other'
14
- | 'video.movie'
15
- | 'video.episode'
16
-
17
- export type OpenGraph =
18
- | OpenGraphWebsite
19
- | OpenGraphArticle
20
- | OpenGraphBook
21
- | OpenGraphProfile
22
- | OpenGraphMusicSong
23
- | OpenGraphMusicAlbum
24
- | OpenGraphMusicPlaylist
25
- | OpenGraphRadioStation
26
- | OpenGraphVideoMovie
27
- | OpenGraphVideoEpisode
28
- | OpenGraphVideoTVShow
29
- | OpenGraphVideoOther
30
- | OpenGraphMetadata
31
-
32
- // update this type to reflect actual locales
33
- type Locale = string
34
-
35
- type OpenGraphMetadata = {
36
- determiner?: 'a' | 'an' | 'the' | 'auto' | ''
37
- title?: string | TemplateString
38
- description?: string
39
- emails?: string | Array<string>
40
- phoneNumbers?: string | Array<string>
41
- faxNumbers?: string | Array<string>
42
- siteName?: string
43
- locale?: Locale
44
- alternateLocale?: Locale | Array<Locale>
45
- images?: OGImage | Array<OGImage>
46
- audio?: OGAudio | Array<OGAudio>
47
- videos?: OGVideo | Array<OGVideo>
48
- url?: string | URL
49
- countryName?: string
50
- ttl?: number
51
- }
52
- export type OpenGraphWebsite = OpenGraphMetadata & {
53
- type: 'website'
54
- }
55
- type OpenGraphArticle = OpenGraphMetadata & {
56
- type: 'article'
57
- publishedTime?: string // datetime
58
- modifiedTime?: string // datetime
59
- expirationTime?: string // datetime
60
- authors?: null | string | URL | Array<string | URL>
61
- section?: null | string
62
- tags?: null | string | Array<string>
63
- }
64
- type OpenGraphBook = OpenGraphMetadata & {
65
- type: 'book'
66
- isbn?: null | string
67
- releaseDate?: null | string // datetime
68
- authors?: null | string | URL | Array<string | URL>
69
- tags?: null | string | Array<string>
70
- }
71
- type OpenGraphProfile = OpenGraphMetadata & {
72
- type: 'profile'
73
- firstName?: null | string
74
- lastName?: null | string
75
- username?: null | string
76
- gender?: null | string
77
- }
78
- type OpenGraphMusicSong = OpenGraphMetadata & {
79
- type: 'music.song'
80
- duration?: null | number
81
- albums?: null | string | URL | OGAlbum | Array<string | URL | OGAlbum>
82
- musicians?: null | string | URL | Array<string | URL>
83
- }
84
- type OpenGraphMusicAlbum = OpenGraphMetadata & {
85
- type: 'music.album'
86
- songs?: null | string | URL | OGSong | Array<string | URL | OGSong>
87
- musicians?: null | string | URL | Array<string | URL>
88
- releaseDate?: null | string // datetime
89
- }
90
- type OpenGraphMusicPlaylist = OpenGraphMetadata & {
91
- type: 'music.playlist'
92
- songs?: null | string | URL | OGSong | Array<string | URL | OGSong>
93
- creators?: null | string | URL | Array<string | URL>
94
- }
95
- type OpenGraphRadioStation = OpenGraphMetadata & {
96
- type: 'music.radio_station'
97
- creators?: null | string | URL | Array<string | URL>
98
- }
99
- type OpenGraphVideoMovie = OpenGraphMetadata & {
100
- type: 'video.movie'
101
- actors?: null | string | URL | OGActor | Array<string | URL | OGActor>
102
- directors?: null | string | URL | Array<string | URL>
103
- writers?: null | string | URL | Array<string | URL>
104
- duration?: null | number
105
- releaseDate?: null | string // datetime
106
- tags?: null | string | Array<string>
107
- }
108
- type OpenGraphVideoEpisode = OpenGraphMetadata & {
109
- type: 'video.episode'
110
- actors?: null | string | URL | OGActor | Array<string | URL | OGActor>
111
- directors?: null | string | URL | Array<string | URL>
112
- writers?: null | string | URL | Array<string | URL>
113
- duration?: null | number
114
- releaseDate?: null | string // datetime
115
- tags?: null | string | Array<string>
116
- series?: null | string | URL
117
- }
118
- type OpenGraphVideoTVShow = OpenGraphMetadata & {
119
- type: 'video.tv_show'
120
- }
121
- type OpenGraphVideoOther = OpenGraphMetadata & {
122
- type: 'video.other'
123
- }
124
-
125
- export type OGImage = string | OGImageDescriptor | URL
126
- type OGImageDescriptor = {
127
- url: string | URL
128
- secureUrl?: string | URL
129
- alt?: string
130
- type?: string
131
- width?: string | number
132
- height?: string | number
133
- }
134
- type OGAudio = string | OGAudioDescriptor | URL
135
- type OGAudioDescriptor = {
136
- url: string | URL
137
- secureUrl?: string | URL
138
- type?: string
139
- }
140
- type OGVideo = string | OGVideoDescriptor | URL
141
- type OGVideoDescriptor = {
142
- url: string | URL
143
- secureUrl?: string | URL
144
- type?: string
145
- width?: string | number
146
- height?: string | number
147
- }
148
-
149
- export type ResolvedOpenGraph =
150
- | ResolvedOpenGraphWebsite
151
- | ResolvedOpenGraphArticle
152
- | ResolvedOpenGraphBook
153
- | ResolvedOpenGraphProfile
154
- | ResolvedOpenGraphMusicSong
155
- | ResolvedOpenGraphMusicAlbum
156
- | ResolvedOpenGraphMusicPlaylist
157
- | ResolvedOpenGraphRadioStation
158
- | ResolvedOpenGraphVideoMovie
159
- | ResolvedOpenGraphVideoEpisode
160
- | ResolvedOpenGraphVideoTVShow
161
- | ResolvedOpenGraphVideoOther
162
- | ResolvedOpenGraphMetadata
163
-
164
- type ResolvedOpenGraphMetadata = {
165
- determiner?: 'a' | 'an' | 'the' | 'auto' | ''
166
- title: AbsoluteTemplateString
167
- description?: string
168
- emails?: Array<string>
169
- phoneNumbers?: Array<string>
170
- faxNumbers?: Array<string>
171
- siteName?: string
172
- locale?: Locale
173
- alternateLocale?: Array<Locale>
174
- images?: Array<OGImage>
175
- audio?: Array<OGAudio>
176
- videos?: Array<OGVideo>
177
- url: null | URL | string
178
- countryName?: string
179
- ttl?: number
180
- }
181
- type ResolvedOpenGraphWebsite = ResolvedOpenGraphMetadata & {
182
- type: 'website'
183
- }
184
- type ResolvedOpenGraphArticle = ResolvedOpenGraphMetadata & {
185
- type: 'article'
186
- publishedTime?: string // datetime
187
- modifiedTime?: string // datetime
188
- expirationTime?: string // datetime
189
- authors?: Array<string>
190
- section?: string
191
- tags?: Array<string>
192
- }
193
- type ResolvedOpenGraphBook = ResolvedOpenGraphMetadata & {
194
- type: 'book'
195
- isbn?: string
196
- releaseDate?: string // datetime
197
- authors?: Array<string>
198
- tags?: Array<string>
199
- }
200
- type ResolvedOpenGraphProfile = ResolvedOpenGraphMetadata & {
201
- type: 'profile'
202
- firstName?: string
203
- lastName?: string
204
- username?: string
205
- gender?: string
206
- }
207
- type ResolvedOpenGraphMusicSong = ResolvedOpenGraphMetadata & {
208
- type: 'music.song'
209
- duration?: number
210
- albums?: Array<OGAlbum>
211
- musicians?: Array<string | URL>
212
- }
213
- type ResolvedOpenGraphMusicAlbum = ResolvedOpenGraphMetadata & {
214
- type: 'music.album'
215
- songs?: Array<string | URL | OGSong>
216
- musicians?: Array<string | URL>
217
- releaseDate?: string // datetime
218
- }
219
- type ResolvedOpenGraphMusicPlaylist = ResolvedOpenGraphMetadata & {
220
- type: 'music.playlist'
221
- songs?: Array<string | URL | OGSong>
222
- creators?: Array<string | URL>
223
- }
224
- type ResolvedOpenGraphRadioStation = ResolvedOpenGraphMetadata & {
225
- type: 'music.radio_station'
226
- creators?: Array<string | URL>
227
- }
228
- type ResolvedOpenGraphVideoMovie = ResolvedOpenGraphMetadata & {
229
- type: 'video.movie'
230
- actors?: Array<string | URL | OGActor>
231
- directors?: Array<string | URL>
232
- writers?: Array<string | URL>
233
- duration?: number
234
- releaseDate?: string // datetime
235
- tags?: Array<string>
236
- }
237
- type ResolvedOpenGraphVideoEpisode = ResolvedOpenGraphMetadata & {
238
- type: 'video.episode'
239
- actors?: Array<string | URL | OGActor>
240
- directors?: Array<string | URL>
241
- writers?: Array<string | URL>
242
- duration?: number
243
- releaseDate?: string // datetime
244
- tags?: Array<string>
245
- series?: string | URL
246
- }
247
- type ResolvedOpenGraphVideoTVShow = ResolvedOpenGraphMetadata & {
248
- type: 'video.tv_show'
249
- }
250
- type ResolvedOpenGraphVideoOther = ResolvedOpenGraphMetadata & {
251
- type: 'video.other'
252
- }
253
-
254
- type OGSong = {
255
- url: string | URL
256
- disc?: number
257
- track?: number
258
- }
259
- type OGAlbum = {
260
- url: string | URL
261
- disc?: number
262
- track?: number
263
- }
264
- type OGActor = {
265
- url: string | URL
266
- role?: string
267
- }
@@ -1,92 +0,0 @@
1
- // Reference: https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup
2
-
3
- import type { AbsoluteTemplateString, TemplateString } from './metadata-types'
4
-
5
- export type Twitter =
6
- | TwitterSummary
7
- | TwitterSummaryLargeImage
8
- | TwitterPlayer
9
- | TwitterApp
10
- | TwitterMetadata
11
-
12
- type TwitterMetadata = {
13
- // defaults to card="summary"
14
- site?: string // username for account associated to the site itself
15
- siteId?: string // id for account associated to the site itself
16
- creator?: string // username for the account associated to the creator of the content on the site
17
- creatorId?: string // id for the account associated to the creator of the content on the site
18
- description?: string
19
- title?: string | TemplateString
20
- images?: TwitterImage | Array<TwitterImage>
21
- }
22
- type TwitterSummary = TwitterMetadata & {
23
- card: 'summary'
24
- }
25
- type TwitterSummaryLargeImage = TwitterMetadata & {
26
- card: 'summary_large_image'
27
- }
28
- type TwitterPlayer = TwitterMetadata & {
29
- card: 'player'
30
- players: TwitterPlayerDescriptor | Array<TwitterPlayerDescriptor>
31
- }
32
- type TwitterApp = TwitterMetadata & {
33
- card: 'app'
34
- app: TwitterAppDescriptor
35
- }
36
- export type TwitterAppDescriptor = {
37
- id: {
38
- iphone?: string | number
39
- ipad?: string | number
40
- googleplay?: string
41
- }
42
- url?: {
43
- iphone?: string | URL
44
- ipad?: string | URL
45
- googleplay?: string | URL
46
- }
47
- name?: string
48
- }
49
-
50
- export type TwitterImage = string | TwitterImageDescriptor | URL
51
- type TwitterImageDescriptor = {
52
- url: string | URL
53
- alt?: string
54
- secureUrl?: string | URL
55
- type?: string
56
- width?: string | number
57
- height?: string | number
58
- }
59
- type TwitterPlayerDescriptor = {
60
- playerUrl: string | URL
61
- streamUrl: string | URL
62
- width: number
63
- height: number
64
- }
65
-
66
- type ResolvedTwitterImage = {
67
- url: string | URL
68
- alt?: string
69
- secureUrl?: string | URL
70
- type?: string
71
- width?: string | number
72
- height?: string | number
73
- }
74
- type ResolvedTwitterSummary = {
75
- site: string | null
76
- siteId: string | null
77
- creator: string | null
78
- creatorId: string | null
79
- description: string | null
80
- title: AbsoluteTemplateString
81
- images?: Array<ResolvedTwitterImage>
82
- }
83
- type ResolvedTwitterPlayer = ResolvedTwitterSummary & {
84
- players: Array<TwitterPlayerDescriptor>
85
- }
86
- type ResolvedTwitterApp = ResolvedTwitterSummary & { app: TwitterAppDescriptor }
87
-
88
- export type ResolvedTwitterMetadata =
89
- | ({ card: 'summary' } & ResolvedTwitterSummary)
90
- | ({ card: 'summary_large_image' } & ResolvedTwitterSummary)
91
- | ({ card: 'player' } & ResolvedTwitterPlayer)
92
- | ({ card: 'app' } & ResolvedTwitterApp)
@@ -1,208 +0,0 @@
1
- import React from 'react'
2
-
3
- import type { Metadata } from 'next'
4
- import Head from "next/head"
5
-
6
- import type {
7
- IconDescriptor,
8
- TemplateString,
9
- Author,
10
- ThemeColorDescriptor
11
- } from './from-next/metadata-types'
12
-
13
- import type { OpenGraph, OGImage } from './from-next/opengraph-types'
14
- import type { Twitter, TwitterImage } from './from-next/twitter-types'
15
-
16
- /*
17
- NOTE: This is ONLY for sites that use the pages router in next.
18
- The app router does this automatically
19
- */
20
-
21
- const getURLasString = (url: string | URL) => {
22
- return (
23
- (typeof url === 'string') ? (url as string) : (url.href)
24
- )
25
- }
26
-
27
- // https://stackoverflow.com/questions/68746228/next-head-wont-render-meta-tags-inside-of-fragment
28
- const Icons: React.FC<{icons: IconDescriptor[]}> = ({
29
- icons
30
- }) => {
31
- return <Head>
32
- {icons.map(({url, ...rest}: IconDescriptor, index) => (
33
- <link {...rest} href={getURLasString(url)} key={`icons-${index}`}/>
34
- ))}
35
- </Head>
36
- }
37
-
38
- export const getTitleFromTemplateString = (title: string | TemplateString | null | undefined): string | null => {
39
-
40
- if (!title) {
41
- return null
42
- }
43
- if (typeof title === 'object') {
44
- if ('default' in title) {
45
- return title.default
46
- }
47
- else if ('absolute' in title) {
48
- return title.absolute
49
- }
50
- }
51
- return title as string
52
- }
53
-
54
- const Authors: React.FC<{
55
- authors: null | undefined | Author | Array<Author>
56
- }> = ({
57
- authors
58
- }) => {
59
-
60
- const Author: React.FC<{author: Author}> = ({author}) => (<>
61
- {author.name && <meta name="author" content={author.name} />}
62
- {author.url && <link rel="author" href={getURLasString(author.url)}/>}
63
- </>)
64
-
65
- if (!authors) {
66
- return null
67
- }
68
-
69
- if (Array.isArray(authors)) {
70
- return (<>
71
- {authors.map((el: Author, index) => (
72
- <Author author={el} key={`authors-${index}`} />
73
- ))}
74
- </>)
75
- }
76
- return (<Author author={authors as Author} />)
77
- }
78
-
79
- const Keywords: React.FC<{keywords: undefined | null | string | Array<string>}> = ({
80
- keywords
81
- }) => {
82
- if (!keywords) return null
83
- const content = (Array.isArray(keywords) ? keywords.join(', ') : keywords as string)
84
- return (<meta name="keywords" content={content} />)
85
- }
86
-
87
- const ThemeColor: React.FC<{
88
- thColors: null | undefined | string | ThemeColorDescriptor | ThemeColorDescriptor[]
89
- }> = ({
90
- thColors
91
- }) => {
92
-
93
- const ThColor: React.FC<{thColor: ThemeColorDescriptor}> = ({thColor}) => {
94
- const toSpread: any = {
95
- content: thColor.color
96
- }
97
-
98
- if ('media' in thColor) {
99
- toSpread.media = thColor.media
100
- }
101
-
102
- return <meta name="theme-color" {...toSpread}/>
103
- }
104
-
105
- if (!thColors) {
106
- return null
107
- }
108
-
109
- if (Array.isArray(thColors)) {
110
- return (<>
111
- {thColors.map((el: ThemeColorDescriptor, index) => (
112
- <ThColor thColor={el} key={`theme-colors-${index}`} />
113
- ))}
114
- </>)
115
- }
116
- else if (typeof thColors === 'string') {
117
- <meta name="theme-color" content={thColors as string}/>
118
- }
119
- return (<ThColor thColor={thColors as ThemeColorDescriptor} />)
120
- }
121
-
122
- const Manifest: React.FC<{
123
- manifest: undefined | null | string | URL
124
- }> = ({
125
- manifest
126
- }) => (
127
- manifest && (<link rel="manifest" href={getURLasString(manifest)}/>)
128
- )
129
-
130
- const getOGImageURL = (img: OGImage | undefined): string | null => {
131
-
132
- if (!img) {
133
- return null
134
- }
135
- if (typeof img === 'object' && 'url' in img) { // this is a OGImageDescriptor
136
- return getURLasString(img.url)
137
- }
138
- return getURLasString(img) // this is a URL or string
139
- }
140
-
141
- const getTwitterImageURL = (img: TwitterImage | undefined): string | null => {
142
-
143
- if (!img) {
144
- return null
145
- }
146
- if (typeof img === 'object' && 'url' in img) { // this is a TwitterImageDescriptor
147
- return getURLasString(img.url)
148
- }
149
- return getURLasString(img) // this is a URL or string
150
- }
151
-
152
- // https://stackoverflow.com/questions/68746228/next-head-wont-render-meta-tags-inside-of-fragment
153
- const OpenGraphComponent: React.FC<{
154
- og: OpenGraph | undefined | null
155
- }> = ({
156
- og
157
- }) => (og && (<Head>
158
- {og.url && (<meta property="og:url" content={(typeof og.url === 'string') ? (og.url as string) : (og.url.href)} />)}
159
- {(og as any).type && (<meta property="og:type" content={(og as any).type} />)}
160
- {og.title && (<meta property="og:title" content={getTitleFromTemplateString(og.title)!} />)}
161
- {og.description && (<meta property="og:description" content={og.description} />)}
162
- {og.images && (<meta property="og:image" content={getOGImageURL(Array.isArray(og.images) ? og.images[0] : og.images)!} />)}
163
- </Head>))
164
-
165
- // https://stackoverflow.com/questions/68746228/next-head-wont-render-meta-tags-inside-of-fragment
166
- export const TwitterComponent: React.FC<{
167
- tw: Twitter | undefined | null
168
- }> = ({
169
- tw
170
- }) => (tw && (<Head>
171
- {(tw as any).card && (<meta name="twitter:card" content={(tw as any).card} />)}
172
- {tw.title && (<meta name="twitter:title" content={getTitleFromTemplateString(tw.title)!} />)}
173
- {tw.description && (<meta name="twitter:description" content={tw.description} />)}
174
- {tw.images && (<meta name="twitter:image" content={getTwitterImageURL(Array.isArray(tw.images) ? tw.images[0] : tw.images)!} />)}
175
- {tw.site && (<meta name="twitter:site" content={tw.site} />)}
176
- </Head>))
177
-
178
- /* See NOTE at top of file! */
179
- // https://stackoverflow.com/questions/68746228/next-head-wont-render-meta-tags-inside-of-fragment
180
- const HeadMetadataComponent: React.FC<{
181
- metadata: Metadata
182
- }> = ({
183
- metadata
184
- }) => {
185
- const mainTitle = getTitleFromTemplateString(metadata.title)
186
-
187
- return (<>
188
- <Head>
189
- {mainTitle && (<title>{mainTitle}</title>) /* must be here, directly under Head component */}
190
- {metadata.description && (
191
- <meta name="description" content={metadata.description} />
192
- )}
193
- {metadata.applicationName && (
194
- <meta name="application-name" content={metadata.applicationName} />
195
- )}
196
- <Authors authors={metadata.authors} />
197
- <Keywords keywords={metadata.keywords} />
198
- <ThemeColor thColors={metadata.themeColor} />
199
- <Manifest manifest={metadata.manifest} />
200
- </Head>
201
- {/* Icons: We only support this format for now */}
202
- <Icons icons={metadata.icons as IconDescriptor[]} />
203
- <OpenGraphComponent og={metadata.openGraph} />
204
- <TwitterComponent tw={metadata.twitter} />
205
- </>)
206
- }
207
-
208
- export default HeadMetadataComponent
package/next/index.ts DELETED
@@ -1 +0,0 @@
1
- export { default as determineDeviceMW } from './middleware/determine-device-mw'
@@ -1,16 +0,0 @@
1
- import { NextRequest, NextResponse, userAgent } from 'next/server'
2
- import { getSelectorsByUserAgent } from 'react-device-detect'
3
-
4
- // writed this way so they can be chained :)
5
- const determineDeviceMW = async (request: NextRequest) => {
6
-
7
- const ua = userAgent(request)
8
- const { isMobileOnly, isTablet, isDesktop } = getSelectorsByUserAgent(ua.ua)
9
- const agent = isMobileOnly ? 'phone' : (isTablet ? 'tablet' : (isDesktop ? 'desktop' : 'unknown'))
10
- const { nextUrl: url } = request
11
- //console.log(`\n=== from ${url.href} on a *${agent && agent.toUpperCase()}* device. ===\n`)
12
- url.searchParams.set('agent', agent)
13
- return NextResponse.rewrite(url)
14
- }
15
-
16
- export default determineDeviceMW
@@ -1,2 +0,0 @@
1
- Unwise to have this in a barrel / index file that is mostly imported by a Client Component.
2
- Creates Next / SSR issues
@@ -1,112 +0,0 @@
1
- import React, { type PropsWithChildren } from 'react'
2
- import type { Viewport } from 'next'
3
-
4
- import { Toaster } from '@hanzo/ui/primitives'
5
- import { AuthServiceProvider } from '@hanzo/auth/service'
6
- import { getUserServerSide } from '@hanzo/auth/server'
7
- import type { AuthServiceConf } from '@hanzo/auth/types'
8
- import { CommerceProvider } from '@hanzo/commerce'
9
-
10
- import getAppRouterBodyFontClasses from '../next/font/get-app-router-font-classes'
11
- import { FacebookPixelHead } from '../next/analytics/pixel-analytics'
12
-
13
- import { CommerceUIProvider } from '../commerce/ui/context'
14
- import { AuthListener, ChatWidget, Header, Scripts } from '../components'
15
-
16
- import CommerceDrawer from '../components/commerce/drawer'
17
-
18
- import type SiteDef from '../types/site-def'
19
-
20
- import '../style/lux-global.css'
21
- import '../style/cart-animation.css'
22
- import '../style/checkout-animation.css'
23
-
24
-
25
- // Next 14: https://nextjs.org/docs/app/building-your-application/upgrading/codemods#use-viewport-export
26
- const viewport = {
27
- themeColor: [
28
- { media: '(prefers-color-scheme: light)', color: 'white' },
29
- { media: '(prefers-color-scheme: dark)', color: 'black' },
30
- ],
31
- } satisfies Viewport
32
-
33
- /*
34
- These '.variable' fields are actually autogenerate css classnames that *define* the actual
35
- css variables ('--<ugly-name>') that one asks for in the tailwind classes.
36
- They are what make them available in the global scope. So this MUST
37
- be done like this for the tailwind font classes to work.
38
-
39
- (...not to be confused with the css var itself. This field should be named something else!)
40
- */
41
-
42
- /*
43
- re body: overflow-y-hidden overflow-x-hidden, h-full
44
- We cannot have these on body tag for scroll-snap to work on iOS!
45
- */
46
- const bodyClasses =
47
- 'bg-background text-foreground flex flex-col min-h-full ' +
48
- getAppRouterBodyFontClasses()
49
-
50
- async function RootLayout({
51
- showHeader = false,
52
- chatbot = false,
53
- siteDef,
54
- children,
55
- } : {
56
- siteDef: SiteDef
57
- showHeader?: boolean
58
- chatbot?: boolean
59
- } & PropsWithChildren) {
60
-
61
- const currentUser = await getUserServerSide()
62
-
63
- const Guts: React.FC = () => (<>
64
- {showHeader && <Header siteDef={siteDef}/>}
65
- {children}
66
- {chatbot && (<ChatWidget
67
- title='LUX'
68
- subtitle='AI'
69
- chatbotUrl='https://lux.chat/iframe'
70
- suggestedQuestions={siteDef.chatbot?.suggestedQuestions ?? []}
71
- buttonClx='hidden md:block'
72
- />)}
73
- </>)
74
-
75
- return (
76
- <html lang='en' suppressHydrationWarning className='hanzo-ui-dark-theme' style={{backgroundColor: '#000'}}>
77
- <head >
78
- {/* https://stackoverflow.com/a/75716588/11645689 */ }
79
- <base target='_blank' />
80
- <FacebookPixelHead/>
81
- </head>
82
-
83
- <body className={bodyClasses} style={{
84
-
85
- // As also noted above, 'overflow: hidden' on the <body> tag breaks scroll snap!
86
- display: 'none', // see scripts.tsx // :aa concerned about this.
87
-
88
- }}>
89
- <Scripts/>
90
- <AuthServiceProvider user={currentUser} conf={{} as AuthServiceConf}>
91
- {siteDef?.commerce ? (
92
- <CommerceProvider config={siteDef.commerce!} >
93
- <CommerceUIProvider >
94
- <Guts />
95
- <CommerceDrawer />
96
- </CommerceUIProvider>
97
- </CommerceProvider>
98
- ) : (
99
- <Guts />
100
- )}
101
- <AuthListener/>
102
- </AuthServiceProvider>
103
- <Toaster position='top-center' duration={3000}/>
104
- </body>
105
- </html>
106
- )
107
- }
108
-
109
- export {
110
- RootLayout,
111
- viewport
112
- }
@@ -1 +0,0 @@
1
- move login and logout api routes here!