Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .changeset/five-corners-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
"@bigcommerce/catalyst-core": patch
---

Remove "Exclusive Offers" field temporarily. Currently, the field is not fully implemented in GraphQL, so it may be misleading to display it on the storefront if it's not actually doing anything when registering a customer.

Once the Register Customer operation takes this field into account, we can display it again.

## Migration

Update `core/app/[locale]/(default)/(auth)/register/page.tsx` and add the function:
```ts
// There is currently a GraphQL gap where the "Exclusive Offers" field isn't accounted for
// during customer registration, so the field should not be shown on the Catalyst storefront until it is hooked up.
function removeExlusiveOffersField(field: Field | Field[]): boolean {
if (Array.isArray(field)) {
// Exclusive offers field will always have ID '25', since it is made upon store creation and is also read-only.
return !field.some((f) => f.id === '25');
}

return field.id !== '25';
}
```

Then, add the following code at the end of the `const fields` declaration:
```ts
})
.filter(exists)
.filter(removeExlusiveOffersField); // <---
```
15 changes: 14 additions & 1 deletion core/app/[locale]/(default)/(auth)/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Metadata } from 'next';
import { notFound } from 'next/navigation';
import { getTranslations, setRequestLocale } from 'next-intl/server';

import { Field } from '@/vibes/soul/form/dynamic-form/schema';
import { DynamicFormSection } from '@/vibes/soul/sections/dynamic-form-section';
import {
formFieldTransformer,
Expand Down Expand Up @@ -32,6 +33,17 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
};
}

// There is currently a GraphQL gap where the "Exclusive Offers" field isn't accounted for
// during customer registration, so the field should not be shown on the Catalyst storefront until it is hooked up.
function removeExlusiveOffersField(field: Field | Field[]): boolean {
if (Array.isArray(field)) {
// Exclusive offers field will always have ID '25', since it is made upon store creation and is also read-only.
return !field.some((f) => f.id === '25');
}

return field.id !== '25';
}

export default async function Register({ params }: Props) {
const { locale } = await params;

Expand Down Expand Up @@ -90,7 +102,8 @@ export default async function Register({ params }: Props) {

return injectCountryCodeOptions(field, countries ?? []);
})
.filter(exists);
.filter(exists)
.filter(removeExlusiveOffersField);

return (
<DynamicFormSection
Expand Down