From 8f260d66e7eac35d196d3e3a240101d73769fe5b Mon Sep 17 00:00:00 2001 From: Loan Laux Date: Fri, 23 Apr 2021 20:35:14 +0400 Subject: [PATCH] implement login Signed-off-by: Loan Laux --- .../api/cart/handlers/get-cart.ts | 10 +- .../reactioncommerce/api/checkout/index.ts | 6 +- framework/reactioncommerce/api/index.ts | 8 +- .../api/utils/fetch-graphql-api.ts | 1 - framework/reactioncommerce/auth/index.ts | 3 + framework/reactioncommerce/auth/use-login.tsx | 29 +- .../reactioncommerce/auth/use-signup.tsx | 4 +- .../cart/utils/checkout-create.ts | 4 +- framework/reactioncommerce/const.ts | 6 +- framework/reactioncommerce/fetcher.ts | 9 + framework/reactioncommerce/schema.d.ts | 11351 ++++---- framework/reactioncommerce/schema.graphql | 22610 ++++++++-------- .../reactioncommerce/utils/customer-token.ts | 14 +- .../utils/mutations/authenticate.ts | 15 + .../mutations/customer-access-token-create.ts | 16 - .../reactioncommerce/utils/mutations/index.ts | 2 +- next.config.js | 3 + yarn.lock | 2747 +- 18 files changed, 18596 insertions(+), 18242 deletions(-) create mode 100644 framework/reactioncommerce/auth/index.ts create mode 100644 framework/reactioncommerce/utils/mutations/authenticate.ts delete mode 100644 framework/reactioncommerce/utils/mutations/customer-access-token-create.ts diff --git a/framework/reactioncommerce/api/cart/handlers/get-cart.ts b/framework/reactioncommerce/api/cart/handlers/get-cart.ts index 0e6eb5c36..ca8d1d08e 100644 --- a/framework/reactioncommerce/api/cart/handlers/get-cart.ts +++ b/framework/reactioncommerce/api/cart/handlers/get-cart.ts @@ -9,16 +9,14 @@ import { import { normalizeCart } from '@framework/utils' // Return current cart info -const getCart: CartHandlers['getCart'] = async ({ - req: { +const getCart: CartHandlers['getCart'] = async ({ req, res, config }) => { + const { cookies: { [REACTION_ANONYMOUS_CART_TOKEN_COOKIE]: anonymousCartToken, [REACTION_CART_ID_COOKIE]: cartId, }, - }, - res, - config, -}) => { + } = req + let normalizedCart console.log('get-cart API') diff --git a/framework/reactioncommerce/api/checkout/index.ts b/framework/reactioncommerce/api/checkout/index.ts index de2cb835c..1fe5fb6fe 100644 --- a/framework/reactioncommerce/api/checkout/index.ts +++ b/framework/reactioncommerce/api/checkout/index.ts @@ -6,7 +6,7 @@ import createApiHandler, { import { REACTION_ANONYMOUS_CART_TOKEN_COOKIE, SHOPIFY_CHECKOUT_URL_COOKIE, - SHOPIFY_CUSTOMER_TOKEN_COOKIE, + REACTION_CUSTOMER_TOKEN_COOKIE, } from '../../const' import { getConfig } from '..' @@ -25,14 +25,14 @@ const checkoutApi: ReactionCommerceApiHandler = async ( const { cookies } = req const checkoutUrl = cookies[SHOPIFY_CHECKOUT_URL_COOKIE] - const customerCookie = cookies[SHOPIFY_CUSTOMER_TOKEN_COOKIE] + const customerCookie = cookies[REACTION_CUSTOMER_TOKEN_COOKIE] if (customerCookie) { try { await config.fetch(associateCustomerWithCheckoutMutation, { variables: { checkoutId: cookies[REACTION_ANONYMOUS_CART_TOKEN_COOKIE], - customerAccessToken: cookies[SHOPIFY_CUSTOMER_TOKEN_COOKIE], + customerAccessToken: cookies[REACTION_CUSTOMER_TOKEN_COOKIE], }, }) } catch (error) { diff --git a/framework/reactioncommerce/api/index.ts b/framework/reactioncommerce/api/index.ts index 2b7c47b89..2e3c44683 100644 --- a/framework/reactioncommerce/api/index.ts +++ b/framework/reactioncommerce/api/index.ts @@ -5,8 +5,8 @@ import { REACTION_ANONYMOUS_CART_TOKEN_COOKIE, REACTION_CART_ID_COOKIE, REACTION_EMPTY_DUMMY_CART_ID, - SHOPIFY_CUSTOMER_TOKEN_COOKIE, - SHOPIFY_COOKIE_EXPIRE, + REACTION_CUSTOMER_TOKEN_COOKIE, + REACTION_COOKIE_EXPIRE, SHOP_ID, } from '../const' @@ -45,9 +45,9 @@ const config = new Config({ cartCookie: REACTION_ANONYMOUS_CART_TOKEN_COOKIE, cartIdCookie: REACTION_CART_ID_COOKIE, dummyEmptyCartId: REACTION_EMPTY_DUMMY_CART_ID, - cartCookieMaxAge: SHOPIFY_COOKIE_EXPIRE, + cartCookieMaxAge: REACTION_COOKIE_EXPIRE, fetch: fetchGraphqlApi, - customerCookie: SHOPIFY_CUSTOMER_TOKEN_COOKIE, + customerCookie: REACTION_CUSTOMER_TOKEN_COOKIE, shopId: SHOP_ID, }) diff --git a/framework/reactioncommerce/api/utils/fetch-graphql-api.ts b/framework/reactioncommerce/api/utils/fetch-graphql-api.ts index dfbcf0343..6de009907 100644 --- a/framework/reactioncommerce/api/utils/fetch-graphql-api.ts +++ b/framework/reactioncommerce/api/utils/fetch-graphql-api.ts @@ -1,6 +1,5 @@ import type { GraphQLFetcher } from '@commerce/api' import fetch from './fetch' - import { API_URL } from '../../const' import { getError } from '../../utils/handle-fetch-response' diff --git a/framework/reactioncommerce/auth/index.ts b/framework/reactioncommerce/auth/index.ts new file mode 100644 index 000000000..36e757a89 --- /dev/null +++ b/framework/reactioncommerce/auth/index.ts @@ -0,0 +1,3 @@ +export { default as useLogin } from './use-login' +export { default as useLogout } from './use-logout' +export { default as useSignup } from './use-signup' diff --git a/framework/reactioncommerce/auth/use-login.tsx b/framework/reactioncommerce/auth/use-login.tsx index 188dd54a2..d5afeebb2 100644 --- a/framework/reactioncommerce/auth/use-login.tsx +++ b/framework/reactioncommerce/auth/use-login.tsx @@ -2,7 +2,7 @@ import { useCallback } from 'react' import type { MutationHook } from '@commerce/utils/types' import { CommerceError, ValidationError } from '@commerce/utils/errors' import useCustomer from '../customer/use-customer' -import createCustomerAccessTokenMutation from '../utils/mutations/customer-access-token-create' +import authenticateMutation from '../utils/mutations/authenticate' import { CustomerAccessTokenCreateInput, CustomerUserError, @@ -25,7 +25,7 @@ const getErrorMessage = ({ code, message }: CustomerUserError) => { export const handler: MutationHook = { fetchOptions: { - query: createCustomerAccessTokenMutation, + query: authenticateMutation, }, async fetcher({ input: { email, password }, options, fetch }) { if (!(email && password)) { @@ -35,25 +35,24 @@ export const handler: MutationHook = { }) } - const { customerAccessTokenCreate } = await fetch< - Mutation, - MutationCheckoutCreateArgs - >({ + console.log('querying API') + + const { authenticate } = await fetch({ ...options, variables: { - input: { email, password }, + serviceName: 'password', + params: { user: { email }, password }, }, }) - const errors = customerAccessTokenCreate?.customerUserErrors + // if (errors && errors.length) { + // throw new ValidationError({ + // message: getErrorMessage(errors[0].message), + // }) + // } + const accessToken = authenticate?.tokens?.accessToken - if (errors && errors.length) { - throw new ValidationError({ - message: getErrorMessage(errors[0]), - }) - } - const customerAccessToken = customerAccessTokenCreate?.customerAccessToken - const accessToken = customerAccessToken?.accessToken + console.log('accessToken', accessToken) if (accessToken) { setCustomerToken(accessToken) diff --git a/framework/reactioncommerce/auth/use-signup.tsx b/framework/reactioncommerce/auth/use-signup.tsx index 7f66448d3..0331acc56 100644 --- a/framework/reactioncommerce/auth/use-signup.tsx +++ b/framework/reactioncommerce/auth/use-signup.tsx @@ -7,7 +7,7 @@ import { CustomerCreateInput } from '../schema' import { customerCreateMutation, - customerAccessTokenCreateMutation, + authenticateMutation, } from '../utils/mutations' import handleLogin from '../utils/handle-login' @@ -47,7 +47,7 @@ export const handler: MutationHook< try { const loginData = await fetch({ - query: customerAccessTokenCreateMutation, + query: authenticateMutation, variables: { input: { email, diff --git a/framework/reactioncommerce/cart/utils/checkout-create.ts b/framework/reactioncommerce/cart/utils/checkout-create.ts index f072b5992..af031445d 100644 --- a/framework/reactioncommerce/cart/utils/checkout-create.ts +++ b/framework/reactioncommerce/cart/utils/checkout-create.ts @@ -1,7 +1,7 @@ import { REACTION_ANONYMOUS_CART_TOKEN_COOKIE, SHOPIFY_CHECKOUT_URL_COOKIE, - SHOPIFY_COOKIE_EXPIRE, + REACTION_COOKIE_EXPIRE, } from '../../const' import checkoutCreateMutation from '../../utils/mutations/checkout-create' @@ -22,7 +22,7 @@ export const checkoutCreate = async (fetch: any) => { if (checkoutId) { const options = { - expires: SHOPIFY_COOKIE_EXPIRE, + expires: REACTION_COOKIE_EXPIRE, } Cookies.set(REACTION_ANONYMOUS_CART_TOKEN_COOKIE, checkoutId, options) Cookies.set(SHOPIFY_CHECKOUT_URL_COOKIE, checkout?.webUrl, options) diff --git a/framework/reactioncommerce/const.ts b/framework/reactioncommerce/const.ts index 80090505f..c0faf6752 100644 --- a/framework/reactioncommerce/const.ts +++ b/framework/reactioncommerce/const.ts @@ -7,12 +7,12 @@ export const REACTION_EMPTY_DUMMY_CART_ID = 'DUMMY_EMPTY_CART_ID' export const SHOPIFY_CHECKOUT_URL_COOKIE = 'shopify_checkoutUrl' -export const SHOPIFY_CUSTOMER_TOKEN_COOKIE = 'shopify_customerToken' +export const REACTION_CUSTOMER_TOKEN_COOKIE = 'reaction_customerToken' export const STORE_DOMAIN = process.env.NEXT_PUBLIC_SHOPIFY_STORE_DOMAIN -export const SHOPIFY_COOKIE_EXPIRE = 30 +export const REACTION_COOKIE_EXPIRE = 30 export const API_URL = `http://127.0.0.1:3000/graphql` -export const SHOP_ID = 'cmVhY3Rpb24vc2hvcDplcnBESFlDdzc5cFRBV0FHUg==' +export const SHOP_ID = 'cmVhY3Rpb24vc2hvcDpIZGIycnRYTWVpbVRKbzZrcg==' diff --git a/framework/reactioncommerce/fetcher.ts b/framework/reactioncommerce/fetcher.ts index b4c57097b..4b774d081 100644 --- a/framework/reactioncommerce/fetcher.ts +++ b/framework/reactioncommerce/fetcher.ts @@ -2,6 +2,7 @@ import { FetcherError } from '@commerce/utils/errors' import type { Fetcher } from '@commerce/utils/types' import { handleFetchResponse } from './utils' import { API_URL } from './const' +import { getCustomerToken } from './utils' async function getText(res: Response) { try { @@ -28,12 +29,20 @@ const fetcher: Fetcher = async ({ }) => { // if no URL is passed but we have a `query` param, we assume it's GraphQL if (!url && query) { + const customerToken = getCustomerToken() + const authorizationHeader = {} + + if (customerToken) { + authorizationHeader['Authorization'] = `bearer ${customerToken}` + } + return handleFetchResponse( await fetch(API_URL, { method: 'POST', body: JSON.stringify({ query, variables }), headers: { 'Content-Type': 'application/json', + ...authorizationHeader, }, }) ) diff --git a/framework/reactioncommerce/schema.d.ts b/framework/reactioncommerce/schema.d.ts index 945444080..21b174606 100644 --- a/framework/reactioncommerce/schema.d.ts +++ b/framework/reactioncommerce/schema.d.ts @@ -13,8 +13,6 @@ export type Scalars = { Boolean: boolean Int: number Float: number - /** A string email address */ - Email: any /** * * An opaque string that identifies a particular result within a connection, @@ -29,910 +27,14 @@ export type Scalars = { * */ ConnectionLimitInt: any - /** A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */ - DateTime: any - /** An object with any fields */ - JSONObject: any /** A date string, such as 2007-12-03, compliant with the `full-date` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */ Date: any -} - -/** Queries return all requested data, without any side effects */ -export type Query = { - __typename?: 'Query' - /** A test query */ - ping: Scalars['String'] - /** Returns the primary shop for the domain */ - primaryShop?: Maybe - /** Returns the ID of the primary shop for the domain */ - primaryShopId?: Maybe - /** Returns a shop by ID */ - shop?: Maybe - /** Returns a shop by slug */ - shopBySlug?: Maybe - shops?: Maybe - /** - * Returns app settings that are not shop specific. Plugins extend the GlobalSettings type to support - * whatever settings they need. - */ - globalSettings: GlobalSettings - /** - * Returns app settings for a specific shop. Plugins extend the ShopSettings type to support - * whatever settings they need. - */ - shopSettings: ShopSettings - /** - * Get a list of errors and suggested properly formatted addresses for an address. If no address - * validation service is active for the shop, this will return as if the address is valid even - * though no check actually occurred. - */ - addressValidation: AddressValidationResults - /** Get a full list of all registered address validation services */ - addressValidationServices: Array> - /** Returns a list of defined address validation rules for a shop */ - addressValidationRules: AddressValidationRuleConnection - /** SystemInformation object */ - systemInformation: SystemInformation - /** Retrieves a list of email templates */ - emailTemplates?: Maybe - /** Returns the account with the provided ID */ - account?: Maybe - /** Returns accounts optionally filtered by account groups */ - accounts: AccountConnection - /** Returns customer accounts */ - customers: AccountConnection - /** Returns the account for the authenticated user */ - viewer?: Maybe - /** Returns a single group by ID. */ - group?: Maybe - /** Returns a list of groups for the shop with ID `shopId`, as a Relay-compatible connection. */ - groups?: Maybe - /** Returns all pending staff member invitations */ - invitations: InvitationConnection - /** Returns a paged list of all roles associated with a shop */ - roles?: Maybe - /** Query for a single Product */ - product?: Maybe - /** Query for a list of Products */ - products?: Maybe - /** Gets items from a shop catalog */ - catalogItems?: Maybe - /** Gets product from catalog */ - catalogItemProduct?: Maybe - /** Returns a list of product in a tag */ - productsByTagId: TagProductConnection - /** Returns a tag from a provided tag ID or slug. Tags with isVisible set to false are excluded by default. */ - tag?: Maybe - /** Returns a paged list of tags for a shop. You must include a shopId when querying. */ - tags?: Maybe - /** - * Get the SimpleInventory info for a product configuration. Returns `null` if `updateSimpleInventory` - * has never been called for this product configuration. - */ - simpleInventory?: Maybe - /** Finds a cart by the cart ID and anonymous cart token. */ - anonymousCartByCartId?: Maybe - /** Find a cart for a given account ID. */ - accountCartByAccountId?: Maybe - /** Get an order by its ID */ - orderById?: Maybe - /** Get all orders for a single account, optionally limited to certain shop IDs and certain orderStatus */ - orders: OrderConnection - /** Get all orders for a single account, optionally limited to certain shop IDs and certain orderStatus */ - ordersByAccountId: OrdersByAccountIdConnection - /** Get an order by its reference ID (the ID shown to customers) */ - orderByReferenceId?: Maybe - /** Get refunds applied to an order by order ID */ - refunds?: Maybe>> - /** Get refunds applied to a specific payment by payment ID */ - refundsByPaymentId?: Maybe>> - /** - * Get a list of all payment methods available during a checkout. This may filter by auth, - * active/inactive, IP/region, shop, etc. To get the full list, use the `paymentMethods` - * query with proper authorization. - */ - availablePaymentMethods: Array> - /** Get a full list of all payment methods */ - paymentMethods: Array> - /** Gets discount codes */ - discountCodes?: Maybe - /** Get the full list of surcharges. */ - surcharges: SurchargeConnection - /** Get a single surcharge definition by its ID */ - surchargeById?: Maybe - /** Get a flat rate fulfillment method */ - flatRateFulfillmentMethod: FlatRateFulfillmentMethod - /** Get a flat rate fulfillment methods */ - flatRateFulfillmentMethods: FlatRateFulfillmentMethodConnection - /** Get the full list of flat rate fulfillment method restrictions. */ - getFlatRateFulfillmentRestrictions: FlatRateFulfillmentRestrictionConnection - /** Get a single flat rate fulfillment method restriction. */ - getFlatRateFulfillmentRestriction?: Maybe - /** List all tax codes supported by the current active tax service for the shop */ - taxCodes: Array> - /** Get a full list of all tax services for the shop */ - taxServices: Array> - /** Gets tax rates */ - taxRates?: Maybe - /** Returns a navigation tree by its ID in the specified language */ - navigationTreeById?: Maybe - /** Returns the navigation items for a shop */ - navigationItemsByShopId?: Maybe - /** Returns Sitemap object for a shop based on the handle param */ - sitemap?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryShopArgs = { - id: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryShopBySlugArgs = { - slug: Scalars['String'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryShopsArgs = { - shopIds?: Maybe>> - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryShopSettingsArgs = { - shopId: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryAddressValidationArgs = { - address: AddressInput - shopId: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryAddressValidationRulesArgs = { - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - serviceNames?: Maybe>> - shopId: Scalars['ID'] - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QuerySystemInformationArgs = { - shopId: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryEmailTemplatesArgs = { - shopId: Scalars['ID'] - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryAccountArgs = { - id: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryAccountsArgs = { - groupIds?: Maybe>> - notInAnyGroups?: Maybe - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryCustomersArgs = { - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryGroupArgs = { - id: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryGroupsArgs = { - shopId: Scalars['ID'] - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryInvitationsArgs = { - shopIds?: Maybe>> - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryRolesArgs = { - shopId: Scalars['ID'] - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryProductArgs = { - productId: Scalars['ID'] - shopId: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryProductsArgs = { - isArchived?: Maybe - isVisible?: Maybe - metafieldKey?: Maybe - metafieldValue?: Maybe - priceMax?: Maybe - priceMin?: Maybe - productIds?: Maybe>> - query?: Maybe - shopIds: Array> - tagIds?: Maybe>> - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryCatalogItemsArgs = { - shopIds: Array> - tagIds?: Maybe>> - booleanFilters?: Maybe>> - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortByPriceCurrencyCode?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryCatalogItemProductArgs = { - shopId?: Maybe - slugOrId?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryProductsByTagIdArgs = { - shopId: Scalars['ID'] - tagId: Scalars['ID'] - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryTagArgs = { - slugOrId: Scalars['String'] - shopId: Scalars['ID'] - shouldIncludeInvisible?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryTagsArgs = { - shopId: Scalars['ID'] - filter?: Maybe - excludedTagIds?: Maybe>> - isTopLevel?: Maybe - shouldIncludeDeleted?: Maybe - shouldIncludeInvisible?: Maybe - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QuerySimpleInventoryArgs = { - shopId: Scalars['ID'] - productConfiguration: ProductConfigurationInput -} - -/** Queries return all requested data, without any side effects */ -export type QueryAnonymousCartByCartIdArgs = { - cartId: Scalars['ID'] - cartToken: Scalars['String'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryAccountCartByAccountIdArgs = { - accountId: Scalars['ID'] - shopId: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryOrderByIdArgs = { - id: Scalars['ID'] - shopId: Scalars['ID'] - token?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryOrdersArgs = { - filters?: Maybe - shopIds?: Maybe>> - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryOrdersByAccountIdArgs = { - accountId: Scalars['ID'] - orderStatus?: Maybe>> - shopIds: Array> - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryOrderByReferenceIdArgs = { - id: Scalars['ID'] - shopId: Scalars['ID'] - token?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryRefundsArgs = { - orderId: Scalars['ID'] - shopId: Scalars['ID'] - token?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryRefundsByPaymentIdArgs = { - orderId: Scalars['ID'] - paymentId: Scalars['ID'] - shopId: Scalars['ID'] - token?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryAvailablePaymentMethodsArgs = { - shopId: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryPaymentMethodsArgs = { - shopId: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryDiscountCodesArgs = { - shopId: Scalars['ID'] - filters?: Maybe - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QuerySurchargesArgs = { - shopId: Scalars['ID'] - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QuerySurchargeByIdArgs = { - shopId: Scalars['ID'] - surchargeId: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryFlatRateFulfillmentMethodArgs = { - methodId: Scalars['ID'] - shopId: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryFlatRateFulfillmentMethodsArgs = { - shopId: Scalars['ID'] - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryGetFlatRateFulfillmentRestrictionsArgs = { - shopId: Scalars['ID'] - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryGetFlatRateFulfillmentRestrictionArgs = { - restrictionId: Scalars['ID'] - shopId: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryTaxCodesArgs = { - shopId: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryTaxServicesArgs = { - shopId: Scalars['ID'] -} - -/** Queries return all requested data, without any side effects */ -export type QueryTaxRatesArgs = { - shopId: Scalars['ID'] - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryNavigationTreeByIdArgs = { - id: Scalars['ID'] - language: Scalars['String'] - shopId: Scalars['ID'] - shouldIncludeSecondary?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QueryNavigationItemsByShopIdArgs = { - shopId: Scalars['ID'] - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Queries return all requested data, without any side effects */ -export type QuerySitemapArgs = { - handle: Scalars['String'] - shopUrl: Scalars['String'] -} - -/** Represents a Reaction shop */ -export type Shop = Node & { - __typename?: 'Shop' - /** The shop ID */ - _id: Scalars['ID'] - /** An the shop's default address */ - addressBook?: Maybe>> - /** Whether to allow user to checkout without creating an account */ - allowGuestCheckout?: Maybe - /** The base unit of length */ - baseUOL?: Maybe - /** The base unit of Measure */ - baseUOM?: Maybe - /** URLs for various shop assets in various sizes */ - brandAssets?: Maybe - /** The default shop currency */ - currency: Currency - /** Default parcel size for this shop */ - defaultParcelSize?: Maybe - /** Shop description */ - description?: Maybe - /** The shop's default email record */ - emails?: Maybe>> - /** Shop's keywords */ - keywords?: Maybe - /** Shop default language */ - language: Scalars['String'] - /** Shop name */ - name: Scalars['String'] - /** Returns URLs for shop logos */ - shopLogoUrls?: Maybe - /** Shop's type */ - shopType?: Maybe - /** Shop's slug */ - slug?: Maybe - /** Returns URLs for various storefront routes */ - storefrontUrls?: Maybe - /** Shop default timezone */ - timezone?: Maybe - /** The shop's units of length */ - unitsOfLength?: Maybe>> - /** The shop's units of measure */ - unitsOfMeasure?: Maybe>> - /** Returns a list of groups for this shop, as a Relay-compatible connection. */ - groups?: Maybe - /** Returns a list of roles for this shop, as a Relay-compatible connection. */ - roles?: Maybe - /** Returns a paged list of tags for this shop */ - tags?: Maybe - /** The default navigation tree for this shop */ - defaultNavigationTree?: Maybe - /** The ID of the shop's default navigation tree */ - defaultNavigationTreeId?: Maybe -} - -/** Represents a Reaction shop */ -export type ShopGroupsArgs = { - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Represents a Reaction shop */ -export type ShopRolesArgs = { - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Represents a Reaction shop */ -export type ShopTagsArgs = { - isTopLevel?: Maybe - shouldIncludeDeleted?: Maybe - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Represents a Reaction shop */ -export type ShopDefaultNavigationTreeArgs = { - language: Scalars['String'] - shouldIncludeSecondary?: Maybe -} - -/** Objects implementing the Node interface will always have an _id field that is globally unique. */ -export type Node = { - /** The ID of the object */ - _id: Scalars['ID'] -} - -/** Represents a physical or mailing address somewhere on Earth */ -export type Address = { - __typename?: 'Address' - /** The address ID */ - _id?: Maybe - /** The street address / first line */ - address1: Scalars['String'] - /** Optional second line */ - address2?: Maybe - /** City */ - city: Scalars['String'] - /** Optional company name, if it's a business address */ - company?: Maybe - /** Country */ - country: Scalars['String'] - /** - * The first name of a person at this address - * This is an optional field to support legacy and third party platforms - * We use fullName internally, and use first and last name fields to combine into a full name if needed - */ - firstName?: Maybe - /** The full name of a person at this address */ - fullName: Scalars['String'] - /** Is this the default address for billing purposes? */ - isBillingDefault?: Maybe - /** Is this a commercial address? */ - isCommercial: Scalars['Boolean'] - /** Is this the default address to use when selecting a shipping address at checkout? */ - isShippingDefault?: Maybe - /** - * The last name of a person at this address - * This is an optional field to support legacy and third party platforms - * We use fullName internally, and use first and last name fields to combine into a full name if needed - */ - lastName?: Maybe - /** Arbitrary additional metadata about this address */ - metafields?: Maybe>> - /** A phone number for someone at this address */ - phone: Scalars['String'] - /** Postal code */ - postal: Scalars['String'] - /** Region. For example, a U.S. state */ - region: Scalars['String'] -} - -/** User defined attributes */ -export type Metafield = { - __typename?: 'Metafield' - /** Field description */ - description?: Maybe - /** Field key */ - key?: Maybe - /** Field namespace */ - namespace?: Maybe - /** Field scope */ - scope?: Maybe - /** Field value */ - value?: Maybe - /** Field value type */ - valueType?: Maybe -} - -/** URLs for various shop assets in various sizes */ -export type ShopBrandAssets = { - __typename?: 'ShopBrandAssets' - /** URLs for the navigation bar brand logo image */ - navbarBrandImage?: Maybe - /** Internal navigation bar brand logo image ID */ - navbarBrandImageId?: Maybe -} - -/** A list of URLs for various sizes of an image */ -export type ImageSizes = { - __typename?: 'ImageSizes' - /** Use this URL to get a large resolution file for this image */ - large?: Maybe - /** Use this URL to get a medium resolution file for this image */ - medium?: Maybe - /** - * Use this URL to get this image with its original resolution as uploaded. This may not be - * the true original size if there is a hard cap on how big image files can be. - */ - original?: Maybe - /** Use this URL to get a small resolution file for this image */ - small?: Maybe - /** Use this URL to get a thumbnail resolution file for this image */ - thumbnail?: Maybe -} - -/** Represents one type of currency */ -export type Currency = Node & { - __typename?: 'Currency' - /** ID */ - _id: Scalars['ID'] - /** Currency code */ - code: Scalars['String'] - /** Decimal symbol */ - decimal?: Maybe - /** Format string */ - format: Scalars['String'] - /** Exchange rate from shop default currency, if known */ - rate?: Maybe - /** The decimal scale used by this currency */ - scale?: Maybe - /** Currency symbol */ - symbol: Scalars['String'] - /** Thousands separator symbol */ - thousand?: Maybe -} - -/** Parcel size */ -export type ShopParcelSize = { - __typename?: 'ShopParcelSize' - /** Parcel height */ - height?: Maybe - /** Parcel length */ - length?: Maybe - /** Parcel weight */ - weight?: Maybe - /** Parcel width */ - width?: Maybe -} - -/** A confirmable email record */ -export type EmailRecord = { - __typename?: 'EmailRecord' - /** The actual email address */ - address?: Maybe - /** The services provided by this address */ - provides?: Maybe - /** Has this address been verified? */ - verified?: Maybe -} - -/** Shop logo URLs */ -export type ShopLogoUrls = { - __typename?: 'ShopLogoUrls' - /** The primary logo URL for this shop. Setting this overrides any uploaded logo. */ - primaryShopLogoUrl?: Maybe -} - -/** Storefront route URLs */ -export type StorefrontUrls = { - __typename?: 'StorefrontUrls' - /** Storefront Account Profile URL (can include `:accountId` in string) */ - storefrontAccountProfileUrl?: Maybe - /** Storefront Home URL */ - storefrontHomeUrl?: Maybe - /** Storefront login URL */ - storefrontLoginUrl?: Maybe - /** Storefront single order URL (can include `:orderReferenceId` and `:orderToken` in string) */ - storefrontOrderUrl?: Maybe - /** Storefront orders URL (can include `:accountId` in string) */ - storefrontOrdersUrl?: Maybe -} - -/** Units of length */ -export type UnitOfLength = { - __typename?: 'UnitOfLength' - /** Whether this unit of length is the default */ - default?: Maybe - /** The name of the unit of length */ - label?: Maybe - /** Unit of length */ - uol?: Maybe -} - -/** Units of measure */ -export type UnitOfMeasure = { - __typename?: 'UnitOfMeasure' - /** Whether this unit of measure is the default */ - default?: Maybe - /** The name of the unit of measure */ - label?: Maybe - /** Unit of measure */ - uom?: Maybe -} - -/** The order in which the connection results should be sorted, based on the sortBy field. */ -export enum SortOrder { - /** ascending */ - Asc = 'asc', - /** descending */ - Desc = 'desc', -} - -/** The fields by which you are allowed to sort any query that returns an `GroupConnection` */ -export enum GroupSortByField { - /** Group ID */ - Id = '_id', - /** Date and time at which this group was created */ - CreatedAt = 'createdAt', - /** Group name */ - Name = 'name', - /** Date and time at which this group was last updated */ - UpdatedAt = 'updatedAt', -} - -/** - * Wraps a list of `Groups`, providing pagination cursors and information. - * - * For information about what Relay-compatible connections are and how to use them, see the following articles: - * - [Relay Connection Documentation](https://facebook.github.io/relay/docs/en/graphql-server-specification.html#connections) - * - [Relay Connection Specification](https://facebook.github.io/relay/graphql/connections.htm) - * - [Using Relay-style Connections With Apollo Client](https://www.apollographql.com/docs/react/recipes/pagination.html) - */ -export type GroupConnection = { - __typename?: 'GroupConnection' - /** The list of nodes that match the query, wrapped in an edge to provide a cursor string for each */ - edges?: Maybe>> - /** - * You can request the `nodes` directly to avoid the extra wrapping that `NodeEdge` has, - * if you know you will not need to paginate the results. - */ - nodes?: Maybe>> - /** Information to help a client request the next or previous page */ - pageInfo: PageInfo - /** The total number of nodes that match your query */ - totalCount: Scalars['Int'] -} - -/** A connection edge in which each node is a `Group` object */ -export type GroupEdge = NodeEdge & { - __typename?: 'GroupEdge' - /** The cursor that represents this node in the paginated results */ - cursor: Scalars['ConnectionCursor'] - /** The group */ - node?: Maybe -} - -/** - * Objects implementing the NodeEdge interface will always have a node and a cursor - * that represents that node for purposes of requesting paginated results. - */ -export type NodeEdge = { - /** The cursor that represents this node in the paginated results */ - cursor: Scalars['ConnectionCursor'] - /** The node itself */ - node?: Maybe -} - -/** Represents an account group */ -export type Group = Node & { - __typename?: 'Group' - /** The group ID */ - _id: Scalars['ID'] - /** The date and time at which this group was created */ - createdAt: Scalars['DateTime'] - /** The account that created this group */ - createdBy?: Maybe - /** A free text description of this group */ - description?: Maybe - /** A unique name for the group */ - name: Scalars['String'] - /** The shop to which this group belongs */ - shop?: Maybe - /** A unique URL-safe string representing this group */ - slug: Scalars['String'] - /** The date and time at which this group was last updated */ - updatedAt: Scalars['DateTime'] - /** A list of the account permissions implied by membership in this group */ - permissions?: Maybe>> + /** A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */ + DateTime: any + /** A string email address */ + Email: any + /** An object with any fields */ + JSONObject: any } /** Represents a single user account */ @@ -1000,6 +102,246 @@ export type AccountGroupsArgs = { sortBy?: Maybe } +/** + * Wraps a list of `Accounts`, providing pagination cursors and information. + * + * For information about what Relay-compatible connections are and how to use them, see the following articles: + * - [Relay Connection Documentation](https://facebook.github.io/relay/docs/en/graphql-server-specification.html#connections) + * - [Relay Connection Specification](https://facebook.github.io/relay/graphql/connections.htm) + * - [Using Relay-style Connections With Apollo Client](https://www.apollographql.com/docs/react/recipes/pagination.html) + */ +export type AccountConnection = { + __typename?: 'AccountConnection' + /** The list of nodes that match the query, wrapped in an edge to provide a cursor string for each */ + edges?: Maybe>> + /** + * You can request the `nodes` directly to avoid the extra wrapping that `NodeEdge` has, + * if you know you will not need to paginate the results. + */ + nodes?: Maybe>> + /** Information to help a client request the next or previous page */ + pageInfo: PageInfo + /** The total number of nodes that match your query */ + totalCount: Scalars['Int'] +} + +/** A connection edge in which each node is an `Account` object */ +export type AccountEdge = NodeEdge & { + __typename?: 'AccountEdge' + /** The cursor that represents this node in the paginated results */ + cursor: Scalars['ConnectionCursor'] + /** The account */ + node?: Maybe +} + +/** The fields by which you are allowed to sort any query that returns an `AccountConnection` */ +export enum AccountSortByField { + /** Account ID */ + Id = '_id', + /** Date and time at which this account was created */ + CreatedAt = 'createdAt', + /** Date and time at which this account was last updated */ + UpdatedAt = 'updatedAt', +} + +/** Defines a new Address and the account to which it should be added */ +export type AddAccountAddressBookEntryInput = { + /** The account ID */ + accountId: Scalars['ID'] + /** The address to add */ + address: AddressInput + /** An optional string identifying the mutation call, which will be returned in the response payload */ + clientMutationId?: Maybe +} + +/** The response from the `addAccountAddressBookEntry` mutation */ +export type AddAccountAddressBookEntryPayload = { + __typename?: 'AddAccountAddressBookEntryPayload' + /** The added address */ + address?: Maybe
+ /** The added address edge */ + addressEdge?: Maybe + /** The same string you sent with the mutation params, for matching mutation calls with their responses */ + clientMutationId?: Maybe +} + +/** Defines a new Email and the account to which it should be added */ +export type AddAccountEmailRecordInput = { + /** The account ID, which defaults to the viewer account */ + accountId?: Maybe + /** An optional string identifying the mutation call, which will be returned in the response payload */ + clientMutationId?: Maybe + /** The email address to add */ + email: Scalars['Email'] +} + +/** The response from the `addAccountEmailRecord` mutation */ +export type AddAccountEmailRecordPayload = { + __typename?: 'AddAccountEmailRecordPayload' + /** The account, with updated `emailRecords` */ + account?: Maybe + /** The same string you sent with the mutation params, for matching mutation calls with their responses */ + clientMutationId?: Maybe +} + +/** Defines a group and account that should be linked */ +export type AddAccountToGroupInput = { + /** The account ID */ + accountId: Scalars['ID'] + /** An optional string identifying the mutation call, which will be returned in the response payload */ + clientMutationId?: Maybe + /** The group ID */ + groupId: Scalars['ID'] +} + +/** The response from the `addAccountToGroup` mutation */ +export type AddAccountToGroupPayload = { + __typename?: 'AddAccountToGroupPayload' + /** The same string you sent with the mutation params, for matching mutation calls with their responses */ + clientMutationId?: Maybe + /** The updated group */ + group?: Maybe +} + +/** Input for the `addCartItems` mutation */ +export type AddCartItemsInput = { + /** The cart ID */ + cartId: Scalars['ID'] + /** If this cart is anonymous, provide the `cartToken` that was returned in the `CreateCartPayload` */ + cartToken?: Maybe + /** An optional string identifying the mutation call, which will be returned in the response payload */ + clientMutationId?: Maybe + /** Array of items to be added to the cart */ + items: Array> +} + +/** The payload returned from the `addCartItems` mutation call */ +export type AddCartItemsPayload = { + __typename?: 'AddCartItemsPayload' + /** + * The modified cart. You should check `incorrectPriceFailures` and `minOrderQuantityFailures` for + * information necessary to display errors to the shopper. Some items may not have been added. + */ + cart?: Maybe + /** The same string you sent with the mutation params, for matching mutation calls with their responses */ + clientMutationId?: Maybe + /** + * Clients should check to see if any items failed to be added due to the price not matching the current price. + * In general, a user interface should display the correct current prices to the shopper, confirm that they still + * want to add the items, and then call `createCart` or `addCartItems` to do so. + * + * Note that this field will always exist but may be an empty array if there were no failures of this type. + */ + incorrectPriceFailures: Array> + /** + * Clients should check to see if any items failed to be added due to quantity being below the minimum order + * quantity defined for the product variant. In general, a user interface should display the minimum order + * quantity to the shopper and allow them to add that quantity or greater. + * + * Note that this field will always exist but may be an empty array if there were no failures of this type. + */ + minOrderQuantityFailures: Array> +} + +/** Input for the addOrderFulfillmentGroup mutation */ +export type AddOrderFulfillmentGroupInput = { + /** An optional string identifying the mutation call, which will be returned in the response payload */ + clientMutationId?: Maybe + /** The order fulfillment group input, used to build the new group */ + fulfillmentGroup: OrderFulfillmentGroupExistingOrderInput + /** Optional list of order item IDs that should be moved from an existing group to the new group */ + moveItemIds?: Maybe>> + /** ID of the order that has the item you want to add the group to */ + orderId: Scalars['ID'] +} + +/** Response payload for the addOrderFulfillmentGroup mutation */ +export type AddOrderFulfillmentGroupPayload = { + __typename?: 'AddOrderFulfillmentGroupPayload' + /** The same string you sent with the mutation params, for matching mutation calls with their responses */ + clientMutationId?: Maybe + /** ID of the added fulfillment group */ + newFulfillmentGroupId: Scalars['ID'] + /** The updated order */ + order: Order +} + +/** Input for `addTag` mutation */ +export type AddTagInput = { + /** An optional string identifying the mutation call, which will be returned in the response payload */ + clientMutationId?: Maybe + /** Title to display to customers */ + displayTitle?: Maybe + /** Hero media URL */ + heroMediaUrl?: Maybe + /** Whether the tag is visible */ + isVisible: Scalars['Boolean'] + /** Tag metafields */ + metafields?: Maybe>> + /** Unique name of the tag */ + name: Scalars['String'] + /** The shop that owns the tag */ + shopId: Scalars['ID'] + /** The tag slug. If left blank, the name will be slugified and saved as the slug */ + slug?: Maybe +} + +/** Response payload for `addTag` mutation */ +export type AddTagPayload = { + __typename?: 'AddTagPayload' + /** The same string you sent with the mutation params, for matching mutation calls with their responses */ + clientMutationId?: Maybe + /** The shop that owns the tag */ + shopId: Scalars['ID'] + /** The newly-created tag */ + tag: Tag +} + +/** Represents a physical or mailing address somewhere on Earth */ +export type Address = { + __typename?: 'Address' + /** The address ID */ + _id?: Maybe + /** The street address / first line */ + address1: Scalars['String'] + /** Optional second line */ + address2?: Maybe + /** City */ + city: Scalars['String'] + /** Optional company name, if it's a business address */ + company?: Maybe + /** Country */ + country: Scalars['String'] + /** + * The first name of a person at this address + * This is an optional field to support legacy and third party platforms + * We use fullName internally, and use first and last name fields to combine into a full name if needed + */ + firstName?: Maybe + /** The full name of a person at this address */ + fullName: Scalars['String'] + /** Is this the default address for billing purposes? */ + isBillingDefault?: Maybe + /** Is this a commercial address? */ + isCommercial: Scalars['Boolean'] + /** Is this the default address to use when selecting a shipping address at checkout? */ + isShippingDefault?: Maybe + /** + * The last name of a person at this address + * This is an optional field to support legacy and third party platforms + * We use fullName internally, and use first and last name fields to combine into a full name if needed + */ + lastName?: Maybe + /** Arbitrary additional metadata about this address */ + metafields?: Maybe>> + /** A phone number for someone at this address */ + phone: Scalars['String'] + /** Postal code */ + postal: Scalars['String'] + /** Region. For example, a U.S. state */ + region: Scalars['String'] +} + /** * Wraps a list of `Addresses`, providing pagination cursors and information. * @@ -1032,351 +374,6 @@ export type AddressEdge = { node?: Maybe
} -/** - * Pagination information. When requesting pages of results, you can use endCursor or startCursor - * as your before or after parameters for the query you are paging. - */ -export type PageInfo = { - __typename?: 'PageInfo' - /** When paginating forwards, the cursor to continue. */ - endCursor?: Maybe - /** When paginating forwards, are there more items? */ - hasNextPage: Scalars['Boolean'] - /** When paginating backwards, are there more items? */ - hasPreviousPage: Scalars['Boolean'] - /** When paginating backwards, the cursor to continue. */ - startCursor?: Maybe -} - -/** The fields by which you are allowed to sort any query that returns an `RoleConnection` */ -export enum RoleSortByField { - /** Role ID */ - Id = '_id', - /** Role name */ - Name = 'name', -} - -/** - * Wraps a list of `Roles`, providing pagination cursors and information. - * - * For information about what Relay-compatible connections are and how to use them, see the following articles: - * - [Relay Connection Documentation](https://facebook.github.io/relay/docs/en/graphql-server-specification.html#connections) - * - [Relay Connection Specification](https://facebook.github.io/relay/graphql/connections.htm) - * - [Using Relay-style Connections With Apollo Client](https://www.apollographql.com/docs/react/recipes/pagination.html) - */ -export type RoleConnection = { - __typename?: 'RoleConnection' - /** The list of nodes that match the query, wrapped in an edge to provide a cursor string for each */ - edges?: Maybe>> - /** - * You can request the `nodes` directly to avoid the extra wrapping that `NodeEdge` has, - * if you know you will not need to paginate the results. - */ - nodes?: Maybe>> - /** Information to help a client request the next or previous page */ - pageInfo: PageInfo - /** The total number of nodes that match your query */ - totalCount: Scalars['Int'] -} - -/** A connection edge in which each node is a `Role` object */ -export type RoleEdge = NodeEdge & { - __typename?: 'RoleEdge' - /** The cursor that represents this node in the paginated results */ - cursor: Scalars['ConnectionCursor'] - /** The role */ - node?: Maybe -} - -/** Represents a named role */ -export type Role = Node & { - __typename?: 'Role' - /** The role ID */ - _id: Scalars['ID'] - /** A unique name for the role */ - name: Scalars['String'] -} - -/** The fields by which you are allowed to sort any query that returns a `TagConnection` */ -export enum TagSortByField { - /** Tag ID */ - Id = '_id', - /** Date and time the tag was created */ - CreatedAt = 'createdAt', - /** Tag name */ - Name = 'name', - /** Tag position */ - Position = 'position', - /** Date and time the tag was last updated */ - UpdatedAt = 'updatedAt', -} - -/** - * Wraps a list of `Tags`, providing pagination cursors and information. - * - * For information about what Relay-compatible connections are and how to use them, see the following articles: - * - [Relay Connection Documentation](https://facebook.github.io/relay/docs/en/graphql-server-specification.html#connections) - * - [Relay Connection Specification](https://facebook.github.io/relay/graphql/connections.htm) - * - [Using Relay-style Connections With Apollo Client](https://www.apollographql.com/docs/react/recipes/pagination.html) - */ -export type TagConnection = { - __typename?: 'TagConnection' - /** The list of nodes that match the query, wrapped in an edge to provide a cursor string for each */ - edges?: Maybe>> - /** - * You can request the `nodes` directly to avoid the extra wrapping that `NodeEdge` has, - * if you know you will not need to paginate the results. - */ - nodes?: Maybe>> - /** Information to help a client request the next or previous page */ - pageInfo: PageInfo - /** The total number of nodes that match your query */ - totalCount: Scalars['Int'] -} - -/** A connection edge in which each node is a `Tag` object */ -export type TagEdge = NodeEdge & { - __typename?: 'TagEdge' - /** The cursor that represents this node in the paginated results */ - cursor: Scalars['ConnectionCursor'] - /** The tag */ - node?: Maybe -} - -/** Represents a single tag */ -export type Tag = Node & - Deletable & { - __typename?: 'Tag' - /** The tag ID */ - _id: Scalars['ID'] - /** The date and time at which this tag was created */ - createdAt: Scalars['DateTime'] - /** A string of the title to be displayed on a Tag Listing Page */ - displayTitle?: Maybe - /** A list of the IDs of top products in this tag */ - featuredProductIds?: Maybe>> - /** A string containing the hero image url for a Tag Listing Page */ - heroMediaUrl?: Maybe - /** - * If `true`, this object should be considered deleted. Soft deleted objects are not - * returned in query results unless you explicitly ask for them. - */ - isDeleted: Scalars['Boolean'] - /** If `true`, this tag should be shown at the top level of the tag hierarchy */ - isTopLevel: Scalars['Boolean'] - /** If `true`, this tag's Tag Listing Page should be visible to the public */ - isVisible: Scalars['Boolean'] - /** Arbitrary additional metadata about this tag */ - metafields?: Maybe>> - /** The display name for the tag. This is unique within a given shop. */ - name: Scalars['String'] - /** The tag's position relative to other tags at the same level of the tag hierarchy */ - position?: Maybe - /** The shop to which this tag belongs */ - shop: Shop - /** A unique URL-safe string representing this tag for links */ - slug?: Maybe - /** A list of the IDs of tags that have this tag as their parent in the tag hierarchy, in the user-defined order */ - subTagIds: Array> - /** The date and time at which this tag was last updated */ - updatedAt: Scalars['DateTime'] - /** A paged list of tags that have this tag as their parent in the tag hierarchy. Currently only three levels are supported. */ - subTags?: Maybe - } - -/** Represents a single tag */ -export type TagSubTagsArgs = { - after?: Maybe - before?: Maybe - first?: Maybe - last?: Maybe - offset?: Maybe - sortOrder?: Maybe - sortBy?: Maybe -} - -/** Objects implementing the Deletable support soft deletion */ -export type Deletable = { - /** - * If true, this object should be considered deleted. Soft deleted objects are not - * returned in query results unless you explicitly ask for them. - */ - isDeleted: Scalars['Boolean'] -} - -/** Represents a navigation tree containing multiple levels of navigation items */ -export type NavigationTree = Node & { - __typename?: 'NavigationTree' - /** The navigation tree ID */ - _id: Scalars['ID'] - /** The draft navigation items that make up this tree */ - draftItems?: Maybe>> - /** Whether the navigation item has unpublished changes */ - hasUnpublishedChanges?: Maybe - /** The published navigation items that make up this tree */ - items?: Maybe>> - /** The name of the tree, for operator display purposes. Assumed to be in the primary shop's language */ - name: Scalars['String'] - /** The ID of the shop this navigation tree belongs to */ - shopId: Scalars['ID'] -} - -/** Represents a navigation item and its children in a tree */ -export type NavigationTreeItem = { - __typename?: 'NavigationTreeItem' - /** Whether the navigation item should display its children */ - expanded?: Maybe - /** Whether the navigation item should be hidden from customers */ - isPrivate?: Maybe - /** Whether the navigaton item is a secondary navigation item */ - isSecondary?: Maybe - /** Whether the navigation ttem should shown in query results for customers and admins */ - isVisible?: Maybe - /** The child navigation items */ - items?: Maybe>> - /** The navigation item */ - navigationItem: NavigationItem -} - -/** Represents a single navigation item */ -export type NavigationItem = Node & { - __typename?: 'NavigationItem' - /** The navigation item ID */ - _id: Scalars['ID'] - /** The date and time at which this navigation item was created */ - createdAt: Scalars['DateTime'] - /** The published data for this navigation item */ - data?: Maybe - /** The draft/unpublished data for this navigation item */ - draftData?: Maybe - /** Whether the navigation item has unpublished changes */ - hasUnpublishedChanges?: Maybe - /** An object storing additional metadata about the navigation item (such as its related tag) */ - metadata?: Maybe - /** The ID of the shop the navigation item belongs to */ - shopId: Scalars['ID'] -} - -/** Represents the data for a navigation item */ -export type NavigationItemData = { - __typename?: 'NavigationItemData' - /** CSS class names to add to the menu item for display */ - classNames?: Maybe - /** The content for the navigation item, in one or more languages */ - content?: Maybe>> - /** The translated content for a navigation item */ - contentForLanguage?: Maybe - /** Whether the provided URL is relative or external */ - isUrlRelative?: Maybe - /** Whether the navigation item should trigger a new tab/window to open when clicked */ - shouldOpenInNewWindow?: Maybe - /** The URL for the navigation item to link to */ - url?: Maybe -} - -/** Represents the translated content for a navigation item */ -export type NavigationItemContent = { - __typename?: 'NavigationItemContent' - /** The language of the piece of navigation content */ - language: Scalars['String'] - /** The translated value, in plain text or markdown */ - value?: Maybe -} - -/** - * Wraps a list of `Shops`, providing pagination cursors and information. - * - * For information about what Relay-compatible connections are and how to use them, see the following articles: - * - [Relay Connection Documentation](https://facebook.github.io/relay/docs/en/graphql-server-specification.html#connections) - * - [Relay Connection Specification](https://facebook.github.io/relay/graphql/connections.htm) - * - [Using Relay-style Connections With Apollo Client](https://www.apollographql.com/docs/react/recipes/pagination.html) - */ -export type ShopConnection = { - __typename?: 'ShopConnection' - /** The list of nodes that match the query, wrapped in an edge to provide a cursor string for each */ - edges?: Maybe>> - /** - * You can request the `nodes` directly to avoid the extra wrapping that `NodeEdge` has, - * if you know you will not need to paginate the results. - */ - nodes?: Maybe>> - /** Information to help a client request the next or previous page */ - pageInfo: PageInfo - /** The total number of nodes that match your query */ - totalCount: Scalars['Int'] -} - -/** A connection edge in which each node is an `Shop` object */ -export type ShopEdge = NodeEdge & { - __typename?: 'ShopEdge' - /** The cursor that represents this node in the paginated results */ - cursor: Scalars['ConnectionCursor'] - /** The Shop */ - node?: Maybe -} - -/** - * App settings that are not shop specific. Plugins extend the GlobalSettings type to support - * whatever settings they need. - */ -export type GlobalSettings = { - __typename?: 'GlobalSettings' - /** A fake setting necessary until some plugin extends this with a real setting */ - doNotUse?: Maybe -} - -/** - * App settings for a specific shop. Plugins extend the ShopSettings type to support - * whatever settings they need. - */ -export type ShopSettings = { - __typename?: 'ShopSettings' - /** A fake setting necessary until some plugin extends this with a real setting */ - doNotUse?: Maybe - /** - * If there is no known inventory for a product configuration, this setting determines - * whether that product configuration can be sold and should appear to be available. - */ - canSellVariantWithoutInventory: Scalars['Boolean'] - /** - * If `false` no defined shipping rates will be used when fulfillment - * quotes are requested for a cart or order. A quick way to disable the entire - * `reaction-shipping-rates` plugin temporarily. - */ - isShippingRatesFulfillmentEnabled?: Maybe - /** The default value to use for `taxCode` property of a product */ - defaultTaxCode?: Maybe - /** - * The name of the tax service to fall back to if the primary tax service is down. - * This will match the `name` field of one of the services returned by the `taxServices` - * query. - */ - fallbackTaxServiceName?: Maybe - /** - * The name of the tax service to use for calculating taxes on carts and orders. - * This will match the `name` field of one of the services returned by the `taxServices` - * query. - */ - primaryTaxServiceName?: Maybe - /** - * Whether a navigation item added to the navigation tree should be visible only to - * admins by default. - */ - shouldNavigationTreeItemsBeAdminOnly: Scalars['Boolean'] - /** - * Whether a navigation item added to the navigation tree should be - * public API/Storefront visible by default. - */ - shouldNavigationTreeItemsBePubliclyVisible: Scalars['Boolean'] - /** - * Whether a navigation item added to the navigation tree should be a secondary - * navigation item by default. - */ - shouldNavigationTreeItemsBeSecondaryNavOnly: Scalars['Boolean'] - /** This setting controls how often the sitemaps for the shop will be rebuilt */ - sitemapRefreshPeriod: Scalars['String'] -} - /** The details of an `Address` to be created or updated */ export type AddressInput = { /** The street address / first line */ @@ -1421,20 +418,25 @@ export type AddressInput = { region: Scalars['String'] } -/** User defined attributes. You can include only `key` and use these like tags, or also include a `value`. */ -export type MetafieldInput = { - /** Field description */ - description?: Maybe - /** Field key */ - key: Scalars['String'] - /** Field namespace */ - namespace?: Maybe - /** Field scope */ - scope?: Maybe - /** Field value */ - value?: Maybe - /** Field value type */ - valueType?: Maybe +/** A list of the possible types of `Address` */ +export enum AddressType { + /** Address can be used for payment transactions and invoicing */ + Billing = 'billing', + /** Address can be used as a mailing address for sending physical items */ + Shipping = 'shipping', +} + +/** Details about an error that was the result of validating an address that is invalid */ +export type AddressValidationError = { + __typename?: 'AddressValidationError' + /** A longer, detailed error message suitable for showing in the user interface */ + details?: Maybe + /** An identifier of the source of this error. These are not currently standardized. As long as your client understands it, any string is fine. */ + source?: Maybe + /** A short error message suitable for showing in the user interface */ + summary: Scalars['String'] + /** The error type. These are not currently standardized. As long as your client understands it, any string is fine. */ + type: Scalars['String'] } /** The response from `Query.addressValidation` */ @@ -1452,57 +454,27 @@ export type AddressValidationResults = { validationErrors: Array> } -/** An address suggestion returned from an address validation service */ -export type SuggestedAddress = { - __typename?: 'SuggestedAddress' - /** The street address / first line */ - address1: Scalars['String'] - /** Optional second line */ - address2?: Maybe - /** City */ - city: Scalars['String'] - /** Country */ - country: Scalars['String'] - /** Postal code */ - postal: Scalars['String'] - /** Region. For example, a U.S. state */ - region: Scalars['String'] -} - -/** Details about an error that was the result of validating an address that is invalid */ -export type AddressValidationError = { - __typename?: 'AddressValidationError' - /** A longer, detailed error message suitable for showing in the user interface */ - details?: Maybe - /** An identifier of the source of this error. These are not currently standardized. As long as your client understands it, any string is fine. */ - source?: Maybe - /** A short error message suitable for showing in the user interface */ - summary: Scalars['String'] - /** The error type. These are not currently standardized. As long as your client understands it, any string is fine. */ - type: Scalars['String'] -} - -/** A single registered address validation service */ -export type AddressValidationService = { - __typename?: 'AddressValidationService' - /** Human-readable name to show operators */ - displayName: Scalars['String'] - /** Unique name to serve as a key identifying this service */ - name: Scalars['String'] - /** An optional list of all country codes that this address service supports. Null means all countries. */ - supportedCountryCodes?: Maybe>> -} - -/** The fields by which you are allowed to sort any query that returns an `AddressValidationRuleConnection` */ -export enum AddressValidationRuleSortByField { - /** AddressValidationRule ID */ - Id = '_id', - /** Date and time at which the rule was created */ - CreatedAt = 'createdAt', - /** Service name */ - ServiceName = 'serviceName', - /** Date and time at which the rule was last updated */ - UpdatedAt = 'updatedAt', +/** + * An address validation rule specifies which validation services should run for + * which countries in each shop. + */ +export type AddressValidationRule = Node & { + __typename?: 'AddressValidationRule' + /** The rule ID */ + _id: Scalars['ID'] + /** Country codes for which this service is enabled */ + countryCodes?: Maybe>> + /** The date and time at which this rule was created */ + createdAt: Scalars['DateTime'] + /** + * The name of one of the installed validation services. Use `addressValidationServices` + * query to get a list with more details about all installed services. + */ + serviceName: Scalars['String'] + /** ID of the shop to which this rule applies */ + shopId: Scalars['ID'] + /** The date and time at which this rule was last updated */ + updatedAt: Scalars['DateTime'] } /** @@ -1537,265 +509,401 @@ export type AddressValidationRuleEdge = NodeEdge & { node?: Maybe } -/** - * An address validation rule specifies which validation services should run for - * which countries in each shop. - */ -export type AddressValidationRule = Node & { - __typename?: 'AddressValidationRule' - /** The rule ID */ - _id: Scalars['ID'] - /** Country codes for which this service is enabled */ - countryCodes?: Maybe>> - /** The date and time at which this rule was created */ - createdAt: Scalars['DateTime'] - /** - * The name of one of the installed validation services. Use `addressValidationServices` - * query to get a list with more details about all installed services. - */ - serviceName: Scalars['String'] - /** ID of the shop to which this rule applies */ - shopId: Scalars['ID'] - /** The date and time at which this rule was last updated */ - updatedAt: Scalars['DateTime'] -} - -/** Represents Reaction System Infomation */ -export type SystemInformation = { - __typename?: 'SystemInformation' - /** Core api version */ - apiVersion: Scalars['String'] - /** Mongo version */ - mongoVersion: DatabaseInformation - /** Plugins installed with name, version information */ - plugins?: Maybe>> -} - -/** Represents Mongo Database information */ -export type DatabaseInformation = { - __typename?: 'DatabaseInformation' - /** Version of database */ - version: Scalars['String'] -} - -/** Represents Reaction Plugin */ -export type Plugin = { - __typename?: 'Plugin' - /** Name of plugin */ - name: Scalars['String'] - /** Version of plugin */ - version?: Maybe -} - -/** - * Wraps a list of Templates, providing pagination cursors and information. - * - * For information about what Relay-compatible connections are and how to use them, see the following articles: - * - [Relay Connection Documentation](https://facebook.github.io/relay/docs/en/graphql-server-specification.html#connections) - * - [Relay Connection Specification](https://facebook.github.io/relay/graphql/connections.htm) - * - [Using Relay-style Connections With Apollo Client](https://www.apollographql.com/docs/react/recipes/pagination.html) - */ -export type TemplateConnection = { - __typename?: 'TemplateConnection' - /** The list of nodes that match the query, wrapped in an edge to provide a cursor string for each */ - edges?: Maybe>> - /** - * You can request the `nodes` directly to avoid the extra wrapping that `NodeEdge` has, - * if you know you will not need to paginate the results. - */ - nodes?: Maybe>> - /** Information to help a client request the next or previous page */ - pageInfo: PageInfo - /** The total number of nodes that match your query */ - totalCount: Scalars['Int'] -} - -/** A connection edge in which each node is a `Template` object */ -export type TemplateEdge = { - __typename?: 'TemplateEdge' - /** The cursor that represents this node in the paginated results */ - cursor: Scalars['ConnectionCursor'] - /** The email template */ - node?: Maybe