mirror of
https://github.com/vercel/commerce.git
synced 2025-05-17 15:06:59 +00:00
Merge pull request #6 from reactioncommerce/fix-failed-build
Fix failed build for local package
This commit is contained in:
commit
2baf1723b0
@ -7,6 +7,8 @@ export type Category = {
|
|||||||
|
|
||||||
export type Brand = any
|
export type Brand = any
|
||||||
|
|
||||||
|
export type Navigation = any
|
||||||
|
|
||||||
export type SiteTypes = {
|
export type SiteTypes = {
|
||||||
category: Category
|
category: Category
|
||||||
brand: Brand
|
brand: Brand
|
||||||
|
@ -15,16 +15,16 @@ export type Vendor = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export type NavigationItem = {
|
export type Navigation = {
|
||||||
url: string
|
url: string
|
||||||
label: string
|
label: string
|
||||||
isUrlRelative: boolean
|
isUrlRelative: boolean
|
||||||
shouldOpenInNewWindow: boolean
|
shouldOpenInNewWindow: boolean
|
||||||
items?: NavigationItem[]
|
items?: Navigation[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SiteTypes = CoreSiteTypes & {
|
export type SiteTypes = CoreSiteTypes & {
|
||||||
navigation: NavigationItem
|
navigation: Navigation
|
||||||
}
|
}
|
||||||
|
|
||||||
export type GetSiteInfoOperation<T extends SiteTypes = SiteTypes> = {
|
export type GetSiteInfoOperation<T extends SiteTypes = SiteTypes> = {
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
Category,
|
Category,
|
||||||
Vendor,
|
Vendor,
|
||||||
OCVendor,
|
OCVendor,
|
||||||
NavigationItem,
|
Navigation,
|
||||||
} from '../types/site'
|
} from '../types/site'
|
||||||
import {
|
import {
|
||||||
CatalogItemProduct,
|
CatalogItemProduct,
|
||||||
@ -310,7 +310,7 @@ function normalizeLineItem(cartItemEdge: CartItemEdge): LineItem {
|
|||||||
|
|
||||||
export const normalizeNavigation = (
|
export const normalizeNavigation = (
|
||||||
navigationTreeItems: NavigationTreeItem[]
|
navigationTreeItems: NavigationTreeItem[]
|
||||||
): NavigationItem[] => {
|
): Navigation[] => {
|
||||||
return navigationTreeItems.map(({ items, navigationItem: { data } }) => {
|
return navigationTreeItems.map(({ items, navigationItem: { data } }) => {
|
||||||
return {
|
return {
|
||||||
url: data?.url ?? '/',
|
url: data?.url ?? '/',
|
||||||
|
@ -4,6 +4,21 @@ import SidebarLayout from '@components/common/SidebarLayout'
|
|||||||
import { useUI } from '@components/ui/context'
|
import { useUI } from '@components/ui/context'
|
||||||
import { Button } from '@components/ui'
|
import { Button } from '@components/ui'
|
||||||
import { useCheckoutContext } from '../context'
|
import { useCheckoutContext } from '../context'
|
||||||
|
import { Key, ReactChild, ReactFragment, ReactPortal } from 'react'
|
||||||
|
|
||||||
|
type FulfillmentGroup = {
|
||||||
|
type: string
|
||||||
|
}
|
||||||
|
|
||||||
|
type FulfillmentOption = {
|
||||||
|
fulfillmentMethod: {
|
||||||
|
_id: string
|
||||||
|
displayName: string
|
||||||
|
}
|
||||||
|
price: {
|
||||||
|
displayAmount: string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const ShippingMethod = () => {
|
const ShippingMethod = () => {
|
||||||
const { setSidebarView } = useUI()
|
const { setSidebarView } = useUI()
|
||||||
@ -13,7 +28,7 @@ const ShippingMethod = () => {
|
|||||||
|
|
||||||
const updateShippingMethod = useUpdateUpdateAddress()
|
const updateShippingMethod = useUpdateUpdateAddress()
|
||||||
const shippingGroup = cart?.checkout?.fulfillmentGroups.find(
|
const shippingGroup = cart?.checkout?.fulfillmentGroups.find(
|
||||||
(group) => group?.type === 'shipping'
|
(group: FulfillmentGroup) => group?.type === 'shipping'
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleSubmit = async (event: React.ChangeEvent<HTMLFormElement>) => {
|
const handleSubmit = async (event: React.ChangeEvent<HTMLFormElement>) => {
|
||||||
@ -40,7 +55,8 @@ const ShippingMethod = () => {
|
|||||||
Shipping Methods
|
Shipping Methods
|
||||||
</h2>
|
</h2>
|
||||||
<div>
|
<div>
|
||||||
{shippingGroup.availableFulfillmentOptions.map((option) => (
|
{shippingGroup.availableFulfillmentOptions.map(
|
||||||
|
(option: FulfillmentOption) => (
|
||||||
<div
|
<div
|
||||||
className="flex flex-row my-3 items-center justify-between"
|
className="flex flex-row my-3 items-center justify-between"
|
||||||
key={option?.fulfillmentMethod?._id}
|
key={option?.fulfillmentMethod?._id}
|
||||||
@ -52,8 +68,9 @@ const ShippingMethod = () => {
|
|||||||
type="radio"
|
type="radio"
|
||||||
value={option?.fulfillmentMethod?._id}
|
value={option?.fulfillmentMethod?._id}
|
||||||
defaultChecked={
|
defaultChecked={
|
||||||
shippingGroup.selectedFulfillmentOption?.fulfillmentMethod
|
shippingGroup.selectedFulfillmentOption
|
||||||
?._id === option?.fulfillmentMethod?._id
|
?.fulfillmentMethod?._id ===
|
||||||
|
option?.fulfillmentMethod?._id
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<span className="ml-3 text-sm">
|
<span className="ml-3 text-sm">
|
||||||
@ -63,7 +80,8 @@ const ShippingMethod = () => {
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<span>{option?.price.displayAmount}</span>
|
<span>{option?.price.displayAmount}</span>
|
||||||
</div>
|
</div>
|
||||||
))}
|
)
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="sticky z-20 bottom-0 w-full right-0 left-0 py-12 bg-accent-0 border-t border-accent-2 px-6">
|
<div className="sticky z-20 bottom-0 w-full right-0 left-0 py-12 bg-accent-0 border-t border-accent-2 px-6">
|
||||||
|
@ -7,7 +7,7 @@ import React, {
|
|||||||
createContext,
|
createContext,
|
||||||
} from 'react'
|
} from 'react'
|
||||||
import type { CardFields } from '@commerce/types/customer/card'
|
import type { CardFields } from '@commerce/types/customer/card'
|
||||||
import type { AddressFields } from '@framework/types/customer/address'
|
import type { AddressFields } from '@commerce/types/customer/address'
|
||||||
|
|
||||||
export type State = {
|
export type State = {
|
||||||
cardFields: CardFields
|
cardFields: CardFields
|
||||||
|
@ -16,9 +16,8 @@ import ShippingMethodView from '@components/checkout/ShippingMethodView'
|
|||||||
import { CheckoutProvider } from '@components/checkout/context'
|
import { CheckoutProvider } from '@components/checkout/context'
|
||||||
import { MenuSidebarView } from '@components/common/UserNav'
|
import { MenuSidebarView } from '@components/common/UserNav'
|
||||||
import type { Page } from '@commerce/types/page'
|
import type { Page } from '@commerce/types/page'
|
||||||
import type { Category } from '@commerce/types/site'
|
import type { Category, Navigation } from '@commerce/types/site'
|
||||||
import type { Link as LinkProps } from '../UserNav/MenuSidebarView'
|
import type { Link as LinkProps } from '../UserNav/MenuSidebarView'
|
||||||
import { NavigationItem } from '@framework/types/site'
|
|
||||||
|
|
||||||
const Loading = () => (
|
const Loading = () => (
|
||||||
<div className="w-80 h-80 flex items-center text-center justify-center p-3">
|
<div className="w-80 h-80 flex items-center text-center justify-center p-3">
|
||||||
@ -54,7 +53,7 @@ interface Props {
|
|||||||
pageProps: {
|
pageProps: {
|
||||||
pages?: Page[]
|
pages?: Page[]
|
||||||
categories: Category[]
|
categories: Category[]
|
||||||
navigation: NavigationItem[]
|
navigation: Navigation[]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +87,8 @@ const SidebarView: React.FC<{
|
|||||||
{sidebarView === 'CART_VIEW' && <CartSidebarView />}
|
{sidebarView === 'CART_VIEW' && <CartSidebarView />}
|
||||||
{sidebarView === 'SHIPPING_VIEW' && <ShippingView />}
|
{sidebarView === 'SHIPPING_VIEW' && <ShippingView />}
|
||||||
{sidebarView === 'PAYMENT_VIEW' && <PaymentMethodView />}
|
{sidebarView === 'PAYMENT_VIEW' && <PaymentMethodView />}
|
||||||
{sidebarView === 'SHIPPING_METHOD_VIEW' && <ShippingMethodView />}
|
{process.env.COMMERCE_CUSTOMCHECKOUT_ENABLED &&
|
||||||
|
sidebarView === 'SHIPPING_METHOD_VIEW' && <ShippingMethodView />}
|
||||||
{sidebarView === 'CHECKOUT_VIEW' && <CheckoutSidebarView />}
|
{sidebarView === 'CHECKOUT_VIEW' && <CheckoutSidebarView />}
|
||||||
{sidebarView === 'MOBILE_MENU_VIEW' && <MenuSidebarView links={links} />}
|
{sidebarView === 'MOBILE_MENU_VIEW' && <MenuSidebarView links={links} />}
|
||||||
</Sidebar>
|
</Sidebar>
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
import cn from 'clsx'
|
import cn from 'clsx'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
|
|
||||||
import { NavigationItem } from '@framework/types/site'
|
|
||||||
|
|
||||||
import s from './Navbar.module.css'
|
import s from './Navbar.module.css'
|
||||||
|
|
||||||
|
type Navigation = {
|
||||||
|
url: string
|
||||||
|
label: string
|
||||||
|
isUrlRelative: boolean
|
||||||
|
shouldOpenInNewWindow: boolean
|
||||||
|
items?: Navigation[]
|
||||||
|
}
|
||||||
|
|
||||||
interface SubItemProps {
|
interface SubItemProps {
|
||||||
subItem: NavigationItem
|
subItem: Navigation
|
||||||
level?: number
|
level?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +52,7 @@ const SubItem = ({ subItem, level = 0 }: SubItemProps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface CustomNavbarProps {
|
interface CustomNavbarProps {
|
||||||
links?: NavigationItem[]
|
links?: Navigation[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const CustomNavbar = ({ links = [] }: CustomNavbarProps) => {
|
const CustomNavbar = ({ links = [] }: CustomNavbarProps) => {
|
||||||
|
@ -5,7 +5,7 @@ import s from './Navbar.module.css'
|
|||||||
import NavbarRoot from './NavbarRoot'
|
import NavbarRoot from './NavbarRoot'
|
||||||
import { Logo, Container } from '@components/ui'
|
import { Logo, Container } from '@components/ui'
|
||||||
import { Searchbar, UserNav } from '@components/common'
|
import { Searchbar, UserNav } from '@components/common'
|
||||||
import { SiteTypes } from '@framework/types/site'
|
import { Navigation } from '@commerce/types/site'
|
||||||
import CustomNavbar from './CustomNavbar'
|
import CustomNavbar from './CustomNavbar'
|
||||||
|
|
||||||
interface Link {
|
interface Link {
|
||||||
@ -15,7 +15,7 @@ interface Link {
|
|||||||
|
|
||||||
interface NavbarProps {
|
interface NavbarProps {
|
||||||
links?: Link[]
|
links?: Link[]
|
||||||
customNavigation?: SiteTypes['navigation'][]
|
customNavigation?: Navigation[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const Navbar: FC<NavbarProps> = ({ links, customNavigation }) => (
|
const Navbar: FC<NavbarProps> = ({ links, customNavigation }) => (
|
||||||
|
@ -3,11 +3,7 @@
|
|||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"lib": [
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
"dom",
|
|
||||||
"dom.iterable",
|
|
||||||
"esnext"
|
|
||||||
],
|
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
@ -20,43 +16,17 @@
|
|||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"incremental": true,
|
"incremental": true,
|
||||||
"paths": {
|
"paths": {
|
||||||
"@lib/*": [
|
"@lib/*": ["lib/*"],
|
||||||
"lib/*"
|
"@utils/*": ["utils/*"],
|
||||||
],
|
"@config/*": ["config/*"],
|
||||||
"@utils/*": [
|
"@assets/*": ["assets/*"],
|
||||||
"utils/*"
|
"@components/*": ["components/*"],
|
||||||
],
|
"@commerce": ["../packages/commerce/src"],
|
||||||
"@config/*": [
|
"@commerce/*": ["../packages/commerce/src/*"],
|
||||||
"config/*"
|
"@framework": ["../packages/local/src"],
|
||||||
],
|
"@framework/*": ["../packages/local/src/*"]
|
||||||
"@assets/*": [
|
|
||||||
"assets/*"
|
|
||||||
],
|
|
||||||
"@components/*": [
|
|
||||||
"components/*"
|
|
||||||
],
|
|
||||||
"@commerce": [
|
|
||||||
"../packages/commerce/src"
|
|
||||||
],
|
|
||||||
"@commerce/*": [
|
|
||||||
"../packages/commerce/src/*"
|
|
||||||
],
|
|
||||||
"@framework": [
|
|
||||||
"../packages/local/src"
|
|
||||||
],
|
|
||||||
"@framework/*": [
|
|
||||||
"../packages/local/src/*"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": [
|
"include": ["next-env.d.ts", "**/*.d.ts", "**/*.ts", "**/*.tsx", "**/*.js"],
|
||||||
"next-env.d.ts",
|
"exclude": ["node_modules"]
|
||||||
"**/*.d.ts",
|
|
||||||
"**/*.ts",
|
|
||||||
"**/*.tsx",
|
|
||||||
"**/*.js"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
]
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user