Skip to content

Commit

Permalink
chore(core): rename query/mutations to standard names (#1928)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemoya authored Jan 23, 2025
1 parent 43351ab commit 157ea54
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 17 deletions.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-beds-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bigcommerce/catalyst-core": patch
---

Rename some GQL query/mutations/fragments to standardized naming.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { client } from '~/client';
import { graphql } from '~/client/graphql';

const ChangePasswordMutation = graphql(`
mutation ChangePassword($input: ResetPasswordInput!) {
mutation ChangePasswordMutation($input: ResetPasswordInput!) {
customer {
resetPassword(input: $input) {
__typename
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { client } from '~/client';
import { graphql } from '~/client/graphql';

const ResetPasswordMutation = graphql(`
mutation ResetPassword($input: RequestResetPasswordInput!, $reCaptcha: ReCaptchaV2Input) {
mutation ResetPasswordMutation($input: RequestResetPasswordInput!, $reCaptcha: ReCaptchaV2Input) {
customer {
requestResetPassword(input: $input, reCaptchaV2: $reCaptcha) {
__typename
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import { FieldNameToFieldId } from '~/data-transformers/form-field-transformer/u
import { redirect } from '~/i18n/routing';

const RegisterCustomerMutation = graphql(`
mutation RegisterCustomer($input: RegisterCustomerInput!, $reCaptchaV2: ReCaptchaV2Input) {
mutation RegisterCustomerMutation(
$input: RegisterCustomerInput!
$reCaptchaV2: ReCaptchaV2Input
) {
customer {
registerCustomer(input: $input, reCaptchaV2: $reCaptchaV2) {
customer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ import { unstable_expireTag } from 'next/cache';
import { getTranslations } from 'next-intl/server';

import { updateAccountSchema } from '@/vibes/soul/sections/account-settings-section/schema';
import { UpdateAccountAction } from '@/vibes/soul/sections/account-settings-section/update-account-form';
import { getSessionCustomerAccessToken } from '~/auth';
import { client } from '~/client';
import { graphql } from '~/client/graphql';
import { TAGS } from '~/client/tags';

import { UpdateAccountAction } from '../../../../../../vibes/soul/sections/account-settings-section/update-account-form';

const UpdateCustomerMutation = graphql(`
mutation UpdateCustomerMutation($input: UpdateCustomerInput!) {
customer {
Expand Down
10 changes: 5 additions & 5 deletions core/app/[locale]/(default)/cart/page-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const DigitalItemFragment = graphql(`
`);

const MoneyFieldsFragment = graphql(`
fragment MoneyFields on Money {
fragment MoneyFieldsFragment on Money {
currencyCode
value
}
Expand All @@ -148,18 +148,18 @@ const CartPageQuery = graphql(
}
checkout(entityId: $cartId) {
subtotal {
...MoneyFields
...MoneyFieldsFragment
}
grandTotal {
...MoneyFields
...MoneyFieldsFragment
}
taxTotal {
...MoneyFields
...MoneyFieldsFragment
}
cart {
currencyCode
discountedAmount {
...MoneyFields
...MoneyFieldsFragment
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion core/app/[locale]/(default)/webpages/[id]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface Props extends React.PropsWithChildren {
}

const WebPageChildrenQuery = graphql(`
query WebPageChildren($id: ID!) {
query WebPageChildrenQuery($id: ID!) {
node(id: $id) {
... on WebPage {
children(first: 20) {
Expand Down
2 changes: 1 addition & 1 deletion core/app/favicon.ico/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { graphql } from '~/client/graphql';
import { defaultLocale } from '~/i18n/routing';

const GetFaviconQuery = graphql(`
query GetFavicon {
query GetFaviconQuery {
site {
settings {
faviconUrl
Expand Down
2 changes: 1 addition & 1 deletion core/app/robots.txt/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { graphql } from '~/client/graphql';
import { defaultLocale } from '~/i18n/routing';

const RobotsTxtQuery = graphql(`
query RobotsTxt {
query RobotsTxtQuery {
site {
settings {
robotsTxt
Expand Down
4 changes: 2 additions & 2 deletions core/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { graphql } from '~/client/graphql';
import { getCartId } from '~/lib/cart';

const LoginMutation = graphql(`
mutation Login($email: String!, $password: String!, $cartEntityId: String) {
mutation LoginMutation($email: String!, $password: String!, $cartEntityId: String) {
login(email: $email, password: $password, guestCartEntityId: $cartEntityId) {
customerAccessToken {
value
Expand All @@ -25,7 +25,7 @@ const LoginMutation = graphql(`
`);

const LoginWithTokenMutation = graphql(`
mutation LoginWithCustomerLoginJwt($jwt: String!, $cartEntityId: String) {
mutation LoginWithCustomerLoginJwtMutation($jwt: String!, $cartEntityId: String) {
loginWithCustomerLoginJwt(jwt: $jwt, guestCartEntityId: $cartEntityId) {
customerAccessToken {
value
Expand Down
2 changes: 1 addition & 1 deletion core/components/header/_actions/switch-currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const currencySwitchSchema = z.object({

// Note: this results in a new cart being created in the new currency, so the cart ID will change
const UpdateCartCurrencyMutation = graphql(`
mutation UpdateCartCurrency($input: UpdateCartCurrencyInput!) {
mutation UpdateCartCurrencyMutation($input: UpdateCartCurrencyInput!) {
cart {
updateCartCurrency(input: $input) {
cart {
Expand Down
2 changes: 1 addition & 1 deletion core/middlewares/with-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { kv } from '../lib/kv';
import { type MiddlewareFactory } from './compose-middlewares';

const GetRouteQuery = graphql(`
query getRoute($path: String!) {
query GetRouteQuery($path: String!) {
site {
route(path: $path, redirectBehavior: FOLLOW) {
redirect {
Expand Down

0 comments on commit 157ea54

Please sign in to comment.