mirror of
https://github.com/vercel/commerce.git
synced 2025-05-18 23:46: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) => {
|
return variants.map((variant) => {
|
||||||
const { _id, options, sku, title, pricing = [], variantId } = variant ?? {}
|
const { _id, options, sku, title, pricing = [], variantId } = variant ?? {}
|
||||||
const variantPrice = pricing[0]?.price ?? pricing[0]?.minPrice ?? 0
|
const variantPrice = pricing[0]?.price ?? pricing[0]?.minPrice ?? 0
|
||||||
@ -79,7 +79,7 @@ const normalizeProductVariants = (variants: Maybe<CatalogProductVariant>[]) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function groupProductOptionsByAttributeLabel(
|
export function groupProductOptionsByAttributeLabel(
|
||||||
options: Maybe<CatalogProductVariant>[]
|
options: CatalogProductVariant[]
|
||||||
) {
|
) {
|
||||||
return options.reduce((groupedOptions, currentOption) => {
|
return options.reduce((groupedOptions, currentOption) => {
|
||||||
const attributeLabelIndex = groupedOptions.findIndex((option) => {
|
const attributeLabelIndex = groupedOptions.findIndex((option) => {
|
||||||
@ -101,7 +101,7 @@ export function groupProductOptionsByAttributeLabel(
|
|||||||
groupedOptions = [
|
groupedOptions = [
|
||||||
...groupedOptions,
|
...groupedOptions,
|
||||||
normalizeProductOption({
|
normalizeProductOption({
|
||||||
id: currentOption?.variantId ?? '',
|
id: currentOption?._id ?? '',
|
||||||
displayName: currentOption?.attributeLabel ?? '',
|
displayName: currentOption?.attributeLabel ?? '',
|
||||||
values: [currentOption?.optionTitle ?? ''],
|
values: [currentOption?.optionTitle ?? ''],
|
||||||
}),
|
}),
|
||||||
|
@ -11,7 +11,7 @@ const isRC = provider === 'reactioncommerce'
|
|||||||
|
|
||||||
module.exports = withCommerceConfig({
|
module.exports = withCommerceConfig({
|
||||||
env: {
|
env: {
|
||||||
NEXTAUTH_URL: process.env.NEXTAUTH_URL,
|
REACTION_API_DOMAIN: process.env.REACTION_API_DOMAIN,
|
||||||
},
|
},
|
||||||
commerce,
|
commerce,
|
||||||
i18n: {
|
i18n: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user