mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
setup custom fetcher and auth hooks
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Product } from '@commerce/types'
|
||||
import { Customer } from '@commerce/types'
|
||||
|
||||
import {
|
||||
Product as ShopifyProduct,
|
||||
@@ -11,7 +12,7 @@ import {
|
||||
ProductOption,
|
||||
} from '../schema'
|
||||
|
||||
import type { Cart, LineItem } from '../types'
|
||||
import type { Cart, LineItem, SwellCustomer } from '../types'
|
||||
|
||||
const money = ({ amount, currencyCode }: MoneyV2) => {
|
||||
return {
|
||||
@@ -121,6 +122,15 @@ export function normalizeCart(checkout: Checkout): Cart {
|
||||
}
|
||||
}
|
||||
|
||||
export function normalizeCustomer(customer: SwellCustomer): Customer {
|
||||
const { first_name: firstName, last_name: lastName } = customer
|
||||
return {
|
||||
...customer,
|
||||
firstName,
|
||||
lastName,
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeLineItem({
|
||||
node: { id, title, variant, quantity },
|
||||
}: CheckoutLineItemEdge): LineItem {
|
||||
|
Reference in New Issue
Block a user