mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 15:36:58 +00:00
fix some option types and pass REACTION_API_DOMAIN to front-end
Signed-off-by: Loan Laux <loan@outgrow.io>
This commit is contained in:
parent
d5804d60a1
commit
6f0dfb78f3
@ -53,7 +53,7 @@ const normalizeProductOption = ({ id, displayName, values }: ProductOption) => {
|
||||
}
|
||||
}
|
||||
|
||||
const normalizeProductVariants = (variants: Maybe<CatalogProductVariant>[]) => {
|
||||
const normalizeProductVariants = (variants: CatalogProductVariant[]) => {
|
||||
return variants.map((variant) => {
|
||||
const { _id, options, sku, title, pricing = [], variantId } = variant ?? {}
|
||||
const variantPrice = pricing[0]?.price ?? pricing[0]?.minPrice ?? 0
|
||||
@ -79,7 +79,7 @@ const normalizeProductVariants = (variants: Maybe<CatalogProductVariant>[]) => {
|
||||
}
|
||||
|
||||
export function groupProductOptionsByAttributeLabel(
|
||||
options: Maybe<CatalogProductVariant>[]
|
||||
options: CatalogProductVariant[]
|
||||
) {
|
||||
return options.reduce((groupedOptions, currentOption) => {
|
||||
const attributeLabelIndex = groupedOptions.findIndex((option) => {
|
||||
@ -101,7 +101,7 @@ export function groupProductOptionsByAttributeLabel(
|
||||
groupedOptions = [
|
||||
...groupedOptions,
|
||||
normalizeProductOption({
|
||||
id: currentOption?.variantId ?? '',
|
||||
id: currentOption?._id ?? '',
|
||||
displayName: currentOption?.attributeLabel ?? '',
|
||||
values: [currentOption?.optionTitle ?? ''],
|
||||
}),
|
||||
|
@ -11,7 +11,7 @@ const isRC = provider === 'reactioncommerce'
|
||||
|
||||
module.exports = withCommerceConfig({
|
||||
env: {
|
||||
NEXTAUTH_URL: process.env.NEXTAUTH_URL,
|
||||
REACTION_API_DOMAIN: process.env.REACTION_API_DOMAIN,
|
||||
},
|
||||
commerce,
|
||||
i18n: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user