content
stringlengths
28
1.34M
import { ArgumentsHost, OnApplicationBootstrap } from '@nestjs/common'; import { Mutation, Resolver } from '@nestjs/graphql'; import { mergeConfig, Job, ErrorHandlerStrategy, VendurePlugin, PluginCommonModule, JobQueueService, JobQueue, } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-config'; import { awaitRunningJobs } from './utils/await-running-jobs'; class TestErrorHandlerStrategy implements ErrorHandlerStrategy { static serverErrorSpy = vi.fn(); static workerErrorSpy = vi.fn(); handleServerError(exception: Error, context: { host: ArgumentsHost }) { TestErrorHandlerStrategy.serverErrorSpy(exception, context); } handleWorkerError(exception: Error, context: { job: Job }) { TestErrorHandlerStrategy.workerErrorSpy(exception, context); } } @Resolver() class TestResolver implements OnApplicationBootstrap { private queue: JobQueue<any>; constructor(private jobQueueService: JobQueueService) {} async onApplicationBootstrap() { this.queue = await this.jobQueueService.createQueue({ name: 'test-queue', process: async () => { throw new Error('worker error'); }, }); } @Mutation() createServerError() { throw new Error('server error'); } @Mutation() createWorkerError() { return this.queue.add({}); } } @VendurePlugin({ imports: [PluginCommonModule], adminApiExtensions: { schema: gql` extend type Mutation { createServerError: Boolean! createWorkerError: Job! } `, resolvers: [TestResolver], }, }) class TestErrorMakingPlugin {} describe('ErrorHandlerStrategy', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { systemOptions: { errorHandlers: [new TestErrorHandlerStrategy()], }, plugins: [TestErrorMakingPlugin], }), ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); beforeEach(() => { TestErrorHandlerStrategy.serverErrorSpy.mockClear(); TestErrorHandlerStrategy.workerErrorSpy.mockClear(); }); afterAll(async () => { await server.destroy(); }); it('no error handler have initially been called', async () => { expect(TestErrorHandlerStrategy.serverErrorSpy).toHaveBeenCalledTimes(0); expect(TestErrorHandlerStrategy.workerErrorSpy).toHaveBeenCalledTimes(0); }); it('invokes the server handler', async () => { try { await adminClient.query(gql` mutation { createServerError } `); } catch (e: any) { expect(e.message).toBe('server error'); } expect(TestErrorHandlerStrategy.serverErrorSpy).toHaveBeenCalledTimes(1); expect(TestErrorHandlerStrategy.workerErrorSpy).toHaveBeenCalledTimes(0); expect(TestErrorHandlerStrategy.serverErrorSpy.mock.calls[0][0]).toBeInstanceOf(Error); expect(TestErrorHandlerStrategy.serverErrorSpy.mock.calls[0][0].message).toBe('server error'); expect(TestErrorHandlerStrategy.serverErrorSpy.mock.calls[0][1].host).toBeDefined(); }); it('invokes the worker handler', async () => { await adminClient.query(gql` mutation { createWorkerError { id } } `); await awaitRunningJobs(adminClient); expect(TestErrorHandlerStrategy.serverErrorSpy).toHaveBeenCalledTimes(0); expect(TestErrorHandlerStrategy.workerErrorSpy).toHaveBeenCalledTimes(1); expect(TestErrorHandlerStrategy.workerErrorSpy.mock.calls[0][0]).toBeInstanceOf(Error); expect(TestErrorHandlerStrategy.workerErrorSpy.mock.calls[0][0].message).toBe('worker error'); expect(TestErrorHandlerStrategy.workerErrorSpy.mock.calls[0][1].job).toHaveProperty( 'queueName', 'test-queue', ); }); });
import { pick } from '@vendure/common/lib/pick'; import { createTestEnvironment, E2E_DEFAULT_CHANNEL_TOKEN } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-config'; import { FACET_VALUE_FRAGMENT } from './graphql/fragments'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { ChannelFragment, CurrencyCode, DeletionResult, FacetWithValuesFragment, GetFacetWithValueListDocument, LanguageCode, } from './graphql/generated-e2e-admin-types'; import { ASSIGN_PRODUCT_TO_CHANNEL, CREATE_CHANNEL, CREATE_FACET, GET_FACET_LIST, GET_FACET_LIST_SIMPLE, GET_FACET_WITH_VALUES, GET_PRODUCT_WITH_VARIANTS, UPDATE_FACET, UPDATE_PRODUCT, UPDATE_PRODUCT_VARIANTS, } from './graphql/shared-definitions'; import { assertThrowsWithMessage } from './utils/assert-throws-with-message'; /* eslint-disable @typescript-eslint/no-non-null-assertion */ describe('Facet resolver', () => { const { server, adminClient, shopClient } = createTestEnvironment(testConfig()); let brandFacet: FacetWithValuesFragment; let speakerTypeFacet: FacetWithValuesFragment; beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('createFacet', async () => { const result = await adminClient.query< Codegen.CreateFacetMutation, Codegen.CreateFacetMutationVariables >(CREATE_FACET, { input: { isPrivate: false, code: 'speaker-type', translations: [{ languageCode: LanguageCode.en, name: 'Speaker Type' }], values: [ { code: 'portable', translations: [{ languageCode: LanguageCode.en, name: 'Portable' }], }, ], }, }); speakerTypeFacet = result.createFacet; expect(speakerTypeFacet).toMatchSnapshot(); }); it('updateFacet', async () => { const result = await adminClient.query< Codegen.UpdateFacetMutation, Codegen.UpdateFacetMutationVariables >(UPDATE_FACET, { input: { id: speakerTypeFacet.id, translations: [{ languageCode: LanguageCode.en, name: 'Speaker Category' }], isPrivate: true, }, }); expect(result.updateFacet.name).toBe('Speaker Category'); }); it('createFacetValues', async () => { const { createFacetValues } = await adminClient.query< Codegen.CreateFacetValuesMutation, Codegen.CreateFacetValuesMutationVariables >(CREATE_FACET_VALUES, { input: [ { facetId: speakerTypeFacet.id, code: 'pc', translations: [{ languageCode: LanguageCode.en, name: 'PC Speakers' }], }, { facetId: speakerTypeFacet.id, code: 'hi-fi', translations: [{ languageCode: LanguageCode.en, name: 'Hi Fi Speakers' }], }, ], }); expect(createFacetValues.length).toBe(2); expect(pick(createFacetValues.find(fv => fv.code === 'pc')!, ['code', 'facet', 'name'])).toEqual({ code: 'pc', facet: { id: 'T_2', name: 'Speaker Category', }, name: 'PC Speakers', }); expect(pick(createFacetValues.find(fv => fv.code === 'hi-fi')!, ['code', 'facet', 'name'])).toEqual({ code: 'hi-fi', facet: { id: 'T_2', name: 'Speaker Category', }, name: 'Hi Fi Speakers', }); }); it('updateFacetValues', async () => { const portableFacetValue = speakerTypeFacet.values.find(v => v.code === 'portable')!; const result = await adminClient.query< Codegen.UpdateFacetValuesMutation, Codegen.UpdateFacetValuesMutationVariables >(UPDATE_FACET_VALUES, { input: [ { id: portableFacetValue.id, code: 'compact', }, ], }); expect(result.updateFacetValues[0].code).toBe('compact'); }); it('facets', async () => { const result = await adminClient.query<Codegen.GetFacetListQuery>(GET_FACET_LIST); const { items } = result.facets; expect(items.length).toBe(2); expect(items[0].name).toBe('category'); expect(items[1].name).toBe('Speaker Category'); brandFacet = items[0]; speakerTypeFacet = items[1]; }); it('facets by shop-api', async () => { const result = await shopClient.query<Codegen.GetFacetListQuery>(GET_FACET_LIST_SIMPLE); const { items } = result.facets; expect(items.length).toBe(1); expect(items[0].name).toBe('category'); }); it('facet', async () => { const result = await adminClient.query< Codegen.GetFacetWithValuesQuery, Codegen.GetFacetWithValuesQueryVariables >(GET_FACET_WITH_VALUES, { id: speakerTypeFacet.id, }); expect(result.facet!.name).toBe('Speaker Category'); }); it('facet with valueList', async () => { const result = await adminClient.query(GetFacetWithValueListDocument, { id: speakerTypeFacet.id, }); expect(result.facet?.valueList.totalItems).toBe(3); }); it('product.facetValues resolver omits private facets in shop-api', async () => { const publicFacetValue = brandFacet.values[0]; const privateFacetValue = speakerTypeFacet.values[0]; await adminClient.query<Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables>( UPDATE_PRODUCT, { input: { id: 'T_1', facetValueIds: [publicFacetValue.id, privateFacetValue.id], }, }, ); const { product } = await shopClient.query< Codegen.GetProductWithFacetValuesQuery, Codegen.GetProductWithFacetValuesQueryVariables >(GET_PRODUCT_WITH_FACET_VALUES, { id: 'T_1', }); expect(product?.facetValues.map(v => v.id).includes(publicFacetValue.id)).toBe(true); expect(product?.facetValues.map(v => v.id).includes(privateFacetValue.id)).toBe(false); }); it('productVariant.facetValues resolver omits private facets in shop-api', async () => { const publicFacetValue = brandFacet.values[0]; const privateFacetValue = speakerTypeFacet.values[0]; await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: 'T_1', facetValueIds: [publicFacetValue.id, privateFacetValue.id], }, ], }); const { product } = await shopClient.query< Codegen.GetProductWithFacetValuesQuery, Codegen.GetProductWithFacetValuesQueryVariables >(GET_PRODUCT_WITH_FACET_VALUES, { id: 'T_1', }); const productVariant1 = product?.variants.find(v => v.id === 'T_1'); expect(productVariant1?.facetValues.map(v => v.id).includes(publicFacetValue.id)).toBe(true); expect(productVariant1?.facetValues.map(v => v.id).includes(privateFacetValue.id)).toBe(false); }); describe('deletion', () => { let products: Codegen.GetProductListWithVariantsQuery['products']['items']; beforeAll(async () => { // add the FacetValues to products and variants const result1 = await adminClient.query<Codegen.GetProductListWithVariantsQuery>( GET_PRODUCTS_LIST_WITH_VARIANTS, ); products = result1.products.items; const pcFacetValue = speakerTypeFacet.values.find(v => v.code === 'pc')!; const hifiFacetValue = speakerTypeFacet.values.find(v => v.code === 'hi-fi')!; await adminClient.query<Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables>( UPDATE_PRODUCT, { input: { id: products[0].id, facetValueIds: [pcFacetValue.id], }, }, ); await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: products[0].variants[0].id, facetValueIds: [pcFacetValue.id], }, ], }); await adminClient.query<Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables>( UPDATE_PRODUCT, { input: { id: products[1].id, facetValueIds: [hifiFacetValue.id], }, }, ); }); it('deleteFacetValues deletes unused facetValue', async () => { const facetValueToDelete = speakerTypeFacet.values.find(v => v.code === 'compact')!; const result1 = await adminClient.query< Codegen.DeleteFacetValuesMutation, Codegen.DeleteFacetValuesMutationVariables >(DELETE_FACET_VALUES, { ids: [facetValueToDelete.id], force: false, }); const result2 = await adminClient.query< Codegen.GetFacetWithValuesQuery, Codegen.GetFacetWithValuesQueryVariables >(GET_FACET_WITH_VALUES, { id: speakerTypeFacet.id, }); expect(result1.deleteFacetValues).toEqual([ { result: DeletionResult.DELETED, message: '', }, ]); expect(result2.facet!.values[0]).not.toEqual(facetValueToDelete); }); it('deleteFacetValues for FacetValue in use returns NOT_DELETED', async () => { const facetValueToDelete = speakerTypeFacet.values.find(v => v.code === 'pc')!; const result1 = await adminClient.query< Codegen.DeleteFacetValuesMutation, Codegen.DeleteFacetValuesMutationVariables >(DELETE_FACET_VALUES, { ids: [facetValueToDelete.id], force: false, }); const result2 = await adminClient.query< Codegen.GetFacetWithValuesQuery, Codegen.GetFacetWithValuesQueryVariables >(GET_FACET_WITH_VALUES, { id: speakerTypeFacet.id, }); expect(result1.deleteFacetValues).toEqual([ { result: DeletionResult.NOT_DELETED, message: 'The FacetValue "pc" is assigned to 1 Product, 1 ProductVariant', }, ]); expect(result2.facet!.values.find(v => v.id === facetValueToDelete.id)).toBeDefined(); }); it('deleteFacetValues for FacetValue in use can be force deleted', async () => { const facetValueToDelete = speakerTypeFacet.values.find(v => v.code === 'pc')!; const result1 = await adminClient.query< Codegen.DeleteFacetValuesMutation, Codegen.DeleteFacetValuesMutationVariables >(DELETE_FACET_VALUES, { ids: [facetValueToDelete.id], force: true, }); expect(result1.deleteFacetValues).toEqual([ { result: DeletionResult.DELETED, message: 'The selected FacetValue was removed from 1 Product, 1 ProductVariant and deleted', }, ]); // FacetValue no longer in the Facet.values array const result2 = await adminClient.query< Codegen.GetFacetWithValuesQuery, Codegen.GetFacetWithValuesQueryVariables >(GET_FACET_WITH_VALUES, { id: speakerTypeFacet.id, }); expect(result2.facet!.values[0]).not.toEqual(facetValueToDelete); // FacetValue no longer in the Product.facetValues array const result3 = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: products[0].id, }); expect(result3.product!.facetValues).toEqual([]); }); it('deleteFacet that is in use returns NOT_DELETED', async () => { const result1 = await adminClient.query< Codegen.DeleteFacetMutation, Codegen.DeleteFacetMutationVariables >(DELETE_FACET, { id: speakerTypeFacet.id, force: false, }); const result2 = await adminClient.query< Codegen.GetFacetWithValuesQuery, Codegen.GetFacetWithValuesQueryVariables >(GET_FACET_WITH_VALUES, { id: speakerTypeFacet.id, }); expect(result1.deleteFacet).toEqual({ result: DeletionResult.NOT_DELETED, message: 'The Facet "speaker-type" includes FacetValues which are assigned to 1 Product', }); expect(result2.facet).not.toBe(null); }); it('deleteFacet that is in use can be force deleted', async () => { const result1 = await adminClient.query< Codegen.DeleteFacetMutation, Codegen.DeleteFacetMutationVariables >(DELETE_FACET, { id: speakerTypeFacet.id, force: true, }); expect(result1.deleteFacet).toEqual({ result: DeletionResult.DELETED, message: 'The Facet was deleted and its FacetValues were removed from 1 Product', }); // FacetValue no longer in the Facet.values array const result2 = await adminClient.query< Codegen.GetFacetWithValuesQuery, Codegen.GetFacetWithValuesQueryVariables >(GET_FACET_WITH_VALUES, { id: speakerTypeFacet.id, }); expect(result2.facet).toBe(null); // FacetValue no longer in the Product.facetValues array const result3 = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: products[1].id, }); expect(result3.product!.facetValues).toEqual([]); }); it('deleteFacet with no FacetValues works', async () => { const { createFacet } = await adminClient.query< Codegen.CreateFacetMutation, Codegen.CreateFacetMutationVariables >(CREATE_FACET, { input: { code: 'test', isPrivate: false, translations: [{ languageCode: LanguageCode.en, name: 'Test' }], }, }); const result = await adminClient.query< Codegen.DeleteFacetMutation, Codegen.DeleteFacetMutationVariables >(DELETE_FACET, { id: createFacet.id, force: false, }); expect(result.deleteFacet.result).toBe(DeletionResult.DELETED); }); }); describe('channels', () => { const SECOND_CHANNEL_TOKEN = 'second_channel_token'; let secondChannel: ChannelFragment; let createdFacet: Codegen.CreateFacetMutation['createFacet']; beforeAll(async () => { const { createChannel } = await adminClient.query< Codegen.CreateChannelMutation, Codegen.CreateChannelMutationVariables >(CREATE_CHANNEL, { input: { code: 'second-channel', token: SECOND_CHANNEL_TOKEN, defaultLanguageCode: LanguageCode.en, currencyCode: CurrencyCode.USD, pricesIncludeTax: true, defaultShippingZoneId: 'T_1', defaultTaxZoneId: 'T_1', }, }); secondChannel = createChannel as ChannelFragment; const { assignProductsToChannel } = await adminClient.query< Codegen.AssignProductsToChannelMutation, Codegen.AssignProductsToChannelMutationVariables >(ASSIGN_PRODUCT_TO_CHANNEL, { input: { channelId: secondChannel.id, productIds: ['T_1'], priceFactor: 0.5, }, }); adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); }); it('create Facet in channel', async () => { const { createFacet } = await adminClient.query< Codegen.CreateFacetMutation, Codegen.CreateFacetMutationVariables >(CREATE_FACET, { input: { isPrivate: false, code: 'channel-facet', translations: [{ languageCode: LanguageCode.en, name: 'Channel Facet' }], values: [ { code: 'channel-value-1', translations: [{ languageCode: LanguageCode.en, name: 'Channel Value 1' }], }, { code: 'channel-value-2', translations: [{ languageCode: LanguageCode.en, name: 'Channel Value 2' }], }, ], }, }); expect(createFacet.code).toBe('channel-facet'); createdFacet = createFacet; }); it('facets list in channel', async () => { const result = await adminClient.query<Codegen.GetFacetListQuery>(GET_FACET_LIST); const { items } = result.facets; expect(items.length).toBe(1); expect(items.map(i => i.code)).toEqual(['channel-facet']); }); it('Product.facetValues in channel', async () => { adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); await adminClient.query<Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables>( UPDATE_PRODUCT, { input: { id: 'T_1', facetValueIds: [brandFacet.values[0].id, ...createdFacet.values.map(v => v.id)], }, }, ); await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: 'T_1', facetValueIds: [brandFacet.values[0].id, ...createdFacet.values.map(v => v.id)], }, ], }); adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }); expect(product?.facetValues.map(fv => fv.code).sort()).toEqual([ 'channel-value-1', 'channel-value-2', ]); }); it('ProductVariant.facetValues in channel', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }); expect(product?.variants[0].facetValues.map(fv => fv.code).sort()).toEqual([ 'channel-value-1', 'channel-value-2', ]); }); it('updating Product facetValuesIds in channel only affects that channel', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); await adminClient.query<Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables>( UPDATE_PRODUCT, { input: { id: 'T_1', facetValueIds: [createdFacet.values[0].id], }, }, ); const { product: productC2 } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }); expect(productC2?.facetValues.map(fv => fv.code)).toEqual([createdFacet.values[0].code]); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { product: productCD } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }); expect(productCD?.facetValues.map(fv => fv.code)).toEqual([ brandFacet.values[0].code, createdFacet.values[0].code, ]); }); it('updating ProductVariant facetValuesIds in channel only affects that channel', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: 'T_1', facetValueIds: [createdFacet.values[0].id], }, ], }); const { product: productC2 } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }); expect(productC2?.variants.find(v => v.id === 'T_1')?.facetValues.map(fv => fv.code)).toEqual([ createdFacet.values[0].code, ]); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { product: productCD } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }); expect(productCD?.variants.find(v => v.id === 'T_1')?.facetValues.map(fv => fv.code)).toEqual([ brandFacet.values[0].code, createdFacet.values[0].code, ]); }); it( 'attempting to create FacetValue in Facet from another Channel throws', assertThrowsWithMessage(async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); await adminClient.query< Codegen.CreateFacetValuesMutation, Codegen.CreateFacetValuesMutationVariables >(CREATE_FACET_VALUES, { input: [ { facetId: brandFacet.id, code: 'channel-brand', translations: [{ languageCode: LanguageCode.en, name: 'Channel Brand' }], }, ], }); }, 'No Facet with the id "1" could be found'), ); it('removing from channel with error', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { facets: before } = await adminClient.query<Codegen.GetFacetListSimpleQuery>( GET_FACET_LIST_SIMPLE, ); expect(before.items).toEqual([{ id: 'T_4', name: 'Channel Facet' }]); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { removeFacetsFromChannel } = await adminClient.query< Codegen.RemoveFacetsFromChannelMutation, Codegen.RemoveFacetsFromChannelMutationVariables >(REMOVE_FACETS_FROM_CHANNEL, { input: { channelId: secondChannel.id, facetIds: [createdFacet.id], force: false, }, }); expect(removeFacetsFromChannel).toEqual([ { errorCode: 'FACET_IN_USE_ERROR', message: 'The Facet "channel-facet" includes FacetValues which are assigned to 1 Product 1 ProductVariant', productCount: 1, variantCount: 1, }, ]); adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { facets: after } = await adminClient.query<Codegen.GetFacetListSimpleQuery>( GET_FACET_LIST_SIMPLE, ); expect(after.items).toEqual([{ id: 'T_4', name: 'Channel Facet' }]); }); it('force removing from channel', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { facets: before } = await adminClient.query<Codegen.GetFacetListSimpleQuery>( GET_FACET_LIST_SIMPLE, ); expect(before.items).toEqual([{ id: 'T_4', name: 'Channel Facet' }]); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { removeFacetsFromChannel } = await adminClient.query< Codegen.RemoveFacetsFromChannelMutation, Codegen.RemoveFacetsFromChannelMutationVariables >(REMOVE_FACETS_FROM_CHANNEL, { input: { channelId: secondChannel.id, facetIds: [createdFacet.id], force: true, }, }); expect(removeFacetsFromChannel).toEqual([{ id: 'T_4', name: 'Channel Facet' }]); adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { facets: after } = await adminClient.query<Codegen.GetFacetListSimpleQuery>( GET_FACET_LIST_SIMPLE, ); expect(after.items).toEqual([]); }); it('assigning to channel', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { facets: before } = await adminClient.query<Codegen.GetFacetListSimpleQuery>( GET_FACET_LIST_SIMPLE, ); expect(before.items).toEqual([]); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { assignFacetsToChannel } = await adminClient.query< Codegen.AssignFacetsToChannelMutation, Codegen.AssignFacetsToChannelMutationVariables >(ASSIGN_FACETS_TO_CHANNEL, { input: { channelId: secondChannel.id, facetIds: [createdFacet.id], }, }); expect(assignFacetsToChannel).toEqual([{ id: 'T_4', name: 'Channel Facet' }]); adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { facets: after } = await adminClient.query<Codegen.GetFacetListSimpleQuery>( GET_FACET_LIST_SIMPLE, ); expect(after.items).toEqual([{ id: 'T_4', name: 'Channel Facet' }]); }); }); // https://github.com/vendure-ecommerce/vendure/issues/715 describe('code conflicts', () => { function createFacetWithCode(code: string) { return adminClient.query<Codegen.CreateFacetMutation, Codegen.CreateFacetMutationVariables>( CREATE_FACET, { input: { isPrivate: false, code, translations: [{ languageCode: LanguageCode.en, name: `Test Facet (${code})` }], values: [], }, }, ); } // https://github.com/vendure-ecommerce/vendure/issues/831 it('updateFacet with unchanged code', async () => { const { createFacet } = await createFacetWithCode('some-new-facet'); const result = await adminClient.query< Codegen.UpdateFacetMutation, Codegen.UpdateFacetMutationVariables >(UPDATE_FACET, { input: { id: createFacet.id, code: createFacet.code, }, }); expect(result.updateFacet.code).toBe(createFacet.code); }); it('createFacet with conflicting slug gets renamed', async () => { const { createFacet: result1 } = await createFacetWithCode('test'); expect(result1.code).toBe('test'); const { createFacet: result2 } = await createFacetWithCode('test'); expect(result2.code).toBe('test-2'); }); it('updateFacet with conflicting slug gets renamed', async () => { const { createFacet } = await createFacetWithCode('foo'); expect(createFacet.code).toBe('foo'); const { updateFacet } = await adminClient.query< Codegen.UpdateFacetMutation, Codegen.UpdateFacetMutationVariables >(UPDATE_FACET, { input: { id: createFacet.id, code: 'test-2', }, }); expect(updateFacet.code).toBe('test-3'); }); }); }); export const GET_FACET_WITH_VALUE_LIST = gql` query GetFacetWithValueList($id: ID!) { facet(id: $id) { id languageCode isPrivate code name valueList { items { ...FacetValue } totalItems } } } ${FACET_VALUE_FRAGMENT} `; const DELETE_FACET_VALUES = gql` mutation DeleteFacetValues($ids: [ID!]!, $force: Boolean) { deleteFacetValues(ids: $ids, force: $force) { result message } } `; const DELETE_FACET = gql` mutation DeleteFacet($id: ID!, $force: Boolean) { deleteFacet(id: $id, force: $force) { result message } } `; const GET_PRODUCT_WITH_FACET_VALUES = gql` query GetProductWithFacetValues($id: ID!) { product(id: $id) { id facetValues { id name code } variants { id facetValues { id name code } } } } `; const GET_PRODUCTS_LIST_WITH_VARIANTS = gql` query GetProductListWithVariants { products { items { id name variants { id name } } totalItems } } `; export const CREATE_FACET_VALUES = gql` mutation CreateFacetValues($input: [CreateFacetValueInput!]!) { createFacetValues(input: $input) { ...FacetValue } } ${FACET_VALUE_FRAGMENT} `; export const UPDATE_FACET_VALUES = gql` mutation UpdateFacetValues($input: [UpdateFacetValueInput!]!) { updateFacetValues(input: $input) { ...FacetValue } } ${FACET_VALUE_FRAGMENT} `; export const ASSIGN_FACETS_TO_CHANNEL = gql` mutation AssignFacetsToChannel($input: AssignFacetsToChannelInput!) { assignFacetsToChannel(input: $input) { id name } } `; export const REMOVE_FACETS_FROM_CHANNEL = gql` mutation RemoveFacetsFromChannel($input: RemoveFacetsFromChannelInput!) { removeFacetsFromChannel(input: $input) { ... on Facet { id name } ... on FacetInUseError { errorCode message productCount variantCount } } } `;
import { CreateProductInput, ProductTranslationInput } from '@vendure/common/lib/generated-types'; import { ensureConfigLoaded, FastImporterService, LanguageCode } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { initialData } from '../mock-data/data-sources/initial-data'; import { GetProductWithVariantsQuery, GetProductWithVariantsQueryVariables, } from './graphql/generated-e2e-admin-types'; import { GET_PRODUCT_WITH_VARIANTS } from './graphql/shared-definitions'; describe('FastImporterService resolver', () => { const { server, adminClient } = createTestEnvironment(testConfig()); let fastImporterService: FastImporterService; beforeAll(async () => { await ensureConfigLoaded(); await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), }); await adminClient.asSuperAdmin(); fastImporterService = server.app.get(FastImporterService); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('creates normalized slug', async () => { const productTranslation: ProductTranslationInput = { languageCode: LanguageCode.en, name: 'test product', slug: 'test product', description: 'test description', }; const createProductInput: CreateProductInput = { translations: [productTranslation], }; await fastImporterService.initialize(); const productId = await fastImporterService.createProduct(createProductInput); const { product } = await adminClient.query< GetProductWithVariantsQuery, GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: productId as string, }); expect(product?.slug).toMatch('test-product'); }); });
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { CustomFulfillmentProcess, defaultFulfillmentProcess, manualFulfillmentHandler, mergeConfig, TransactionalConnection, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import path from 'path'; import { vi } from 'vitest'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { testSuccessfulPaymentMethod } from './fixtures/test-payment-methods'; import { ErrorCode, FulfillmentFragment } from './graphql/generated-e2e-admin-types'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { AddItemToOrderMutation, AddItemToOrderMutationVariables } from './graphql/generated-e2e-shop-types'; import { CREATE_FULFILLMENT, GET_CUSTOMER_LIST, GET_ORDER_FULFILLMENTS, TRANSIT_FULFILLMENT, } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER } from './graphql/shop-definitions'; import { addPaymentToOrder, proceedToArrangingPayment } from './utils/test-order-utils'; const initSpy = vi.fn(); const transitionStartSpy = vi.fn(); const transitionEndSpy = vi.fn(); const transitionEndSpy2 = vi.fn(); const transitionErrorSpy = vi.fn(); describe('Fulfillment process', () => { const fulfillmentGuard: ErrorResultGuard<FulfillmentFragment> = createErrorResultGuard( input => !!input.id, ); const VALIDATION_ERROR_MESSAGE = 'Fulfillment must have a tracking code'; const customOrderProcess: CustomFulfillmentProcess<'AwaitingPickup'> = { init(injector) { initSpy(injector.get(TransactionalConnection).rawConnection.name); }, transitions: { Pending: { to: ['AwaitingPickup'], mergeStrategy: 'replace', }, AwaitingPickup: { to: ['Shipped'], }, }, onTransitionStart(fromState, toState, data) { transitionStartSpy(fromState, toState, data); if (fromState === 'AwaitingPickup' && toState === 'Shipped') { if (!data.fulfillment.trackingCode) { return VALIDATION_ERROR_MESSAGE; } } }, onTransitionEnd(fromState, toState, data) { transitionEndSpy(fromState, toState, data); }, onTransitionError(fromState, toState, message) { transitionErrorSpy(fromState, toState, message); }, }; const customOrderProcess2: CustomFulfillmentProcess<'AwaitingPickup'> = { transitions: { AwaitingPickup: { to: ['Cancelled'], }, }, onTransitionEnd(fromState, toState, data) { transitionEndSpy2(fromState, toState, data); }, }; const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { shippingOptions: { ...testConfig().shippingOptions, process: [defaultFulfillmentProcess, customOrderProcess as any, customOrderProcess2 as any], }, paymentOptions: { paymentMethodHandlers: [testSuccessfulPaymentMethod], }, }), ); beforeAll(async () => { await server.init({ initialData: { ...initialData, paymentMethods: [ { name: testSuccessfulPaymentMethod.code, handler: { code: testSuccessfulPaymentMethod.code, arguments: [] }, }, ], }, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); // Create a couple of orders to be queried const result = await adminClient.query< Codegen.GetCustomerListQuery, Codegen.GetCustomerListQueryVariables >(GET_CUSTOMER_LIST, { options: { take: 3, }, }); const customers = result.customers.items; /** * Creates a Orders to test Fulfillment Process */ await shopClient.asUserWithCredentials(customers[0].emailAddress, 'test'); // Add Items await shopClient.query<AddItemToOrderMutation, AddItemToOrderMutationVariables>(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); await shopClient.query<AddItemToOrderMutation, AddItemToOrderMutationVariables>(ADD_ITEM_TO_ORDER, { productVariantId: 'T_2', quantity: 1, }); // Transit to payment await proceedToArrangingPayment(shopClient); await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); // Add a fulfillment without tracking code await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: [{ orderLineId: 'T_1', quantity: 1 }], handler: { code: manualFulfillmentHandler.code, arguments: [{ name: 'method', value: 'Test1' }], }, }, }); // Add a fulfillment with tracking code await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: [{ orderLineId: 'T_2', quantity: 1 }], handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'Test1' }, { name: 'trackingCode', value: '222' }, ], }, }, }); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); describe('CustomFulfillmentProcess', () => { it('is injectable', () => { expect(initSpy).toHaveBeenCalled(); expect(initSpy.mock.calls[0][0]).toBe('default'); }); it('replaced transition target', async () => { const { order } = await adminClient.query< Codegen.GetOrderFulfillmentsQuery, Codegen.GetOrderFulfillmentsQueryVariables >(GET_ORDER_FULFILLMENTS, { id: 'T_1', }); const [fulfillment] = order?.fulfillments || []; expect(fulfillment.nextStates).toEqual(['AwaitingPickup']); }); it('custom onTransitionStart handler returning error message', async () => { // First transit to AwaitingPickup await adminClient.query< Codegen.TransitFulfillmentMutation, Codegen.TransitFulfillmentMutationVariables >(TRANSIT_FULFILLMENT, { id: 'T_1', state: 'AwaitingPickup', }); transitionStartSpy.mockClear(); transitionErrorSpy.mockClear(); transitionEndSpy.mockClear(); const { transitionFulfillmentToState } = await adminClient.query< Codegen.TransitFulfillmentMutation, Codegen.TransitFulfillmentMutationVariables >(TRANSIT_FULFILLMENT, { id: 'T_1', state: 'Shipped', }); fulfillmentGuard.assertErrorResult(transitionFulfillmentToState); expect(transitionFulfillmentToState.errorCode).toBe(ErrorCode.FULFILLMENT_STATE_TRANSITION_ERROR); expect(transitionFulfillmentToState.transitionError).toBe(VALIDATION_ERROR_MESSAGE); expect(transitionStartSpy).toHaveBeenCalledTimes(1); expect(transitionErrorSpy).toHaveBeenCalledTimes(1); expect(transitionEndSpy).not.toHaveBeenCalled(); expect(transitionErrorSpy.mock.calls[0]).toEqual([ 'AwaitingPickup', 'Shipped', VALIDATION_ERROR_MESSAGE, ]); }); it('custom onTransitionStart handler allows transition', async () => { transitionEndSpy.mockClear(); // First transit to AwaitingPickup await adminClient.query< Codegen.TransitFulfillmentMutation, Codegen.TransitFulfillmentMutationVariables >(TRANSIT_FULFILLMENT, { id: 'T_2', state: 'AwaitingPickup', }); transitionEndSpy.mockClear(); const { transitionFulfillmentToState } = await adminClient.query< Codegen.TransitFulfillmentMutation, Codegen.TransitFulfillmentMutationVariables >(TRANSIT_FULFILLMENT, { id: 'T_2', state: 'Shipped', }); fulfillmentGuard.assertSuccess(transitionFulfillmentToState); expect(transitionEndSpy).toHaveBeenCalledTimes(1); expect(transitionEndSpy.mock.calls[0].slice(0, 2)).toEqual(['AwaitingPickup', 'Shipped']); expect(transitionFulfillmentToState?.state).toBe('Shipped'); }); it('composes multiple CustomFulfillmentProcesses', async () => { const { order } = await adminClient.query< Codegen.GetOrderFulfillmentsQuery, Codegen.GetOrderFulfillmentsQueryVariables >(GET_ORDER_FULFILLMENTS, { id: 'T_1', }); const [fulfillment] = order?.fulfillments || []; expect(fulfillment.nextStates).toEqual(['Shipped', 'Cancelled']); }); }); });
import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { GLOBAL_SETTINGS_FRAGMENT } from './graphql/fragments'; import { GetGlobalSettingsQuery, GlobalSettingsFragment, LanguageCode, UpdateGlobalSettingsMutation, UpdateGlobalSettingsMutationVariables, } from './graphql/generated-e2e-admin-types'; import { UPDATE_GLOBAL_SETTINGS } from './graphql/shared-definitions'; describe('GlobalSettings resolver', () => { const { server, adminClient } = createTestEnvironment({ ...testConfig(), ...{ customFields: { Customer: [{ name: 'age', type: 'int' }], }, }, }); let globalSettings: GlobalSettingsFragment; const globalSettingsGuard: ErrorResultGuard<GlobalSettingsFragment> = createErrorResultGuard( input => !!input.availableLanguages, ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); await adminClient.query<UpdateGlobalSettingsMutation, UpdateGlobalSettingsMutationVariables>( UPDATE_GLOBAL_SETTINGS, { input: { trackInventory: false, }, }, ); const result = await adminClient.query<GetGlobalSettingsQuery>(GET_GLOBAL_SETTINGS); globalSettings = result.globalSettings; }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); describe('globalSettings query', () => { it('includes basic settings', () => { expect(globalSettings.availableLanguages).toEqual([LanguageCode.en]); expect(globalSettings.trackInventory).toBe(false); }); it('includes orderProcess', () => { expect(globalSettings.serverConfig.orderProcess[0]).toEqual({ name: 'Created', to: ['AddingItems', 'Draft'], }); }); it('includes permittedAssetTypes', () => { expect(globalSettings.serverConfig.permittedAssetTypes).toEqual([ 'image/*', 'video/*', 'audio/*', '.pdf', ]); }); it('includes customFieldConfig', () => { expect(globalSettings.serverConfig.customFieldConfig.Customer).toEqual([{ name: 'age' }]); }); it('includes non-internal permission definitions', () => { const permissionNames = globalSettings.serverConfig.permissions.map(p => p.name); expect(permissionNames).toContain('CreateAdministrator'); expect(permissionNames).not.toContain('SuperAdmin'); expect(permissionNames).not.toContain('Owner'); expect(permissionNames).not.toContain('Authenticated'); }); }); describe('update', () => { it('returns error result when removing required language', async () => { const { updateGlobalSettings } = await adminClient.query< UpdateGlobalSettingsMutation, UpdateGlobalSettingsMutationVariables >(UPDATE_GLOBAL_SETTINGS, { input: { availableLanguages: [LanguageCode.zh], }, }); globalSettingsGuard.assertErrorResult(updateGlobalSettings); expect(updateGlobalSettings.message).toBe( 'Cannot make language "en" unavailable as it is used as the defaultLanguage by the channel "__default_channel__"', ); }); it('successful update', async () => { const { updateGlobalSettings } = await adminClient.query< UpdateGlobalSettingsMutation, UpdateGlobalSettingsMutationVariables >(UPDATE_GLOBAL_SETTINGS, { input: { availableLanguages: [LanguageCode.en, LanguageCode.zh], trackInventory: true, }, }); globalSettingsGuard.assertSuccess(updateGlobalSettings); expect(updateGlobalSettings.availableLanguages).toEqual([LanguageCode.en, LanguageCode.zh]); expect(updateGlobalSettings.trackInventory).toBe(true); }); }); }); const GET_GLOBAL_SETTINGS = gql` query GetGlobalSettings { globalSettings { ...GlobalSettings } } ${GLOBAL_SETTINGS_FRAGMENT} `;
import { CreateCustomerInput, SetCustomerForOrderResult } from '@vendure/common/lib/generated-shop-types'; import { GuestCheckoutStrategy, Order, RequestContext, ErrorResultUnion, Customer, CustomerService, GuestCheckoutError, Injector, TransactionalConnection, ChannelService, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard, SimpleGraphQLClient, } from '@vendure/testing'; import path from 'path'; import { IsNull } from 'typeorm'; import { it, afterAll, beforeAll, describe, expect } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-config'; import { AlreadyLoggedInError } from '../src/common/error/generated-graphql-shop-errors'; import { CustomerEvent } from '../src/index'; import { testSuccessfulPaymentMethod } from './fixtures/test-payment-methods'; import * as Codegen from './graphql/generated-e2e-admin-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { GET_CUSTOMER_LIST, GET_PRODUCTS_WITH_VARIANT_PRICES } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER, SET_CUSTOMER } from './graphql/shop-definitions'; class TestGuestCheckoutStrategy implements GuestCheckoutStrategy { static allowGuestCheckout = true; static allowGuestCheckoutForRegisteredCustomers = true; static createNewCustomerOnEmailAddressConflict = false; private customerService: CustomerService; private connection: TransactionalConnection; private channelService: ChannelService; init(injector: Injector) { this.customerService = injector.get(CustomerService); this.connection = injector.get(TransactionalConnection); this.channelService = injector.get(ChannelService); } async setCustomerForOrder( ctx: RequestContext, order: Order, input: CreateCustomerInput, ): Promise<ErrorResultUnion<SetCustomerForOrderResult, Customer>> { if (TestGuestCheckoutStrategy.allowGuestCheckout === false) { return new GuestCheckoutError({ errorDetail: 'Guest orders are disabled' }); } if (ctx.activeUserId) { return new AlreadyLoggedInError(); } if (TestGuestCheckoutStrategy.createNewCustomerOnEmailAddressConflict === true) { const existing = await this.connection.getRepository(ctx, Customer).findOne({ relations: ['channels'], where: { emailAddress: input.emailAddress, deletedAt: IsNull(), }, }); if (existing) { const newCustomer = await this.connection .getRepository(ctx, Customer) .save(new Customer(input)); await this.channelService.assignToCurrentChannel(newCustomer, ctx); return newCustomer; } } const errorOnExistingUser = !TestGuestCheckoutStrategy.allowGuestCheckoutForRegisteredCustomers; const customer = await this.customerService.createOrUpdate(ctx, input, errorOnExistingUser); return customer; } } describe('Order taxes', () => { const { server, adminClient, shopClient } = createTestEnvironment({ ...testConfig(), orderOptions: { guestCheckoutStrategy: new TestGuestCheckoutStrategy(), }, paymentOptions: { paymentMethodHandlers: [testSuccessfulPaymentMethod], }, }); let customers: Codegen.GetCustomerListQuery['customers']['items']; const orderResultGuard: ErrorResultGuard<CodegenShop.ActiveOrderCustomerFragment> = createErrorResultGuard(input => !!input.lines); beforeAll(async () => { await server.init({ initialData: { ...initialData, paymentMethods: [ { name: testSuccessfulPaymentMethod.code, handler: { code: testSuccessfulPaymentMethod.code, arguments: [] }, }, ], }, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 2, }); await adminClient.asSuperAdmin(); const result = await adminClient.query<Codegen.GetCustomerListQuery>(GET_CUSTOMER_LIST); customers = result.customers.items; }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('with guest checkout disabled', async () => { TestGuestCheckoutStrategy.allowGuestCheckout = false; await shopClient.asAnonymousUser(); await addItemToOrder(shopClient); const { setCustomerForOrder } = await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: 'guest@test.com', firstName: 'Guest', lastName: 'User', }, }); orderResultGuard.assertErrorResult(setCustomerForOrder); expect(setCustomerForOrder.errorCode).toBe('GUEST_CHECKOUT_ERROR'); expect((setCustomerForOrder as any).errorDetail).toBe('Guest orders are disabled'); }); it('with guest checkout enabled', async () => { TestGuestCheckoutStrategy.allowGuestCheckout = true; await shopClient.asAnonymousUser(); await addItemToOrder(shopClient); const { setCustomerForOrder } = await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: 'guest@test.com', firstName: 'Guest', lastName: 'User', }, }); orderResultGuard.assertSuccess(setCustomerForOrder); expect(setCustomerForOrder.customer?.emailAddress).toBe('guest@test.com'); }); it('with guest checkout for registered customers disabled', async () => { TestGuestCheckoutStrategy.allowGuestCheckoutForRegisteredCustomers = false; await shopClient.asAnonymousUser(); await addItemToOrder(shopClient); const { setCustomerForOrder } = await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: customers[0].emailAddress, firstName: customers[0].firstName, lastName: customers[0].lastName, }, }); orderResultGuard.assertErrorResult(setCustomerForOrder); expect(setCustomerForOrder.errorCode).toBe('EMAIL_ADDRESS_CONFLICT_ERROR'); }); it('with guest checkout for registered customers enabled', async () => { TestGuestCheckoutStrategy.allowGuestCheckoutForRegisteredCustomers = true; await shopClient.asAnonymousUser(); await addItemToOrder(shopClient); const { setCustomerForOrder } = await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: customers[0].emailAddress, firstName: customers[0].firstName, lastName: customers[0].lastName, }, }); orderResultGuard.assertSuccess(setCustomerForOrder); expect(setCustomerForOrder.customer?.emailAddress).toBe(customers[0].emailAddress); expect(setCustomerForOrder.customer?.id).toBe(customers[0].id); }); it('create new customer on email address conflict', async () => { TestGuestCheckoutStrategy.createNewCustomerOnEmailAddressConflict = true; await shopClient.asAnonymousUser(); await addItemToOrder(shopClient); const { setCustomerForOrder } = await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: customers[0].emailAddress, firstName: customers[0].firstName, lastName: customers[0].lastName, }, }); orderResultGuard.assertSuccess(setCustomerForOrder); expect(setCustomerForOrder.customer?.emailAddress).toBe(customers[0].emailAddress); expect(setCustomerForOrder.customer?.id).not.toBe(customers[0].id); }); it('when already logged in', async () => { await shopClient.asUserWithCredentials(customers[0].emailAddress, 'test'); await addItemToOrder(shopClient); const { setCustomerForOrder } = await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: customers[0].emailAddress, firstName: customers[0].firstName, lastName: customers[0].lastName, }, }); orderResultGuard.assertErrorResult(setCustomerForOrder); expect(setCustomerForOrder.errorCode).toBe('ALREADY_LOGGED_IN_ERROR'); }); }); async function addItemToOrder(shopClient: SimpleGraphQLClient) { await shopClient.query<CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables>( ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }, ); }
import { omit } from '@vendure/common/lib/omit'; import { User } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import * as fs from 'fs'; import gql from 'graphql-tag'; import http from 'http'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; describe('Import resolver', () => { const { server, adminClient } = createTestEnvironment({ ...testConfig(), customFields: { Product: [ { type: 'string', name: 'pageType' }, { name: 'owner', public: true, nullable: true, type: 'relation', entity: User, eager: true, }, { name: 'keywords', public: true, nullable: true, type: 'string', list: true, }, { name: 'localName', type: 'localeString', }, ], ProductVariant: [ { type: 'boolean', name: 'valid' }, { type: 'int', name: 'weight' }, ], }, }); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-empty.csv'), customerCount: 0, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('imports products', async () => { // TODO: waste a few more hours actually fixing this for real // Forgive me this abomination of a work-around. // On the inital run (as in CI), when the sqlite db has just been populated, // this test will fail due to an "out of memory" exception originating from // SqljsQueryRunner.ts:79:22, which is part of the findOne() operation on the // Session repository called from the AuthService.validateSession() method. // After several hours of fruitless hunting, I did what any desperate JavaScript // developer would do, and threw in a setTimeout. Which of course "works"... const timeout = process.env.CI ? 2000 : 1000; await new Promise(resolve => { setTimeout(resolve, timeout); }); const csvFile = path.join(__dirname, 'fixtures', 'product-import.csv'); const result = await adminClient.fileUploadMutation({ mutation: gql` mutation ImportProducts($csvFile: Upload!) { importProducts(csvFile: $csvFile) { imported processed errors } } `, filePaths: [csvFile], mapVariables: () => ({ csvFile: null }), }); expect(result.importProducts.errors).toEqual([ 'Invalid Record Length: header length is 20, got 1 on line 8', ]); expect(result.importProducts.imported).toBe(4); expect(result.importProducts.processed).toBe(4); const productResult = await adminClient.query( gql` query GetProducts($options: ProductListOptions) { products(options: $options) { totalItems items { id name slug description featuredAsset { id name preview source } assets { id name preview source } optionGroups { id code name } facetValues { id name facet { id name } } customFields { pageType owner { id } keywords localName } variants { id name sku price taxCategory { id name } options { id code } assets { id name preview source } featuredAsset { id name preview source } facetValues { id code name facet { id name } } stockOnHand trackInventory stockMovements { items { ... on StockMovement { id type quantity } } } customFields { valid weight } } } } } `, { options: {}, }, ); expect(productResult.products.totalItems).toBe(4); const paperStretcher = productResult.products.items.find( (p: any) => p.name === 'Perfect Paper Stretcher', ); const easel = productResult.products.items.find((p: any) => p.name === 'Mabef M/02 Studio Easel'); const pencils = productResult.products.items.find((p: any) => p.name === 'Giotto Mega Pencils'); const smock = productResult.products.items.find((p: any) => p.name === 'Artists Smock'); // Omit FacetValues & options due to variations in the ordering between different DB engines expect(omit(paperStretcher, ['facetValues', 'options'], true)).toMatchSnapshot(); expect(omit(easel, ['facetValues', 'options'], true)).toMatchSnapshot(); expect(omit(pencils, ['facetValues', 'options'], true)).toMatchSnapshot(); expect(omit(smock, ['facetValues', 'options'], true)).toMatchSnapshot(); const byName = (e: { name: string }) => e.name; const byCode = (e: { code: string }) => e.code; expect(paperStretcher.facetValues).toEqual([]); expect(easel.facetValues).toEqual([]); expect(pencils.facetValues).toEqual([]); expect(smock.facetValues.map(byName).sort()).toEqual(['Denim', 'clothes']); expect(paperStretcher.variants[0].facetValues.map(byName).sort()).toEqual(['Accessory', 'KB']); expect(paperStretcher.variants[1].facetValues.map(byName).sort()).toEqual(['Accessory', 'KB']); expect(paperStretcher.variants[2].facetValues.map(byName).sort()).toEqual(['Accessory', 'KB']); expect(paperStretcher.variants[0].options.map(byCode).sort()).toEqual(['half-imperial']); expect(paperStretcher.variants[1].options.map(byCode).sort()).toEqual(['quarter-imperial']); expect(paperStretcher.variants[2].options.map(byCode).sort()).toEqual(['full-imperial']); expect(easel.variants[0].facetValues.map(byName).sort()).toEqual(['Easel', 'Mabef']); expect(pencils.variants[0].facetValues.map(byName).sort()).toEqual(['Xmas Sale']); expect(pencils.variants[1].facetValues.map(byName).sort()).toEqual(['Xmas Sale']); expect(pencils.variants[0].options.map(byCode).sort()).toEqual(['box-of-8']); expect(pencils.variants[1].options.map(byCode).sort()).toEqual(['box-of-12']); expect(smock.variants[0].facetValues.map(byName).sort()).toEqual([]); expect(smock.variants[1].facetValues.map(byName).sort()).toEqual([]); expect(smock.variants[2].facetValues.map(byName).sort()).toEqual([]); expect(smock.variants[3].facetValues.map(byName).sort()).toEqual([]); expect(smock.variants[0].options.map(byCode).sort()).toEqual(['beige', 'small']); expect(smock.variants[1].options.map(byCode).sort()).toEqual(['beige', 'large']); expect(smock.variants[2].options.map(byCode).sort()).toEqual(['navy', 'small']); expect(smock.variants[3].options.map(byCode).sort()).toEqual(['large', 'navy']); // Import relation custom fields expect(paperStretcher.customFields.owner.id).toBe('T_1'); expect(easel.customFields.owner.id).toBe('T_1'); expect(pencils.customFields.owner.id).toBe('T_1'); expect(smock.customFields.owner.id).toBe('T_1'); // Import non-list custom fields expect(smock.variants[0].customFields.valid).toEqual(true); expect(smock.variants[0].customFields.weight).toEqual(500); expect(smock.variants[1].customFields.valid).toEqual(false); expect(smock.variants[1].customFields.weight).toEqual(500); expect(smock.variants[2].customFields.valid).toEqual(null); expect(smock.variants[2].customFields.weight).toEqual(500); expect(smock.variants[3].customFields.valid).toEqual(true); expect(smock.variants[3].customFields.weight).toEqual(500); expect(smock.variants[4].customFields.valid).toEqual(false); expect(smock.variants[4].customFields.weight).toEqual(null); // Import list custom fields expect(paperStretcher.customFields.keywords).toEqual(['paper', 'stretching', 'watercolor']); expect(easel.customFields.keywords).toEqual([]); expect(pencils.customFields.keywords).toEqual([]); expect(smock.customFields.keywords).toEqual(['apron', 'clothing']); // Import localeString custom fields expect(paperStretcher.customFields.localName).toEqual('localPPS'); expect(easel.customFields.localName).toEqual('localMabef'); expect(pencils.customFields.localName).toEqual('localGiotto'); expect(smock.customFields.localName).toEqual('localSmock'); }, 20000); it('imports products with multiple languages', async () => { // TODO: see test above const timeout = process.env.CI ? 2000 : 1000; await new Promise(resolve => { setTimeout(resolve, timeout); }); const csvFile = path.join(__dirname, 'fixtures', 'e2e-product-import-multi-languages.csv'); const result = await adminClient.fileUploadMutation({ mutation: gql` mutation ImportProducts($csvFile: Upload!) { importProducts(csvFile: $csvFile) { imported processed errors } } `, filePaths: [csvFile], mapVariables: () => ({ csvFile: null }), }); expect(result.importProducts.errors).toEqual([]); expect(result.importProducts.imported).toBe(1); expect(result.importProducts.processed).toBe(1); const productResult = await adminClient.query( gql` query GetProducts($options: ProductListOptions) { products(options: $options) { totalItems items { id name slug description featuredAsset { id name preview source } assets { id name preview source } optionGroups { id code name } facetValues { id name facet { id name } } customFields { pageType owner { id } keywords localName } variants { id name sku price taxCategory { id name } options { id code name } assets { id name preview source } featuredAsset { id name preview source } facetValues { id code name facet { id name } } stockOnHand trackInventory stockMovements { items { ... on StockMovement { id type quantity } } } customFields { weight } } } } } `, { options: {}, }, { languageCode: 'zh_Hans', }, ); expect(productResult.products.totalItems).toBe(5); const paperStretcher = productResult.products.items.find((p: any) => p.name === '奇妙的纸张拉伸器'); // Omit FacetValues & options due to variations in the ordering between different DB engines expect(omit(paperStretcher, ['facetValues', 'options'], true)).toMatchSnapshot(); const byName = (e: { name: string }) => e.name; expect(paperStretcher.facetValues.map(byName).sort()).toEqual(['KB', '饰品']); expect(paperStretcher.variants[0].options.map(byName).sort()).toEqual(['半英制']); expect(paperStretcher.variants[1].options.map(byName).sort()).toEqual(['四分之一英制']); expect(paperStretcher.variants[2].options.map(byName).sort()).toEqual(['全英制']); // Import list custom fields expect(paperStretcher.customFields.keywords).toEqual(['paper, stretch']); // Import localeString custom fields expect(paperStretcher.customFields.localName).toEqual('纸张拉伸器'); }, 20000); describe('asset urls', () => { let staticServer: http.Server; beforeAll(() => { // Set up minimal static file server staticServer = http .createServer((req, res) => { const filePath = path.join(__dirname, 'fixtures/assets', req?.url ?? ''); fs.readFile(filePath, (err, data) => { if (err) { res.writeHead(404); res.end(JSON.stringify(err)); return; } res.writeHead(200); res.end(data); }); }) .listen(3456); }); afterAll(() => { if (staticServer) { return new Promise<void>((resolve, reject) => { staticServer.close(err => { if (err) { reject(err); } else { resolve(); } }); }); } }); it('imports assets with url paths', async () => { const timeout = process.env.CI ? 2000 : 1000; await new Promise(resolve => { setTimeout(resolve, timeout); }); const csvFile = path.join(__dirname, 'fixtures', 'e2e-product-import-asset-urls.csv'); const result = await adminClient.fileUploadMutation({ mutation: gql` mutation ImportProducts($csvFile: Upload!) { importProducts(csvFile: $csvFile) { imported processed errors } } `, filePaths: [csvFile], mapVariables: () => ({ csvFile: null }), }); expect(result.importProducts.errors).toEqual([]); expect(result.importProducts.imported).toBe(1); expect(result.importProducts.processed).toBe(1); const productResult = await adminClient.query( gql` query GetProducts($options: ProductListOptions) { products(options: $options) { totalItems items { id name featuredAsset { id name preview } } } } `, { options: { filter: { name: { contains: 'guitar' }, }, }, }, ); expect(productResult.products.items.length).toBe(1); expect(productResult.products.items[0].featuredAsset.preview).toBe( 'test-url/test-assets/guitar__preview.jpg', ); }); }); });
import { DefaultJobQueuePlugin, mergeConfig } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { PluginWithJobQueue } from './fixtures/test-plugins/with-job-queue'; import { CancelJobMutation, CancelJobMutationVariables, GetRunningJobsQuery, GetRunningJobsQueryVariables, JobState, } from './graphql/generated-e2e-admin-types'; import { GET_RUNNING_JOBS } from './graphql/shared-definitions'; describe('JobQueue', () => { const activeConfig = testConfig(); if (activeConfig.dbConnectionOptions.type === 'sqljs') { it.only('skip JobQueue tests for sqljs', () => { // The tests in this suite will fail when running on sqljs because // the DB state is not persisted after shutdown. In this case it is // an acceptable tradeoff to just skip them, since the other DB engines // _will_ run in CI, and sqljs is less of a production use-case anyway. return; }); } const { server, adminClient } = createTestEnvironment( mergeConfig(activeConfig, { plugins: [ DefaultJobQueuePlugin.init({ pollInterval: 50, gracefulShutdownTimeout: 1_000, }), PluginWithJobQueue, ], }), ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); await sleep(1000); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { PluginWithJobQueue.jobSubject.complete(); await server.destroy(); }); function getJobsInTestQueue(state?: JobState) { return adminClient .query<GetRunningJobsQuery, GetRunningJobsQueryVariables>(GET_RUNNING_JOBS, { options: { filter: { queueName: { eq: 'test', }, ...(state ? { state: { eq: state }, } : {}), }, }, }) .then(data => data.jobs); } let testJobId: string; it('creates and starts running a job', async () => { const restControllerUrl = `http://localhost:${activeConfig.apiOptions.port}/run-job`; await adminClient.fetch(restControllerUrl); await sleep(300); const jobs = await getJobsInTestQueue(); expect(jobs.items.length).toBe(1); expect(jobs.items[0].state).toBe(JobState.RUNNING); expect(PluginWithJobQueue.jobHasDoneWork).toBe(false); testJobId = jobs.items[0].id; }); it( 'shutdown server before completing job', async () => { await server.destroy(); await server.bootstrap(); await adminClient.asSuperAdmin(); await sleep(300); const jobs = await getJobsInTestQueue(); expect(jobs.items.length).toBe(1); expect(jobs.items[0].state).toBe(JobState.RUNNING); expect(jobs.items[0].id).toBe(testJobId); expect(PluginWithJobQueue.jobHasDoneWork).toBe(false); }, TEST_SETUP_TIMEOUT_MS, ); it('complete job after restart', async () => { PluginWithJobQueue.jobSubject.next(); await sleep(300); const jobs = await getJobsInTestQueue(); expect(jobs.items.length).toBe(1); expect(jobs.items[0].state).toBe(JobState.COMPLETED); expect(jobs.items[0].id).toBe(testJobId); expect(PluginWithJobQueue.jobHasDoneWork).toBe(true); }); it('cancels a running job', async () => { PluginWithJobQueue.jobHasDoneWork = false; const restControllerUrl = `http://localhost:${activeConfig.apiOptions.port}/run-job`; await adminClient.fetch(restControllerUrl); await sleep(300); const jobs = await getJobsInTestQueue(JobState.RUNNING); expect(jobs.items.length).toBe(1); expect(jobs.items[0].state).toBe(JobState.RUNNING); expect(PluginWithJobQueue.jobHasDoneWork).toBe(false); const jobId = jobs.items[0].id; const { cancelJob } = await adminClient.query<CancelJobMutation, CancelJobMutationVariables>( CANCEL_JOB, { id: jobId, }, ); expect(cancelJob.state).toBe(JobState.CANCELLED); expect(cancelJob.isSettled).toBe(true); expect(cancelJob.settledAt).not.toBeNull(); const jobs2 = await getJobsInTestQueue(JobState.CANCELLED); expect(jobs.items.length).toBe(1); expect(jobs.items[0].id).toBe(jobId); PluginWithJobQueue.jobSubject.next(); }); it('subscribe to result of job', async () => { const restControllerUrl = `http://localhost:${activeConfig.apiOptions.port}/run-job/subscribe`; const result = await adminClient.fetch(restControllerUrl); expect(await result.text()).toBe('42!'); const jobs = await getJobsInTestQueue(JobState.RUNNING); expect(jobs.items.length).toBe(0); }); }); function sleep(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)); } const CANCEL_JOB = gql` mutation CancelJob($id: ID!) { cancelJob(jobId: $id) { id state isSettled settledAt } } `;
import { AutoIncrementIdStrategy, defaultShippingEligibilityChecker, Injector, ProductService, ShippingEligibilityChecker, TransactionalConnection, } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import path from 'path'; import { vi } from 'vitest'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; const strategyInitSpy = vi.fn(); const strategyDestroySpy = vi.fn(); const codInitSpy = vi.fn(); const codDestroySpy = vi.fn(); class TestIdStrategy extends AutoIncrementIdStrategy { async init(injector: Injector) { const productService = injector.get(ProductService); const connection = injector.get(TransactionalConnection); await new Promise(resolve => setTimeout(resolve, 100)); strategyInitSpy(productService.constructor.name, connection.rawConnection.name); } async destroy() { await new Promise(resolve => setTimeout(resolve, 100)); strategyDestroySpy(); } } const testShippingEligChecker = new ShippingEligibilityChecker({ code: 'test', args: {}, description: [], init: async injector => { const productService = injector.get(ProductService); const connection = injector.get(TransactionalConnection); await new Promise(resolve => setTimeout(resolve, 100)); codInitSpy(productService.constructor.name, connection.rawConnection.name); }, destroy: async () => { await new Promise(resolve => setTimeout(resolve, 100)); codDestroySpy(); }, check: order => { return true; }, }); describe('lifecycle hooks for configurable objects', () => { const { server, adminClient } = createTestEnvironment({ ...testConfig(), entityOptions: { entityIdStrategy: new TestIdStrategy() }, shippingOptions: { shippingEligibilityCheckers: [defaultShippingEligibilityChecker, testShippingEligChecker], }, }); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-empty.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); describe('strategy', () => { it('runs init with Injector', () => { expect(strategyInitSpy).toHaveBeenCalled(); expect(strategyInitSpy.mock.calls[0][0]).toEqual('ProductService'); expect(strategyInitSpy.mock.calls[0][1]).toBe('default'); }); it('runs destroy', async () => { await server.destroy(); expect(strategyDestroySpy).toHaveBeenCalled(); }); }); describe('configurable operation', () => { beforeAll(async () => { await server.bootstrap(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('runs init with Injector', () => { expect(codInitSpy).toHaveBeenCalled(); expect(codInitSpy.mock.calls[0][0]).toEqual('ProductService'); expect(codInitSpy.mock.calls[0][1]).toBe('default'); }); it('runs destroy', async () => { await server.destroy(); expect(codDestroySpy).toHaveBeenCalled(); }); }); });
import { LogicalOperator } from '@vendure/common/lib/generated-types'; import { mergeConfig } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { ListQueryPlugin } from './fixtures/test-plugins/list-query-plugin'; import { LanguageCode, SortOrder } from './graphql/generated-e2e-admin-types'; import { assertThrowsWithMessage } from './utils/assert-throws-with-message'; import { fixPostgresTimezone } from './utils/fix-pg-timezone'; import { sortById } from './utils/test-order-utils'; fixPostgresTimezone(); describe('ListQueryBuilder', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { apiOptions: { shopListQueryLimit: 10, adminListQueryLimit: 30, }, plugins: [ListQueryPlugin], }), ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 3, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); function getItemLabels(items: any[]): string[] { return items.map((x: any) => x.label).sort(); } describe('pagination', () => { it('all en', async () => { const { testEntities } = await adminClient.query( GET_LIST, { options: {}, }, { languageCode: LanguageCode.en }, ); expect(testEntities.totalItems).toBe(6); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B', 'C', 'D', 'E', 'F']); expect(testEntities.items.map((i: any) => i.name)).toEqual(expect.arrayContaining([ 'apple', 'bike', 'cake', 'dog', 'egg', 'baum', // if default en lang does not exist, use next available lang ])); }); it('all de', async () => { const { testEntities } = await adminClient.query( GET_LIST, { options: {}, }, { languageCode: LanguageCode.de }, ); expect(testEntities.totalItems).toBe(6); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B', 'C', 'D', 'E', 'F']); expect(testEntities.items.map((i: any) => i.name)).toEqual(expect.arrayContaining([ 'apfel', 'fahrrad', 'kuchen', 'hund', 'egg', // falls back to en translation when de doesn't exist 'baum', ])); }); it('take', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { take: 2, }, }); expect(testEntities.totalItems).toBe(6); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B']); }); it('skip', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { skip: 2, }, }); expect(testEntities.totalItems).toBe(6); expect(getItemLabels(testEntities.items)).toEqual(['C', 'D', 'E', 'F']); }); it('skip negative is ignored', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { skip: -1, }, }); expect(testEntities.totalItems).toBe(6); expect(testEntities.items.length).toBe(6); }); it('take zero is ignored', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { take: 0, }, }); expect(testEntities.totalItems).toBe(6); expect(testEntities.items.length).toBe(6); }); it('take negative is ignored', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { take: -1, }, }); expect(testEntities.totalItems).toBe(6); expect(testEntities.items.length).toBe(6); }); it( 'take beyond adminListQueryLimit', assertThrowsWithMessage(async () => { await adminClient.query(GET_LIST, { options: { take: 50, }, }); }, 'Cannot take more than 30 results from a list query'), ); it( 'take beyond shopListQueryLimit', assertThrowsWithMessage(async () => { await shopClient.query(GET_LIST, { options: { take: 50, }, }); }, 'Cannot take more than 10 results from a list query'), ); }); describe('string filtering', () => { it('eq', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { label: { eq: 'B', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B']); }); it('notEq', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { label: { notEq: 'B', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'C', 'D', 'E', 'F']); }); it('contains', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { contains: 'adip', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['C']); }); it('notContains', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { notContains: 'te', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B', 'E', 'F']); }); it('in', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { label: { in: ['A', 'C'], }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'C']); }); it('notIn', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { label: { notIn: ['A', 'C'], }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B', 'D', 'E', 'F']); }); it('isNull true', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { nullableString: { isNull: true, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B', 'D', 'F']); }); it('isNull false', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { nullableString: { isNull: false, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'C', 'E']); }); describe('regex', () => { it('simple substring', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { regex: 'or', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B', 'D']); }); it('start of string', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { regex: '^in', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['E']); }); it('end of string', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { regex: 'or$', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['D']); }); it('alternation', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { regex: 'dolor|tempor', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B', 'D']); }); it('complex', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { regex: '(dolor|tempor)|inc[i]?d[^a]d.*nt', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B', 'D', 'E']); }); }); }); describe('ID filtering', () => { it('eq', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { ownerId: { eq: 'T_13', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['D']); }); it('notEq', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { ownerId: { notEq: 'T_13', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B', 'C', 'E', 'F']); }); it('in', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { ownerId: { in: ['T_10', 'T_15'], }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'F']); }); it('in with empty set', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { ownerId: { in: [], }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual([]); }); it('notIn', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { ownerId: { notIn: ['T_10', 'T_15'], }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B', 'C', 'D', 'E']); }); it('notIn with empty set', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { ownerId: { notIn: [], }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B', 'C', 'D', 'E', 'F']); }); it('isNull true', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { nullableId: { isNull: true, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B', 'D', 'F']); }); it('isNull false', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { nullableId: { isNull: false, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'C', 'E']); }); describe('regex', () => { it('simple substring', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { regex: 'or', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B', 'D']); }); it('start of string', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { regex: '^in', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['E']); }); it('end of string', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { regex: 'or$', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['D']); }); it('alternation', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { regex: 'dolor|tempor', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B', 'D']); }); it('complex', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { regex: '(dolor|tempor)|inc[i]?d[^a]d.*nt', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B', 'D', 'E']); }); }); }); describe('boolean filtering', () => { it('eq', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { active: { eq: false, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['C', 'E', 'F']); }); it('isNull true', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { nullableBoolean: { isNull: true, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B', 'D', 'F']); }); it('isNull false', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { nullableBoolean: { isNull: false, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'C', 'E']); }); }); describe('number filtering', () => { it('eq', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { order: { eq: 1, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B']); }); it('lt', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { order: { lt: 1, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A']); }); it('lte', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { order: { lte: 1, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B']); }); it('gt', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { order: { gt: 1, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['C', 'D', 'E', 'F']); }); it('gte', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { order: { gte: 1, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B', 'C', 'D', 'E', 'F']); }); it('between', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { order: { between: { start: 2, end: 4, }, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['C', 'D', 'E']); }); it('isNull true', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { nullableNumber: { isNull: true, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B', 'D', 'F']); }); it('isNull false', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { nullableNumber: { isNull: false, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'C', 'E']); }); }); describe('date filtering', () => { it('before', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { date: { before: '2020-01-20T10:00:00.000Z', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B']); }); it('before on same date', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { date: { before: '2020-01-15T17:00:00.000Z', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B']); }); it('after', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { date: { after: '2020-01-20T10:00:00.000Z', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['C', 'D', 'E', 'F']); }); it('after on same date', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { date: { after: '2020-01-25T09:00:00.000Z', }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['C', 'D', 'E', 'F']); }); it('between', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { date: { between: { start: '2020-01-10T10:00:00.000Z', end: '2020-01-20T10:00:00.000Z', }, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B']); }); it('isNull true', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { nullableDate: { isNull: true, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['B', 'D', 'F']); }); it('isNull false', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { nullableDate: { isNull: false, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'C', 'E']); }); }); describe('multiple filters with filterOperator', () => { it('default AND', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { contains: 'Lorem', }, active: { eq: false, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual([]); }); it('explicit AND', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { contains: 'Lorem', }, active: { eq: false, }, }, filterOperator: LogicalOperator.AND, }, }); expect(getItemLabels(testEntities.items)).toEqual([]); }); it('explicit OR', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { contains: 'Lorem', }, active: { eq: false, }, }, filterOperator: LogicalOperator.OR, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'C', 'E', 'F']); }); it('explicit OR with 3 filters', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { description: { contains: 'eiusmod', }, active: { eq: false, }, order: { lt: 3, }, }, filterOperator: LogicalOperator.OR, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B', 'C', 'D', 'E', 'F']); }); it('explicit OR with empty filters object', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: {}, filterOperator: LogicalOperator.OR, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B', 'C', 'D', 'E', 'F']); }); }); describe('complex boolean logic with _and & _or', () => { it('single _and', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { _and: [ { description: { contains: 'Lorem', }, active: { eq: false, }, }, ], }, }, }); expect(getItemLabels(testEntities.items)).toEqual([]); }); it('single _or', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { _or: [ { description: { contains: 'Lorem', }, active: { eq: false, }, }, ], }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'C', 'E', 'F']); }); it('_or with nested _and', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { _or: [ { description: { contains: 'Lorem' }, }, { _and: [{ order: { gt: 3 } }, { order: { lt: 5 } }], }, ], }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'E']); }); it('_and with nested _or', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { _and: [ { description: { contains: 'e' }, }, { _or: [{ active: { eq: false } }, { ownerId: { eq: '10' } }], }, ], }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'C', 'F']); }); }); describe('sorting', () => { it('sort by string', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { sort: { label: SortOrder.DESC, }, }, }); expect(testEntities.items.map((x: any) => x.label)).toEqual(['F', 'E', 'D', 'C', 'B', 'A']); }); it('sort by number', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { sort: { order: SortOrder.DESC, }, }, }); expect(testEntities.items.map((x: any) => x.label)).toEqual(['F', 'E', 'D', 'C', 'B', 'A']); }); it('sort by date', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { sort: { date: SortOrder.DESC, }, }, }); expect(testEntities.items.map((x: any) => x.label)).toEqual(['F', 'E', 'D', 'C', 'B', 'A']); }); it('sort by ID', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { sort: { id: SortOrder.DESC, }, }, }); expect(testEntities.items.map((x: any) => x.label)).toEqual(['F', 'E', 'D', 'C', 'B', 'A']); }); it('sort by translated field en', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { sort: { name: SortOrder.ASC, }, }, }); expect(testEntities.items.map((x: any) => x.name)).toEqual([ 'apple', 'baum', // falling back to de here 'bike', 'cake', 'dog', 'egg', ]); }); it('sort by translated field de', async () => { const { testEntities } = await adminClient.query( GET_LIST, { options: { sort: { name: SortOrder.ASC, }, }, }, { languageCode: LanguageCode.de }, ); expect(testEntities.items.map((x: any) => x.name)).toEqual([ 'apfel', 'baum', 'egg', 'fahrrad', 'hund', 'kuchen', ]); }); it('sort by translated field en with take', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { sort: { name: SortOrder.ASC, }, take: 4, }, }); expect(testEntities.items.map((x: any) => x.name)).toEqual(['apple', 'baum', 'bike', 'cake']); }); it('sort by translated field de with take', async () => { const { testEntities } = await adminClient.query( GET_LIST, { options: { sort: { name: SortOrder.ASC, }, take: 4, }, }, { languageCode: LanguageCode.de }, ); expect(testEntities.items.map((x: any) => x.name)).toEqual(['apfel', 'baum', 'egg', 'fahrrad']); }); }); describe('calculated fields', () => { it('filter by simple calculated property', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { descriptionLength: { lt: 12, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B']); }); it('filter by calculated property with join', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { filter: { price: { lt: 14, }, }, }, }); expect(getItemLabels(testEntities.items)).toEqual(['A', 'B', 'E']); }); it('sort by simple calculated property', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { sort: { descriptionLength: SortOrder.ASC, }, }, }); expect(testEntities.items.map((x: any) => x.label)).toEqual(['B', 'A', 'E', 'D', 'C', 'F']); }); it('sort by calculated property with join', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { sort: { price: SortOrder.ASC, }, }, }); expect(testEntities.items.map((x: any) => x.label)).toEqual(['B', 'A', 'E', 'D', 'C', 'F']); }); }); describe('multiple clauses', () => { it('sort by translated field en & filter', async () => { const { testEntities } = await adminClient.query(GET_LIST, { options: { sort: { name: SortOrder.ASC, }, filter: { order: { gte: 1, }, }, }, }); expect(testEntities.items.map((x: any) => x.name)).toEqual([ 'baum', 'bike', 'cake', 'dog', 'egg', ]); }); it('sort by translated field de & filter', async () => { const { testEntities } = await adminClient.query( GET_LIST, { options: { sort: { name: SortOrder.ASC, }, filter: { order: { gte: 1, }, }, }, }, { languageCode: LanguageCode.de }, ); expect(testEntities.items.map((x: any) => x.name)).toEqual([ 'baum', 'egg', 'fahrrad', 'hund', 'kuchen', ]); }); it('sort by translated field de & filter & pagination', async () => { const { testEntities } = await adminClient.query( GET_LIST, { options: { sort: { name: SortOrder.ASC, }, filter: { order: { gte: 1, }, }, take: 2, skip: 1, }, }, { languageCode: LanguageCode.de }, ); expect(testEntities.items.map((x: any) => x.name)).toEqual(['egg', 'fahrrad']); }); }); // https://github.com/vendure-ecommerce/vendure/issues/1586 it('using the getMany() of the resulting QueryBuilder', async () => { const { testEntitiesGetMany } = await adminClient.query(GET_ARRAY_LIST, {}); const actualPrices = testEntitiesGetMany.sort(sortById).map((x: any) => x.price).sort((a: number, b: number) => a - b); const expectedPrices = [11, 9, 22, 14, 13, 33].sort((a, b) => a - b); expect(actualPrices).toEqual(expectedPrices); }); // https://github.com/vendure-ecommerce/vendure/issues/1611 describe('translations handling', () => { const allTranslations = [ [ { languageCode: LanguageCode.en, name: 'apple' }, { languageCode: LanguageCode.de, name: 'apfel' }, ], [ { languageCode: LanguageCode.en, name: 'bike' }, { languageCode: LanguageCode.de, name: 'fahrrad' }, ], ]; function getTestEntityTranslations(testEntities: { items: any[] }) { // Explicitly sort the order of the translations as it was being non-deterministic on // the mysql CI tests. return testEntities.items.map((e: any) => e.translations.sort((a: any, b: any) => (a.languageCode < b.languageCode ? 1 : -1)), ); } it('returns all translations with default languageCode', async () => { const { testEntities } = await shopClient.query(GET_LIST_WITH_TRANSLATIONS, { options: { take: 2, sort: { order: SortOrder.ASC, }, }, }); const testEntityTranslations = getTestEntityTranslations(testEntities); expect(testEntities.items.map((e: any) => e.name)).toEqual(['apple', 'bike']); expect(testEntityTranslations).toEqual(allTranslations); }); it('returns all translations with non-default languageCode', async () => { const { testEntities } = await shopClient.query( GET_LIST_WITH_TRANSLATIONS, { options: { take: 2, sort: { order: SortOrder.ASC, }, }, }, { languageCode: LanguageCode.de }, ); const testEntityTranslations = getTestEntityTranslations(testEntities); expect(testEntities.items.map((e: any) => e.name)).toEqual(['apfel', 'fahrrad']); expect(testEntityTranslations).toEqual(allTranslations); }); }); describe('customPropertyMap', () => { it('filter by custom string field', async () => { const { testEntities } = await shopClient.query(GET_LIST_WITH_ORDERS, { options: { sort: { label: SortOrder.ASC, }, filter: { customerLastName: { contains: 'zieme' }, }, }, }); expect(testEntities.items).toEqual([ { id: 'T_1', label: 'A', name: 'apple', parent: { id: 'T_2', label: 'B', name: 'bike', }, orderRelation: { customer: { firstName: 'Hayden', lastName: 'Zieme', }, id: 'T_1', }, }, { id: 'T_4', label: 'D', name: 'dog', parent: { id: 'T_2', label: 'B', name: 'bike', }, orderRelation: { customer: { firstName: 'Hayden', lastName: 'Zieme', }, id: 'T_4', }, }, ]); }); it('sort by custom string field', async () => { const { testEntities } = await shopClient.query(GET_LIST_WITH_ORDERS, { options: { sort: { customerLastName: SortOrder.ASC, }, }, }); expect(testEntities.items.map((i: any) => i.orderRelation.customer)).toEqual([ { firstName: 'Trevor', lastName: 'Donnelly' }, { firstName: 'Trevor', lastName: 'Donnelly' }, { firstName: 'Marques', lastName: 'Sawayn' }, { firstName: 'Marques', lastName: 'Sawayn' }, { firstName: 'Hayden', lastName: 'Zieme' }, { firstName: 'Hayden', lastName: 'Zieme' }, ]); }); }); describe('relations in customFields', () => { it('should resolve relations in customFields successfully', async () => { const { testEntities } = await shopClient.query(GET_LIST_WITH_CUSTOM_FIELD_RELATION, { options: { filter: { label: { eq: 'A' }, }, }, }); expect(testEntities.items).toEqual([ { id: 'T_1', label: 'A', customFields: { relation: [{ id: 'T_1', data: 'A' }], }, }, ]); }); it('should resolve multiple relations in customFields successfully', async () => { const { testEntities } = await shopClient.query(GET_LIST_WITH_MULTIPLE_CUSTOM_FIELD_RELATION, { options: { filter: { label: { eq: 'A' }, }, }, }); expect(testEntities.items).toEqual([ { id: 'T_1', label: 'A', customFields: { relation: [{ id: 'T_1', data: 'A' }], otherRelation: [{ id: 'T_1', data: 'A' }], }, }, ]); }); }); }); const GET_LIST = gql` query GetTestEntities($options: TestEntityListOptions) { testEntities(options: $options) { totalItems items { id label name date } } } `; const GET_LIST_WITH_TRANSLATIONS = gql` query GetTestEntitiesWithTranslations($options: TestEntityListOptions) { testEntities(options: $options) { totalItems items { id label name date translations { languageCode name } } } } `; const GET_LIST_WITH_ORDERS = gql` query GetTestEntitiesWithTranslations($options: TestEntityListOptions) { testEntities(options: $options) { totalItems items { id label name parent { id label name } orderRelation { id customer { firstName lastName } } } } } `; const GET_ARRAY_LIST = gql` query GetTestEntitiesArray($options: TestEntityListOptions) { testEntitiesGetMany(options: $options) { id label name date price } } `; const GET_LIST_WITH_CUSTOM_FIELD_RELATION = gql` query GetTestWithCustomFieldRelation($options: TestEntityListOptions) { testEntities(options: $options) { items { id label customFields { relation { id data } } } } } `; const GET_LIST_WITH_MULTIPLE_CUSTOM_FIELD_RELATION = gql` query GetTestWithMultipleCustomFieldRelation($options: TestEntityListOptions) { testEntities(options: $options) { items { id label customFields { relation { id data } otherRelation { id data } } } } } `;
import { pick } from '@vendure/common/lib/pick'; import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { LanguageCode } from './graphql/generated-e2e-admin-types'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { GET_PRODUCT_WITH_VARIANTS, UPDATE_PRODUCT } from './graphql/shared-definitions'; /* eslint-disable @typescript-eslint/no-non-null-assertion */ describe('Localization', () => { const { server, adminClient } = createTestEnvironment(testConfig()); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); const { updateProduct } = await adminClient.query< Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables >(UPDATE_PRODUCT, { input: { id: 'T_1', translations: [ { languageCode: LanguageCode.en, name: 'en name', slug: 'en-slug', description: 'en-description', }, { languageCode: LanguageCode.de, name: 'de name', slug: 'de-slug', description: 'de-description', }, { languageCode: LanguageCode.zh, name: 'zh name', slug: 'zh-slug', description: 'zh-description', }, ], }, }); await adminClient.query< Codegen.UpdateOptionGroupMutation, Codegen.UpdateOptionGroupMutationVariables >(UPDATE_OPTION_GROUP, { input: { id: 'T_1', translations: [ { languageCode: LanguageCode.en, name: 'en name' }, { languageCode: LanguageCode.de, name: 'de name' }, { languageCode: LanguageCode.zh, name: 'zh name' }, ], }, }); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('returns default language when none specified', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }); expect(pick(product!, ['name', 'slug', 'description'])).toEqual({ name: 'en name', slug: 'en-slug', description: 'en-description', }); }); it('returns specified language', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >( GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }, { languageCode: LanguageCode.de }, ); expect(pick(product!, ['name', 'slug', 'description'])).toEqual({ name: 'de name', slug: 'de-slug', description: 'de-description', }); }); it('falls back to default language code', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >( GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }, { languageCode: LanguageCode.ga }, ); expect(pick(product!, ['name', 'slug', 'description'])).toEqual({ name: 'en name', slug: 'en-slug', description: 'en-description', }); }); it('nested entites are translated', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >( GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }, { languageCode: LanguageCode.zh }, ); expect(pick(product!.optionGroups[0], ['name'])).toEqual({ name: 'zh name', }); }); it('translates results of mutation', async () => { const { updateProduct } = await adminClient.query< Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables >( UPDATE_PRODUCT, { input: { id: 'T_1', enabled: true, }, }, { languageCode: LanguageCode.zh }, ); expect(updateProduct.name).toBe('zh name'); expect(pick(updateProduct.optionGroups[0], ['name'])).toEqual({ name: 'zh name', }); }); }); const UPDATE_OPTION_GROUP = gql` mutation UpdateOptionGroup($input: UpdateProductOptionGroupInput!) { updateProductOptionGroup(input: $input) { id } } `;
import { DefaultMoneyStrategy, Logger, mergeConfig, MoneyStrategy, VendurePlugin } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import path from 'path'; import { ColumnOptions } from 'typeorm'; import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { SortOrder } from './graphql/generated-e2e-admin-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { AddItemToOrderMutation, AddItemToOrderMutationVariables } from './graphql/generated-e2e-shop-types'; import { GET_PRODUCT_VARIANT_LIST } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER } from './graphql/shop-definitions'; /* eslint-disable @typescript-eslint/no-non-null-assertion */ const orderGuard: ErrorResultGuard<CodegenShop.UpdatedOrderFragment> = createErrorResultGuard( input => !!input.total, ); class CustomMoneyStrategy implements MoneyStrategy { static transformerFromSpy = vi.fn(); readonly moneyColumnOptions: ColumnOptions = { type: 'bigint', transformer: { to: (entityValue: number) => { return entityValue; }, from: (databaseValue: string): number => { CustomMoneyStrategy.transformerFromSpy(databaseValue); if (databaseValue == null) { return databaseValue; } const intVal = Number.parseInt(databaseValue, 10); if (!Number.isSafeInteger(intVal)) { Logger.warn(`Monetary value ${databaseValue} is not a safe integer!`); } if (Number.isNaN(intVal)) { Logger.warn(`Monetary value ${databaseValue} is not a number!`); } return intVal; }, }, }; round(value: number, quantity = 1): number { return Math.round(value * quantity); } } @VendurePlugin({ configuration: config => { config.entityOptions.moneyStrategy = new CustomMoneyStrategy(); return config; }, }) class MyPlugin {} describe('Custom MoneyStrategy', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { plugins: [MyPlugin], }), ); let cheapVariantId: string; let expensiveVariantId: string; beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-money-handling.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('check initial prices', async () => { expect(CustomMoneyStrategy.transformerFromSpy).toHaveBeenCalledTimes(0); const { productVariants } = await adminClient.query< Codegen.GetProductVariantListQuery, Codegen.GetProductVariantListQueryVariables >(GET_PRODUCT_VARIANT_LIST, { options: { sort: { price: SortOrder.ASC, }, }, }); expect(productVariants.items[0].price).toBe(31); expect(productVariants.items[0].priceWithTax).toBe(37); expect(productVariants.items[1].price).toBe(9_999_999_00); expect(productVariants.items[1].priceWithTax).toBe(11_999_998_80); cheapVariantId = productVariants.items[0].id; expensiveVariantId = productVariants.items[1].id; expect(CustomMoneyStrategy.transformerFromSpy).toHaveBeenCalledTimes(2); }); // https://github.com/vendure-ecommerce/vendure/issues/838 it('can handle totals over 21 million', async () => { await shopClient.asAnonymousUser(); const { addItemToOrder } = await shopClient.query< AddItemToOrderMutation, AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: expensiveVariantId, quantity: 2, }); orderGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines[0].linePrice).toBe(1_999_999_800); expect(addItemToOrder.lines[0].linePriceWithTax).toBe(2_399_999_760); }); // https://github.com/vendure-ecommerce/vendure/issues/1835 // 31 * 1.2 = 37.2 // Math.round(37.2 * 10) =372 it('tax calculation rounds at the unit level', async () => { await shopClient.asAnonymousUser(); const { addItemToOrder } = await shopClient.query< AddItemToOrderMutation, AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: cheapVariantId, quantity: 10, }); orderGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines[0].linePrice).toBe(310); expect(addItemToOrder.lines[0].linePriceWithTax).toBe(372); }); });
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { ChangedPriceHandlingStrategy, mergeConfig, OrderLine, PriceCalculationResult, RequestContext, } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import path from 'path'; import { vi } from 'vitest'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import * as Codegen from './graphql/generated-e2e-admin-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { UPDATE_PRODUCT_VARIANTS } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER, ADJUST_ITEM_QUANTITY, GET_ACTIVE_ORDER } from './graphql/shop-definitions'; class TestChangedPriceStrategy implements ChangedPriceHandlingStrategy { static spy = vi.fn(); static useLatestPrice = true; handlePriceChange( ctx: RequestContext, current: PriceCalculationResult, orderLine: OrderLine, ): PriceCalculationResult { TestChangedPriceStrategy.spy(current); if (TestChangedPriceStrategy.useLatestPrice) { return current; } else { return { price: orderLine.listPrice, priceIncludesTax: orderLine.listPriceIncludesTax, }; } } } describe('ChangedPriceHandlingStrategy', () => { const { server, shopClient, adminClient } = createTestEnvironment( mergeConfig(testConfig(), { orderOptions: { changedPriceHandlingStrategy: new TestChangedPriceStrategy(), }, }), ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('unitPriceChangeSinceAdded starts as 0', async () => { TestChangedPriceStrategy.spy.mockClear(); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_12', quantity: 1, }); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder?.lines[0].unitPriceChangeSinceAdded).toBe(0); expect(activeOrder?.lines[0].unitPrice).toBe(5374); expect(TestChangedPriceStrategy.spy).not.toHaveBeenCalled(); }); describe('use latest price', () => { let firstOrderLineId: string; beforeAll(() => { TestChangedPriceStrategy.useLatestPrice = true; }); it('calls handlePriceChange on addItemToOrder', async () => { TestChangedPriceStrategy.spy.mockClear(); await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: 'T_12', price: 6000, }, ], }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_12', quantity: 1, }); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder?.lines[0].unitPriceChangeSinceAdded).toBe(626); expect(activeOrder?.lines[0].unitPrice).toBe(6000); expect(TestChangedPriceStrategy.spy).toHaveBeenCalledTimes(1); firstOrderLineId = activeOrder!.lines[0].id; }); it('calls handlePriceChange on adjustOrderLine', async () => { TestChangedPriceStrategy.spy.mockClear(); await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: 'T_12', price: 3000, }, ], }); await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: firstOrderLineId, quantity: 3, }); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder?.lines[0].unitPriceChangeSinceAdded).toBe(-2374); expect(activeOrder?.lines[0].unitPrice).toBe(3000); expect(TestChangedPriceStrategy.spy).toHaveBeenCalledTimes(1); }); }); describe('use original price', () => { let secondOrderLineId: string; const ORIGINAL_PRICE = 7896; beforeAll(() => { TestChangedPriceStrategy.useLatestPrice = false; }); it('calls handlePriceChange on addItemToOrder', async () => { TestChangedPriceStrategy.spy.mockClear(); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_13', quantity: 1, }); await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: 'T_13', price: 8000, }, ], }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_13', quantity: 1, }); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder?.lines[1].unitPriceChangeSinceAdded).toBe(0); expect(activeOrder?.lines[1].unitPrice).toBe(ORIGINAL_PRICE); expect(TestChangedPriceStrategy.spy).toHaveBeenCalledTimes(1); secondOrderLineId = activeOrder!.lines[1].id; }); it('calls handlePriceChange on adjustOrderLine', async () => { TestChangedPriceStrategy.spy.mockClear(); await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: 'T_13', price: 3000, }, ], }); await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: secondOrderLineId, quantity: 3, }); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder?.lines[1].unitPriceChangeSinceAdded).toBe(0); expect(activeOrder?.lines[1].unitPrice).toBe(ORIGINAL_PRICE); expect(TestChangedPriceStrategy.spy).toHaveBeenCalledTimes(1); }); }); });
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { createErrorResultGuard, createTestEnvironment, E2E_DEFAULT_CHANNEL_TOKEN, ErrorResultGuard, } from '@vendure/testing'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { CurrencyCode, LanguageCode } from './graphql/generated-e2e-admin-types'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { UpdatedOrderFragment } from './graphql/generated-e2e-shop-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { ASSIGN_PRODUCT_TO_CHANNEL, CREATE_CHANNEL, GET_CUSTOMER_LIST, GET_ORDERS_LIST, GET_PRODUCT_WITH_VARIANTS, } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER, GET_ACTIVE_ORDER, GET_ORDER_SHOP } from './graphql/shop-definitions'; describe('Channelaware orders', () => { const { server, adminClient, shopClient } = createTestEnvironment(testConfig()); const SECOND_CHANNEL_TOKEN = 'second_channel_token'; const THIRD_CHANNEL_TOKEN = 'third_channel_token'; let customerUser: Codegen.GetCustomerListQuery['customers']['items'][number]; let product1: Codegen.GetProductWithVariantsQuery['product']; let product2: Codegen.GetProductWithVariantsQuery['product']; let order1Id: string; let order2Id: string; beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); const { customers } = await adminClient.query< Codegen.GetCustomerListQuery, Codegen.GetCustomerListQueryVariables >(GET_CUSTOMER_LIST, { options: { take: 1 }, }); customerUser = customers.items[0]; await shopClient.asUserWithCredentials(customerUser.emailAddress, 'test'); await adminClient.query<Codegen.CreateChannelMutation, Codegen.CreateChannelMutationVariables>( CREATE_CHANNEL, { input: { code: 'second-channel', token: SECOND_CHANNEL_TOKEN, defaultLanguageCode: LanguageCode.en, currencyCode: CurrencyCode.GBP, pricesIncludeTax: true, defaultShippingZoneId: 'T_1', defaultTaxZoneId: 'T_1', }, }, ); await adminClient.query<Codegen.CreateChannelMutation, Codegen.CreateChannelMutationVariables>( CREATE_CHANNEL, { input: { code: 'third-channel', token: THIRD_CHANNEL_TOKEN, defaultLanguageCode: LanguageCode.en, currencyCode: CurrencyCode.GBP, pricesIncludeTax: true, defaultShippingZoneId: 'T_1', defaultTaxZoneId: 'T_1', }, }, ); product1 = ( await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }) ).product!; await adminClient.query< Codegen.AssignProductsToChannelMutation, Codegen.AssignProductsToChannelMutationVariables >(ASSIGN_PRODUCT_TO_CHANNEL, { input: { channelId: 'T_2', productIds: [product1.id], }, }); product2 = ( await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_2', }) ).product!; await adminClient.query< Codegen.AssignProductsToChannelMutation, Codegen.AssignProductsToChannelMutationVariables >(ASSIGN_PRODUCT_TO_CHANNEL, { input: { channelId: 'T_3', productIds: [product2.id], }, }); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); const orderResultGuard: ErrorResultGuard<UpdatedOrderFragment> = createErrorResultGuard( input => !!input.lines, ); it('creates order on current channel', async () => { shopClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: product1!.variants[0].id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(1); expect(addItemToOrder.lines[0].quantity).toBe(1); expect(addItemToOrder.lines[0].productVariant.id).toBe(product1!.variants[0].id); order1Id = addItemToOrder.id; }); it('sets active order to null when switching channel', async () => { shopClient.setChannelToken(THIRD_CHANNEL_TOKEN); const result = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result.activeOrder).toBeNull(); }); it('creates new order on current channel when already active order on other channel', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: product2!.variants[0].id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(1); expect(addItemToOrder.lines[0].quantity).toBe(1); expect(addItemToOrder.lines[0].productVariant.id).toBe(product2!.variants[0].id); order2Id = addItemToOrder.id; }); it('goes back to most recent active order when switching channel', async () => { shopClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder!.id).toBe(order1Id); }); it('returns null when requesting order from other channel', async () => { const result = await shopClient.query<CodegenShop.GetOrderShopQuery>(GET_ORDER_SHOP, { id: order2Id, }); expect(result.order).toBeNull(); }); it('returns order when requesting order from correct channel', async () => { const result = await shopClient.query<CodegenShop.GetOrderShopQuery>(GET_ORDER_SHOP, { id: order1Id, }); expect(result.order!.id).toBe(order1Id); }); it('returns all orders on default channel', async () => { adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const result = await adminClient.query<Codegen.GetOrderListQuery>(GET_ORDERS_LIST); expect(result.orders.items.map(o => o.id).sort()).toEqual([order1Id, order2Id]); }); it('returns only channel specific orders when on other than default channel', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const result = await adminClient.query<Codegen.GetOrderListQuery>(GET_ORDERS_LIST); expect(result.orders.items.map(o => o.id)).toEqual([order1Id]); }); });
import { defaultShippingCalculator, defaultShippingEligibilityChecker, FulfillmentHandler, LanguageCode, manualFulfillmentHandler, mergeConfig, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { vi } from 'vitest'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { testSuccessfulPaymentMethod } from './fixtures/test-payment-methods'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { CreateFulfillmentError, ErrorCode, FulfillmentFragment } from './graphql/generated-e2e-admin-types'; import { AddItemToOrderMutation, AddItemToOrderMutationVariables, TestOrderWithPaymentsFragment, } from './graphql/generated-e2e-shop-types'; import { CREATE_FULFILLMENT, CREATE_SHIPPING_METHOD, TRANSIT_FULFILLMENT, } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER } from './graphql/shop-definitions'; import { addPaymentToOrder, proceedToArrangingPayment } from './utils/test-order-utils'; const badTrackingCode = 'bad-code'; const transitionErrorMessage = 'Some error message'; const transitionSpy = vi.fn(); const testFulfillmentHandler = new FulfillmentHandler({ code: 'test-fulfillment-handler', description: [{ languageCode: LanguageCode.en, value: 'Test fulfillment handler' }], args: { trackingCode: { type: 'string', }, }, createFulfillment: (ctx, orders, items, args) => { if (args.trackingCode === badTrackingCode) { throw new Error('The code was bad!'); } return { trackingCode: args.trackingCode, }; }, onFulfillmentTransition: (fromState, toState, { fulfillment }) => { transitionSpy(fromState, toState); if (toState === 'Shipped') { return transitionErrorMessage; } }, }); describe('Order fulfillments', () => { const orderGuard: ErrorResultGuard<TestOrderWithPaymentsFragment> = createErrorResultGuard( input => !!input.lines, ); const fulfillmentGuard: ErrorResultGuard<FulfillmentFragment> = createErrorResultGuard( input => !!input.id, ); let order: TestOrderWithPaymentsFragment; let f1Id: string; const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { paymentOptions: { paymentMethodHandlers: [testSuccessfulPaymentMethod], }, shippingOptions: { fulfillmentHandlers: [manualFulfillmentHandler, testFulfillmentHandler], }, }), ); beforeAll(async () => { await server.init({ initialData: { ...initialData, paymentMethods: [ { name: testSuccessfulPaymentMethod.code, handler: { code: testSuccessfulPaymentMethod.code, arguments: [] }, }, ], }, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 2, }); await adminClient.asSuperAdmin(); await adminClient.query< Codegen.CreateShippingMethodMutation, Codegen.CreateShippingMethodMutationVariables >(CREATE_SHIPPING_METHOD, { input: { code: 'test-method', fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: defaultShippingEligibilityChecker.code, arguments: [ { name: 'orderMinimum', value: '0', }, ], }, calculator: { code: defaultShippingCalculator.code, arguments: [ { name: 'rate', value: '500', }, { name: 'taxRate', value: '0', }, ], }, translations: [{ languageCode: LanguageCode.en, name: 'test method', description: '' }], }, }); await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); await shopClient.query<AddItemToOrderMutation, AddItemToOrderMutationVariables>(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); await shopClient.query<AddItemToOrderMutation, AddItemToOrderMutationVariables>(ADD_ITEM_TO_ORDER, { productVariantId: 'T_2', quantity: 1, }); await proceedToArrangingPayment(shopClient); const result = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(result); order = result; }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('fulfillmentHandlers query', async () => { const { fulfillmentHandlers } = await adminClient.query<Codegen.GetFulfillmentHandlersQuery>( GET_FULFILLMENT_HANDLERS, ); expect(fulfillmentHandlers.map(h => h.code)).toEqual([ 'manual-fulfillment', 'test-fulfillment-handler', ]); }); it('creates fulfillment based on args', async () => { const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: order.lines.slice(0, 1).map(l => ({ orderLineId: l.id, quantity: l.quantity })), handler: { code: testFulfillmentHandler.code, arguments: [ { name: 'trackingCode', value: 'abc123', }, ], }, }, }); fulfillmentGuard.assertSuccess(addFulfillmentToOrder); expect(addFulfillmentToOrder.trackingCode).toBe('abc123'); f1Id = addFulfillmentToOrder.id; }); it('onFulfillmentTransition is called', async () => { expect(transitionSpy).toHaveBeenCalledTimes(1); expect(transitionSpy).toHaveBeenCalledWith('Created', 'Pending'); }); it('onFulfillmentTransition can prevent state transition', async () => { const { transitionFulfillmentToState } = await adminClient.query< Codegen.TransitFulfillmentMutation, Codegen.TransitFulfillmentMutationVariables >(TRANSIT_FULFILLMENT, { id: f1Id, state: 'Shipped', }); fulfillmentGuard.assertErrorResult(transitionFulfillmentToState); expect(transitionFulfillmentToState.errorCode).toBe(ErrorCode.FULFILLMENT_STATE_TRANSITION_ERROR); expect(transitionFulfillmentToState.transitionError).toBe(transitionErrorMessage); }); it('throwing from createFulfillment returns CreateFulfillmentError result', async () => { const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: order.lines.slice(1, 2).map(l => ({ orderLineId: l.id, quantity: l.quantity })), handler: { code: testFulfillmentHandler.code, arguments: [ { name: 'trackingCode', value: badTrackingCode, }, ], }, }, }); fulfillmentGuard.assertErrorResult(addFulfillmentToOrder); expect(addFulfillmentToOrder.errorCode).toBe(ErrorCode.CREATE_FULFILLMENT_ERROR); expect((addFulfillmentToOrder as CreateFulfillmentError).fulfillmentHandlerError).toBe( 'The code was bad!', ); }); }); const GET_FULFILLMENT_HANDLERS = gql` query GetFulfillmentHandlers { fulfillmentHandlers { code description args { name type description label ui } } } `;
import { DefaultSearchPlugin, JobQueueService, mergeConfig } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { TestOrderItemPriceCalculationStrategy } from './fixtures/test-order-item-price-calculation-strategy'; import { AddItemToOrderMutation, AddItemToOrderMutationVariables, SearchProductsShopQuery, SearchProductsShopQueryVariables, SinglePrice, } from './graphql/generated-e2e-shop-types'; import { ADD_ITEM_TO_ORDER, SEARCH_PRODUCTS_SHOP } from './graphql/shop-definitions'; describe('custom OrderItemPriceCalculationStrategy', () => { let variants: SearchProductsShopQuery['search']['items']; const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { customFields: { OrderLine: [{ name: 'giftWrap', type: 'boolean' }], }, orderOptions: { orderItemPriceCalculationStrategy: new TestOrderItemPriceCalculationStrategy(), }, plugins: [DefaultSearchPlugin], }), ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 3, }); const { search } = await shopClient.query<SearchProductsShopQuery, SearchProductsShopQueryVariables>( SEARCH_PRODUCTS_SHOP, { input: { take: 3, groupByProduct: false }, }, ); variants = search.items; }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); let secondOrderLineId: string; it('does not add surcharge', async () => { const variant0 = variants[0]; const { addItemToOrder } = await shopClient.query(ADD_ITEM_TO_ORDER_CUSTOM_FIELDS, { productVariantId: variant0.productVariantId, quantity: 1, customFields: { giftWrap: false, }, }); expect(addItemToOrder.lines[0].unitPrice).toEqual((variant0.price as SinglePrice).value); }); it('adds a surcharge', async () => { const variant0 = variants[0]; const { addItemToOrder } = await shopClient.query(ADD_ITEM_TO_ORDER_CUSTOM_FIELDS, { productVariantId: variant0.productVariantId, quantity: 1, customFields: { giftWrap: true, }, }); const variantPrice = (variant0.price as SinglePrice).value; expect(addItemToOrder.lines[0].unitPrice).toEqual(variantPrice); expect(addItemToOrder.lines[1].unitPrice).toEqual(variantPrice + 500); expect(addItemToOrder.subTotal).toEqual(variantPrice + variantPrice + 500); secondOrderLineId = addItemToOrder.lines[1].id; }); it('re-calculates when customFields changes', async () => { const { adjustOrderLine } = await shopClient.query(ADJUST_ORDER_LINE_CUSTOM_FIELDS, { orderLineId: secondOrderLineId, quantity: 1, customFields: { giftWrap: false, }, }); const variantPrice = (variants[0].price as SinglePrice).value; expect(adjustOrderLine.lines[0].unitPrice).toEqual(variantPrice); expect(adjustOrderLine.lines[1].unitPrice).toEqual(variantPrice); expect(adjustOrderLine.subTotal).toEqual(variantPrice + variantPrice); }); it('applies discount for quantity greater than 3', async () => { const { adjustOrderLine } = await shopClient.query(ADJUST_ORDER_LINE_CUSTOM_FIELDS, { orderLineId: secondOrderLineId, quantity: 4, customFields: { giftWrap: false, }, }); const variantPrice = (variants[0].price as SinglePrice).value; expect(adjustOrderLine.lines[1].unitPrice).toEqual(variantPrice / 2); expect(adjustOrderLine.subTotal).toEqual(variantPrice + (variantPrice / 2) * 4); }); }); const ORDER_WITH_LINES_AND_ITEMS_FRAGMENT = gql` fragment OrderWithLinesAndItems on Order { id subTotal subTotalWithTax shipping total totalWithTax lines { id quantity unitPrice unitPriceWithTax } } `; const ADD_ITEM_TO_ORDER_CUSTOM_FIELDS = gql` mutation AddItemToOrderCustomFields( $productVariantId: ID! $quantity: Int! $customFields: OrderLineCustomFieldsInput ) { addItemToOrder( productVariantId: $productVariantId quantity: $quantity customFields: $customFields ) { ...OrderWithLinesAndItems } } ${ORDER_WITH_LINES_AND_ITEMS_FRAGMENT} `; const ADJUST_ORDER_LINE_CUSTOM_FIELDS = gql` mutation AdjustOrderLineCustomFields( $orderLineId: ID! $quantity: Int! $customFields: OrderLineCustomFieldsInput ) { adjustOrderLine(orderLineId: $orderLineId, quantity: $quantity, customFields: $customFields) { ...OrderWithLinesAndItems } } ${ORDER_WITH_LINES_AND_ITEMS_FRAGMENT} `;
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { mergeConfig, MergedOrderLine, MergeOrdersStrategy, Order, OrderMergeStrategy, RequestContext, UseExistingStrategy, UseGuestIfExistingEmptyStrategy, UseGuestStrategy, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { AttemptLogin, AttemptLoginMutation, AttemptLoginMutationVariables, GetCustomerList, } from './graphql/generated-e2e-admin-types'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { AddItemToOrder, AddItemToOrderMutation, AddItemToOrderMutation, AddItemToOrderMutationVariables, GetActiveOrderPaymentsQuery, GetNextOrderStatesQuery, TestOrderFragmentFragment, UpdatedOrderFragment, } from './graphql/generated-e2e-shop-types'; import { ATTEMPT_LOGIN, GET_CUSTOMER_LIST } from './graphql/shared-definitions'; import { GET_ACTIVE_ORDER_PAYMENTS, GET_NEXT_STATES, TEST_ORDER_FRAGMENT } from './graphql/shop-definitions'; import { sortById } from './utils/test-order-utils'; /** * Allows us to change the active OrderMergeStrategy per-test and delegates to the current * activeStrategy. */ class DelegateMergeStrategy implements OrderMergeStrategy { static activeStrategy: OrderMergeStrategy = new MergeOrdersStrategy(); merge(ctx: RequestContext, guestOrder: Order, existingOrder: Order): MergedOrderLine[] { return DelegateMergeStrategy.activeStrategy.merge(ctx, guestOrder, existingOrder); } } type AddItemToOrderWithCustomFields = AddItemToOrderMutationVariables & { customFields?: { inscription?: string }; }; describe('Order merging', () => { type OrderSuccessResult = UpdatedOrderFragment | TestOrderFragmentFragment; const orderResultGuard: ErrorResultGuard<OrderSuccessResult> = createErrorResultGuard( input => !!input.lines, ); let customers: Codegen.GetCustomerListQuery['customers']['items']; const { server, shopClient, adminClient } = createTestEnvironment( mergeConfig(testConfig(), { orderOptions: { mergeStrategy: new DelegateMergeStrategy(), }, customFields: { OrderLine: [{ name: 'inscription', type: 'string' }], }, }), ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 10, }); await adminClient.asSuperAdmin(); const result = await adminClient.query<Codegen.GetCustomerListQuery>(GET_CUSTOMER_LIST); customers = result.customers.items; }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); async function testMerge(options: { strategy: OrderMergeStrategy; customerEmailAddress: string; existingOrderLines: AddItemToOrderWithCustomFields[]; guestOrderLines: AddItemToOrderWithCustomFields[]; }): Promise<{ lines: any[] }> { const { strategy, customerEmailAddress, existingOrderLines, guestOrderLines } = options; DelegateMergeStrategy.activeStrategy = strategy; await shopClient.asUserWithCredentials(customerEmailAddress, 'test'); for (const line of existingOrderLines) { await shopClient.query<AddItemToOrderMutation, AddItemToOrderWithCustomFields>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, line, ); } await shopClient.asAnonymousUser(); for (const line of guestOrderLines) { await shopClient.query<AddItemToOrderMutation, AddItemToOrderWithCustomFields>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, line, ); } await shopClient.query<Codegen.AttemptLoginMutation, Codegen.AttemptLoginMutationVariables>( ATTEMPT_LOGIN, { username: customerEmailAddress, password: 'test', }, ); const { activeOrder } = await shopClient.query(GET_ACTIVE_ORDER_WITH_CUSTOM_FIELDS); return activeOrder; } it('MergeOrdersStrategy adds new line', async () => { const result = await testMerge({ strategy: new MergeOrdersStrategy(), customerEmailAddress: customers[0].emailAddress, existingOrderLines: [{ productVariantId: 'T_1', quantity: 1 }], guestOrderLines: [{ productVariantId: 'T_2', quantity: 1 }], }); expect( result.lines.map(line => ({ productVariantId: line.productVariant.id, quantity: line.quantity })), ).toEqual([ { productVariantId: 'T_1', quantity: 1 }, { productVariantId: 'T_2', quantity: 1 }, ]); }); it('MergeOrdersStrategy uses guest quantity', async () => { const result = await testMerge({ strategy: new MergeOrdersStrategy(), customerEmailAddress: customers[1].emailAddress, existingOrderLines: [{ productVariantId: 'T_1', quantity: 1 }], guestOrderLines: [{ productVariantId: 'T_1', quantity: 3 }], }); expect( result.lines.map(line => ({ productVariantId: line.productVariant.id, quantity: line.quantity })), ).toEqual([{ productVariantId: 'T_1', quantity: 3 }]); }); it('MergeOrdersStrategy accounts for customFields', async () => { const result = await testMerge({ strategy: new MergeOrdersStrategy(), customerEmailAddress: customers[2].emailAddress, existingOrderLines: [ { productVariantId: 'T_1', quantity: 1, customFields: { inscription: 'foo' } }, ], guestOrderLines: [{ productVariantId: 'T_1', quantity: 3, customFields: { inscription: 'bar' } }], }); expect( result.lines.sort(sortById).map(line => ({ productVariantId: line.productVariant.id, quantity: line.quantity, customFields: line.customFields, })), ).toEqual([ { productVariantId: 'T_1', quantity: 1, customFields: { inscription: 'foo' } }, { productVariantId: 'T_1', quantity: 3, customFields: { inscription: 'bar' } }, ]); }); it('UseGuestStrategy', async () => { const result = await testMerge({ strategy: new UseGuestStrategy(), customerEmailAddress: customers[3].emailAddress, existingOrderLines: [ { productVariantId: 'T_1', quantity: 1 }, { productVariantId: 'T_3', quantity: 1 }, ], guestOrderLines: [{ productVariantId: 'T_5', quantity: 3 }], }); expect( result.lines.sort(sortById).map(line => ({ productVariantId: line.productVariant.id, quantity: line.quantity, })), ).toEqual([{ productVariantId: 'T_5', quantity: 3 }]); }); it('UseGuestIfExistingEmptyStrategy with empty existing', async () => { const result = await testMerge({ strategy: new UseGuestIfExistingEmptyStrategy(), customerEmailAddress: customers[4].emailAddress, existingOrderLines: [], guestOrderLines: [{ productVariantId: 'T_2', quantity: 3 }], }); expect( result.lines.sort(sortById).map(line => ({ productVariantId: line.productVariant.id, quantity: line.quantity, })), ).toEqual([{ productVariantId: 'T_2', quantity: 3 }]); }); it('UseGuestIfExistingEmptyStrategy with non-empty existing', async () => { const result = await testMerge({ strategy: new UseGuestIfExistingEmptyStrategy(), customerEmailAddress: customers[5].emailAddress, existingOrderLines: [{ productVariantId: 'T_5', quantity: 5 }], guestOrderLines: [{ productVariantId: 'T_2', quantity: 3 }], }); expect( result.lines.sort(sortById).map(line => ({ productVariantId: line.productVariant.id, quantity: line.quantity, })), ).toEqual([{ productVariantId: 'T_5', quantity: 5 }]); }); it('UseExistingStrategy', async () => { const result = await testMerge({ strategy: new UseExistingStrategy(), customerEmailAddress: customers[6].emailAddress, existingOrderLines: [{ productVariantId: 'T_8', quantity: 1 }], guestOrderLines: [{ productVariantId: 'T_2', quantity: 3 }], }); expect( result.lines.sort(sortById).map(line => ({ productVariantId: line.productVariant.id, quantity: line.quantity, })), ).toEqual([{ productVariantId: 'T_8', quantity: 1 }]); }); // https://github.com/vendure-ecommerce/vendure/issues/1454 it('does not throw FK error when merging with a cart with an existing session', async () => { await shopClient.asUserWithCredentials(customers[7].emailAddress, 'test'); // Create an Order linked with the current session const { nextOrderStates } = await shopClient.query<GetNextOrderStatesQuery>(GET_NEXT_STATES); // unset last auth token to simulate a guest user in a different browser shopClient.setAuthToken(''); await shopClient.query<AddItemToOrderMutation, AddItemToOrderWithCustomFields>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: '1', quantity: 2 }, ); const { login } = await shopClient.query<AttemptLoginMutation, AttemptLoginMutationVariables>( ATTEMPT_LOGIN, { username: customers[7].emailAddress, password: 'test' }, ); expect(login.id).toBe(customers[7].user?.id); }); }); export const ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS = gql` mutation AddItemToOrder( $productVariantId: ID! $quantity: Int! $customFields: OrderLineCustomFieldsInput ) { addItemToOrder( productVariantId: $productVariantId quantity: $quantity customFields: $customFields ) { ... on Order { id } ... on ErrorResult { errorCode message } } } `; export const GET_ACTIVE_ORDER_WITH_CUSTOM_FIELDS = gql` query GetActiveOrder { activeOrder { ...TestOrderFragment ... on Order { lines { customFields { inscription } } } } } ${TEST_ORDER_FRAGMENT} `;
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { omit } from '@vendure/common/lib/omit'; import { pick } from '@vendure/common/lib/pick'; import { summate } from '@vendure/common/lib/shared-utils'; import { defaultShippingCalculator, defaultShippingEligibilityChecker, freeShipping, mergeConfig, minimumOrderAmount, orderPercentageDiscount, productsPercentageDiscount, ShippingCalculator, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { manualFulfillmentHandler } from '../src/config/fulfillment/manual-fulfillment-handler'; import { orderFixedDiscount } from '../src/config/promotion/actions/order-fixed-discount-action'; import { failsToSettlePaymentMethod, testFailingPaymentMethod, testSuccessfulPaymentMethod, } from './fixtures/test-payment-methods'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { ErrorCode, GlobalFlag, HistoryEntryType, LanguageCode, OrderFragment, OrderWithLinesFragment, OrderWithModificationsFragment, } from './graphql/generated-e2e-admin-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { AddItemToOrderMutationVariables, TestOrderWithPaymentsFragment, UpdatedOrderFragment, } from './graphql/generated-e2e-shop-types'; import { ADMIN_TRANSITION_TO_STATE, CREATE_FULFILLMENT, CREATE_PROMOTION, CREATE_SHIPPING_METHOD, DELETE_PROMOTION, GET_ORDER, GET_ORDER_HISTORY, GET_PRODUCT_VARIANT_LIST, GET_STOCK_MOVEMENT, UPDATE_CHANNEL, UPDATE_PRODUCT_VARIANTS, } from './graphql/shared-definitions'; import { APPLY_COUPON_CODE, SET_SHIPPING_ADDRESS, SET_SHIPPING_METHOD, TRANSITION_TO_STATE, } from './graphql/shop-definitions'; import { addPaymentToOrder, proceedToArrangingPayment, sortById } from './utils/test-order-utils'; const SHIPPING_GB = 500; const SHIPPING_US = 1000; const SHIPPING_OTHER = 750; const testCalculator = new ShippingCalculator({ code: 'test-calculator', description: [{ languageCode: LanguageCode.en, value: 'Has metadata' }], args: { surcharge: { type: 'int', defaultValue: 0, }, }, calculate: (ctx, order, args) => { let price; const surcharge = args.surcharge || 0; switch (order.shippingAddress.countryCode) { case 'GB': price = SHIPPING_GB + surcharge; break; case 'US': price = SHIPPING_US + surcharge; break; default: price = SHIPPING_OTHER + surcharge; } return { price, priceIncludesTax: true, taxRate: 20, }; }, }); describe('Order modification', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { paymentOptions: { paymentMethodHandlers: [ testSuccessfulPaymentMethod, failsToSettlePaymentMethod, testFailingPaymentMethod, ], }, shippingOptions: { shippingCalculators: [defaultShippingCalculator, testCalculator], }, customFields: { Order: [{ name: 'points', type: 'int', defaultValue: 0 }], OrderLine: [{ name: 'color', type: 'string', nullable: true }], }, }), ); let orderId: string; let testShippingMethodId: string; let testExpressShippingMethodId: string; const orderGuard: ErrorResultGuard< UpdatedOrderFragment | OrderWithModificationsFragment | OrderFragment > = createErrorResultGuard(input => !!input.id); beforeAll(async () => { await server.init({ initialData: { ...initialData, paymentMethods: [ { name: testSuccessfulPaymentMethod.code, handler: { code: testSuccessfulPaymentMethod.code, arguments: [] }, }, { name: failsToSettlePaymentMethod.code, handler: { code: failsToSettlePaymentMethod.code, arguments: [] }, }, { name: testFailingPaymentMethod.code, handler: { code: testFailingPaymentMethod.code, arguments: [] }, }, ], }, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 3, }); await adminClient.asSuperAdmin(); await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: 'T_1', trackInventory: GlobalFlag.TRUE, }, { id: 'T_2', trackInventory: GlobalFlag.TRUE, }, { id: 'T_3', trackInventory: GlobalFlag.TRUE, }, ], }); const { createShippingMethod } = await adminClient.query< Codegen.CreateShippingMethodMutation, Codegen.CreateShippingMethodMutationVariables >(CREATE_SHIPPING_METHOD, { input: { code: 'new-method', fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: defaultShippingEligibilityChecker.code, arguments: [ { name: 'orderMinimum', value: '0', }, ], }, calculator: { code: testCalculator.code, arguments: [], }, translations: [{ languageCode: LanguageCode.en, name: 'test method', description: '' }], }, }); testShippingMethodId = createShippingMethod.id; const { createShippingMethod: shippingMethod2 } = await adminClient.query< Codegen.CreateShippingMethodMutation, Codegen.CreateShippingMethodMutationVariables >(CREATE_SHIPPING_METHOD, { input: { code: 'new-method-express', fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: defaultShippingEligibilityChecker.code, arguments: [ { name: 'orderMinimum', value: '0', }, ], }, calculator: { code: testCalculator.code, arguments: [ { name: 'surcharge', value: '500', }, ], }, translations: [ { languageCode: LanguageCode.en, name: 'test method express', description: '' }, ], }, }); testExpressShippingMethodId = shippingMethod2.id; // create an order and check out await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); await shopClient.query(gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: 'T_1', quantity: 1, customFields: { color: 'green', }, } as any); await shopClient.query(gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: 'T_4', quantity: 2, }); await proceedToArrangingPayment(shopClient); const result = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(result); orderId = result.id; }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('modifyOrder returns error result when not in Modifying state', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId, adjustOrderLines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 3 })), }, }); orderGuard.assertErrorResult(modifyOrder); expect(modifyOrder.errorCode).toBe(ErrorCode.ORDER_MODIFICATION_STATE_ERROR); }); it('transition to Modifying state', async () => { const transitionOrderToState = await adminTransitionOrderToState(orderId, 'Modifying'); orderGuard.assertSuccess(transitionOrderToState); expect(transitionOrderToState.state).toBe('Modifying'); }); describe('error cases', () => { it('no changes specified error', async () => { const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId, }, }); orderGuard.assertErrorResult(modifyOrder); expect(modifyOrder.errorCode).toBe(ErrorCode.NO_CHANGES_SPECIFIED_ERROR); }); it('no refund paymentId specified', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId, surcharges: [{ price: -500, priceIncludesTax: true, description: 'Discount' }], }, }); orderGuard.assertErrorResult(modifyOrder); expect(modifyOrder.errorCode).toBe(ErrorCode.REFUND_PAYMENT_ID_MISSING_ERROR); await assertOrderIsUnchanged(order!); }); it('addItems negative quantity', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId, addItems: [{ productVariantId: 'T_3', quantity: -1 }], }, }); orderGuard.assertErrorResult(modifyOrder); expect(modifyOrder.errorCode).toBe(ErrorCode.NEGATIVE_QUANTITY_ERROR); await assertOrderIsUnchanged(order!); }); it('adjustOrderLines negative quantity', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId, adjustOrderLines: [{ orderLineId: order!.lines[0].id, quantity: -1 }], }, }); orderGuard.assertErrorResult(modifyOrder); expect(modifyOrder.errorCode).toBe(ErrorCode.NEGATIVE_QUANTITY_ERROR); await assertOrderIsUnchanged(order!); }); it('addItems insufficient stock', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId, addItems: [{ productVariantId: 'T_3', quantity: 500 }], }, }); orderGuard.assertErrorResult(modifyOrder); expect(modifyOrder.errorCode).toBe(ErrorCode.INSUFFICIENT_STOCK_ERROR); await assertOrderIsUnchanged(order!); }); it('adjustOrderLines insufficient stock', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId, adjustOrderLines: [{ orderLineId: order!.lines[0].id, quantity: 500 }], }, }); orderGuard.assertErrorResult(modifyOrder); expect(modifyOrder.errorCode).toBe(ErrorCode.INSUFFICIENT_STOCK_ERROR); await assertOrderIsUnchanged(order!); }); it('addItems order limit', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId, addItems: [{ productVariantId: 'T_4', quantity: 9999 }], }, }); orderGuard.assertErrorResult(modifyOrder); expect(modifyOrder.errorCode).toBe(ErrorCode.ORDER_LIMIT_ERROR); await assertOrderIsUnchanged(order!); }); it('adjustOrderLines order limit', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId, adjustOrderLines: [{ orderLineId: order!.lines[1].id, quantity: 9999 }], }, }); orderGuard.assertErrorResult(modifyOrder); expect(modifyOrder.errorCode).toBe(ErrorCode.ORDER_LIMIT_ERROR); await assertOrderIsUnchanged(order!); }); }); describe('dry run', () => { it('addItems', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: true, orderId, addItems: [{ productVariantId: 'T_5', quantity: 1 }], }, }); orderGuard.assertSuccess(modifyOrder); const expectedTotal = order!.totalWithTax + Math.round(14374 * 1.2); // price of variant T_5 expect(modifyOrder.totalWithTax).toBe(expectedTotal); expect(modifyOrder.lines.length).toBe(order!.lines.length + 1); await assertOrderIsUnchanged(order!); }); it('addItems with existing variant id increments existing OrderLine', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: true, orderId, addItems: [ { productVariantId: 'T_1', quantity: 1, customFields: { color: 'green' } } as any, ], }, }); orderGuard.assertSuccess(modifyOrder); const lineT1 = modifyOrder.lines.find(l => l.productVariant.id === 'T_1'); expect(modifyOrder.lines.length).toBe(2); expect(lineT1?.quantity).toBe(2); await assertOrderIsUnchanged(order!); }); it('addItems with existing variant id but different customFields adds new OrderLine', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: true, orderId, addItems: [ { productVariantId: 'T_1', quantity: 1, customFields: { color: 'blue' } } as any, ], }, }); orderGuard.assertSuccess(modifyOrder); const lineT1 = modifyOrder.lines.find(l => l.productVariant.id === 'T_1'); expect(modifyOrder.lines.length).toBe(3); expect( modifyOrder.lines.map(l => ({ variantId: l.productVariant.id, quantity: l.quantity })), ).toEqual([ { variantId: 'T_1', quantity: 1 }, { variantId: 'T_4', quantity: 2 }, { variantId: 'T_1', quantity: 1 }, ]); await assertOrderIsUnchanged(order!); }); it('adjustOrderLines up', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: true, orderId, adjustOrderLines: [{ orderLineId: order!.lines[0].id, quantity: 3 }], }, }); orderGuard.assertSuccess(modifyOrder); const expectedTotal = order!.totalWithTax + order!.lines[0].unitPriceWithTax * 2; expect(modifyOrder.lines[0].quantity).toBe(3); expect(modifyOrder.totalWithTax).toBe(expectedTotal); await assertOrderIsUnchanged(order!); }); it('adjustOrderLines down', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: true, orderId, adjustOrderLines: [{ orderLineId: order!.lines[1].id, quantity: 1 }], }, }); orderGuard.assertSuccess(modifyOrder); const expectedTotal = order!.totalWithTax - order!.lines[1].unitPriceWithTax; expect(modifyOrder.lines[1].quantity).toBe(1); expect(modifyOrder.totalWithTax).toBe(expectedTotal); await assertOrderIsUnchanged(order!); }); it('adjustOrderLines to zero', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: true, orderId, adjustOrderLines: [{ orderLineId: order!.lines[0].id, quantity: 0 }], }, }); orderGuard.assertSuccess(modifyOrder); const expectedTotal = order!.totalWithTax - order!.lines[0].unitPriceWithTax * order!.lines[0].quantity; expect(modifyOrder.totalWithTax).toBe(expectedTotal); expect(modifyOrder.lines[0].quantity).toBe(0); await assertOrderIsUnchanged(order!); }); it('surcharge positive', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: true, orderId, surcharges: [ { description: 'extra fee', sku: '123', price: 300, priceIncludesTax: true, taxRate: 20, taxDescription: 'VAT', }, ], }, }); orderGuard.assertSuccess(modifyOrder); const expectedTotal = order!.totalWithTax + 300; expect(modifyOrder.totalWithTax).toBe(expectedTotal); expect(modifyOrder.surcharges.map(s => omit(s, ['id']))).toEqual([ { description: 'extra fee', sku: '123', price: 250, priceWithTax: 300, taxRate: 20, }, ]); await assertOrderIsUnchanged(order!); }); it('surcharge negative', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: true, orderId, surcharges: [ { description: 'special discount', sku: '123', price: -300, priceIncludesTax: true, taxRate: 20, taxDescription: 'VAT', }, ], }, }); orderGuard.assertSuccess(modifyOrder); const expectedTotal = order!.totalWithTax + -300; expect(modifyOrder.totalWithTax).toBe(expectedTotal); expect(modifyOrder.surcharges.map(s => omit(s, ['id']))).toEqual([ { description: 'special discount', sku: '123', price: -250, priceWithTax: -300, taxRate: 20, }, ]); await assertOrderIsUnchanged(order!); }); it('changing shipping method', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: true, orderId, shippingMethodIds: [testExpressShippingMethodId], }, }); orderGuard.assertSuccess(modifyOrder); const expectedTotal = order!.totalWithTax + 500; expect(modifyOrder.totalWithTax).toBe(expectedTotal); expect(modifyOrder.shippingLines).toEqual([ { id: 'T_1', discountedPriceWithTax: 1500, shippingMethod: { id: testExpressShippingMethodId, name: 'test method express', }, }, ]); await assertOrderIsUnchanged(order!); }); it('does not add a history entry', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: true, orderId, addItems: [{ productVariantId: 'T_5', quantity: 1 }], }, }); orderGuard.assertSuccess(modifyOrder); const { order: history } = await adminClient.query< Codegen.GetOrderHistoryQuery, Codegen.GetOrderHistoryQueryVariables >(GET_ORDER_HISTORY, { id: orderId, options: { filter: { type: { eq: HistoryEntryType.ORDER_MODIFIED } } }, }); orderGuard.assertSuccess(history); expect(history.history.totalItems).toBe(0); }); }); describe('wet run', () => { async function assertModifiedOrderIsPersisted(order: OrderWithModificationsFragment) { const { order: order2 } = await adminClient.query< Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables >(GET_ORDER, { id: order.id, }); expect(order2!.totalWithTax).toBe(order.totalWithTax); expect(order2!.lines.length).toBe(order.lines.length); expect(order2!.surcharges.length).toBe(order.surcharges.length); expect(order2!.payments!.length).toBe(order.payments!.length); expect(order2!.payments!.map(p => pick(p, ['id', 'amount', 'method']))).toEqual( order.payments!.map(p => pick(p, ['id', 'amount', 'method'])), ); } it('addItems', async () => { const order = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_1', quantity: 1, }, ]); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, addItems: [{ productVariantId: 'T_5', quantity: 1 }], }, }); orderGuard.assertSuccess(modifyOrder); const priceDelta = Math.round(14374 * 1.2); // price of variant T_5 const expectedTotal = order.totalWithTax + priceDelta; expect(modifyOrder.totalWithTax).toBe(expectedTotal); expect(modifyOrder.lines.length).toBe(order.lines.length + 1); expect(modifyOrder.modifications.length).toBe(1); expect(modifyOrder.modifications[0].priceChange).toBe(priceDelta); expect(modifyOrder.modifications[0].lines.length).toBe(1); expect(modifyOrder.modifications[0].lines).toEqual([ { orderLineId: modifyOrder.lines[1].id, quantity: 1 }, ]); await assertModifiedOrderIsPersisted(modifyOrder); }); it('adjustOrderLines up', async () => { const order = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_1', quantity: 1, }, ]); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, adjustOrderLines: [{ orderLineId: order.lines[0].id, quantity: 2 }], }, }); orderGuard.assertSuccess(modifyOrder); const priceDelta = order.lines[0].unitPriceWithTax; const expectedTotal = order.totalWithTax + priceDelta; expect(modifyOrder.totalWithTax).toBe(expectedTotal); expect(modifyOrder.lines[0].quantity).toBe(2); expect(modifyOrder.modifications.length).toBe(1); expect(modifyOrder.modifications[0].priceChange).toBe(priceDelta); expect(modifyOrder.modifications[0].lines.length).toBe(1); expect(modifyOrder.lines[0].id).toEqual(modifyOrder.modifications[0].lines[0].orderLineId); await assertModifiedOrderIsPersisted(modifyOrder); }); it('adjustOrderLines down', async () => { const order = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_1', quantity: 2, }, ]); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, adjustOrderLines: [{ orderLineId: order.lines[0].id, quantity: 1 }], refund: { paymentId: order.payments![0].id }, }, }); orderGuard.assertSuccess(modifyOrder); const priceDelta = -order.lines[0].unitPriceWithTax; const expectedTotal = order.totalWithTax + priceDelta; expect(modifyOrder.totalWithTax).toBe(expectedTotal); expect(modifyOrder.lines[0].quantity).toBe(1); expect(modifyOrder.payments?.length).toBe(1); expect(modifyOrder.payments?.[0].refunds.length).toBe(1); expect(modifyOrder.payments?.[0].refunds[0]).toEqual({ id: 'T_1', state: 'Pending', total: -priceDelta, paymentId: modifyOrder.payments?.[0].id, }); expect(modifyOrder.modifications.length).toBe(1); expect(modifyOrder.modifications[0].priceChange).toBe(priceDelta); expect(modifyOrder.modifications[0].surcharges).toEqual(modifyOrder.surcharges.map(pick(['id']))); expect(modifyOrder.modifications[0].lines.length).toBe(1); expect(modifyOrder.lines[0].id).toEqual(modifyOrder.modifications[0].lines[0].orderLineId); await assertModifiedOrderIsPersisted(modifyOrder); }); it('adjustOrderLines with changed customField value', async () => { const order = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_1', quantity: 1, customFields: { color: 'green', }, }, ]); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, adjustOrderLines: [ { orderLineId: order.lines[0].id, quantity: 1, customFields: { color: 'black' }, } as any, ], }, }); orderGuard.assertSuccess(modifyOrder); expect(modifyOrder.lines.length).toBe(1); const { order: orderWithLines } = await adminClient.query(gql(GET_ORDER_WITH_CUSTOM_FIELDS), { id: order.id, }); expect(orderWithLines.lines[0]).toEqual({ id: order.lines[0].id, customFields: { color: 'black' }, }); }); it('adjustOrderLines handles quantity correctly', async () => { await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: 'T_6', stockOnHand: 1, trackInventory: GlobalFlag.TRUE, }, ], }); const order = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_6', quantity: 1, }, ]); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, adjustOrderLines: [ { orderLineId: order.lines[0].id, quantity: 1, }, ], updateShippingAddress: { fullName: 'Jim', }, }, }); orderGuard.assertSuccess(modifyOrder); }); it('surcharge positive', async () => { const order = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_1', quantity: 1, }, ]); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, surcharges: [ { description: 'extra fee', sku: '123', price: 300, priceIncludesTax: true, taxRate: 20, taxDescription: 'VAT', }, ], }, }); orderGuard.assertSuccess(modifyOrder); const priceDelta = 300; const expectedTotal = order.totalWithTax + priceDelta; expect(modifyOrder.totalWithTax).toBe(expectedTotal); expect(modifyOrder.surcharges.map(s => omit(s, ['id']))).toEqual([ { description: 'extra fee', sku: '123', price: 250, priceWithTax: 300, taxRate: 20, }, ]); expect(modifyOrder.modifications.length).toBe(1); expect(modifyOrder.modifications[0].priceChange).toBe(priceDelta); expect(modifyOrder.modifications[0].surcharges).toEqual(modifyOrder.surcharges.map(pick(['id']))); await assertModifiedOrderIsPersisted(modifyOrder); }); it('surcharge negative', async () => { const order = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_1', quantity: 1, }, ]); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, surcharges: [ { description: 'special discount', sku: '123', price: -300, priceIncludesTax: true, taxRate: 20, taxDescription: 'VAT', }, ], refund: { paymentId: order.payments![0].id, }, }, }); orderGuard.assertSuccess(modifyOrder); const expectedTotal = order.totalWithTax + -300; expect(modifyOrder.totalWithTax).toBe(expectedTotal); expect(modifyOrder.surcharges.map(s => omit(s, ['id']))).toEqual([ { description: 'special discount', sku: '123', price: -250, priceWithTax: -300, taxRate: 20, }, ]); expect(modifyOrder.modifications.length).toBe(1); expect(modifyOrder.modifications[0].priceChange).toBe(-300); await assertModifiedOrderIsPersisted(modifyOrder); }); it('update updateShippingAddress, recalculate shipping', async () => { const order = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_1', quantity: 1, }, ]); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, updateShippingAddress: { countryCode: 'US', }, options: { recalculateShipping: true, }, }, }); orderGuard.assertSuccess(modifyOrder); const priceDelta = SHIPPING_US - SHIPPING_OTHER; const expectedTotal = order.totalWithTax + priceDelta; expect(modifyOrder.totalWithTax).toBe(expectedTotal); expect(modifyOrder.shippingAddress?.countryCode).toBe('US'); expect(modifyOrder.modifications.length).toBe(1); expect(modifyOrder.modifications[0].priceChange).toBe(priceDelta); await assertModifiedOrderIsPersisted(modifyOrder); }); it('update updateShippingAddress, do not recalculate shipping', async () => { const order = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_1', quantity: 1, }, ]); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, updateShippingAddress: { countryCode: 'US', }, options: { recalculateShipping: false, }, }, }); orderGuard.assertSuccess(modifyOrder); const priceDelta = 0; const expectedTotal = order.totalWithTax + priceDelta; expect(modifyOrder.totalWithTax).toBe(expectedTotal); expect(modifyOrder.shippingAddress?.countryCode).toBe('US'); expect(modifyOrder.modifications.length).toBe(1); expect(modifyOrder.modifications[0].priceChange).toBe(priceDelta); await assertModifiedOrderIsPersisted(modifyOrder); }); it('update Order customFields', async () => { const order = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_1', quantity: 1, }, ]); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, customFields: { points: 42, }, } as any, }); orderGuard.assertSuccess(modifyOrder); const { order: orderWithCustomFields } = await adminClient.query( gql(GET_ORDER_WITH_CUSTOM_FIELDS), { id: order.id }, ); expect(orderWithCustomFields.customFields).toEqual({ points: 42, }); }); it('adds a history entry', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order!.id, addItems: [{ productVariantId: 'T_5', quantity: 1 }], }, }); orderGuard.assertSuccess(modifyOrder); const { order: history } = await adminClient.query< Codegen.GetOrderHistoryQuery, Codegen.GetOrderHistoryQueryVariables >(GET_ORDER_HISTORY, { id: orderId, options: { filter: { type: { eq: HistoryEntryType.ORDER_MODIFIED } } }, }); orderGuard.assertSuccess(history); expect(history.history.totalItems).toBe(1); expect(history.history.items[0].data).toEqual({ modificationId: modifyOrder.modifications[0].id, }); }); }); describe('additional payment handling', () => { let orderId2: string; beforeAll(async () => { const order = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_1', quantity: 1, }, ]); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, surcharges: [ { description: 'extra fee', sku: '123', price: 300, priceIncludesTax: true, taxRate: 20, taxDescription: 'VAT', }, ], }, }); orderGuard.assertSuccess(modifyOrder); orderId2 = modifyOrder.id; }); it('cannot transition back to original state if no payment is set', async () => { const transitionOrderToState = await adminTransitionOrderToState(orderId2, 'PaymentSettled'); orderGuard.assertErrorResult(transitionOrderToState); expect(transitionOrderToState!.errorCode).toBe(ErrorCode.ORDER_STATE_TRANSITION_ERROR); expect(transitionOrderToState!.transitionError).toBe( 'Can only transition to the "ArrangingAdditionalPayment" state', ); }); it('can transition to ArrangingAdditionalPayment state', async () => { const transitionOrderToState = await adminTransitionOrderToState( orderId2, 'ArrangingAdditionalPayment', ); orderGuard.assertSuccess(transitionOrderToState); expect(transitionOrderToState.state).toBe('ArrangingAdditionalPayment'); }); it('cannot transition from ArrangingAdditionalPayment when total not covered by Payments', async () => { const transitionOrderToState = await adminTransitionOrderToState(orderId2, 'PaymentSettled'); orderGuard.assertErrorResult(transitionOrderToState); expect(transitionOrderToState!.errorCode).toBe(ErrorCode.ORDER_STATE_TRANSITION_ERROR); expect(transitionOrderToState!.transitionError).toBe( 'Cannot transition away from "ArrangingAdditionalPayment" unless Order total is covered by Payments', ); }); it('addManualPaymentToOrder', async () => { const { addManualPaymentToOrder } = await adminClient.query< Codegen.AddManualPaymentMutation, Codegen.AddManualPaymentMutationVariables >(ADD_MANUAL_PAYMENT, { input: { orderId: orderId2, method: 'test', transactionId: 'ABC123', metadata: { foo: 'bar', }, }, }); orderGuard.assertSuccess(addManualPaymentToOrder); expect(addManualPaymentToOrder.payments?.length).toBe(2); expect(omit(addManualPaymentToOrder.payments![1], ['id'])).toEqual({ transactionId: 'ABC123', state: 'Settled', amount: 300, method: 'test', metadata: { foo: 'bar', }, refunds: [], }); expect(addManualPaymentToOrder.modifications[0].isSettled).toBe(true); expect(addManualPaymentToOrder.modifications[0].payment?.id).toBe( addManualPaymentToOrder.payments![1].id, ); }); it('transition back to original state', async () => { const transitionOrderToState = await adminTransitionOrderToState(orderId2, 'PaymentSettled'); orderGuard.assertSuccess(transitionOrderToState); expect(transitionOrderToState.state).toBe('PaymentSettled'); }); }); describe('refund handling', () => { let orderId3: string; beforeAll(async () => { const order = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_1', quantity: 1, }, ]); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, surcharges: [ { description: 'discount', sku: '123', price: -300, priceIncludesTax: true, taxRate: 20, taxDescription: 'VAT', }, ], refund: { paymentId: order.payments![0].id, reason: 'discount', }, }, }); orderGuard.assertSuccess(modifyOrder); orderId3 = modifyOrder.id; }); it('modification is settled', async () => { const { order } = await adminClient.query< Codegen.GetOrderWithModificationsQuery, Codegen.GetOrderWithModificationsQueryVariables >(GET_ORDER_WITH_MODIFICATIONS, { id: orderId3 }); expect(order?.modifications.length).toBe(1); expect(order?.modifications[0].isSettled).toBe(true); }); it('cannot transition to ArrangingAdditionalPayment state if no payment is needed', async () => { const transitionOrderToState = await adminTransitionOrderToState( orderId3, 'ArrangingAdditionalPayment', ); orderGuard.assertErrorResult(transitionOrderToState); expect(transitionOrderToState!.errorCode).toBe(ErrorCode.ORDER_STATE_TRANSITION_ERROR); expect(transitionOrderToState!.transitionError).toBe( 'Cannot transition Order to the "ArrangingAdditionalPayment" state as no additional payments are needed', ); }); it('can transition to original state', async () => { const transitionOrderToState = await adminTransitionOrderToState(orderId3, 'PaymentSettled'); orderGuard.assertSuccess(transitionOrderToState); expect(transitionOrderToState.state).toBe('PaymentSettled'); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId3, }, ); expect(order?.payments![0].refunds.length).toBe(1); expect(order?.payments![0].refunds[0].total).toBe(300); expect(order?.payments![0].refunds[0].reason).toBe('discount'); }); }); // https://github.com/vendure-ecommerce/vendure/issues/1753 describe('refunds for multiple payments', () => { let orderId2: string; let orderLineId: string; let additionalPaymentId: string; beforeAll(async () => { await adminClient.query< Codegen.CreatePromotionMutation, Codegen.CreatePromotionMutationVariables >(CREATE_PROMOTION, { input: { couponCode: '5OFF', enabled: true, conditions: [], actions: [ { code: orderFixedDiscount.code, arguments: [{ name: 'discount', value: '500' }], }, ], translations: [{ languageCode: LanguageCode.en, name: '$5 off' }], }, }); await shopClient.asUserWithCredentials('trevor_donnelly96@hotmail.com', 'test'); await shopClient.query(gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: 'T_5', quantity: 1, } as any); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(order); orderLineId = order.lines[0].id; orderId2 = order.id; const transitionOrderToState = await adminTransitionOrderToState(orderId2, 'Modifying'); orderGuard.assertSuccess(transitionOrderToState); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: orderId2, adjustOrderLines: [{ orderLineId, quantity: 2 }], }, }); orderGuard.assertSuccess(modifyOrder); await adminTransitionOrderToState(orderId2, 'ArrangingAdditionalPayment'); const { addManualPaymentToOrder } = await adminClient.query< Codegen.AddManualPaymentMutation, Codegen.AddManualPaymentMutationVariables >(ADD_MANUAL_PAYMENT, { input: { orderId: orderId2, method: 'test', transactionId: 'ABC123', metadata: { foo: 'bar', }, }, }); orderGuard.assertSuccess(addManualPaymentToOrder); additionalPaymentId = addManualPaymentToOrder.payments![1].id!; const transitionOrderToState2 = await adminTransitionOrderToState(orderId2, 'PaymentSettled'); orderGuard.assertSuccess(transitionOrderToState2); expect(transitionOrderToState2.state).toBe('PaymentSettled'); }); it('apply couponCode to create first refund', async () => { const transitionOrderToState = await adminTransitionOrderToState(orderId2, 'Modifying'); orderGuard.assertSuccess(transitionOrderToState); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: orderId2, couponCodes: ['5OFF'], refund: { paymentId: additionalPaymentId, reason: 'test', }, }, }); orderGuard.assertSuccess(modifyOrder); expect(modifyOrder.payments?.length).toBe(2); expect(modifyOrder?.payments?.find(p => p.id === additionalPaymentId)?.refunds).toEqual([ { id: 'T_4', paymentId: additionalPaymentId, state: 'Pending', total: 600, }, ]); expect(modifyOrder.totalWithTax).toBe(getOrderPaymentsTotalWithRefunds(modifyOrder)); }); it('reduce quantity to create second refund', async () => { const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: orderId2, adjustOrderLines: [{ orderLineId, quantity: 1 }], refund: { paymentId: additionalPaymentId, reason: 'test 2', }, }, }); orderGuard.assertSuccess(modifyOrder); expect( modifyOrder?.payments?.find(p => p.id === additionalPaymentId)?.refunds.sort(sortById), ).toEqual([ { id: 'T_4', paymentId: additionalPaymentId, state: 'Pending', total: 600, }, { id: 'T_5', paymentId: additionalPaymentId, state: 'Pending', total: 16649, }, ]); // Note: During the big refactor of the OrderItem entity, the "total" value in the following // assertion was changed from `300` to `600`. This is due to a change in the way we calculate // refunds on pro-rated discounts. Previously, the pro-ration was not recalculated prior to // the refund being calculated, so the individual OrderItem had only 1/2 the full order discount // applied to it (300). Now, the pro-ration is applied to the single remaining item and therefore the // entire discount of 600 gets moved over to the remaining item. expect(modifyOrder?.payments?.find(p => p.id !== additionalPaymentId)?.refunds).toEqual([ { id: 'T_6', paymentId: 'T_15', state: 'Pending', total: 600, }, ]); expect(modifyOrder.totalWithTax).toBe(getOrderPaymentsTotalWithRefunds(modifyOrder)); }); }); // https://github.com/vendure-ecommerce/vendure/issues/688 - 4th point it('correct additional payment when discounts applied', async () => { await adminClient.query<Codegen.CreatePromotionMutation, Codegen.CreatePromotionMutationVariables>( CREATE_PROMOTION, { input: { couponCode: '5OFF', enabled: true, conditions: [], actions: [ { code: orderFixedDiscount.code, arguments: [{ name: 'discount', value: '500' }], }, ], translations: [{ languageCode: LanguageCode.en, name: '$5 off' }], }, }, ); await shopClient.asUserWithCredentials('trevor_donnelly96@hotmail.com', 'test'); await shopClient.query(gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: 'T_1', quantity: 1, } as any); await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: '5OFF', }); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(order); const originalTotalWithTax = order.totalWithTax; const surcharge = 300; const transitionOrderToState = await adminTransitionOrderToState(order.id, 'Modifying'); orderGuard.assertSuccess(transitionOrderToState); expect(transitionOrderToState.state).toBe('Modifying'); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, surcharges: [ { description: 'extra fee', sku: '123', price: surcharge, priceIncludesTax: true, taxRate: 20, taxDescription: 'VAT', }, ], }, }); orderGuard.assertSuccess(modifyOrder); expect(modifyOrder.totalWithTax).toBe(originalTotalWithTax + surcharge); }); // https://github.com/vendure-ecommerce/vendure/issues/872 describe('correct price calculations when prices include tax', () => { async function modifyOrderLineQuantity(order: TestOrderWithPaymentsFragment) { const transitionOrderToState = await adminTransitionOrderToState(order.id, 'Modifying'); orderGuard.assertSuccess(transitionOrderToState); expect(transitionOrderToState.state).toBe('Modifying'); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: true, orderId: order.id, adjustOrderLines: [{ orderLineId: order.lines[0].id, quantity: 2 }], }, }); orderGuard.assertSuccess(modifyOrder); return modifyOrder; } beforeAll(async () => { await adminClient.query<Codegen.UpdateChannelMutation, Codegen.UpdateChannelMutationVariables>( UPDATE_CHANNEL, { input: { id: 'T_1', pricesIncludeTax: true, }, }, ); }); it('without promotion', async () => { await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); await shopClient.query(gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: 'T_1', quantity: 1, } as any); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(order); const modifyOrder = await modifyOrderLineQuantity(order); expect(modifyOrder.lines[0].linePriceWithTax).toBe(order.lines[0].linePriceWithTax * 2); }); it('with promotion', async () => { await adminClient.query< Codegen.CreatePromotionMutation, Codegen.CreatePromotionMutationVariables >(CREATE_PROMOTION, { input: { couponCode: 'HALF', enabled: true, conditions: [], actions: [ { code: productsPercentageDiscount.code, arguments: [ { name: 'discount', value: '50' }, { name: 'productVariantIds', value: JSON.stringify(['T_1']) }, ], }, ], translations: [{ languageCode: LanguageCode.en, name: 'half price' }], }, }); await shopClient.asUserWithCredentials('trevor_donnelly96@hotmail.com', 'test'); await shopClient.query(gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: 'T_1', quantity: 1, } as any); await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: 'HALF', }); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(order); const modifyOrder = await modifyOrderLineQuantity(order); expect(modifyOrder.lines[0].discountedLinePriceWithTax).toBe( modifyOrder.lines[0].linePriceWithTax / 2, ); expect(modifyOrder.lines[0].linePriceWithTax).toBe(order.lines[0].linePriceWithTax * 2); }); }); describe('refund handling when promotions are active on order', () => { // https://github.com/vendure-ecommerce/vendure/issues/890 it('refunds correct amount when order-level promotion applied', async () => { await adminClient.query< Codegen.CreatePromotionMutation, Codegen.CreatePromotionMutationVariables >(CREATE_PROMOTION, { input: { couponCode: '5OFF2', enabled: true, conditions: [], actions: [ { code: orderFixedDiscount.code, arguments: [{ name: 'discount', value: '500' }], }, ], translations: [{ languageCode: LanguageCode.en, name: '$5 off' }], }, }); await shopClient.asUserWithCredentials('trevor_donnelly96@hotmail.com', 'test'); await shopClient.query(gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: 'T_1', quantity: 2, } as any); await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: '5OFF2', }); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(order); const originalTotalWithTax = order.totalWithTax; const transitionOrderToState = await adminTransitionOrderToState(order.id, 'Modifying'); orderGuard.assertSuccess(transitionOrderToState); expect(transitionOrderToState.state).toBe('Modifying'); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, adjustOrderLines: [{ orderLineId: order.lines[0].id, quantity: 1 }], refund: { paymentId: order.payments![0].id, reason: 'requested', }, }, }); orderGuard.assertSuccess(modifyOrder); expect(modifyOrder.totalWithTax).toBe( originalTotalWithTax - order.lines[0].proratedUnitPriceWithTax, ); expect(modifyOrder.payments![0].refunds[0].total).toBe(order.lines[0].proratedUnitPriceWithTax); expect(modifyOrder.totalWithTax).toBe(getOrderPaymentsTotalWithRefunds(modifyOrder)); }); // https://github.com/vendure-ecommerce/vendure/issues/1865 describe('issue 1865', () => { const promoDiscount = 5000; let promoId: string; let orderId2: string; beforeAll(async () => { const { createPromotion } = await adminClient.query< Codegen.CreatePromotionMutation, Codegen.CreatePromotionMutationVariables >(CREATE_PROMOTION, { input: { enabled: true, conditions: [ { code: minimumOrderAmount.code, arguments: [ { name: 'amount', value: '10000' }, { name: 'taxInclusive', value: 'true' }, ], }, ], actions: [ { code: orderFixedDiscount.code, arguments: [{ name: 'discount', value: JSON.stringify(promoDiscount) }], }, ], translations: [{ languageCode: LanguageCode.en, name: '50 off orders over 100' }], }, }); promoId = (createPromotion as any).id; }); afterAll(async () => { await adminClient.query< Codegen.DeletePromotionMutation, Codegen.DeletePromotionMutationVariables >(DELETE_PROMOTION, { id: promoId, }); }); it('refund handling when order-level promotion becomes invalid on modification', async () => { const { productVariants } = await adminClient.query< Codegen.GetProductVariantListQuery, Codegen.GetProductVariantListQueryVariables >(GET_PRODUCT_VARIANT_LIST, { options: { filter: { name: { contains: 'football' }, }, }, }); const football = productVariants.items[0]; await shopClient.query(gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: football.id, quantity: 2, } as any); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(order); orderId2 = order.id; expect(order.discounts.length).toBe(1); expect(order.discounts[0].amountWithTax).toBe(-promoDiscount); const shippingPrice = order.shippingWithTax; const expectedTotal = football.priceWithTax * 2 + shippingPrice - promoDiscount; expect(order.totalWithTax).toBe(expectedTotal); const originalTotalWithTax = order.totalWithTax; const transitionOrderToState = await adminTransitionOrderToState(order.id, 'Modifying'); orderGuard.assertSuccess(transitionOrderToState); expect(transitionOrderToState.state).toBe('Modifying'); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, adjustOrderLines: [{ orderLineId: order.lines[0].id, quantity: 1 }], refund: { paymentId: order.payments![0].id, reason: 'requested', }, }, }); orderGuard.assertSuccess(modifyOrder); const expectedNewTotal = order.lines[0].unitPriceWithTax + shippingPrice; expect(modifyOrder.totalWithTax).toBe(expectedNewTotal); expect(modifyOrder.payments![0].refunds[0].total).toBe(expectedTotal - expectedNewTotal); expect(modifyOrder.totalWithTax).toBe(getOrderPaymentsTotalWithRefunds(modifyOrder)); }); it('transition back to original state', async () => { const transitionOrderToState2 = await adminTransitionOrderToState(orderId2, 'PaymentSettled'); orderGuard.assertSuccess(transitionOrderToState2); expect(transitionOrderToState2.state).toBe('PaymentSettled'); }); it('order no longer has promotions', async () => { const { order } = await adminClient.query< Codegen.GetOrderWithModificationsQuery, Codegen.GetOrderWithModificationsQueryVariables >(GET_ORDER_WITH_MODIFICATIONS, { id: orderId2 }); expect(order?.promotions).toEqual([]); }); it('order no longer has discounts', async () => { const { order } = await adminClient.query< Codegen.GetOrderWithModificationsQuery, Codegen.GetOrderWithModificationsQueryVariables >(GET_ORDER_WITH_MODIFICATIONS, { id: orderId2 }); expect(order?.discounts).toEqual([]); }); }); }); // https://github.com/vendure-ecommerce/vendure/issues/1197 describe('refund on shipping when change made to shippingAddress', () => { let order: OrderWithModificationsFragment; beforeAll(async () => { const createdOrder = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_1', quantity: 1, }, ]); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: createdOrder.id, updateShippingAddress: { countryCode: 'GB', }, refund: { paymentId: createdOrder.payments![0].id, reason: 'discount', }, }, }); orderGuard.assertSuccess(modifyOrder); order = modifyOrder; }); it('creates a Refund with the correct amount', async () => { expect(order.payments?.[0].refunds[0].total).toBe(SHIPPING_OTHER - SHIPPING_GB); }); it('allows transition to PaymentSettled', async () => { const transitionOrderToState = await adminTransitionOrderToState(order.id, 'PaymentSettled'); orderGuard.assertSuccess(transitionOrderToState); expect(transitionOrderToState.state).toBe('PaymentSettled'); }); }); // https://github.com/vendure-ecommerce/vendure/issues/1210 describe('updating stock levels', () => { async function getVariant(id: 'T_1' | 'T_2' | 'T_3') { const { product } = await adminClient.query< Codegen.GetStockMovementQuery, Codegen.GetStockMovementQueryVariables >(GET_STOCK_MOVEMENT, { id: 'T_1', }); return product!.variants.find(v => v.id === id)!; } let orderId4: string; let orderId5: string; it('updates stock when increasing quantity before fulfillment', async () => { const variant1 = await getVariant('T_2'); expect(variant1.stockOnHand).toBe(100); expect(variant1.stockAllocated).toBe(0); const order = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_2', quantity: 1, }, ]); orderId4 = order.id; const variant2 = await getVariant('T_2'); expect(variant2.stockOnHand).toBe(100); expect(variant2.stockAllocated).toBe(1); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, adjustOrderLines: [{ orderLineId: order.lines[0].id, quantity: 2 }], }, }); orderGuard.assertSuccess(modifyOrder); const variant3 = await getVariant('T_2'); expect(variant3.stockOnHand).toBe(100); expect(variant3.stockAllocated).toBe(2); }); it('updates stock when increasing quantity after fulfillment', async () => { const result = await adminTransitionOrderToState(orderId4, 'ArrangingAdditionalPayment'); orderGuard.assertSuccess(result); expect(result.state).toBe('ArrangingAdditionalPayment'); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId4, }, ); const { addManualPaymentToOrder } = await adminClient.query< Codegen.AddManualPaymentMutation, Codegen.AddManualPaymentMutationVariables >(ADD_MANUAL_PAYMENT, { input: { orderId: orderId4, method: 'test', transactionId: 'ABC123', metadata: { foo: 'bar', }, }, }); orderGuard.assertSuccess(addManualPaymentToOrder); await adminTransitionOrderToState(orderId4, 'PaymentSettled'); await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: order?.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })) ?? [], handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'test method' }, { name: 'trackingCode', value: 'ABC123' }, ], }, }, }); const variant1 = await getVariant('T_2'); expect(variant1.stockOnHand).toBe(98); expect(variant1.stockAllocated).toBe(0); await adminTransitionOrderToState(orderId4, 'Modifying'); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order!.id, adjustOrderLines: [{ orderLineId: order!.lines[0].id, quantity: 3 }], }, }); orderGuard.assertSuccess(modifyOrder); const variant2 = await getVariant('T_2'); expect(variant2.stockOnHand).toBe(98); expect(variant2.stockAllocated).toBe(1); const { order: order2 } = await adminClient.query< Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables >(GET_ORDER, { id: orderId4, }); }); it('updates stock when adding item before fulfillment', async () => { const variant1 = await getVariant('T_3'); expect(variant1.stockOnHand).toBe(100); expect(variant1.stockAllocated).toBe(0); const order = await createOrderAndTransitionToModifyingState([ { productVariantId: 'T_2', quantity: 1, }, ]); orderId5 = order.id; const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, addItems: [{ productVariantId: 'T_3', quantity: 1 }], }, }); orderGuard.assertSuccess(modifyOrder); const variant2 = await getVariant('T_3'); expect(variant2.stockOnHand).toBe(100); expect(variant2.stockAllocated).toBe(1); const result = await adminTransitionOrderToState(orderId5, 'ArrangingAdditionalPayment'); orderGuard.assertSuccess(result); expect(result!.state).toBe('ArrangingAdditionalPayment'); const { addManualPaymentToOrder } = await adminClient.query< Codegen.AddManualPaymentMutation, Codegen.AddManualPaymentMutationVariables >(ADD_MANUAL_PAYMENT, { input: { orderId: orderId5, method: 'test', transactionId: 'manual-extra-payment', metadata: { foo: 'bar', }, }, }); orderGuard.assertSuccess(addManualPaymentToOrder); const result2 = await adminTransitionOrderToState(orderId5, 'PaymentSettled'); orderGuard.assertSuccess(result2); const result3 = await adminTransitionOrderToState(orderId5, 'Modifying'); orderGuard.assertSuccess(result3); }); it('updates stock when removing item before fulfillment', async () => { const variant1 = await getVariant('T_3'); expect(variant1.stockOnHand).toBe(100); expect(variant1.stockAllocated).toBe(1); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId5, }, ); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: orderId5, adjustOrderLines: [ { orderLineId: order!.lines.find(l => l.productVariant.id === 'T_3')!.id, quantity: 0, }, ], refund: { paymentId: order!.payments![0].id, }, }, }); orderGuard.assertSuccess(modifyOrder); const variant2 = await getVariant('T_3'); expect(variant2.stockOnHand).toBe(100); expect(variant2.stockAllocated).toBe(0); }); it('updates stock when removing item after fulfillment', async () => { const variant1 = await getVariant('T_3'); expect(variant1.stockOnHand).toBe(100); expect(variant1.stockAllocated).toBe(0); const order = await createOrderAndCheckout([ { productVariantId: 'T_3', quantity: 1, }, ]); const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: order?.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })) ?? [], handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'test method' }, { name: 'trackingCode', value: 'ABC123' }, ], }, }, }); orderGuard.assertSuccess(addFulfillmentToOrder); const variant2 = await getVariant('T_3'); expect(variant2.stockOnHand).toBe(99); expect(variant2.stockAllocated).toBe(0); await adminTransitionOrderToState(order.id, 'Modifying'); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, adjustOrderLines: [ { orderLineId: order.lines.find(l => l.productVariant.id === 'T_3')!.id, quantity: 0, }, ], refund: { paymentId: order.payments![0].id, }, }, }); const variant3 = await getVariant('T_3'); expect(variant3.stockOnHand).toBe(100); expect(variant3.stockAllocated).toBe(0); }); }); describe('couponCode handling', () => { const CODE_50PC_OFF = '50PC'; const CODE_FREE_SHIPPING = 'FREESHIP'; let order: TestOrderWithPaymentsFragment; beforeAll(async () => { await adminClient.query< Codegen.CreatePromotionMutation, Codegen.CreatePromotionMutationVariables >(CREATE_PROMOTION, { input: { couponCode: CODE_50PC_OFF, enabled: true, conditions: [], actions: [ { code: orderPercentageDiscount.code, arguments: [{ name: 'discount', value: '50' }], }, ], translations: [{ languageCode: LanguageCode.en, name: '50% off' }], }, }); await adminClient.query< Codegen.CreatePromotionMutation, Codegen.CreatePromotionMutationVariables >(CREATE_PROMOTION, { input: { couponCode: CODE_FREE_SHIPPING, enabled: true, conditions: [], actions: [{ code: freeShipping.code, arguments: [] }], translations: [{ languageCode: LanguageCode.en, name: 'Free shipping' }], }, }); // create an order and check out await shopClient.asUserWithCredentials('trevor_donnelly96@hotmail.com', 'test'); await shopClient.query(gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: 'T_1', quantity: 1, customFields: { color: 'green', }, } as any); await shopClient.query(gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: 'T_4', quantity: 2, }); await proceedToArrangingPayment(shopClient); const result = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(result); order = result; const result2 = await adminTransitionOrderToState(order.id, 'Modifying'); orderGuard.assertSuccess(result2); expect(result2.state).toBe('Modifying'); }); it('invalid coupon code returns ErrorResult', async () => { const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, couponCodes: ['BAD_CODE'], }, }); orderGuard.assertErrorResult(modifyOrder); expect(modifyOrder.message).toBe('Coupon code "BAD_CODE" is not valid'); }); it('valid coupon code applies Promotion', async () => { const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, refund: { paymentId: order.payments![0].id, }, couponCodes: [CODE_50PC_OFF], }, }); orderGuard.assertSuccess(modifyOrder); expect(modifyOrder.subTotalWithTax).toBe(order.subTotalWithTax * 0.5); }); it('adds order.discounts', async () => { const { order: orderWithModifications } = await adminClient.query< Codegen.GetOrderWithModificationsQuery, Codegen.GetOrderWithModificationsQueryVariables >(GET_ORDER_WITH_MODIFICATIONS, { id: order.id }); expect(orderWithModifications?.discounts.length).toBe(1); expect(orderWithModifications?.discounts[0].description).toBe('50% off'); }); it('adds order.promotions', async () => { const { order: orderWithModifications } = await adminClient.query< Codegen.GetOrderWithModificationsQuery, Codegen.GetOrderWithModificationsQueryVariables >(GET_ORDER_WITH_MODIFICATIONS, { id: order.id }); expect(orderWithModifications?.promotions.length).toBe(1); expect(orderWithModifications?.promotions[0].name).toBe('50% off'); }); it('creates correct refund amount', async () => { const { order: orderWithModifications } = await adminClient.query< Codegen.GetOrderWithModificationsQuery, Codegen.GetOrderWithModificationsQueryVariables >(GET_ORDER_WITH_MODIFICATIONS, { id: order.id }); expect(orderWithModifications?.payments![0].refunds.length).toBe(1); expect(orderWithModifications!.totalWithTax).toBe( getOrderPaymentsTotalWithRefunds(orderWithModifications!), ); expect(orderWithModifications?.payments![0].refunds[0].total).toBe( order.totalWithTax - orderWithModifications!.totalWithTax, ); }); it('creates history entry for applying couponCode', async () => { const { order: history } = await adminClient.query< Codegen.GetOrderHistoryQuery, Codegen.GetOrderHistoryQueryVariables >(GET_ORDER_HISTORY, { id: order.id, options: { filter: { type: { eq: HistoryEntryType.ORDER_COUPON_APPLIED } } }, }); orderGuard.assertSuccess(history); expect(history.history.items.length).toBe(1); expect(pick(history.history.items[0]!, ['type', 'data'])).toEqual({ type: HistoryEntryType.ORDER_COUPON_APPLIED, data: { couponCode: CODE_50PC_OFF, promotionId: 'T_6' }, }); }); it('removes coupon code', async () => { const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order.id, couponCodes: [], }, }); orderGuard.assertSuccess(modifyOrder); expect(modifyOrder.subTotalWithTax).toBe(order.subTotalWithTax); }); it('removes order.discounts', async () => { const { order: orderWithModifications } = await adminClient.query< Codegen.GetOrderWithModificationsQuery, Codegen.GetOrderWithModificationsQueryVariables >(GET_ORDER_WITH_MODIFICATIONS, { id: order.id }); expect(orderWithModifications?.discounts.length).toBe(0); }); it('removes order.promotions', async () => { const { order: orderWithModifications } = await adminClient.query< Codegen.GetOrderWithModificationsQuery, Codegen.GetOrderWithModificationsQueryVariables >(GET_ORDER_WITH_MODIFICATIONS, { id: order.id }); expect(orderWithModifications?.promotions.length).toBe(0); }); it('creates history entry for removing couponCode', async () => { const { order: history } = await adminClient.query< Codegen.GetOrderHistoryQuery, Codegen.GetOrderHistoryQueryVariables >(GET_ORDER_HISTORY, { id: order.id, options: { filter: { type: { eq: HistoryEntryType.ORDER_COUPON_REMOVED } } }, }); orderGuard.assertSuccess(history); expect(history.history.items.length).toBe(1); expect(pick(history.history.items[0]!, ['type', 'data'])).toEqual({ type: HistoryEntryType.ORDER_COUPON_REMOVED, data: { couponCode: CODE_50PC_OFF }, }); }); it('correct refund for free shipping couponCode', async () => { await shopClient.query(gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: 'T_1', quantity: 1, } as any); await proceedToArrangingPayment(shopClient); const result = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(result); const order2 = result; const shippingWithTax = order2.shippingWithTax; const result2 = await adminTransitionOrderToState(order2.id, 'Modifying'); orderGuard.assertSuccess(result2); expect(result2.state).toBe('Modifying'); const { modifyOrder } = await adminClient.query< Codegen.ModifyOrderMutation, Codegen.ModifyOrderMutationVariables >(MODIFY_ORDER, { input: { dryRun: false, orderId: order2.id, refund: { paymentId: order2.payments![0].id, }, couponCodes: [CODE_FREE_SHIPPING], }, }); orderGuard.assertSuccess(modifyOrder); expect(modifyOrder.shippingWithTax).toBe(0); expect(modifyOrder.totalWithTax).toBe(getOrderPaymentsTotalWithRefunds(modifyOrder)); expect(modifyOrder.payments![0].refunds[0].total).toBe(shippingWithTax); }); }); async function adminTransitionOrderToState(id: string, state: string) { const result = await adminClient.query< Codegen.AdminTransitionMutation, Codegen.AdminTransitionMutationVariables >(ADMIN_TRANSITION_TO_STATE, { id, state, }); return result.transitionOrderToState; } async function assertOrderIsUnchanged(order: OrderWithLinesFragment) { const { order: order2 } = await adminClient.query< Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables >(GET_ORDER, { id: order.id, }); expect(order2!.totalWithTax).toBe(order.totalWithTax); expect(order2!.lines.length).toBe(order.lines.length); expect(order2!.surcharges.length).toBe(order.surcharges.length); expect(order2!.totalQuantity).toBe(order.totalQuantity); } async function createOrderAndCheckout( items: Array<AddItemToOrderMutationVariables & { customFields?: any }>, ) { await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); for (const itemInput of items) { await shopClient.query(gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), itemInput); } await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { fullName: 'name', streetLine1: '12 the street', city: 'foo', postalCode: '123456', countryCode: 'AT', }, }); await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: testShippingMethodId, }); await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment', }); const order = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(order); return order; } async function createOrderAndTransitionToModifyingState( items: Array<AddItemToOrderMutationVariables & { customFields?: any }>, ): Promise<TestOrderWithPaymentsFragment> { const order = await createOrderAndCheckout(items); await adminTransitionOrderToState(order.id, 'Modifying'); return order; } function getOrderPaymentsTotalWithRefunds(_order: OrderWithModificationsFragment) { return _order.payments?.reduce((sum, p) => sum + p.amount - summate(p?.refunds, 'total'), 0) ?? 0; } }); export const ORDER_WITH_MODIFICATION_FRAGMENT = gql` fragment OrderWithModifications on Order { id state subTotal subTotalWithTax shipping shippingWithTax total totalWithTax lines { id quantity orderPlacedQuantity linePrice linePriceWithTax unitPriceWithTax discountedLinePriceWithTax proratedLinePriceWithTax proratedUnitPriceWithTax discounts { description amountWithTax } productVariant { id name } } surcharges { id description sku price priceWithTax taxRate } payments { id transactionId state amount method metadata refunds { id state total paymentId } } modifications { id note priceChange isSettled lines { orderLineId quantity } surcharges { id } payment { id state amount method } refund { id state total paymentId } } promotions { id name couponCode } discounts { description adjustmentSource amount amountWithTax } shippingAddress { streetLine1 city postalCode province countryCode country } billingAddress { streetLine1 city postalCode province countryCode country } shippingLines { id discountedPriceWithTax shippingMethod { id name } } } `; export const GET_ORDER_WITH_MODIFICATIONS = gql` query GetOrderWithModifications($id: ID!) { order(id: $id) { ...OrderWithModifications } } ${ORDER_WITH_MODIFICATION_FRAGMENT} `; export const MODIFY_ORDER = gql` mutation ModifyOrder($input: ModifyOrderInput!) { modifyOrder(input: $input) { ...OrderWithModifications ... on ErrorResult { errorCode message } } } ${ORDER_WITH_MODIFICATION_FRAGMENT} `; export const ADD_MANUAL_PAYMENT = gql` mutation AddManualPayment($input: ManualPaymentInput!) { addManualPaymentToOrder(input: $input) { ...OrderWithModifications ... on ErrorResult { errorCode message } } } ${ORDER_WITH_MODIFICATION_FRAGMENT} `; // Note, we don't use the gql tag around these due to the customFields which // would cause a codegen error. const ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS = ` mutation AddItemToOrder($productVariantId: ID!, $quantity: Int!, $customFields: OrderLineCustomFieldsInput) { addItemToOrder(productVariantId: $productVariantId, quantity: $quantity, customFields: $customFields) { ...on Order { id } } } `; const GET_ORDER_WITH_CUSTOM_FIELDS = ` query GetOrderCustomFields($id: ID!) { order(id: $id) { customFields { points } lines { id, customFields { color } } } } `;
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { summate } from '@vendure/common/lib/shared-utils'; import { mergeConfig, RequestContext, ShippingLineAssignmentStrategy, ShippingLine, Order, OrderLine, manualFulfillmentHandler, defaultShippingCalculator, defaultShippingEligibilityChecker, OrderService, RequestContextService, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-config'; import { hydratingShippingEligibilityChecker } from './fixtures/test-shipping-eligibility-checkers'; import { CreateAddressInput, CreateShippingMethodDocument, LanguageCode, } from './graphql/generated-e2e-admin-types'; import * as Codegen from './graphql/generated-e2e-admin-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { GET_COUNTRY_LIST, UPDATE_COUNTRY } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER, GET_ACTIVE_ORDER, GET_AVAILABLE_COUNTRIES, GET_ELIGIBLE_SHIPPING_METHODS, REMOVE_ITEM_FROM_ORDER, SET_SHIPPING_ADDRESS, SET_SHIPPING_METHOD, } from './graphql/shop-definitions'; declare module '@vendure/core/dist/entity/custom-entity-fields' { interface CustomShippingMethodFields { minPrice: number; maxPrice: number; } } class CustomShippingLineAssignmentStrategy implements ShippingLineAssignmentStrategy { assignShippingLineToOrderLines( ctx: RequestContext, shippingLine: ShippingLine, order: Order, ): OrderLine[] | Promise<OrderLine[]> { const { minPrice, maxPrice } = shippingLine.shippingMethod.customFields; return order.lines.filter(l => l.linePriceWithTax >= minPrice && l.linePriceWithTax <= maxPrice); } } describe('Shop orders', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { customFields: { ShippingMethod: [ { name: 'minPrice', type: 'int' }, { name: 'maxPrice', type: 'int' }, ], }, shippingOptions: { shippingLineAssignmentStrategy: new CustomShippingLineAssignmentStrategy(), }, }), ); type OrderSuccessResult = | CodegenShop.UpdatedOrderFragment | CodegenShop.TestOrderFragmentFragment | CodegenShop.TestOrderWithPaymentsFragment | CodegenShop.ActiveOrderCustomerFragment; const orderResultGuard: ErrorResultGuard<OrderSuccessResult> = createErrorResultGuard( input => !!input.lines, ); let lessThan100MethodId: string; let greaterThan100MethodId: string; let orderService: OrderService; beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 3, }); await adminClient.asSuperAdmin(); orderService = server.app.get(OrderService); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('setup shipping methods', async () => { const result1 = await adminClient.query(CreateShippingMethodDocument, { input: { code: 'less-than-100', translations: [{ languageCode: LanguageCode.en, name: 'Less than 100', description: '' }], fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: defaultShippingEligibilityChecker.code, arguments: [{ name: 'orderMinimum', value: '0' }], }, calculator: { code: defaultShippingCalculator.code, arguments: [ { name: 'rate', value: '1000' }, { name: 'taxRate', value: '0' }, { name: 'includesTax', value: 'auto' }, ], }, customFields: { minPrice: 0, maxPrice: 100_00, }, }, }); const result2 = await adminClient.query(CreateShippingMethodDocument, { input: { code: 'greater-than-100', translations: [{ languageCode: LanguageCode.en, name: 'Greater than 200', description: '' }], fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: defaultShippingEligibilityChecker.code, arguments: [{ name: 'orderMinimum', value: '0' }], }, calculator: { code: defaultShippingCalculator.code, arguments: [ { name: 'rate', value: '2000' }, { name: 'taxRate', value: '0' }, { name: 'includesTax', value: 'auto' }, ], }, customFields: { minPrice: 100_00, maxPrice: 500000_00, }, }, }); expect(result1.createShippingMethod.id).toBe('T_3'); expect(result2.createShippingMethod.id).toBe('T_4'); lessThan100MethodId = result1.createShippingMethod.id; greaterThan100MethodId = result2.createShippingMethod.id; }); it('assigns shipping methods to correct order lines', async () => { await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_11', quantity: 1, }); await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { streetLine1: '12 the street', postalCode: '123456', countryCode: 'US', }, }); const { eligibleShippingMethods } = await shopClient.query<CodegenShop.GetShippingMethodsQuery>( GET_ELIGIBLE_SHIPPING_METHODS, ); expect(eligibleShippingMethods.map(m => m.id).includes(lessThan100MethodId)).toBe(true); expect(eligibleShippingMethods.map(m => m.id).includes(greaterThan100MethodId)).toBe(true); const { setOrderShippingMethod } = await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: [lessThan100MethodId, greaterThan100MethodId], }); orderResultGuard.assertSuccess(setOrderShippingMethod); const order = await getInternalOrder(setOrderShippingMethod.id); expect(order?.lines[0].shippingLine?.shippingMethod.code).toBe('greater-than-100'); expect(order?.lines[1].shippingLine?.shippingMethod.code).toBe('less-than-100'); expect(order?.shippingLines.length).toBe(2); }); it('removes shipping methods that are no longer applicable', async () => { const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); const { removeOrderLine } = await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: activeOrder!.lines[0].id, }); orderResultGuard.assertSuccess(removeOrderLine); const order = await getInternalOrder(activeOrder!.id); expect(order?.lines.length).toBe(1); expect(order?.shippingLines.length).toBe(1); expect(order?.shippingLines[0].shippingMethod.code).toBe('less-than-100'); const { activeOrder: activeOrder2 } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(activeOrder2?.shippingWithTax).toBe(summate(activeOrder2!.shippingLines, 'priceWithTax')); }); it('removes remaining shipping method when removing all items', async () => { const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); const { removeOrderLine } = await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: activeOrder!.lines[0].id, }); orderResultGuard.assertSuccess(removeOrderLine); const order = await getInternalOrder(activeOrder!.id); expect(order?.lines.length).toBe(0); const { activeOrder: activeOrder2 } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(activeOrder2?.shippingWithTax).toBe(0); }); async function getInternalOrder(externalOrderId: string): Promise<Order> { const ctx = await server.app.get(RequestContextService).create({ apiType: 'admin' }); const internalOrderId = +externalOrderId.replace('T_', ''); const order = await orderService.findOne(ctx, internalOrderId, [ 'lines', 'lines.shippingLine', 'lines.shippingLine.shippingMethod', 'shippingLines', 'shippingLines.shippingMethod', ]); return order!; } });
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { CustomOrderProcess, defaultOrderProcess, mergeConfig, OrderState, TransactionalConnection, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import path from 'path'; import { vi } from 'vitest'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { testSuccessfulPaymentMethod } from './fixtures/test-payment-methods'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { OrderFragment } from './graphql/generated-e2e-admin-types'; import { AddPaymentToOrderMutation, AddPaymentToOrderMutationVariables, ErrorCode, TestOrderFragmentFragment, TransitionToStateMutation, TransitionToStateMutationVariables, } from './graphql/generated-e2e-shop-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { ADMIN_TRANSITION_TO_STATE, GET_ORDER } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER, ADD_PAYMENT, GET_NEXT_STATES, SET_CUSTOMER, SET_SHIPPING_ADDRESS, SET_SHIPPING_METHOD, TRANSITION_TO_STATE, } from './graphql/shop-definitions'; type TestOrderState = OrderState | 'ValidatingCustomer'; const initSpy = vi.fn(); const transitionStartSpy = vi.fn(); const transitionEndSpy = vi.fn(); const transitionEndSpy2 = vi.fn(); const transitionErrorSpy = vi.fn(); describe('Order process', () => { const VALIDATION_ERROR_MESSAGE = 'Customer must have a company email address'; const customOrderProcess: CustomOrderProcess<'ValidatingCustomer' | 'PaymentProcessing'> = { init(injector) { initSpy(injector.get(TransactionalConnection).rawConnection.name); }, transitions: { AddingItems: { to: ['ValidatingCustomer'], mergeStrategy: 'replace', }, ValidatingCustomer: { to: ['ArrangingPayment', 'AddingItems'], }, ArrangingPayment: { to: ['PaymentProcessing'], }, PaymentProcessing: { to: ['PaymentAuthorized', 'PaymentSettled'], }, }, onTransitionStart(fromState, toState, data) { transitionStartSpy(fromState, toState, data); if (toState === 'ValidatingCustomer') { if (!data.order.customer) { return false; } if (!data.order.customer.emailAddress.includes('@company.com')) { return VALIDATION_ERROR_MESSAGE; } } }, onTransitionEnd(fromState, toState, data) { transitionEndSpy(fromState, toState, data); }, onTransitionError(fromState, toState, message) { transitionErrorSpy(fromState, toState, message); }, }; const customOrderProcess2: CustomOrderProcess<'ValidatingCustomer'> = { transitions: { ValidatingCustomer: { to: ['Cancelled'], }, }, onTransitionEnd(fromState, toState, data) { transitionEndSpy2(fromState, toState, data); }, }; const orderErrorGuard: ErrorResultGuard<TestOrderFragmentFragment | OrderFragment> = createErrorResultGuard(input => !!input.total); const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { orderOptions: { process: [defaultOrderProcess, customOrderProcess, customOrderProcess2] as any }, paymentOptions: { paymentMethodHandlers: [testSuccessfulPaymentMethod], }, }), ); beforeAll(async () => { await server.init({ initialData: { ...initialData, paymentMethods: [ { name: testSuccessfulPaymentMethod.code, handler: { code: testSuccessfulPaymentMethod.code, arguments: [] }, }, ], }, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); describe('Initial transition', () => { it('transitions from Created to AddingItems on creation', async () => { transitionStartSpy.mockClear(); transitionEndSpy.mockClear(); await shopClient.asAnonymousUser(); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); expect(transitionStartSpy).toHaveBeenCalledTimes(1); expect(transitionEndSpy).toHaveBeenCalledTimes(1); expect(transitionStartSpy.mock.calls[0].slice(0, 2)).toEqual(['Created', 'AddingItems']); expect(transitionEndSpy.mock.calls[0].slice(0, 2)).toEqual(['Created', 'AddingItems']); }); }); describe('CustomOrderProcess', () => { it('CustomOrderProcess is injectable', () => { expect(initSpy).toHaveBeenCalled(); expect(initSpy.mock.calls[0][0]).toBe('default'); }); it('replaced transition target', async () => { await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); const { nextOrderStates } = await shopClient.query<CodegenShop.GetNextOrderStatesQuery>( GET_NEXT_STATES, ); expect(nextOrderStates).toEqual(['ValidatingCustomer']); }); it('custom onTransitionStart handler returning false', async () => { transitionStartSpy.mockClear(); transitionEndSpy.mockClear(); const { transitionOrderToState } = await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ValidatingCustomer', }); orderErrorGuard.assertSuccess(transitionOrderToState); expect(transitionStartSpy).toHaveBeenCalledTimes(1); expect(transitionEndSpy).not.toHaveBeenCalled(); expect(transitionStartSpy.mock.calls[0].slice(0, 2)).toEqual([ 'AddingItems', 'ValidatingCustomer', ]); expect(transitionOrderToState?.state).toBe('AddingItems'); }); it('custom onTransitionStart handler returning error message', async () => { transitionStartSpy.mockClear(); transitionErrorSpy.mockClear(); await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { firstName: 'Joe', lastName: 'Test', emailAddress: 'joetest@gmail.com', }, }); const { transitionOrderToState } = await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ValidatingCustomer', }); orderErrorGuard.assertErrorResult(transitionOrderToState); expect(transitionOrderToState!.message).toBe( 'Cannot transition Order from "AddingItems" to "ValidatingCustomer"', ); expect(transitionOrderToState!.errorCode).toBe(ErrorCode.ORDER_STATE_TRANSITION_ERROR); expect(transitionOrderToState!.transitionError).toBe(VALIDATION_ERROR_MESSAGE); expect(transitionOrderToState!.fromState).toBe('AddingItems'); expect(transitionOrderToState!.toState).toBe('ValidatingCustomer'); expect(transitionStartSpy).toHaveBeenCalledTimes(1); expect(transitionErrorSpy).toHaveBeenCalledTimes(1); expect(transitionEndSpy).not.toHaveBeenCalled(); expect(transitionErrorSpy.mock.calls[0]).toEqual([ 'AddingItems', 'ValidatingCustomer', VALIDATION_ERROR_MESSAGE, ]); }); it('custom onTransitionStart handler allows transition', async () => { transitionEndSpy.mockClear(); await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { firstName: 'Joe', lastName: 'Test', emailAddress: 'joetest@company.com', }, }); const { transitionOrderToState } = await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ValidatingCustomer', }); orderErrorGuard.assertSuccess(transitionOrderToState); expect(transitionEndSpy).toHaveBeenCalledTimes(1); expect(transitionEndSpy.mock.calls[0].slice(0, 2)).toEqual(['AddingItems', 'ValidatingCustomer']); expect(transitionOrderToState?.state).toBe('ValidatingCustomer'); }); it('composes multiple CustomOrderProcesses', async () => { transitionEndSpy.mockClear(); transitionEndSpy2.mockClear(); const { nextOrderStates } = await shopClient.query<CodegenShop.GetNextOrderStatesQuery>( GET_NEXT_STATES, ); expect(nextOrderStates).toEqual(['ArrangingPayment', 'AddingItems', 'Cancelled']); await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'AddingItems', }); expect(transitionEndSpy.mock.calls[0].slice(0, 2)).toEqual(['ValidatingCustomer', 'AddingItems']); expect(transitionEndSpy2.mock.calls[0].slice(0, 2)).toEqual([ 'ValidatingCustomer', 'AddingItems', ]); }); // https://github.com/vendure-ecommerce/vendure/issues/963 it('allows addPaymentToOrder from a custom state', async () => { await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: 'T_1' }); const result0 = await shopClient.query< TransitionToStateMutation, TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ValidatingCustomer', }); orderErrorGuard.assertSuccess(result0.transitionOrderToState); const result1 = await shopClient.query< TransitionToStateMutation, TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment', }); orderErrorGuard.assertSuccess(result1.transitionOrderToState); const result2 = await shopClient.query< TransitionToStateMutation, TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'PaymentProcessing', }); orderErrorGuard.assertSuccess(result2.transitionOrderToState); expect(result2.transitionOrderToState.state).toBe('PaymentProcessing'); const { addPaymentToOrder } = await shopClient.query< AddPaymentToOrderMutation, AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: testSuccessfulPaymentMethod.code, metadata: {}, }, }); orderErrorGuard.assertSuccess(addPaymentToOrder); expect(addPaymentToOrder.state).toBe('PaymentSettled'); }); }); describe('Admin API transition constraints', () => { let order: NonNullable<TestOrderFragmentFragment>; beforeAll(async () => { await shopClient.asAnonymousUser(); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { firstName: 'Su', lastName: 'Test', emailAddress: 'sutest@company.com', }, }); await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { fullName: 'name', streetLine1: '12 the street', city: 'foo', postalCode: '123456', countryCode: 'US', phoneNumber: '4444444', }, }); await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: 'T_1' }); await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ValidatingCustomer', }); const { transitionOrderToState } = await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment', }); orderErrorGuard.assertSuccess(transitionOrderToState); order = transitionOrderToState!; }); it('cannot manually transition to PaymentAuthorized', async () => { expect(order.state).toBe('ArrangingPayment'); const { transitionOrderToState } = await adminClient.query< Codegen.AdminTransitionMutation, Codegen.AdminTransitionMutationVariables >(ADMIN_TRANSITION_TO_STATE, { id: order.id, state: 'PaymentAuthorized', }); orderErrorGuard.assertErrorResult(transitionOrderToState); expect(transitionOrderToState!.message).toBe( 'Cannot transition Order from "ArrangingPayment" to "PaymentAuthorized"', ); expect(transitionOrderToState!.transitionError).toBe( 'Cannot transition Order to the "PaymentAuthorized" state when the total is not covered by authorized Payments', ); const result = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: order.id, }, ); expect(result.order?.state).toBe('ArrangingPayment'); }); it('cannot manually transition to PaymentSettled', async () => { const { transitionOrderToState } = await adminClient.query< Codegen.AdminTransitionMutation, Codegen.AdminTransitionMutationVariables >(ADMIN_TRANSITION_TO_STATE, { id: order.id, state: 'PaymentSettled', }); orderErrorGuard.assertErrorResult(transitionOrderToState); expect(transitionOrderToState!.message).toBe( 'Cannot transition Order from "ArrangingPayment" to "PaymentSettled"', ); expect(transitionOrderToState!.transitionError).toContain( 'Cannot transition Order to the "PaymentSettled" state when the total is not covered by settled Payments', ); const result = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: order.id, }, ); expect(result.order?.state).toBe('ArrangingPayment'); }); it('cannot manually transition to Cancelled', async () => { const { addPaymentToOrder } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: testSuccessfulPaymentMethod.code, metadata: {}, }, }); orderErrorGuard.assertSuccess(addPaymentToOrder); expect(addPaymentToOrder?.state).toBe('PaymentSettled'); const { transitionOrderToState } = await adminClient.query< Codegen.AdminTransitionMutation, Codegen.AdminTransitionMutationVariables >(ADMIN_TRANSITION_TO_STATE, { id: order.id, state: 'Cancelled', }); orderErrorGuard.assertErrorResult(transitionOrderToState); expect(transitionOrderToState!.message).toBe( 'Cannot transition Order from "PaymentSettled" to "Cancelled"', ); expect(transitionOrderToState!.transitionError).toContain( 'Cannot transition Order to the "Cancelled" state unless all OrderItems are cancelled', ); const result = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: order.id, }, ); expect(result.order?.state).toBe('PaymentSettled'); }); it('cannot manually transition to PartiallyDelivered', async () => { const { transitionOrderToState } = await adminClient.query< Codegen.AdminTransitionMutation, Codegen.AdminTransitionMutationVariables >(ADMIN_TRANSITION_TO_STATE, { id: order.id, state: 'PartiallyDelivered', }); orderErrorGuard.assertErrorResult(transitionOrderToState); expect(transitionOrderToState!.message).toBe( 'Cannot transition Order from "PaymentSettled" to "PartiallyDelivered"', ); expect(transitionOrderToState!.transitionError).toContain( 'Cannot transition Order to the "PartiallyDelivered" state unless some OrderItems are delivered', ); const result = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: order.id, }, ); expect(result.order?.state).toBe('PaymentSettled'); }); it('cannot manually transition to PartiallyDelivered', async () => { const { transitionOrderToState } = await adminClient.query< Codegen.AdminTransitionMutation, Codegen.AdminTransitionMutationVariables >(ADMIN_TRANSITION_TO_STATE, { id: order.id, state: 'Delivered', }); orderErrorGuard.assertErrorResult(transitionOrderToState); expect(transitionOrderToState!.message).toBe( 'Cannot transition Order from "PaymentSettled" to "Delivered"', ); expect(transitionOrderToState!.transitionError).toContain( 'Cannot transition Order to the "Delivered" state unless all OrderItems are delivered', ); const result = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: order.id, }, ); expect(result.order?.state).toBe('PaymentSettled'); }); }); });
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { omit } from '@vendure/common/lib/omit'; import { pick } from '@vendure/common/lib/pick'; import { containsProducts, customerGroup, defaultShippingCalculator, defaultShippingEligibilityChecker, discountOnItemWithFacets, hasFacetValues, manualFulfillmentHandler, mergeConfig, minimumOrderAmount, orderPercentageDiscount, productsPercentageDiscount, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, E2E_DEFAULT_CHANNEL_TOKEN, ErrorResultGuard, } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { freeShipping } from '../src/config/promotion/actions/free-shipping-action'; import { orderFixedDiscount } from '../src/config/promotion/actions/order-fixed-discount-action'; import { testSuccessfulPaymentMethod } from './fixtures/test-payment-methods'; import { CurrencyCode, HistoryEntryType, LanguageCode } from './graphql/generated-e2e-admin-types'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { AdjustmentType, ErrorCode } from './graphql/generated-e2e-shop-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { ASSIGN_PRODUCT_TO_CHANNEL, ASSIGN_PROMOTIONS_TO_CHANNEL, CANCEL_ORDER, CREATE_CHANNEL, CREATE_CUSTOMER_GROUP, CREATE_PROMOTION, CREATE_SHIPPING_METHOD, GET_FACET_LIST, GET_PRODUCTS_WITH_VARIANT_PRICES, REMOVE_CUSTOMERS_FROM_GROUP, } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER, ADJUST_ITEM_QUANTITY, APPLY_COUPON_CODE, GET_ACTIVE_ORDER, GET_ORDER_PROMOTIONS_BY_CODE, REMOVE_COUPON_CODE, REMOVE_ITEM_FROM_ORDER, SET_CUSTOMER, SET_SHIPPING_METHOD, } from './graphql/shop-definitions'; import { addPaymentToOrder, proceedToArrangingPayment } from './utils/test-order-utils'; describe('Promotions applied to Orders', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { dbConnectionOptions: { logging: true }, paymentOptions: { paymentMethodHandlers: [testSuccessfulPaymentMethod], }, }), ); const freeOrderAction = { code: orderPercentageDiscount.code, arguments: [{ name: 'discount', value: '100' }], }; const minOrderAmountCondition = (min: number) => ({ code: minimumOrderAmount.code, arguments: [ { name: 'amount', value: min.toString() }, { name: 'taxInclusive', value: 'true' }, ], }); type OrderSuccessResult = CodegenShop.UpdatedOrderFragment | CodegenShop.TestOrderFragmentFragment; const orderResultGuard: ErrorResultGuard<OrderSuccessResult> = createErrorResultGuard( input => !!input.lines, ); let products: Codegen.GetProductsWithVariantPricesQuery['products']['items']; beforeAll(async () => { await server.init({ initialData: { ...initialData, paymentMethods: [ { name: testSuccessfulPaymentMethod.code, handler: { code: testSuccessfulPaymentMethod.code, arguments: [] }, }, ], }, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-promotions.csv'), customerCount: 2, }); await adminClient.asSuperAdmin(); await getProducts(); await createGlobalPromotions(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); describe('coupon codes', () => { const TEST_COUPON_CODE = 'TESTCOUPON'; const EXPIRED_COUPON_CODE = 'EXPIRED'; let promoFreeWithCoupon: Codegen.PromotionFragment; let promoFreeWithExpiredCoupon: Codegen.PromotionFragment; beforeAll(async () => { promoFreeWithCoupon = await createPromotion({ enabled: true, name: 'Free with test coupon', couponCode: TEST_COUPON_CODE, conditions: [], actions: [freeOrderAction], }); promoFreeWithExpiredCoupon = await createPromotion({ enabled: true, name: 'Expired coupon', endsAt: new Date(2010, 0, 0), couponCode: EXPIRED_COUPON_CODE, conditions: [], actions: [freeOrderAction], }); await shopClient.asAnonymousUser(); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); }); afterAll(async () => { await deletePromotion(promoFreeWithCoupon.id); await deletePromotion(promoFreeWithExpiredCoupon.id); }); it('applyCouponCode returns error result when code is nonexistant', async () => { const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: 'bad code', }); orderResultGuard.assertErrorResult(applyCouponCode); expect(applyCouponCode.message).toBe('Coupon code "bad code" is not valid'); expect(applyCouponCode.errorCode).toBe(ErrorCode.COUPON_CODE_INVALID_ERROR); }); it('applyCouponCode returns error when code is expired', async () => { const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: EXPIRED_COUPON_CODE, }); orderResultGuard.assertErrorResult(applyCouponCode); expect(applyCouponCode.message).toBe(`Coupon code "${EXPIRED_COUPON_CODE}" has expired`); expect(applyCouponCode.errorCode).toBe(ErrorCode.COUPON_CODE_EXPIRED_ERROR); }); it('coupon code application is case-sensitive', async () => { const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE.toLowerCase(), }); orderResultGuard.assertErrorResult(applyCouponCode); expect(applyCouponCode.message).toBe( `Coupon code "${TEST_COUPON_CODE.toLowerCase()}" is not valid`, ); expect(applyCouponCode.errorCode).toBe(ErrorCode.COUPON_CODE_INVALID_ERROR); }); it('applies a valid coupon code', async () => { const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.couponCodes).toEqual([TEST_COUPON_CODE]); expect(applyCouponCode.discounts.length).toBe(1); expect(applyCouponCode.discounts[0].description).toBe('Free with test coupon'); expect(applyCouponCode.totalWithTax).toBe(0); }); it('order history records application', async () => { const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder!.history.items.map(i => omit(i, ['id']))).toEqual([ { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'Created', to: 'AddingItems', }, }, { type: HistoryEntryType.ORDER_COUPON_APPLIED, data: { couponCode: TEST_COUPON_CODE, promotionId: 'T_3', }, }, ]); }); it('de-duplicates existing codes', async () => { const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.couponCodes).toEqual([TEST_COUPON_CODE]); }); it('removes a coupon code', async () => { const { removeCouponCode } = await shopClient.query< CodegenShop.RemoveCouponCodeMutation, CodegenShop.RemoveCouponCodeMutationVariables >(REMOVE_COUPON_CODE, { couponCode: TEST_COUPON_CODE, }); expect(removeCouponCode!.discounts.length).toBe(0); expect(removeCouponCode!.totalWithTax).toBe(6000); }); // https://github.com/vendure-ecommerce/vendure/issues/649 it('discounts array cleared after coupon code removed', async () => { const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder?.discounts).toEqual([]); }); it('order history records removal', async () => { const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder!.history.items.map(i => omit(i, ['id']))).toEqual([ { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'Created', to: 'AddingItems', }, }, { type: HistoryEntryType.ORDER_COUPON_APPLIED, data: { couponCode: TEST_COUPON_CODE, promotionId: 'T_3', }, }, { type: HistoryEntryType.ORDER_COUPON_REMOVED, data: { couponCode: TEST_COUPON_CODE, }, }, ]); }); it('does not record removal of coupon code that was not added', async () => { const { removeCouponCode } = await shopClient.query< CodegenShop.RemoveCouponCodeMutation, CodegenShop.RemoveCouponCodeMutationVariables >(REMOVE_COUPON_CODE, { couponCode: 'NOT_THERE', }); expect(removeCouponCode!.history.items.map(i => omit(i, ['id']))).toEqual([ { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'Created', to: 'AddingItems', }, }, { type: HistoryEntryType.ORDER_COUPON_APPLIED, data: { couponCode: TEST_COUPON_CODE, promotionId: 'T_3', }, }, { type: HistoryEntryType.ORDER_COUPON_REMOVED, data: { couponCode: TEST_COUPON_CODE, }, }, ]); }); describe('coupon codes in other channels', () => { const OTHER_CHANNEL_TOKEN = 'other-channel'; const OTHER_CHANNEL_COUPON_CODE = 'OTHER_CHANNEL_CODE'; beforeAll(async () => { const { createChannel } = await adminClient.query< Codegen.CreateChannelMutation, Codegen.CreateChannelMutationVariables >(CREATE_CHANNEL, { input: { code: 'other-channel', currencyCode: CurrencyCode.GBP, pricesIncludeTax: false, defaultTaxZoneId: 'T_1', defaultShippingZoneId: 'T_1', defaultLanguageCode: LanguageCode.en, token: OTHER_CHANNEL_TOKEN, }, }); await createPromotion({ enabled: true, name: 'Other Channel Promo', couponCode: OTHER_CHANNEL_COUPON_CODE, conditions: [], actions: [freeOrderAction], }); }); afterAll(() => { shopClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); }); // https://github.com/vendure-ecommerce/vendure/issues/1692 it('does not allow a couponCode from another channel', async () => { shopClient.setChannelToken(OTHER_CHANNEL_TOKEN); const { applyCouponCode } = await shopClient.query< ApplyCouponCode.Mutation, ApplyCouponCode.Variables >(APPLY_COUPON_CODE, { couponCode: OTHER_CHANNEL_COUPON_CODE, }); orderResultGuard.assertErrorResult(applyCouponCode); expect(applyCouponCode.errorCode).toEqual('COUPON_CODE_INVALID_ERROR'); }); }); }); describe('default PromotionConditions', () => { beforeEach(async () => { await shopClient.asAnonymousUser(); }); it('minimumOrderAmount', async () => { const promotion = await createPromotion({ enabled: true, name: 'Free if order total greater than 100', conditions: [minOrderAmountCondition(10000)], actions: [freeOrderAction], }); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.totalWithTax).toBe(6000); expect(addItemToOrder.discounts.length).toBe(0); const { adjustOrderLine } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: addItemToOrder.lines[0].id, quantity: 2, }); orderResultGuard.assertSuccess(adjustOrderLine); expect(adjustOrderLine.totalWithTax).toBe(0); expect(adjustOrderLine.discounts[0].description).toBe('Free if order total greater than 100'); expect(adjustOrderLine.discounts[0].amountWithTax).toBe(-12000); await deletePromotion(promotion.id); }); it('atLeastNWithFacets', async () => { const { facets } = await adminClient.query<Codegen.GetFacetListQuery>(GET_FACET_LIST); const saleFacetValue = facets.items[0].values[0]; const promotion = await createPromotion({ enabled: true, name: 'Free if order contains 2 items with Sale facet value', conditions: [ { code: hasFacetValues.code, arguments: [ { name: 'minimum', value: '2' }, { name: 'facets', value: `["${saleFacetValue.id}"]` }, ], }, ], actions: [freeOrderAction], }); const { addItemToOrder: res1 } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-sale-100').id, quantity: 1, }); orderResultGuard.assertSuccess(res1); expect(res1.totalWithTax).toBe(120); expect(res1.discounts.length).toBe(0); const { addItemToOrder: res2 } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-sale-1000').id, quantity: 1, }); orderResultGuard.assertSuccess(res2); expect(res2.totalWithTax).toBe(0); expect(res2.discounts.length).toBe(1); expect(res2.totalWithTax).toBe(0); expect(res2.discounts[0].description).toBe( 'Free if order contains 2 items with Sale facet value', ); expect(res2.discounts[0].amountWithTax).toBe(-1320); await deletePromotion(promotion.id); }); it('containsProducts', async () => { const item5000 = getVariantBySlug('item-5000')!; const item1000 = getVariantBySlug('item-1000')!; const promotion = await createPromotion({ enabled: true, name: 'Free if buying 3 or more offer products', conditions: [ { code: containsProducts.code, arguments: [ { name: 'minimum', value: '3' }, { name: 'productVariantIds', value: JSON.stringify([item5000.id, item1000.id]), }, ], }, ], actions: [freeOrderAction], }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: item5000.id, quantity: 1, }); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: item1000.id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.totalWithTax).toBe(7200); expect(addItemToOrder.discounts.length).toBe(0); const { adjustOrderLine } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: addItemToOrder.lines.find(l => l.productVariant.id === item5000.id)!.id, quantity: 2, }); orderResultGuard.assertSuccess(adjustOrderLine); expect(adjustOrderLine.total).toBe(0); expect(adjustOrderLine.discounts[0].description).toBe('Free if buying 3 or more offer products'); expect(adjustOrderLine.discounts[0].amountWithTax).toBe(-13200); await deletePromotion(promotion.id); }); it('customerGroup', async () => { const { createCustomerGroup } = await adminClient.query< Codegen.CreateCustomerGroupMutation, Codegen.CreateCustomerGroupMutationVariables >(CREATE_CUSTOMER_GROUP, { input: { name: 'Test Group', customerIds: ['T_1'] }, }); await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); const promotion = await createPromotion({ enabled: true, name: 'Free for group members', conditions: [ { code: customerGroup.code, arguments: [{ name: 'customerGroupId', value: createCustomerGroup.id }], }, ], actions: [freeOrderAction], }); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.totalWithTax).toBe(0); expect(addItemToOrder.discounts.length).toBe(1); expect(addItemToOrder.discounts[0].description).toBe('Free for group members'); expect(addItemToOrder.discounts[0].amountWithTax).toBe(-6000); await adminClient.query< Codegen.RemoveCustomersFromGroupMutation, Codegen.RemoveCustomersFromGroupMutationVariables >(REMOVE_CUSTOMERS_FROM_GROUP, { groupId: createCustomerGroup.id, customerIds: ['T_1'], }); const { adjustOrderLine } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: addItemToOrder.lines[0].id, quantity: 2, }); orderResultGuard.assertSuccess(adjustOrderLine); expect(adjustOrderLine.totalWithTax).toBe(12000); expect(adjustOrderLine.discounts.length).toBe(0); await deletePromotion(promotion.id); }); }); describe('default PromotionActions', () => { const TAX_INCLUDED_CHANNEL_TOKEN = 'tax_included_channel'; let taxIncludedChannel: Codegen.ChannelFragment; beforeAll(async () => { // Create a channel where the prices include tax, so we can ensure // that PromotionActions are working as expected when taxes are included const { createChannel } = await adminClient.query< Codegen.CreateChannelMutation, Codegen.CreateChannelMutationVariables >(CREATE_CHANNEL, { input: { code: 'tax-included-channel', currencyCode: CurrencyCode.GBP, pricesIncludeTax: true, defaultTaxZoneId: 'T_1', defaultShippingZoneId: 'T_1', defaultLanguageCode: LanguageCode.en, token: TAX_INCLUDED_CHANNEL_TOKEN, }, }); taxIncludedChannel = createChannel as Codegen.ChannelFragment; await adminClient.query< Codegen.AssignProductsToChannelMutation, Codegen.AssignProductsToChannelMutationVariables >(ASSIGN_PRODUCT_TO_CHANNEL, { input: { channelId: taxIncludedChannel.id, priceFactor: 1, productIds: products.map(p => p.id), }, }); }); beforeEach(async () => { await shopClient.asAnonymousUser(); }); async function assignPromotionToTaxIncludedChannel(promotionId: string | string[]) { await adminClient.query< Codegen.AssignPromotionToChannelMutation, Codegen.AssignPromotionToChannelMutationVariables >(ASSIGN_PROMOTIONS_TO_CHANNEL, { input: { promotionIds: Array.isArray(promotionId) ? promotionId : [promotionId], channelId: taxIncludedChannel.id, }, }); } describe('orderPercentageDiscount', () => { const couponCode = '50%_off_order'; let promotion: Codegen.PromotionFragment; beforeAll(async () => { promotion = await createPromotion({ enabled: true, name: '20% discount on order', couponCode, conditions: [], actions: [ { code: orderPercentageDiscount.code, arguments: [{ name: 'discount', value: '20' }], }, ], }); await assignPromotionToTaxIncludedChannel(promotion.id); }); afterAll(async () => { await deletePromotion(promotion.id); }); it('prices exclude tax', async () => { shopClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.totalWithTax).toBe(6000); expect(addItemToOrder.discounts.length).toBe(0); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.discounts.length).toBe(1); expect(applyCouponCode.discounts[0].description).toBe('20% discount on order'); expect(applyCouponCode.totalWithTax).toBe(4800); }); it('prices include tax', async () => { shopClient.setChannelToken(TAX_INCLUDED_CHANNEL_TOKEN); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.totalWithTax).toBe(6000); expect(addItemToOrder.discounts.length).toBe(0); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.discounts.length).toBe(1); expect(applyCouponCode.discounts[0].description).toBe('20% discount on order'); expect(applyCouponCode.totalWithTax).toBe(4800); }); // https://github.com/vendure-ecommerce/vendure/issues/1773 it('decimal percentage', async () => { const decimalPercentageCouponCode = 'DPCC'; await createPromotion({ enabled: true, name: '10.5% discount on order', couponCode: decimalPercentageCouponCode, conditions: [], actions: [ { code: orderPercentageDiscount.code, arguments: [{ name: 'discount', value: '10.5' }], }, ], }); shopClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { addItemToOrder } = await shopClient.query< AddItemToOrder.Mutation, AddItemToOrder.Variables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.totalWithTax).toBe(6000); expect(addItemToOrder.discounts.length).toBe(0); const { applyCouponCode } = await shopClient.query< ApplyCouponCode.Mutation, ApplyCouponCode.Variables >(APPLY_COUPON_CODE, { couponCode: decimalPercentageCouponCode, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.discounts.length).toBe(1); expect(applyCouponCode.discounts[0].description).toBe('10.5% discount on order'); expect(applyCouponCode.totalWithTax).toBe(5370); }); }); describe('orderFixedDiscount', () => { const couponCode = '10_off_order'; let promotion: Codegen.PromotionFragment; beforeAll(async () => { promotion = await createPromotion({ enabled: true, name: '$10 discount on order', couponCode, conditions: [], actions: [ { code: orderFixedDiscount.code, arguments: [{ name: 'discount', value: '1000' }], }, ], }); await assignPromotionToTaxIncludedChannel(promotion.id); }); afterAll(async () => { await deletePromotion(promotion.id); shopClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); }); it('prices exclude tax', async () => { shopClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.total).toBe(5000); expect(addItemToOrder.totalWithTax).toBe(6000); expect(addItemToOrder.discounts.length).toBe(0); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.discounts.length).toBe(1); expect(applyCouponCode.discounts[0].description).toBe('$10 discount on order'); expect(applyCouponCode.total).toBe(4000); expect(applyCouponCode.totalWithTax).toBe(4800); }); it('prices include tax', async () => { shopClient.setChannelToken(TAX_INCLUDED_CHANNEL_TOKEN); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.totalWithTax).toBe(6000); expect(addItemToOrder.discounts.length).toBe(0); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.discounts.length).toBe(1); expect(applyCouponCode.discounts[0].description).toBe('$10 discount on order'); expect(applyCouponCode.totalWithTax).toBe(5000); }); it('does not result in negative total when shipping is included', async () => { shopClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-100').id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.totalWithTax).toBe(120); expect(addItemToOrder.discounts.length).toBe(0); const { setOrderShippingMethod } = await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: 'T_1', }); orderResultGuard.assertSuccess(setOrderShippingMethod); expect(setOrderShippingMethod.totalWithTax).toBe(620); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.discounts.length).toBe(1); expect(applyCouponCode.discounts[0].description).toBe('$10 discount on order'); expect(applyCouponCode.subTotalWithTax).toBe(0); expect(applyCouponCode.totalWithTax).toBe(500); // shipping price }); }); describe('discountOnItemWithFacets', () => { const couponCode = '50%_off_sale_items'; let promotion: Codegen.PromotionFragment; function getItemSale1Line< T extends Array< | CodegenShop.UpdatedOrderFragment['lines'][number] | CodegenShop.TestOrderFragmentFragment['lines'][number] >, >(lines: T): T[number] { return lines.find(l => l.productVariant.id === getVariantBySlug('item-sale-100').id)!; } beforeAll(async () => { const { facets } = await adminClient.query<Codegen.GetFacetListQuery>(GET_FACET_LIST); const saleFacetValue = facets.items[0].values[0]; promotion = await createPromotion({ enabled: true, name: '50% off sale items', couponCode, conditions: [], actions: [ { code: discountOnItemWithFacets.code, arguments: [ { name: 'discount', value: '50' }, { name: 'facets', value: `["${saleFacetValue.id}"]` }, ], }, ], }); await assignPromotionToTaxIncludedChannel(promotion.id); }); afterAll(async () => { await deletePromotion(promotion.id); shopClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); }); it('prices exclude tax', async () => { await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-1000').id, quantity: 1, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-sale-1000').id, quantity: 1, }); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-sale-100').id, quantity: 2, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.discounts.length).toBe(0); expect(getItemSale1Line(addItemToOrder.lines).discounts.length).toBe(0); expect(addItemToOrder.total).toBe(2200); expect(addItemToOrder.totalWithTax).toBe(2640); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.total).toBe(1600); expect(applyCouponCode.totalWithTax).toBe(1920); expect(getItemSale1Line(applyCouponCode.lines).discounts.length).toBe(1); // 1x promotion const { removeCouponCode } = await shopClient.query< CodegenShop.RemoveCouponCodeMutation, CodegenShop.RemoveCouponCodeMutationVariables >(REMOVE_COUPON_CODE, { couponCode, }); expect(getItemSale1Line(removeCouponCode!.lines).discounts.length).toBe(0); expect(removeCouponCode!.total).toBe(2200); expect(removeCouponCode!.totalWithTax).toBe(2640); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(getItemSale1Line(activeOrder!.lines).discounts.length).toBe(0); expect(activeOrder!.total).toBe(2200); expect(activeOrder!.totalWithTax).toBe(2640); }); it('prices include tax', async () => { shopClient.setChannelToken(TAX_INCLUDED_CHANNEL_TOKEN); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-1000').id, quantity: 1, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-sale-1000').id, quantity: 1, }); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-sale-100').id, quantity: 2, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.discounts.length).toBe(0); expect(getItemSale1Line(addItemToOrder.lines).discounts.length).toBe(0); expect(addItemToOrder.total).toBe(2200); expect(addItemToOrder.totalWithTax).toBe(2640); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.total).toBe(1600); expect(applyCouponCode.totalWithTax).toBe(1920); expect(getItemSale1Line(applyCouponCode.lines).discounts.length).toBe(1); // 1x promotion const { removeCouponCode } = await shopClient.query< CodegenShop.RemoveCouponCodeMutation, CodegenShop.RemoveCouponCodeMutationVariables >(REMOVE_COUPON_CODE, { couponCode, }); expect(getItemSale1Line(removeCouponCode!.lines).discounts.length).toBe(0); expect(removeCouponCode!.total).toBe(2200); expect(removeCouponCode!.totalWithTax).toBe(2640); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(getItemSale1Line(activeOrder!.lines).discounts.length).toBe(0); expect(activeOrder!.total).toBe(2200); expect(activeOrder!.totalWithTax).toBe(2640); }); }); describe('productsPercentageDiscount', () => { const couponCode = '50%_off_product'; let promotion: Codegen.PromotionFragment; beforeAll(async () => { promotion = await createPromotion({ enabled: true, name: '50% off product', couponCode, conditions: [], actions: [ { code: productsPercentageDiscount.code, arguments: [ { name: 'discount', value: '50' }, { name: 'productVariantIds', value: `["${getVariantBySlug('item-5000').id}"]`, }, ], }, ], }); await assignPromotionToTaxIncludedChannel(promotion.id); }); afterAll(async () => { await deletePromotion(promotion.id); shopClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); }); it('prices exclude tax', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.discounts.length).toBe(0); expect(addItemToOrder.lines[0].discounts.length).toBe(0); expect(addItemToOrder.total).toBe(5000); expect(addItemToOrder.totalWithTax).toBe(6000); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.total).toBe(2500); expect(applyCouponCode.totalWithTax).toBe(3000); expect(applyCouponCode.lines[0].discounts.length).toBe(1); // 1x promotion }); it('prices include tax', async () => { shopClient.setChannelToken(TAX_INCLUDED_CHANNEL_TOKEN); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.discounts.length).toBe(0); expect(addItemToOrder.lines[0].discounts.length).toBe(0); expect(addItemToOrder.total).toBe(5000); expect(addItemToOrder.totalWithTax).toBe(6000); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.total).toBe(2500); expect(applyCouponCode.totalWithTax).toBe(3000); expect(applyCouponCode.lines[0].discounts.length).toBe(1); // 1x promotion }); }); describe('freeShipping', () => { const couponCode = 'FREE_SHIPPING'; let promotion: Codegen.PromotionFragment; // The test shipping method needs to be created in each Channel, since ShippingMethods // are ChannelAware async function createTestShippingMethod(channelToken: string) { adminClient.setChannelToken(channelToken); const result = await adminClient.query< Codegen.CreateShippingMethodMutation, Codegen.CreateShippingMethodMutationVariables >(CREATE_SHIPPING_METHOD, { input: { code: 'test-method', fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: defaultShippingEligibilityChecker.code, arguments: [ { name: 'orderMinimum', value: '0', }, ], }, calculator: { code: defaultShippingCalculator.code, arguments: [ { name: 'rate', value: '345' }, { name: 'includesTax', value: 'auto' }, { name: 'taxRate', value: '20' }, ], }, translations: [ { languageCode: LanguageCode.en, name: 'test method', description: '' }, ], }, }); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); return result.createShippingMethod; } beforeAll(async () => { promotion = await createPromotion({ enabled: true, name: 'Free shipping', couponCode, conditions: [], actions: [ { code: freeShipping.code, arguments: [], }, ], }); await assignPromotionToTaxIncludedChannel(promotion.id); }); afterAll(async () => { await deletePromotion(promotion.id); shopClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); }); it('prices exclude tax', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); const method = await createTestShippingMethod(E2E_DEFAULT_CHANNEL_TOKEN); const { setOrderShippingMethod } = await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: method.id, }); orderResultGuard.assertSuccess(setOrderShippingMethod); expect(setOrderShippingMethod.discounts).toEqual([]); expect(setOrderShippingMethod.shipping).toBe(345); expect(setOrderShippingMethod.shippingWithTax).toBe(414); expect(setOrderShippingMethod.total).toBe(5345); expect(setOrderShippingMethod.totalWithTax).toBe(6414); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.discounts.length).toBe(1); expect(applyCouponCode.discounts[0].description).toBe('Free shipping'); expect(applyCouponCode.shipping).toBe(0); expect(applyCouponCode.shippingWithTax).toBe(0); expect(applyCouponCode.total).toBe(5000); expect(applyCouponCode.totalWithTax).toBe(6000); }); it('prices include tax', async () => { shopClient.setChannelToken(TAX_INCLUDED_CHANNEL_TOKEN); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); const method = await createTestShippingMethod(TAX_INCLUDED_CHANNEL_TOKEN); const { setOrderShippingMethod } = await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: method.id, }); orderResultGuard.assertSuccess(setOrderShippingMethod); expect(setOrderShippingMethod.discounts).toEqual([]); expect(setOrderShippingMethod.shipping).toBe(288); expect(setOrderShippingMethod.shippingWithTax).toBe(345); expect(setOrderShippingMethod.total).toBe(5288); expect(setOrderShippingMethod.totalWithTax).toBe(6345); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.discounts.length).toBe(1); expect(applyCouponCode.discounts[0].description).toBe('Free shipping'); expect(applyCouponCode.shipping).toBe(0); expect(applyCouponCode.shippingWithTax).toBe(0); expect(applyCouponCode.total).toBe(5000); expect(applyCouponCode.totalWithTax).toBe(6000); }); // https://github.com/vendure-ecommerce/vendure/pull/1150 it('shipping discounts get correctly removed', async () => { shopClient.setChannelToken(TAX_INCLUDED_CHANNEL_TOKEN); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); const method = await createTestShippingMethod(TAX_INCLUDED_CHANNEL_TOKEN); const { setOrderShippingMethod } = await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: method.id, }); orderResultGuard.assertSuccess(setOrderShippingMethod); expect(setOrderShippingMethod.discounts).toEqual([]); expect(setOrderShippingMethod.shippingWithTax).toBe(345); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode, }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.discounts.length).toBe(1); expect(applyCouponCode.discounts[0].description).toBe('Free shipping'); expect(applyCouponCode.shippingWithTax).toBe(0); const { removeCouponCode } = await shopClient.query< CodegenShop.RemoveCouponCodeMutation, CodegenShop.RemoveCouponCodeMutationVariables >(REMOVE_COUPON_CODE, { couponCode, }); orderResultGuard.assertSuccess(removeCouponCode); expect(removeCouponCode.discounts).toEqual([]); expect(removeCouponCode.shippingWithTax).toBe(345); }); }); describe('multiple promotions simultaneously', () => { const saleItem50pcOffCoupon = 'CODE1'; const order15pcOffCoupon = 'CODE2'; let promotion1: Codegen.PromotionFragment; let promotion2: Codegen.PromotionFragment; beforeAll(async () => { const { facets } = await adminClient.query<Codegen.GetFacetListQuery>(GET_FACET_LIST); const saleFacetValue = facets.items[0].values[0]; promotion1 = await createPromotion({ enabled: true, name: 'item promo', couponCode: saleItem50pcOffCoupon, conditions: [], actions: [ { code: discountOnItemWithFacets.code, arguments: [ { name: 'discount', value: '50' }, { name: 'facets', value: `["${saleFacetValue.id}"]` }, ], }, ], }); promotion2 = await createPromotion({ enabled: true, name: 'order promo', couponCode: order15pcOffCoupon, conditions: [], actions: [ { code: orderPercentageDiscount.code, arguments: [{ name: 'discount', value: '15' }], }, ], }); await assignPromotionToTaxIncludedChannel([promotion1.id, promotion2.id]); }); afterAll(async () => { await deletePromotion(promotion1.id); await deletePromotion(promotion2.id); shopClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); }); it('prices exclude tax', async () => { await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-sale-1000').id, quantity: 2, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); // Apply the OrderItem-level promo const { applyCouponCode: apply1 } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: saleItem50pcOffCoupon, }); orderResultGuard.assertSuccess(apply1); const saleItemLine = apply1.lines.find( l => l.productVariant.id === getVariantBySlug('item-sale-1000').id, )!; expect(saleItemLine.discounts.length).toBe(1); // 1x promotion expect( saleItemLine.discounts.find(a => a.type === AdjustmentType.PROMOTION)?.description, ).toBe('item promo'); expect(apply1.discounts.length).toBe(1); expect(apply1.total).toBe(6000); expect(apply1.totalWithTax).toBe(7200); // Apply the Order-level promo const { applyCouponCode: apply2 } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: order15pcOffCoupon, }); orderResultGuard.assertSuccess(apply2); expect(apply2.discounts.map(d => d.description).sort()).toEqual([ 'item promo', 'order promo', ]); expect(apply2.total).toBe(5100); expect(apply2.totalWithTax).toBe(6120); }); it('prices include tax', async () => { shopClient.setChannelToken(TAX_INCLUDED_CHANNEL_TOKEN); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-sale-1000').id, quantity: 2, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); // Apply the OrderItem-level promo const { applyCouponCode: apply1 } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: saleItem50pcOffCoupon, }); orderResultGuard.assertSuccess(apply1); const saleItemLine = apply1.lines.find( l => l.productVariant.id === getVariantBySlug('item-sale-1000').id, )!; expect(saleItemLine.discounts.length).toBe(1); // 1x promotion expect( saleItemLine.discounts.find(a => a.type === AdjustmentType.PROMOTION)?.description, ).toBe('item promo'); expect(apply1.discounts.length).toBe(1); expect(apply1.total).toBe(6000); expect(apply1.totalWithTax).toBe(7200); // Apply the Order-level promo const { applyCouponCode: apply2 } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: order15pcOffCoupon, }); orderResultGuard.assertSuccess(apply2); expect(apply2.discounts.map(d => d.description).sort()).toEqual([ 'item promo', 'order promo', ]); expect(apply2.total).toBe(5100); expect(apply2.totalWithTax).toBe(6120); }); }); }); describe('per-customer usage limit', () => { const TEST_COUPON_CODE = 'TESTCOUPON'; const orderGuard: ErrorResultGuard<CodegenShop.TestOrderWithPaymentsFragment> = createErrorResultGuard(input => !!input.lines); let promoWithUsageLimit: Codegen.PromotionFragment; beforeAll(async () => { promoWithUsageLimit = await createPromotion({ enabled: true, name: 'Free with test coupon', couponCode: TEST_COUPON_CODE, perCustomerUsageLimit: 1, conditions: [], actions: [freeOrderAction], }); }); afterAll(async () => { await deletePromotion(promoWithUsageLimit.id); }); async function createNewActiveOrder() { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); return addItemToOrder; } describe('guest customer', () => { const GUEST_EMAIL_ADDRESS = 'guest@test.com'; let orderCode: string; function addGuestCustomerToOrder() { return shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: GUEST_EMAIL_ADDRESS, firstName: 'Guest', lastName: 'Customer', }, }); } it('allows initial usage', async () => { await shopClient.asAnonymousUser(); await createNewActiveOrder(); await addGuestCustomerToOrder(); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.totalWithTax).toBe(0); expect(applyCouponCode.couponCodes).toEqual([TEST_COUPON_CODE]); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(order); expect(order.state).toBe('PaymentSettled'); expect(order.active).toBe(false); orderCode = order.code; }); it('adds Promotions to Order once payment arranged', async () => { const { orderByCode } = await shopClient.query< CodegenShop.GetOrderPromotionsByCodeQuery, CodegenShop.GetOrderPromotionsByCodeQueryVariables >(GET_ORDER_PROMOTIONS_BY_CODE, { code: orderCode, }); expect(orderByCode!.promotions.map(pick(['name']))).toEqual([ { name: 'Free with test coupon' }, ]); }); it('returns error result when usage exceeds limit', async () => { await shopClient.asAnonymousUser(); await createNewActiveOrder(); await addGuestCustomerToOrder(); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE }); orderResultGuard.assertErrorResult(applyCouponCode); expect(applyCouponCode.message).toEqual( 'Coupon code cannot be used more than once per customer', ); }); it('removes couponCode from order when adding customer after code applied', async () => { await shopClient.asAnonymousUser(); await createNewActiveOrder(); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.totalWithTax).toBe(0); expect(applyCouponCode.couponCodes).toEqual([TEST_COUPON_CODE]); await addGuestCustomerToOrder(); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(activeOrder!.couponCodes).toEqual([]); expect(activeOrder!.totalWithTax).toBe(6000); }); it('does not remove valid couponCode when setting guest customer', async () => { await shopClient.asAnonymousUser(); await createNewActiveOrder(); const { applyCouponCode } = await shopClient.query< ApplyCouponCode.Mutation, ApplyCouponCode.Variables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.totalWithTax).toBe(0); expect(applyCouponCode.couponCodes).toEqual([TEST_COUPON_CODE]); await shopClient.query<SetCustomerForOrder.Mutation, SetCustomerForOrder.Variables>( SET_CUSTOMER, { input: { emailAddress: 'new-guest@test.com', firstName: 'New Guest', lastName: 'Customer', }, }, ); const { activeOrder } = await shopClient.query<GetActiveOrder.Query>(GET_ACTIVE_ORDER); expect(activeOrder.couponCodes).toEqual([TEST_COUPON_CODE]); expect(applyCouponCode.totalWithTax).toBe(0); }); }); describe('signed-in customer', () => { function logInAsRegisteredCustomer() { return shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); } let orderId: string; it('allows initial usage', async () => { await logInAsRegisteredCustomer(); await createNewActiveOrder(); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.totalWithTax).toBe(0); expect(applyCouponCode.couponCodes).toEqual([TEST_COUPON_CODE]); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(order); orderId = order.id; expect(order.state).toBe('PaymentSettled'); expect(order.active).toBe(false); }); it('returns error result when usage exceeds limit', async () => { await logInAsRegisteredCustomer(); await createNewActiveOrder(); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE }); orderResultGuard.assertErrorResult(applyCouponCode); expect(applyCouponCode.message).toEqual( 'Coupon code cannot be used more than once per customer', ); expect(applyCouponCode.errorCode).toBe(ErrorCode.COUPON_CODE_LIMIT_ERROR); }); it('removes couponCode from order when logging in after code applied', async () => { await shopClient.asAnonymousUser(); await createNewActiveOrder(); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.couponCodes).toEqual([TEST_COUPON_CODE]); expect(applyCouponCode.totalWithTax).toBe(0); await logInAsRegisteredCustomer(); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(activeOrder!.totalWithTax).toBe(6000); expect(activeOrder!.couponCodes).toEqual([]); }); // https://github.com/vendure-ecommerce/vendure/issues/1466 it('cancelled orders do not count against usage limit', async () => { const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId, cancelShipping: true, reason: 'request', }, }); orderResultGuard.assertSuccess(cancelOrder); expect(cancelOrder.state).toBe('Cancelled'); await logInAsRegisteredCustomer(); await createNewActiveOrder(); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.totalWithTax).toBe(0); expect(applyCouponCode.couponCodes).toEqual([TEST_COUPON_CODE]); }); }); }); describe('usage limit', () => { const TEST_COUPON_CODE = 'TESTCOUPON'; const orderGuard: ErrorResultGuard<CodegenShop.TestOrderWithPaymentsFragment> = createErrorResultGuard(input => !!input.lines); let promoWithUsageLimit: Codegen.PromotionFragment; async function createNewActiveOrder() { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); return addItemToOrder; } describe('guest customer', () => { const GUEST_EMAIL_ADDRESS = 'guest@test.com'; let orderCode: string; beforeAll(async () => { promoWithUsageLimit = await createPromotion({ enabled: true, name: 'Free with test coupon', couponCode: TEST_COUPON_CODE, usageLimit: 1, conditions: [], actions: [freeOrderAction], }); }); afterAll(async () => { await deletePromotion(promoWithUsageLimit.id); }); function addGuestCustomerToOrder() { return shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: GUEST_EMAIL_ADDRESS, firstName: 'Guest', lastName: 'Customer', }, }); } it('allows initial usage', async () => { await shopClient.asAnonymousUser(); await createNewActiveOrder(); await addGuestCustomerToOrder(); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.totalWithTax).toBe(0); expect(applyCouponCode.couponCodes).toEqual([TEST_COUPON_CODE]); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(order); expect(order.state).toBe('PaymentSettled'); expect(order.active).toBe(false); orderCode = order.code; }); it('adds Promotions to Order once payment arranged', async () => { const { orderByCode } = await shopClient.query< CodegenShop.GetOrderPromotionsByCodeQuery, CodegenShop.GetOrderPromotionsByCodeQueryVariables >(GET_ORDER_PROMOTIONS_BY_CODE, { code: orderCode, }); expect(orderByCode!.promotions.map(pick(['name']))).toEqual([ { name: 'Free with test coupon' }, ]); }); it('returns error result when usage exceeds limit', async () => { await shopClient.asAnonymousUser(); await createNewActiveOrder(); await addGuestCustomerToOrder(); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE }); orderResultGuard.assertErrorResult(applyCouponCode); expect(applyCouponCode.message).toEqual( 'Coupon code cannot be used more than once per customer', ); }); }); describe('signed-in customer', () => { beforeAll(async () => { promoWithUsageLimit = await createPromotion({ enabled: true, name: 'Free with test coupon', couponCode: TEST_COUPON_CODE, usageLimit: 1, conditions: [], actions: [freeOrderAction], }); }); afterAll(async () => { await deletePromotion(promoWithUsageLimit.id); }); function logInAsRegisteredCustomer() { return shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); } let orderId: string; it('allows initial usage', async () => { await logInAsRegisteredCustomer(); await createNewActiveOrder(); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.totalWithTax).toBe(0); expect(applyCouponCode.couponCodes).toEqual([TEST_COUPON_CODE]); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(order); orderId = order.id; expect(order.state).toBe('PaymentSettled'); expect(order.active).toBe(false); }); it('returns error result when usage exceeds limit', async () => { await logInAsRegisteredCustomer(); await createNewActiveOrder(); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE }); orderResultGuard.assertErrorResult(applyCouponCode); expect(applyCouponCode.message).toEqual( 'Coupon code cannot be used more than once per customer', ); expect(applyCouponCode.errorCode).toBe(ErrorCode.COUPON_CODE_LIMIT_ERROR); }); // https://github.com/vendure-ecommerce/vendure/issues/1466 it('cancelled orders do not count against usage limit', async () => { const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId, cancelShipping: true, reason: 'request', }, }); orderResultGuard.assertSuccess(cancelOrder); expect(cancelOrder.state).toBe('Cancelled'); await logInAsRegisteredCustomer(); await createNewActiveOrder(); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: TEST_COUPON_CODE }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.totalWithTax).toBe(0); expect(applyCouponCode.couponCodes).toEqual([TEST_COUPON_CODE]); }); }); }); // https://github.com/vendure-ecommerce/vendure/issues/710 it('removes order-level discount made invalid by removing OrderLine', async () => { const promotion = await createPromotion({ enabled: true, name: 'Test Promo', conditions: [minOrderAmountCondition(10000)], actions: [ { code: orderFixedDiscount.code, arguments: [{ name: 'discount', value: '1000' }], }, ], }); await shopClient.asAnonymousUser(); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-1000').id, quantity: 8, }); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-5000').id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.discounts.length).toBe(1); expect(addItemToOrder.discounts[0].description).toBe('Test Promo'); const { activeOrder: check1 } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(check1!.discounts.length).toBe(1); expect(check1!.discounts[0].description).toBe('Test Promo'); const { removeOrderLine } = await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: addItemToOrder.lines[1].id, }); orderResultGuard.assertSuccess(removeOrderLine); expect(removeOrderLine.discounts.length).toBe(0); const { activeOrder: check2 } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(check2!.discounts.length).toBe(0); }); // https://github.com/vendure-ecommerce/vendure/issues/1492 it('correctly handles pro-ration of variants with 0 price', async () => { const couponCode = '20%_off_order'; const promotion = await createPromotion({ enabled: true, name: '20% discount on order', couponCode, conditions: [], actions: [ { code: orderPercentageDiscount.code, arguments: [{ name: 'discount', value: '20' }], }, ], }); await shopClient.asAnonymousUser(); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-100').id, quantity: 1, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: getVariantBySlug('item-0').id, quantity: 1, }); const { applyCouponCode } = await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode }); orderResultGuard.assertSuccess(applyCouponCode); expect(applyCouponCode.totalWithTax).toBe(96); }); // https://github.com/vendure-ecommerce/vendure/issues/2385 describe('prevents negative line price', () => { const TAX_INCLUDED_CHANNEL_TOKEN_2 = 'tax_included_channel_2'; const couponCode1 = '100%_off'; const couponCode2 = '100%_off'; let taxIncludedChannel: Codegen.ChannelFragment; beforeAll(async () => { // Create a channel where the prices include tax, so we can ensure // that PromotionActions are working as expected when taxes are included const { createChannel } = await adminClient.query< Codegen.CreateChannelMutation, Codegen.CreateChannelMutationVariables >(CREATE_CHANNEL, { input: { code: 'tax-included-channel-2', currencyCode: CurrencyCode.GBP, pricesIncludeTax: true, defaultTaxZoneId: 'T_1', defaultShippingZoneId: 'T_1', defaultLanguageCode: LanguageCode.en, token: TAX_INCLUDED_CHANNEL_TOKEN_2, }, }); taxIncludedChannel = createChannel as Codegen.ChannelFragment; await adminClient.query< Codegen.AssignProductsToChannelMutation, Codegen.AssignProductsToChannelMutationVariables >(ASSIGN_PRODUCT_TO_CHANNEL, { input: { channelId: taxIncludedChannel.id, priceFactor: 1, productIds: products.map(p => p.id), }, }); const item1000 = getVariantBySlug('item-1000')!; const promo100 = await createPromotion({ enabled: true, name: '100% discount ', couponCode: couponCode1, conditions: [], actions: [ { code: productsPercentageDiscount.code, arguments: [ { name: 'discount', value: '100' }, { name: 'productVariantIds', value: `["${item1000.id}"]`, }, ], }, ], }); const promo20 = await createPromotion({ enabled: true, name: '20% discount ', couponCode: couponCode2, conditions: [], actions: [ { code: productsPercentageDiscount.code, arguments: [ { name: 'discount', value: '20' }, { name: 'productVariantIds', value: `["${item1000.id}"]`, }, ], }, ], }); await adminClient.query< Codegen.AssignPromotionToChannelMutation, Codegen.AssignPromotionToChannelMutationVariables >(ASSIGN_PROMOTIONS_TO_CHANNEL, { input: { promotionIds: [promo100.id, promo20.id], channelId: taxIncludedChannel.id, }, }); }); it('prices exclude tax', async () => { await shopClient.asAnonymousUser(); const item1000 = getVariantBySlug('item-1000')!; await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: couponCode1 }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: item1000.id, quantity: 1, }); const { activeOrder: check1 } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(check1!.lines[0].discountedUnitPriceWithTax).toBe(0); expect(check1!.totalWithTax).toBe(0); await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: couponCode2 }); const { activeOrder: check2 } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(check2!.lines[0].discountedUnitPriceWithTax).toBe(0); expect(check2!.totalWithTax).toBe(0); }); it('prices include tax', async () => { shopClient.setChannelToken(TAX_INCLUDED_CHANNEL_TOKEN_2); await shopClient.asAnonymousUser(); const item1000 = getVariantBySlug('item-1000')!; await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: couponCode1 }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: item1000.id, quantity: 1, }); const { activeOrder: check1 } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(check1!.lines[0].discountedUnitPriceWithTax).toBe(0); expect(check1!.totalWithTax).toBe(0); await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: couponCode2 }); const { activeOrder: check2 } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(check2!.lines[0].discountedUnitPriceWithTax).toBe(0); expect(check2!.totalWithTax).toBe(0); }); }); async function getProducts() { const result = await adminClient.query<Codegen.GetProductsWithVariantPricesQuery>( GET_PRODUCTS_WITH_VARIANT_PRICES, { options: { take: 10, skip: 0, }, }, ); products = result.products.items; } async function createGlobalPromotions() { const { facets } = await adminClient.query<Codegen.GetFacetListQuery>(GET_FACET_LIST); const saleFacetValue = facets.items[0].values[0]; await createPromotion({ enabled: true, name: 'Promo not yet started', startsAt: new Date(2199, 0, 0), conditions: [minOrderAmountCondition(100)], actions: [freeOrderAction], }); const deletedPromotion = await createPromotion({ enabled: true, name: 'Deleted promotion', conditions: [minOrderAmountCondition(100)], actions: [freeOrderAction], }); await deletePromotion(deletedPromotion.id); } async function createPromotion( input: Omit<Codegen.CreatePromotionInput, 'translations'> & { name: string }, ): Promise<Codegen.PromotionFragment> { const correctedInput = { ...input, translations: [{ languageCode: LanguageCode.en, name: input.name }], }; delete (correctedInput as any).name; const result = await adminClient.query< Codegen.CreatePromotionMutation, Codegen.CreatePromotionMutationVariables >(CREATE_PROMOTION, { input: correctedInput, }); return result.createPromotion as Codegen.PromotionFragment; } function getVariantBySlug( slug: 'item-100' | 'item-1000' | 'item-5000' | 'item-sale-100' | 'item-sale-1000' | 'item-0', ): Codegen.GetProductsWithVariantPricesQuery['products']['items'][number]['variants'][number] { return products.find(p => p.slug === slug)!.variants[0]; } async function deletePromotion(promotionId: string) { await adminClient.query(gql` mutation DeletePromotionAdHoc1 { deletePromotion(id: "${promotionId}") { result } } `); } });
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { summate } from '@vendure/common/lib/shared-utils'; import { Channel, Injector, Order, RequestContext, TaxZoneStrategy, TransactionalConnection, Zone, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { testSuccessfulPaymentMethod } from './fixtures/test-payment-methods'; import * as Codegen from './graphql/generated-e2e-admin-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { GET_PRODUCTS_WITH_VARIANT_PRICES, UPDATE_CHANNEL, UPDATE_TAX_RATE, } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER, GET_ACTIVE_ORDER_WITH_PRICE_DATA, SET_BILLING_ADDRESS, SET_SHIPPING_ADDRESS, } from './graphql/shop-definitions'; import { sortById } from './utils/test-order-utils'; /** * Determines active tax zone based on: * * 1. billingAddress country, if set * 2. else shippingAddress country, is set * 3. else channel default tax zone. */ class TestTaxZoneStrategy implements TaxZoneStrategy { private connection: TransactionalConnection; init(injector: Injector): void | Promise<void> { this.connection = injector.get(TransactionalConnection); } async determineTaxZone( ctx: RequestContext, zones: Zone[], channel: Channel, order?: Order, ): Promise<Zone> { if (!order?.billingAddress?.countryCode && !order?.shippingAddress?.countryCode) { return channel.defaultTaxZone; } const countryCode = order?.billingAddress?.countryCode || order?.shippingAddress?.countryCode; const zoneForCountryCode = await this.getZoneForCountryCode(ctx, countryCode); return zoneForCountryCode ?? channel.defaultTaxZone; } private getZoneForCountryCode(ctx: RequestContext, countryCode?: string): Promise<Zone | null> { return this.connection .getRepository(ctx, Zone) .createQueryBuilder('zone') .leftJoin('zone.members', 'country') .where('country.code = :countryCode', { countryCode, }) .getOne(); } } describe('Order taxes', () => { const { server, adminClient, shopClient } = createTestEnvironment({ ...testConfig(), taxOptions: { taxZoneStrategy: new TestTaxZoneStrategy(), }, paymentOptions: { paymentMethodHandlers: [testSuccessfulPaymentMethod], }, }); type OrderSuccessResult = CodegenShop.UpdatedOrderFragment | CodegenShop.TestOrderFragmentFragment; const orderResultGuard: ErrorResultGuard<OrderSuccessResult> = createErrorResultGuard( input => !!input.lines, ); let products: Codegen.GetProductsWithVariantPricesQuery['products']['items']; beforeAll(async () => { await server.init({ initialData: { ...initialData, paymentMethods: [ { name: testSuccessfulPaymentMethod.code, handler: { code: testSuccessfulPaymentMethod.code, arguments: [] }, }, ], }, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-order-taxes.csv'), customerCount: 2, }); await adminClient.asSuperAdmin(); const result = await adminClient.query<Codegen.GetProductsWithVariantPricesQuery>( GET_PRODUCTS_WITH_VARIANT_PRICES, ); products = result.products.items; }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); describe('Channel.pricesIncludeTax = false', () => { beforeAll(async () => { await adminClient.query<Codegen.UpdateChannelMutation, Codegen.UpdateChannelMutationVariables>( UPDATE_CHANNEL, { input: { id: 'T_1', pricesIncludeTax: false, }, }, ); await shopClient.asAnonymousUser(); }); it('prices are correct', async () => { const variant = products.sort(sortById)[0].variants.sort(sortById)[0]; await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variant.id, quantity: 2, }); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderWithPriceDataQuery>( GET_ACTIVE_ORDER_WITH_PRICE_DATA, ); expect(activeOrder?.totalWithTax).toBe(240); expect(activeOrder?.total).toBe(200); expect(activeOrder?.lines[0].taxRate).toBe(20); expect(activeOrder?.lines[0].linePrice).toBe(200); expect(activeOrder?.lines[0].lineTax).toBe(40); expect(activeOrder?.lines[0].linePriceWithTax).toBe(240); expect(activeOrder?.lines[0].unitPrice).toBe(100); expect(activeOrder?.lines[0].unitPriceWithTax).toBe(120); expect(activeOrder?.lines[0].taxLines).toEqual([ { description: 'Standard Tax Europe', taxRate: 20, }, ]); }); }); describe('Channel.pricesIncludeTax = true', () => { beforeAll(async () => { await adminClient.query<Codegen.UpdateChannelMutation, Codegen.UpdateChannelMutationVariables>( UPDATE_CHANNEL, { input: { id: 'T_1', pricesIncludeTax: true, }, }, ); await shopClient.asAnonymousUser(); }); it('prices are correct', async () => { const variant = products[0].variants[0]; await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variant.id, quantity: 2, }); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderWithPriceDataQuery>( GET_ACTIVE_ORDER_WITH_PRICE_DATA, ); expect(activeOrder?.totalWithTax).toBe(200); expect(activeOrder?.total).toBe(166); expect(activeOrder?.lines[0].taxRate).toBe(20); expect(activeOrder?.lines[0].linePrice).toBe(166); expect(activeOrder?.lines[0].lineTax).toBe(34); expect(activeOrder?.lines[0].linePriceWithTax).toBe(200); expect(activeOrder?.lines[0].unitPrice).toBe(83); expect(activeOrder?.lines[0].unitPriceWithTax).toBe(100); expect(activeOrder?.lines[0].taxLines).toEqual([ { description: 'Standard Tax Europe', taxRate: 20, }, ]); }); // https://github.com/vendure-ecommerce/vendure/issues/1216 it('re-calculates OrderLine prices when shippingAddress causes activeTaxZone change', async () => { const { taxRates } = await adminClient.query<Codegen.GetTaxRateListQuery>(GET_TAX_RATE_LIST); // Set the TaxRates to Asia to 0% const taxRatesAsia = taxRates.items.filter(tr => tr.name.includes('Asia')); for (const taxRate of taxRatesAsia) { await adminClient.query< Codegen.UpdateTaxRateMutation, Codegen.UpdateTaxRateMutationVariables >(UPDATE_TAX_RATE, { input: { id: taxRate.id, value: 0, }, }); } await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { countryCode: 'CN', streetLine1: '123 Lugu St', city: 'Beijing', province: 'Beijing', postalCode: '12340', }, }); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderWithPriceDataQuery>( GET_ACTIVE_ORDER_WITH_PRICE_DATA, ); expect(activeOrder?.totalWithTax).toBe(166); expect(activeOrder?.total).toBe(166); expect(activeOrder?.lines[0].taxRate).toBe(0); expect(activeOrder?.lines[0].linePrice).toBe(166); expect(activeOrder?.lines[0].lineTax).toBe(0); expect(activeOrder?.lines[0].linePriceWithTax).toBe(166); expect(activeOrder?.lines[0].unitPrice).toBe(83); expect(activeOrder?.lines[0].unitPriceWithTax).toBe(83); expect(activeOrder?.lines[0].taxLines).toEqual([ { description: 'Standard Tax Asia', taxRate: 0, }, ]); }); // https://github.com/vendure-ecommerce/vendure/issues/1216 it('re-calculates OrderLine prices when billingAddress causes activeTaxZone change', async () => { await shopClient.query< CodegenShop.SetBillingAddressMutation, CodegenShop.SetBillingAddressMutationVariables >(SET_BILLING_ADDRESS, { input: { countryCode: 'US', streetLine1: '123 Chad Street', city: 'Houston', province: 'Texas', postalCode: '12345', }, }); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderWithPriceDataQuery>( GET_ACTIVE_ORDER_WITH_PRICE_DATA, ); expect(activeOrder?.totalWithTax).toBe(200); expect(activeOrder?.total).toBe(166); expect(activeOrder?.lines[0].taxRate).toBe(20); expect(activeOrder?.lines[0].linePrice).toBe(166); expect(activeOrder?.lines[0].lineTax).toBe(34); expect(activeOrder?.lines[0].linePriceWithTax).toBe(200); expect(activeOrder?.lines[0].unitPrice).toBe(83); expect(activeOrder?.lines[0].unitPriceWithTax).toBe(100); expect(activeOrder?.lines[0].taxLines).toEqual([ { description: 'Standard Tax Americas', taxRate: 20, }, ]); }); }); it('taxSummary works', async () => { await adminClient.query<Codegen.UpdateChannelMutation, Codegen.UpdateChannelMutationVariables>( UPDATE_CHANNEL, { input: { id: 'T_1', pricesIncludeTax: false, }, }, ); await shopClient.asAnonymousUser(); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: products[0].variants[0].id, quantity: 2, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: products[1].variants[0].id, quantity: 2, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: products[2].variants[0].id, quantity: 2, }); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderWithPriceDataQuery>( GET_ACTIVE_ORDER_WITH_PRICE_DATA, ); expect(activeOrder?.taxSummary).toEqual([ { description: 'Standard Tax Europe', taxRate: 20, taxBase: 200, taxTotal: 40, }, { description: 'Reduced Tax Europe', taxRate: 10, taxBase: 200, taxTotal: 20, }, { description: 'Zero Tax Europe', taxRate: 0, taxBase: 200, taxTotal: 0, }, ]); // ensure that the summary total add up to the overall totals const taxSummaryBaseTotal = summate(activeOrder!.taxSummary, 'taxBase'); const taxSummaryTaxTotal = summate(activeOrder!.taxSummary, 'taxTotal'); expect(taxSummaryBaseTotal).toBe(activeOrder?.total); expect(taxSummaryBaseTotal + taxSummaryTaxTotal).toBe(activeOrder?.totalWithTax); }); }); export const GET_TAX_RATE_LIST = gql` query GetTaxRateList($options: TaxRateListOptions) { taxRates(options: $options) { items { id name enabled value category { id name } zone { id name } } totalItems } } `;
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { omit } from '@vendure/common/lib/omit'; import { pick } from '@vendure/common/lib/pick'; import { defaultShippingCalculator, defaultShippingEligibilityChecker, manualFulfillmentHandler, mergeConfig, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard, SimpleGraphQLClient, } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-config'; import { failsToCancelPaymentMethod, failsToSettlePaymentMethod, onCancelPaymentSpy, onTransitionSpy, partialPaymentMethod, singleStageRefundablePaymentMethod, singleStageRefundFailingPaymentMethod, twoStagePaymentMethod, } from './fixtures/test-payment-methods'; import { FULFILLMENT_FRAGMENT, PAYMENT_FRAGMENT } from './graphql/fragments'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { AddManualPaymentDocument, CanceledOrderFragment, CreateFulfillmentDocument, ErrorCode, FulfillmentFragment, GetOrderDocument, GetOrderHistoryDocument, GlobalFlag, HistoryEntryType, LanguageCode, OrderLineInput, PaymentFragment, RefundFragment, RefundOrderDocument, SettlePaymentDocument, SortOrder, StockMovementType, TransitFulfillmentDocument, } from './graphql/generated-e2e-admin-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { DeletionResult, TestOrderFragmentFragment, UpdatedOrderFragment, } from './graphql/generated-e2e-shop-types'; import { CANCEL_ORDER, CREATE_FULFILLMENT, CREATE_SHIPPING_METHOD, DELETE_PRODUCT, DELETE_SHIPPING_METHOD, GET_CUSTOMER_LIST, GET_ORDER, GET_ORDER_FULFILLMENTS, GET_ORDER_HISTORY, GET_ORDERS_LIST, GET_PRODUCT_WITH_VARIANTS, GET_STOCK_MOVEMENT, SETTLE_PAYMENT, TRANSIT_FULFILLMENT, UPDATE_PRODUCT_VARIANTS, } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER, ADD_PAYMENT, APPLY_COUPON_CODE, GET_ACTIVE_CUSTOMER_WITH_ORDERS_PRODUCT_PRICE, GET_ACTIVE_CUSTOMER_WITH_ORDERS_PRODUCT_SLUG, GET_ACTIVE_ORDER, GET_ORDER_BY_CODE_WITH_PAYMENTS, SET_SHIPPING_ADDRESS, SET_SHIPPING_METHOD, } from './graphql/shop-definitions'; import { assertThrowsWithMessage } from './utils/assert-throws-with-message'; import { addPaymentToOrder, proceedToArrangingPayment, sortById } from './utils/test-order-utils'; describe('Orders resolver', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { paymentOptions: { paymentMethodHandlers: [ twoStagePaymentMethod, failsToSettlePaymentMethod, singleStageRefundablePaymentMethod, partialPaymentMethod, singleStageRefundFailingPaymentMethod, failsToCancelPaymentMethod, ], }, }), ); let customers: Codegen.GetCustomerListQuery['customers']['items']; const password = 'test'; const orderGuard: ErrorResultGuard< TestOrderFragmentFragment | CanceledOrderFragment | UpdatedOrderFragment > = createErrorResultGuard(input => !!input.lines); const paymentGuard: ErrorResultGuard<PaymentFragment> = createErrorResultGuard(input => !!input.state); const fulfillmentGuard: ErrorResultGuard<FulfillmentFragment> = createErrorResultGuard( input => !!input.method, ); const refundGuard: ErrorResultGuard<RefundFragment> = createErrorResultGuard(input => !!input.total); beforeAll(async () => { await server.init({ initialData: { ...initialData, paymentMethods: [ { name: twoStagePaymentMethod.code, handler: { code: twoStagePaymentMethod.code, arguments: [] }, }, { name: failsToSettlePaymentMethod.code, handler: { code: failsToSettlePaymentMethod.code, arguments: [] }, }, { name: failsToCancelPaymentMethod.code, handler: { code: failsToCancelPaymentMethod.code, arguments: [] }, }, { name: singleStageRefundablePaymentMethod.code, handler: { code: singleStageRefundablePaymentMethod.code, arguments: [] }, }, { name: singleStageRefundFailingPaymentMethod.code, handler: { code: singleStageRefundFailingPaymentMethod.code, arguments: [] }, }, { name: partialPaymentMethod.code, handler: { code: partialPaymentMethod.code, arguments: [] }, }, ], }, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 3, }); await adminClient.asSuperAdmin(); // Create a couple of orders to be queried const result = await adminClient.query< Codegen.GetCustomerListQuery, Codegen.GetCustomerListQueryVariables >(GET_CUSTOMER_LIST, { options: { take: 3, }, }); customers = result.customers.items; await shopClient.asUserWithCredentials(customers[0].emailAddress, password); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_2', quantity: 1, }); await shopClient.asUserWithCredentials(customers[1].emailAddress, password); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_2', quantity: 1, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_3', quantity: 3, }); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('order history initially contains Created -> AddingItems transition', async () => { const { order } = await adminClient.query< Codegen.GetOrderHistoryQuery, Codegen.GetOrderHistoryQueryVariables >(GET_ORDER_HISTORY, { id: 'T_1' }); expect(order!.history.totalItems).toBe(1); expect(order!.history.items.map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'Created', to: 'AddingItems', }, }, ]); }); describe('querying', () => { it('orders', async () => { const result = await adminClient.query<Codegen.GetOrderListQuery>(GET_ORDERS_LIST); expect(result.orders.items.map(o => o.id).sort()).toEqual(['T_1', 'T_2']); }); it('order', async () => { const result = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: 'T_2', }, ); expect(result.order!.id).toBe('T_2'); }); it('order with calculated line properties', async () => { const result = await adminClient.query<GetOrder.Query, GetOrder.Variables>( gql` query GetOrderWithLineCalculatedProps($id: ID!) { order(id: $id) { id lines { id linePriceWithTax quantity } } } `, { id: 'T_2', }, ); expect(result.order!.lines).toEqual([ { id: 'T_3', linePriceWithTax: 167880, quantity: 1, }, { id: 'T_4', linePriceWithTax: 791640, quantity: 3, }, ]); }); it('sort by total', async () => { const result = await adminClient.query< Codegen.GetOrderListQuery, Codegen.GetOrderListQueryVariables >(GET_ORDERS_LIST, { options: { sort: { total: SortOrder.DESC, }, take: 10, }, }); expect(result.orders.items.map(o => pick(o, ['id', 'total']))).toEqual([ { id: 'T_2', total: 799600 }, { id: 'T_1', total: 269800 }, ]); }); it('sort by totalWithTax', async () => { const result = await adminClient.query< Codegen.GetOrderListQuery, Codegen.GetOrderListQueryVariables >(GET_ORDERS_LIST, { options: { sort: { totalWithTax: SortOrder.DESC, }, take: 10, }, }); expect(result.orders.items.map(o => pick(o, ['id', 'totalWithTax']))).toEqual([ { id: 'T_2', totalWithTax: 959520 }, { id: 'T_1', totalWithTax: 323760 }, ]); }); it('sort by totalQuantity', async () => { const result = await adminClient.query< Codegen.GetOrderListQuery, Codegen.GetOrderListQueryVariables >(GET_ORDERS_LIST, { options: { sort: { totalQuantity: SortOrder.DESC, }, take: 10, }, }); expect(result.orders.items.map(o => pick(o, ['id', 'totalQuantity']))).toEqual([ { id: 'T_2', totalQuantity: 4 }, { id: 'T_1', totalQuantity: 2 }, ]); }); it('sort by customerLastName', async () => { async function sortOrdersByLastName(sortOrder: SortOrder) { const { orders } = await adminClient.query< Codegen.GetOrderListQuery, Codegen.GetOrderListQueryVariables >(GET_ORDERS_LIST, { options: { sort: { customerLastName: sortOrder, }, }, }); return orders; } const result1 = await sortOrdersByLastName(SortOrder.ASC); expect(result1.totalItems).toEqual(2); expect(result1.items.map(order => order.customer?.lastName)).toEqual(['Donnelly', 'Zieme']); const result2 = await sortOrdersByLastName(SortOrder.DESC); expect(result2.totalItems).toEqual(2); expect(result2.items.map(order => order.customer?.lastName)).toEqual(['Zieme', 'Donnelly']); }); it('filter by total', async () => { const result = await adminClient.query< Codegen.GetOrderListQuery, Codegen.GetOrderListQueryVariables >(GET_ORDERS_LIST, { options: { filter: { total: { gt: 323760 }, }, take: 10, }, }); expect(result.orders.items.map(o => pick(o, ['id', 'total']))).toEqual([ { id: 'T_2', total: 799600 }, ]); }); it('filter by totalWithTax', async () => { const result = await adminClient.query< Codegen.GetOrderListQuery, Codegen.GetOrderListQueryVariables >(GET_ORDERS_LIST, { options: { filter: { totalWithTax: { gt: 323760 }, }, take: 10, }, }); expect(result.orders.items.map(o => pick(o, ['id', 'totalWithTax']))).toEqual([ { id: 'T_2', totalWithTax: 959520 }, ]); }); it('filter by totalQuantity', async () => { const result = await adminClient.query< Codegen.GetOrderListQuery, Codegen.GetOrderListQueryVariables >(GET_ORDERS_LIST, { options: { filter: { totalQuantity: { eq: 4 }, }, }, }); expect(result.orders.items.map(o => pick(o, ['id', 'totalQuantity']))).toEqual([ { id: 'T_2', totalQuantity: 4 }, ]); }); it('filter by customerLastName', async () => { const result = await adminClient.query< Codegen.GetOrderListQuery, Codegen.GetOrderListQueryVariables >(GET_ORDERS_LIST, { options: { filter: { customerLastName: { eq: customers[1].lastName, }, }, }, }); expect(result.orders.totalItems).toEqual(1); expect(result.orders.items[0].customer?.lastName).toEqual(customers[1].lastName); }); }); describe('payments', () => { let firstOrderCode: string; let firstOrderId: string; it('settlePayment fails', async () => { await shopClient.asUserWithCredentials(customers[0].emailAddress, password); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, failsToSettlePaymentMethod); orderGuard.assertSuccess(order); expect(order.state).toBe('PaymentAuthorized'); const payment = order.payments![0]; const { settlePayment } = await adminClient.query< Codegen.SettlePaymentMutation, Codegen.SettlePaymentMutationVariables >(SETTLE_PAYMENT, { id: payment.id, }); paymentGuard.assertErrorResult(settlePayment); expect(settlePayment.message).toBe('Settling the payment failed'); expect(settlePayment.errorCode).toBe(ErrorCode.SETTLE_PAYMENT_ERROR); expect((settlePayment as any).paymentErrorMessage).toBe('Something went horribly wrong'); const result = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: order.id, }, ); expect(result.order!.state).toBe('PaymentAuthorized'); expect(result.order!.payments![0].state).toBe('Cancelled'); firstOrderCode = order.code; firstOrderId = order.id; }); it('public payment metadata available in Shop API', async () => { const { orderByCode } = await shopClient.query< CodegenShop.GetOrderByCodeWithPaymentsQuery, CodegenShop.GetOrderByCodeWithPaymentsQueryVariables >(GET_ORDER_BY_CODE_WITH_PAYMENTS, { code: firstOrderCode }); expect(orderByCode?.payments?.[0].metadata).toEqual({ public: { publicCreatePaymentData: 'public', publicSettlePaymentData: 'public', }, }); }); it('public and private payment metadata available in Admin API', async () => { const { order } = await adminClient.query< Codegen.GetOrderWithPaymentsQuery, Codegen.GetOrderWithPaymentsQueryVariables >(GET_ORDER_WITH_PAYMENTS, { id: firstOrderId }); expect(order?.payments?.[0].metadata).toEqual({ privateCreatePaymentData: 'secret', privateSettlePaymentData: 'secret', public: { publicCreatePaymentData: 'public', publicSettlePaymentData: 'public', }, }); }); it('settlePayment succeeds, onStateTransitionStart called', async () => { onTransitionSpy.mockClear(); await shopClient.asUserWithCredentials(customers[1].emailAddress, password); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, twoStagePaymentMethod); orderGuard.assertSuccess(order); expect(order.state).toBe('PaymentAuthorized'); expect(onTransitionSpy).toHaveBeenCalledTimes(1); expect(onTransitionSpy.mock.calls[0][0]).toBe('Created'); expect(onTransitionSpy.mock.calls[0][1]).toBe('Authorized'); const payment = order.payments![0]; const { settlePayment } = await adminClient.query< Codegen.SettlePaymentMutation, Codegen.SettlePaymentMutationVariables >(SETTLE_PAYMENT, { id: payment.id, }); paymentGuard.assertSuccess(settlePayment); expect(settlePayment.id).toBe(payment.id); expect(settlePayment.state).toBe('Settled'); // further metadata is combined into existing object expect(settlePayment.metadata).toEqual({ moreData: 42, public: { baz: 'quux', }, }); expect(onTransitionSpy).toHaveBeenCalledTimes(2); expect(onTransitionSpy.mock.calls[1][0]).toBe('Authorized'); expect(onTransitionSpy.mock.calls[1][1]).toBe('Settled'); const result = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: order.id, }, ); expect(result.order!.state).toBe('PaymentSettled'); expect(result.order!.payments![0].state).toBe('Settled'); }); it('order history contains expected entries', async () => { const { order } = await adminClient.query< Codegen.GetOrderHistoryQuery, Codegen.GetOrderHistoryQueryVariables >(GET_ORDER_HISTORY, { id: 'T_2', options: { sort: { id: SortOrder.ASC } } }); expect(order.history.items.map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'Created', to: 'AddingItems', }, }, { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'AddingItems', to: 'ArrangingPayment', }, }, { type: HistoryEntryType.ORDER_PAYMENT_TRANSITION, data: { paymentId: 'T_2', from: 'Created', to: 'Authorized', }, }, { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'ArrangingPayment', to: 'PaymentAuthorized', }, }, { type: HistoryEntryType.ORDER_PAYMENT_TRANSITION, data: { paymentId: 'T_2', from: 'Authorized', to: 'Settled', }, }, { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'PaymentAuthorized', to: 'PaymentSettled', }, }, ]); }); it('filter by transactionId', async () => { const result = await adminClient.query< Codegen.GetOrderListQuery, Codegen.GetOrderListQueryVariables >(GET_ORDERS_LIST, { options: { filter: { transactionId: { eq: '12345-' + firstOrderCode, }, }, }, }); expect(result.orders.totalItems).toEqual(1); expect(result.orders.items[0].code).toBe(firstOrderCode); }); }); describe('fulfillment', () => { const orderId = 'T_2'; let f1Id: string; let f2Id: string; let f3Id: string; it('return error result if lines is empty', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); expect(order!.state).toBe('PaymentSettled'); const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: [], handler: { code: manualFulfillmentHandler.code, arguments: [{ name: 'method', value: 'Test' }], }, }, }); fulfillmentGuard.assertErrorResult(addFulfillmentToOrder); expect(addFulfillmentToOrder.message).toBe('At least one OrderLine must be specified'); expect(addFulfillmentToOrder.errorCode).toBe(ErrorCode.EMPTY_ORDER_LINE_SELECTION_ERROR); }); it('returns error result if all quantities are zero', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); expect(order!.state).toBe('PaymentSettled'); const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 0 })), handler: { code: manualFulfillmentHandler.code, arguments: [{ name: 'method', value: 'Test' }], }, }, }); fulfillmentGuard.assertErrorResult(addFulfillmentToOrder); expect(addFulfillmentToOrder.message).toBe('At least one OrderLine must be specified'); expect(addFulfillmentToOrder.errorCode).toBe(ErrorCode.EMPTY_ORDER_LINE_SELECTION_ERROR); }); it('creates the first fulfillment', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); expect(order!.state).toBe('PaymentSettled'); const lines = order!.lines; const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: [{ orderLineId: lines[0].id, quantity: lines[0].quantity }], handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'Test1' }, { name: 'trackingCode', value: '111' }, ], }, }, }); fulfillmentGuard.assertSuccess(addFulfillmentToOrder); expect(addFulfillmentToOrder.id).toBe('T_1'); expect(addFulfillmentToOrder.method).toBe('Test1'); expect(addFulfillmentToOrder.trackingCode).toBe('111'); expect(addFulfillmentToOrder.state).toBe('Pending'); expect(addFulfillmentToOrder.lines).toEqual([ { orderLineId: lines[0].id, quantity: lines[0].quantity }, ]); f1Id = addFulfillmentToOrder.id; const result = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); expect(result.order!.fulfillments?.length).toBe(1); expect(result.order!.fulfillments![0]!.id).toBe(addFulfillmentToOrder.id); expect(result.order!.fulfillments![0]!.lines).toEqual([ { orderLineId: order?.lines[0].id, quantity: order?.lines[0].quantity, }, ]); expect( result.order!.fulfillments![0]!.lines.filter(l => l.orderLineId === lines[1].id).length, ).toBe(0); }); it('creates the second fulfillment', async () => { const lines = await getUnfulfilledOrderLineInput(adminClient, orderId); const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines, handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'Test2' }, { name: 'trackingCode', value: '222' }, ], }, }, }); fulfillmentGuard.assertSuccess(addFulfillmentToOrder); expect(addFulfillmentToOrder.id).toBe('T_2'); expect(addFulfillmentToOrder.method).toBe('Test2'); expect(addFulfillmentToOrder.trackingCode).toBe('222'); expect(addFulfillmentToOrder.state).toBe('Pending'); f2Id = addFulfillmentToOrder.id; }); it('cancels second fulfillment', async () => { const { transitionFulfillmentToState } = await adminClient.query< Codegen.TransitFulfillmentMutation, Codegen.TransitFulfillmentMutationVariables >(TRANSIT_FULFILLMENT, { id: f2Id, state: 'Cancelled', }); fulfillmentGuard.assertSuccess(transitionFulfillmentToState); expect(transitionFulfillmentToState.id).toBe('T_2'); expect(transitionFulfillmentToState.state).toBe('Cancelled'); }); it('order.fulfillments still lists second (cancelled) fulfillment', async () => { const { order } = await adminClient.query< Codegen.GetOrderFulfillmentsQuery, Codegen.GetOrderFulfillmentsQueryVariables >(GET_ORDER_FULFILLMENTS, { id: orderId, }); expect(order?.fulfillments?.sort(sortById).map(pick(['id', 'state']))).toEqual([ { id: f1Id, state: 'Pending' }, { id: f2Id, state: 'Cancelled' }, ]); }); it('order.fulfillments.summary', async () => { const { order } = await adminClient.query< Codegen.GetOrderFulfillmentsQuery, Codegen.GetOrderFulfillmentsQueryVariables >(GET_ORDER_FULFILLMENTS, { id: orderId, }); expect(order?.fulfillments?.sort(sortById).map(pick(['id', 'state', 'summary']))).toEqual([ { id: f1Id, state: 'Pending', summary: [{ orderLine: { id: 'T_3' }, quantity: 1 }] }, { id: f2Id, state: 'Cancelled', summary: [{ orderLine: { id: 'T_4' }, quantity: 3 }] }, ]); }); it('lines.fulfillments', async () => { const { order } = await adminClient.query< Codegen.GetOrderLineFulfillmentsQuery, Codegen.GetOrderLineFulfillmentsQueryVariables >(GET_ORDER_LINE_FULFILLMENTS, { id: orderId, }); expect(order?.lines.find(l => l.id === 'T_3')!.fulfillmentLines).toEqual([ { fulfillment: { id: f1Id, state: 'Pending' }, orderLineId: 'T_3', quantity: 1 }, ]); // Cancelled Fulfillments do not appear in the line field expect(order?.lines.find(l => l.id === 'T_4')!.fulfillmentLines).toEqual([]); }); it('creates third fulfillment with same items from second fulfillment', async () => { const lines = await getUnfulfilledOrderLineInput(adminClient, orderId); const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines, handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'Test3' }, { name: 'trackingCode', value: '333' }, ], }, }, }); fulfillmentGuard.assertSuccess(addFulfillmentToOrder); expect(addFulfillmentToOrder.id).toBe('T_3'); expect(addFulfillmentToOrder.method).toBe('Test3'); expect(addFulfillmentToOrder.trackingCode).toBe('333'); expect(addFulfillmentToOrder.state).toBe('Pending'); f3Id = addFulfillmentToOrder.id; }); it('returns error result if an OrderItem already part of a Fulfillment', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: [ { orderLineId: order!.lines[0].id, quantity: 1, }, ], handler: { code: manualFulfillmentHandler.code, arguments: [{ name: 'method', value: 'Test' }], }, }, }); fulfillmentGuard.assertErrorResult(addFulfillmentToOrder); expect(addFulfillmentToOrder.message).toBe( 'One or more OrderItems are already part of a Fulfillment', ); expect(addFulfillmentToOrder.errorCode).toBe(ErrorCode.ITEMS_ALREADY_FULFILLED_ERROR); }); it('transitions the first fulfillment from created to Shipped and automatically change the order state to PartiallyShipped', async () => { const { transitionFulfillmentToState } = await adminClient.query< Codegen.TransitFulfillmentMutation, Codegen.TransitFulfillmentMutationVariables >(TRANSIT_FULFILLMENT, { id: f1Id, state: 'Shipped', }); fulfillmentGuard.assertSuccess(transitionFulfillmentToState); expect(transitionFulfillmentToState.id).toBe(f1Id); expect(transitionFulfillmentToState.state).toBe('Shipped'); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); expect(order?.state).toBe('PartiallyShipped'); }); it('transitions the third fulfillment from created to Shipped and automatically change the order state to Shipped', async () => { const { transitionFulfillmentToState } = await adminClient.query< Codegen.TransitFulfillmentMutation, Codegen.TransitFulfillmentMutationVariables >(TRANSIT_FULFILLMENT, { id: f3Id, state: 'Shipped', }); fulfillmentGuard.assertSuccess(transitionFulfillmentToState); expect(transitionFulfillmentToState.id).toBe(f3Id); expect(transitionFulfillmentToState.state).toBe('Shipped'); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); expect(order?.state).toBe('Shipped'); }); it('transitions the first fulfillment from Shipped to Delivered and change the order state to PartiallyDelivered', async () => { const { transitionFulfillmentToState } = await adminClient.query< Codegen.TransitFulfillmentMutation, Codegen.TransitFulfillmentMutationVariables >(TRANSIT_FULFILLMENT, { id: f1Id, state: 'Delivered', }); fulfillmentGuard.assertSuccess(transitionFulfillmentToState); expect(transitionFulfillmentToState.id).toBe(f1Id); expect(transitionFulfillmentToState.state).toBe('Delivered'); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); expect(order?.state).toBe('PartiallyDelivered'); }); it('transitions the third fulfillment from Shipped to Delivered and change the order state to Delivered', async () => { const { transitionFulfillmentToState } = await adminClient.query< Codegen.TransitFulfillmentMutation, Codegen.TransitFulfillmentMutationVariables >(TRANSIT_FULFILLMENT, { id: f3Id, state: 'Delivered', }); fulfillmentGuard.assertSuccess(transitionFulfillmentToState); expect(transitionFulfillmentToState.id).toBe(f3Id); expect(transitionFulfillmentToState.state).toBe('Delivered'); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); expect(order?.state).toBe('Delivered'); }); it('order history contains expected entries', async () => { const { order } = await adminClient.query< Codegen.GetOrderHistoryQuery, Codegen.GetOrderHistoryQueryVariables >(GET_ORDER_HISTORY, { id: orderId, options: { skip: 6, }, }); expect(order!.history.items.map(pick(['type', 'data']))).toEqual([ { data: { fulfillmentId: f1Id, }, type: HistoryEntryType.ORDER_FULFILLMENT, }, { data: { from: 'Created', fulfillmentId: f1Id, to: 'Pending', }, type: HistoryEntryType.ORDER_FULFILLMENT_TRANSITION, }, { data: { fulfillmentId: f2Id, }, type: HistoryEntryType.ORDER_FULFILLMENT, }, { data: { from: 'Created', fulfillmentId: f2Id, to: 'Pending', }, type: HistoryEntryType.ORDER_FULFILLMENT_TRANSITION, }, { data: { from: 'Pending', fulfillmentId: f2Id, to: 'Cancelled', }, type: HistoryEntryType.ORDER_FULFILLMENT_TRANSITION, }, { data: { fulfillmentId: f3Id, }, type: HistoryEntryType.ORDER_FULFILLMENT, }, { data: { from: 'Created', fulfillmentId: f3Id, to: 'Pending', }, type: HistoryEntryType.ORDER_FULFILLMENT_TRANSITION, }, { data: { from: 'Pending', fulfillmentId: f1Id, to: 'Shipped', }, type: HistoryEntryType.ORDER_FULFILLMENT_TRANSITION, }, { data: { from: 'PaymentSettled', to: 'PartiallyShipped', }, type: HistoryEntryType.ORDER_STATE_TRANSITION, }, { data: { from: 'Pending', fulfillmentId: f3Id, to: 'Shipped', }, type: HistoryEntryType.ORDER_FULFILLMENT_TRANSITION, }, { data: { from: 'PartiallyShipped', to: 'Shipped', }, type: HistoryEntryType.ORDER_STATE_TRANSITION, }, { data: { from: 'Shipped', fulfillmentId: f1Id, to: 'Delivered', }, type: HistoryEntryType.ORDER_FULFILLMENT_TRANSITION, }, { data: { from: 'Shipped', to: 'PartiallyDelivered', }, type: HistoryEntryType.ORDER_STATE_TRANSITION, }, { data: { from: 'Shipped', fulfillmentId: f3Id, to: 'Delivered', }, type: HistoryEntryType.ORDER_FULFILLMENT_TRANSITION, }, { data: { from: 'PartiallyDelivered', to: 'Delivered', }, type: HistoryEntryType.ORDER_STATE_TRANSITION, }, ]); }); it('order.fulfillments resolver for single order', async () => { const { order } = await adminClient.query< Codegen.GetOrderFulfillmentsQuery, Codegen.GetOrderFulfillmentsQueryVariables >(GET_ORDER_FULFILLMENTS, { id: orderId, }); expect( order!.fulfillments?.sort(sortById).map(pick(['id', 'method', 'state', 'nextStates'])), ).toEqual([ { id: f1Id, method: 'Test1', state: 'Delivered', nextStates: ['Cancelled'] }, { id: f2Id, method: 'Test2', state: 'Cancelled', nextStates: [] }, { id: f3Id, method: 'Test3', state: 'Delivered', nextStates: ['Cancelled'] }, ]); }); it('order.fulfillments resolver for order list', async () => { const { orders } = await adminClient.query<Codegen.GetOrderListFulfillmentsQuery>( GET_ORDER_LIST_FULFILLMENTS, ); expect(orders.items[0].fulfillments).toEqual([]); expect(orders.items[1].fulfillments?.sort(sortById)).toEqual([ { id: f1Id, method: 'Test1', state: 'Delivered', nextStates: ['Cancelled'] }, { id: f2Id, method: 'Test2', state: 'Cancelled', nextStates: [] }, { id: f3Id, method: 'Test3', state: 'Delivered', nextStates: ['Cancelled'] }, ]); }); }); describe('cancellation by orderId', () => { it('cancel from AddingItems state', async () => { const testOrder = await createTestOrder( adminClient, shopClient, customers[0].emailAddress, password, ); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: testOrder.orderId, }, ); expect(order!.state).toBe('AddingItems'); const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId: testOrder.orderId, }, }); const { order: order2 } = await adminClient.query< Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables >(GET_ORDER, { id: testOrder.orderId, }); expect(order2!.state).toBe('Cancelled'); expect(order2!.active).toBe(false); await assertNoStockMovementsCreated(testOrder.product!.id); }); it('cancel from ArrangingPayment state', async () => { const testOrder = await createTestOrder( adminClient, shopClient, customers[0].emailAddress, password, ); await proceedToArrangingPayment(shopClient); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: testOrder.orderId, }, ); expect(order!.state).toBe('ArrangingPayment'); await adminClient.query<Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables>( CANCEL_ORDER, { input: { orderId: testOrder.orderId, }, }, ); const { order: order2 } = await adminClient.query< Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables >(GET_ORDER, { id: testOrder.orderId, }); expect(order2!.state).toBe('Cancelled'); expect(order2!.active).toBe(false); await assertNoStockMovementsCreated(testOrder.product!.id); }); it('cancel from PaymentAuthorized state with cancelShipping: true', async () => { const testOrder = await createTestOrder( adminClient, shopClient, customers[0].emailAddress, password, ); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, failsToSettlePaymentMethod); orderGuard.assertSuccess(order); expect(order.state).toBe('PaymentAuthorized'); const result1 = await adminClient.query< Codegen.GetStockMovementQuery, Codegen.GetStockMovementQueryVariables >(GET_STOCK_MOVEMENT, { id: 'T_3', }); let variant1 = result1.product!.variants[0]; expect(variant1.stockOnHand).toBe(100); expect(variant1.stockAllocated).toBe(2); expect(variant1.stockMovements.items.map(pick(['type', 'quantity']))).toEqual([ { type: StockMovementType.ADJUSTMENT, quantity: 100 }, { type: StockMovementType.ALLOCATION, quantity: 2 }, ]); const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId: testOrder.orderId, cancelShipping: true, }, }); orderGuard.assertSuccess(cancelOrder); expect(cancelOrder.lines.sort((a, b) => (a.id > b.id ? 1 : -1))).toEqual([ { id: 'T_7', quantity: 0 }, ]); const { order: order2 } = await adminClient.query< Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables >(GET_ORDER, { id: testOrder.orderId, }); expect(order2!.active).toBe(false); expect(order2!.state).toBe('Cancelled'); expect(order2!.totalWithTax).toBe(0); expect(order2!.shippingWithTax).toBe(0); const result2 = await adminClient.query< Codegen.GetStockMovementQuery, Codegen.GetStockMovementQueryVariables >(GET_STOCK_MOVEMENT, { id: 'T_3', }); variant1 = result2.product!.variants[0]; expect(variant1.stockOnHand).toBe(100); expect(variant1.stockAllocated).toBe(0); expect(variant1.stockMovements.items.map(pick(['type', 'quantity']))).toEqual([ { type: StockMovementType.ADJUSTMENT, quantity: 100 }, { type: StockMovementType.ALLOCATION, quantity: 2 }, { type: StockMovementType.RELEASE, quantity: 2 }, ]); }); async function assertNoStockMovementsCreated(productId: string) { const result = await adminClient.query< Codegen.GetStockMovementQuery, Codegen.GetStockMovementQueryVariables >(GET_STOCK_MOVEMENT, { id: productId, }); const variant2 = result.product!.variants[0]; expect(variant2.stockOnHand).toBe(100); expect(variant2.stockMovements.items.map(pick(['type', 'quantity']))).toEqual([ { type: StockMovementType.ADJUSTMENT, quantity: 100 }, ]); } }); describe('cancellation by OrderLine', () => { let orderId: string; let product: Codegen.GetProductWithVariantsQuery['product']; let productVariantId: string; beforeAll(async () => { const result = await createTestOrder( adminClient, shopClient, customers[0].emailAddress, password, ); orderId = result.orderId; product = result.product; productVariantId = result.productVariantId; }); it('cannot cancel from AddingItems state', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); expect(order!.state).toBe('AddingItems'); const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId, lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 1 })), }, }); orderGuard.assertErrorResult(cancelOrder); expect(cancelOrder.message).toBe( 'Cannot cancel OrderLines from an Order in the "AddingItems" state', ); expect(cancelOrder.errorCode).toBe(ErrorCode.CANCEL_ACTIVE_ORDER_ERROR); }); it('cannot cancel from ArrangingPayment state', async () => { await proceedToArrangingPayment(shopClient); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); expect(order!.state).toBe('ArrangingPayment'); const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId, lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 1 })), }, }); orderGuard.assertErrorResult(cancelOrder); expect(cancelOrder.message).toBe( 'Cannot cancel OrderLines from an Order in the "ArrangingPayment" state', ); expect(cancelOrder.errorCode).toBe(ErrorCode.CANCEL_ACTIVE_ORDER_ERROR); }); it('returns error result if lines are empty', async () => { const order = await addPaymentToOrder(shopClient, twoStagePaymentMethod); orderGuard.assertSuccess(order); expect(order.state).toBe('PaymentAuthorized'); const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId, lines: [], }, }); orderGuard.assertErrorResult(cancelOrder); expect(cancelOrder.message).toBe('At least one OrderLine must be specified'); expect(cancelOrder.errorCode).toBe(ErrorCode.EMPTY_ORDER_LINE_SELECTION_ERROR); }); it('returns error result if all quantities zero', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId, lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 0 })), }, }); orderGuard.assertErrorResult(cancelOrder); expect(cancelOrder.message).toBe('At least one OrderLine must be specified'); expect(cancelOrder.errorCode).toBe(ErrorCode.EMPTY_ORDER_LINE_SELECTION_ERROR); }); it('partial cancellation', async () => { const result1 = await adminClient.query< Codegen.GetStockMovementQuery, Codegen.GetStockMovementQueryVariables >(GET_STOCK_MOVEMENT, { id: product!.id, }); const variant1 = result1.product!.variants[0]; expect(variant1.stockOnHand).toBe(100); expect(variant1.stockAllocated).toBe(2); expect(variant1.stockMovements.items.map(pick(['type', 'quantity']))).toEqual([ { type: StockMovementType.ADJUSTMENT, quantity: 100 }, { type: StockMovementType.ALLOCATION, quantity: 2 }, { type: StockMovementType.RELEASE, quantity: 2 }, { type: StockMovementType.ALLOCATION, quantity: 2 }, ]); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId, lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 1 })), reason: 'cancel reason 1', }, }); orderGuard.assertSuccess(cancelOrder); expect(cancelOrder.lines[0].quantity).toBe(1); const { order: order2 } = await adminClient.query< Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables >(GET_ORDER, { id: orderId, }); expect(order2!.state).toBe('PaymentAuthorized'); expect(order2!.lines[0].quantity).toBe(1); const result2 = await adminClient.query< Codegen.GetStockMovementQuery, Codegen.GetStockMovementQueryVariables >(GET_STOCK_MOVEMENT, { id: product!.id, }); const variant2 = result2.product!.variants[0]; expect(variant2.stockOnHand).toBe(100); expect(variant2.stockAllocated).toBe(1); expect(variant2.stockMovements.items.map(pick(['type', 'quantity']))).toEqual([ { type: StockMovementType.ADJUSTMENT, quantity: 100 }, { type: StockMovementType.ALLOCATION, quantity: 2 }, { type: StockMovementType.RELEASE, quantity: 2 }, { type: StockMovementType.ALLOCATION, quantity: 2 }, { type: StockMovementType.RELEASE, quantity: 1 }, ]); }); it('returns error result if attempting to cancel already cancelled item', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId, lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 2 })), }, }); orderGuard.assertErrorResult(cancelOrder); expect(cancelOrder.message).toBe( 'The specified quantity is greater than the available OrderItems', ); expect(cancelOrder.errorCode).toBe(ErrorCode.QUANTITY_TOO_GREAT_ERROR); }); it('complete cancellation', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); await adminClient.query<Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables>( CANCEL_ORDER, { input: { orderId, lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 1 })), reason: 'cancel reason 2', cancelShipping: true, }, }, ); const { order: order2 } = await adminClient.query< Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables >(GET_ORDER, { id: orderId, }); expect(order2!.state).toBe('Cancelled'); expect(order2!.shippingWithTax).toBe(0); expect(order2!.totalWithTax).toBe(0); const result = await adminClient.query< Codegen.GetStockMovementQuery, Codegen.GetStockMovementQueryVariables >(GET_STOCK_MOVEMENT, { id: product!.id, }); const variant2 = result.product!.variants[0]; expect(variant2.stockOnHand).toBe(100); expect(variant2.stockAllocated).toBe(0); expect(variant2.stockMovements.items.map(pick(['type', 'quantity']))).toEqual([ { type: StockMovementType.ADJUSTMENT, quantity: 100 }, { type: StockMovementType.ALLOCATION, quantity: 2 }, { type: StockMovementType.RELEASE, quantity: 2 }, { type: StockMovementType.ALLOCATION, quantity: 2 }, { type: StockMovementType.RELEASE, quantity: 1 }, { type: StockMovementType.RELEASE, quantity: 1 }, ]); }); it('cancelled OrderLine.unitPrice is not zero', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); expect(order?.lines[0].unitPrice).not.toBe(0); }); it('order history contains expected entries', async () => { const { order } = await adminClient.query< Codegen.GetOrderHistoryQuery, Codegen.GetOrderHistoryQueryVariables >(GET_ORDER_HISTORY, { id: orderId, options: { skip: 0, }, }); expect(order!.history.items.map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'Created', to: 'AddingItems', }, }, { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'AddingItems', to: 'ArrangingPayment', }, }, { type: HistoryEntryType.ORDER_PAYMENT_TRANSITION, data: { paymentId: 'T_4', from: 'Created', to: 'Authorized', }, }, { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'ArrangingPayment', to: 'PaymentAuthorized', }, }, { type: HistoryEntryType.ORDER_CANCELLATION, data: { lines: [{ orderLineId: 'T_8', quantity: 1 }], reason: 'cancel reason 1', shippingCancelled: false, }, }, { type: HistoryEntryType.ORDER_CANCELLATION, data: { lines: [{ orderLineId: 'T_8', quantity: 1 }], reason: 'cancel reason 2', shippingCancelled: true, }, }, { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'PaymentAuthorized', to: 'Cancelled', }, }, ]); }); }); describe('refunds', () => { let orderId: string; let paymentId: string; let refundId: string; beforeAll(async () => { const result = await createTestOrder( adminClient, shopClient, customers[0].emailAddress, password, ); orderId = result.orderId; }); it('cannot refund from PaymentAuthorized state', async () => { await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, twoStagePaymentMethod); orderGuard.assertSuccess(order); expect(order.state).toBe('PaymentAuthorized'); paymentId = order.payments![0].id; const { refundOrder } = await adminClient.query< Codegen.RefundOrderMutation, Codegen.RefundOrderMutationVariables >(REFUND_ORDER, { input: { lines: order.lines.map(l => ({ orderLineId: l.id, quantity: 1 })), shipping: 0, adjustment: 0, paymentId, }, }); refundGuard.assertErrorResult(refundOrder); expect(refundOrder.message).toBe('Cannot refund an Order in the "PaymentAuthorized" state'); expect(refundOrder.errorCode).toBe(ErrorCode.REFUND_ORDER_STATE_ERROR); }); it('returns error result if no amount and no shipping', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { settlePayment } = await adminClient.query< Codegen.SettlePaymentMutation, Codegen.SettlePaymentMutationVariables >(SETTLE_PAYMENT, { id: order!.payments![0].id, }); paymentGuard.assertSuccess(settlePayment); expect(settlePayment.state).toBe('Settled'); const { refundOrder } = await adminClient.query< Codegen.RefundOrderMutation, Codegen.RefundOrderMutationVariables >(REFUND_ORDER, { input: { lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 0 })), shipping: 0, adjustment: 0, paymentId, }, }); refundGuard.assertErrorResult(refundOrder); expect(refundOrder.message).toBe('Nothing to refund'); expect(refundOrder.errorCode).toBe(ErrorCode.NOTHING_TO_REFUND_ERROR); }); it( 'throws if paymentId not valid', assertThrowsWithMessage(async () => { const { order } = await adminClient.query< Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables >(GET_ORDER, { id: orderId, }); const { refundOrder } = await adminClient.query< Codegen.RefundOrderMutation, Codegen.RefundOrderMutationVariables >(REFUND_ORDER, { input: { lines: [], shipping: 100, adjustment: 0, paymentId: 'T_999', }, }); }, 'No Payment with the id "999" could be found'), ); it('returns error result if payment and order lines do not belong to the same Order', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { refundOrder } = await adminClient.query< Codegen.RefundOrderMutation, Codegen.RefundOrderMutationVariables >(REFUND_ORDER, { input: { lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })), shipping: 100, adjustment: 0, paymentId: 'T_1', }, }); refundGuard.assertErrorResult(refundOrder); expect(refundOrder.message).toBe('The Payment and OrderLines do not belong to the same Order'); expect(refundOrder.errorCode).toBe(ErrorCode.PAYMENT_ORDER_MISMATCH_ERROR); }); it('creates a Refund to be manually settled', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { refundOrder } = await adminClient.query< Codegen.RefundOrderMutation, Codegen.RefundOrderMutationVariables >(REFUND_ORDER, { input: { lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })), shipping: order!.shipping, adjustment: 0, reason: 'foo', paymentId, }, }); refundGuard.assertSuccess(refundOrder); expect(refundOrder.shipping).toBe(order!.shipping); expect(refundOrder.items).toBe(order!.subTotalWithTax); expect(refundOrder.total).toBe(order!.totalWithTax); expect(refundOrder.transactionId).toBe(null); expect(refundOrder.state).toBe('Pending'); refundId = refundOrder.id; }); it('manually settle a Refund', async () => { const { settleRefund } = await adminClient.query< Codegen.SettleRefundMutation, Codegen.SettleRefundMutationVariables >(SETTLE_REFUND, { input: { id: refundId, transactionId: 'aaabbb', }, }); refundGuard.assertSuccess(settleRefund); expect(settleRefund.state).toBe('Settled'); expect(settleRefund.transactionId).toBe('aaabbb'); }); it('order history contains expected entries', async () => { const { order } = await adminClient.query< Codegen.GetOrderHistoryQuery, Codegen.GetOrderHistoryQueryVariables >(GET_ORDER_HISTORY, { id: orderId, options: { skip: 0, }, }); expect(order!.history.items.sort(sortById).map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'Created', to: 'AddingItems', }, }, { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'AddingItems', to: 'ArrangingPayment', }, }, { type: HistoryEntryType.ORDER_PAYMENT_TRANSITION, data: { paymentId: 'T_5', from: 'Created', to: 'Authorized', }, }, { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'ArrangingPayment', to: 'PaymentAuthorized', }, }, { type: HistoryEntryType.ORDER_PAYMENT_TRANSITION, data: { paymentId: 'T_5', from: 'Authorized', to: 'Settled', }, }, { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'PaymentAuthorized', to: 'PaymentSettled', }, }, { type: HistoryEntryType.ORDER_REFUND_TRANSITION, data: { refundId: 'T_1', reason: 'foo', from: 'Pending', to: 'Settled', }, }, ]); }); // https://github.com/vendure-ecommerce/vendure/issues/873 it('can add another refund if the first one fails', async () => { const orderResult = await createTestOrder( adminClient, shopClient, customers[0].emailAddress, password, ); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, singleStageRefundFailingPaymentMethod); orderGuard.assertSuccess(order); expect(order.state).toBe('PaymentSettled'); const { refundOrder: refund1 } = await adminClient.query< Codegen.RefundOrderMutation, Codegen.RefundOrderMutationVariables >(REFUND_ORDER, { input: { lines: order.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })), shipping: order.shipping, adjustment: 0, reason: 'foo', paymentId: order.payments![0].id, }, }); refundGuard.assertSuccess(refund1); expect(refund1.state).toBe('Failed'); expect(refund1.total).toBe(order.totalWithTax); const { refundOrder: refund2 } = await adminClient.query< Codegen.RefundOrderMutation, Codegen.RefundOrderMutationVariables >(REFUND_ORDER, { input: { lines: order.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })), shipping: order.shipping, adjustment: 0, reason: 'foo', paymentId: order.payments![0].id, }, }); refundGuard.assertSuccess(refund2); expect(refund2.state).toBe('Settled'); expect(refund2.total).toBe(order.totalWithTax); }); // https://github.com/vendure-ecommerce/vendure/issues/2302 it('passes correct amount to createRefund function after cancellation', async () => { const orderResult = await createTestOrder( adminClient, shopClient, customers[0].emailAddress, password, ); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, singleStageRefundablePaymentMethod); orderGuard.assertSuccess(order); expect(order.state).toBe('PaymentSettled'); const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId: order.id, lines: order.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })), reason: 'cancel reason 1', }, }); orderGuard.assertSuccess(cancelOrder); const { refundOrder } = await adminClient.query< Codegen.RefundOrderMutation, Codegen.RefundOrderMutationVariables >(REFUND_ORDER, { input: { lines: order.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })), shipping: order.shipping, adjustment: 0, reason: 'foo', paymentId: order.payments![0].id, }, }); refundGuard.assertSuccess(refundOrder); expect(refundOrder.state).toBe('Settled'); expect(refundOrder.total).toBe(order.totalWithTax); expect(refundOrder.metadata.amount).toBe(order.totalWithTax); }); }); describe('payment cancellation', () => { it("cancelling payment calls the method's cancelPayment handler", async () => { await createTestOrder(adminClient, shopClient, customers[0].emailAddress, password); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, twoStagePaymentMethod); orderGuard.assertSuccess(order); expect(order.state).toBe('PaymentAuthorized'); const paymentId = order.payments![0].id; expect(onCancelPaymentSpy).not.toHaveBeenCalled(); const { cancelPayment } = await adminClient.query< Codegen.CancelPaymentMutation, Codegen.CancelPaymentMutationVariables >(CANCEL_PAYMENT, { paymentId, }); paymentGuard.assertSuccess(cancelPayment); expect(cancelPayment.state).toBe('Cancelled'); expect(cancelPayment.metadata.cancellationCode).toBe('12345'); expect(onCancelPaymentSpy).toHaveBeenCalledTimes(1); }); it('cancellation failure', async () => { await createTestOrder(adminClient, shopClient, customers[0].emailAddress, password); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, failsToCancelPaymentMethod); orderGuard.assertSuccess(order); expect(order.state).toBe('PaymentAuthorized'); const paymentId = order.payments![0].id; const { cancelPayment } = await adminClient.query< Codegen.CancelPaymentMutation, Codegen.CancelPaymentMutationVariables >(CANCEL_PAYMENT, { paymentId, }); paymentGuard.assertErrorResult(cancelPayment); expect(cancelPayment.message).toBe('Cancelling the payment failed'); const { order: checkorder } = await adminClient.query< Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables >(GET_ORDER, { id: order.id, }); expect(checkorder!.payments![0].state).toBe('Authorized'); expect(checkorder!.payments![0].metadata).toEqual({ cancellationData: 'foo' }); }); }); describe('refund by amount', () => { let orderId: string; let paymentId: string; let refundId: string; beforeAll(async () => { const result = await createTestOrder( adminClient, shopClient, customers[0].emailAddress, password, ); orderId = result.orderId; await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, singleStageRefundablePaymentMethod); orderGuard.assertSuccess(order); paymentId = order.payments![0].id; }); it('return RefundAmountError if amount too large', async () => { const { refundOrder } = await adminClient.query(RefundOrderDocument, { input: { lines: [], shipping: 0, adjustment: 0, amount: 999999, paymentId, }, }); refundGuard.assertErrorResult(refundOrder); expect(refundOrder.message).toBe( 'The amount specified exceeds the refundable amount for this payment', ); expect(refundOrder.errorCode).toBe(ErrorCode.REFUND_AMOUNT_ERROR); }); it('creates a partial refund for the given amount', async () => { const { order } = await adminClient.query(GetOrderDocument, { id: orderId, }); const refundAmount = order!.totalWithTax - 500; const { refundOrder } = await adminClient.query(RefundOrderDocument, { input: { lines: [], shipping: 0, adjustment: 0, amount: refundAmount, paymentId, }, }); refundGuard.assertSuccess(refundOrder); expect(refundOrder.total).toBe(refundAmount); }); }); describe('order notes', () => { let orderId: string; let firstNoteId: string; beforeAll(async () => { const result = await createTestOrder( adminClient, shopClient, customers[2].emailAddress, password, ); orderId = result.orderId; }); it('private note', async () => { const { addNoteToOrder } = await adminClient.query< Codegen.AddNoteToOrderMutation, Codegen.AddNoteToOrderMutationVariables >(ADD_NOTE_TO_ORDER, { input: { id: orderId, note: 'A private note', isPublic: false, }, }); expect(addNoteToOrder.id).toBe(orderId); const { order } = await adminClient.query< Codegen.GetOrderHistoryQuery, Codegen.GetOrderHistoryQueryVariables >(GET_ORDER_HISTORY, { id: orderId, options: { skip: 1, }, }); expect(order!.history.items.map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.ORDER_NOTE, data: { note: 'A private note', }, }, ]); firstNoteId = order!.history.items[0].id; const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder!.history.items.map(pick(['type']))).toEqual([ { type: HistoryEntryType.ORDER_STATE_TRANSITION }, ]); }); it('public note', async () => { const { addNoteToOrder } = await adminClient.query< Codegen.AddNoteToOrderMutation, Codegen.AddNoteToOrderMutationVariables >(ADD_NOTE_TO_ORDER, { input: { id: orderId, note: 'A public note', isPublic: true, }, }); expect(addNoteToOrder.id).toBe(orderId); const { order } = await adminClient.query< Codegen.GetOrderHistoryQuery, Codegen.GetOrderHistoryQueryVariables >(GET_ORDER_HISTORY, { id: orderId, options: { skip: 2, }, }); expect(order!.history.items.map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.ORDER_NOTE, data: { note: 'A public note', }, }, ]); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder!.history.items.map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.ORDER_STATE_TRANSITION, data: { from: 'Created', to: 'AddingItems', }, }, { type: HistoryEntryType.ORDER_NOTE, data: { note: 'A public note', }, }, ]); }); it('update note', async () => { const { updateOrderNote } = await adminClient.query< Codegen.UpdateOrderNoteMutation, Codegen.UpdateOrderNoteMutationVariables >(UPDATE_ORDER_NOTE, { input: { noteId: firstNoteId, note: 'An updated note', }, }); expect(updateOrderNote.data).toEqual({ note: 'An updated note', }); }); it('delete note', async () => { const { order: before } = await adminClient.query< Codegen.GetOrderHistoryQuery, Codegen.GetOrderHistoryQueryVariables >(GET_ORDER_HISTORY, { id: orderId }); expect(before?.history.totalItems).toBe(3); const { deleteOrderNote } = await adminClient.query< Codegen.DeleteOrderNoteMutation, Codegen.DeleteOrderNoteMutationVariables >(DELETE_ORDER_NOTE, { id: firstNoteId, }); expect(deleteOrderNote.result).toBe(DeletionResult.DELETED); const { order: after } = await adminClient.query< Codegen.GetOrderHistoryQuery, Codegen.GetOrderHistoryQueryVariables >(GET_ORDER_HISTORY, { id: orderId }); expect(after?.history.totalItems).toBe(2); }); }); describe('multiple payments', () => { const PARTIAL_PAYMENT_AMOUNT = 1000; let orderId: string; let orderTotalWithTax: number; let payment1Id: string; let payment2Id: string; let productInOrder: Codegen.GetProductWithVariantsQuery['product']; beforeAll(async () => { const result = await createTestOrder( adminClient, shopClient, customers[1].emailAddress, password, ); orderId = result.orderId; productInOrder = result.product; }); it('adds a partial payment', async () => { await proceedToArrangingPayment(shopClient); const { addPaymentToOrder: order } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: partialPaymentMethod.code, metadata: { amount: PARTIAL_PAYMENT_AMOUNT, }, }, }); orderGuard.assertSuccess(order); orderTotalWithTax = order.totalWithTax; expect(order.state).toBe('ArrangingPayment'); expect(order.payments?.length).toBe(1); expect(omit(order.payments![0], ['id'])).toEqual({ amount: PARTIAL_PAYMENT_AMOUNT, metadata: { public: { amount: PARTIAL_PAYMENT_AMOUNT, }, }, method: partialPaymentMethod.code, state: 'Settled', transactionId: '12345', }); payment1Id = order.payments![0].id; }); it('adds another payment to make up order totalWithTax', async () => { const { addPaymentToOrder: order } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: singleStageRefundablePaymentMethod.code, metadata: {}, }, }); orderGuard.assertSuccess(order); expect(order.state).toBe('PaymentSettled'); expect(order.payments?.length).toBe(2); expect( omit(order.payments!.find(p => p.method === singleStageRefundablePaymentMethod.code)!, [ 'id', ]), ).toEqual({ amount: orderTotalWithTax - PARTIAL_PAYMENT_AMOUNT, metadata: {}, method: singleStageRefundablePaymentMethod.code, state: 'Settled', transactionId: '12345', }); payment2Id = order.payments![1].id; }); it('partial refunding of order with multiple payments', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { refundOrder } = await adminClient.query< Codegen.RefundOrderMutation, Codegen.RefundOrderMutationVariables >(REFUND_ORDER, { input: { lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 1 })), shipping: 0, adjustment: 0, reason: 'first refund', paymentId: payment1Id, }, }); refundGuard.assertSuccess(refundOrder); expect(refundOrder.total).toBe(PARTIAL_PAYMENT_AMOUNT); const { order: orderWithPayments } = await adminClient.query< Codegen.GetOrderWithPaymentsQuery, Codegen.GetOrderWithPaymentsQueryVariables >(GET_ORDER_WITH_PAYMENTS, { id: orderId, }); expect(orderWithPayments?.payments!.sort(sortById)[0].refunds.length).toBe(1); expect(orderWithPayments?.payments!.sort(sortById)[0].refunds[0].total).toBe( PARTIAL_PAYMENT_AMOUNT, ); expect(orderWithPayments?.payments!.sort(sortById)[1].refunds.length).toBe(1); expect(orderWithPayments?.payments!.sort(sortById)[1].refunds[0].total).toBe( productInOrder!.variants[0].priceWithTax - PARTIAL_PAYMENT_AMOUNT, ); }); it('refunding remaining amount of order with multiple payments', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); const { refundOrder } = await adminClient.query< Codegen.RefundOrderMutation, Codegen.RefundOrderMutationVariables >(REFUND_ORDER, { input: { lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: 1 })), shipping: order!.shippingWithTax, adjustment: 0, reason: 'second refund', paymentId: payment1Id, }, }); refundGuard.assertSuccess(refundOrder); expect(refundOrder.total).toBe(order!.totalWithTax - order!.lines[0].unitPriceWithTax); const { order: orderWithPayments } = await adminClient.query< Codegen.GetOrderWithPaymentsQuery, Codegen.GetOrderWithPaymentsQueryVariables >(GET_ORDER_WITH_PAYMENTS, { id: orderId, }); expect(orderWithPayments?.payments!.sort(sortById)[0].refunds.length).toBe(1); expect(orderWithPayments?.payments!.sort(sortById)[0].refunds[0].total).toBe( PARTIAL_PAYMENT_AMOUNT, ); expect(orderWithPayments?.payments!.sort(sortById)[1].refunds.length).toBe(2); expect(orderWithPayments?.payments!.sort(sortById)[1].refunds[0].total).toBe( productInOrder!.variants[0].priceWithTax - PARTIAL_PAYMENT_AMOUNT, ); expect(orderWithPayments?.payments!.sort(sortById)[1].refunds[1].total).toBe( productInOrder!.variants[0].priceWithTax + order!.shippingWithTax, ); }); // https://github.com/vendure-ecommerce/vendure/issues/847 it('manual call to settlePayment works with multiple payments', async () => { const result = await createTestOrder( adminClient, shopClient, customers[1].emailAddress, password, ); await proceedToArrangingPayment(shopClient); await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: partialPaymentMethod.code, metadata: { amount: PARTIAL_PAYMENT_AMOUNT, authorizeOnly: true, }, }, }); const { addPaymentToOrder: order } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: singleStageRefundablePaymentMethod.code, metadata: {}, }, }); orderGuard.assertSuccess(order); expect(order.state).toBe('PaymentAuthorized'); const { settlePayment } = await adminClient.query< Codegen.SettlePaymentMutation, Codegen.SettlePaymentMutationVariables >(SETTLE_PAYMENT, { id: order.payments!.find(p => p.method === partialPaymentMethod.code)!.id, }); paymentGuard.assertSuccess(settlePayment); expect(settlePayment.state).toBe('Settled'); const { order: order2 } = await adminClient.query< Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables >(GET_ORDER, { id: order.id, }); expect(order2?.state).toBe('PaymentSettled'); }); }); // https://github.com/vendure-ecommerce/vendure/issues/2505 describe('updating order customer', () => { let orderId: string; let customerId: string; it('set up order', async () => { const result = await createTestOrder( adminClient, shopClient, customers[1].emailAddress, password, ); orderId = result.orderId; customerId = customers[1].id; await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, singleStageRefundablePaymentMethod); orderGuard.assertSuccess(order); expect(order.customer?.id).toBe(customerId); }); it( 'throws in invalid orderId', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.SetOrderCustomerMutation, Codegen.SetOrderCustomerMutationVariables >(SET_ORDER_CUSTOMER, { input: { orderId: 'T_9999', customerId: customers[2].id, note: 'Testing', }, }); }, 'No Order with the id "9999" could be found'), ); it( 'throws in invalid orderId', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.SetOrderCustomerMutation, Codegen.SetOrderCustomerMutationVariables >(SET_ORDER_CUSTOMER, { input: { orderId, customerId: 'T_999', note: 'Testing', }, }); }, 'No Customer with the id "999" could be found'), ); it('update order customer', async () => { const newCustomerId = customers[2].id; const { setOrderCustomer } = await adminClient.query< Codegen.SetOrderCustomerMutation, Codegen.SetOrderCustomerMutationVariables >(SET_ORDER_CUSTOMER, { input: { orderId, customerId: customers[2].id, note: 'Testing', }, }); expect(setOrderCustomer?.customer?.id).toBe(newCustomerId); }); it('adds a history entry for the customer update', async () => { const { order } = await adminClient.query< Codegen.GetOrderHistoryQuery, Codegen.GetOrderHistoryQueryVariables >(GET_ORDER_HISTORY, { id: orderId, options: { skip: 4, }, }); expect(order!.history.items.map(pick(['type', 'data']))).toEqual([ { data: { previousCustomerId: customerId, previousCustomerName: 'Trevor Donnelly', newCustomerId: customers[2].id, newCustomerName: `${customers[2].firstName} ${customers[2].lastName}`, note: 'Testing', }, type: HistoryEntryType.ORDER_CUSTOMER_UPDATED, }, ]); }); }); describe('issues', () => { // https://github.com/vendure-ecommerce/vendure/issues/639 it('returns fulfillments for Order with no lines', async () => { await shopClient.asAnonymousUser(); // Apply a coupon code just to create an active order with no OrderLines await shopClient.query< CodegenShop.ApplyCouponCodeMutation, CodegenShop.ApplyCouponCodeMutationVariables >(APPLY_COUPON_CODE, { couponCode: 'TEST', }); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); const { order } = await adminClient.query< Codegen.GetOrderFulfillmentsQuery, Codegen.GetOrderFulfillmentsQueryVariables >(GET_ORDER_FULFILLMENTS, { id: activeOrder!.id, }); expect(order?.fulfillments).toEqual([]); }); // https://github.com/vendure-ecommerce/vendure/issues/603 it('orders correctly resolves quantities and OrderItems', async () => { await shopClient.asAnonymousUser(); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 2, }); orderGuard.assertSuccess(addItemToOrder); const { orders } = await adminClient.query< Codegen.GetOrderListWithQtyQuery, Codegen.GetOrderListWithQtyQueryVariables >(GET_ORDERS_LIST_WITH_QUANTITIES, { options: { filter: { code: { eq: addItemToOrder.code }, }, }, }); expect(orders.items[0].totalQuantity).toBe(2); expect(orders.items[0].lines[0].quantity).toBe(2); }); // https://github.com/vendure-ecommerce/vendure/issues/716 it('get an Order with a deleted ShippingMethod', async () => { const { createShippingMethod: shippingMethod } = await adminClient.query< Codegen.CreateShippingMethodMutation, Codegen.CreateShippingMethodMutationVariables >(CREATE_SHIPPING_METHOD, { input: { code: 'royal-mail', translations: [{ languageCode: LanguageCode.en, name: 'Royal Mail', description: '' }], fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: defaultShippingEligibilityChecker.code, arguments: [{ name: 'orderMinimum', value: '0' }], }, calculator: { code: defaultShippingCalculator.code, arguments: [ { name: 'rate', value: '500' }, { name: 'taxRate', value: '0' }, ], }, }, }); await shopClient.asUserWithCredentials(customers[0].emailAddress, password); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 2, }); await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { fullName: 'name', streetLine1: '12 the street', city: 'foo', postalCode: '123456', countryCode: 'US', }, }); const { setOrderShippingMethod: order } = await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: shippingMethod.id, }); orderGuard.assertSuccess(order); await adminClient.query< Codegen.DeleteShippingMethodMutation, Codegen.DeleteShippingMethodMutationVariables >(DELETE_SHIPPING_METHOD, { id: shippingMethod.id, }); const { order: order2 } = await adminClient.query< Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables >(GET_ORDER, { id: order.id, }); expect(order2?.shippingLines[0]).toEqual({ priceWithTax: 500, shippingMethod: pick(shippingMethod, ['id', 'name', 'code', 'description']), }); }); // https://github.com/vendure-ecommerce/vendure/issues/868 it('allows multiple refunds of same OrderLine', async () => { await shopClient.asUserWithCredentials(customers[0].emailAddress, password); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 2, }); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, singleStageRefundablePaymentMethod); orderGuard.assertSuccess(order); const { refundOrder: refund1 } = await adminClient.query< Codegen.RefundOrderMutation, Codegen.RefundOrderMutationVariables >(REFUND_ORDER, { input: { lines: order.lines.map(l => ({ orderLineId: l.id, quantity: 1 })), shipping: 0, adjustment: 0, reason: 'foo', paymentId: order.payments![0].id, }, }); refundGuard.assertSuccess(refund1); const { refundOrder: refund2 } = await adminClient.query< Codegen.RefundOrderMutation, Codegen.RefundOrderMutationVariables >(REFUND_ORDER, { input: { lines: order.lines.map(l => ({ orderLineId: l.id, quantity: 1 })), shipping: 0, adjustment: 0, reason: 'foo', paymentId: order.payments![0].id, }, }); refundGuard.assertSuccess(refund2); }); // https://github.com/vendure-ecommerce/vendure/issues/1125 it('resolves deleted Product of OrderLine ProductVariants', async () => { await shopClient.asUserWithCredentials(customers[0].emailAddress, password); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_7', quantity: 1, }); await proceedToArrangingPayment(shopClient); const order = await addPaymentToOrder(shopClient, singleStageRefundablePaymentMethod); orderGuard.assertSuccess(order); await adminClient.query<Codegen.DeleteProductMutation, Codegen.DeleteProductMutationVariables>( DELETE_PRODUCT, { id: 'T_3', }, ); const { activeCustomer } = await shopClient.query< CodegenShop.GetActiveCustomerWithOrdersProductSlugQuery, CodegenShop.GetActiveCustomerWithOrdersProductSlugQueryVariables >(GET_ACTIVE_CUSTOMER_WITH_ORDERS_PRODUCT_SLUG, { options: { sort: { createdAt: SortOrder.ASC, }, }, }); expect( activeCustomer!.orders.items[activeCustomer!.orders.items.length - 1].lines[0].productVariant .product.slug, ).toBe('gaming-pc'); }); // https://github.com/vendure-ecommerce/vendure/issues/1508 it('resolves price of deleted ProductVariant of OrderLine', async () => { const { activeCustomer } = await shopClient.query< CodegenShop.GetActiveCustomerWithOrdersProductPriceQuery, CodegenShop.GetActiveCustomerWithOrdersProductPriceQueryVariables >(GET_ACTIVE_CUSTOMER_WITH_ORDERS_PRODUCT_PRICE, { options: { sort: { createdAt: SortOrder.ASC, }, }, }); expect( activeCustomer!.orders.items[activeCustomer!.orders.items.length - 1].lines[0].productVariant .price, ).toBe(108720); }); // https://github.com/vendure-ecommerce/vendure/issues/2204 it('creates correct history entries and results in correct state when manually adding payment to order', async () => { await shopClient.asUserWithCredentials(customers[0].emailAddress, password); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 2, }); await proceedToArrangingPayment(shopClient); orderGuard.assertSuccess(addItemToOrder); const { addManualPaymentToOrder } = await adminClient.query(AddManualPaymentDocument, { input: { orderId: addItemToOrder.id, metadata: {}, method: twoStagePaymentMethod.code, transactionId: '12345', }, }); orderGuard.assertSuccess(addManualPaymentToOrder); const { order: orderWithHistory } = await adminClient.query(GetOrderHistoryDocument, { id: addManualPaymentToOrder.id, }); const stateTransitionHistory = orderWithHistory!.history.items .filter(i => i.type === HistoryEntryType.ORDER_STATE_TRANSITION) .map(i => i.data); expect(stateTransitionHistory).toEqual([ { from: 'Created', to: 'AddingItems' }, { from: 'AddingItems', to: 'ArrangingPayment' }, { from: 'ArrangingPayment', to: 'PaymentSettled' }, ]); const { order } = await adminClient.query(GetOrderDocument, { id: addManualPaymentToOrder.id, }); expect(order!.state).toBe('PaymentSettled'); }); // https://github.com/vendure-ecommerce/vendure/issues/2191 it('correctly transitions order & fulfillment on partial fulfillment being shipped', async () => { await shopClient.asUserWithCredentials(customers[0].emailAddress, password); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_6', quantity: 3, }); await proceedToArrangingPayment(shopClient); orderGuard.assertSuccess(addItemToOrder); const order = await addPaymentToOrder(shopClient, singleStageRefundablePaymentMethod); orderGuard.assertSuccess(order); const { addFulfillmentToOrder } = await adminClient.query(CreateFulfillmentDocument, { input: { lines: [{ orderLineId: order.lines[0].id, quantity: 2 }], handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'Test2' }, { name: 'trackingCode', value: '222' }, ], }, }, }); fulfillmentGuard.assertSuccess(addFulfillmentToOrder); const { transitionFulfillmentToState } = await adminClient.query(TransitFulfillmentDocument, { id: addFulfillmentToOrder.id, state: 'Shipped', }); fulfillmentGuard.assertSuccess(transitionFulfillmentToState); expect(transitionFulfillmentToState.id).toBe(addFulfillmentToOrder.id); expect(transitionFulfillmentToState.state).toBe('Shipped'); const { order: order2 } = await adminClient.query(GetOrderDocument, { id: order.id, }); expect(order2?.state).toBe('PartiallyShipped'); }); }); }); async function createTestOrder( adminClient: SimpleGraphQLClient, shopClient: SimpleGraphQLClient, emailAddress: string, password: string, ): Promise<{ orderId: string; product: Codegen.GetProductWithVariantsQuery['product']; productVariantId: string; }> { const result = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_3', }); const product = result.product!; const productVariantId = product.variants[0].id; // Set the ProductVariant to trackInventory const { updateProductVariants } = await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: productVariantId, trackInventory: GlobalFlag.TRUE, }, ], }); // Add the ProductVariant to the Order await shopClient.asUserWithCredentials(emailAddress, password); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId, quantity: 2, }); const orderId = (addItemToOrder as CodegenShop.UpdatedOrderFragment).id; return { product, productVariantId, orderId }; } async function getUnfulfilledOrderLineInput( client: SimpleGraphQLClient, id: string, ): Promise<OrderLineInput[]> { const { order } = await client.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>(GET_ORDER, { id, }); const allFulfillmentLines = order?.fulfillments ?.filter(f => f.state !== 'Cancelled') .reduce((all, f) => [...all, ...f.lines], [] as Codegen.FulfillmentFragment['lines']) || []; const unfulfilledItems = order?.lines .map(l => { const fulfilledQuantity = allFulfillmentLines .filter(fl => fl.orderLineId === l.id) .reduce((sum, fl) => sum + fl.quantity, 0); return { orderLineId: l.id, unfulfilled: l.quantity - fulfilledQuantity }; }) .filter(l => 0 < l.unfulfilled) || []; return unfulfilledItems.map(l => ({ orderLineId: l.orderLineId, quantity: l.unfulfilled, })); } export const GET_ORDER_LIST_FULFILLMENTS = gql` query GetOrderListFulfillments { orders { items { id state fulfillments { id state nextStates method } } } } `; export const GET_ORDER_FULFILLMENT_ITEMS = gql` query GetOrderFulfillmentItems($id: ID!) { order(id: $id) { id state fulfillments { ...Fulfillment } } } ${FULFILLMENT_FRAGMENT} `; const REFUND_FRAGMENT = gql` fragment Refund on Refund { id state items transactionId shipping total metadata } `; export const REFUND_ORDER = gql` mutation RefundOrder($input: RefundOrderInput!) { refundOrder(input: $input) { ...Refund ... on ErrorResult { errorCode message } } } ${REFUND_FRAGMENT} `; export const SETTLE_REFUND = gql` mutation SettleRefund($input: SettleRefundInput!) { settleRefund(input: $input) { ...Refund ... on ErrorResult { errorCode message } } } ${REFUND_FRAGMENT} `; export const ADD_NOTE_TO_ORDER = gql` mutation AddNoteToOrder($input: AddNoteToOrderInput!) { addNoteToOrder(input: $input) { id } } `; export const UPDATE_ORDER_NOTE = gql` mutation UpdateOrderNote($input: UpdateOrderNoteInput!) { updateOrderNote(input: $input) { id data isPublic } } `; export const DELETE_ORDER_NOTE = gql` mutation DeleteOrderNote($id: ID!) { deleteOrderNote(id: $id) { result message } } `; const GET_ORDER_WITH_PAYMENTS = gql` query GetOrderWithPayments($id: ID!) { order(id: $id) { id payments { id errorMessage metadata refunds { id total } } } } `; export const GET_ORDER_LINE_FULFILLMENTS = gql` query GetOrderLineFulfillments($id: ID!) { order(id: $id) { id lines { id fulfillmentLines { fulfillment { id state } orderLineId quantity } } } } `; const GET_ORDERS_LIST_WITH_QUANTITIES = gql` query GetOrderListWithQty($options: OrderListOptions) { orders(options: $options) { items { id code totalQuantity lines { id quantity } } } } `; const CANCEL_PAYMENT = gql` mutation CancelPayment($paymentId: ID!) { cancelPayment(id: $paymentId) { ...Payment ... on ErrorResult { errorCode message } ... on PaymentStateTransitionError { transitionError } ... on CancelPaymentError { paymentErrorMessage } } } ${PAYMENT_FRAGMENT} `; const SET_ORDER_CUSTOMER = gql` mutation SetOrderCustomer($input: SetOrderCustomerInput!) { setOrderCustomer(input: $input) { id customer { id } } } `;
import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { createTestEnvironment } from '../../testing/lib/create-test-environment'; import { SlowMutationPlugin } from './fixtures/test-plugins/slow-mutation-plugin'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { LanguageCode } from './graphql/generated-e2e-admin-types'; import { ADD_OPTION_GROUP_TO_PRODUCT, CREATE_PRODUCT, CREATE_PRODUCT_OPTION_GROUP, CREATE_PRODUCT_VARIANTS, } from './graphql/shared-definitions'; describe('Parallel transactions', () => { const { server, adminClient, shopClient } = createTestEnvironment({ ...testConfig(), plugins: [SlowMutationPlugin], }); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 2, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('does not fail on many concurrent, slow transactions', async () => { const CONCURRENCY_LIMIT = 20; const slowMutations = Array.from({ length: CONCURRENCY_LIMIT }).map(i => adminClient.query(SLOW_MUTATION, { delay: 50 }), ); const result = await Promise.all(slowMutations); expect(result).toEqual(Array.from({ length: CONCURRENCY_LIMIT }).map(() => ({ slowMutation: true }))); }, 100000); it('does not fail on attempted deadlock', async () => { const CONCURRENCY_LIMIT = 4; const slowMutations = Array.from({ length: CONCURRENCY_LIMIT }).map(i => adminClient.query(ATTEMPT_DEADLOCK), ); const result = await Promise.all(slowMutations); expect(result).toEqual( Array.from({ length: CONCURRENCY_LIMIT }).map(() => ({ attemptDeadlock: true })), ); }, 100000); // A real-world error-case originally reported in https://github.com/vendure-ecommerce/vendure/issues/527 it('does not deadlock on concurrent creating ProductVariants', async () => { const CONCURRENCY_LIMIT = 4; const { createProduct } = await adminClient.query< Codegen.CreateProductMutation, Codegen.CreateProductMutationVariables >(CREATE_PRODUCT, { input: { translations: [ { languageCode: LanguageCode.en, name: 'Test', slug: 'test', description: 'test' }, ], }, }); const sizes = Array.from({ length: CONCURRENCY_LIMIT }).map(i => `size-${i as string}`); const { createProductOptionGroup } = await adminClient.query< Codegen.CreateProductOptionGroupMutation, Codegen.CreateProductOptionGroupMutationVariables >(CREATE_PRODUCT_OPTION_GROUP, { input: { code: 'size', options: sizes.map(size => ({ code: size, translations: [{ languageCode: LanguageCode.en, name: size }], })), translations: [{ languageCode: LanguageCode.en, name: 'size' }], }, }); await adminClient.query< Codegen.AddOptionGroupToProductMutation, Codegen.AddOptionGroupToProductMutationVariables >(ADD_OPTION_GROUP_TO_PRODUCT, { productId: createProduct.id, optionGroupId: createProductOptionGroup.id, }); const createVariantMutations = createProductOptionGroup.options .filter((_, index) => index < CONCURRENCY_LIMIT) .map((option, i) => { return adminClient.query< Codegen.CreateProductVariantsMutation, Codegen.CreateProductVariantsMutationVariables >(CREATE_PRODUCT_VARIANTS, { input: [ { sku: `VARIANT-${i}`, productId: createProduct.id, optionIds: [option.id], translations: [{ languageCode: LanguageCode.en, name: `Variant ${i}` }], price: 1000, taxCategoryId: 'T_1', facetValueIds: ['T_1', 'T_2'], featuredAssetId: 'T_1', assetIds: ['T_1'], }, ], }); }); const results = await Promise.all(createVariantMutations); expect(results.length).toBe(CONCURRENCY_LIMIT); }, 100000); }); const SLOW_MUTATION = gql` mutation SlowMutation($delay: Int!) { slowMutation(delay: $delay) } `; const ATTEMPT_DEADLOCK = gql` mutation AttemptDeadlock { attemptDeadlock } `;
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { DefaultLogger, dummyPaymentHandler, LanguageCode, PaymentMethodEligibilityChecker, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, E2E_DEFAULT_CHANNEL_TOKEN, ErrorResultGuard, } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { vi } from 'vitest'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { CurrencyCode, DeletionResult } from './graphql/generated-e2e-admin-types'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { ErrorCode } from './graphql/generated-e2e-shop-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { CREATE_CHANNEL } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER, ADD_PAYMENT, GET_ELIGIBLE_PAYMENT_METHODS } from './graphql/shop-definitions'; import { proceedToArrangingPayment } from './utils/test-order-utils'; const checkerSpy = vi.fn(); const minPriceChecker = new PaymentMethodEligibilityChecker({ code: 'min-price-checker', description: [{ languageCode: LanguageCode.en, value: 'Min price checker' }], args: { minPrice: { type: 'int', }, }, check(ctx, order, args) { checkerSpy(); if (order.totalWithTax >= args.minPrice) { return true; } else { return 'Order total too low'; } }, }); describe('PaymentMethod resolver', () => { const orderGuard: ErrorResultGuard<CodegenShop.TestOrderWithPaymentsFragment> = createErrorResultGuard( input => !!input.lines, ); const { server, adminClient, shopClient } = createTestEnvironment({ ...testConfig(), // logger: new DefaultLogger(), paymentOptions: { paymentMethodEligibilityCheckers: [minPriceChecker], paymentMethodHandlers: [dummyPaymentHandler], }, }); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 2, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('create', async () => { const { createPaymentMethod } = await adminClient.query< Codegen.CreatePaymentMethodMutation, Codegen.CreatePaymentMethodMutationVariables >(CREATE_PAYMENT_METHOD, { input: { code: 'no-checks', enabled: true, handler: { code: dummyPaymentHandler.code, arguments: [{ name: 'automaticSettle', value: 'true' }], }, translations: [ { languageCode: LanguageCode.en, name: 'No Checker', description: 'This is a test payment method', }, ], }, }); expect(createPaymentMethod).toEqual({ id: 'T_1', name: 'No Checker', code: 'no-checks', description: 'This is a test payment method', enabled: true, checker: null, handler: { args: [ { name: 'automaticSettle', value: 'true', }, ], code: 'dummy-payment-handler', }, translations: [ { description: 'This is a test payment method', id: 'T_1', languageCode: 'en', name: 'No Checker', }, ], }); }); it('update', async () => { const { updatePaymentMethod } = await adminClient.query< Codegen.UpdatePaymentMethodMutation, Codegen.UpdatePaymentMethodMutationVariables >(UPDATE_PAYMENT_METHOD, { input: { id: 'T_1', checker: { code: minPriceChecker.code, arguments: [{ name: 'minPrice', value: '0' }], }, handler: { code: dummyPaymentHandler.code, arguments: [{ name: 'automaticSettle', value: 'false' }], }, translations: [ { languageCode: LanguageCode.en, description: 'modified', }, ], }, }); expect(updatePaymentMethod).toEqual({ id: 'T_1', name: 'No Checker', code: 'no-checks', description: 'modified', enabled: true, checker: { args: [{ name: 'minPrice', value: '0' }], code: minPriceChecker.code, }, handler: { args: [ { name: 'automaticSettle', value: 'false', }, ], code: dummyPaymentHandler.code, }, translations: [ { description: 'modified', id: 'T_1', languageCode: 'en', name: 'No Checker', }, ], }); }); it('unset checker', async () => { const { updatePaymentMethod } = await adminClient.query< Codegen.UpdatePaymentMethodMutation, Codegen.UpdatePaymentMethodMutationVariables >(UPDATE_PAYMENT_METHOD, { input: { id: 'T_1', checker: null, }, }); expect(updatePaymentMethod.checker).toEqual(null); const { paymentMethod } = await adminClient.query< Codegen.GetPaymentMethodQuery, Codegen.GetPaymentMethodQueryVariables >(GET_PAYMENT_METHOD, { id: 'T_1' }); expect(paymentMethod!.checker).toEqual(null); }); it('paymentMethodEligibilityCheckers', async () => { const { paymentMethodEligibilityCheckers } = await adminClient.query<Codegen.GetPaymentMethodCheckersQuery>(GET_PAYMENT_METHOD_CHECKERS); expect(paymentMethodEligibilityCheckers).toEqual([ { code: minPriceChecker.code, args: [{ name: 'minPrice', type: 'int' }], }, ]); }); it('paymentMethodHandlers', async () => { const { paymentMethodHandlers } = await adminClient.query<Codegen.GetPaymentMethodHandlersQuery>( GET_PAYMENT_METHOD_HANDLERS, ); expect(paymentMethodHandlers).toEqual([ { code: dummyPaymentHandler.code, args: [{ name: 'automaticSettle', type: 'boolean' }], }, ]); }); describe('eligibility checks', () => { beforeAll(async () => { await adminClient.query< Codegen.CreatePaymentMethodMutation, Codegen.CreatePaymentMethodMutationVariables >(CREATE_PAYMENT_METHOD, { input: { code: 'price-check', enabled: true, checker: { code: minPriceChecker.code, arguments: [{ name: 'minPrice', value: '200000' }], }, handler: { code: dummyPaymentHandler.code, arguments: [{ name: 'automaticSettle', value: 'true' }], }, translations: [ { languageCode: LanguageCode.en, name: 'With Min Price Checker', description: 'Order total must be more than 2k', }, ], }, }); await adminClient.query< Codegen.CreatePaymentMethodMutation, Codegen.CreatePaymentMethodMutationVariables >(CREATE_PAYMENT_METHOD, { input: { code: 'disabled-method', enabled: false, handler: { code: dummyPaymentHandler.code, arguments: [{ name: 'automaticSettle', value: 'true' }], }, translations: [ { languageCode: LanguageCode.en, name: 'Disabled ones', description: 'This method is disabled', }, ], }, }); await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); await proceedToArrangingPayment(shopClient); }); it('eligiblePaymentMethods', async () => { const { eligiblePaymentMethods } = await shopClient.query<CodegenShop.GetEligiblePaymentMethodsQuery>( GET_ELIGIBLE_PAYMENT_METHODS, ); expect(eligiblePaymentMethods).toEqual([ { id: 'T_1', code: 'no-checks', isEligible: true, eligibilityMessage: null, }, { id: 'T_2', code: 'price-check', isEligible: false, eligibilityMessage: 'Order total too low', }, ]); }); it('addPaymentToOrder does not allow ineligible method', async () => { checkerSpy.mockClear(); const { addPaymentToOrder } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: 'price-check', metadata: {}, }, }); orderGuard.assertErrorResult(addPaymentToOrder); expect(addPaymentToOrder.errorCode).toBe(ErrorCode.INELIGIBLE_PAYMENT_METHOD_ERROR); expect(addPaymentToOrder.eligibilityCheckerMessage).toBe('Order total too low'); expect(checkerSpy).toHaveBeenCalledTimes(1); }); }); describe('channels', () => { const SECOND_CHANNEL_TOKEN = 'SECOND_CHANNEL_TOKEN'; const THIRD_CHANNEL_TOKEN = 'THIRD_CHANNEL_TOKEN'; beforeAll(async () => { await adminClient.query<Codegen.CreateChannelMutation, Codegen.CreateChannelMutationVariables>( CREATE_CHANNEL, { input: { code: 'second-channel', token: SECOND_CHANNEL_TOKEN, defaultLanguageCode: LanguageCode.en, currencyCode: CurrencyCode.GBP, pricesIncludeTax: true, defaultShippingZoneId: 'T_1', defaultTaxZoneId: 'T_1', }, }, ); await adminClient.query<Codegen.CreateChannelMutation, Codegen.CreateChannelMutationVariables>( CREATE_CHANNEL, { input: { code: 'third-channel', token: THIRD_CHANNEL_TOKEN, defaultLanguageCode: LanguageCode.en, currencyCode: CurrencyCode.GBP, pricesIncludeTax: true, defaultShippingZoneId: 'T_1', defaultTaxZoneId: 'T_1', }, }, ); }); it('creates a PaymentMethod in channel2', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { createPaymentMethod } = await adminClient.query< Codegen.CreatePaymentMethodMutation, Codegen.CreatePaymentMethodMutationVariables >(CREATE_PAYMENT_METHOD, { input: { code: 'channel-2-method', enabled: true, handler: { code: dummyPaymentHandler.code, arguments: [{ name: 'automaticSettle', value: 'true' }], }, translations: [ { languageCode: LanguageCode.en, name: 'Channel 2 method', description: 'This is a test payment method', }, ], }, }); expect(createPaymentMethod.code).toBe('channel-2-method'); }); it('method is listed in channel2', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { paymentMethods } = await adminClient.query<Codegen.GetPaymentMethodListQuery>( GET_PAYMENT_METHOD_LIST, ); expect(paymentMethods.totalItems).toBe(1); expect(paymentMethods.items[0].code).toBe('channel-2-method'); }); it('method is not listed in channel3', async () => { adminClient.setChannelToken(THIRD_CHANNEL_TOKEN); const { paymentMethods } = await adminClient.query<Codegen.GetPaymentMethodListQuery>( GET_PAYMENT_METHOD_LIST, ); expect(paymentMethods.totalItems).toBe(0); }); it('method is listed in default channel', async () => { adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { paymentMethods } = await adminClient.query<Codegen.GetPaymentMethodListQuery>( GET_PAYMENT_METHOD_LIST, ); expect(paymentMethods.totalItems).toBe(4); expect(paymentMethods.items.map(i => i.code).sort()).toEqual([ 'channel-2-method', 'disabled-method', 'no-checks', 'price-check', ]); }); it('delete from channel', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { paymentMethods } = await adminClient.query<Codegen.GetPaymentMethodListQuery>( GET_PAYMENT_METHOD_LIST, ); expect(paymentMethods.totalItems).toBe(1); const { deletePaymentMethod } = await adminClient.query< Codegen.DeletePaymentMethodMutation, Codegen.DeletePaymentMethodMutationVariables >(DELETE_PAYMENT_METHOD, { id: paymentMethods.items[0].id, }); expect(deletePaymentMethod.result).toBe(DeletionResult.DELETED); const { paymentMethods: checkChannel } = await adminClient.query<Codegen.GetPaymentMethodListQuery>(GET_PAYMENT_METHOD_LIST); expect(checkChannel.totalItems).toBe(0); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { paymentMethods: checkDefault } = await adminClient.query<Codegen.GetPaymentMethodListQuery>(GET_PAYMENT_METHOD_LIST); expect(checkDefault.totalItems).toBe(4); }); it('delete from default channel', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { createPaymentMethod } = await adminClient.query< Codegen.CreatePaymentMethodMutation, Codegen.CreatePaymentMethodMutationVariables >(CREATE_PAYMENT_METHOD, { input: { code: 'channel-2-method2', enabled: true, handler: { code: dummyPaymentHandler.code, arguments: [{ name: 'automaticSettle', value: 'true' }], }, translations: [ { languageCode: LanguageCode.en, name: 'Channel 2 method 2', description: 'This is a test payment method', }, ], }, }); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { deletePaymentMethod: delete1 } = await adminClient.query< Codegen.DeletePaymentMethodMutation, Codegen.DeletePaymentMethodMutationVariables >(DELETE_PAYMENT_METHOD, { id: createPaymentMethod.id, }); expect(delete1.result).toBe(DeletionResult.NOT_DELETED); expect(delete1.message).toBe( 'The selected PaymentMethod is assigned to the following Channels: second-channel. Set "force: true" to delete from all Channels.', ); const { paymentMethods: check1 } = await adminClient.query<Codegen.GetPaymentMethodListQuery>( GET_PAYMENT_METHOD_LIST, ); expect(check1.totalItems).toBe(5); const { deletePaymentMethod: delete2 } = await adminClient.query< Codegen.DeletePaymentMethodMutation, Codegen.DeletePaymentMethodMutationVariables >(DELETE_PAYMENT_METHOD, { id: createPaymentMethod.id, force: true, }); expect(delete2.result).toBe(DeletionResult.DELETED); const { paymentMethods: check2 } = await adminClient.query<Codegen.GetPaymentMethodListQuery>( GET_PAYMENT_METHOD_LIST, ); expect(check2.totalItems).toBe(4); }); }); it('create without description', async () => { const { createPaymentMethod } = await adminClient.query< Codegen.CreatePaymentMethodMutation, Codegen.CreatePaymentMethodMutationVariables >(CREATE_PAYMENT_METHOD, { input: { code: 'no-description', enabled: true, handler: { code: dummyPaymentHandler.code, arguments: [{ name: 'automaticSettle', value: 'true' }], }, translations: [ { languageCode: LanguageCode.en, name: 'No Description', }, ], }, }); expect(createPaymentMethod).toEqual({ id: 'T_6', name: 'No Description', code: 'no-description', description: '', enabled: true, checker: null, handler: { args: [ { name: 'automaticSettle', value: 'true', }, ], code: 'dummy-payment-handler', }, translations: [ { description: '', id: 'T_6', languageCode: 'en', name: 'No Description', }, ], }); }); }); export const PAYMENT_METHOD_FRAGMENT = gql` fragment PaymentMethod on PaymentMethod { id code name description enabled checker { code args { name value } } handler { code args { name value } } translations { id languageCode name description } } `; export const CREATE_PAYMENT_METHOD = gql` mutation CreatePaymentMethod($input: CreatePaymentMethodInput!) { createPaymentMethod(input: $input) { ...PaymentMethod } } ${PAYMENT_METHOD_FRAGMENT} `; export const UPDATE_PAYMENT_METHOD = gql` mutation UpdatePaymentMethod($input: UpdatePaymentMethodInput!) { updatePaymentMethod(input: $input) { ...PaymentMethod } } ${PAYMENT_METHOD_FRAGMENT} `; export const GET_PAYMENT_METHOD_HANDLERS = gql` query GetPaymentMethodHandlers { paymentMethodHandlers { code args { name type } } } `; export const GET_PAYMENT_METHOD_CHECKERS = gql` query GetPaymentMethodCheckers { paymentMethodEligibilityCheckers { code args { name type } } } `; export const GET_PAYMENT_METHOD = gql` query GetPaymentMethod($id: ID!) { paymentMethod(id: $id) { ...PaymentMethod } } ${PAYMENT_METHOD_FRAGMENT} `; export const GET_PAYMENT_METHOD_LIST = gql` query GetPaymentMethodList($options: PaymentMethodListOptions) { paymentMethods(options: $options) { items { ...PaymentMethod } totalItems } } ${PAYMENT_METHOD_FRAGMENT} `; export const DELETE_PAYMENT_METHOD = gql` mutation DeletePaymentMethod($id: ID!, $force: Boolean) { deletePaymentMethod(id: $id, force: $force) { message result } } `;
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { CustomOrderProcess, CustomPaymentProcess, DefaultLogger, defaultOrderProcess, LanguageCode, mergeConfig, Order, OrderPlacedStrategy, OrderState, PaymentMethodHandler, RequestContext, TransactionalConnection, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { vi } from 'vitest'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { ORDER_WITH_LINES_FRAGMENT } from './graphql/fragments'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { ErrorCode } from './graphql/generated-e2e-admin-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { ADMIN_TRANSITION_TO_STATE, GET_ORDER, TRANSITION_PAYMENT_TO_STATE, } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER, ADD_PAYMENT, GET_ACTIVE_ORDER } from './graphql/shop-definitions'; import { proceedToArrangingPayment } from './utils/test-order-utils'; const initSpy = vi.fn(); const transitionStartSpy = vi.fn(); const transitionEndSpy = vi.fn(); const transitionErrorSpy = vi.fn(); const settlePaymentSpy = vi.fn(); describe('Payment process', () => { let orderId: string; let payment1Id: string; const PAYMENT_ERROR_MESSAGE = 'Payment is not valid'; const customPaymentProcess: CustomPaymentProcess<'Validating'> = { init(injector) { initSpy(injector.get(TransactionalConnection).rawConnection.name); }, transitions: { Created: { to: ['Validating'], mergeStrategy: 'merge', }, Validating: { to: ['Settled', 'Declined', 'Cancelled'], }, }, onTransitionStart(fromState, toState, data) { transitionStartSpy(fromState, toState, data); if (fromState === 'Validating' && toState === 'Settled') { if (!data.payment.metadata.valid) { return PAYMENT_ERROR_MESSAGE; } } }, onTransitionEnd(fromState, toState, data) { transitionEndSpy(fromState, toState, data); }, onTransitionError(fromState, toState, message) { transitionErrorSpy(fromState, toState, message); }, }; const customOrderProcess: CustomOrderProcess<'ValidatingPayment'> = { transitions: { ArrangingPayment: { to: ['ValidatingPayment'], mergeStrategy: 'replace', }, ValidatingPayment: { to: ['PaymentAuthorized', 'PaymentSettled', 'ArrangingAdditionalPayment'], }, }, }; const testPaymentHandler = new PaymentMethodHandler({ code: 'test-handler', description: [{ languageCode: LanguageCode.en, value: 'Test handler' }], args: {}, createPayment: (ctx, order, amount, args, metadata) => { return { state: 'Validating' as any, amount, metadata, }; }, settlePayment: (ctx, order, payment) => { settlePaymentSpy(); return { success: true, }; }, }); class TestOrderPlacedStrategy implements OrderPlacedStrategy { shouldSetAsPlaced( ctx: RequestContext, fromState: OrderState, toState: OrderState, order: Order, ): boolean | Promise<boolean> { return fromState === 'ArrangingPayment' && toState === ('ValidatingPayment' as any); } } const orderGuard: ErrorResultGuard<CodegenShop.TestOrderFragmentFragment | Codegen.OrderFragment> = createErrorResultGuard(input => !!input.total); const paymentGuard: ErrorResultGuard<Codegen.PaymentFragment> = createErrorResultGuard( input => !!input.id, ); const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { // logger: new DefaultLogger(), orderOptions: { process: [defaultOrderProcess, customOrderProcess] as any, orderPlacedStrategy: new TestOrderPlacedStrategy(), }, paymentOptions: { paymentMethodHandlers: [testPaymentHandler], customPaymentProcess: [customPaymentProcess as any], }, }), ); beforeAll(async () => { await server.init({ initialData: { ...initialData, paymentMethods: [ { name: testPaymentHandler.code, handler: { code: testPaymentHandler.code, arguments: [] }, }, ], }, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); orderId = (await proceedToArrangingPayment(shopClient)) as string; }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('CustomPaymentProcess is injectable', () => { expect(initSpy).toHaveBeenCalled(); expect(initSpy.mock.calls[0][0]).toBe('default'); }); it('creates Payment in custom state', async () => { const { addPaymentToOrder } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: testPaymentHandler.code, metadata: { valid: true, }, }, }); orderGuard.assertSuccess(addPaymentToOrder); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); expect(order?.state).toBe('ArrangingPayment'); expect(order?.payments?.length).toBe(1); expect(order?.payments?.[0].state).toBe('Validating'); payment1Id = addPaymentToOrder.payments![0].id; }); it('calls transition hooks', async () => { expect(transitionStartSpy.mock.calls[0].slice(0, 2)).toEqual(['Created', 'Validating']); expect(transitionEndSpy.mock.calls[0].slice(0, 2)).toEqual(['Created', 'Validating']); expect(transitionErrorSpy).not.toHaveBeenCalled(); }); it('Payment next states', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); expect(order?.payments?.[0].nextStates).toEqual(['Settled', 'Declined', 'Cancelled']); }); it('transition Order to custom state, custom OrderPlacedStrategy sets as placed', async () => { const { activeOrder: activeOrderPre } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(activeOrderPre).not.toBeNull(); const { transitionOrderToState } = await adminClient.query< Codegen.AdminTransitionMutation, Codegen.AdminTransitionMutationVariables >(ADMIN_TRANSITION_TO_STATE, { id: orderId, state: 'ValidatingPayment', }); orderGuard.assertSuccess(transitionOrderToState); expect(transitionOrderToState.state).toBe('ValidatingPayment'); expect(transitionOrderToState?.active).toBe(false); const { activeOrder: activeOrderPost } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(activeOrderPost).toBeNull(); }); it('transitionPaymentToState succeeds', async () => { const { transitionPaymentToState } = await adminClient.query< Codegen.TransitionPaymentToStateMutation, Codegen.TransitionPaymentToStateMutationVariables >(TRANSITION_PAYMENT_TO_STATE, { id: payment1Id, state: 'Settled', }); paymentGuard.assertSuccess(transitionPaymentToState); expect(transitionPaymentToState.state).toBe('Settled'); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); expect(order?.state).toBe('PaymentSettled'); expect(settlePaymentSpy).toHaveBeenCalled(); }); describe('failing, cancelling, and manually adding a Payment', () => { let order2Id: string; let payment2Id: string; beforeAll(async () => { await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); order2Id = (await proceedToArrangingPayment(shopClient)) as string; const { addPaymentToOrder } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: testPaymentHandler.code, metadata: { valid: false, }, }, }); orderGuard.assertSuccess(addPaymentToOrder); payment2Id = addPaymentToOrder.payments![0].id; await adminClient.query< Codegen.AdminTransitionMutation, Codegen.AdminTransitionMutationVariables >(ADMIN_TRANSITION_TO_STATE, { id: order2Id, state: 'ValidatingPayment', }); }); it('attempting to transition payment to settled fails', async () => { const { transitionPaymentToState } = await adminClient.query< Codegen.TransitionPaymentToStateMutation, Codegen.TransitionPaymentToStateMutationVariables >(TRANSITION_PAYMENT_TO_STATE, { id: payment2Id, state: 'Settled', }); paymentGuard.assertErrorResult(transitionPaymentToState); expect(transitionPaymentToState.errorCode).toBe(ErrorCode.PAYMENT_STATE_TRANSITION_ERROR); expect((transitionPaymentToState as any).transitionError).toBe(PAYMENT_ERROR_MESSAGE); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: order2Id, }, ); expect(order?.state).toBe('ValidatingPayment'); }); it('cancel failed payment', async () => { const { transitionPaymentToState } = await adminClient.query< Codegen.TransitionPaymentToStateMutation, Codegen.TransitionPaymentToStateMutationVariables >(TRANSITION_PAYMENT_TO_STATE, { id: payment2Id, state: 'Cancelled', }); paymentGuard.assertSuccess(transitionPaymentToState); expect(transitionPaymentToState.state).toBe('Cancelled'); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: order2Id, }, ); expect(order?.state).toBe('ValidatingPayment'); }); it('manually adds payment', async () => { const { transitionOrderToState } = await adminClient.query< Codegen.AdminTransitionMutation, Codegen.AdminTransitionMutationVariables >(ADMIN_TRANSITION_TO_STATE, { id: order2Id, state: 'ArrangingAdditionalPayment', }); orderGuard.assertSuccess(transitionOrderToState); const { addManualPaymentToOrder } = await adminClient.query< Codegen.AddManualPayment2Mutation, Codegen.AddManualPayment2MutationVariables >(ADD_MANUAL_PAYMENT, { input: { orderId: order2Id, metadata: {}, method: 'manual payment', transactionId: '12345', }, }); orderGuard.assertSuccess(addManualPaymentToOrder); expect(addManualPaymentToOrder.state).toBe('ArrangingAdditionalPayment'); expect(addManualPaymentToOrder.payments![1].state).toBe('Settled'); expect(addManualPaymentToOrder.payments![1].amount).toBe(addManualPaymentToOrder.totalWithTax); }); it('transitions Order to PaymentSettled', async () => { const { transitionOrderToState } = await adminClient.query< Codegen.AdminTransitionMutation, Codegen.AdminTransitionMutationVariables >(ADMIN_TRANSITION_TO_STATE, { id: order2Id, state: 'PaymentSettled', }); orderGuard.assertSuccess(transitionOrderToState); expect(transitionOrderToState.state).toBe('PaymentSettled'); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: order2Id, }, ); const settledPaymentAmount = order?.payments ?.filter(p => p.state === 'Settled') .reduce((sum, p) => sum + p.amount, 0); expect(settledPaymentAmount).toBe(order?.totalWithTax); }); }); }); export const ADD_MANUAL_PAYMENT = gql` mutation AddManualPayment2($input: ManualPaymentInput!) { addManualPaymentToOrder(input: $input) { ...OrderWithLines ... on ErrorResult { errorCode message } } } ${ORDER_WITH_LINES_FRAGMENT} `;
import { LanguageCode } from '@vendure/common/lib/generated-types'; import { ConfigService } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { vi } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { TestPluginWithAllLifecycleHooks } from './fixtures/test-plugins/with-all-lifecycle-hooks'; import { TestAPIExtensionPlugin } from './fixtures/test-plugins/with-api-extensions'; import { TestPluginWithConfig } from './fixtures/test-plugins/with-config'; import { PluginWithGlobalProviders } from './fixtures/test-plugins/with-global-providers'; import { TestLazyExtensionPlugin } from './fixtures/test-plugins/with-lazy-api-extensions'; import { TestPluginWithProvider } from './fixtures/test-plugins/with-provider'; import { TestRestPlugin } from './fixtures/test-plugins/with-rest-controller'; describe('Plugins', () => { const onConstructorFn = vi.fn(); const activeConfig = testConfig(); const { server, adminClient, shopClient } = createTestEnvironment({ ...activeConfig, plugins: [ TestPluginWithAllLifecycleHooks.init(onConstructorFn), TestPluginWithConfig.setup(), TestAPIExtensionPlugin, TestPluginWithProvider, TestLazyExtensionPlugin, TestRestPlugin, PluginWithGlobalProviders, ], }); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('can modify the config in configure()', () => { const configService = server.app.get(ConfigService); expect(configService instanceof ConfigService).toBe(true); expect(configService.defaultLanguageCode).toBe(LanguageCode.zh); }); it('extends the admin API', async () => { const result = await adminClient.query(gql` query { foo } `); expect(result.foo).toEqual(['bar']); }); it('extends the shop API', async () => { const result = await shopClient.query(gql` query { baz } `); expect(result.baz).toEqual(['quux']); }); it('custom scalar', async () => { const result = await adminClient.query(gql` query { barList(options: { skip: 0, take: 1 }) { items { id pizzaType } } } `); expect(result.barList).toEqual({ items: [{ id: 'T_1', pizzaType: 'Cheese pizza!' }], }); }); it('allows lazy evaluation of API extension', async () => { const result = await shopClient.query(gql` query { lazy } `); expect(result.lazy).toEqual('sleeping'); }); it('generates ListQueryOptions for api extensions', async () => { const result = await adminClient.query(gql` query { barList(options: { skip: 0, take: 1 }) { items { id name } totalItems } } `); expect(result.barList).toEqual({ items: [{ id: 'T_1', name: 'Test' }], totalItems: 1, }); }); it('DI works with defined providers', async () => { const result = await shopClient.query(gql` query { names } `); expect(result.names).toEqual(['seon', 'linda', 'hong']); }); describe('REST plugins', () => { const restControllerUrl = `http://localhost:${activeConfig.apiOptions.port}/test`; it('public route', async () => { const response = await shopClient.fetch(restControllerUrl + '/public'); const body = await response.text(); expect(body).toBe('success'); }); it('permission-restricted route forbidden', async () => { const response = await shopClient.fetch(restControllerUrl + '/restricted'); expect(response.status).toBe(403); const result = await response.json(); expect(result.message).toContain('FORBIDDEN'); }); it('permission-restricted route forbidden allowed', async () => { await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); const response = await shopClient.fetch(restControllerUrl + '/restricted'); expect(response.status).toBe(200); const result = await response.text(); expect(result).toBe('success'); }); it('handling I18nErrors', async () => { const response = await shopClient.fetch(restControllerUrl + '/bad'); expect(response.status).toBe(500); const result = await response.json(); expect(result.message).toContain('uh oh!'); }); }); });
import { INestApplication } from '@nestjs/common'; import { DefaultLogger, User } from '@vendure/core'; import { populate } from '@vendure/core/cli'; import { createTestEnvironment, E2E_DEFAULT_CHANNEL_TOKEN } from '@vendure/testing'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { InitialData } from '../src/index'; import { ChannelFragment, CreateChannelMutation, CreateChannelMutationVariables, CurrencyCode, GetAssetListQuery, GetCollectionsQuery, GetProductListQuery, GetProductListQueryVariables, GetProductWithVariantsQuery, GetProductWithVariantsQueryVariables, LanguageCode, } from './graphql/generated-e2e-admin-types'; import { CREATE_CHANNEL, GET_ASSET_LIST, GET_COLLECTIONS, GET_PRODUCT_LIST, GET_PRODUCT_WITH_VARIANTS, } from './graphql/shared-definitions'; describe('populate() function', () => { let channel2: ChannelFragment; const { server, adminClient } = createTestEnvironment({ ...testConfig(), // logger: new DefaultLogger(), customFields: { Product: [ { type: 'string', name: 'pageType' }, { name: 'owner', public: true, nullable: true, type: 'relation', entity: User, eager: true, }, { name: 'keywords', public: true, nullable: true, type: 'string', list: true, }, { name: 'localName', type: 'localeString', }, ], ProductVariant: [ { type: 'boolean', name: 'valid' }, { type: 'int', name: 'weight' }, ], }, }); beforeAll(async () => { await server.init({ initialData: { ...initialData, collections: [] }, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-empty.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); const { createChannel } = await adminClient.query< CreateChannelMutation, CreateChannelMutationVariables >(CREATE_CHANNEL, { input: { code: 'Channel 2', token: 'channel-2', currencyCode: CurrencyCode.EUR, defaultLanguageCode: LanguageCode.en, defaultShippingZoneId: 'T_1', defaultTaxZoneId: 'T_2', pricesIncludeTax: true, }, }); channel2 = createChannel as ChannelFragment; await server.destroy(); }, TEST_SETUP_TIMEOUT_MS); describe('populating default channel', () => { let app: INestApplication; beforeAll(async () => { const initialDataForPopulate: InitialData = { defaultLanguage: initialData.defaultLanguage, defaultZone: initialData.defaultZone, taxRates: [], shippingMethods: [], paymentMethods: [], countries: [], collections: [{ name: 'Collection 1', filters: [] }], }; const csvFile = path.join(__dirname, 'fixtures', 'product-import.csv'); app = await populate( async () => { await server.bootstrap(); return server.app; }, initialDataForPopulate, csvFile, ); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await app.close(); }); it('populates products', async () => { await adminClient.asSuperAdmin(); const { products } = await adminClient.query<GetProductListQuery>(GET_PRODUCT_LIST); expect(products.totalItems).toBe(4); expect(products.items.map(i => i.name).sort()).toEqual([ 'Artists Smock', 'Giotto Mega Pencils', 'Mabef M/02 Studio Easel', 'Perfect Paper Stretcher', ]); }); it('populates assets', async () => { const { assets } = await adminClient.query<GetAssetListQuery>(GET_ASSET_LIST); expect(assets.items.map(i => i.name).sort()).toEqual([ 'box-of-12.jpg', 'box-of-8.jpg', 'pps1.jpg', 'pps2.jpg', ]); }); it('populates collections', async () => { const { collections } = await adminClient.query<GetCollectionsQuery>(GET_COLLECTIONS); expect(collections.items.map(i => i.name).sort()).toEqual(['Collection 1']); }); }); describe('populating a non-default channel', () => { let app: INestApplication; beforeAll(async () => { const initialDataForPopulate: InitialData = { defaultLanguage: initialData.defaultLanguage, defaultZone: initialData.defaultZone, taxRates: [], shippingMethods: [], paymentMethods: [], countries: [], collections: [{ name: 'Collection 2', filters: [] }], }; const csvFile = path.join(__dirname, 'fixtures', 'product-import-channel.csv'); app = await populate( async () => { await server.bootstrap(); return server.app; }, initialDataForPopulate, csvFile, channel2.token, ); }); afterAll(async () => { await app.close(); }); it('populates products', async () => { await adminClient.asSuperAdmin(); adminClient.setChannelToken(channel2.token); const { products } = await adminClient.query<GetProductListQuery>(GET_PRODUCT_LIST); expect(products.totalItems).toBe(1); expect(products.items.map(i => i.name).sort()).toEqual(['Model Hand']); }); it('populates assets', async () => { const { assets } = await adminClient.query<GetAssetListQuery>(GET_ASSET_LIST); expect(assets.items.map(i => i.name).sort()).toEqual(['vincent-botta-736919-unsplash.jpg']); }); it('populates collections', async () => { const { collections } = await adminClient.query<GetCollectionsQuery>(GET_COLLECTIONS); expect(collections.items.map(i => i.name).sort()).toEqual(['Collection 2']); }); it('product also assigned to default channel', async () => { adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { products } = await adminClient.query<GetProductListQuery>(GET_PRODUCT_LIST); expect(products.items.map(i => i.name).includes('Model Hand')).toBe(true); }); }); // https://github.com/vendure-ecommerce/vendure/issues/1445 describe('clashing option names', () => { let app: INestApplication; beforeAll(async () => { const initialDataForPopulate: InitialData = { defaultLanguage: initialData.defaultLanguage, defaultZone: initialData.defaultZone, taxRates: [], shippingMethods: [], paymentMethods: [], countries: [], collections: [{ name: 'Collection 1', filters: [] }], }; const csvFile = path.join(__dirname, 'fixtures', 'product-import-option-values.csv'); app = await populate( async () => { await server.bootstrap(); return server.app; }, initialDataForPopulate, csvFile, ); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await app.close(); }); it('populates variants & options', async () => { await adminClient.asSuperAdmin(); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { products } = await adminClient.query<GetProductListQuery, GetProductListQueryVariables>( GET_PRODUCT_LIST, { options: { filter: { slug: { eq: 'foo' }, }, }, }, ); expect(products.totalItems).toBe(1); const fooProduct = products.items[0]; expect(fooProduct.name).toBe('Foo'); const { product } = await adminClient.query< GetProductWithVariantsQuery, GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: fooProduct.id, }); expect(product?.variants.length).toBe(4); expect(product?.optionGroups.map(og => og.name).sort()).toEqual(['Bar', 'Foo']); expect( product?.variants .find(v => v.sku === 'foo-fiz-buz') ?.options.map(o => o.name) .sort(), ).toEqual(['buz', 'fiz']); }); }); });
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { createErrorResultGuard, createTestEnvironment, E2E_DEFAULT_CHANNEL_TOKEN, ErrorResultGuard, } from '@vendure/testing'; import { fail } from 'assert'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-config'; import { AssignProductsToChannelDocument, AssignProductVariantsToChannelDocument, ChannelFragment, CreateAdministratorDocument, CreateChannelDocument, CreateProductDocument, CreateProductMutation, CreateProductVariantsDocument, CreateRoleDocument, CreateRoleMutation, CurrencyCode, GetChannelsDocument, GetProductVariantListDocument, GetProductWithVariantsDocument, GetProductWithVariantsQuery, LanguageCode, Permission, ProductVariantFragment, RemoveProductsFromChannelDocument, RemoveProductVariantsFromChannelDocument, UpdateChannelDocument, UpdateProductDocument, UpdateProductVariantsDocument, } from './graphql/generated-e2e-admin-types'; import { AddItemToOrderMutation, AddItemToOrderMutationVariables } from './graphql/generated-e2e-shop-types'; import { ADD_ITEM_TO_ORDER } from './graphql/shop-definitions'; import { assertThrowsWithMessage } from './utils/assert-throws-with-message'; describe('ChannelAware Products and ProductVariants', () => { const { server, adminClient, shopClient } = createTestEnvironment(testConfig()); const SECOND_CHANNEL_TOKEN = 'second_channel_token'; const THIRD_CHANNEL_TOKEN = 'third_channel_token'; let secondChannelAdminRole: CreateRoleMutation['createRole']; const orderResultGuard: ErrorResultGuard<{ lines: Array<{ id: string }> }> = createErrorResultGuard( input => !!input.lines, ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); await adminClient.query(CreateChannelDocument, { input: { code: 'second-channel', token: SECOND_CHANNEL_TOKEN, defaultLanguageCode: LanguageCode.en, currencyCode: CurrencyCode.GBP, pricesIncludeTax: true, defaultShippingZoneId: 'T_1', defaultTaxZoneId: 'T_1', }, }); await adminClient.query(CreateChannelDocument, { input: { code: 'third-channel', token: THIRD_CHANNEL_TOKEN, defaultLanguageCode: LanguageCode.en, currencyCode: CurrencyCode.EUR, pricesIncludeTax: true, defaultShippingZoneId: 'T_1', defaultTaxZoneId: 'T_1', }, }); const { createRole } = await adminClient.query(CreateRoleDocument, { input: { description: 'second channel admin', code: 'second-channel-admin', channelIds: ['T_2'], permissions: [ Permission.ReadCatalog, Permission.ReadSettings, Permission.ReadAdministrator, Permission.CreateAdministrator, Permission.UpdateAdministrator, ], }, }); secondChannelAdminRole = createRole; await adminClient.query(CreateAdministratorDocument, { input: { firstName: 'Admin', lastName: 'Two', emailAddress: 'admin2@test.com', password: 'test', roleIds: [secondChannelAdminRole.id], }, }); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); describe('assigning Product to Channels', () => { let product1: NonNullable<GetProductWithVariantsQuery['product']>; beforeAll(async () => { await adminClient.asSuperAdmin(); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { product } = await adminClient.query(GetProductWithVariantsDocument, { id: 'T_1', }); product1 = product!; }); it( 'throws if attempting to assign Product to channel to which the admin has no access', assertThrowsWithMessage(async () => { await adminClient.asUserWithCredentials('admin2@test.com', 'test'); await adminClient.query(AssignProductsToChannelDocument, { input: { channelId: 'T_3', productIds: [product1.id], }, }); }, 'You are not currently authorized to perform this action'), ); it('assigns Product to Channel and applies price factor', async () => { adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const PRICE_FACTOR = 0.5; await adminClient.asSuperAdmin(); const { assignProductsToChannel } = await adminClient.query(AssignProductsToChannelDocument, { input: { channelId: 'T_2', productIds: [product1.id], priceFactor: PRICE_FACTOR, }, }); expect(assignProductsToChannel[0].channels.map(c => c.id).sort()).toEqual(['T_1', 'T_2']); adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { product } = await adminClient.query(GetProductWithVariantsDocument, { id: product1.id, }); expect(product!.variants.map(v => v.price)).toEqual( product1.variants.map(v => Math.round(v.price * PRICE_FACTOR)), ); // Second Channel is configured to include taxes in price, so they should be the same. expect(product!.variants.map(v => v.priceWithTax)).toEqual( product1.variants.map(v => Math.round(v.priceWithTax * PRICE_FACTOR)), ); // Second Channel has the default currency of GBP, so the prices should be the same. expect(product!.variants.map(v => v.currencyCode)).toEqual(['GBP', 'GBP', 'GBP', 'GBP']); }); it('ProductVariant.channels includes all Channels from default Channel', async () => { adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { product } = await adminClient.query(GetProductWithVariantsDocument, { id: product1.id, }); expect(product?.variants[0].channels.map(c => c.id)).toEqual(['T_1', 'T_2']); }); it('ProductVariant.channels includes only current Channel from non-default Channel', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { product } = await adminClient.query(GetProductWithVariantsDocument, { id: product1.id, }); expect(product?.variants[0].channels.map(c => c.id)).toEqual(['T_2']); }); it('does not assign Product to same channel twice', async () => { adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { assignProductsToChannel } = await adminClient.query(AssignProductsToChannelDocument, { input: { channelId: 'T_2', productIds: [product1.id], }, }); expect(assignProductsToChannel[0].channels.map(c => c.id).sort()).toEqual(['T_1', 'T_2']); }); it( 'throws if attempting to remove Product from default Channel', assertThrowsWithMessage(async () => { await adminClient.query(RemoveProductsFromChannelDocument, { input: { productIds: [product1.id], channelId: 'T_1', }, }); }, 'Items cannot be removed from the default Channel'), ); it('removes Product from Channel', async () => { await adminClient.asSuperAdmin(); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { removeProductsFromChannel } = await adminClient.query(RemoveProductsFromChannelDocument, { input: { productIds: [product1.id], channelId: 'T_2', }, }); expect(removeProductsFromChannel[0].channels.map(c => c.id)).toEqual(['T_1']); }); // https://github.com/vendure-ecommerce/vendure/issues/2716 it('querying an Order with a variant that was since removed from the channel', async () => { await adminClient.query(AssignProductsToChannelDocument, { input: { channelId: 'T_2', productIds: [product1.id], priceFactor: 1, }, }); // Create an order in the second channel with the variant just assigned shopClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { addItemToOrder } = await shopClient.query< AddItemToOrderMutation, AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: product1.variants[0].id, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); // Now remove that variant from the second channel await adminClient.query(RemoveProductsFromChannelDocument, { input: { productIds: [product1.id], channelId: 'T_2', }, }); adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); // If no price fields are requested on the ProductVariant, then the query will // succeed even if the ProductVariant is no longer assigned to the channel. const GET_ORDER_WITHOUT_VARIANT_PRICE = ` query GetOrderWithoutVariantPrice($id: ID!) { order(id: $id) { id lines { id linePrice productVariant { id name } } } }`; const { order } = await adminClient.query(gql(GET_ORDER_WITHOUT_VARIANT_PRICE), { id: addItemToOrder.id, }); expect(order).toEqual({ id: 'T_1', lines: [ { id: 'T_1', linePrice: 129900, productVariant: { id: 'T_1', name: 'Laptop 13 inch 8GB', }, }, ], }); try { // The API will only throw if one of the price fields is requested in the query const GET_ORDER_WITH_VARIANT_PRICE = ` query GetOrderWithVariantPrice($id: ID!) { order(id: $id) { id lines { id linePrice productVariant { id name price } } } }`; await adminClient.query(gql(GET_ORDER_WITH_VARIANT_PRICE), { id: addItemToOrder.id, }); fail(`Should have thrown`); } catch (e: any) { expect(e.message).toContain( 'No price information was found for ProductVariant ID "1" in the Channel "second-channel"', ); } }); }); describe('assigning ProductVariant to Channels', () => { let product1: NonNullable<GetProductWithVariantsQuery['product']>; beforeAll(async () => { await adminClient.asSuperAdmin(); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { product } = await adminClient.query(GetProductWithVariantsDocument, { id: 'T_2', }); product1 = product!; }); it( 'throws if attempting to assign ProductVariant to channel to which the admin has no access', assertThrowsWithMessage(async () => { await adminClient.asUserWithCredentials('admin2@test.com', 'test'); await adminClient.query(AssignProductVariantsToChannelDocument, { input: { channelId: 'T_3', productVariantIds: [product1.variants[0].id], }, }); }, 'You are not currently authorized to perform this action'), ); it('assigns ProductVariant to Channel and applies price factor', async () => { const PRICE_FACTOR = 0.5; await adminClient.asSuperAdmin(); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { assignProductVariantsToChannel } = await adminClient.query( AssignProductVariantsToChannelDocument, { input: { channelId: 'T_3', productVariantIds: [product1.variants[0].id], priceFactor: PRICE_FACTOR, }, }, ); expect(assignProductVariantsToChannel[0].channels.map(c => c.id).sort()).toEqual(['T_1', 'T_3']); adminClient.setChannelToken(THIRD_CHANNEL_TOKEN); const { product } = await adminClient.query(GetProductWithVariantsDocument, { id: product1.id, }); expect(product!.channels.map(c => c.id).sort()).toEqual(['T_3']); // Third Channel is configured to include taxes in price, so they should be the same. expect(product!.variants.map(v => v.priceWithTax)).toEqual([ Math.round(product1.variants[0].priceWithTax * PRICE_FACTOR), ]); // Third Channel has the default currency EUR expect(product!.variants.map(v => v.currencyCode)).toEqual(['EUR']); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { product: check } = await adminClient.query(GetProductWithVariantsDocument, { id: product1.id, }); // from the default channel, all channels are visible expect(check?.channels.map(c => c.id).sort()).toEqual(['T_1', 'T_3']); expect(check?.variants[0].channels.map(c => c.id).sort()).toEqual(['T_1', 'T_3']); expect(check?.variants[1].channels.map(c => c.id).sort()).toEqual(['T_1']); }); it('does not assign ProductVariant to same channel twice', async () => { await adminClient.asSuperAdmin(); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { assignProductVariantsToChannel } = await adminClient.query( AssignProductVariantsToChannelDocument, { input: { channelId: 'T_3', productVariantIds: [product1.variants[0].id], }, }, ); expect(assignProductVariantsToChannel[0].channels.map(c => c.id).sort()).toEqual(['T_1', 'T_3']); }); it( 'throws if attempting to remove ProductVariant from default Channel', assertThrowsWithMessage(async () => { await adminClient.query(RemoveProductVariantsFromChannelDocument, { input: { productVariantIds: [product1.variants[0].id], channelId: 'T_1', }, }); }, 'Items cannot be removed from the default Channel'), ); it('removes ProductVariant but not Product from Channel', async () => { await adminClient.asSuperAdmin(); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { assignProductVariantsToChannel } = await adminClient.query( AssignProductVariantsToChannelDocument, { input: { channelId: 'T_3', productVariantIds: [product1.variants[1].id], }, }, ); expect(assignProductVariantsToChannel[0].channels.map(c => c.id).sort()).toEqual(['T_1', 'T_3']); const { removeProductVariantsFromChannel } = await adminClient.query( RemoveProductVariantsFromChannelDocument, { input: { productVariantIds: [product1.variants[1].id], channelId: 'T_3', }, }, ); expect(removeProductVariantsFromChannel[0].channels.map(c => c.id)).toEqual(['T_1']); const { product } = await adminClient.query(GetProductWithVariantsDocument, { id: product1.id, }); expect(product!.channels.map(c => c.id).sort()).toEqual(['T_1', 'T_3']); }); it('removes ProductVariant and Product from Channel', async () => { await adminClient.asSuperAdmin(); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { removeProductVariantsFromChannel } = await adminClient.query( RemoveProductVariantsFromChannelDocument, { input: { productVariantIds: [product1.variants[0].id], channelId: 'T_3', }, }, ); expect(removeProductVariantsFromChannel[0].channels.map(c => c.id)).toEqual(['T_1']); const { product } = await adminClient.query(GetProductWithVariantsDocument, { id: product1.id, }); expect(product!.channels.map(c => c.id).sort()).toEqual(['T_1']); }); }); describe('creating Product in sub-channel', () => { let createdProduct: CreateProductMutation['createProduct']; let createdVariant: ProductVariantFragment; it('creates a Product in sub-channel', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { createProduct } = await adminClient.query(CreateProductDocument, { input: { translations: [ { languageCode: LanguageCode.en, name: 'Channel Product', slug: 'channel-product', description: 'Channel product', }, ], }, }); const { createProductVariants } = await adminClient.query(CreateProductVariantsDocument, { input: [ { productId: createProduct.id, sku: 'PV1', optionIds: [], translations: [{ languageCode: LanguageCode.en, name: 'Variant 1' }], }, ], }); createdProduct = createProduct; createdVariant = createProductVariants[0]!; // from sub-channel, only that channel is visible expect(createdProduct.channels.map(c => c.id).sort()).toEqual(['T_2']); expect(createdVariant.channels.map(c => c.id).sort()).toEqual(['T_2']); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { product } = await adminClient.query(GetProductWithVariantsDocument, { id: createProduct.id, }); // from the default channel, all channels are visible expect(product?.channels.map(c => c.id).sort()).toEqual(['T_1', 'T_2']); expect(product?.variants[0].channels.map(c => c.id).sort()).toEqual(['T_1', 'T_2']); }); }); describe('updating Product in sub-channel', () => { it( 'throws if attempting to update a Product which is not assigned to that Channel', assertThrowsWithMessage(async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); await adminClient.query(UpdateProductDocument, { input: { id: 'T_2', translations: [{ languageCode: LanguageCode.en, name: 'xyz' }], }, }); }, 'No Product with the id "2" could be found'), ); }); describe('updating channel defaultCurrencyCode', () => { let secondChannelId: string; const channelGuard: ErrorResultGuard<ChannelFragment> = createErrorResultGuard(input => !!input.id); beforeAll(async () => { const { channels } = await adminClient.query(GetChannelsDocument); secondChannelId = channels.items.find(c => c.token === SECOND_CHANNEL_TOKEN)!.id; }); it('updates variant prices from old default to new', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { productVariants } = await adminClient.query(GetProductVariantListDocument, {}); expect(productVariants.items.map(i => i.currencyCode)).toEqual(['GBP']); const { updateChannel } = await adminClient.query(UpdateChannelDocument, { input: { id: secondChannelId, availableCurrencyCodes: [CurrencyCode.MYR, CurrencyCode.GBP, CurrencyCode.EUR], defaultCurrencyCode: CurrencyCode.MYR, }, }); channelGuard.assertSuccess(updateChannel); expect(updateChannel.defaultCurrencyCode).toBe(CurrencyCode.MYR); const { productVariants: variantsAfter } = await adminClient.query( GetProductVariantListDocument, {}, ); expect(variantsAfter.items.map(i => i.currencyCode)).toEqual(['MYR']); }); it('does not change prices in other currencies', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { productVariants } = await adminClient.query(GetProductVariantListDocument, {}); const { updateProductVariants } = await adminClient.query(UpdateProductVariantsDocument, { input: productVariants.items.map(i => ({ id: i.id, prices: [ { price: 100, currencyCode: CurrencyCode.GBP }, { price: 200, currencyCode: CurrencyCode.MYR }, { price: 300, currencyCode: CurrencyCode.EUR }, ], })), }); expect(updateProductVariants[0]?.prices.sort((a, b) => a.price - b.price)).toEqual([ { currencyCode: 'GBP', price: 100 }, { currencyCode: 'MYR', price: 200 }, { currencyCode: 'EUR', price: 300 }, ]); expect(updateProductVariants[0]?.currencyCode).toBe('MYR'); await adminClient.query(UpdateChannelDocument, { input: { id: secondChannelId, availableCurrencyCodes: [ CurrencyCode.MYR, CurrencyCode.GBP, CurrencyCode.EUR, CurrencyCode.AUD, ], defaultCurrencyCode: CurrencyCode.AUD, }, }); const { productVariants: after } = await adminClient.query(GetProductVariantListDocument, {}); expect(after.items.map(i => i.currencyCode)).toEqual(['AUD']); expect(after.items[0]?.prices.sort((a, b) => a.price - b.price)).toEqual([ { currencyCode: 'GBP', price: 100 }, { currencyCode: 'AUD', price: 200 }, { currencyCode: 'EUR', price: 300 }, ]); }); // https://github.com/vendure-ecommerce/vendure/issues/2391 it('does not duplicate an existing price', async () => { await adminClient.query(UpdateChannelDocument, { input: { id: secondChannelId, defaultCurrencyCode: CurrencyCode.GBP, }, }); const { productVariants: after } = await adminClient.query(GetProductVariantListDocument, {}); expect(after.items.map(i => i.currencyCode)).toEqual(['GBP']); expect(after.items[0]?.prices.sort((a, b) => a.price - b.price)).toEqual([ { currencyCode: 'GBP', price: 100 }, { currencyCode: 'AUD', price: 200 }, { currencyCode: 'EUR', price: 300 }, ]); }); }); });
import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { omit } from '../../common/lib/omit'; import { PRODUCT_OPTION_GROUP_FRAGMENT } from './graphql/fragments'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { DeletionResult, LanguageCode } from './graphql/generated-e2e-admin-types'; import { ADD_OPTION_GROUP_TO_PRODUCT, CREATE_PRODUCT, CREATE_PRODUCT_OPTION_GROUP, CREATE_PRODUCT_VARIANTS, DELETE_PRODUCT_VARIANT, } from './graphql/shared-definitions'; import { assertThrowsWithMessage } from './utils/assert-throws-with-message'; /* eslint-disable @typescript-eslint/no-non-null-assertion */ describe('ProductOption resolver', () => { const { server, adminClient } = createTestEnvironment(testConfig()); let sizeGroup: Codegen.ProductOptionGroupFragment; let mediumOption: Codegen.CreateProductOptionMutation['createProductOption']; beforeAll(async () => { await server.init({ initialData, customerCount: 1, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('createProductOptionGroup', async () => { const { createProductOptionGroup } = await adminClient.query< Codegen.CreateProductOptionGroupMutation, Codegen.CreateProductOptionGroupMutationVariables >(CREATE_PRODUCT_OPTION_GROUP, { input: { code: 'size', translations: [ { languageCode: LanguageCode.en, name: 'Size' }, { languageCode: LanguageCode.de, name: 'Größe' }, ], options: [ { code: 'small', translations: [ { languageCode: LanguageCode.en, name: 'Small' }, { languageCode: LanguageCode.de, name: 'Klein' }, ], }, { code: 'large', translations: [ { languageCode: LanguageCode.en, name: 'Large' }, { languageCode: LanguageCode.de, name: 'Groß' }, ], }, ], }, }); expect(omit(createProductOptionGroup, ['options', 'translations'])).toEqual({ id: 'T_3', name: 'Size', code: 'size', }); sizeGroup = createProductOptionGroup; }); it('updateProductOptionGroup', async () => { const { updateProductOptionGroup } = await adminClient.query< Codegen.UpdateProductOptionGroupMutation, Codegen.UpdateProductOptionGroupMutationVariables >(UPDATE_PRODUCT_OPTION_GROUP, { input: { id: sizeGroup.id, translations: [ { id: sizeGroup.translations[0].id, languageCode: LanguageCode.en, name: 'Bigness' }, ], }, }); expect(updateProductOptionGroup.name).toBe('Bigness'); }); it( 'createProductOption throws with invalid productOptionGroupId', assertThrowsWithMessage(async () => { const { createProductOption } = await adminClient.query< Codegen.CreateProductOptionMutation, Codegen.CreateProductOptionMutationVariables >(CREATE_PRODUCT_OPTION, { input: { productOptionGroupId: 'T_999', code: 'medium', translations: [ { languageCode: LanguageCode.en, name: 'Medium' }, { languageCode: LanguageCode.de, name: 'Mittel' }, ], }, }); }, 'No ProductOptionGroup with the id "999" could be found'), ); it('createProductOption', async () => { const { createProductOption } = await adminClient.query< Codegen.CreateProductOptionMutation, Codegen.CreateProductOptionMutationVariables >(CREATE_PRODUCT_OPTION, { input: { productOptionGroupId: sizeGroup.id, code: 'medium', translations: [ { languageCode: LanguageCode.en, name: 'Medium' }, { languageCode: LanguageCode.de, name: 'Mittel' }, ], }, }); expect(omit(createProductOption, ['translations'])).toEqual({ id: 'T_7', groupId: sizeGroup.id, code: 'medium', name: 'Medium', }); mediumOption = createProductOption; }); it('updateProductOption', async () => { const { updateProductOption } = await adminClient.query< Codegen.UpdateProductOptionMutation, Codegen.UpdateProductOptionMutationVariables >(UPDATE_PRODUCT_OPTION, { input: { id: 'T_7', translations: [ { id: mediumOption.translations[0].id, languageCode: LanguageCode.en, name: 'Middling' }, ], }, }); expect(updateProductOption.name).toBe('Middling'); }); describe('deletion', () => { let sizeOptionGroupWithOptions: NonNullable<Codegen.GetProductOptionGroupQuery['productOptionGroup']>; let variants: Codegen.CreateProductVariantsMutation['createProductVariants']; beforeAll(async () => { // Create a new product with a variant in each size option const { createProduct } = await adminClient.query< Codegen.CreateProductMutation, Codegen.CreateProductMutationVariables >(CREATE_PRODUCT, { input: { translations: [ { languageCode: LanguageCode.en, name: 'T-shirt', slug: 't-shirt', description: 'A television set', }, ], }, }); const result = await adminClient.query< Codegen.AddOptionGroupToProductMutation, Codegen.AddOptionGroupToProductMutationVariables >(ADD_OPTION_GROUP_TO_PRODUCT, { optionGroupId: sizeGroup.id, productId: createProduct.id, }); const { productOptionGroup } = await adminClient.query< Codegen.GetProductOptionGroupQuery, Codegen.GetProductOptionGroupQueryVariables >(GET_PRODUCT_OPTION_GROUP, { id: sizeGroup.id, }); const variantInput: Codegen.CreateProductVariantsMutationVariables['input'] = productOptionGroup!.options.map((option, i) => ({ productId: createProduct.id, sku: `TS-${option.code}`, optionIds: [option.id], translations: [{ languageCode: LanguageCode.en, name: `T-shirt ${option.code}` }], })); const { createProductVariants } = await adminClient.query< Codegen.CreateProductVariantsMutation, Codegen.CreateProductVariantsMutationVariables >(CREATE_PRODUCT_VARIANTS, { input: variantInput, }); variants = createProductVariants; sizeOptionGroupWithOptions = productOptionGroup!; }); it( 'attempting to delete a non-existent id throws', assertThrowsWithMessage( () => adminClient.query< Codegen.DeleteProductOptionMutation, Codegen.DeleteProductOptionMutationVariables >(DELETE_PRODUCT_OPTION, { id: '999999', }), 'No ProductOption with the id "999999" could be found', ), ); it('cannot delete ProductOption that is used by a ProductVariant', async () => { const { deleteProductOption } = await adminClient.query< Codegen.DeleteProductOptionMutation, Codegen.DeleteProductOptionMutationVariables >(DELETE_PRODUCT_OPTION, { id: sizeOptionGroupWithOptions.options.find(o => o.code === 'medium')!.id, }); expect(deleteProductOption.result).toBe(DeletionResult.NOT_DELETED); expect(deleteProductOption.message).toBe( 'Cannot delete the option "medium" as it is being used by 1 ProductVariant', ); }); it('can delete ProductOption after deleting associated ProductVariant', async () => { const { deleteProductVariant } = await adminClient.query< Codegen.DeleteProductVariantMutation, Codegen.DeleteProductVariantMutationVariables >(DELETE_PRODUCT_VARIANT, { id: variants.find(v => v!.name.includes('medium'))!.id, }); expect(deleteProductVariant.result).toBe(DeletionResult.DELETED); const { deleteProductOption } = await adminClient.query< Codegen.DeleteProductOptionMutation, Codegen.DeleteProductOptionMutationVariables >(DELETE_PRODUCT_OPTION, { id: sizeOptionGroupWithOptions.options.find(o => o.code === 'medium')!.id, }); expect(deleteProductOption.result).toBe(DeletionResult.DELETED); }); it('deleted ProductOptions not included in query result', async () => { const { productOptionGroup } = await adminClient.query< Codegen.GetProductOptionGroupQuery, Codegen.GetProductOptionGroupQueryVariables >(GET_PRODUCT_OPTION_GROUP, { id: sizeGroup.id, }); expect(productOptionGroup?.options.length).toBe(2); expect(productOptionGroup?.options.findIndex(o => o.code === 'medium')).toBe(-1); }); }); }); const GET_PRODUCT_OPTION_GROUP = gql` query GetProductOptionGroup($id: ID!) { productOptionGroup(id: $id) { id code name options { id code name } } } `; const UPDATE_PRODUCT_OPTION_GROUP = gql` mutation UpdateProductOptionGroup($input: UpdateProductOptionGroupInput!) { updateProductOptionGroup(input: $input) { ...ProductOptionGroup } } ${PRODUCT_OPTION_GROUP_FRAGMENT} `; const CREATE_PRODUCT_OPTION = gql` mutation CreateProductOption($input: CreateProductOptionInput!) { createProductOption(input: $input) { id code name groupId translations { id languageCode name } } } `; const UPDATE_PRODUCT_OPTION = gql` mutation UpdateProductOption($input: UpdateProductOptionInput!) { updateProductOption(input: $input) { id code name groupId } } `; const DELETE_PRODUCT_OPTION = gql` mutation DeleteProductOption($id: ID!) { deleteProductOption(id: $id) { result message } } `;
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { pick } from '@vendure/common/lib/pick'; import { mergeConfig } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, E2E_DEFAULT_CHANNEL_TOKEN, ErrorResultGuard, } from '@vendure/testing'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-config'; import { ProductVariantPrice, ProductVariantPriceUpdateStrategy, RequestContext } from '../src/index'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { AssignProductsToChannelDocument, CreateChannelDocument, CreateProductDocument, CreateProductVariantsDocument, CurrencyCode, GetProductWithVariantsDocument, LanguageCode, UpdateChannelDocument, UpdateProductVariantsDocument, } from './graphql/generated-e2e-admin-types'; import { AddItemToOrderDocument, AdjustItemQuantityDocument, GetActiveOrderDocument, TestOrderFragmentFragment, UpdatedOrderFragment, } from './graphql/generated-e2e-shop-types'; import { assertThrowsWithMessage } from './utils/assert-throws-with-message'; class TestProductVariantPriceUpdateStrategy implements ProductVariantPriceUpdateStrategy { static syncAcrossChannels = false; static onCreatedSpy = vi.fn(); static onUpdatedSpy = vi.fn(); static onDeletedSpy = vi.fn(); onPriceCreated(ctx: RequestContext, price: ProductVariantPrice, prices: ProductVariantPrice[]) { TestProductVariantPriceUpdateStrategy.onCreatedSpy(price, prices); return []; } onPriceUpdated(ctx: RequestContext, updatedPrice: ProductVariantPrice, prices: ProductVariantPrice[]) { TestProductVariantPriceUpdateStrategy.onUpdatedSpy(updatedPrice, prices); if (TestProductVariantPriceUpdateStrategy.syncAcrossChannels) { return prices .filter(p => p.currencyCode === updatedPrice.currencyCode) .map(p => ({ id: p.id, price: updatedPrice.price, })); } else { return []; } } onPriceDeleted(ctx: RequestContext, deletedPrice: ProductVariantPrice, prices: ProductVariantPrice[]) { TestProductVariantPriceUpdateStrategy.onDeletedSpy(deletedPrice, prices); return []; } } describe('Product prices', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig( { ...testConfig() }, { catalogOptions: { productVariantPriceUpdateStrategy: new TestProductVariantPriceUpdateStrategy(), }, }, ), ); let multiPriceProduct: Codegen.CreateProductMutation['createProduct']; let multiPriceVariant: NonNullable< Codegen.CreateProductVariantsMutation['createProductVariants'][number] >; const orderResultGuard: ErrorResultGuard<TestOrderFragmentFragment | UpdatedOrderFragment> = createErrorResultGuard(input => !!input.lines); const createChannelResultGuard: ErrorResultGuard<{ id: string }> = createErrorResultGuard( input => !!input.id, ); beforeAll(async () => { await server.init({ initialData, customerCount: 1, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), }); await adminClient.asSuperAdmin(); await adminClient.query(UpdateChannelDocument, { input: { id: 'T_1', availableCurrencyCodes: [CurrencyCode.USD, CurrencyCode.GBP, CurrencyCode.EUR], }, }); const { createProduct } = await adminClient.query(CreateProductDocument, { input: { translations: [ { languageCode: LanguageCode.en, name: 'Cactus', slug: 'cactus', description: 'A prickly plant', }, ], }, }); multiPriceProduct = createProduct; }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('create ProductVariant creates price in Channel default currency', async () => { const { createProductVariants } = await adminClient.query(CreateProductVariantsDocument, { input: [ { productId: multiPriceProduct.id, sku: 'CACTUS-1', optionIds: [], translations: [{ languageCode: LanguageCode.de, name: 'Cactus' }], price: 1000, }, ], }); expect(createProductVariants.length).toBe(1); expect(createProductVariants[0]?.prices).toEqual([ { currencyCode: CurrencyCode.USD, price: 1000, }, ]); multiPriceVariant = createProductVariants[0]!; }); it( 'updating ProductVariant with price in unavailable currency throws', assertThrowsWithMessage(async () => { await adminClient.query(UpdateProductVariantsDocument, { input: { id: multiPriceVariant.id, prices: [ { currencyCode: CurrencyCode.JPY, price: 100000, }, ], }, }); }, 'The currency "JPY" is not available in the current Channel'), ); it('updates ProductVariant with multiple prices', async () => { await adminClient.query(UpdateProductVariantsDocument, { input: { id: multiPriceVariant.id, prices: [ { currencyCode: CurrencyCode.USD, price: 1200 }, { currencyCode: CurrencyCode.GBP, price: 900 }, { currencyCode: CurrencyCode.EUR, price: 1100 }, ], }, }); const { product } = await adminClient.query(GetProductWithVariantsDocument, { id: multiPriceProduct.id, }); expect(product?.variants[0]?.prices.sort((a, b) => a.price - b.price)).toEqual([ { currencyCode: CurrencyCode.GBP, price: 900 }, { currencyCode: CurrencyCode.EUR, price: 1100 }, { currencyCode: CurrencyCode.USD, price: 1200 }, ]); }); it('deletes a price in a non-default currency', async () => { await adminClient.query(UpdateProductVariantsDocument, { input: { id: multiPriceVariant.id, prices: [{ currencyCode: CurrencyCode.EUR, price: 1100, delete: true }], }, }); const { product } = await adminClient.query(GetProductWithVariantsDocument, { id: multiPriceProduct.id, }); expect(product?.variants[0]?.prices.sort((a, b) => a.price - b.price)).toEqual([ { currencyCode: CurrencyCode.GBP, price: 900 }, { currencyCode: CurrencyCode.USD, price: 1200 }, ]); }); describe('DefaultProductVariantPriceSelectionStrategy', () => { it('defaults to default Channel currency', async () => { const { product } = await adminClient.query(GetProductWithVariantsDocument, { id: multiPriceProduct.id, }); expect(product?.variants[0]?.price).toEqual(1200); expect(product?.variants[0]?.priceWithTax).toEqual(1200 * 1.2); expect(product?.variants[0]?.currencyCode).toEqual(CurrencyCode.USD); }); it('uses query string to select currency', async () => { const { product } = await adminClient.query( GetProductWithVariantsDocument, { id: multiPriceProduct.id, }, { currencyCode: 'GBP' }, ); expect(product?.variants[0]?.price).toEqual(900); expect(product?.variants[0]?.priceWithTax).toEqual(900 * 1.2); expect(product?.variants[0]?.currencyCode).toEqual(CurrencyCode.GBP); }); it( 'throws if unrecognised currency code passed in query string', assertThrowsWithMessage(async () => { await adminClient.query( GetProductWithVariantsDocument, { id: multiPriceProduct.id, }, { currencyCode: 'JPY' }, ); }, 'The currency "JPY" is not available in the current Channel'), ); }); describe('changing Order currencyCode', () => { beforeAll(async () => { await adminClient.query(UpdateProductVariantsDocument, { input: [ { id: 'T_1', prices: [ { currencyCode: CurrencyCode.USD, price: 1000 }, { currencyCode: CurrencyCode.GBP, price: 900 }, { currencyCode: CurrencyCode.EUR, price: 1100 }, ], }, { id: 'T_2', prices: [ { currencyCode: CurrencyCode.USD, price: 2000 }, { currencyCode: CurrencyCode.GBP, price: 1900 }, { currencyCode: CurrencyCode.EUR, price: 2100 }, ], }, { id: 'T_3', prices: [ { currencyCode: CurrencyCode.USD, price: 3000 }, { currencyCode: CurrencyCode.GBP, price: 2900 }, { currencyCode: CurrencyCode.EUR, price: 3100 }, ], }, ], }); }); it('create order in default currency', async () => { await shopClient.query(AddItemToOrderDocument, { productVariantId: 'T_1', quantity: 1, }); await shopClient.query(AddItemToOrderDocument, { productVariantId: 'T_2', quantity: 1, }); const { activeOrder } = await shopClient.query(GetActiveOrderDocument); expect(activeOrder?.lines[0]?.unitPrice).toBe(1000); expect(activeOrder?.lines[0]?.unitPriceWithTax).toBe(1200); expect(activeOrder?.lines[1]?.unitPrice).toBe(2000); expect(activeOrder?.lines[1]?.unitPriceWithTax).toBe(2400); expect(activeOrder?.currencyCode).toBe(CurrencyCode.USD); }); it( 'updating an order in an unsupported currency throws', assertThrowsWithMessage(async () => { await shopClient.query( AddItemToOrderDocument, { productVariantId: 'T_1', quantity: 1, }, { currencyCode: 'JPY' }, ); }, 'The currency "JPY" is not available in the current Channel'), ); it('updating an order line with a new currency updates all lines to that currency', async () => { const { activeOrder } = await shopClient.query(GetActiveOrderDocument); const { adjustOrderLine } = await shopClient.query( AdjustItemQuantityDocument, { orderLineId: activeOrder!.lines[0]?.id, quantity: 2, }, { currencyCode: 'GBP' }, ); orderResultGuard.assertSuccess(adjustOrderLine); expect(adjustOrderLine?.lines[0]?.unitPrice).toBe(900); expect(adjustOrderLine?.lines[0]?.unitPriceWithTax).toBe(1080); expect(adjustOrderLine?.lines[1]?.unitPrice).toBe(1900); expect(adjustOrderLine?.lines[1]?.unitPriceWithTax).toBe(2280); expect(adjustOrderLine.currencyCode).toBe('GBP'); }); it('adding a new order line with a new currency updates all lines to that currency', async () => { const { addItemToOrder } = await shopClient.query( AddItemToOrderDocument, { productVariantId: 'T_3', quantity: 1, }, { currencyCode: 'EUR' }, ); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder?.lines[0]?.unitPrice).toBe(1100); expect(addItemToOrder?.lines[0]?.unitPriceWithTax).toBe(1320); expect(addItemToOrder?.lines[1]?.unitPrice).toBe(2100); expect(addItemToOrder?.lines[1]?.unitPriceWithTax).toBe(2520); expect(addItemToOrder?.lines[2]?.unitPrice).toBe(3100); expect(addItemToOrder?.lines[2]?.unitPriceWithTax).toBe(3720); expect(addItemToOrder.currencyCode).toBe('EUR'); }); }); describe('ProductVariantPriceUpdateStrategy', () => { const SECOND_CHANNEL_TOKEN = 'second_channel_token'; const THIRD_CHANNEL_TOKEN = 'third_channel_token'; beforeAll(async () => { const { createChannel: channel2Result } = await adminClient.query(CreateChannelDocument, { input: { code: 'second-channel', token: SECOND_CHANNEL_TOKEN, defaultLanguageCode: LanguageCode.en, currencyCode: CurrencyCode.GBP, pricesIncludeTax: true, defaultShippingZoneId: 'T_1', defaultTaxZoneId: 'T_1', }, }); createChannelResultGuard.assertSuccess(channel2Result); const { createChannel: channel3Result } = await adminClient.query(CreateChannelDocument, { input: { code: 'third-channel', token: THIRD_CHANNEL_TOKEN, defaultLanguageCode: LanguageCode.en, currencyCode: CurrencyCode.GBP, pricesIncludeTax: true, defaultShippingZoneId: 'T_1', defaultTaxZoneId: 'T_1', }, }); createChannelResultGuard.assertSuccess(channel3Result); await adminClient.query(AssignProductsToChannelDocument, { input: { channelId: channel2Result.id, productIds: [multiPriceProduct.id], }, }); await adminClient.query(AssignProductsToChannelDocument, { input: { channelId: channel3Result.id, productIds: [multiPriceProduct.id], }, }); }); it('onPriceCreated() is called when a new price is created', async () => { await adminClient.asSuperAdmin(); const onCreatedSpy = TestProductVariantPriceUpdateStrategy.onCreatedSpy; onCreatedSpy.mockClear(); await adminClient.query(UpdateChannelDocument, { input: { id: 'T_1', availableCurrencyCodes: [ CurrencyCode.USD, CurrencyCode.GBP, CurrencyCode.EUR, CurrencyCode.MYR, ], }, }); await adminClient.query(UpdateProductVariantsDocument, { input: { id: multiPriceVariant.id, prices: [{ currencyCode: CurrencyCode.MYR, price: 5500 }], }, }); expect(onCreatedSpy).toHaveBeenCalledTimes(1); expect(onCreatedSpy.mock.calls[0][0].currencyCode).toBe(CurrencyCode.MYR); expect(onCreatedSpy.mock.calls[0][0].price).toBe(5500); expect(onCreatedSpy.mock.calls[0][1].length).toBe(4); expect(getOrderedPricesArray(onCreatedSpy.mock.calls[0][1])).toEqual([ { channelId: 1, currencyCode: 'USD', id: 35, price: 1200, }, { channelId: 1, currencyCode: 'GBP', id: 36, price: 900, }, { channelId: 2, currencyCode: 'GBP', id: 44, price: 1440, }, { channelId: 3, currencyCode: 'GBP', id: 45, price: 1440, }, ]); }); it('onPriceUpdated() is called when a new price is created', async () => { adminClient.setChannelToken(THIRD_CHANNEL_TOKEN); TestProductVariantPriceUpdateStrategy.syncAcrossChannels = true; const onUpdatedSpy = TestProductVariantPriceUpdateStrategy.onUpdatedSpy; onUpdatedSpy.mockClear(); await adminClient.query(UpdateProductVariantsDocument, { input: { id: multiPriceVariant.id, prices: [ { currencyCode: CurrencyCode.GBP, price: 4242, }, ], }, }); expect(onUpdatedSpy).toHaveBeenCalledTimes(1); expect(onUpdatedSpy.mock.calls[0][0].currencyCode).toBe(CurrencyCode.GBP); expect(onUpdatedSpy.mock.calls[0][0].price).toBe(4242); expect(onUpdatedSpy.mock.calls[0][1].length).toBe(5); expect(getOrderedPricesArray(onUpdatedSpy.mock.calls[0][1])).toEqual([ { channelId: 1, currencyCode: 'USD', id: 35, price: 1200, }, { channelId: 1, currencyCode: 'GBP', id: 36, price: 900, }, { channelId: 2, currencyCode: 'GBP', id: 44, price: 1440, }, { channelId: 3, currencyCode: 'GBP', id: 45, price: 4242, }, { channelId: 1, currencyCode: 'MYR', id: 46, price: 5500, }, ]); }); it('syncing prices in other channels', async () => { const { product: productChannel3 } = await adminClient.query(GetProductWithVariantsDocument, { id: multiPriceProduct.id, }); expect(productChannel3?.variants[0].prices).toEqual([ { currencyCode: CurrencyCode.GBP, price: 4242 }, ]); adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { product: productChannel2 } = await adminClient.query(GetProductWithVariantsDocument, { id: multiPriceProduct.id, }); expect(productChannel2?.variants[0].prices).toEqual([ { currencyCode: CurrencyCode.GBP, price: 4242 }, ]); adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { product: productDefaultChannel } = await adminClient.query( GetProductWithVariantsDocument, { id: multiPriceProduct.id, }, ); expect(productDefaultChannel?.variants[0].prices).toEqual([ { currencyCode: CurrencyCode.USD, price: 1200 }, { currencyCode: CurrencyCode.GBP, price: 4242 }, { currencyCode: CurrencyCode.MYR, price: 5500 }, ]); }); it('onPriceDeleted() is called when a price is deleted', async () => { adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const onDeletedSpy = TestProductVariantPriceUpdateStrategy.onDeletedSpy; onDeletedSpy.mockClear(); const result = await adminClient.query(UpdateProductVariantsDocument, { input: { id: multiPriceVariant.id, prices: [ { currencyCode: CurrencyCode.MYR, price: 4242, delete: true, }, ], }, }); expect(result.updateProductVariants[0]?.prices).toEqual([ { currencyCode: CurrencyCode.USD, price: 1200 }, { currencyCode: CurrencyCode.GBP, price: 4242 }, ]); expect(onDeletedSpy).toHaveBeenCalledTimes(1); expect(onDeletedSpy.mock.calls[0][0].currencyCode).toBe(CurrencyCode.MYR); expect(onDeletedSpy.mock.calls[0][0].price).toBe(5500); expect(onDeletedSpy.mock.calls[0][1].length).toBe(4); expect(getOrderedPricesArray(onDeletedSpy.mock.calls[0][1])).toEqual([ { channelId: 1, currencyCode: 'USD', id: 35, price: 1200, }, { channelId: 1, currencyCode: 'GBP', id: 36, price: 4242, }, { channelId: 2, currencyCode: 'GBP', id: 44, price: 4242, }, { channelId: 3, currencyCode: 'GBP', id: 45, price: 4242, }, ]); }); }); }); function getOrderedPricesArray(input: ProductVariantPrice[]) { return input .map(p => pick(p, ['channelId', 'currencyCode', 'price', 'id'])) .sort((a, b) => (a.id < b.id ? -1 : 1)); }
import { omit } from '@vendure/common/lib/omit'; import { pick } from '@vendure/common/lib/pick'; import { notNullOrUndefined } from '@vendure/common/lib/shared-utils'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-config'; import { PRODUCT_VARIANT_FRAGMENT, PRODUCT_WITH_OPTIONS_FRAGMENT } from './graphql/fragments'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { DeletionResult, ErrorCode, LanguageCode, SortOrder, UpdateChannelDocument, } from './graphql/generated-e2e-admin-types'; import { ADD_OPTION_GROUP_TO_PRODUCT, CREATE_PRODUCT, CREATE_PRODUCT_OPTION_GROUP, CREATE_PRODUCT_VARIANTS, DELETE_PRODUCT, DELETE_PRODUCT_VARIANT, GET_ASSET_LIST, GET_PRODUCT_LIST, GET_PRODUCT_SIMPLE, GET_PRODUCT_VARIANT_LIST, GET_PRODUCT_WITH_VARIANTS, UPDATE_GLOBAL_SETTINGS, UPDATE_PRODUCT, UPDATE_PRODUCT_VARIANTS, } from './graphql/shared-definitions'; import { assertThrowsWithMessage } from './utils/assert-throws-with-message'; /* eslint-disable @typescript-eslint/no-non-null-assertion */ describe('Product resolver', () => { const { server, adminClient, shopClient } = createTestEnvironment({ ...testConfig(), }); const removeOptionGuard: ErrorResultGuard<Codegen.ProductWithOptionsFragment> = createErrorResultGuard( input => !!input.optionGroups, ); const updateChannelGuard: ErrorResultGuard<Codegen.ChannelFragment> = createErrorResultGuard( input => !!input.id, ); beforeAll(async () => { await server.init({ initialData, customerCount: 1, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); describe('products list query', () => { it('returns all products when no options passed', async () => { const result = await adminClient.query< Codegen.GetProductListQuery, Codegen.GetProductListQueryVariables >(GET_PRODUCT_LIST, {}); expect(result.products.items.length).toBe(20); expect(result.products.totalItems).toBe(20); }); it('limits result set with skip & take', async () => { const result = await adminClient.query< Codegen.GetProductListQuery, Codegen.GetProductListQueryVariables >(GET_PRODUCT_LIST, { options: { skip: 0, take: 3, }, }); expect(result.products.items.length).toBe(3); expect(result.products.totalItems).toBe(20); }); it('filters by name admin', async () => { const result = await adminClient.query< Codegen.GetProductListQuery, Codegen.GetProductListQueryVariables >(GET_PRODUCT_LIST, { options: { filter: { name: { contains: 'skateboard', }, }, }, }); expect(result.products.items.length).toBe(1); expect(result.products.items[0].name).toBe('Cruiser Skateboard'); }); it('filters multiple admin', async () => { const result = await adminClient.query< Codegen.GetProductListQuery, Codegen.GetProductListQueryVariables >(GET_PRODUCT_LIST, { options: { filter: { name: { contains: 'camera', }, slug: { contains: 'tent', }, }, }, }); expect(result.products.items.length).toBe(0); }); it('sorts by name admin', async () => { const result = await adminClient.query< Codegen.GetProductListQuery, Codegen.GetProductListQueryVariables >(GET_PRODUCT_LIST, { options: { sort: { name: SortOrder.ASC, }, }, }); expect(result.products.items.map(p => p.name)).toEqual([ 'Bonsai Tree', 'Boxing Gloves', 'Camera Lens', 'Clacky Keyboard', 'Cruiser Skateboard', 'Curvy Monitor', 'Football', 'Gaming PC', 'Hard Drive', 'Instant Camera', 'Laptop', 'Orchid', 'Road Bike', 'Running Shoe', 'Skipping Rope', 'Slr Camera', 'Spiky Cactus', 'Tent', 'Tripod', 'USB Cable', ]); }); it('filters by name shop', async () => { const result = await shopClient.query< Codegen.GetProductListQuery, Codegen.GetProductListQueryVariables >(GET_PRODUCT_LIST, { options: { filter: { name: { contains: 'skateboard', }, }, }, }); expect(result.products.items.length).toBe(1); expect(result.products.items[0].name).toBe('Cruiser Skateboard'); }); it('filters by sku admin', async () => { const result = await adminClient.query< Codegen.GetProductListQuery, Codegen.GetProductListQueryVariables >(GET_PRODUCT_LIST, { options: { filter: { sku: { contains: 'IHD455T1', }, }, }, }); expect(result.products.items.length).toBe(1); expect(result.products.items[0].name).toBe('Hard Drive'); }); it('sorts by name shop', async () => { const result = await shopClient.query< Codegen.GetProductListQuery, Codegen.GetProductListQueryVariables >(GET_PRODUCT_LIST, { options: { sort: { name: SortOrder.ASC, }, }, }); expect(result.products.items.map(p => p.name)).toEqual([ 'Bonsai Tree', 'Boxing Gloves', 'Camera Lens', 'Clacky Keyboard', 'Cruiser Skateboard', 'Curvy Monitor', 'Football', 'Gaming PC', 'Hard Drive', 'Instant Camera', 'Laptop', 'Orchid', 'Road Bike', 'Running Shoe', 'Skipping Rope', 'Slr Camera', 'Spiky Cactus', 'Tent', 'Tripod', 'USB Cable', ]); }); }); describe('product query', () => { it('by id', async () => { const { product } = await adminClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { id: 'T_2' }); if (!product) { fail('Product not found'); return; } expect(product.id).toBe('T_2'); }); it('by slug', async () => { const { product } = await adminClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { slug: 'curvy-monitor' }); if (!product) { fail('Product not found'); return; } expect(product.slug).toBe('curvy-monitor'); }); // https://github.com/vendure-ecommerce/vendure/issues/820 it('by slug with multiple assets', async () => { const { product: product1 } = await adminClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { id: 'T_1' }); const result = await adminClient.query< Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables >(UPDATE_PRODUCT, { input: { id: product1!.id, assetIds: ['T_1', 'T_2', 'T_3'], }, }); const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { slug: product1!.slug }); if (!product) { fail('Product not found'); return; } expect(product.assets.map(a => a.id)).toEqual(['T_1', 'T_2', 'T_3']); }); // https://github.com/vendure-ecommerce/vendure/issues/538 it('falls back to default language slug', async () => { const { product } = await adminClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { slug: 'curvy-monitor' }, { languageCode: LanguageCode.de }); if (!product) { fail('Product not found'); return; } expect(product.slug).toBe('curvy-monitor'); }); it( 'throws if neither id nor slug provided', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, {}); }, 'Either the Product id or slug must be provided'), ); it( 'throws if id and slug do not refer to the same Product', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { id: 'T_2', slug: 'laptop', }); }, 'The provided id and slug refer to different Products'), ); it('returns expected properties', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_2', }); if (!product) { fail('Product not found'); return; } expect(omit(product, ['variants'])).toMatchSnapshot(); expect(product.variants.length).toBe(2); }); it('ProductVariant price properties are correct', async () => { const result = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_2', }); if (!result.product) { fail('Product not found'); return; } expect(result.product.variants[0].price).toBe(14374); expect(result.product.variants[0].taxCategory).toEqual({ id: 'T_1', name: 'Standard Tax', }); }); it('returns null when id not found', async () => { const result = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'bad_id', }); expect(result.product).toBeNull(); }); it('returns null when slug not found', async () => { const result = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { slug: 'bad_slug', }); expect(result.product).toBeNull(); }); describe('product query with translations', () => { let translatedProduct: Codegen.ProductWithVariantsFragment; let en_translation: Codegen.ProductWithVariantsFragment['translations'][number]; let de_translation: Codegen.ProductWithVariantsFragment['translations'][number]; beforeAll(async () => { const result = await adminClient.query< Codegen.CreateProductMutation, Codegen.CreateProductMutationVariables >(CREATE_PRODUCT, { input: { translations: [ { languageCode: LanguageCode.en, name: 'en Pineapple', slug: 'en-pineapple', description: 'A delicious pineapple', }, { languageCode: LanguageCode.de, name: 'de Ananas', slug: 'de-ananas', description: 'Eine köstliche Ananas', }, ], }, }); translatedProduct = result.createProduct; en_translation = translatedProduct.translations.find( t => t.languageCode === LanguageCode.en, )!; de_translation = translatedProduct.translations.find( t => t.languageCode === LanguageCode.de, )!; }); it('en slug without translation arg', async () => { const { product } = await adminClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { slug: en_translation.slug }); if (!product) { fail('Product not found'); return; } expect(product.slug).toBe(en_translation.slug); }); it('de slug without translation arg', async () => { const { product } = await adminClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { slug: de_translation.slug }); if (!product) { fail('Product not found'); return; } expect(product.slug).toBe(en_translation.slug); }); it('en slug with translation en', async () => { const { product } = await adminClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { slug: en_translation.slug }, { languageCode: LanguageCode.en }); if (!product) { fail('Product not found'); return; } expect(product.slug).toBe(en_translation.slug); }); it('de slug with translation en', async () => { const { product } = await adminClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { slug: de_translation.slug }, { languageCode: LanguageCode.en }); if (!product) { fail('Product not found'); return; } expect(product.slug).toBe(en_translation.slug); }); it('en slug with translation de', async () => { const { product } = await adminClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { slug: en_translation.slug }, { languageCode: LanguageCode.de }); if (!product) { fail('Product not found'); return; } expect(product.slug).toBe(de_translation.slug); }); it('de slug with translation de', async () => { const { product } = await adminClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { slug: de_translation.slug }, { languageCode: LanguageCode.de }); if (!product) { fail('Product not found'); return; } expect(product.slug).toBe(de_translation.slug); }); it('de slug with translation ru', async () => { const { product } = await adminClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { slug: de_translation.slug }, { languageCode: LanguageCode.ru }); if (!product) { fail('Product not found'); return; } expect(product.slug).toBe(en_translation.slug); }); }); describe('product.variants', () => { it('returns product variants', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }); expect(product?.variants.length).toBe(4); }); it('returns product variants in existing language', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >( GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }, { languageCode: LanguageCode.en }, ); expect(product?.variants.length).toBe(4); }); it('returns product variants in non-existing language', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >( GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }, { languageCode: LanguageCode.ru }, ); expect(product?.variants.length).toBe(4); }); }); describe('product.variants', () => { it('returns product variants', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }); expect(product?.variants.length).toBe(4); }); it('returns product variants in existing language', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >( GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }, { languageCode: LanguageCode.en }, ); expect(product?.variants.length).toBe(4); }); it('returns product variants in non-existing language', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >( GET_PRODUCT_WITH_VARIANTS, { id: 'T_1', }, { languageCode: LanguageCode.ru }, ); expect(product?.variants.length).toBe(4); }); }); describe('product.variantList', () => { it('returns product variants', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantListQuery, Codegen.GetProductWithVariantListQueryVariables >(GET_PRODUCT_WITH_VARIANT_LIST, { id: 'T_1', }); expect(product?.variantList.items.length).toBe(4); expect(product?.variantList.totalItems).toBe(4); }); it('returns product variants in existing language', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantListQuery, Codegen.GetProductWithVariantListQueryVariables >( GET_PRODUCT_WITH_VARIANT_LIST, { id: 'T_1', }, { languageCode: LanguageCode.en }, ); expect(product?.variantList.items.length).toBe(4); }); it('returns product variants in non-existing language', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantListQuery, Codegen.GetProductWithVariantListQueryVariables >( GET_PRODUCT_WITH_VARIANT_LIST, { id: 'T_1', }, { languageCode: LanguageCode.ru }, ); expect(product?.variantList.items.length).toBe(4); }); it('filter & sort', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantListQuery, Codegen.GetProductWithVariantListQueryVariables >(GET_PRODUCT_WITH_VARIANT_LIST, { id: 'T_1', variantListOptions: { filter: { name: { contains: '15', }, }, sort: { price: SortOrder.DESC, }, }, }); expect(product?.variantList.items.map(i => i.name)).toEqual([ 'Laptop 15 inch 16GB', 'Laptop 15 inch 8GB', ]); }); }); }); describe('productVariants list query', () => { it('returns list', async () => { const { productVariants } = await adminClient.query< Codegen.GetProductVariantListQuery, Codegen.GetProductVariantListQueryVariables >(GET_PRODUCT_VARIANT_LIST, { options: { take: 3, sort: { name: SortOrder.ASC, }, }, }); expect( productVariants.items.map(i => pick(i, ['id', 'name', 'price', 'priceWithTax', 'sku'])), ).toEqual([ { id: 'T_34', name: 'Bonsai Tree', price: 1999, priceWithTax: 2399, sku: 'B01MXFLUSV', }, { id: 'T_24', name: 'Boxing Gloves', price: 3304, priceWithTax: 3965, sku: 'B000ZYLPPU', }, { id: 'T_19', name: 'Camera Lens', price: 10400, priceWithTax: 12480, sku: 'B0012UUP02', }, ]); }); it('sort by price', async () => { const { productVariants } = await adminClient.query< Codegen.GetProductVariantListQuery, Codegen.GetProductVariantListQueryVariables >(GET_PRODUCT_VARIANT_LIST, { options: { take: 3, sort: { price: SortOrder.ASC, }, }, }); expect( productVariants.items.map(i => pick(i, ['id', 'name', 'price', 'priceWithTax', 'sku'])), ).toEqual([ { id: 'T_23', name: 'Skipping Rope', price: 799, priceWithTax: 959, sku: 'B07CNGXVXT', }, { id: 'T_20', name: 'Tripod', price: 1498, priceWithTax: 1798, sku: 'B00XI87KV8', }, { id: 'T_32', name: 'Spiky Cactus', price: 1550, priceWithTax: 1860, sku: 'SC011001', }, ]); }); it('sort by priceWithTax', async () => { const { productVariants } = await adminClient.query< Codegen.GetProductVariantListQuery, Codegen.GetProductVariantListQueryVariables >(GET_PRODUCT_VARIANT_LIST, { options: { take: 3, sort: { priceWithTax: SortOrder.ASC, }, }, }); expect( productVariants.items.map(i => pick(i, ['id', 'name', 'price', 'priceWithTax', 'sku'])), ).toEqual([ { id: 'T_23', name: 'Skipping Rope', price: 799, priceWithTax: 959, sku: 'B07CNGXVXT', }, { id: 'T_20', name: 'Tripod', price: 1498, priceWithTax: 1798, sku: 'B00XI87KV8', }, { id: 'T_32', name: 'Spiky Cactus', price: 1550, priceWithTax: 1860, sku: 'SC011001', }, ]); }); it('filter by price', async () => { const { productVariants } = await adminClient.query< Codegen.GetProductVariantListQuery, Codegen.GetProductVariantListQueryVariables >(GET_PRODUCT_VARIANT_LIST, { options: { take: 3, filter: { price: { between: { start: 1400, end: 1500, }, }, }, }, }); expect( productVariants.items.map(i => pick(i, ['id', 'name', 'price', 'priceWithTax', 'sku'])), ).toEqual([ { id: 'T_20', name: 'Tripod', price: 1498, priceWithTax: 1798, sku: 'B00XI87KV8', }, ]); }); it('filter by priceWithTax', async () => { const { productVariants } = await adminClient.query< Codegen.GetProductVariantListQuery, Codegen.GetProductVariantListQueryVariables >(GET_PRODUCT_VARIANT_LIST, { options: { take: 3, filter: { priceWithTax: { between: { start: 1400, end: 1500, }, }, }, }, }); // Note the results are incorrect. This is a design trade-off. See the // commend on the ProductVariant.priceWithTax annotation for explanation. expect( productVariants.items.map(i => pick(i, ['id', 'name', 'price', 'priceWithTax', 'sku'])), ).toEqual([ { id: 'T_20', name: 'Tripod', price: 1498, priceWithTax: 1798, sku: 'B00XI87KV8', }, ]); }); it('returns variants for particular product by id', async () => { const { productVariants } = await adminClient.query< Codegen.GetProductVariantListQuery, Codegen.GetProductVariantListQueryVariables >(GET_PRODUCT_VARIANT_LIST, { options: { take: 3, sort: { price: SortOrder.ASC, }, }, productId: 'T_1', }); expect( productVariants.items.map(i => pick(i, ['id', 'name', 'price', 'priceWithTax', 'sku'])), ).toEqual([ { id: 'T_1', name: 'Laptop 13 inch 8GB', price: 129900, priceWithTax: 155880, sku: 'L2201308', }, { id: 'T_2', name: 'Laptop 15 inch 8GB', price: 139900, priceWithTax: 167880, sku: 'L2201508', }, { id: 'T_3', name: 'Laptop 13 inch 16GB', priceWithTax: 263880, price: 219900, sku: 'L2201316', }, ]); }); }); describe('productVariant query', () => { it('by id', async () => { const { productVariant } = await adminClient.query< Codegen.GetProductVariantQuery, Codegen.GetProductVariantQueryVariables >(GET_PRODUCT_VARIANT, { id: 'T_1', }); expect(productVariant?.id).toBe('T_1'); expect(productVariant?.name).toBe('Laptop 13 inch 8GB'); }); it('returns null when id not found', async () => { const { productVariant } = await adminClient.query< Codegen.GetProductVariantQuery, Codegen.GetProductVariantQueryVariables >(GET_PRODUCT_VARIANT, { id: 'T_999', }); expect(productVariant).toBeNull(); }); }); describe('product mutation', () => { let newTranslatedProduct: Codegen.ProductWithVariantsFragment; let newProduct: Codegen.ProductWithVariantsFragment; let newProductWithAssets: Codegen.ProductWithVariantsFragment; it('createProduct creates a new Product', async () => { const result = await adminClient.query< Codegen.CreateProductMutation, Codegen.CreateProductMutationVariables >(CREATE_PRODUCT, { input: { translations: [ { languageCode: LanguageCode.en, name: 'en Baked Potato', slug: 'en Baked Potato', description: 'A baked potato', }, { languageCode: LanguageCode.de, name: 'de Baked Potato', slug: 'de-baked-potato', description: 'Eine baked Erdapfel', }, ], }, }); expect(omit(result.createProduct, ['translations'])).toMatchSnapshot(); expect(result.createProduct.translations.map(t => t.description).sort()).toEqual([ 'A baked potato', 'Eine baked Erdapfel', ]); newTranslatedProduct = result.createProduct; }); it('createProduct creates a new Product with assets', async () => { const assetsResult = await adminClient.query< Codegen.GetAssetListQuery, Codegen.GetAssetListQueryVariables >(GET_ASSET_LIST); const assetIds = assetsResult.assets.items.slice(0, 2).map(a => a.id); const featuredAssetId = assetsResult.assets.items[0].id; const result = await adminClient.query< Codegen.CreateProductMutation, Codegen.CreateProductMutationVariables >(CREATE_PRODUCT, { input: { assetIds, featuredAssetId, translations: [ { languageCode: LanguageCode.en, name: 'en Has Assets', slug: 'en-has-assets', description: 'A product with assets', }, ], }, }); expect(result.createProduct.assets.map(a => a.id)).toEqual(assetIds); expect(result.createProduct.featuredAsset!.id).toBe(featuredAssetId); newProductWithAssets = result.createProduct; }); it('createProduct creates a disabled Product', async () => { const result = await adminClient.query< Codegen.CreateProductMutation, Codegen.CreateProductMutationVariables >(CREATE_PRODUCT, { input: { enabled: false, translations: [ { languageCode: LanguageCode.en, name: 'en Small apple', slug: 'en-small-apple', description: 'A small apple', }, ], }, }); expect(result.createProduct.enabled).toBe(false); newProduct = result.createProduct; }); it('updateProduct updates a Product', async () => { const result = await adminClient.query< Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables >(UPDATE_PRODUCT, { input: { id: newProduct.id, translations: [ { languageCode: LanguageCode.en, name: 'en Mashed Potato', slug: 'en-mashed-potato', description: 'A blob of mashed potato', }, { languageCode: LanguageCode.de, name: 'de Mashed Potato', slug: 'de-mashed-potato', description: 'Eine blob von gemashed Erdapfel', }, ], }, }); expect(result.updateProduct.translations.map(t => t.description).sort()).toEqual([ 'A blob of mashed potato', 'Eine blob von gemashed Erdapfel', ]); }); it('slug is normalized to be url-safe', async () => { const result = await adminClient.query< Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables >(UPDATE_PRODUCT, { input: { id: newProduct.id, translations: [ { languageCode: LanguageCode.en, name: 'en Mashed Potato', slug: 'A (very) nice potato!!', description: 'A blob of mashed potato', }, ], }, }); expect(result.updateProduct.slug).toBe('a-very-nice-potato'); }); it('create with duplicate slug is renamed to be unique', async () => { const result = await adminClient.query< Codegen.CreateProductMutation, Codegen.CreateProductMutationVariables >(CREATE_PRODUCT, { input: { translations: [ { languageCode: LanguageCode.en, name: 'Another baked potato', slug: 'a-very-nice-potato', description: 'Another baked potato but a bit different', }, ], }, }); expect(result.createProduct.slug).toBe('a-very-nice-potato-2'); }); it('update with duplicate slug is renamed to be unique', async () => { const result = await adminClient.query< Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables >(UPDATE_PRODUCT, { input: { id: newProduct.id, translations: [ { languageCode: LanguageCode.en, name: 'Yet another baked potato', slug: 'a-very-nice-potato-2', description: 'Possibly the final baked potato', }, ], }, }); expect(result.updateProduct.slug).toBe('a-very-nice-potato-3'); }); it('slug duplicate check does not include self', async () => { const result = await adminClient.query< Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables >(UPDATE_PRODUCT, { input: { id: newProduct.id, translations: [ { languageCode: LanguageCode.en, slug: 'a-very-nice-potato-3', }, ], }, }); expect(result.updateProduct.slug).toBe('a-very-nice-potato-3'); }); it('updateProduct accepts partial input', async () => { const result = await adminClient.query< Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables >(UPDATE_PRODUCT, { input: { id: newProduct.id, translations: [ { languageCode: LanguageCode.en, name: 'en Very Mashed Potato', }, ], }, }); expect(result.updateProduct.translations.length).toBe(2); expect( result.updateProduct.translations.find(t => t.languageCode === LanguageCode.de)!.name, ).toBe('de Mashed Potato'); expect( result.updateProduct.translations.find(t => t.languageCode === LanguageCode.en)!.name, ).toBe('en Very Mashed Potato'); expect( result.updateProduct.translations.find(t => t.languageCode === LanguageCode.en)!.description, ).toBe('Possibly the final baked potato'); }); it('updateProduct adds Assets to a product and sets featured asset', async () => { const assetsResult = await adminClient.query< Codegen.GetAssetListQuery, Codegen.GetAssetListQueryVariables >(GET_ASSET_LIST); const assetIds = assetsResult.assets.items.map(a => a.id); const featuredAssetId = assetsResult.assets.items[2].id; const result = await adminClient.query< Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables >(UPDATE_PRODUCT, { input: { id: newProduct.id, assetIds, featuredAssetId, }, }); expect(result.updateProduct.assets.map(a => a.id)).toEqual(assetIds); expect(result.updateProduct.featuredAsset!.id).toBe(featuredAssetId); }); it('updateProduct sets a featured asset', async () => { const productResult = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: newProduct.id, }); const assets = productResult.product!.assets; const result = await adminClient.query< Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables >(UPDATE_PRODUCT, { input: { id: newProduct.id, featuredAssetId: assets[0].id, }, }); expect(result.updateProduct.featuredAsset!.id).toBe(assets[0].id); }); it('updateProduct updates assets', async () => { const result = await adminClient.query< Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables >(UPDATE_PRODUCT, { input: { id: newProduct.id, featuredAssetId: 'T_1', assetIds: ['T_1', 'T_2'], }, }); expect(result.updateProduct.assets.map(a => a.id)).toEqual(['T_1', 'T_2']); }); it('updateProduct updates FacetValues', async () => { const result = await adminClient.query< Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables >(UPDATE_PRODUCT, { input: { id: newProduct.id, facetValueIds: ['T_1'], }, }); expect(result.updateProduct.facetValues.length).toEqual(1); }); it( 'updateProduct errors with an invalid productId', assertThrowsWithMessage( () => adminClient.query<Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables>( UPDATE_PRODUCT, { input: { id: '999', translations: [ { languageCode: LanguageCode.en, name: 'en Mashed Potato', slug: 'en-mashed-potato', description: 'A blob of mashed potato', }, { languageCode: LanguageCode.de, name: 'de Mashed Potato', slug: 'de-mashed-potato', description: 'Eine blob von gemashed Erdapfel', }, ], }, }, ), 'No Product with the id "999" could be found', ), ); it('addOptionGroupToProduct adds an option group', async () => { const optionGroup = await createOptionGroup('Quark-type', ['Charm', 'Strange']); const result = await adminClient.query< Codegen.AddOptionGroupToProductMutation, Codegen.AddOptionGroupToProductMutationVariables >(ADD_OPTION_GROUP_TO_PRODUCT, { optionGroupId: optionGroup.id, productId: newProduct.id, }); expect(result.addOptionGroupToProduct.optionGroups.length).toBe(1); expect(result.addOptionGroupToProduct.optionGroups[0].id).toBe(optionGroup.id); // not really testing this, but just cleaning up for later tests const { removeOptionGroupFromProduct } = await adminClient.query< Codegen.RemoveOptionGroupFromProductMutation, Codegen.RemoveOptionGroupFromProductMutationVariables >(REMOVE_OPTION_GROUP_FROM_PRODUCT, { optionGroupId: optionGroup.id, productId: newProduct.id, }); removeOptionGuard.assertSuccess(removeOptionGroupFromProduct); }); it( 'addOptionGroupToProduct errors with an invalid productId', assertThrowsWithMessage( () => adminClient.query< Codegen.AddOptionGroupToProductMutation, Codegen.AddOptionGroupToProductMutationVariables >(ADD_OPTION_GROUP_TO_PRODUCT, { optionGroupId: 'T_1', productId: 'T_999', }), 'No Product with the id "999" could be found', ), ); it( 'addOptionGroupToProduct errors if the OptionGroup is already assigned to another Product', assertThrowsWithMessage( () => adminClient.query< Codegen.AddOptionGroupToProductMutation, Codegen.AddOptionGroupToProductMutationVariables >(ADD_OPTION_GROUP_TO_PRODUCT, { optionGroupId: 'T_1', productId: 'T_2', }), 'The ProductOptionGroup "laptop-screen-size" is already assigned to the Product "Laptop"', ), ); it( 'addOptionGroupToProduct errors with an invalid optionGroupId', assertThrowsWithMessage( () => adminClient.query< Codegen.AddOptionGroupToProductMutation, Codegen.AddOptionGroupToProductMutationVariables >(ADD_OPTION_GROUP_TO_PRODUCT, { optionGroupId: '999', productId: newProduct.id, }), 'No ProductOptionGroup with the id "999" could be found', ), ); it('removeOptionGroupFromProduct removes an option group', async () => { const optionGroup = await createOptionGroup('Length', ['Short', 'Long']); const { addOptionGroupToProduct } = await adminClient.query< Codegen.AddOptionGroupToProductMutation, Codegen.AddOptionGroupToProductMutationVariables >(ADD_OPTION_GROUP_TO_PRODUCT, { optionGroupId: optionGroup.id, productId: newProductWithAssets.id, }); expect(addOptionGroupToProduct.optionGroups.length).toBe(1); const { removeOptionGroupFromProduct } = await adminClient.query< Codegen.RemoveOptionGroupFromProductMutation, Codegen.RemoveOptionGroupFromProductMutationVariables >(REMOVE_OPTION_GROUP_FROM_PRODUCT, { optionGroupId: optionGroup.id, productId: newProductWithAssets.id, }); removeOptionGuard.assertSuccess(removeOptionGroupFromProduct); expect(removeOptionGroupFromProduct.id).toBe(newProductWithAssets.id); expect(removeOptionGroupFromProduct.optionGroups.length).toBe(0); }); it('removeOptionGroupFromProduct return error result if the optionGroup is being used by variants', async () => { const { removeOptionGroupFromProduct } = await adminClient.query< Codegen.RemoveOptionGroupFromProductMutation, Codegen.RemoveOptionGroupFromProductMutationVariables >(REMOVE_OPTION_GROUP_FROM_PRODUCT, { optionGroupId: 'T_3', productId: 'T_2', }); removeOptionGuard.assertErrorResult(removeOptionGroupFromProduct); expect(removeOptionGroupFromProduct.message).toBe( 'Cannot remove ProductOptionGroup "curvy-monitor-monitor-size" as it is used by 2 ProductVariants. Use the `force` argument to remove it anyway', ); expect(removeOptionGroupFromProduct.errorCode).toBe(ErrorCode.PRODUCT_OPTION_IN_USE_ERROR); expect(removeOptionGroupFromProduct.optionGroupCode).toBe('curvy-monitor-monitor-size'); expect(removeOptionGroupFromProduct.productVariantCount).toBe(2); }); it('removeOptionGroupFromProduct succeeds if all related ProductVariants are also deleted', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_2' }); // Delete all variants for that product for (const variant of product!.variants) { await adminClient.query< Codegen.DeleteProductVariantMutation, Codegen.DeleteProductVariantMutationVariables >(DELETE_PRODUCT_VARIANT, { id: variant.id, }); } const { removeOptionGroupFromProduct } = await adminClient.query< Codegen.RemoveOptionGroupFromProductMutation, Codegen.RemoveOptionGroupFromProductMutationVariables >(REMOVE_OPTION_GROUP_FROM_PRODUCT, { optionGroupId: product!.optionGroups[0].id, productId: product!.id, }); removeOptionGuard.assertSuccess(removeOptionGroupFromProduct); }); it( 'removeOptionGroupFromProduct errors with an invalid productId', assertThrowsWithMessage( () => adminClient.query< Codegen.RemoveOptionGroupFromProductMutation, Codegen.RemoveOptionGroupFromProductMutationVariables >(REMOVE_OPTION_GROUP_FROM_PRODUCT, { optionGroupId: '1', productId: '999', }), 'No Product with the id "999" could be found', ), ); it( 'removeOptionGroupFromProduct errors with an invalid optionGroupId', assertThrowsWithMessage( () => adminClient.query< Codegen.RemoveOptionGroupFromProductMutation, Codegen.RemoveOptionGroupFromProductMutationVariables >(REMOVE_OPTION_GROUP_FROM_PRODUCT, { optionGroupId: '999', productId: newProduct.id, }), 'No ProductOptionGroup with the id "999" could be found', ), ); describe('variants', () => { let variants: Codegen.CreateProductVariantsMutation['createProductVariants']; let optionGroup2: NonNullable<Codegen.GetOptionGroupQuery['productOptionGroup']>; let optionGroup3: NonNullable<Codegen.GetOptionGroupQuery['productOptionGroup']>; beforeAll(async () => { optionGroup2 = await createOptionGroup('group-2', ['group2-option-1', 'group2-option-2']); optionGroup3 = await createOptionGroup('group-3', ['group3-option-1', 'group3-option-2']); await adminClient.query< Codegen.AddOptionGroupToProductMutation, Codegen.AddOptionGroupToProductMutationVariables >(ADD_OPTION_GROUP_TO_PRODUCT, { optionGroupId: optionGroup2.id, productId: newProduct.id, }); await adminClient.query< Codegen.AddOptionGroupToProductMutation, Codegen.AddOptionGroupToProductMutationVariables >(ADD_OPTION_GROUP_TO_PRODUCT, { optionGroupId: optionGroup3.id, productId: newProduct.id, }); }); it( 'createProductVariants throws if optionIds not compatible with product', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.CreateProductVariantsMutation, Codegen.CreateProductVariantsMutationVariables >(CREATE_PRODUCT_VARIANTS, { input: [ { productId: newProduct.id, sku: 'PV1', optionIds: [], translations: [{ languageCode: LanguageCode.en, name: 'Variant 1' }], }, ], }); }, 'ProductVariant optionIds must include one optionId from each of the groups: group-2, group-3'), ); it( 'createProductVariants throws if optionIds are duplicated', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.CreateProductVariantsMutation, Codegen.CreateProductVariantsMutationVariables >(CREATE_PRODUCT_VARIANTS, { input: [ { productId: newProduct.id, sku: 'PV1', optionIds: [optionGroup2.options[0].id, optionGroup2.options[1].id], translations: [{ languageCode: LanguageCode.en, name: 'Variant 1' }], }, ], }); }, 'ProductVariant optionIds must include one optionId from each of the groups: group-2, group-3'), ); it('createProductVariants works', async () => { const { createProductVariants } = await adminClient.query< Codegen.CreateProductVariantsMutation, Codegen.CreateProductVariantsMutationVariables >(CREATE_PRODUCT_VARIANTS, { input: [ { productId: newProduct.id, sku: 'PV1', optionIds: [optionGroup2.options[0].id, optionGroup3.options[0].id], translations: [{ languageCode: LanguageCode.en, name: 'Variant 1' }], }, ], }); expect(createProductVariants[0]!.name).toBe('Variant 1'); expect(createProductVariants[0]!.options.map(pick(['id']))).toContainEqual({ id: optionGroup2.options[0].id, }); expect(createProductVariants[0]!.options.map(pick(['id']))).toContainEqual({ id: optionGroup3.options[0].id, }); }); it('createProductVariants adds multiple variants at once', async () => { const { createProductVariants } = await adminClient.query< Codegen.CreateProductVariantsMutation, Codegen.CreateProductVariantsMutationVariables >(CREATE_PRODUCT_VARIANTS, { input: [ { productId: newProduct.id, sku: 'PV2', optionIds: [optionGroup2.options[1].id, optionGroup3.options[0].id], translations: [{ languageCode: LanguageCode.en, name: 'Variant 2' }], }, { productId: newProduct.id, sku: 'PV3', optionIds: [optionGroup2.options[1].id, optionGroup3.options[1].id], translations: [{ languageCode: LanguageCode.en, name: 'Variant 3' }], }, ], }); const variant2 = createProductVariants.find(v => v!.name === 'Variant 2')!; const variant3 = createProductVariants.find(v => v!.name === 'Variant 3')!; expect(variant2.options.map(pick(['id']))).toContainEqual({ id: optionGroup2.options[1].id }); expect(variant2.options.map(pick(['id']))).toContainEqual({ id: optionGroup3.options[0].id }); expect(variant3.options.map(pick(['id']))).toContainEqual({ id: optionGroup2.options[1].id }); expect(variant3.options.map(pick(['id']))).toContainEqual({ id: optionGroup3.options[1].id }); variants = createProductVariants.filter(notNullOrUndefined); }); it( 'createProductVariants throws if options combination already exists', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.CreateProductVariantsMutation, Codegen.CreateProductVariantsMutationVariables >(CREATE_PRODUCT_VARIANTS, { input: [ { productId: newProduct.id, sku: 'PV2', optionIds: [optionGroup2.options[0].id, optionGroup3.options[0].id], translations: [{ languageCode: LanguageCode.en, name: 'Variant 2' }], }, ], }); }, 'A ProductVariant with the selected options already exists: Variant 1'), ); it('updateProductVariants updates variants', async () => { const firstVariant = variants[0]; const { updateProductVariants } = await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: firstVariant!.id, translations: firstVariant!.translations, sku: 'ABC', price: 432, }, ], }); const updatedVariant = updateProductVariants[0]; if (!updatedVariant) { fail('no updated variant returned.'); return; } expect(updatedVariant.sku).toBe('ABC'); expect(updatedVariant.price).toBe(432); }); // https://github.com/vendure-ecommerce/vendure/issues/1101 it('after update, the updatedAt should be modified', async () => { // Pause for a second to ensure the updatedAt date is more than 1s // later than the createdAt date, since sqlite does not seem to store // down to millisecond resolution. await new Promise(resolve => setTimeout(resolve, 1000)); const firstVariant = variants[0]; const { updateProductVariants } = await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: firstVariant!.id, translations: firstVariant!.translations, sku: 'ABCD', price: 432, }, ], }); const updatedVariant = updateProductVariants.find(v => v?.id === variants[0]!.id); expect(updatedVariant?.updatedAt).not.toBe(updatedVariant?.createdAt); }); it('updateProductVariants updates assets', async () => { const firstVariant = variants[0]; const result = await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: firstVariant!.id, assetIds: ['T_1', 'T_2'], featuredAssetId: 'T_2', }, ], }); const updatedVariant = result.updateProductVariants[0]; if (!updatedVariant) { fail('no updated variant returned.'); return; } expect(updatedVariant.assets.map(a => a.id)).toEqual(['T_1', 'T_2']); expect(updatedVariant.featuredAsset!.id).toBe('T_2'); }); it('updateProductVariants updates assets again', async () => { const firstVariant = variants[0]; const result = await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: firstVariant!.id, assetIds: ['T_4', 'T_3'], featuredAssetId: 'T_4', }, ], }); const updatedVariant = result.updateProductVariants[0]; if (!updatedVariant) { fail('no updated variant returned.'); return; } expect(updatedVariant.assets.map(a => a.id)).toEqual(['T_4', 'T_3']); expect(updatedVariant.featuredAsset!.id).toBe('T_4'); }); it('updateProductVariants updates taxCategory and price', async () => { const firstVariant = variants[0]; const result = await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: firstVariant!.id, price: 105, taxCategoryId: 'T_2', }, ], }); const updatedVariant = result.updateProductVariants[0]; if (!updatedVariant) { fail('no updated variant returned.'); return; } expect(updatedVariant.price).toBe(105); expect(updatedVariant.taxCategory.id).toBe('T_2'); }); it('updateProductVariants updates facetValues', async () => { const firstVariant = variants[0]; const result = await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: firstVariant!.id, facetValueIds: ['T_1'], }, ], }); const updatedVariant = result.updateProductVariants[0]; if (!updatedVariant) { fail('no updated variant returned.'); return; } expect(updatedVariant.facetValues.length).toBe(1); expect(updatedVariant.facetValues[0].id).toBe('T_1'); }); it( 'updateProductVariants throws with an invalid variant id', assertThrowsWithMessage( () => adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: 'T_999', translations: variants[0]!.translations, sku: 'ABC', price: 432, }, ], }), 'No ProductVariant with the id "999" could be found', ), ); describe('adding options to existing variants', () => { let variantToModify: NonNullable< Codegen.CreateProductVariantsMutation['createProductVariants'][number] >; let initialOptionIds: string[]; let newOptionGroup: Codegen.CreateProductOptionGroupMutation['createProductOptionGroup']; beforeAll(() => { variantToModify = variants[0]!; initialOptionIds = variantToModify.options.map(o => o.id); }); it('assert initial state', async () => { expect(variantToModify.options.map(o => o.code)).toEqual([ 'group2-option-2', 'group3-option-1', ]); }); it( 'passing optionIds from an invalid OptionGroup throws', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: variantToModify.id, optionIds: [...variantToModify.options.map(o => o.id), 'T_1'], }, ], }); }, 'ProductVariant optionIds must include one optionId from each of the groups: group-2, group-3'), ); it( 'passing optionIds that match an existing variant throws', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: variantToModify.id, optionIds: variants[1]!.options.map(o => o.id), }, ], }); }, 'A ProductVariant with the selected options already exists: Variant 3'), ); it('addOptionGroupToProduct and then update existing ProductVariant with a new option', async () => { const optionGroup4 = await createOptionGroup('group-4', [ 'group4-option-1', 'group4-option-2', ]); newOptionGroup = optionGroup4; const result = await adminClient.query< Codegen.AddOptionGroupToProductMutation, Codegen.AddOptionGroupToProductMutationVariables >(ADD_OPTION_GROUP_TO_PRODUCT, { optionGroupId: optionGroup4.id, productId: newProduct.id, }); expect(result.addOptionGroupToProduct.optionGroups.length).toBe(3); expect(result.addOptionGroupToProduct.optionGroups[2].id).toBe(optionGroup4.id); const { updateProductVariants } = await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: variantToModify.id, optionIds: [ ...variantToModify.options.map(o => o.id), optionGroup4.options[0].id, ], }, ], }); expect(updateProductVariants[0]!.options.map(o => o.code)).toEqual([ 'group2-option-2', 'group3-option-1', 'group4-option-1', ]); }); it('removeOptionGroup fails because option is in use', async () => { const { removeOptionGroupFromProduct } = await adminClient.query< Codegen.RemoveOptionGroupFromProductMutation, Codegen.RemoveOptionGroupFromProductMutationVariables >(REMOVE_OPTION_GROUP_FROM_PRODUCT, { optionGroupId: newOptionGroup.id, productId: newProduct.id, }); removeOptionGuard.assertErrorResult(removeOptionGroupFromProduct); expect(removeOptionGroupFromProduct.message).toBe( 'Cannot remove ProductOptionGroup "group-4" as it is used by 3 ProductVariants. Use the `force` argument to remove it anyway', ); }); it('removeOptionGroup with force argument', async () => { const { removeOptionGroupFromProduct } = await adminClient.query< Codegen.RemoveOptionGroupFromProductMutation, Codegen.RemoveOptionGroupFromProductMutationVariables >(REMOVE_OPTION_GROUP_FROM_PRODUCT, { optionGroupId: newOptionGroup.id, productId: newProduct.id, force: true, }); removeOptionGuard.assertSuccess(removeOptionGroupFromProduct); expect(removeOptionGroupFromProduct.optionGroups.length).toBe(2); const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: newProduct.id, }); function assertNoOptionGroup( variant: Codegen.ProductVariantFragment, optionGroupId: string, ) { expect(variant.options.map(o => o.groupId).every(id => id !== optionGroupId)).toBe( true, ); } assertNoOptionGroup(product!.variants[0]!, newOptionGroup.id); assertNoOptionGroup(product!.variants[1]!, newOptionGroup.id); assertNoOptionGroup(product!.variants[2]!, newOptionGroup.id); }); }); let deletedVariant: Codegen.ProductVariantFragment; it('deleteProductVariant', async () => { const result1 = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: newProduct.id, }); const sortedVariantIds = result1.product!.variants.map(v => v.id).sort(); expect(sortedVariantIds).toEqual(['T_35', 'T_36', 'T_37']); const { deleteProductVariant } = await adminClient.query< Codegen.DeleteProductVariantMutation, Codegen.DeleteProductVariantMutationVariables >(DELETE_PRODUCT_VARIANT, { id: sortedVariantIds[0], }); expect(deleteProductVariant.result).toBe(DeletionResult.DELETED); const result2 = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: newProduct.id, }); expect(result2.product!.variants.map(v => v.id).sort()).toEqual(['T_36', 'T_37']); deletedVariant = result1.product!.variants.find(v => v.id === 'T_35')!; }); /** Testing https://github.com/vendure-ecommerce/vendure/issues/412 **/ it('createProductVariants ignores deleted variants when checking for existing combinations', async () => { const { createProductVariants } = await adminClient.query< Codegen.CreateProductVariantsMutation, Codegen.CreateProductVariantsMutationVariables >(CREATE_PRODUCT_VARIANTS, { input: [ { productId: newProduct.id, sku: 'RE1', optionIds: [deletedVariant.options[0].id, deletedVariant.options[1].id], translations: [{ languageCode: LanguageCode.en, name: 'Re-created Variant' }], }, ], }); expect(createProductVariants.length).toBe(1); expect(createProductVariants[0]!.options.map(o => o.code).sort()).toEqual( deletedVariant.options.map(o => o.code).sort(), ); }); // https://github.com/vendure-ecommerce/vendure/issues/980 it('creating variants in a non-default language', async () => { const { createProduct } = await adminClient.query< Codegen.CreateProductMutation, Codegen.CreateProductMutationVariables >(CREATE_PRODUCT, { input: { translations: [ { languageCode: LanguageCode.de, name: 'Ananas', slug: 'ananas', description: 'Yummy Ananas', }, ], }, }); const { createProductVariants } = await adminClient.query< Codegen.CreateProductVariantsMutation, Codegen.CreateProductVariantsMutationVariables >(CREATE_PRODUCT_VARIANTS, { input: [ { productId: createProduct.id, sku: 'AN1110111', optionIds: [], translations: [{ languageCode: LanguageCode.de, name: 'Ananas Klein' }], }, ], }); expect(createProductVariants.length).toBe(1); expect(createProductVariants[0]?.name).toBe('Ananas Klein'); const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >( GET_PRODUCT_WITH_VARIANTS, { id: createProduct.id, }, { languageCode: LanguageCode.en }, ); expect(product?.variants.length).toBe(1); }); // https://github.com/vendure-ecommerce/vendure/issues/1631 describe('changing the Channel default language', () => { let productId: string; function getProductWithVariantsInLanguage( id: string, languageCode: LanguageCode, variantListOptions?: Codegen.ProductVariantListOptions, ) { return adminClient.query< Codegen.GetProductWithVariantListQuery, Codegen.GetProductWithVariantListQueryVariables >(GET_PRODUCT_WITH_VARIANT_LIST, { id, variantListOptions }, { languageCode }); } beforeAll(async () => { await adminClient.query< Codegen.UpdateGlobalSettingsMutation, Codegen.UpdateGlobalSettingsMutationVariables >(UPDATE_GLOBAL_SETTINGS, { input: { availableLanguages: [LanguageCode.en, LanguageCode.de], }, }); const { createProduct } = await adminClient.query< Codegen.CreateProductMutation, Codegen.CreateProductMutationVariables >(CREATE_PRODUCT, { input: { translations: [ { languageCode: LanguageCode.en, name: 'Bottle', slug: 'bottle', description: 'A container for liquids', }, ], }, }); productId = createProduct.id; await adminClient.query< Codegen.CreateProductVariantsMutation, Codegen.CreateProductVariantsMutationVariables >(CREATE_PRODUCT_VARIANTS, { input: [ { productId, sku: 'BOTTLE111', optionIds: [], translations: [{ languageCode: LanguageCode.en, name: 'Bottle' }], }, ], }); }); afterAll(async () => { // Restore the default language to English for the subsequent tests await adminClient.query(UpdateChannelDocument, { input: { id: 'T_1', defaultLanguageCode: LanguageCode.en, }, }); }); it('returns all variants', async () => { const { product: product1 } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >( GET_PRODUCT_WITH_VARIANTS, { id: productId, }, { languageCode: LanguageCode.en }, ); expect(product1?.variants.length).toBe(1); // Change the default language of the channel to "de" const { updateChannel } = await adminClient.query(UpdateChannelDocument, { input: { id: 'T_1', defaultLanguageCode: LanguageCode.de, }, }); updateChannelGuard.assertSuccess(updateChannel); expect(updateChannel.defaultLanguageCode).toBe(LanguageCode.de); // Fetch the product in en, it should still return 1 variant const { product: product2 } = await getProductWithVariantsInLanguage( productId, LanguageCode.en, ); expect(product2?.variantList.items.length).toBe(1); // Fetch the product in de, it should still return 1 variant const { product: product3 } = await getProductWithVariantsInLanguage( productId, LanguageCode.de, ); expect(product3?.variantList.items.length).toBe(1); }); it('returns all variants when sorting on variant name', async () => { // Fetch the product in en, it should still return 1 variant const { product: product1 } = await getProductWithVariantsInLanguage( productId, LanguageCode.en, { sort: { name: SortOrder.ASC } }, ); expect(product1?.variantList.items.length).toBe(1); // Fetch the product in de, it should still return 1 variant const { product: product2 } = await getProductWithVariantsInLanguage( productId, LanguageCode.de, { sort: { name: SortOrder.ASC } }, ); expect(product2?.variantList.items.length).toBe(1); }); }); }); }); describe('deletion', () => { let allProducts: Codegen.GetProductListQuery['products']['items']; let productToDelete: NonNullable<Codegen.GetProductWithVariantsQuery['product']>; beforeAll(async () => { const result = await adminClient.query< Codegen.GetProductListQuery, Codegen.GetProductListQueryVariables >(GET_PRODUCT_LIST, { options: { sort: { id: SortOrder.ASC, }, }, }); allProducts = result.products.items; }); it('deletes a product', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: allProducts[0].id, }); const result = await adminClient.query< Codegen.DeleteProductMutation, Codegen.DeleteProductMutationVariables >(DELETE_PRODUCT, { id: product!.id }); expect(result.deleteProduct).toEqual({ result: DeletionResult.DELETED }); productToDelete = product!; }); it('cannot get a deleted product', async () => { const { product } = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: productToDelete.id, }); expect(product).toBe(null); }); // https://github.com/vendure-ecommerce/vendure/issues/1096 it('variants of deleted product are also deleted', async () => { for (const variant of productToDelete.variants) { const { productVariant } = await adminClient.query< Codegen.GetProductVariantQuery, Codegen.GetProductVariantQueryVariables >(GET_PRODUCT_VARIANT, { id: variant.id, }); expect(productVariant).toBe(null); } }); it('deleted product omitted from list', async () => { const result = await adminClient.query<Codegen.GetProductListQuery>(GET_PRODUCT_LIST); expect(result.products.items.length).toBe(allProducts.length - 1); expect(result.products.items.map(c => c.id).includes(productToDelete.id)).toBe(false); }); it( 'updateProduct throws for deleted product', assertThrowsWithMessage( () => adminClient.query<Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables>( UPDATE_PRODUCT, { input: { id: productToDelete.id, facetValueIds: ['T_1'], }, }, ), 'No Product with the id "1" could be found', ), ); it( 'addOptionGroupToProduct throws for deleted product', assertThrowsWithMessage( () => adminClient.query< Codegen.AddOptionGroupToProductMutation, Codegen.AddOptionGroupToProductMutationVariables >(ADD_OPTION_GROUP_TO_PRODUCT, { optionGroupId: 'T_1', productId: productToDelete.id, }), 'No Product with the id "1" could be found', ), ); it( 'removeOptionGroupToProduct throws for deleted product', assertThrowsWithMessage( () => adminClient.query< Codegen.RemoveOptionGroupFromProductMutation, Codegen.RemoveOptionGroupFromProductMutationVariables >(REMOVE_OPTION_GROUP_FROM_PRODUCT, { optionGroupId: 'T_1', productId: productToDelete.id, }), 'No Product with the id "1" could be found', ), ); // https://github.com/vendure-ecommerce/vendure/issues/558 it('slug of a deleted product can be re-used', async () => { const result = await adminClient.query< Codegen.CreateProductMutation, Codegen.CreateProductMutationVariables >(CREATE_PRODUCT, { input: { translations: [ { languageCode: LanguageCode.en, name: 'Product reusing deleted slug', slug: productToDelete.slug, description: 'stuff', }, ], }, }); expect(result.createProduct.slug).toBe(productToDelete.slug); }); // https://github.com/vendure-ecommerce/vendure/issues/1505 it('attempting to re-use deleted slug twice is not allowed', async () => { const result = await adminClient.query< Codegen.CreateProductMutation, Codegen.CreateProductMutationVariables >(CREATE_PRODUCT, { input: { translations: [ { languageCode: LanguageCode.en, name: 'Product reusing deleted slug', slug: productToDelete.slug, description: 'stuff', }, ], }, }); expect(result.createProduct.slug).not.toBe(productToDelete.slug); expect(result.createProduct.slug).toBe('laptop-2'); }); // https://github.com/vendure-ecommerce/vendure/issues/800 it('product can be fetched by slug of a deleted product', async () => { const { product } = await adminClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { slug: productToDelete.slug }); if (!product) { fail('Product not found'); return; } expect(product.slug).toBe(productToDelete.slug); }); }); async function createOptionGroup(name: string, options: string[]) { const { createProductOptionGroup } = await adminClient.query< Codegen.CreateProductOptionGroupMutation, Codegen.CreateProductOptionGroupMutationVariables >(CREATE_PRODUCT_OPTION_GROUP, { input: { code: name.toLowerCase(), translations: [{ languageCode: LanguageCode.en, name }], options: options.map(option => ({ code: option.toLowerCase(), translations: [{ languageCode: LanguageCode.en, name: option }], })), }, }); return createProductOptionGroup; } }); export const REMOVE_OPTION_GROUP_FROM_PRODUCT = gql` mutation RemoveOptionGroupFromProduct($productId: ID!, $optionGroupId: ID!, $force: Boolean) { removeOptionGroupFromProduct(productId: $productId, optionGroupId: $optionGroupId, force: $force) { ...ProductWithOptions ... on ProductOptionInUseError { errorCode message optionGroupCode productVariantCount } } } ${PRODUCT_WITH_OPTIONS_FRAGMENT} `; export const GET_OPTION_GROUP = gql` query GetOptionGroup($id: ID!) { productOptionGroup(id: $id) { id code options { id code } } } `; export const GET_PRODUCT_VARIANT = gql` query GetProductVariant($id: ID!) { productVariant(id: $id) { id name } } `; export const GET_PRODUCT_WITH_VARIANT_LIST = gql` query GetProductWithVariantList($id: ID, $variantListOptions: ProductVariantListOptions) { product(id: $id) { id variantList(options: $variantListOptions) { items { ...ProductVariant } totalItems } } } ${PRODUCT_VARIANT_FRAGMENT} `;
import { pick } from '@vendure/common/lib/pick'; import { PromotionAction, PromotionCondition, PromotionOrderAction } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, E2E_DEFAULT_CHANNEL_TOKEN, ErrorResultGuard, } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-config'; import { PROMOTION_FRAGMENT } from './graphql/fragments'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { CurrencyCode, DeletionResult, ErrorCode, LanguageCode } from './graphql/generated-e2e-admin-types'; import { ASSIGN_PROMOTIONS_TO_CHANNEL, CREATE_CHANNEL, CREATE_PROMOTION, DELETE_PROMOTION, GET_PROMOTION, REMOVE_PROMOTIONS_FROM_CHANNEL, } from './graphql/shared-definitions'; import { assertThrowsWithMessage } from './utils/assert-throws-with-message'; /* eslint-disable @typescript-eslint/no-non-null-assertion */ describe('Promotion resolver', () => { const promoCondition = generateTestCondition('promo_condition'); const promoCondition2 = generateTestCondition('promo_condition2'); const promoAction = generateTestAction('promo_action'); const { server, adminClient, shopClient } = createTestEnvironment({ ...testConfig(), promotionOptions: { promotionConditions: [promoCondition, promoCondition2], promotionActions: [promoAction], }, }); const snapshotProps: Array<keyof Codegen.PromotionFragment> = [ 'name', 'actions', 'conditions', 'enabled', 'couponCode', 'startsAt', 'endsAt', ]; let promotion: Codegen.PromotionFragment; const promotionGuard: ErrorResultGuard<Codegen.PromotionFragment> = createErrorResultGuard( input => !!input.couponCode, ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('createPromotion', async () => { const { createPromotion } = await adminClient.query< Codegen.CreatePromotionMutation, Codegen.CreatePromotionMutationVariables >(CREATE_PROMOTION, { input: { enabled: true, couponCode: 'TEST123', startsAt: new Date('2019-10-30T00:00:00.000Z'), endsAt: new Date('2019-12-01T00:00:00.000Z'), translations: [ { languageCode: LanguageCode.en, name: 'test promotion', description: 'a test promotion', }, ], conditions: [ { code: promoCondition.code, arguments: [{ name: 'arg', value: '500' }], }, ], actions: [ { code: promoAction.code, arguments: [ { name: 'facetValueIds', value: '["T_1"]', }, ], }, ], }, }); promotionGuard.assertSuccess(createPromotion); promotion = createPromotion; expect(pick(promotion, snapshotProps)).toMatchSnapshot(); }); it('createPromotion with no description', async () => { const { createPromotion } = await adminClient.query< Codegen.CreatePromotionMutation, Codegen.CreatePromotionMutationVariables >(CREATE_PROMOTION, { input: { enabled: true, couponCode: 'TEST567', translations: [ { languageCode: LanguageCode.en, name: 'test promotion no description', customFields: {}, }, ], conditions: [], actions: [ { code: promoAction.code, arguments: [ { name: 'facetValueIds', value: '["T_1"]', }, ], }, ], }, }); promotionGuard.assertSuccess(createPromotion); expect(createPromotion.name).toBe('test promotion no description'); expect(createPromotion.description).toBe(''); expect(createPromotion.translations[0].description).toBe(''); }); it('createPromotion return error result with empty conditions and no couponCode', async () => { const { createPromotion } = await adminClient.query< Codegen.CreatePromotionMutation, Codegen.CreatePromotionMutationVariables >(CREATE_PROMOTION, { input: { enabled: true, translations: [ { languageCode: LanguageCode.en, name: 'bad promotion', }, ], conditions: [], actions: [ { code: promoAction.code, arguments: [ { name: 'facetValueIds', value: '["T_1"]', }, ], }, ], }, }); promotionGuard.assertErrorResult(createPromotion); expect(createPromotion.message).toBe( 'A Promotion must have either at least one condition or a coupon code set', ); expect(createPromotion.errorCode).toBe(ErrorCode.MISSING_CONDITIONS_ERROR); }); it('updatePromotion', async () => { const { updatePromotion } = await adminClient.query< Codegen.UpdatePromotionMutation, Codegen.UpdatePromotionMutationVariables >(UPDATE_PROMOTION, { input: { id: promotion.id, couponCode: 'TEST1235', startsAt: new Date('2019-05-30T22:00:00.000Z'), endsAt: new Date('2019-06-01T22:00:00.000Z'), conditions: [ { code: promoCondition.code, arguments: [{ name: 'arg', value: '90' }], }, { code: promoCondition2.code, arguments: [{ name: 'arg', value: '10' }], }, ], }, }); promotionGuard.assertSuccess(updatePromotion); expect(pick(updatePromotion, snapshotProps)).toMatchSnapshot(); }); it('updatePromotion return error result with empty conditions and no couponCode', async () => { const { updatePromotion } = await adminClient.query< Codegen.UpdatePromotionMutation, Codegen.UpdatePromotionMutationVariables >(UPDATE_PROMOTION, { input: { id: promotion.id, couponCode: '', conditions: [], }, }); promotionGuard.assertErrorResult(updatePromotion); expect(updatePromotion.message).toBe( 'A Promotion must have either at least one condition or a coupon code set', ); expect(updatePromotion.errorCode).toBe(ErrorCode.MISSING_CONDITIONS_ERROR); }); it('promotion', async () => { const result = await adminClient.query<Codegen.GetPromotionQuery, Codegen.GetPromotionQueryVariables>( GET_PROMOTION, { id: promotion.id, }, ); expect(result.promotion!.name).toBe(promotion.name); }); it('promotions', async () => { const result = await adminClient.query< Codegen.GetPromotionListQuery, Codegen.GetPromotionListQueryVariables >(GET_PROMOTION_LIST, {}); expect(result.promotions.totalItems).toBe(2); expect(result.promotions.items[0].name).toBe('test promotion'); }); it('adjustmentOperations', async () => { const result = await adminClient.query< Codegen.GetAdjustmentOperationsQuery, Codegen.GetAdjustmentOperationsQueryVariables >(GET_ADJUSTMENT_OPERATIONS); expect(result.promotionActions).toMatchSnapshot(); expect(result.promotionConditions).toMatchSnapshot(); }); describe('channels', () => { const SECOND_CHANNEL_TOKEN = 'SECOND_CHANNEL_TOKEN'; let secondChannel: Codegen.ChannelFragment; beforeAll(async () => { const { createChannel } = await adminClient.query< Codegen.CreateChannelMutation, Codegen.CreateChannelMutationVariables >(CREATE_CHANNEL, { input: { code: 'second-channel', token: SECOND_CHANNEL_TOKEN, defaultLanguageCode: LanguageCode.en, pricesIncludeTax: true, currencyCode: CurrencyCode.EUR, defaultTaxZoneId: 'T_1', defaultShippingZoneId: 'T_2', }, }); secondChannel = createChannel as any; }); it('does not list Promotions not in active channel', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { promotions } = await adminClient.query<Codegen.GetPromotionListQuery>(GET_PROMOTION_LIST); expect(promotions.totalItems).toBe(0); expect(promotions.items).toEqual([]); }); it('does not return Promotion not in active channel', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { promotion: result } = await adminClient.query< Codegen.GetPromotionQuery, Codegen.GetPromotionQueryVariables >(GET_PROMOTION, { id: promotion.id, }); expect(result).toBeNull(); }); it('assignPromotionsToChannel', async () => { adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { assignPromotionsToChannel } = await adminClient.query< Codegen.AssignPromotionToChannelMutation, Codegen.AssignPromotionToChannelMutationVariables >(ASSIGN_PROMOTIONS_TO_CHANNEL, { input: { channelId: secondChannel.id, promotionIds: [promotion.id], }, }); expect(assignPromotionsToChannel).toEqual([{ id: promotion.id, name: promotion.name }]); adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { promotion: result } = await adminClient.query< Codegen.GetPromotionQuery, Codegen.GetPromotionQueryVariables >(GET_PROMOTION, { id: promotion.id, }); expect(result?.id).toBe(promotion.id); const { promotions } = await adminClient.query<Codegen.GetPromotionListQuery>(GET_PROMOTION_LIST); expect(promotions.totalItems).toBe(1); expect(promotions.items.map(pick(['id']))).toEqual([{ id: promotion.id }]); }); it('removePromotionsFromChannel', async () => { adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { removePromotionsFromChannel } = await adminClient.query< Codegen.RemovePromotionFromChannelMutation, Codegen.RemovePromotionFromChannelMutationVariables >(REMOVE_PROMOTIONS_FROM_CHANNEL, { input: { channelId: secondChannel.id, promotionIds: [promotion.id], }, }); expect(removePromotionsFromChannel).toEqual([{ id: promotion.id, name: promotion.name }]); adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { promotion: result } = await adminClient.query< Codegen.GetPromotionQuery, Codegen.GetPromotionQueryVariables >(GET_PROMOTION, { id: promotion.id, }); expect(result).toBeNull(); const { promotions } = await adminClient.query<Codegen.GetPromotionListQuery>(GET_PROMOTION_LIST); expect(promotions.totalItems).toBe(0); }); }); describe('deletion', () => { let allPromotions: Codegen.GetPromotionListQuery['promotions']['items']; let promotionToDelete: Codegen.GetPromotionListQuery['promotions']['items'][number]; beforeAll(async () => { adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const result = await adminClient.query<Codegen.GetPromotionListQuery>(GET_PROMOTION_LIST); allPromotions = result.promotions.items; }); it('deletes a promotion', async () => { promotionToDelete = allPromotions[0]; const result = await adminClient.query< Codegen.DeletePromotionMutation, Codegen.DeletePromotionMutationVariables >(DELETE_PROMOTION, { id: promotionToDelete.id }); expect(result.deletePromotion).toEqual({ result: DeletionResult.DELETED }); }); it('cannot get a deleted promotion', async () => { const result = await adminClient.query< Codegen.GetPromotionQuery, Codegen.GetPromotionQueryVariables >(GET_PROMOTION, { id: promotionToDelete.id, }); expect(result.promotion).toBe(null); }); it('deleted promotion omitted from list', async () => { const result = await adminClient.query<Codegen.GetPromotionListQuery>(GET_PROMOTION_LIST); expect(result.promotions.items.length).toBe(allPromotions.length - 1); expect(result.promotions.items.map(c => c.id).includes(promotionToDelete.id)).toBe(false); }); it( 'updatePromotion throws for deleted promotion', assertThrowsWithMessage( () => adminClient.query< Codegen.UpdatePromotionMutation, Codegen.UpdatePromotionMutationVariables >(UPDATE_PROMOTION, { input: { id: promotionToDelete.id, enabled: false, }, }), 'No Promotion with the id "1" could be found', ), ); }); }); function generateTestCondition(code: string): PromotionCondition<any> { return new PromotionCondition({ code, description: [{ languageCode: LanguageCode.en, value: `description for ${code}` }], args: { arg: { type: 'int' } }, check: (order, args) => true, }); } function generateTestAction(code: string): PromotionAction<any> { return new PromotionOrderAction({ code, description: [{ languageCode: LanguageCode.en, value: `description for ${code}` }], args: { facetValueIds: { type: 'ID', list: true } }, execute: (order, args) => { return 42; }, }); } export const GET_PROMOTION_LIST = gql` query GetPromotionList($options: PromotionListOptions) { promotions(options: $options) { items { ...Promotion } totalItems } } ${PROMOTION_FRAGMENT} `; export const UPDATE_PROMOTION = gql` mutation UpdatePromotion($input: UpdatePromotionInput!) { updatePromotion(input: $input) { ...Promotion ... on ErrorResult { errorCode message } } } ${PROMOTION_FRAGMENT} `; export const CONFIGURABLE_DEF_FRAGMENT = gql` fragment ConfigurableOperationDef on ConfigurableOperationDefinition { args { name type ui } code description } `; export const GET_ADJUSTMENT_OPERATIONS = gql` query GetAdjustmentOperations { promotionActions { ...ConfigurableOperationDef } promotionConditions { ...ConfigurableOperationDef } } ${CONFIGURABLE_DEF_FRAGMENT} `;
import { mergeConfig, Zone } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { RelationDecoratorTestService, RelationsDecoratorTestPlugin, } from './fixtures/test-plugins/relations-decorator-test-plugin'; describe('Relations decorator', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { customFields: { Order: [ { name: 'zone', entity: Zone, type: 'relation', }, ], }, plugins: [RelationsDecoratorTestPlugin], }), ); let testService: RelationDecoratorTestService; beforeAll(async () => { await server.init({ initialData, customerCount: 1, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), }); await adminClient.asSuperAdmin(); testService = server.app.get(RelationDecoratorTestService); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('empty relations', async () => { testService.reset(); await shopClient.query(gql` { orders(options: { take: 5 }) { items { id } } } `); expect(testService.getRelations()).toEqual([]); }); it('relations specified in query are included', async () => { testService.reset(); await shopClient.query(gql` { orders(options: { take: 5 }) { items { customer { firstName } lines { featuredAsset { preview } } } } } `); expect(testService.getRelations()).toEqual(['customer', 'lines', 'lines.featuredAsset']); }); it('custom field relations are included', async () => { testService.reset(); await shopClient.query(gql` { orders(options: { take: 5 }) { items { customFields { zone { id } } } } } `); expect(testService.getRelations()).toEqual(['customFields.zone']); }); it('relations specified in Calculated decorator are included', async () => { testService.reset(); await shopClient.query(gql` { orders(options: { take: 5 }) { items { id totalQuantity } } } `); expect(testService.getRelations()).toEqual(['lines']); }); it('defaults to a depth of 3', async () => { testService.reset(); await shopClient.query(gql` { orders(options: { take: 5 }) { items { lines { productVariant { product { featuredAsset { preview } } } } } } } `); expect(testService.getRelations()).toEqual([ 'lines', 'lines.productVariant', 'lines.productVariant.product', ]); }); it('manually set depth of 5', async () => { testService.reset(); await shopClient.query(gql` { ordersWithDepth5(options: { take: 5 }) { items { lines { productVariant { product { optionGroups { options { name } } } } } } } } `); expect(testService.getRelations()).toEqual([ 'lines', 'lines.productVariant', 'lines.productVariant.product', 'lines.productVariant.product.optionGroups', 'lines.productVariant.product.optionGroups.options', ]); }); });
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { omit } from '@vendure/common/lib/omit'; import { CUSTOMER_ROLE_CODE, DEFAULT_CHANNEL_CODE, SUPER_ADMIN_ROLE_CODE, } from '@vendure/common/lib/shared-constants'; import { createTestEnvironment, E2E_DEFAULT_CHANNEL_TOKEN } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { ROLE_FRAGMENT } from './graphql/fragments'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { CurrencyCode, DeletionResult, LanguageCode, Permission } from './graphql/generated-e2e-admin-types'; import { CREATE_ADMINISTRATOR, CREATE_CHANNEL, CREATE_ROLE, GET_CHANNELS, UPDATE_ADMINISTRATOR, UPDATE_ROLE, } from './graphql/shared-definitions'; import { assertThrowsWithMessage } from './utils/assert-throws-with-message'; import { sortById } from './utils/test-order-utils'; describe('Role resolver', () => { const { server, adminClient } = createTestEnvironment(testConfig()); let createdRole: Codegen.RoleFragment; let defaultRoles: Codegen.RoleFragment[]; beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('roles', async () => { const result = await adminClient.query<Codegen.GetRolesQuery, Codegen.GetRolesQueryVariables>( GET_ROLES, ); defaultRoles = result.roles.items; expect(result.roles.items.length).toBe(2); expect(result.roles.totalItems).toBe(2); }); it('createRole with invalid permission', async () => { try { await adminClient.query<Codegen.CreateRoleMutation, Codegen.CreateRoleMutationVariables>( CREATE_ROLE, { input: { code: 'test', description: 'test role', permissions: ['ReadCatalogx' as any], }, }, ); fail('Should have thrown'); } catch (e: any) { expect(e.response.errors[0]?.extensions.code).toBe('BAD_USER_INPUT'); } }); it('createRole with no permissions includes Authenticated', async () => { const { createRole } = await adminClient.query< Codegen.CreateRoleMutation, Codegen.CreateRoleMutationVariables >(CREATE_ROLE, { input: { code: 'test', description: 'test role', permissions: [], }, }); expect(omit(createRole, ['channels'])).toEqual({ code: 'test', description: 'test role', id: 'T_3', permissions: [Permission.Authenticated], }); }); it('createRole deduplicates permissions', async () => { const { createRole } = await adminClient.query< Codegen.CreateRoleMutation, Codegen.CreateRoleMutationVariables >(CREATE_ROLE, { input: { code: 'test2', description: 'test role2', permissions: [Permission.ReadSettings, Permission.ReadSettings], }, }); expect(omit(createRole, ['channels'])).toEqual({ code: 'test2', description: 'test role2', id: 'T_4', permissions: [Permission.Authenticated, Permission.ReadSettings], }); }); it('createRole with permissions', async () => { const result = await adminClient.query< Codegen.CreateRoleMutation, Codegen.CreateRoleMutationVariables >(CREATE_ROLE, { input: { code: 'test', description: 'test role', permissions: [Permission.ReadCustomer, Permission.UpdateCustomer], }, }); createdRole = result.createRole; expect(createdRole).toEqual({ code: 'test', description: 'test role', id: 'T_5', permissions: [Permission.Authenticated, Permission.ReadCustomer, Permission.UpdateCustomer], channels: [ { code: DEFAULT_CHANNEL_CODE, id: 'T_1', token: 'e2e-default-channel', }, ], }); }); it('role', async () => { const result = await adminClient.query<Codegen.GetRoleQuery, Codegen.GetRoleQueryVariables>( GET_ROLE, { id: createdRole.id, }, ); expect(result.role).toEqual(createdRole); }); describe('updateRole', () => { it('updates role', async () => { const result = await adminClient.query< Codegen.UpdateRoleMutation, Codegen.UpdateRoleMutationVariables >(UPDATE_ROLE, { input: { id: createdRole.id, code: 'test-modified', description: 'test role modified', permissions: [ Permission.ReadCustomer, Permission.UpdateCustomer, Permission.DeleteCustomer, ], }, }); expect(omit(result.updateRole, ['channels'])).toEqual({ code: 'test-modified', description: 'test role modified', id: 'T_5', permissions: [ Permission.Authenticated, Permission.ReadCustomer, Permission.UpdateCustomer, Permission.DeleteCustomer, ], }); }); it('works with partial input', async () => { const result = await adminClient.query< Codegen.UpdateRoleMutation, Codegen.UpdateRoleMutationVariables >(UPDATE_ROLE, { input: { id: createdRole.id, code: 'test-modified-again', }, }); expect(result.updateRole.code).toBe('test-modified-again'); expect(result.updateRole.description).toBe('test role modified'); expect(result.updateRole.permissions).toEqual([ Permission.Authenticated, Permission.ReadCustomer, Permission.UpdateCustomer, Permission.DeleteCustomer, ]); }); it('deduplicates permissions', async () => { const result = await adminClient.query< Codegen.UpdateRoleMutation, Codegen.UpdateRoleMutationVariables >(UPDATE_ROLE, { input: { id: createdRole.id, permissions: [ Permission.Authenticated, Permission.Authenticated, Permission.ReadCustomer, Permission.ReadCustomer, ], }, }); expect(result.updateRole.permissions).toEqual([ Permission.Authenticated, Permission.ReadCustomer, ]); }); it( 'does not allow setting non-assignable permissions - Owner', assertThrowsWithMessage(async () => { await adminClient.query<Codegen.UpdateRoleMutation, Codegen.UpdateRoleMutationVariables>( UPDATE_ROLE, { input: { id: createdRole.id, permissions: [Permission.Owner], }, }, ); }, 'The permission "Owner" may not be assigned'), ); it( 'does not allow setting non-assignable permissions - Public', assertThrowsWithMessage(async () => { await adminClient.query<Codegen.UpdateRoleMutation, Codegen.UpdateRoleMutationVariables>( UPDATE_ROLE, { input: { id: createdRole.id, permissions: [Permission.Public], }, }, ); }, 'The permission "Public" may not be assigned'), ); it( 'does not allow setting SuperAdmin permission', assertThrowsWithMessage(async () => { await adminClient.query<Codegen.UpdateRoleMutation, Codegen.UpdateRoleMutationVariables>( UPDATE_ROLE, { input: { id: createdRole.id, permissions: [Permission.SuperAdmin], }, }, ); }, 'The permission "SuperAdmin" may not be assigned'), ); it( 'is not allowed for SuperAdmin role', assertThrowsWithMessage(async () => { const superAdminRole = defaultRoles.find(r => r.code === SUPER_ADMIN_ROLE_CODE); if (!superAdminRole) { fail('Could not find SuperAdmin role'); return; } return adminClient.query<Codegen.UpdateRoleMutation, Codegen.UpdateRoleMutationVariables>( UPDATE_ROLE, { input: { id: superAdminRole.id, code: 'superadmin-modified', description: 'superadmin modified', permissions: [Permission.Authenticated], }, }, ); }, `The role "${SUPER_ADMIN_ROLE_CODE}" cannot be modified`), ); it( 'is not allowed for Customer role', assertThrowsWithMessage(async () => { const customerRole = defaultRoles.find(r => r.code === CUSTOMER_ROLE_CODE); if (!customerRole) { fail('Could not find Customer role'); return; } return adminClient.query<Codegen.UpdateRoleMutation, Codegen.UpdateRoleMutationVariables>( UPDATE_ROLE, { input: { id: customerRole.id, code: 'customer-modified', description: 'customer modified', permissions: [Permission.Authenticated, Permission.DeleteAdministrator], }, }, ); }, `The role "${CUSTOMER_ROLE_CODE}" cannot be modified`), ); }); it( 'deleteRole is not allowed for Customer role', assertThrowsWithMessage(async () => { const customerRole = defaultRoles.find(r => r.code === CUSTOMER_ROLE_CODE); if (!customerRole) { fail('Could not find Customer role'); return; } return adminClient.query<Codegen.DeleteRoleMutation, Codegen.DeleteRoleMutationVariables>( DELETE_ROLE, { id: customerRole.id, }, ); }, `The role "${CUSTOMER_ROLE_CODE}" cannot be deleted`), ); it( 'deleteRole is not allowed for SuperAdmin role', assertThrowsWithMessage(async () => { const superAdminRole = defaultRoles.find(r => r.code === SUPER_ADMIN_ROLE_CODE); if (!superAdminRole) { fail('Could not find Customer role'); return; } return adminClient.query<Codegen.DeleteRoleMutation, Codegen.DeleteRoleMutationVariables>( DELETE_ROLE, { id: superAdminRole.id, }, ); }, `The role "${SUPER_ADMIN_ROLE_CODE}" cannot be deleted`), ); it('deleteRole deletes a role', async () => { const { deleteRole } = await adminClient.query< Codegen.DeleteRoleMutation, Codegen.DeleteRoleMutationVariables >(DELETE_ROLE, { id: createdRole.id, }); expect(deleteRole.result).toBe(DeletionResult.DELETED); const { role } = await adminClient.query<Codegen.GetRoleQuery, Codegen.GetRoleQueryVariables>( GET_ROLE, { id: createdRole.id, }, ); expect(role).toBeNull(); }); describe('multi-channel', () => { let secondChannel: Codegen.ChannelFragment; let multiChannelRole: Codegen.CreateRoleMutation['createRole']; beforeAll(async () => { const { createChannel } = await adminClient.query< Codegen.CreateChannelMutation, Codegen.CreateChannelMutationVariables >(CREATE_CHANNEL, { input: { code: 'second-channel', token: 'second-channel-token', defaultLanguageCode: LanguageCode.en, currencyCode: CurrencyCode.GBP, pricesIncludeTax: true, defaultShippingZoneId: 'T_1', defaultTaxZoneId: 'T_1', }, }); secondChannel = createChannel as any; }); it('createRole with specified channel', async () => { const result = await adminClient.query< Codegen.CreateRoleMutation, Codegen.CreateRoleMutationVariables >(CREATE_ROLE, { input: { code: 'multi-test', description: 'multi channel test role', permissions: [Permission.ReadCustomer], channelIds: [secondChannel.id], }, }); multiChannelRole = result.createRole; expect(multiChannelRole).toEqual({ code: 'multi-test', description: 'multi channel test role', id: 'T_6', permissions: [Permission.Authenticated, Permission.ReadCustomer], channels: [ { code: 'second-channel', id: 'T_2', token: 'second-channel-token', }, ], }); }); it('updateRole with specified channel', async () => { const { updateRole } = await adminClient.query< Codegen.UpdateRoleMutation, Codegen.UpdateRoleMutationVariables >(UPDATE_ROLE, { input: { id: multiChannelRole.id, channelIds: ['T_1', 'T_2'], }, }); expect(updateRole.channels.sort(sortById)).toEqual([ { code: DEFAULT_CHANNEL_CODE, id: 'T_1', token: 'e2e-default-channel', }, { code: 'second-channel', id: 'T_2', token: 'second-channel-token', }, ]); }); }); // https://github.com/vendure-ecommerce/vendure/issues/1874 describe('role escalation', () => { let defaultChannel: Codegen.GetChannelsQuery['channels'][number]; let secondChannel: Codegen.GetChannelsQuery['channels'][number]; let limitedAdmin: Codegen.CreateAdministratorMutation['createAdministrator']; let orderReaderRole: Codegen.CreateRoleMutation['createRole']; let adminCreatorRole: Codegen.CreateRoleMutation['createRole']; let adminCreatorAdministrator: Codegen.CreateAdministratorMutation['createAdministrator']; beforeAll(async () => { const { channels } = await adminClient.query<Codegen.GetChannelsQuery>(GET_CHANNELS); defaultChannel = channels.items.find(c => c.token === E2E_DEFAULT_CHANNEL_TOKEN)!; secondChannel = channels.items.find(c => c.token !== E2E_DEFAULT_CHANNEL_TOKEN)!; adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); await adminClient.asSuperAdmin(); const { createRole } = await adminClient.query< Codegen.CreateRoleMutation, Codegen.CreateRoleMutationVariables >(CREATE_ROLE, { input: { code: 'second-channel-admin-manager', description: '', channelIds: [secondChannel.id], permissions: [ Permission.CreateAdministrator, Permission.ReadAdministrator, Permission.UpdateAdministrator, Permission.DeleteAdministrator, ], }, }); const { createAdministrator } = await adminClient.query< Codegen.CreateAdministratorMutation, Codegen.CreateAdministratorMutationVariables >(CREATE_ADMINISTRATOR, { input: { firstName: 'channel2', lastName: 'admin manager', emailAddress: 'channel2@test.com', roleIds: [createRole.id], password: 'test', }, }); limitedAdmin = createAdministrator; const { createRole: createRole2 } = await adminClient.query< Codegen.CreateRoleMutation, Codegen.CreateRoleMutationVariables >(CREATE_ROLE, { input: { code: 'second-channel-order-manager', description: '', channelIds: [secondChannel.id], permissions: [Permission.ReadOrder], }, }); orderReaderRole = createRole2; adminClient.setChannelToken(secondChannel.token); await adminClient.asUserWithCredentials(limitedAdmin.emailAddress, 'test'); }); it('limited admin cannot view Roles which require permissions they do not have', async () => { const result = await adminClient.query<Codegen.GetRolesQuery, Codegen.GetRolesQueryVariables>( GET_ROLES, ); const roleCodes = result.roles.items.map(r => r.code); expect(roleCodes).toEqual(['second-channel-admin-manager']); }); it('limited admin cannot view Role which requires permissions they do not have', async () => { const result = await adminClient.query<Codegen.GetRoleQuery, Codegen.GetRoleQueryVariables>( GET_ROLE, { id: orderReaderRole.id }, ); expect(result.role).toBeNull(); }); it( 'limited admin cannot create Role with SuperAdmin permission', assertThrowsWithMessage(async () => { await adminClient.query<Codegen.CreateRoleMutation, Codegen.CreateRoleMutationVariables>( CREATE_ROLE, { input: { code: 'evil-superadmin', description: '', channelIds: [secondChannel.id], permissions: [Permission.SuperAdmin], }, }, ); }, 'The permission "SuperAdmin" may not be assigned'), ); it( 'limited admin cannot create Administrator with SuperAdmin role', assertThrowsWithMessage(async () => { const superAdminRole = defaultRoles.find(r => r.code === SUPER_ADMIN_ROLE_CODE)!; await adminClient.query< Codegen.CreateAdministratorMutation, Codegen.CreateAdministratorMutationVariables >(CREATE_ADMINISTRATOR, { input: { firstName: 'Dr', lastName: 'Evil', emailAddress: 'drevil@test.com', roleIds: [superAdminRole.id], password: 'test', }, }); }, 'Active user does not have sufficient permissions'), ); it( 'limited admin cannot create Role with permissions it itself does not have', assertThrowsWithMessage(async () => { await adminClient.query<Codegen.CreateRoleMutation, Codegen.CreateRoleMutationVariables>( CREATE_ROLE, { input: { code: 'evil-order-manager', description: '', channelIds: [secondChannel.id], permissions: [Permission.ReadOrder], }, }, ); }, 'Active user does not have sufficient permissions'), ); it( 'limited admin cannot create Role on channel it does not have permissions on', assertThrowsWithMessage(async () => { await adminClient.query<Codegen.CreateRoleMutation, Codegen.CreateRoleMutationVariables>( CREATE_ROLE, { input: { code: 'evil-order-manager', description: '', channelIds: [defaultChannel.id], permissions: [Permission.CreateAdministrator], }, }, ); }, 'You are not currently authorized to perform this action'), ); it( 'limited admin cannot create Administrator with a Role with greater permissions than they themselves have', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.CreateAdministratorMutation, Codegen.CreateAdministratorMutationVariables >(CREATE_ADMINISTRATOR, { input: { firstName: 'Dr', lastName: 'Evil', emailAddress: 'drevil@test.com', roleIds: [orderReaderRole.id], password: 'test', }, }); }, 'Active user does not have sufficient permissions'), ); it('limited admin can create Role with permissions it itself has', async () => { const { createRole } = await adminClient.query< Codegen.CreateRoleMutation, Codegen.CreateRoleMutationVariables >(CREATE_ROLE, { input: { code: 'good-admin-creator', description: '', channelIds: [secondChannel.id], permissions: [Permission.CreateAdministrator], }, }); expect(createRole.code).toBe('good-admin-creator'); adminCreatorRole = createRole; }); it('limited admin can create Administrator with permissions it itself has', async () => { const { createAdministrator } = await adminClient.query< Codegen.CreateAdministratorMutation, Codegen.CreateAdministratorMutationVariables >(CREATE_ADMINISTRATOR, { input: { firstName: 'Admin', lastName: 'Creator', emailAddress: 'admincreator@test.com', roleIds: [adminCreatorRole.id], password: 'test', }, }); expect(createAdministrator.emailAddress).toBe('admincreator@test.com'); adminCreatorAdministrator = createAdministrator; }); it( 'limited admin cannot update Role with permissions it itself lacks', assertThrowsWithMessage(async () => { await adminClient.query<Codegen.UpdateRoleMutation, Codegen.UpdateRoleMutationVariables>( UPDATE_ROLE, { input: { id: adminCreatorRole.id, permissions: [Permission.ReadOrder], }, }, ); }, 'Active user does not have sufficient permissions'), ); it( 'limited admin cannot update Administrator with Role containing permissions it itself lacks', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.UpdateAdministratorMutation, Codegen.UpdateAdministratorMutationVariables >(UPDATE_ADMINISTRATOR, { input: { id: adminCreatorAdministrator.id, roleIds: [adminCreatorRole.id, orderReaderRole.id], }, }); }, 'Active user does not have sufficient permissions'), ); }); }); export const GET_ROLES = gql` query GetRoles($options: RoleListOptions) { roles(options: $options) { items { ...Role } totalItems } } ${ROLE_FRAGMENT} `; export const GET_ROLE = gql` query GetRole($id: ID!) { role(id: $id) { ...Role } } ${ROLE_FRAGMENT} `; export const DELETE_ROLE = gql` mutation DeleteRole($id: ID!) { deleteRole(id: $id) { result message } } `;
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { CachedSession, mergeConfig, SessionCacheStrategy } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { vi } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { SUPER_ADMIN_USER_IDENTIFIER, SUPER_ADMIN_USER_PASSWORD } from '../../common/src/shared-constants'; import { AttemptLoginMutation, AttemptLoginMutationVariables, MeQuery, } from './graphql/generated-e2e-admin-types'; import { ATTEMPT_LOGIN, ME } from './graphql/shared-definitions'; const testSessionCache = new Map<string, CachedSession>(); const getSpy = vi.fn(); const setSpy = vi.fn(); const clearSpy = vi.fn(); const deleteSpy = vi.fn(); class TestingSessionCacheStrategy implements SessionCacheStrategy { clear() { clearSpy(); testSessionCache.clear(); } delete(sessionToken: string) { deleteSpy(sessionToken); testSessionCache.delete(sessionToken); } get(sessionToken: string) { getSpy(sessionToken); return testSessionCache.get(sessionToken); } set(session: CachedSession) { setSpy(session); testSessionCache.set(session.token, session); } } describe('Session caching', () => { const { server, adminClient } = createTestEnvironment( mergeConfig(testConfig(), { authOptions: { sessionCacheStrategy: new TestingSessionCacheStrategy(), sessionCacheTTL: 2, }, }), ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 1, }); testSessionCache.clear(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('populates the cache on login', async () => { setSpy.mockClear(); expect(setSpy.mock.calls.length).toBe(0); expect(testSessionCache.size).toBe(0); await adminClient.query<AttemptLoginMutation, AttemptLoginMutationVariables>(ATTEMPT_LOGIN, { username: SUPER_ADMIN_USER_IDENTIFIER, password: SUPER_ADMIN_USER_PASSWORD, }); expect(testSessionCache.size).toBe(1); expect(setSpy.mock.calls.length).toBe(1); }); it('takes user data from cache on next request', async () => { getSpy.mockClear(); const { me } = await adminClient.query<MeQuery>(ME); expect(getSpy.mock.calls.length).toBe(1); }); it('sets fresh data after TTL expires', async () => { setSpy.mockClear(); await adminClient.query<MeQuery>(ME); expect(setSpy.mock.calls.length).toBe(0); await adminClient.query<MeQuery>(ME); expect(setSpy.mock.calls.length).toBe(0); await pause(2000); await adminClient.query<MeQuery>(ME); expect(setSpy.mock.calls.length).toBe(1); }); it('clears cache for that user on logout', async () => { deleteSpy.mockClear(); expect(deleteSpy.mock.calls.length).toBe(0); await adminClient.query( gql` mutation Logout { logout { success } } `, ); expect(testSessionCache.size).toBe(0); expect(deleteSpy.mock.calls.length).toBeGreaterThan(0); }); }); describe('Session expiry', () => { const { server, adminClient } = createTestEnvironment( mergeConfig(testConfig(), { authOptions: { sessionDuration: '3s', sessionCacheTTL: 1, }, }), ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('session does not expire with continued use', async () => { await adminClient.asSuperAdmin(); await pause(1000); await adminClient.query(ME); await pause(1000); await adminClient.query(ME); await pause(1000); await adminClient.query(ME); await pause(1000); await adminClient.query(ME); }, 10000); it('session expires when not used for longer than sessionDuration', async () => { await adminClient.asSuperAdmin(); await pause(3500); try { await adminClient.query(ME); fail('Should have thrown'); } catch (e: any) { expect(e.message).toContain('You are not currently authorized to perform this action'); } }, 10000); }); function pause(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)); }
import { defaultShippingCalculator, defaultShippingEligibilityChecker, manualFulfillmentHandler, ShippingCalculator, ShippingEligibilityChecker, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import path from 'path'; import { vi } from 'vitest'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import * as Codegen from './graphql/generated-e2e-admin-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { ErrorCode, LanguageCode } from './graphql/generated-e2e-shop-types'; import { CREATE_SHIPPING_METHOD } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER, ADJUST_ITEM_QUANTITY, GET_ACTIVE_ORDER, GET_ELIGIBLE_SHIPPING_METHODS, REMOVE_ITEM_FROM_ORDER, SET_SHIPPING_ADDRESS, SET_SHIPPING_METHOD, } from './graphql/shop-definitions'; const check1Spy = vi.fn(); const checker1 = new ShippingEligibilityChecker({ code: 'checker1', description: [], args: {}, check: (ctx, order) => { check1Spy(); return order.lines.length === 1; }, }); const check2Spy = vi.fn(); const checker2 = new ShippingEligibilityChecker({ code: 'checker2', description: [], args: {}, check: (ctx, order) => { check2Spy(); return order.lines.length > 1; }, }); const check3Spy = vi.fn(); const checker3 = new ShippingEligibilityChecker({ code: 'checker3', description: [], args: {}, check: (ctx, order) => { check3Spy(); return order.lines.length === 3; }, shouldRunCheck: (ctx, order) => { return order.shippingAddress; }, }); const calculator = new ShippingCalculator({ code: 'calculator', description: [], args: {}, calculate: ctx => { return { price: 10, priceIncludesTax: false, taxRate: 20, }; }, }); describe('ShippingMethod eligibility', () => { const { server, adminClient, shopClient } = createTestEnvironment({ ...testConfig(), shippingOptions: { shippingEligibilityCheckers: [defaultShippingEligibilityChecker, checker1, checker2, checker3], shippingCalculators: [defaultShippingCalculator, calculator], }, }); const orderGuard: ErrorResultGuard< CodegenShop.UpdatedOrderFragment | CodegenShop.TestOrderFragmentFragment > = createErrorResultGuard(input => !!input.lines); let singleLineShippingMethod: Codegen.ShippingMethodFragment; let multiLineShippingMethod: Codegen.ShippingMethodFragment; let optimizedShippingMethod: Codegen.ShippingMethodFragment; beforeAll(async () => { await server.init({ initialData: { ...initialData, shippingMethods: [], }, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); const result1 = await adminClient.query< Codegen.CreateShippingMethodMutation, Codegen.CreateShippingMethodMutationVariables >(CREATE_SHIPPING_METHOD, { input: { code: 'single-line', fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: checker1.code, arguments: [], }, calculator: { code: calculator.code, arguments: [], }, translations: [ { languageCode: LanguageCode.en, name: 'For single-line orders', description: '' }, ], }, }); singleLineShippingMethod = result1.createShippingMethod; const result2 = await adminClient.query< Codegen.CreateShippingMethodMutation, Codegen.CreateShippingMethodMutationVariables >(CREATE_SHIPPING_METHOD, { input: { code: 'multi-line', fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: checker2.code, arguments: [], }, calculator: { code: calculator.code, arguments: [], }, translations: [ { languageCode: LanguageCode.en, name: 'For multi-line orders', description: '' }, ], }, }); multiLineShippingMethod = result2.createShippingMethod; const result3 = await adminClient.query< Codegen.CreateShippingMethodMutation, Codegen.CreateShippingMethodMutationVariables >(CREATE_SHIPPING_METHOD, { input: { code: 'optimized', fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: checker3.code, arguments: [], }, calculator: { code: calculator.code, arguments: [], }, translations: [ { languageCode: LanguageCode.en, name: 'Optimized with shouldRunCheck', description: '' }, ], }, }); optimizedShippingMethod = result3.createShippingMethod; }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); describe('default behavior', () => { let order: CodegenShop.UpdatedOrderFragment; it('Does not run checkers before a ShippingMethod is assigned to Order', async () => { check1Spy.mockClear(); check2Spy.mockClear(); await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { quantity: 1, productVariantId: 'T_1', }); orderGuard.assertSuccess(addItemToOrder); expect(check1Spy).not.toHaveBeenCalled(); expect(check2Spy).not.toHaveBeenCalled(); await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { quantity: 2, orderLineId: addItemToOrder.lines[0].id, }); expect(check1Spy).not.toHaveBeenCalled(); expect(check2Spy).not.toHaveBeenCalled(); order = addItemToOrder; }); it('Runs checkers when querying for eligible ShippingMethods', async () => { check1Spy.mockClear(); check2Spy.mockClear(); const { eligibleShippingMethods } = await shopClient.query<CodegenShop.GetShippingMethodsQuery>( GET_ELIGIBLE_SHIPPING_METHODS, ); expect(check1Spy).toHaveBeenCalledTimes(1); expect(check2Spy).toHaveBeenCalledTimes(1); }); it('Runs checker of assigned method only', async () => { check1Spy.mockClear(); check2Spy.mockClear(); await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: singleLineShippingMethod.id, }); // A check is done when assigning the method to ensure it // is eligible, and again when calculating order adjustments expect(check1Spy).toHaveBeenCalledTimes(2); expect(check2Spy).not.toHaveBeenCalled(); await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { quantity: 3, orderLineId: order.lines[0].id, }); expect(check1Spy).toHaveBeenCalledTimes(3); expect(check2Spy).not.toHaveBeenCalled(); await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { quantity: 4, orderLineId: order.lines[0].id, }); expect(check1Spy).toHaveBeenCalledTimes(4); expect(check2Spy).not.toHaveBeenCalled(); }); it('Prevents ineligible method from being assigned', async () => { const { setOrderShippingMethod } = await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: multiLineShippingMethod.id, }); orderGuard.assertErrorResult(setOrderShippingMethod); expect(setOrderShippingMethod.errorCode).toBe(ErrorCode.INELIGIBLE_SHIPPING_METHOD_ERROR); expect(setOrderShippingMethod.message).toBe( 'This Order is not eligible for the selected ShippingMethod', ); }); it('Runs checks when assigned method becomes ineligible', async () => { check1Spy.mockClear(); check2Spy.mockClear(); // Adding a second OrderLine will make the singleLineShippingMethod // ineligible const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { quantity: 1, productVariantId: 'T_2', }); orderGuard.assertSuccess(addItemToOrder); // Checked once to see if still eligible (no) expect(check1Spy).toHaveBeenCalledTimes(1); // Checked once when looking for a fallback expect(check2Spy).toHaveBeenCalledTimes(1); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); // multiLineShippingMethod assigned as a fallback expect(activeOrder?.shippingLines?.[0]?.shippingMethod?.id).toBe(multiLineShippingMethod.id); await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { quantity: 2, orderLineId: addItemToOrder.lines[1].id, }); // No longer called as singleLineShippingMethod not assigned expect(check1Spy).toHaveBeenCalledTimes(1); // Called on changes since multiLineShippingMethod is assigned expect(check2Spy).toHaveBeenCalledTimes(2); // Remove the second OrderLine and make multiLineShippingMethod ineligible const { removeOrderLine } = await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: addItemToOrder.lines[1].id, }); orderGuard.assertSuccess(removeOrderLine); // Called when looking for a fallback expect(check1Spy).toHaveBeenCalledTimes(2); // Called when checking if still eligibile (no) expect(check2Spy).toHaveBeenCalledTimes(3); // Falls back to the first eligible shipping method expect(removeOrderLine.shippingLines[0].shippingMethod?.id).toBe(singleLineShippingMethod.id); }); }); describe('optimization via shouldRunCheck function', () => { let order: CodegenShop.UpdatedOrderFragment; beforeAll(async () => { await shopClient.asAnonymousUser(); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { quantity: 1, productVariantId: 'T_1', }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { quantity: 1, productVariantId: 'T_2', }); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { quantity: 1, productVariantId: 'T_3', }); orderGuard.assertSuccess(addItemToOrder); order = addItemToOrder; await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { streetLine1: '42 Test Street', city: 'Doncaster', postalCode: 'DN1 4EE', countryCode: 'GB', }, }); }); it('runs check on getEligibleShippingMethods', async () => { check3Spy.mockClear(); const { eligibleShippingMethods } = await shopClient.query<CodegenShop.GetShippingMethodsQuery>( GET_ELIGIBLE_SHIPPING_METHODS, ); expect(check3Spy).toHaveBeenCalledTimes(1); }); it('does not re-run check on setting shipping method', async () => { check3Spy.mockClear(); await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: optimizedShippingMethod.id, }); expect(check3Spy).toHaveBeenCalledTimes(0); }); it('does not re-run check when changing cart contents', async () => { check3Spy.mockClear(); await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { quantity: 3, orderLineId: order.lines[0].id, }); expect(check3Spy).toHaveBeenCalledTimes(0); }); it('re-runs check when shouldRunCheck fn invalidates last check', async () => { check3Spy.mockClear(); // Update the shipping address, causing the `shouldRunCheck` function // to trigger a check await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { streetLine1: '43 Test Street', // This line changed city: 'Doncaster', postalCode: 'DN1 4EE', countryCode: 'GB', }, }); await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { quantity: 2, orderLineId: order.lines[0].id, }); expect(check3Spy).toHaveBeenCalledTimes(1); // Does not check a second time though, since the shipping address // is now the same as on the last check. await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { quantity: 3, orderLineId: order.lines[0].id, }); expect(check3Spy).toHaveBeenCalledTimes(1); }); }); });
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { defaultShippingCalculator, defaultShippingEligibilityChecker, ShippingCalculator, } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { manualFulfillmentHandler } from '../src/config/fulfillment/manual-fulfillment-handler'; import { SHIPPING_METHOD_FRAGMENT } from './graphql/fragments'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { DeletionResult, LanguageCode } from './graphql/generated-e2e-admin-types'; import { CREATE_SHIPPING_METHOD, DELETE_SHIPPING_METHOD, GET_SHIPPING_METHOD_LIST, UPDATE_SHIPPING_METHOD, } from './graphql/shared-definitions'; const TEST_METADATA = { foo: 'bar', baz: [1, 2, 3], }; const calculatorWithMetadata = new ShippingCalculator({ code: 'calculator-with-metadata', description: [{ languageCode: LanguageCode.en, value: 'Has metadata' }], args: {}, calculate: () => { return { price: 100, priceIncludesTax: true, taxRate: 0, metadata: TEST_METADATA, }; }, }); describe('ShippingMethod resolver', () => { const { server, adminClient, shopClient } = createTestEnvironment({ ...testConfig(), shippingOptions: { shippingEligibilityCheckers: [defaultShippingEligibilityChecker], shippingCalculators: [defaultShippingCalculator, calculatorWithMetadata], }, }); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('shippingEligibilityCheckers', async () => { const { shippingEligibilityCheckers } = await adminClient.query<Codegen.GetEligibilityCheckersQuery>( GET_ELIGIBILITY_CHECKERS, ); expect(shippingEligibilityCheckers).toEqual([ { args: [ { description: 'Order is eligible only if its total is greater or equal to this value', label: 'Minimum order value', name: 'orderMinimum', type: 'int', ui: { component: 'currency-form-input', }, }, ], code: 'default-shipping-eligibility-checker', description: 'Default Shipping Eligibility Checker', }, ]); }); it('shippingCalculators', async () => { const { shippingCalculators } = await adminClient.query<Codegen.GetCalculatorsQuery>(GET_CALCULATORS); expect(shippingCalculators).toEqual([ { args: [ { ui: { component: 'currency-form-input', }, description: null, label: 'Shipping price', name: 'rate', type: 'int', }, { label: 'Price includes tax', name: 'includesTax', type: 'string', description: null, ui: { component: 'select-form-input', options: [ { label: [{ languageCode: LanguageCode.en, value: 'Includes tax' }], value: 'include', }, { label: [{ languageCode: LanguageCode.en, value: 'Excludes tax' }], value: 'exclude', }, { label: [ { languageCode: LanguageCode.en, value: 'Auto (based on Channel)' }, ], value: 'auto', }, ], }, }, { ui: { component: 'number-form-input', suffix: '%', }, description: null, label: 'Tax rate', name: 'taxRate', type: 'int', }, ], code: 'default-shipping-calculator', description: 'Default Flat-Rate Shipping Calculator', }, { args: [], code: 'calculator-with-metadata', description: 'Has metadata', }, ]); }); it('shippingMethods', async () => { const { shippingMethods } = await adminClient.query<Codegen.GetShippingMethodListQuery>( GET_SHIPPING_METHOD_LIST, ); expect(shippingMethods.totalItems).toEqual(2); expect(shippingMethods.items[0].code).toBe('standard-shipping'); expect(shippingMethods.items[1].code).toBe('express-shipping'); }); it('shippingMethod', async () => { const { shippingMethod } = await adminClient.query< Codegen.GetShippingMethodQuery, Codegen.GetShippingMethodQueryVariables >(GET_SHIPPING_METHOD, { id: 'T_1', }); expect(shippingMethod!.code).toBe('standard-shipping'); }); it('createShippingMethod', async () => { const { createShippingMethod } = await adminClient.query< Codegen.CreateShippingMethodMutation, Codegen.CreateShippingMethodMutationVariables >(CREATE_SHIPPING_METHOD, { input: { code: 'new-method', fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: defaultShippingEligibilityChecker.code, arguments: [ { name: 'orderMinimum', value: '0', }, ], }, calculator: { code: calculatorWithMetadata.code, arguments: [], }, translations: [{ languageCode: LanguageCode.en, name: 'new method', description: '' }], }, }); expect(createShippingMethod).toEqual({ id: 'T_3', code: 'new-method', name: 'new method', description: '', calculator: { code: 'calculator-with-metadata', args: [], }, checker: { code: 'default-shipping-eligibility-checker', args: [ { name: 'orderMinimum', value: '0', }, ], }, }); }); it('testShippingMethod', async () => { const { testShippingMethod } = await adminClient.query< Codegen.TestShippingMethodQuery, Codegen.TestShippingMethodQueryVariables >(TEST_SHIPPING_METHOD, { input: { calculator: { code: calculatorWithMetadata.code, arguments: [], }, checker: { code: defaultShippingEligibilityChecker.code, arguments: [ { name: 'orderMinimum', value: '0', }, ], }, lines: [{ productVariantId: 'T_1', quantity: 1 }], shippingAddress: { streetLine1: '', countryCode: 'GB', }, }, }); expect(testShippingMethod).toEqual({ eligible: true, quote: { price: 100, priceWithTax: 100, metadata: TEST_METADATA, }, }); }); it('testEligibleShippingMethods', async () => { const { testEligibleShippingMethods } = await adminClient.query< Codegen.TestEligibleMethodsQuery, Codegen.TestEligibleMethodsQueryVariables >(TEST_ELIGIBLE_SHIPPING_METHODS, { input: { lines: [{ productVariantId: 'T_1', quantity: 1 }], shippingAddress: { streetLine1: '', countryCode: 'GB', }, }, }); expect(testEligibleShippingMethods).toEqual([ { id: 'T_3', name: 'new method', description: '', price: 100, priceWithTax: 100, metadata: TEST_METADATA, }, { id: 'T_1', name: 'Standard Shipping', description: '', price: 500, priceWithTax: 500, metadata: null, }, { id: 'T_2', name: 'Express Shipping', description: '', price: 1000, priceWithTax: 1000, metadata: null, }, ]); }); it('updateShippingMethod', async () => { const { updateShippingMethod } = await adminClient.query< Codegen.UpdateShippingMethodMutation, Codegen.UpdateShippingMethodMutationVariables >(UPDATE_SHIPPING_METHOD, { input: { id: 'T_3', translations: [{ languageCode: LanguageCode.en, name: 'changed method', description: '' }], }, }); expect(updateShippingMethod.name).toBe('changed method'); }); it('deleteShippingMethod', async () => { const listResult1 = await adminClient.query<Codegen.GetShippingMethodListQuery>( GET_SHIPPING_METHOD_LIST, ); expect(listResult1.shippingMethods.items.map(i => i.id)).toEqual(['T_1', 'T_2', 'T_3']); const { deleteShippingMethod } = await adminClient.query< Codegen.DeleteShippingMethodMutation, Codegen.DeleteShippingMethodMutationVariables >(DELETE_SHIPPING_METHOD, { id: 'T_3', }); expect(deleteShippingMethod).toEqual({ result: DeletionResult.DELETED, message: null, }); const listResult2 = await adminClient.query<Codegen.GetShippingMethodListQuery>( GET_SHIPPING_METHOD_LIST, ); expect(listResult2.shippingMethods.items.map(i => i.id)).toEqual(['T_1', 'T_2']); }); describe('argument ordering', () => { it('createShippingMethod corrects order of arguments', async () => { const { createShippingMethod } = await adminClient.query< Codegen.CreateShippingMethodMutation, Codegen.CreateShippingMethodMutationVariables >(CREATE_SHIPPING_METHOD, { input: { code: 'new-method', fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: defaultShippingEligibilityChecker.code, arguments: [ { name: 'orderMinimum', value: '0', }, ], }, calculator: { code: defaultShippingCalculator.code, arguments: [ { name: 'rate', value: '500' }, { name: 'taxRate', value: '20' }, { name: 'includesTax', value: 'include' }, ], }, translations: [{ languageCode: LanguageCode.en, name: 'new method', description: '' }], }, }); expect(createShippingMethod.calculator).toEqual({ code: defaultShippingCalculator.code, args: [ { name: 'rate', value: '500' }, { name: 'includesTax', value: 'include' }, { name: 'taxRate', value: '20' }, ], }); }); it('updateShippingMethod corrects order of arguments', async () => { const { updateShippingMethod } = await adminClient.query< Codegen.UpdateShippingMethodMutation, Codegen.UpdateShippingMethodMutationVariables >(UPDATE_SHIPPING_METHOD, { input: { id: 'T_4', translations: [], calculator: { code: defaultShippingCalculator.code, arguments: [ { name: 'rate', value: '500' }, { name: 'taxRate', value: '20' }, { name: 'includesTax', value: 'include' }, ], }, }, }); expect(updateShippingMethod.calculator).toEqual({ code: defaultShippingCalculator.code, args: [ { name: 'rate', value: '500' }, { name: 'includesTax', value: 'include' }, { name: 'taxRate', value: '20' }, ], }); }); it('get shippingMethod preserves correct ordering', async () => { const { shippingMethod } = await adminClient.query< Codegen.GetShippingMethodQuery, Codegen.GetShippingMethodQueryVariables >(GET_SHIPPING_METHOD, { id: 'T_4', }); expect(shippingMethod?.calculator.args).toEqual([ { name: 'rate', value: '500' }, { name: 'includesTax', value: 'include' }, { name: 'taxRate', value: '20' }, ]); }); it('testShippingMethod corrects order of arguments', async () => { const { testShippingMethod } = await adminClient.query< Codegen.TestShippingMethodQuery, Codegen.TestShippingMethodQueryVariables >(TEST_SHIPPING_METHOD, { input: { calculator: { code: defaultShippingCalculator.code, arguments: [ { name: 'rate', value: '500' }, { name: 'taxRate', value: '0' }, { name: 'includesTax', value: 'include' }, ], }, checker: { code: defaultShippingEligibilityChecker.code, arguments: [ { name: 'orderMinimum', value: '0', }, ], }, lines: [{ productVariantId: 'T_1', quantity: 1 }], shippingAddress: { streetLine1: '', countryCode: 'GB', }, }, }); expect(testShippingMethod).toEqual({ eligible: true, quote: { metadata: null, price: 500, priceWithTax: 500, }, }); }); }); }); const GET_SHIPPING_METHOD = gql` query GetShippingMethod($id: ID!) { shippingMethod(id: $id) { ...ShippingMethod } } ${SHIPPING_METHOD_FRAGMENT} `; const GET_ELIGIBILITY_CHECKERS = gql` query GetEligibilityCheckers { shippingEligibilityCheckers { code description args { name type description label ui } } } `; const GET_CALCULATORS = gql` query GetCalculators { shippingCalculators { code description args { name type description label ui } } } `; const TEST_SHIPPING_METHOD = gql` query TestShippingMethod($input: TestShippingMethodInput!) { testShippingMethod(input: $input) { eligible quote { price priceWithTax metadata } } } `; export const TEST_ELIGIBLE_SHIPPING_METHODS = gql` query TestEligibleMethods($input: TestEligibleShippingMethodsInput!) { testEligibleShippingMethods(input: $input) { id name description price priceWithTax metadata } } `;
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { OnModuleInit } from '@nestjs/common'; import { ErrorCode, RegisterCustomerInput } from '@vendure/common/lib/generated-shop-types'; import { pick } from '@vendure/common/lib/pick'; import { AccountRegistrationEvent, EventBus, EventBusModule, IdentifierChangeEvent, IdentifierChangeRequestEvent, mergeConfig, PasswordResetEvent, PasswordValidationStrategy, RequestContext, VendurePlugin, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import { DocumentNode } from 'graphql'; import gql from 'graphql-tag'; import path from 'path'; import { Mock, vi } from 'vitest'; import { afterAll, beforeAll, beforeEach, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { PasswordValidationError } from '../src/common/error/generated-graphql-shop-errors'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { HistoryEntryType, Permission } from './graphql/generated-e2e-admin-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { CurrentUserShopFragment } from './graphql/generated-e2e-shop-types'; import { CREATE_ADMINISTRATOR, CREATE_ROLE, GET_CUSTOMER, GET_CUSTOMER_HISTORY, GET_CUSTOMER_LIST, } from './graphql/shared-definitions'; import { GET_ACTIVE_CUSTOMER, REFRESH_TOKEN, REGISTER_ACCOUNT, REQUEST_PASSWORD_RESET, REQUEST_UPDATE_EMAIL_ADDRESS, RESET_PASSWORD, UPDATE_EMAIL_ADDRESS, VERIFY_EMAIL, } from './graphql/shop-definitions'; let sendEmailFn: Mock; /** * This mock plugin simulates an EmailPlugin which would send emails * on the registration & password reset events. */ @VendurePlugin({ imports: [EventBusModule], }) class TestEmailPlugin implements OnModuleInit { constructor(private eventBus: EventBus) {} onModuleInit() { this.eventBus.ofType(AccountRegistrationEvent).subscribe(event => { sendEmailFn?.(event); }); this.eventBus.ofType(PasswordResetEvent).subscribe(event => { sendEmailFn?.(event); }); this.eventBus.ofType(IdentifierChangeRequestEvent).subscribe(event => { sendEmailFn?.(event); }); this.eventBus.ofType(IdentifierChangeEvent).subscribe(event => { sendEmailFn?.(event); }); } } const successErrorGuard: ErrorResultGuard<{ success: boolean }> = createErrorResultGuard( input => input.success != null, ); const currentUserErrorGuard: ErrorResultGuard<CurrentUserShopFragment> = createErrorResultGuard( input => input.identifier != null, ); class TestPasswordValidationStrategy implements PasswordValidationStrategy { validate(ctx: RequestContext, password: string): boolean | string { if (password === 'test') { // allow the default seed data password return true; } if (password.length < 8) { return 'Password must be more than 8 characters'; } if (password === '12345678') { return "Don't use 12345678!"; } return true; } } describe('Shop auth & accounts', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { plugins: [TestEmailPlugin as any], authOptions: { passwordValidationStrategy: new TestPasswordValidationStrategy(), }, }), ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 2, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); describe('customer account creation with deferred password', () => { const password = 'password'; const emailAddress = 'test1@test.com'; let verificationToken: string; let newCustomerId: string; beforeEach(() => { sendEmailFn = vi.fn(); }); it('does not return error result on email address conflict', async () => { // To prevent account enumeration attacks const { customers } = await adminClient.query<Codegen.GetCustomerListQuery>(GET_CUSTOMER_LIST); const input: RegisterCustomerInput = { firstName: 'Duplicate', lastName: 'Person', phoneNumber: '123456', emailAddress: customers.items[0].emailAddress, }; const { registerCustomerAccount } = await shopClient.query< CodegenShop.RegisterMutation, CodegenShop.RegisterMutationVariables >(REGISTER_ACCOUNT, { input, }); successErrorGuard.assertSuccess(registerCustomerAccount); }); it('register a new account without password', async () => { const verificationTokenPromise = getVerificationTokenPromise(); const input: RegisterCustomerInput = { firstName: 'Sean', lastName: 'Tester', phoneNumber: '123456', emailAddress, }; const { registerCustomerAccount } = await shopClient.query< CodegenShop.RegisterMutation, CodegenShop.RegisterMutationVariables >(REGISTER_ACCOUNT, { input, }); successErrorGuard.assertSuccess(registerCustomerAccount); verificationToken = await verificationTokenPromise; expect(registerCustomerAccount.success).toBe(true); expect(sendEmailFn).toHaveBeenCalled(); expect(verificationToken).toBeDefined(); const { customers } = await adminClient.query< Codegen.GetCustomerListQuery, Codegen.GetCustomerListQueryVariables >(GET_CUSTOMER_LIST, { options: { filter: { emailAddress: { eq: emailAddress, }, }, }, }); expect( pick(customers.items[0], ['firstName', 'lastName', 'emailAddress', 'phoneNumber']), ).toEqual(input); }); it('issues a new token if attempting to register a second time', async () => { const sendEmail = new Promise<string>(resolve => { sendEmailFn.mockImplementation((event: AccountRegistrationEvent) => { resolve(event.user.getNativeAuthenticationMethod().verificationToken!); }); }); const input: RegisterCustomerInput = { firstName: 'Sean', lastName: 'Tester', emailAddress, }; const { registerCustomerAccount } = await shopClient.query< CodegenShop.RegisterMutation, CodegenShop.RegisterMutationVariables >(REGISTER_ACCOUNT, { input, }); successErrorGuard.assertSuccess(registerCustomerAccount); const newVerificationToken = await sendEmail; expect(registerCustomerAccount.success).toBe(true); expect(sendEmailFn).toHaveBeenCalled(); expect(newVerificationToken).not.toBe(verificationToken); verificationToken = newVerificationToken; }); it('refreshCustomerVerification issues a new token', async () => { const sendEmail = new Promise<string>(resolve => { sendEmailFn.mockImplementation((event: AccountRegistrationEvent) => { resolve(event.user.getNativeAuthenticationMethod().verificationToken!); }); }); const { refreshCustomerVerification } = await shopClient.query< CodegenShop.RefreshTokenMutation, CodegenShop.RefreshTokenMutationVariables >(REFRESH_TOKEN, { emailAddress }); successErrorGuard.assertSuccess(refreshCustomerVerification); const newVerificationToken = await sendEmail; expect(refreshCustomerVerification.success).toBe(true); expect(sendEmailFn).toHaveBeenCalled(); expect(newVerificationToken).not.toBe(verificationToken); verificationToken = newVerificationToken; }); it('refreshCustomerVerification does nothing with an unrecognized emailAddress', async () => { const { refreshCustomerVerification } = await shopClient.query< CodegenShop.RefreshTokenMutation, CodegenShop.RefreshTokenMutationVariables >(REFRESH_TOKEN, { emailAddress: 'never-been-registered@test.com', }); successErrorGuard.assertSuccess(refreshCustomerVerification); await waitForSendEmailFn(); expect(refreshCustomerVerification.success).toBe(true); expect(sendEmailFn).not.toHaveBeenCalled(); }); it('login fails before verification', async () => { const result = await shopClient.asUserWithCredentials(emailAddress, ''); expect(result.errorCode).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR); }); it('verification fails with wrong token', async () => { const { verifyCustomerAccount } = await shopClient.query< CodegenShop.VerifyMutation, CodegenShop.VerifyMutationVariables >(VERIFY_EMAIL, { password, token: 'bad-token', }); currentUserErrorGuard.assertErrorResult(verifyCustomerAccount); expect(verifyCustomerAccount.message).toBe('Verification token not recognized'); expect(verifyCustomerAccount.errorCode).toBe(ErrorCode.VERIFICATION_TOKEN_INVALID_ERROR); }); it('verification fails with no password', async () => { const { verifyCustomerAccount } = await shopClient.query< CodegenShop.VerifyMutation, CodegenShop.VerifyMutationVariables >(VERIFY_EMAIL, { token: verificationToken, }); currentUserErrorGuard.assertErrorResult(verifyCustomerAccount); expect(verifyCustomerAccount.message).toBe('A password must be provided.'); expect(verifyCustomerAccount.errorCode).toBe(ErrorCode.MISSING_PASSWORD_ERROR); }); it('verification fails with invalid password', async () => { const { verifyCustomerAccount } = await shopClient.query< CodegenShop.VerifyMutation, CodegenShop.VerifyMutationVariables >(VERIFY_EMAIL, { token: verificationToken, password: '2short', }); currentUserErrorGuard.assertErrorResult(verifyCustomerAccount); expect(verifyCustomerAccount.message).toBe('Password is invalid'); expect((verifyCustomerAccount as PasswordValidationError).validationErrorMessage).toBe( 'Password must be more than 8 characters', ); expect(verifyCustomerAccount.errorCode).toBe(ErrorCode.PASSWORD_VALIDATION_ERROR); }); it('verification succeeds with password and correct token', async () => { const { verifyCustomerAccount } = await shopClient.query< CodegenShop.VerifyMutation, CodegenShop.VerifyMutationVariables >(VERIFY_EMAIL, { password, token: verificationToken, }); currentUserErrorGuard.assertSuccess(verifyCustomerAccount); expect(verifyCustomerAccount.identifier).toBe('test1@test.com'); const { activeCustomer } = await shopClient.query<CodegenShop.GetActiveCustomerQuery>( GET_ACTIVE_CUSTOMER, ); newCustomerId = activeCustomer!.id; }); it('registration silently fails if attempting to register an email already verified', async () => { const input: RegisterCustomerInput = { firstName: 'Dodgy', lastName: 'Hacker', emailAddress, }; const { registerCustomerAccount } = await shopClient.query< CodegenShop.RegisterMutation, CodegenShop.RegisterMutationVariables >(REGISTER_ACCOUNT, { input, }); successErrorGuard.assertSuccess(registerCustomerAccount); await waitForSendEmailFn(); expect(registerCustomerAccount.success).toBe(true); expect(sendEmailFn).not.toHaveBeenCalled(); }); it('verification fails if attempted a second time', async () => { const { verifyCustomerAccount } = await shopClient.query< CodegenShop.VerifyMutation, CodegenShop.VerifyMutationVariables >(VERIFY_EMAIL, { password, token: verificationToken, }); currentUserErrorGuard.assertErrorResult(verifyCustomerAccount); expect(verifyCustomerAccount.message).toBe('Verification token not recognized'); expect(verifyCustomerAccount.errorCode).toBe(ErrorCode.VERIFICATION_TOKEN_INVALID_ERROR); }); it('customer history contains entries for registration & verification', async () => { const { customer } = await adminClient.query< Codegen.GetCustomerHistoryQuery, Codegen.GetCustomerHistoryQueryVariables >(GET_CUSTOMER_HISTORY, { id: newCustomerId, }); expect(customer?.history.items.map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.CUSTOMER_REGISTERED, data: { strategy: 'native', }, }, { // second entry because we register twice above type: HistoryEntryType.CUSTOMER_REGISTERED, data: { strategy: 'native', }, }, { type: HistoryEntryType.CUSTOMER_VERIFIED, data: { strategy: 'native', }, }, ]); }); }); describe('customer account creation with up-front password', () => { const password = 'password'; const emailAddress = 'test2@test.com'; let verificationToken: string; it('registerCustomerAccount fails with invalid password', async () => { const input: RegisterCustomerInput = { firstName: 'Lu', lastName: 'Tester', phoneNumber: '443324', emailAddress, password: '12345678', }; const { registerCustomerAccount } = await shopClient.query< CodegenShop.RegisterMutation, CodegenShop.RegisterMutationVariables >(REGISTER_ACCOUNT, { input, }); successErrorGuard.assertErrorResult(registerCustomerAccount); expect(registerCustomerAccount.errorCode).toBe(ErrorCode.PASSWORD_VALIDATION_ERROR); expect(registerCustomerAccount.message).toBe('Password is invalid'); expect((registerCustomerAccount as PasswordValidationError).validationErrorMessage).toBe( "Don't use 12345678!", ); }); it('register a new account with password', async () => { const verificationTokenPromise = getVerificationTokenPromise(); const input: RegisterCustomerInput = { firstName: 'Lu', lastName: 'Tester', phoneNumber: '443324', emailAddress, password, }; const { registerCustomerAccount } = await shopClient.query< CodegenShop.RegisterMutation, CodegenShop.RegisterMutationVariables >(REGISTER_ACCOUNT, { input, }); successErrorGuard.assertSuccess(registerCustomerAccount); verificationToken = await verificationTokenPromise; expect(registerCustomerAccount.success).toBe(true); expect(sendEmailFn).toHaveBeenCalled(); expect(verificationToken).toBeDefined(); const { customers } = await adminClient.query< Codegen.GetCustomerListQuery, Codegen.GetCustomerListQueryVariables >(GET_CUSTOMER_LIST, { options: { filter: { emailAddress: { eq: emailAddress, }, }, }, }); expect( pick(customers.items[0], ['firstName', 'lastName', 'emailAddress', 'phoneNumber']), ).toEqual(pick(input, ['firstName', 'lastName', 'emailAddress', 'phoneNumber'])); }); it('login fails before verification', async () => { const result = await shopClient.asUserWithCredentials(emailAddress, password); expect(result.errorCode).toBe(ErrorCode.NOT_VERIFIED_ERROR); expect(result.message).toBe('Please verify this email address before logging in'); }); it('verification fails with password', async () => { const { verifyCustomerAccount } = await shopClient.query< CodegenShop.VerifyMutation, CodegenShop.VerifyMutationVariables >(VERIFY_EMAIL, { token: verificationToken, password: 'new password', }); currentUserErrorGuard.assertErrorResult(verifyCustomerAccount); expect(verifyCustomerAccount.message).toBe('A password has already been set during registration'); expect(verifyCustomerAccount.errorCode).toBe(ErrorCode.PASSWORD_ALREADY_SET_ERROR); }); it('verification succeeds with no password and correct token', async () => { const { verifyCustomerAccount } = await shopClient.query< CodegenShop.VerifyMutation, CodegenShop.VerifyMutationVariables >(VERIFY_EMAIL, { token: verificationToken, }); currentUserErrorGuard.assertSuccess(verifyCustomerAccount); expect(verifyCustomerAccount.identifier).toBe('test2@test.com'); const { activeCustomer } = await shopClient.query<CodegenShop.GetActiveCustomerQuery>( GET_ACTIVE_CUSTOMER, ); }); }); describe('password reset', () => { let passwordResetToken: string; let customer: Codegen.GetCustomerQuery['customer']; beforeAll(async () => { const result = await adminClient.query< Codegen.GetCustomerQuery, Codegen.GetCustomerQueryVariables >(GET_CUSTOMER, { id: 'T_1', }); customer = result.customer!; }); beforeEach(() => { sendEmailFn = vi.fn(); }); it('requestPasswordReset silently fails with invalid identifier', async () => { const { requestPasswordReset } = await shopClient.query< CodegenShop.RequestPasswordResetMutation, CodegenShop.RequestPasswordResetMutationVariables >(REQUEST_PASSWORD_RESET, { identifier: 'invalid-identifier', }); successErrorGuard.assertSuccess(requestPasswordReset); await waitForSendEmailFn(); expect(requestPasswordReset.success).toBe(true); expect(sendEmailFn).not.toHaveBeenCalled(); expect(passwordResetToken).not.toBeDefined(); }); it('requestPasswordReset sends reset token', async () => { const passwordResetTokenPromise = getPasswordResetTokenPromise(); const { requestPasswordReset } = await shopClient.query< CodegenShop.RequestPasswordResetMutation, CodegenShop.RequestPasswordResetMutationVariables >(REQUEST_PASSWORD_RESET, { identifier: customer!.emailAddress, }); successErrorGuard.assertSuccess(requestPasswordReset); passwordResetToken = await passwordResetTokenPromise; expect(requestPasswordReset.success).toBe(true); expect(sendEmailFn).toHaveBeenCalled(); expect(passwordResetToken).toBeDefined(); }); it('resetPassword returns error result with wrong token', async () => { const { resetPassword } = await shopClient.query< CodegenShop.ResetPasswordMutation, CodegenShop.ResetPasswordMutationVariables >(RESET_PASSWORD, { password: 'newPassword', token: 'bad-token', }); currentUserErrorGuard.assertErrorResult(resetPassword); expect(resetPassword.message).toBe('Password reset token not recognized'); expect(resetPassword.errorCode).toBe(ErrorCode.PASSWORD_RESET_TOKEN_INVALID_ERROR); }); it('resetPassword fails with invalid password', async () => { const { resetPassword } = await shopClient.query< CodegenShop.ResetPasswordMutation, CodegenShop.ResetPasswordMutationVariables >(RESET_PASSWORD, { token: passwordResetToken, password: '2short', }); currentUserErrorGuard.assertErrorResult(resetPassword); expect(resetPassword.message).toBe('Password is invalid'); expect((resetPassword as PasswordValidationError).validationErrorMessage).toBe( 'Password must be more than 8 characters', ); expect(resetPassword.errorCode).toBe(ErrorCode.PASSWORD_VALIDATION_ERROR); }); it('resetPassword works with valid token', async () => { const { resetPassword } = await shopClient.query< CodegenShop.ResetPasswordMutation, CodegenShop.ResetPasswordMutationVariables >(RESET_PASSWORD, { token: passwordResetToken, password: 'newPassword', }); currentUserErrorGuard.assertSuccess(resetPassword); expect(resetPassword.identifier).toBe(customer!.emailAddress); const loginResult = await shopClient.asUserWithCredentials(customer!.emailAddress, 'newPassword'); expect(loginResult.identifier).toBe(customer!.emailAddress); }); it('customer history for password reset', async () => { const result = await adminClient.query< Codegen.GetCustomerHistoryQuery, Codegen.GetCustomerHistoryQueryVariables >(GET_CUSTOMER_HISTORY, { id: customer!.id, options: { // skip CUSTOMER_ADDRESS_CREATED entry skip: 3, }, }); expect(result.customer?.history.items.map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.CUSTOMER_PASSWORD_RESET_REQUESTED, data: {}, }, { type: HistoryEntryType.CUSTOMER_PASSWORD_RESET_VERIFIED, data: {}, }, ]); }); }); // https://github.com/vendure-ecommerce/vendure/issues/1659 describe('password reset before verification', () => { const password = 'password'; const emailAddress = 'test3@test.com'; let verificationToken: string; let passwordResetToken: string; let newCustomerId: string; beforeEach(() => { sendEmailFn = vi.fn(); }); it('register a new account without password', async () => { const verificationTokenPromise = getVerificationTokenPromise(); const input: RegisterCustomerInput = { firstName: 'Bobby', lastName: 'Tester', phoneNumber: '123456', emailAddress, }; const { registerCustomerAccount } = await shopClient.query< Codegen.RegisterMutation, Codegen.RegisterMutationVariables >(REGISTER_ACCOUNT, { input }); successErrorGuard.assertSuccess(registerCustomerAccount); verificationToken = await verificationTokenPromise; const { customers } = await adminClient.query< Codegen.GetCustomerListQuery, Codegen.GetCustomerListQueryVariables >(GET_CUSTOMER_LIST, { options: { filter: { emailAddress: { eq: emailAddress }, }, }, }); expect(customers.items[0].user?.verified).toBe(false); newCustomerId = customers.items[0].id; }); it('requestPasswordReset', async () => { const passwordResetTokenPromise = getPasswordResetTokenPromise(); const { requestPasswordReset } = await shopClient.query< RequestPasswordReset.Mutation, RequestPasswordReset.Variables >(REQUEST_PASSWORD_RESET, { identifier: emailAddress, }); successErrorGuard.assertSuccess(requestPasswordReset); await waitForSendEmailFn(); passwordResetToken = await passwordResetTokenPromise; expect(requestPasswordReset.success).toBe(true); expect(sendEmailFn).toHaveBeenCalled(); expect(passwordResetToken).toBeDefined(); }); it('resetPassword also performs verification', async () => { const { resetPassword } = await shopClient.query<ResetPassword.Mutation, ResetPassword.Variables>( RESET_PASSWORD, { token: passwordResetToken, password: 'newPassword', }, ); currentUserErrorGuard.assertSuccess(resetPassword); expect(resetPassword.identifier).toBe(emailAddress); const { customer } = await adminClient.query<GetCustomer.Query, GetCustomer.Variables>( GET_CUSTOMER, { id: newCustomerId, }, ); expect(customer?.user?.verified).toBe(true); }); it('can log in with new password', async () => { const loginResult = await shopClient.asUserWithCredentials(emailAddress, 'newPassword'); expect(loginResult.identifier).toBe(emailAddress); }); }); describe('updating emailAddress', () => { let emailUpdateToken: string; let customer: Codegen.GetCustomerQuery['customer']; const NEW_EMAIL_ADDRESS = 'new@address.com'; const PASSWORD = 'newPassword'; beforeAll(async () => { const result = await adminClient.query< Codegen.GetCustomerQuery, Codegen.GetCustomerQueryVariables >(GET_CUSTOMER, { id: 'T_1', }); customer = result.customer!; }); beforeEach(() => { sendEmailFn = vi.fn(); }); it('throws if not logged in', async () => { try { await shopClient.asAnonymousUser(); await shopClient.query< CodegenShop.RequestUpdateEmailAddressMutation, CodegenShop.RequestUpdateEmailAddressMutationVariables >(REQUEST_UPDATE_EMAIL_ADDRESS, { password: PASSWORD, newEmailAddress: NEW_EMAIL_ADDRESS, }); fail('should have thrown'); } catch (err: any) { expect(getErrorCode(err)).toBe('FORBIDDEN'); } }); it('return error result if password is incorrect', async () => { await shopClient.asUserWithCredentials(customer!.emailAddress, PASSWORD); const { requestUpdateCustomerEmailAddress } = await shopClient.query< CodegenShop.RequestUpdateEmailAddressMutation, CodegenShop.RequestUpdateEmailAddressMutationVariables >(REQUEST_UPDATE_EMAIL_ADDRESS, { password: 'bad password', newEmailAddress: NEW_EMAIL_ADDRESS, }); successErrorGuard.assertErrorResult(requestUpdateCustomerEmailAddress); expect(requestUpdateCustomerEmailAddress.message).toBe('The provided credentials are invalid'); expect(requestUpdateCustomerEmailAddress.errorCode).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR); }); it('return error result email address already in use', async () => { await shopClient.asUserWithCredentials(customer!.emailAddress, PASSWORD); const result = await adminClient.query< Codegen.GetCustomerQuery, Codegen.GetCustomerQueryVariables >(GET_CUSTOMER, { id: 'T_2', }); const otherCustomer = result.customer!; const { requestUpdateCustomerEmailAddress } = await shopClient.query< CodegenShop.RequestUpdateEmailAddressMutation, CodegenShop.RequestUpdateEmailAddressMutationVariables >(REQUEST_UPDATE_EMAIL_ADDRESS, { password: PASSWORD, newEmailAddress: otherCustomer.emailAddress, }); successErrorGuard.assertErrorResult(requestUpdateCustomerEmailAddress); expect(requestUpdateCustomerEmailAddress.message).toBe('The email address is not available.'); expect(requestUpdateCustomerEmailAddress.errorCode).toBe(ErrorCode.EMAIL_ADDRESS_CONFLICT_ERROR); }); it('triggers event with token', async () => { await shopClient.asUserWithCredentials(customer!.emailAddress, PASSWORD); const emailUpdateTokenPromise = getEmailUpdateTokenPromise(); await shopClient.query< CodegenShop.RequestUpdateEmailAddressMutation, CodegenShop.RequestUpdateEmailAddressMutationVariables >(REQUEST_UPDATE_EMAIL_ADDRESS, { password: PASSWORD, newEmailAddress: NEW_EMAIL_ADDRESS, }); const { identifierChangeToken, pendingIdentifier } = await emailUpdateTokenPromise; emailUpdateToken = identifierChangeToken!; expect(pendingIdentifier).toBe(NEW_EMAIL_ADDRESS); expect(emailUpdateToken).toBeTruthy(); }); it('cannot login with new email address before verification', async () => { const result = await shopClient.asUserWithCredentials(NEW_EMAIL_ADDRESS, PASSWORD); expect(result.errorCode).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR); }); it('return error result for bad token', async () => { const { updateCustomerEmailAddress } = await shopClient.query< CodegenShop.UpdateEmailAddressMutation, CodegenShop.UpdateEmailAddressMutationVariables >(UPDATE_EMAIL_ADDRESS, { token: 'bad token' }); successErrorGuard.assertErrorResult(updateCustomerEmailAddress); expect(updateCustomerEmailAddress.message).toBe('Identifier change token not recognized'); expect(updateCustomerEmailAddress.errorCode).toBe( ErrorCode.IDENTIFIER_CHANGE_TOKEN_INVALID_ERROR, ); }); it('verify the new email address', async () => { const { updateCustomerEmailAddress } = await shopClient.query< CodegenShop.UpdateEmailAddressMutation, CodegenShop.UpdateEmailAddressMutationVariables >(UPDATE_EMAIL_ADDRESS, { token: emailUpdateToken }); successErrorGuard.assertSuccess(updateCustomerEmailAddress); expect(updateCustomerEmailAddress.success).toBe(true); // Allow for occasional race condition where the event does not // publish before the assertions are made. await new Promise(resolve => setTimeout(resolve, 10)); expect(sendEmailFn).toHaveBeenCalled(); expect(sendEmailFn.mock.calls[0][0] instanceof IdentifierChangeEvent).toBe(true); }); it('can login with new email address after verification', async () => { await shopClient.asUserWithCredentials(NEW_EMAIL_ADDRESS, PASSWORD); const { activeCustomer } = await shopClient.query<CodegenShop.GetActiveCustomerQuery>( GET_ACTIVE_CUSTOMER, ); expect(activeCustomer!.id).toBe(customer!.id); expect(activeCustomer!.emailAddress).toBe(NEW_EMAIL_ADDRESS); }); it('cannot login with old email address after verification', async () => { const result = await shopClient.asUserWithCredentials(customer!.emailAddress, PASSWORD); expect(result.errorCode).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR); }); it('customer history for email update', async () => { const result = await adminClient.query< Codegen.GetCustomerHistoryQuery, Codegen.GetCustomerHistoryQueryVariables >(GET_CUSTOMER_HISTORY, { id: customer!.id, options: { skip: 5, }, }); expect(result.customer?.history.items.map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.CUSTOMER_EMAIL_UPDATE_REQUESTED, data: { newEmailAddress: 'new@address.com', oldEmailAddress: 'hayden.zieme12@hotmail.com', }, }, { type: HistoryEntryType.CUSTOMER_EMAIL_UPDATE_VERIFIED, data: { newEmailAddress: 'new@address.com', oldEmailAddress: 'hayden.zieme12@hotmail.com', }, }, ]); }); }); async function assertRequestAllowed<V>(operation: DocumentNode, variables?: V) { try { const status = await shopClient.queryStatus(operation, variables); expect(status).toBe(200); } catch (e: any) { const errorCode = getErrorCode(e); if (!errorCode) { fail(`Unexpected failure: ${JSON.stringify(e)}`); } else { fail(`Operation should be allowed, got status ${getErrorCode(e)}`); } } } async function assertRequestForbidden<V>(operation: DocumentNode, variables: V) { try { const status = await shopClient.query(operation, variables); fail('Should have thrown'); } catch (e: any) { expect(getErrorCode(e)).toBe('FORBIDDEN'); } } function getErrorCode(err: any): string { return err.response.errors[0].extensions.code; } async function createAdministratorWithPermissions( code: string, permissions: Permission[], ): Promise<{ identifier: string; password: string }> { const roleResult = await shopClient.query< Codegen.CreateRoleMutation, Codegen.CreateRoleMutationVariables >(CREATE_ROLE, { input: { code, description: '', permissions, }, }); const role = roleResult.createRole; const identifier = `${code}@${Math.random().toString(16).substr(2, 8)}`; const password = 'test'; const adminResult = await shopClient.query< Codegen.CreateAdministratorMutation, Codegen.CreateAdministratorMutationVariables >(CREATE_ADMINISTRATOR, { input: { emailAddress: identifier, firstName: code, lastName: 'Admin', password, roleIds: [role.id], }, }); const admin = adminResult.createAdministrator; return { identifier, password, }; } /** * A "sleep" function which allows the sendEmailFn time to get called. */ function waitForSendEmailFn() { return new Promise(resolve => setTimeout(resolve, 10)); } }); describe('Expiring tokens', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { plugins: [TestEmailPlugin as any], authOptions: { verificationTokenDuration: '1ms', }, }), ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); beforeEach(() => { sendEmailFn = vi.fn(); }); afterAll(async () => { await server.destroy(); }); it('attempting to verify after token has expired throws', async () => { const verificationTokenPromise = getVerificationTokenPromise(); const input: RegisterCustomerInput = { firstName: 'Barry', lastName: 'Wallace', emailAddress: 'barry.wallace@test.com', }; const { registerCustomerAccount } = await shopClient.query< CodegenShop.RegisterMutation, CodegenShop.RegisterMutationVariables >(REGISTER_ACCOUNT, { input, }); successErrorGuard.assertSuccess(registerCustomerAccount); const verificationToken = await verificationTokenPromise; expect(registerCustomerAccount.success).toBe(true); expect(sendEmailFn).toHaveBeenCalledTimes(1); expect(verificationToken).toBeDefined(); await new Promise(resolve => setTimeout(resolve, 3)); const { verifyCustomerAccount } = await shopClient.query< CodegenShop.VerifyMutation, CodegenShop.VerifyMutationVariables >(VERIFY_EMAIL, { password: 'test', token: verificationToken, }); currentUserErrorGuard.assertErrorResult(verifyCustomerAccount); expect(verifyCustomerAccount.message).toBe( 'Verification token has expired. Use refreshCustomerVerification to send a new token.', ); expect(verifyCustomerAccount.errorCode).toBe(ErrorCode.VERIFICATION_TOKEN_EXPIRED_ERROR); }); it('attempting to reset password after token has expired returns error result', async () => { const { customer } = await adminClient.query< Codegen.GetCustomerQuery, Codegen.GetCustomerQueryVariables >(GET_CUSTOMER, { id: 'T_1', }); const passwordResetTokenPromise = getPasswordResetTokenPromise(); const { requestPasswordReset } = await shopClient.query< CodegenShop.RequestPasswordResetMutation, CodegenShop.RequestPasswordResetMutationVariables >(REQUEST_PASSWORD_RESET, { identifier: customer!.emailAddress, }); successErrorGuard.assertSuccess(requestPasswordReset); const passwordResetToken = await passwordResetTokenPromise; expect(requestPasswordReset.success).toBe(true); expect(sendEmailFn).toHaveBeenCalledTimes(1); expect(passwordResetToken).toBeDefined(); await new Promise(resolve => setTimeout(resolve, 3)); const { resetPassword } = await shopClient.query< CodegenShop.ResetPasswordMutation, CodegenShop.ResetPasswordMutationVariables >(RESET_PASSWORD, { password: 'test', token: passwordResetToken, }); currentUserErrorGuard.assertErrorResult(resetPassword); expect(resetPassword.message).toBe('Password reset token has expired'); expect(resetPassword.errorCode).toBe(ErrorCode.PASSWORD_RESET_TOKEN_EXPIRED_ERROR); }); }); describe('Registration without email verification', () => { const { server, shopClient, adminClient } = createTestEnvironment( mergeConfig(testConfig(), { plugins: [TestEmailPlugin as any], authOptions: { requireVerification: false, }, }), ); const userEmailAddress = 'glen.beardsley@test.com'; beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); beforeEach(() => { sendEmailFn = vi.fn(); }); afterAll(async () => { await server.destroy(); }); it('Returns error result if no password is provided', async () => { const input: RegisterCustomerInput = { firstName: 'Glen', lastName: 'Beardsley', emailAddress: userEmailAddress, }; const { registerCustomerAccount } = await shopClient.query< CodegenShop.RegisterMutation, CodegenShop.RegisterMutationVariables >(REGISTER_ACCOUNT, { input, }); successErrorGuard.assertErrorResult(registerCustomerAccount); expect(registerCustomerAccount.message).toBe('A password must be provided.'); expect(registerCustomerAccount.errorCode).toBe(ErrorCode.MISSING_PASSWORD_ERROR); }); it('register a new account with password', async () => { const input: RegisterCustomerInput = { firstName: 'Glen', lastName: 'Beardsley', emailAddress: userEmailAddress, password: 'test', }; const { registerCustomerAccount } = await shopClient.query< CodegenShop.RegisterMutation, CodegenShop.RegisterMutationVariables >(REGISTER_ACCOUNT, { input, }); successErrorGuard.assertSuccess(registerCustomerAccount); expect(registerCustomerAccount.success).toBe(true); expect(sendEmailFn).not.toHaveBeenCalled(); }); it('can login after registering', async () => { await shopClient.asUserWithCredentials(userEmailAddress, 'test'); const result = await shopClient.query( gql` query GetMe { me { identifier } } `, ); expect(result.me.identifier).toBe(userEmailAddress); }); it('can login case insensitive', async () => { await shopClient.asUserWithCredentials(userEmailAddress.toUpperCase(), 'test'); const result = await shopClient.query( gql` query GetMe { me { identifier } } `, ); expect(result.me.identifier).toBe(userEmailAddress); }); it('normalizes customer & user email addresses', async () => { const input: RegisterCustomerInput = { firstName: 'Bobbington', lastName: 'Jarrolds', emailAddress: 'BOBBINGTON.J@Test.com', password: 'test', }; const { registerCustomerAccount } = await shopClient.query< CodegenShop.RegisterMutation, CodegenShop.RegisterMutationVariables >(REGISTER_ACCOUNT, { input, }); successErrorGuard.assertSuccess(registerCustomerAccount); const { customers } = await adminClient.query< Codegen.GetCustomerListQuery, Codegen.GetCustomerListQueryVariables >(GET_CUSTOMER_LIST, { options: { filter: { firstName: { eq: 'Bobbington' }, }, }, }); expect(customers.items[0].emailAddress).toBe('bobbington.j@test.com'); expect(customers.items[0].user?.identifier).toBe('bobbington.j@test.com'); }); it('registering with same email address with different casing does not create new user', async () => { const input: RegisterCustomerInput = { firstName: 'Glen', lastName: 'Beardsley', emailAddress: userEmailAddress.toUpperCase(), password: 'test', }; const { registerCustomerAccount } = await shopClient.query< CodegenShop.RegisterMutation, CodegenShop.RegisterMutationVariables >(REGISTER_ACCOUNT, { input, }); successErrorGuard.assertSuccess(registerCustomerAccount); const { customers } = await adminClient.query< Codegen.GetCustomerListQuery, Codegen.GetCustomerListQueryVariables >(GET_CUSTOMER_LIST, { options: { filter: { firstName: { eq: 'Glen' }, }, }, }); expect(customers.items[0].emailAddress).toBe(userEmailAddress); expect(customers.items[0].user?.identifier).toBe(userEmailAddress); }); }); describe('Updating email address without email verification', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { plugins: [TestEmailPlugin as any], authOptions: { requireVerification: false, }, }), ); let customer: Codegen.GetCustomerQuery['customer']; const NEW_EMAIL_ADDRESS = 'new@address.com'; beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); const result = await adminClient.query<Codegen.GetCustomerQuery, Codegen.GetCustomerQueryVariables>( GET_CUSTOMER, { id: 'T_1', }, ); customer = result.customer!; }, TEST_SETUP_TIMEOUT_MS); beforeEach(() => { sendEmailFn = vi.fn(); }); afterAll(async () => { await server.destroy(); }); it('updates email address', async () => { await shopClient.asUserWithCredentials(customer!.emailAddress, 'test'); const { requestUpdateCustomerEmailAddress } = await shopClient.query< CodegenShop.RequestUpdateEmailAddressMutation, CodegenShop.RequestUpdateEmailAddressMutationVariables >(REQUEST_UPDATE_EMAIL_ADDRESS, { password: 'test', newEmailAddress: NEW_EMAIL_ADDRESS, }); successErrorGuard.assertSuccess(requestUpdateCustomerEmailAddress); // Attempting to fix flakiness possibly caused by race condition on the event // subscriber await new Promise(resolve => setTimeout(resolve, 100)); expect(requestUpdateCustomerEmailAddress.success).toBe(true); expect(sendEmailFn).toHaveBeenCalledTimes(1); expect(sendEmailFn.mock.calls[0][0] instanceof IdentifierChangeEvent).toBe(true); const { activeCustomer } = await shopClient.query<CodegenShop.GetActiveCustomerQuery>( GET_ACTIVE_CUSTOMER, ); expect(activeCustomer!.emailAddress).toBe(NEW_EMAIL_ADDRESS); }); it('normalizes updated email address', async () => { await shopClient.asUserWithCredentials(NEW_EMAIL_ADDRESS, 'test'); const { requestUpdateCustomerEmailAddress } = await shopClient.query< CodegenShop.RequestUpdateEmailAddressMutation, CodegenShop.RequestUpdateEmailAddressMutationVariables >(REQUEST_UPDATE_EMAIL_ADDRESS, { password: 'test', newEmailAddress: ' Not.Normal@test.com ', }); successErrorGuard.assertSuccess(requestUpdateCustomerEmailAddress); // Attempting to fix flakiness possibly caused by race condition on the event // subscriber await new Promise(resolve => setTimeout(resolve, 100)); expect(requestUpdateCustomerEmailAddress.success).toBe(true); expect(sendEmailFn).toHaveBeenCalledTimes(1); expect(sendEmailFn.mock.calls[0][0] instanceof IdentifierChangeEvent).toBe(true); const { activeCustomer } = await shopClient.query<CodegenShop.GetActiveCustomerQuery>( GET_ACTIVE_CUSTOMER, ); expect(activeCustomer!.emailAddress).toBe('not.normal@test.com'); }); }); function getVerificationTokenPromise(): Promise<string> { return new Promise<any>(resolve => { sendEmailFn.mockImplementation((event: AccountRegistrationEvent) => { resolve(event.user.getNativeAuthenticationMethod().verificationToken); }); }); } function getPasswordResetTokenPromise(): Promise<string> { return new Promise<any>(resolve => { sendEmailFn.mockImplementation((event: PasswordResetEvent) => { resolve(event.user.getNativeAuthenticationMethod().passwordResetToken); }); }); } function getEmailUpdateTokenPromise(): Promise<{ identifierChangeToken: string | null; pendingIdentifier: string | null; }> { return new Promise(resolve => { sendEmailFn.mockImplementation((event: IdentifierChangeRequestEvent) => { resolve( pick(event.user.getNativeAuthenticationMethod(), [ 'identifierChangeToken', 'pendingIdentifier', ]), ); }); }); }
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { facetValueCollectionFilter, JobQueueService } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { LanguageCode } from './graphql/generated-e2e-admin-types'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { CREATE_COLLECTION, CREATE_FACET, GET_FACET_LIST, GET_PRODUCT_SIMPLE, GET_PRODUCT_WITH_VARIANTS, UPDATE_COLLECTION, UPDATE_PRODUCT, UPDATE_PRODUCT_VARIANTS, } from './graphql/shared-definitions'; import { assertThrowsWithMessage } from './utils/assert-throws-with-message'; import { awaitRunningJobs } from './utils/await-running-jobs'; describe('Shop catalog', () => { const { server, adminClient, shopClient } = createTestEnvironment(testConfig()); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); describe('products', () => { beforeAll(async () => { // disable the first product await adminClient.query<Codegen.DisableProductMutation, Codegen.DisableProductMutationVariables>( DISABLE_PRODUCT, { id: 'T_1', }, ); const monitorProduct = await adminClient.query< Codegen.GetProductWithVariantsQuery, Codegen.GetProductWithVariantsQueryVariables >(GET_PRODUCT_WITH_VARIANTS, { id: 'T_2', }); if (monitorProduct.product) { await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: monitorProduct.product.variants[0].id, enabled: false, }, ], }); } }); it('products list omits disabled products', async () => { const result = await shopClient.query<Codegen.GetProductsTake3Query>(gql` query GetProductsTake3 { products(options: { take: 3 }) { items { id } } } `); expect(result.products.items.map(item => item.id).sort()).toEqual(['T_2', 'T_3', 'T_4']); }); it('by id', async () => { const { product } = await shopClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { id: 'T_2' }); if (!product) { fail('Product not found'); return; } expect(product.id).toBe('T_2'); }); it('by slug', async () => { const { product } = await shopClient.query< Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables >(GET_PRODUCT_SIMPLE, { slug: 'curvy-monitor' }); if (!product) { fail('Product not found'); return; } expect(product.slug).toBe('curvy-monitor'); }); it( 'throws if neither id nor slug provided', assertThrowsWithMessage(async () => { await shopClient.query<Codegen.GetProductSimpleQuery, Codegen.GetProductSimpleQueryVariables>( GET_PRODUCT_SIMPLE, {}, ); }, 'Either the Product id or slug must be provided'), ); it('product returns null for disabled product', async () => { const result = await shopClient.query<Codegen.GetProduct1Query>(gql` query GetProduct1 { product(id: "T_1") { id } } `); expect(result.product).toBeNull(); }); it('omits disabled variants from product response', async () => { const result = await shopClient.query<Codegen.GetProduct2VariantsQuery>(gql` query GetProduct2Variants { product(id: "T_2") { id variants { id name } } } `); expect(result.product!.variants).toEqual([{ id: 'T_6', name: 'Curvy Monitor 27 inch' }]); }); }); describe('facets', () => { let facetValue: Codegen.FacetWithValuesFragment; beforeAll(async () => { const result = await adminClient.query< Codegen.CreateFacetMutation, Codegen.CreateFacetMutationVariables >(CREATE_FACET, { input: { code: 'profit-margin', isPrivate: true, translations: [{ languageCode: LanguageCode.en, name: 'Profit Margin' }], values: [ { code: 'massive', translations: [{ languageCode: LanguageCode.en, name: 'massive' }], }, ], }, }); facetValue = result.createFacet.values[0]; await adminClient.query<Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables>( UPDATE_PRODUCT, { input: { id: 'T_2', facetValueIds: [facetValue.id], }, }, ); await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: 'T_6', facetValueIds: [facetValue.id], }, ], }); }); it('omits private Product.facetValues', async () => { const result = await shopClient.query< Codegen.GetProductFacetValuesQuery, Codegen.GetProductFacetValuesQueryVariables >(GET_PRODUCT_FACET_VALUES, { id: 'T_2', }); expect(result.product!.facetValues.map(fv => fv.name)).toEqual([]); }); it('omits private ProductVariant.facetValues', async () => { const result = await shopClient.query< Codegen.GetVariantFacetValuesQuery, Codegen.GetVariantFacetValuesQueryVariables >(GET_PRODUCT_VARIANT_FACET_VALUES, { id: 'T_2', }); expect(result.product!.variants[0].facetValues.map(fv => fv.name)).toEqual([]); }); }); describe('collections', () => { let collection: Codegen.CreateCollectionMutation['createCollection']; async function createNewCollection(name: string, isPrivate: boolean, parentId?: string) { return await adminClient.query< Codegen.CreateCollectionMutation, Codegen.CreateCollectionMutationVariables >(CREATE_COLLECTION, { input: { translations: [ { languageCode: LanguageCode.en, name, description: '', slug: name, }, ], isPrivate, parentId, filters: [], }, }); } beforeAll(async () => { const result = await adminClient.query<Codegen.GetFacetListQuery>(GET_FACET_LIST); const category = result.facets.items[0]; const sportsEquipment = category.values.find(v => v.code === 'sports-equipment')!; const { createCollection } = await adminClient.query< Codegen.CreateCollectionMutation, Codegen.CreateCollectionMutationVariables >(CREATE_COLLECTION, { input: { filters: [ { code: facetValueCollectionFilter.code, arguments: [ { name: 'facetValueIds', value: `["${sportsEquipment.id}"]`, }, { name: 'containsAny', value: 'false', }, ], }, ], translations: [ { languageCode: LanguageCode.en, name: 'My Collection', description: '', slug: 'my-collection', }, ], }, }); collection = createCollection; await awaitRunningJobs(adminClient); }); it('returns collection with variants', async () => { const result = await shopClient.query< Codegen.GetCollectionVariantsQuery, Codegen.GetCollectionVariantsQueryVariables >(GET_COLLECTION_VARIANTS, { id: collection.id }); expect(result.collection!.productVariants.items).toEqual([ { id: 'T_22', name: 'Road Bike' }, { id: 'T_23', name: 'Skipping Rope' }, { id: 'T_24', name: 'Boxing Gloves' }, { id: 'T_25', name: 'Tent' }, { id: 'T_26', name: 'Cruiser Skateboard' }, { id: 'T_27', name: 'Football' }, { id: 'T_28', name: 'Running Shoe Size 40' }, { id: 'T_29', name: 'Running Shoe Size 42' }, { id: 'T_30', name: 'Running Shoe Size 44' }, { id: 'T_31', name: 'Running Shoe Size 46' }, ]); }); it('collection by slug', async () => { const result = await shopClient.query< Codegen.GetCollectionVariantsQuery, Codegen.GetCollectionVariantsQueryVariables >(GET_COLLECTION_VARIANTS, { slug: collection.slug }); expect(result.collection?.id).toBe(collection.id); }); it('omits variants from disabled products', async () => { await adminClient.query<Codegen.DisableProductMutation, Codegen.DisableProductMutationVariables>( DISABLE_PRODUCT, { id: 'T_17', }, ); await awaitRunningJobs(adminClient); const result = await shopClient.query< Codegen.GetCollectionVariantsQuery, Codegen.GetCollectionVariantsQueryVariables >(GET_COLLECTION_VARIANTS, { id: collection.id }); expect(result.collection!.productVariants.items).toEqual([ { id: 'T_22', name: 'Road Bike' }, { id: 'T_23', name: 'Skipping Rope' }, { id: 'T_24', name: 'Boxing Gloves' }, { id: 'T_25', name: 'Tent' }, { id: 'T_26', name: 'Cruiser Skateboard' }, { id: 'T_27', name: 'Football' }, ]); }); it('omits disabled product variants', async () => { await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [{ id: 'T_22', enabled: false }], }); await awaitRunningJobs(adminClient); const result = await shopClient.query< Codegen.GetCollectionVariantsQuery, Codegen.GetCollectionVariantsQueryVariables >(GET_COLLECTION_VARIANTS, { id: collection.id }); expect(result.collection!.productVariants.items).toEqual([ { id: 'T_23', name: 'Skipping Rope' }, { id: 'T_24', name: 'Boxing Gloves' }, { id: 'T_25', name: 'Tent' }, { id: 'T_26', name: 'Cruiser Skateboard' }, { id: 'T_27', name: 'Football' }, ]); }); it('collection list', async () => { const result = await shopClient.query<Codegen.GetCollectionListQuery>(GET_COLLECTION_LIST); expect(result.collections.items).toEqual([ { id: 'T_2', name: 'Plants' }, { id: 'T_3', name: 'My Collection' }, ]); }); it('omits private collections', async () => { await adminClient.query< Codegen.UpdateCollectionMutation, Codegen.UpdateCollectionMutationVariables >(UPDATE_COLLECTION, { input: { id: collection.id, isPrivate: true, }, }); await awaitRunningJobs(adminClient); const result = await shopClient.query<Codegen.GetCollectionListQuery>(GET_COLLECTION_LIST); expect(result.collections.items).toEqual([{ id: 'T_2', name: 'Plants' }]); }); it('returns null for private collection', async () => { const result = await shopClient.query< Codegen.GetCollectionVariantsQuery, Codegen.GetCollectionVariantsQueryVariables >(GET_COLLECTION_VARIANTS, { id: collection.id }); expect(result.collection).toBeNull(); }); it('product.collections list omits private collections', async () => { const result = await shopClient.query<Codegen.GetProductCollectionQuery>(gql` query GetProductCollection { product(id: "T_12") { collections { id name } } } `); expect(result.product!.collections).toEqual([]); }); it('private children not returned in Shop API', async () => { const { createCollection: parent } = await createNewCollection('public-parent', false); const { createCollection: child } = await createNewCollection('private-child', true, parent.id); const result = await shopClient.query< Codegen.GetCollectionQuery, Codegen.GetCollectionQueryVariables >(GET_COLLECTION_SHOP, { id: parent.id, }); expect(result.collection?.children).toEqual([]); }); it('private parent not returned in Shop API', async () => { const { createCollection: parent } = await createNewCollection('private-parent', true); const { createCollection: child } = await createNewCollection('public-child', false, parent.id); const result = await shopClient.query< Codegen.GetCollectionQuery, Codegen.GetCollectionQueryVariables >(GET_COLLECTION_SHOP, { id: child.id, }); expect(result.collection?.parent).toBeNull(); }); }); }); const GET_COLLECTION_SHOP = gql` query GetCollectionShop($id: ID, $slug: String) { collection(id: $id, slug: $slug) { id name slug description parent { id name } children { id name } } } `; const DISABLE_PRODUCT = gql` mutation DisableProduct($id: ID!) { updateProduct(input: { id: $id, enabled: false }) { id } } `; const GET_COLLECTION_VARIANTS = gql` query GetCollectionVariants($id: ID, $slug: String) { collection(id: $id, slug: $slug) { id productVariants { items { id name } } } } `; const GET_COLLECTION_LIST = gql` query GetCollectionList { collections { items { id name } } } `; const GET_PRODUCT_FACET_VALUES = gql` query GetProductFacetValues($id: ID!) { product(id: $id) { id name facetValues { name } } } `; const GET_PRODUCT_VARIANT_FACET_VALUES = gql` query GetVariantFacetValues($id: ID!) { product(id: $id) { id name variants { id facetValues { name } } } } `;
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { pick } from '@vendure/common/lib/pick'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { HistoryEntryType } from './graphql/generated-e2e-admin-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { CreateAddressInput, ErrorCode, UpdateAddressInput } from './graphql/generated-e2e-shop-types'; import { ATTEMPT_LOGIN, GET_CUSTOMER, GET_CUSTOMER_HISTORY } from './graphql/shared-definitions'; import { CREATE_ADDRESS, DELETE_ADDRESS, UPDATE_ADDRESS, UPDATE_CUSTOMER, UPDATE_PASSWORD, } from './graphql/shop-definitions'; import { assertThrowsWithMessage } from './utils/assert-throws-with-message'; describe('Shop customers', () => { const { server, adminClient, shopClient } = createTestEnvironment(testConfig()); let customer: NonNullable<Codegen.GetCustomerQuery['customer']>; const successErrorGuard: ErrorResultGuard<{ success: boolean }> = createErrorResultGuard( input => input.success != null, ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 2, }); await adminClient.asSuperAdmin(); // Fetch the first Customer and store it as the `customer` variable. const { customers } = await adminClient.query<Codegen.GetCustomerIdsQuery>(gql` query GetCustomerIds { customers { items { id } } } `); const result = await adminClient.query<Codegen.GetCustomerQuery, Codegen.GetCustomerQueryVariables>( GET_CUSTOMER, { id: customers.items[0].id, }, ); customer = result.customer!; }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it( 'updateCustomer throws if not logged in', assertThrowsWithMessage(async () => { const input: CodegenShop.UpdateCustomerInput = { firstName: 'xyz', }; await shopClient.query< CodegenShop.UpdateCustomerMutation, CodegenShop.UpdateCustomerMutationVariables >(UPDATE_CUSTOMER, { input, }); }, 'You are not currently authorized to perform this action'), ); it( 'createCustomerAddress throws if not logged in', assertThrowsWithMessage(async () => { const input: CreateAddressInput = { streetLine1: '1 Test Street', countryCode: 'GB', }; await shopClient.query< CodegenShop.CreateAddressShopMutation, CodegenShop.CreateAddressShopMutationVariables >(CREATE_ADDRESS, { input, }); }, 'You are not currently authorized to perform this action'), ); it( 'updateCustomerAddress throws if not logged in', assertThrowsWithMessage(async () => { const input: UpdateAddressInput = { id: 'T_1', streetLine1: 'zxc', }; await shopClient.query< CodegenShop.UpdateAddressShopMutation, CodegenShop.UpdateAddressShopMutationVariables >(UPDATE_ADDRESS, { input, }); }, 'You are not currently authorized to perform this action'), ); it( 'deleteCustomerAddress throws if not logged in', assertThrowsWithMessage(async () => { await shopClient.query< CodegenShop.DeleteAddressShopMutation, CodegenShop.DeleteAddressShopMutationVariables >(DELETE_ADDRESS, { id: 'T_1', }); }, 'You are not currently authorized to perform this action'), ); describe('logged in Customer', () => { let addressId: string; beforeAll(async () => { await shopClient.query<Codegen.AttemptLoginMutation, Codegen.AttemptLoginMutationVariables>( ATTEMPT_LOGIN, { username: customer.emailAddress, password: 'test', rememberMe: false, }, ); }); it('updateCustomer works', async () => { const input: CodegenShop.UpdateCustomerInput = { firstName: 'xyz', }; const result = await shopClient.query< CodegenShop.UpdateCustomerMutation, CodegenShop.UpdateCustomerMutationVariables >(UPDATE_CUSTOMER, { input }); expect(result.updateCustomer.firstName).toBe('xyz'); }); it('customer history for CUSTOMER_DETAIL_UPDATED', async () => { const result = await adminClient.query< Codegen.GetCustomerHistoryQuery, Codegen.GetCustomerHistoryQueryVariables >(GET_CUSTOMER_HISTORY, { id: customer.id, options: { // skip populated CUSTOMER_ADDRESS_CREATED entry skip: 3, }, }); expect(result.customer?.history.items.map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.CUSTOMER_DETAIL_UPDATED, data: { input: { firstName: 'xyz', id: 'T_1' }, }, }, ]); }); it('createCustomerAddress works', async () => { const input: CreateAddressInput = { streetLine1: '1 Test Street', countryCode: 'GB', }; const { createCustomerAddress } = await shopClient.query< CodegenShop.CreateAddressShopMutation, CodegenShop.CreateAddressShopMutationVariables >(CREATE_ADDRESS, { input }); expect(createCustomerAddress).toEqual({ id: 'T_3', streetLine1: '1 Test Street', country: { code: 'GB', }, }); addressId = createCustomerAddress.id; }); it('customer history for CUSTOMER_ADDRESS_CREATED', async () => { const result = await adminClient.query< Codegen.GetCustomerHistoryQuery, Codegen.GetCustomerHistoryQueryVariables >(GET_CUSTOMER_HISTORY, { id: customer.id, options: { // skip populated CUSTOMER_ADDRESS_CREATED, CUSTOMER_DETAIL_UPDATED entries skip: 4, }, }); expect(result.customer?.history.items.map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.CUSTOMER_ADDRESS_CREATED, data: { address: '1 Test Street, United Kingdom', }, }, ]); }); it('updateCustomerAddress works', async () => { const input: UpdateAddressInput = { id: addressId, streetLine1: '5 Test Street', countryCode: 'AT', }; const result = await shopClient.query< CodegenShop.UpdateAddressShopMutation, CodegenShop.UpdateAddressShopMutationVariables >(UPDATE_ADDRESS, { input }); expect(result.updateCustomerAddress.streetLine1).toEqual('5 Test Street'); expect(result.updateCustomerAddress.country.code).toEqual('AT'); }); it('customer history for CUSTOMER_ADDRESS_UPDATED', async () => { const result = await adminClient.query< Codegen.GetCustomerHistoryQuery, Codegen.GetCustomerHistoryQueryVariables >(GET_CUSTOMER_HISTORY, { id: customer.id, options: { skip: 5 } }); expect(result.customer?.history.items.map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.CUSTOMER_ADDRESS_UPDATED, data: { address: '5 Test Street, Austria', input: { id: addressId, streetLine1: '5 Test Street', countryCode: 'AT', }, }, }, ]); }); it( 'updateCustomerAddress fails for address not owned by Customer', assertThrowsWithMessage(async () => { const input: UpdateAddressInput = { id: 'T_2', streetLine1: '1 Test Street', }; await shopClient.query< CodegenShop.UpdateAddressShopMutation, CodegenShop.UpdateAddressShopMutationVariables >(UPDATE_ADDRESS, { input }); }, 'You are not currently authorized to perform this action'), ); it('deleteCustomerAddress works', async () => { const { deleteCustomerAddress } = await shopClient.query< CodegenShop.DeleteAddressShopMutation, CodegenShop.DeleteAddressShopMutationVariables >(DELETE_ADDRESS, { id: 'T_3' }); expect(deleteCustomerAddress.success).toBe(true); }); it('customer history for CUSTOMER_ADDRESS_DELETED', async () => { const result = await adminClient.query< Codegen.GetCustomerHistoryQuery, Codegen.GetCustomerHistoryQueryVariables >(GET_CUSTOMER_HISTORY, { id: customer!.id, options: { skip: 6 } }); expect(result.customer?.history.items.map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.CUSTOMER_ADDRESS_DELETED, data: { address: '5 Test Street, Austria', }, }, ]); }); it( 'deleteCustomerAddress fails for address not owned by Customer', assertThrowsWithMessage(async () => { await shopClient.query< CodegenShop.DeleteAddressShopMutation, CodegenShop.DeleteAddressShopMutationVariables >(DELETE_ADDRESS, { id: 'T_2' }); }, 'You are not currently authorized to perform this action'), ); it('updatePassword return error result with incorrect current password', async () => { const { updateCustomerPassword } = await shopClient.query< CodegenShop.UpdatePasswordMutation, CodegenShop.UpdatePasswordMutationVariables >(UPDATE_PASSWORD, { old: 'wrong', new: 'test2', }); successErrorGuard.assertErrorResult(updateCustomerPassword); expect(updateCustomerPassword.message).toBe('The provided credentials are invalid'); expect(updateCustomerPassword.errorCode).toBe(ErrorCode.INVALID_CREDENTIALS_ERROR); }); it('updatePassword works', async () => { const { updateCustomerPassword } = await shopClient.query< CodegenShop.UpdatePasswordMutation, CodegenShop.UpdatePasswordMutationVariables >(UPDATE_PASSWORD, { old: 'test', new: 'test2' }); successErrorGuard.assertSuccess(updateCustomerPassword); expect(updateCustomerPassword.success).toBe(true); // Log out and log in with new password const loginResult = await shopClient.asUserWithCredentials(customer.emailAddress, 'test2'); expect(loginResult.identifier).toBe(customer.emailAddress); }); it('customer history for CUSTOMER_PASSWORD_UPDATED', async () => { const result = await adminClient.query< Codegen.GetCustomerHistoryQuery, Codegen.GetCustomerHistoryQueryVariables >(GET_CUSTOMER_HISTORY, { id: customer.id, options: { skip: 7 } }); expect(result.customer?.history.items.map(pick(['type', 'data']))).toEqual([ { type: HistoryEntryType.CUSTOMER_PASSWORD_UPDATED, data: {}, }, ]); }); }); });
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { pick } from '@vendure/common/lib/pick'; import { Asset, defaultShippingCalculator, defaultShippingEligibilityChecker, manualFulfillmentHandler, mergeConfig, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-config'; import { testErrorPaymentMethod, testFailingPaymentMethod, testSuccessfulPaymentMethod, } from './fixtures/test-payment-methods'; import { countryCodeShippingEligibilityChecker, hydratingShippingEligibilityChecker, } from './fixtures/test-shipping-eligibility-checkers'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { CreateAddressInput, CreateShippingMethodDocument, CreateShippingMethodInput, GlobalFlag, LanguageCode, } from './graphql/generated-e2e-admin-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { ErrorCode, RemoveItemFromOrderDocument } from './graphql/generated-e2e-shop-types'; import { ATTEMPT_LOGIN, CANCEL_ORDER, CREATE_SHIPPING_METHOD, DELETE_PRODUCT, DELETE_PRODUCT_VARIANT, DELETE_SHIPPING_METHOD, GET_COUNTRY_LIST, GET_CUSTOMER, GET_CUSTOMER_LIST, GET_SHIPPING_METHOD_LIST, UPDATE_COUNTRY, UPDATE_PRODUCT, UPDATE_PRODUCT_VARIANTS, } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER, ADD_PAYMENT, ADJUST_ITEM_QUANTITY, GET_ACTIVE_ORDER, GET_ACTIVE_ORDER_ADDRESSES, GET_ACTIVE_ORDER_ORDERS, GET_ACTIVE_ORDER_PAYMENTS, GET_ACTIVE_ORDER_WITH_PAYMENTS, GET_AVAILABLE_COUNTRIES, GET_ELIGIBLE_SHIPPING_METHODS, GET_NEXT_STATES, GET_ORDER_BY_CODE, REMOVE_ALL_ORDER_LINES, REMOVE_ITEM_FROM_ORDER, SET_BILLING_ADDRESS, SET_CUSTOMER, SET_SHIPPING_ADDRESS, SET_SHIPPING_METHOD, TRANSITION_TO_STATE, UPDATED_ORDER_FRAGMENT, } from './graphql/shop-definitions'; import { assertThrowsWithMessage } from './utils/assert-throws-with-message'; describe('Shop orders', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { paymentOptions: { paymentMethodHandlers: [ testSuccessfulPaymentMethod, testFailingPaymentMethod, testErrorPaymentMethod, ], }, shippingOptions: { shippingEligibilityCheckers: [ defaultShippingEligibilityChecker, countryCodeShippingEligibilityChecker, hydratingShippingEligibilityChecker, ], }, customFields: { Order: [ { name: 'giftWrap', type: 'boolean', defaultValue: false }, { name: 'orderImage', type: 'relation', entity: Asset }, ], OrderLine: [ { name: 'notes', type: 'string' }, { name: 'privateField', type: 'string', public: false }, { name: 'lineImage', type: 'relation', entity: Asset }, { name: 'lineImages', type: 'relation', list: true, entity: Asset }, { name: 'dropShip', type: 'boolean', defaultValue: false }, ], }, orderOptions: { orderItemsLimit: 199, }, }), ); type OrderSuccessResult = | CodegenShop.UpdatedOrderFragment | CodegenShop.TestOrderFragmentFragment | CodegenShop.TestOrderWithPaymentsFragment | CodegenShop.ActiveOrderCustomerFragment; const orderResultGuard: ErrorResultGuard<OrderSuccessResult> = createErrorResultGuard( input => !!input.lines, ); beforeAll(async () => { await server.init({ initialData: { ...initialData, paymentMethods: [ { name: testSuccessfulPaymentMethod.code, handler: { code: testSuccessfulPaymentMethod.code, arguments: [] }, }, { name: testFailingPaymentMethod.code, handler: { code: testFailingPaymentMethod.code, arguments: [] }, }, { name: testErrorPaymentMethod.code, handler: { code: testErrorPaymentMethod.code, arguments: [] }, }, ], }, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-full.csv'), customerCount: 3, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('availableCountries returns enabled countries', async () => { // disable Austria const { countries } = await adminClient.query<Codegen.GetCountryListQuery>(GET_COUNTRY_LIST, {}); const AT = countries.items.find(c => c.code === 'AT')!; await adminClient.query<Codegen.UpdateCountryMutation, Codegen.UpdateCountryMutationVariables>( UPDATE_COUNTRY, { input: { id: AT.id, enabled: false, }, }, ); const result = await shopClient.query<CodegenShop.GetAvailableCountriesQuery>(GET_AVAILABLE_COUNTRIES); expect(result.availableCountries.length).toBe(countries.items.length - 1); expect(result.availableCountries.find(c => c.id === AT.id)).toBeUndefined(); }); describe('ordering as anonymous user', () => { let firstOrderLineId: string; let createdCustomerId: string; let orderCode: string; it('addItemToOrder starts with no session token', () => { expect(shopClient.getAuthToken()).toBeFalsy(); }); it('activeOrder returns null before any items have been added', async () => { const result = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result.activeOrder).toBeNull(); }); it('activeOrder creates an anonymous session', () => { expect(shopClient.getAuthToken()).not.toBe(''); }); it('addItemToOrder creates a new Order with an item', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(1); expect(addItemToOrder.lines[0].quantity).toBe(1); expect(addItemToOrder.lines[0].productVariant.id).toBe('T_1'); expect(addItemToOrder.lines[0].id).toBe('T_1'); firstOrderLineId = addItemToOrder.lines[0].id; orderCode = addItemToOrder.code; }); it( 'addItemToOrder errors with an invalid productVariantId', assertThrowsWithMessage( () => shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_999', quantity: 1, }), 'No ProductVariant with the id "999" could be found', ), ); it('addItemToOrder errors with a negative quantity', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_999', quantity: -3, }); orderResultGuard.assertErrorResult(addItemToOrder); expect(addItemToOrder.message).toEqual('The quantity for an OrderItem cannot be negative'); expect(addItemToOrder.errorCode).toEqual(ErrorCode.NEGATIVE_QUANTITY_ERROR); }); it('addItemToOrder with an existing productVariantId adds quantity to the existing OrderLine', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 2, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(1); expect(addItemToOrder.lines[0].quantity).toBe(3); }); describe('OrderLine customFields', () => { const GET_ORDER_WITH_ORDER_LINE_CUSTOM_FIELDS = gql` query { activeOrder { lines { id customFields { notes lineImage { id } lineImages { id } } } } } `; it('addItemToOrder with private customFields errors', async () => { try { await shopClient.query<CodegenShop.AddItemToOrderMutation>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: 'T_2', quantity: 1, customFields: { privateField: 'oh no!', }, }, ); fail('Should have thrown'); } catch (e: any) { expect(e.response.errors[0].extensions.code).toBe('BAD_USER_INPUT'); } }); it('addItemToOrder with equal customFields adds quantity to the existing OrderLine', async () => { const { addItemToOrder: add1 } = await shopClient.query<CodegenShop.AddItemToOrderMutation>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: 'T_2', quantity: 1, customFields: { notes: 'note1', }, }, ); orderResultGuard.assertSuccess(add1); expect(add1.lines.length).toBe(2); expect(add1.lines[1].quantity).toBe(1); const { addItemToOrder: add2 } = await shopClient.query<CodegenShop.AddItemToOrderMutation>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: 'T_2', quantity: 1, customFields: { notes: 'note1', }, }, ); orderResultGuard.assertSuccess(add2); expect(add2.lines.length).toBe(2); expect(add2.lines[1].quantity).toBe(2); await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: add2.lines[1].id, }); }); it('addItemToOrder with different customFields adds quantity to a new OrderLine', async () => { const { addItemToOrder: add1 } = await shopClient.query<CodegenShop.AddItemToOrderMutation>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: 'T_3', quantity: 1, customFields: { notes: 'note2', }, }, ); orderResultGuard.assertSuccess(add1); expect(add1.lines.length).toBe(2); expect(add1.lines[1].quantity).toBe(1); const { addItemToOrder: add2 } = await shopClient.query<CodegenShop.AddItemToOrderMutation>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: 'T_3', quantity: 1, customFields: { notes: 'note3', }, }, ); orderResultGuard.assertSuccess(add2); expect(add2.lines.length).toBe(3); expect(add2.lines[1].quantity).toBe(1); expect(add2.lines[2].quantity).toBe(1); await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: add2.lines[1].id, }); await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: add2.lines[2].id, }); }); // https://github.com/vendure-ecommerce/vendure/issues/1670 it('adding a second item after adjusting custom field adds new OrderLine', async () => { const { addItemToOrder: add1 } = await shopClient.query<AddItemToOrder.Mutation>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: 'T_3', quantity: 1, }, ); orderResultGuard.assertSuccess(add1); expect(add1.lines.length).toBe(2); expect(add1.lines[1].quantity).toBe(1); const { adjustOrderLine } = await shopClient.query(ADJUST_ORDER_LINE_WITH_CUSTOM_FIELDS, { orderLineId: add1.lines[1].id, quantity: 1, customFields: { notes: 'updated notes', }, }); expect(adjustOrderLine.lines[1].customFields).toEqual({ lineImage: null, lineImages: [], notes: 'updated notes', }); const { activeOrder: ao1 } = await shopClient.query(GET_ORDER_WITH_ORDER_LINE_CUSTOM_FIELDS); expect(ao1.lines[1].customFields).toEqual({ lineImage: null, lineImages: [], notes: 'updated notes', }); const updatedNotesLineId = ao1.lines[1].id; const { addItemToOrder: add2 } = await shopClient.query<AddItemToOrder.Mutation>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: 'T_3', quantity: 1, }, ); orderResultGuard.assertSuccess(add2); expect(add2.lines.length).toBe(3); expect(add2.lines[1].quantity).toBe(1); expect(add2.lines[2].quantity).toBe(1); const { activeOrder } = await shopClient.query(GET_ORDER_WITH_ORDER_LINE_CUSTOM_FIELDS); expect(activeOrder.lines.find((l: any) => l.id === updatedNotesLineId)?.customFields).toEqual( { lineImage: null, lineImages: [], notes: 'updated notes', }, ); // clean up await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: add2.lines[1].id, }); const { removeOrderLine } = await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: add2.lines[2].id, }); orderResultGuard.assertSuccess(removeOrderLine); expect(removeOrderLine.lines.length).toBe(1); }); it('addItemToOrder with relation customField', async () => { const { addItemToOrder } = await shopClient.query<CodegenShop.AddItemToOrderMutation>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: 'T_3', quantity: 1, customFields: { lineImageId: 'T_1', }, }, ); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(2); expect(addItemToOrder.lines[1].quantity).toBe(1); const { activeOrder } = await shopClient.query(GET_ORDER_WITH_ORDER_LINE_CUSTOM_FIELDS); expect(activeOrder.lines[1].customFields.lineImage).toEqual({ id: 'T_1' }); }); it('addItemToOrder with equal relation customField adds to quantity', async () => { const { addItemToOrder } = await shopClient.query<CodegenShop.AddItemToOrderMutation>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: 'T_3', quantity: 1, customFields: { lineImageId: 'T_1', }, }, ); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(2); expect(addItemToOrder.lines[1].quantity).toBe(2); const { activeOrder } = await shopClient.query(GET_ORDER_WITH_ORDER_LINE_CUSTOM_FIELDS); expect(activeOrder.lines[1].customFields.lineImage).toEqual({ id: 'T_1' }); }); it('addItemToOrder with different relation customField adds new line', async () => { const { addItemToOrder } = await shopClient.query<CodegenShop.AddItemToOrderMutation>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: 'T_3', quantity: 1, customFields: { lineImageId: 'T_2', }, }, ); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(3); expect(addItemToOrder.lines[2].quantity).toBe(1); const { activeOrder } = await shopClient.query(GET_ORDER_WITH_ORDER_LINE_CUSTOM_FIELDS); expect(activeOrder.lines[2].customFields.lineImage).toEqual({ id: 'T_2' }); }); it('adjustOrderLine updates relation reference', async () => { const { activeOrder } = await shopClient.query(GET_ORDER_WITH_ORDER_LINE_CUSTOM_FIELDS); const { adjustOrderLine } = await shopClient.query(ADJUST_ORDER_LINE_WITH_CUSTOM_FIELDS, { orderLineId: activeOrder.lines[2].id, quantity: 1, customFields: { lineImageId: 'T_1', }, }); expect(adjustOrderLine.lines[2].customFields.lineImage).toEqual({ id: 'T_1' }); await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: activeOrder.lines[2].id, }); const { removeOrderLine } = await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: activeOrder.lines[1].id, }); orderResultGuard.assertSuccess(removeOrderLine); expect(removeOrderLine.lines.length).toBe(1); }); it('addItemToOrder with list relation customField', async () => { const { addItemToOrder } = await shopClient.query<CodegenShop.AddItemToOrderMutation>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: 'T_3', quantity: 1, customFields: { lineImagesIds: ['T_1', 'T_2'], }, }, ); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(2); expect(addItemToOrder.lines[1].quantity).toBe(1); const { activeOrder } = await shopClient.query(GET_ORDER_WITH_ORDER_LINE_CUSTOM_FIELDS); expect(activeOrder.lines[1].customFields.lineImages.length).toBe(2); expect(activeOrder.lines[1].customFields.lineImages).toContainEqual({ id: 'T_1' }); expect(activeOrder.lines[1].customFields.lineImages).toContainEqual({ id: 'T_2' }); }); it('addItemToOrder with equal list relation customField adds to quantity', async () => { const { addItemToOrder } = await shopClient.query<CodegenShop.AddItemToOrderMutation>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: 'T_3', quantity: 1, customFields: { lineImagesIds: ['T_1', 'T_2'], }, }, ); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(2); expect(addItemToOrder.lines[1].quantity).toBe(2); const { activeOrder } = await shopClient.query(GET_ORDER_WITH_ORDER_LINE_CUSTOM_FIELDS); expect(activeOrder.lines[1].customFields.lineImages.length).toBe(2); expect(activeOrder.lines[1].customFields.lineImages).toContainEqual({ id: 'T_1' }); expect(activeOrder.lines[1].customFields.lineImages).toContainEqual({ id: 'T_2' }); }); it('addItemToOrder with different list relation customField adds new line', async () => { const { addItemToOrder } = await shopClient.query<CodegenShop.AddItemToOrderMutation>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: 'T_3', quantity: 1, customFields: { lineImagesIds: ['T_1'], }, }, ); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(3); expect(addItemToOrder.lines[2].quantity).toBe(1); const { activeOrder } = await shopClient.query(GET_ORDER_WITH_ORDER_LINE_CUSTOM_FIELDS); expect(activeOrder.lines[2].customFields.lineImages).toEqual([{ id: 'T_1' }]); await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: activeOrder.lines[2].id, }); const { removeOrderLine } = await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: activeOrder.lines[1].id, }); orderResultGuard.assertSuccess(removeOrderLine); expect(removeOrderLine.lines.length).toBe(1); }); }); it('addItemToOrder errors when going beyond orderItemsLimit', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 200, }); orderResultGuard.assertErrorResult(addItemToOrder); expect(addItemToOrder.message).toBe( 'Cannot add items. An order may consist of a maximum of 199 items', ); expect(addItemToOrder.errorCode).toBe(ErrorCode.ORDER_LIMIT_ERROR); }); it('adjustOrderLine adjusts the quantity', async () => { const { adjustOrderLine } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: firstOrderLineId, quantity: 50, }); orderResultGuard.assertSuccess(adjustOrderLine); expect(adjustOrderLine.lines.length).toBe(1); expect(adjustOrderLine.lines[0].quantity).toBe(50); }); it('adjustOrderLine with quantity 0 removes the line', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_3', quantity: 3, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(2); expect(addItemToOrder.lines.map(i => i.productVariant.id)).toEqual(['T_1', 'T_3']); const { adjustOrderLine } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: addItemToOrder?.lines[1].id, quantity: 0, }); orderResultGuard.assertSuccess(adjustOrderLine); expect(adjustOrderLine.lines.length).toBe(1); expect(adjustOrderLine.lines.map(i => i.productVariant.id)).toEqual(['T_1']); }); it('adjustOrderLine with quantity > stockOnHand only allows user to have stock on hand', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_3', quantity: 111, }); orderResultGuard.assertErrorResult(addItemToOrder); // Insufficient stock error should return because there are only 100 available expect(addItemToOrder.errorCode).toBe('INSUFFICIENT_STOCK_ERROR'); // But it should still add the item to the order expect(addItemToOrder.order.lines[1].quantity).toBe(100); const { adjustOrderLine } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: addItemToOrder.order.lines[1].id, quantity: 101, }); orderResultGuard.assertErrorResult(adjustOrderLine); expect(adjustOrderLine.errorCode).toBe('INSUFFICIENT_STOCK_ERROR'); expect(adjustOrderLine.message).toBe( 'Only 100 items were added to the order due to insufficient stock', ); const order = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(order.activeOrder?.lines[1].quantity).toBe(100); // clean up const { adjustOrderLine: adjustLine2 } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: addItemToOrder.order.lines[1].id, quantity: 0, }); orderResultGuard.assertSuccess(adjustLine2); expect(adjustLine2.lines.length).toBe(1); expect(adjustLine2.lines.map(i => i.productVariant.id)).toEqual(['T_1']); }); // https://github.com/vendure-ecommerce/vendure/issues/2702 it('stockOnHand check works with multiple order lines with different custom fields', async () => { const variantId = 'T_27'; const { updateProductVariants } = await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: variantId, stockOnHand: 10, outOfStockThreshold: 0, useGlobalOutOfStockThreshold: false, trackInventory: GlobalFlag.TRUE, }, ], }); expect(updateProductVariants[0]?.stockOnHand).toBe(10); expect(updateProductVariants[0]?.id).toBe('T_27'); expect(updateProductVariants[0]?.trackInventory).toBe(GlobalFlag.TRUE); const { addItemToOrder: add1 } = await shopClient.query<CodegenShop.AddItemToOrderMutation, any>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: variantId, quantity: 9, customFields: { notes: 'abc', }, }, ); orderResultGuard.assertSuccess(add1); expect(add1.lines.length).toBe(2); expect(add1.lines[1].quantity).toBe(9); expect(add1.lines[1].productVariant.id).toBe(variantId); const { addItemToOrder: add2 } = await shopClient.query<CodegenShop.AddItemToOrderMutation, any>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: variantId, quantity: 2, customFields: { notes: 'def', }, }, ); orderResultGuard.assertErrorResult(add2); expect(add2.errorCode).toBe('INSUFFICIENT_STOCK_ERROR'); expect(add2.message).toBe('Only 1 item was added to the order due to insufficient stock'); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder?.lines.length).toBe(3); expect(activeOrder?.lines[1].quantity).toBe(9); expect(activeOrder?.lines[2].quantity).toBe(1); // clean up await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: activeOrder!.lines[1].id, }); await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: activeOrder!.lines[2].id, }); }); it('adjustOrderLine handles stockOnHand correctly with multiple order lines with different custom fields when out of stock', async () => { const variantId = 'T_27'; const { updateProductVariants } = await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: variantId, stockOnHand: 10, outOfStockThreshold: 0, useGlobalOutOfStockThreshold: false, trackInventory: GlobalFlag.TRUE, }, ], }); expect(updateProductVariants[0]?.stockOnHand).toBe(10); expect(updateProductVariants[0]?.id).toBe('T_27'); expect(updateProductVariants[0]?.trackInventory).toBe(GlobalFlag.TRUE); const { addItemToOrder: add1 } = await shopClient.query<CodegenShop.AddItemToOrderMutation, any>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: variantId, quantity: 5, customFields: { notes: 'abc', }, }, ); orderResultGuard.assertSuccess(add1); expect(add1.lines.length).toBe(2); expect(add1.lines[1].quantity).toBe(5); expect(add1.lines[1].productVariant.id).toBe(variantId); const { addItemToOrder: add2 } = await shopClient.query<CodegenShop.AddItemToOrderMutation, any>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: variantId, quantity: 5, customFields: { notes: 'def', }, }, ); orderResultGuard.assertSuccess(add2); expect(add2.lines.length).toBe(3); expect(add2.lines[2].quantity).toBe(5); expect(add2.lines[2].productVariant.id).toBe(variantId); const { adjustOrderLine } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: add2.lines[1].id, quantity: 10, }); orderResultGuard.assertErrorResult(adjustOrderLine); expect(adjustOrderLine.message).toBe( 'Only 5 items were added to the order due to insufficient stock', ); expect(adjustOrderLine.errorCode).toBe(ErrorCode.INSUFFICIENT_STOCK_ERROR); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder?.lines.length).toBe(3); expect(activeOrder?.lines[1].quantity).toBe(5); expect(activeOrder?.lines[2].quantity).toBe(5); // clean up await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: activeOrder!.lines[1].id, }); await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: activeOrder!.lines[2].id, }); }); it('adjustOrderLine handles stockOnHand correctly with multiple order lines with different custom fields', async () => { const variantId = 'T_27'; const { updateProductVariants } = await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: variantId, stockOnHand: 10, outOfStockThreshold: 0, useGlobalOutOfStockThreshold: false, trackInventory: GlobalFlag.TRUE, }, ], }); expect(updateProductVariants[0]?.stockOnHand).toBe(10); expect(updateProductVariants[0]?.id).toBe('T_27'); expect(updateProductVariants[0]?.trackInventory).toBe(GlobalFlag.TRUE); const { addItemToOrder: add1 } = await shopClient.query<CodegenShop.AddItemToOrderMutation, any>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: variantId, quantity: 5, customFields: { notes: 'abc', }, }, ); orderResultGuard.assertSuccess(add1); expect(add1.lines.length).toBe(2); expect(add1.lines[1].quantity).toBe(5); expect(add1.lines[1].productVariant.id).toBe(variantId); const { addItemToOrder: add2 } = await shopClient.query<CodegenShop.AddItemToOrderMutation, any>( ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS, { productVariantId: variantId, quantity: 5, customFields: { notes: 'def', }, }, ); orderResultGuard.assertSuccess(add2); expect(add2.lines.length).toBe(3); expect(add2.lines[2].quantity).toBe(5); expect(add2.lines[2].productVariant.id).toBe(variantId); const { adjustOrderLine } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: add2.lines[1].id, quantity: 3, }); orderResultGuard.assertSuccess(adjustOrderLine); expect(adjustOrderLine?.lines.length).toBe(3); expect(adjustOrderLine?.lines[1].quantity).toBe(3); expect(adjustOrderLine?.lines[2].quantity).toBe(5); // clean up await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: adjustOrderLine.lines[1].id, }); await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: adjustOrderLine.lines[2].id, }); }); it('adjustOrderLine errors when going beyond orderItemsLimit', async () => { const { adjustOrderLine } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: firstOrderLineId, quantity: 200, }); orderResultGuard.assertErrorResult(adjustOrderLine); expect(adjustOrderLine.message).toBe( 'Cannot add items. An order may consist of a maximum of 199 items', ); expect(adjustOrderLine.errorCode).toBe(ErrorCode.ORDER_LIMIT_ERROR); }); it('adjustOrderLine errors with a negative quantity', async () => { const { adjustOrderLine } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: firstOrderLineId, quantity: -3, }); orderResultGuard.assertErrorResult(adjustOrderLine); expect(adjustOrderLine.message).toBe('The quantity for an OrderItem cannot be negative'); expect(adjustOrderLine.errorCode).toBe(ErrorCode.NEGATIVE_QUANTITY_ERROR); }); it( 'adjustOrderLine errors with an invalid orderLineId', assertThrowsWithMessage( () => shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: 'T_999', quantity: 5, }), 'This order does not contain an OrderLine with the id 999', ), ); it('removeItemFromOrder removes the correct item', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_3', quantity: 3, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(2); expect(addItemToOrder.lines.map(i => i.productVariant.id)).toEqual(['T_1', 'T_3']); const { removeOrderLine } = await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: firstOrderLineId, }); orderResultGuard.assertSuccess(removeOrderLine); expect(removeOrderLine.lines.length).toBe(1); expect(removeOrderLine.lines.map(i => i.productVariant.id)).toEqual(['T_3']); }); it( 'removeItemFromOrder errors with an invalid orderItemId', assertThrowsWithMessage( () => shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: 'T_999', }), 'This order does not contain an OrderLine with the id 999', ), ); it('nextOrderStates returns next valid states', async () => { const result = await shopClient.query<CodegenShop.GetNextOrderStatesQuery>(GET_NEXT_STATES); expect(result.nextOrderStates).toEqual(['ArrangingPayment', 'Cancelled']); }); it('transitionOrderToState returns error result for invalid state', async () => { const { transitionOrderToState } = await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'Completed' }); orderResultGuard.assertErrorResult(transitionOrderToState); expect(transitionOrderToState!.message).toBe( 'Cannot transition Order from "AddingItems" to "Completed"', ); expect(transitionOrderToState!.errorCode).toBe(ErrorCode.ORDER_STATE_TRANSITION_ERROR); }); it('attempting to transition to ArrangingPayment returns error result when Order has no Customer', async () => { const { transitionOrderToState } = await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment' }); orderResultGuard.assertErrorResult(transitionOrderToState); expect(transitionOrderToState!.transitionError).toBe( 'Cannot transition Order to the "ArrangingPayment" state without Customer details', ); expect(transitionOrderToState!.errorCode).toBe(ErrorCode.ORDER_STATE_TRANSITION_ERROR); }); it('setCustomerForOrder returns error result on email address conflict', async () => { const { customers } = await adminClient.query<Codegen.GetCustomerListQuery>(GET_CUSTOMER_LIST); const { setCustomerForOrder } = await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: customers.items[0].emailAddress, firstName: 'Test', lastName: 'Person', }, }); orderResultGuard.assertErrorResult(setCustomerForOrder); expect(setCustomerForOrder.message).toBe('The email address is not available.'); expect(setCustomerForOrder.errorCode).toBe(ErrorCode.EMAIL_ADDRESS_CONFLICT_ERROR); }); it('setCustomerForOrder creates a new Customer and associates it with the Order', async () => { const { setCustomerForOrder } = await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: 'test@test.com', firstName: 'Test', lastName: 'Person', }, }); orderResultGuard.assertSuccess(setCustomerForOrder); const customer = setCustomerForOrder.customer!; expect(customer.firstName).toBe('Test'); expect(customer.lastName).toBe('Person'); expect(customer.emailAddress).toBe('test@test.com'); createdCustomerId = customer.id; }); it('setCustomerForOrder updates the existing customer if Customer already set', async () => { const { setCustomerForOrder } = await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: 'test@test.com', firstName: 'Changed', lastName: 'Person', }, }); orderResultGuard.assertSuccess(setCustomerForOrder); const customer = setCustomerForOrder.customer!; expect(customer.firstName).toBe('Changed'); expect(customer.lastName).toBe('Person'); expect(customer.emailAddress).toBe('test@test.com'); expect(customer.id).toBe(createdCustomerId); }); it('setOrderShippingAddress sets shipping address', async () => { const address: CreateAddressInput = { fullName: 'name', company: 'company', streetLine1: '12 Shipping Street', streetLine2: null, city: 'foo', province: 'bar', postalCode: '123456', countryCode: 'US', phoneNumber: '4444444', }; const { setOrderShippingAddress } = await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: address, }); expect(setOrderShippingAddress.shippingAddress).toEqual({ fullName: 'name', company: 'company', streetLine1: '12 Shipping Street', streetLine2: null, city: 'foo', province: 'bar', postalCode: '123456', country: 'United States of America', phoneNumber: '4444444', }); }); it('setOrderBillingAddress sets billing address', async () => { const address: CreateAddressInput = { fullName: 'name', company: 'company', streetLine1: '22 Billing Avenue', streetLine2: null, city: 'foo', province: 'bar', postalCode: '123456', countryCode: 'US', phoneNumber: '4444444', }; const { setOrderBillingAddress } = await shopClient.query< Codegen.SetBillingAddressMutation, Codegen.SetBillingAddressMutationVariables >(SET_BILLING_ADDRESS, { input: address, }); expect(setOrderBillingAddress.billingAddress).toEqual({ fullName: 'name', company: 'company', streetLine1: '22 Billing Avenue', streetLine2: null, city: 'foo', province: 'bar', postalCode: '123456', country: 'United States of America', phoneNumber: '4444444', }); }); it('customer default Addresses are not updated before payment', async () => { const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); const { customer } = await adminClient.query< Codegen.GetCustomerQuery, Codegen.GetCustomerQueryVariables >(GET_CUSTOMER, { id: activeOrder!.customer!.id }); expect(customer!.addresses).toEqual([]); }); it('attempting to transition to ArrangingPayment returns error result when Order has no ShippingMethod', async () => { const { transitionOrderToState } = await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment' }); orderResultGuard.assertErrorResult(transitionOrderToState); expect(transitionOrderToState!.transitionError).toBe( 'Cannot transition Order to the "ArrangingPayment" state without a ShippingMethod', ); expect(transitionOrderToState!.errorCode).toBe(ErrorCode.ORDER_STATE_TRANSITION_ERROR); }); it('can transition to ArrangingPayment once Customer and ShippingMethod has been set', async () => { const { eligibleShippingMethods } = await shopClient.query<CodegenShop.GetShippingMethodsQuery>( GET_ELIGIBLE_SHIPPING_METHODS, ); const { setOrderShippingMethod } = await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: eligibleShippingMethods[0].id, }); orderResultGuard.assertSuccess(setOrderShippingMethod); const { transitionOrderToState } = await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment' }); orderResultGuard.assertSuccess(transitionOrderToState); expect(pick(transitionOrderToState, ['id', 'state'])).toEqual({ id: 'T_1', state: 'ArrangingPayment', }); }); it('adds a successful payment and transitions Order state', async () => { const { addPaymentToOrder } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: testSuccessfulPaymentMethod.code, metadata: {}, }, }); orderResultGuard.assertSuccess(addPaymentToOrder); const payment = addPaymentToOrder.payments![0]; expect(addPaymentToOrder.state).toBe('PaymentSettled'); expect(addPaymentToOrder.active).toBe(false); expect(addPaymentToOrder.payments!.length).toBe(1); expect(payment.method).toBe(testSuccessfulPaymentMethod.code); expect(payment.state).toBe('Settled'); }); it('activeOrder is null after payment', async () => { const result = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result.activeOrder).toBeNull(); }); it('customer default Addresses are updated after payment', async () => { const result = await adminClient.query< Codegen.GetCustomerQuery, Codegen.GetCustomerQueryVariables >(GET_CUSTOMER, { id: createdCustomerId, }); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const shippingAddress = result.customer!.addresses!.find(a => a.defaultShippingAddress)!; expect(shippingAddress.streetLine1).toBe('12 Shipping Street'); expect(shippingAddress.postalCode).toBe('123456'); expect(shippingAddress.defaultBillingAddress).toBe(false); expect(shippingAddress.defaultShippingAddress).toBe(true); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const billingAddress = result.customer!.addresses!.find(a => a.defaultBillingAddress)!; expect(billingAddress.streetLine1).toBe('22 Billing Avenue'); expect(billingAddress.postalCode).toBe('123456'); expect(billingAddress.defaultBillingAddress).toBe(true); expect(billingAddress.defaultShippingAddress).toBe(false); }); }); describe('ordering as authenticated user', () => { let firstOrderLineId: string; let activeOrder: CodegenShop.UpdatedOrderFragment; let authenticatedUserEmailAddress: string; let customers: Codegen.GetCustomerListQuery['customers']['items']; const password = 'test'; beforeAll(async () => { await adminClient.asSuperAdmin(); const result = await adminClient.query< Codegen.GetCustomerListQuery, Codegen.GetCustomerListQueryVariables >(GET_CUSTOMER_LIST, { options: { take: 2, }, }); customers = result.customers.items; authenticatedUserEmailAddress = customers[0].emailAddress; await shopClient.asUserWithCredentials(authenticatedUserEmailAddress, password); }); it('activeOrder returns null before any items have been added', async () => { const result = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result.activeOrder).toBeNull(); }); it('addItemToOrder creates a new Order with an item', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(1); expect(addItemToOrder.lines[0].quantity).toBe(1); expect(addItemToOrder.lines[0].productVariant.id).toBe('T_1'); activeOrder = addItemToOrder!; firstOrderLineId = addItemToOrder.lines[0].id; }); it('activeOrder returns order after item has been added', async () => { const result = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result.activeOrder!.id).toBe(activeOrder.id); expect(result.activeOrder!.state).toBe('AddingItems'); }); it('activeOrder resolves customer user', async () => { const result = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result.activeOrder!.customer!.user).toEqual({ id: 'T_2', identifier: 'hayden.zieme12@hotmail.com', }); }); it('addItemToOrder with an existing productVariantId adds quantity to the existing OrderLine', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 2, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(1); expect(addItemToOrder.lines[0].quantity).toBe(3); }); it('adjustOrderLine adjusts the quantity', async () => { const { adjustOrderLine } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: firstOrderLineId, quantity: 50, }); orderResultGuard.assertSuccess(adjustOrderLine); expect(adjustOrderLine.lines.length).toBe(1); expect(adjustOrderLine.lines[0].quantity).toBe(50); }); it('removeItemFromOrder removes the correct item', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_3', quantity: 3, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(2); expect(addItemToOrder.lines.map(i => i.productVariant.id)).toEqual(['T_1', 'T_3']); const { removeOrderLine } = await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: firstOrderLineId, }); orderResultGuard.assertSuccess(removeOrderLine); expect(removeOrderLine.lines.length).toBe(1); expect(removeOrderLine.lines.map(i => i.productVariant.id)).toEqual(['T_3']); }); it('nextOrderStates returns next valid states', async () => { const result = await shopClient.query<CodegenShop.GetNextOrderStatesQuery>(GET_NEXT_STATES); expect(result.nextOrderStates).toEqual(['ArrangingPayment', 'Cancelled']); }); it('logging out and back in again resumes the last active order', async () => { await shopClient.asAnonymousUser(); const result1 = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result1.activeOrder).toBeNull(); await shopClient.asUserWithCredentials(authenticatedUserEmailAddress, password); const result2 = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result2.activeOrder!.id).toBe(activeOrder.id); }); it('cannot setCustomerForOrder when already logged in', async () => { const { setCustomerForOrder } = await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: 'newperson@email.com', firstName: 'New', lastName: 'Person', }, }); orderResultGuard.assertErrorResult(setCustomerForOrder); expect(setCustomerForOrder.message).toBe( 'Cannot set a Customer for the Order when already logged in', ); expect(setCustomerForOrder.errorCode).toBe(ErrorCode.ALREADY_LOGGED_IN_ERROR); }); describe('shipping', () => { let shippingMethods: CodegenShop.GetShippingMethodsQuery['eligibleShippingMethods']; it( 'setOrderShippingAddress throws with invalid countryCode', assertThrowsWithMessage(() => { const address: CreateAddressInput = { streetLine1: '12 the street', countryCode: 'INVALID', }; return shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: address, }); }, 'The countryCode "INVALID" was not recognized'), ); it('setOrderShippingAddress sets shipping address', async () => { const address: CreateAddressInput = { fullName: 'name', company: 'company', streetLine1: '12 the street', streetLine2: null, city: 'foo', province: 'bar', postalCode: '123456', countryCode: 'US', phoneNumber: '4444444', }; const { setOrderShippingAddress } = await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: address, }); expect(setOrderShippingAddress.shippingAddress).toEqual({ fullName: 'name', company: 'company', streetLine1: '12 the street', streetLine2: null, city: 'foo', province: 'bar', postalCode: '123456', country: 'United States of America', phoneNumber: '4444444', }); }); it('eligibleShippingMethods lists shipping methods', async () => { const result = await shopClient.query<CodegenShop.GetShippingMethodsQuery>( GET_ELIGIBLE_SHIPPING_METHODS, ); shippingMethods = result.eligibleShippingMethods; expect(shippingMethods).toEqual([ { id: 'T_1', price: 500, code: 'standard-shipping', name: 'Standard Shipping', description: '', }, { id: 'T_2', price: 1000, code: 'express-shipping', name: 'Express Shipping', description: '', }, ]); }); it('shipping is initially unset', async () => { const result = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result.activeOrder!.shipping).toEqual(0); expect(result.activeOrder!.shippingLines).toEqual([]); }); it('setOrderShippingMethod sets the shipping method', async () => { const result = await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: shippingMethods[1].id, }); const activeOrderResult = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); const order = activeOrderResult.activeOrder!; expect(order.shipping).toBe(shippingMethods[1].price); expect(order.shippingLines[0].shippingMethod.id).toBe(shippingMethods[1].id); expect(order.shippingLines[0].shippingMethod.description).toBe( shippingMethods[1].description, ); }); it('shipping method is preserved after adjustOrderLine', async () => { const activeOrderResult = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); activeOrder = activeOrderResult.activeOrder!; const { adjustOrderLine } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: activeOrder.lines[0].id, quantity: 10, }); orderResultGuard.assertSuccess(adjustOrderLine); expect(adjustOrderLine.shipping).toBe(shippingMethods[1].price); expect(adjustOrderLine.shippingLines[0].shippingMethod.id).toBe(shippingMethods[1].id); expect(adjustOrderLine.shippingLines[0].shippingMethod.description).toBe( shippingMethods[1].description, ); }); }); describe('payment', () => { it('attempting add a Payment returns error result when in AddingItems state', async () => { const { addPaymentToOrder } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: testSuccessfulPaymentMethod.code, metadata: {}, }, }); orderResultGuard.assertErrorResult(addPaymentToOrder); expect(addPaymentToOrder.message).toBe( 'A Payment may only be added when Order is in "ArrangingPayment" state', ); expect(addPaymentToOrder.errorCode).toBe(ErrorCode.ORDER_PAYMENT_STATE_ERROR); }); it('transitions to the ArrangingPayment state', async () => { const { transitionOrderToState } = await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment' }); orderResultGuard.assertSuccess(transitionOrderToState); expect(pick(transitionOrderToState, ['id', 'state'])).toEqual({ id: activeOrder.id, state: 'ArrangingPayment', }); }); it('attempting to add an item returns error result when in ArrangingPayment state', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_4', quantity: 1, }); orderResultGuard.assertErrorResult(addItemToOrder); expect(addItemToOrder.message).toBe( 'Order contents may only be modified when in the "AddingItems" state', ); expect(addItemToOrder.errorCode).toBe(ErrorCode.ORDER_MODIFICATION_ERROR); }); it('attempting to modify item quantity returns error result when in ArrangingPayment state', async () => { const { adjustOrderLine } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: activeOrder.lines[0].id, quantity: 12, }); orderResultGuard.assertErrorResult(adjustOrderLine); expect(adjustOrderLine.message).toBe( 'Order contents may only be modified when in the "AddingItems" state', ); expect(adjustOrderLine.errorCode).toBe(ErrorCode.ORDER_MODIFICATION_ERROR); }); it('attempting to remove an item returns error result when in ArrangingPayment state', async () => { const { removeOrderLine } = await shopClient.query< CodegenShop.RemoveItemFromOrderMutation, CodegenShop.RemoveItemFromOrderMutationVariables >(REMOVE_ITEM_FROM_ORDER, { orderLineId: activeOrder.lines[0].id, }); orderResultGuard.assertErrorResult(removeOrderLine); expect(removeOrderLine.message).toBe( 'Order contents may only be modified when in the "AddingItems" state', ); expect(removeOrderLine.errorCode).toBe(ErrorCode.ORDER_MODIFICATION_ERROR); }); it('attempting to remove all items returns error result when in ArrangingPayment state', async () => { const { removeAllOrderLines } = await shopClient.query<CodegenShop.RemoveAllOrderLinesMutation>(REMOVE_ALL_ORDER_LINES); orderResultGuard.assertErrorResult(removeAllOrderLines); expect(removeAllOrderLines.message).toBe( 'Order contents may only be modified when in the "AddingItems" state', ); expect(removeAllOrderLines.errorCode).toBe(ErrorCode.ORDER_MODIFICATION_ERROR); }); it('attempting to setOrderShippingMethod returns error result when in ArrangingPayment state', async () => { const shippingMethodsResult = await shopClient.query<CodegenShop.GetShippingMethodsQuery>( GET_ELIGIBLE_SHIPPING_METHODS, ); const shippingMethods = shippingMethodsResult.eligibleShippingMethods; const { setOrderShippingMethod } = await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: shippingMethods[0].id, }); orderResultGuard.assertErrorResult(setOrderShippingMethod); expect(setOrderShippingMethod.message).toBe( 'Order contents may only be modified when in the "AddingItems" state', ); expect(setOrderShippingMethod.errorCode).toBe(ErrorCode.ORDER_MODIFICATION_ERROR); }); it('adds a declined payment', async () => { const { addPaymentToOrder } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: testFailingPaymentMethod.code, metadata: { foo: 'bar', }, }, }); orderResultGuard.assertErrorResult(addPaymentToOrder); expect(addPaymentToOrder.message).toBe('The payment was declined'); expect(addPaymentToOrder.errorCode).toBe(ErrorCode.PAYMENT_DECLINED_ERROR); expect((addPaymentToOrder as any).paymentErrorMessage).toBe('Insufficient funds'); const { activeOrder: order } = await shopClient.query<CodegenShop.GetActiveOrderWithPaymentsQuery>( GET_ACTIVE_ORDER_WITH_PAYMENTS, ); const payment = order!.payments![0]; expect(order!.state).toBe('ArrangingPayment'); expect(order!.payments!.length).toBe(1); expect(payment.method).toBe(testFailingPaymentMethod.code); expect(payment.state).toBe('Declined'); expect(payment.transactionId).toBe(null); expect(payment.metadata).toEqual({ public: { foo: 'bar' }, }); }); it('adds an error payment and returns error result', async () => { const { addPaymentToOrder } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: testErrorPaymentMethod.code, metadata: { foo: 'bar', }, }, }); orderResultGuard.assertErrorResult(addPaymentToOrder); expect(addPaymentToOrder.message).toBe('The payment failed'); expect(addPaymentToOrder.errorCode).toBe(ErrorCode.PAYMENT_FAILED_ERROR); expect((addPaymentToOrder as any).paymentErrorMessage).toBe('Something went horribly wrong'); const result = await shopClient.query<CodegenShop.GetActiveOrderPaymentsQuery>( GET_ACTIVE_ORDER_PAYMENTS, ); const payment = result.activeOrder!.payments![1]; expect(result.activeOrder!.payments!.length).toBe(2); expect(payment.method).toBe(testErrorPaymentMethod.code); expect(payment.state).toBe('Error'); expect(payment.errorMessage).toBe('Something went horribly wrong'); }); it('adds a successful payment and transitions Order state', async () => { const { addPaymentToOrder } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: testSuccessfulPaymentMethod.code, metadata: { baz: 'quux', }, }, }); orderResultGuard.assertSuccess(addPaymentToOrder); const payment = addPaymentToOrder.payments!.find(p => p.transactionId === '12345')!; expect(addPaymentToOrder.state).toBe('PaymentSettled'); expect(addPaymentToOrder.active).toBe(false); expect(addPaymentToOrder.payments!.length).toBe(3); expect(payment.method).toBe(testSuccessfulPaymentMethod.code); expect(payment.state).toBe('Settled'); expect(payment.transactionId).toBe('12345'); expect(payment.metadata).toEqual({ public: { baz: 'quux' }, }); }); it('does not create new address when Customer already has address', async () => { const { customer } = await adminClient.query< Codegen.GetCustomerQuery, Codegen.GetCustomerQueryVariables >(GET_CUSTOMER, { id: customers[0].id }); expect(customer!.addresses!.length).toBe(1); }); }); describe('orderByCode', () => { describe('immediately after Order is placed', () => { it('works when authenticated', async () => { const result = await shopClient.query< CodegenShop.GetOrderByCodeQuery, CodegenShop.GetOrderByCodeQueryVariables >(GET_ORDER_BY_CODE, { code: activeOrder.code, }); expect(result.orderByCode!.id).toBe(activeOrder.id); }); it('works when anonymous', async () => { await shopClient.asAnonymousUser(); const result = await shopClient.query< CodegenShop.GetOrderByCodeQuery, CodegenShop.GetOrderByCodeQueryVariables >(GET_ORDER_BY_CODE, { code: activeOrder.code, }); expect(result.orderByCode!.id).toBe(activeOrder.id); }); it( "throws error for another user's Order", assertThrowsWithMessage(async () => { authenticatedUserEmailAddress = customers[1].emailAddress; await shopClient.asUserWithCredentials(authenticatedUserEmailAddress, password); return shopClient.query< CodegenShop.GetOrderByCodeQuery, CodegenShop.GetOrderByCodeQueryVariables >(GET_ORDER_BY_CODE, { code: activeOrder.code, }); }, 'You are not currently authorized to perform this action'), ); }); describe('3 hours after the Order has been placed', () => { let dateNowMock: any; beforeAll(() => { // mock Date.now: add 3 hours const nowIn3H = Date.now() + 3 * 3600 * 1000; dateNowMock = vi.spyOn(global.Date, 'now').mockImplementation(() => nowIn3H); }); it('still works when authenticated as owner', async () => { authenticatedUserEmailAddress = customers[0].emailAddress; await shopClient.asUserWithCredentials(authenticatedUserEmailAddress, password); const result = await shopClient.query< CodegenShop.GetOrderByCodeQuery, CodegenShop.GetOrderByCodeQueryVariables >(GET_ORDER_BY_CODE, { code: activeOrder.code, }); expect(result.orderByCode!.id).toBe(activeOrder.id); }); it( 'access denied when anonymous', assertThrowsWithMessage(async () => { await shopClient.asAnonymousUser(); await shopClient.query< CodegenShop.GetOrderByCodeQuery, CodegenShop.GetOrderByCodeQueryVariables >(GET_ORDER_BY_CODE, { code: activeOrder.code, }); }, 'You are not currently authorized to perform this action'), ); afterAll(() => { // restore Date.now dateNowMock.mockRestore(); }); }); }); }); describe('order merging', () => { let customers: Codegen.GetCustomerListQuery['customers']['items']; beforeAll(async () => { const result = await adminClient.query<Codegen.GetCustomerListQuery>(GET_CUSTOMER_LIST); customers = result.customers.items; }); it('merges guest order with no existing order', async () => { await shopClient.asAnonymousUser(); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(1); expect(addItemToOrder.lines[0].productVariant.id).toBe('T_1'); await shopClient.query<Codegen.AttemptLoginMutation, Codegen.AttemptLoginMutationVariables>( ATTEMPT_LOGIN, { username: customers[1].emailAddress, password: 'test', }, ); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder!.lines.length).toBe(1); expect(activeOrder!.lines[0].productVariant.id).toBe('T_1'); }); it('merges guest order with existing order', async () => { await shopClient.asAnonymousUser(); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_2', quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(1); expect(addItemToOrder.lines[0].productVariant.id).toBe('T_2'); await shopClient.query<Codegen.AttemptLoginMutation, Codegen.AttemptLoginMutationVariables>( ATTEMPT_LOGIN, { username: customers[1].emailAddress, password: 'test', }, ); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder!.lines.length).toBe(2); expect(activeOrder!.lines[0].productVariant.id).toBe('T_1'); expect(activeOrder!.lines[1].productVariant.id).toBe('T_2'); }); /** * See https://github.com/vendure-ecommerce/vendure/issues/263 */ it('does not merge when logging in to a different account (issue #263)', async () => { await shopClient.query<Codegen.AttemptLoginMutation, Codegen.AttemptLoginMutationVariables>( ATTEMPT_LOGIN, { username: customers[2].emailAddress, password: 'test', }, ); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder).toBeNull(); }); it('does not merge when logging back to other account (issue #263)', async () => { const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_3', quantity: 1, }); await shopClient.query<Codegen.AttemptLoginMutation, Codegen.AttemptLoginMutationVariables>( ATTEMPT_LOGIN, { username: customers[1].emailAddress, password: 'test', }, ); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(activeOrder!.lines.length).toBe(2); expect(activeOrder!.lines[0].productVariant.id).toBe('T_1'); expect(activeOrder!.lines[1].productVariant.id).toBe('T_2'); }); // https://github.com/vendure-ecommerce/vendure/issues/754 it('handles merging when an existing order has OrderLines', async () => { async function setShippingOnActiveOrder() { await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { streetLine1: '12 the street', countryCode: 'US', }, }); const { eligibleShippingMethods } = await shopClient.query<CodegenShop.GetShippingMethodsQuery>( GET_ELIGIBLE_SHIPPING_METHODS, ); await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: eligibleShippingMethods[1].id, }); } // Set up an existing order and add a ShippingLine await shopClient.asUserWithCredentials(customers[2].emailAddress, 'test'); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_3', quantity: 1, }); await setShippingOnActiveOrder(); // Now start a new guest order await shopClient.query(LOG_OUT); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_4', quantity: 1, }); await setShippingOnActiveOrder(); // attempt to log in and merge the guest order with the existing order const { login } = await shopClient.query< Codegen.AttemptLoginMutation, Codegen.AttemptLoginMutationVariables >(ATTEMPT_LOGIN, { username: customers[2].emailAddress, password: 'test', }); expect(login.identifier).toBe(customers[2].emailAddress); }); }); describe('security of customer data', () => { let customers: Codegen.GetCustomerListQuery['customers']['items']; beforeAll(async () => { const result = await adminClient.query<Codegen.GetCustomerListQuery>(GET_CUSTOMER_LIST); customers = result.customers.items; }); it('cannot setCustomOrder to existing non-guest Customer', async () => { await shopClient.asAnonymousUser(); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); const { setCustomerForOrder } = await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: customers[0].emailAddress, firstName: 'Evil', lastName: 'Hacker', }, }); orderResultGuard.assertErrorResult(setCustomerForOrder); expect(setCustomerForOrder.message).toBe('The email address is not available.'); expect(setCustomerForOrder.errorCode).toBe(ErrorCode.EMAIL_ADDRESS_CONFLICT_ERROR); const { customer } = await adminClient.query< Codegen.GetCustomerQuery, Codegen.GetCustomerQueryVariables >(GET_CUSTOMER, { id: customers[0].id, }); expect(customer!.firstName).not.toBe('Evil'); expect(customer!.lastName).not.toBe('Hacker'); }); it('guest cannot access Addresses of guest customer', async () => { await shopClient.asAnonymousUser(); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: 'test@test.com', firstName: 'Evil', lastName: 'Hacker', }, }); const { activeOrder } = await shopClient.query<CodegenShop.GetCustomerAddressesQuery>(GET_ACTIVE_ORDER_ADDRESSES); expect(activeOrder!.customer!.addresses).toEqual([]); }); it('guest cannot access Orders of guest customer', async () => { await shopClient.asAnonymousUser(); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: 'test@test.com', firstName: 'Evil', lastName: 'Hacker', }, }); const { activeOrder } = await shopClient.query<CodegenShop.GetCustomerOrdersQuery>(GET_ACTIVE_ORDER_ORDERS); expect(activeOrder!.customer!.orders.items).toEqual([]); }); }); describe('order custom fields', () => { it('custom fields added to type', async () => { await shopClient.asAnonymousUser(); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); const { activeOrder } = await shopClient.query(GET_ORDER_CUSTOM_FIELDS); expect(activeOrder?.customFields).toEqual({ orderImage: null, giftWrap: false, }); }); it('setting order custom fields', async () => { const { setOrderCustomFields } = await shopClient.query(SET_ORDER_CUSTOM_FIELDS, { input: { customFields: { giftWrap: true, orderImageId: 'T_1' }, }, }); expect(setOrderCustomFields?.customFields).toEqual({ orderImage: { id: 'T_1' }, giftWrap: true, }); const { activeOrder } = await shopClient.query(GET_ORDER_CUSTOM_FIELDS); expect(activeOrder?.customFields).toEqual({ orderImage: { id: 'T_1' }, giftWrap: true, }); }); }); describe('remove all order lines', () => { beforeAll(async () => { await shopClient.asAnonymousUser(); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_2', quantity: 3, }); }); it('should remove all order lines', async () => { const { removeAllOrderLines } = await shopClient.query< CodegenShop.RemoveAllOrderLinesMutation, CodegenShop.RemoveAllOrderLinesMutationVariables >(REMOVE_ALL_ORDER_LINES); orderResultGuard.assertSuccess(removeAllOrderLines); expect(removeAllOrderLines?.total).toBe(0); expect(removeAllOrderLines?.lines.length).toBe(0); }); }); describe('validation of product variant availability', () => { const bonsaiProductId = 'T_20'; const bonsaiVariantId = 'T_34'; beforeAll(async () => { await shopClient.asAnonymousUser(); }); it( 'addItemToOrder errors when product is disabled', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables >(UPDATE_PRODUCT, { input: { id: bonsaiProductId, enabled: false, }, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: bonsaiVariantId, quantity: 1, }); }, 'No ProductVariant with the id "34" could be found'), ); it( 'addItemToOrder errors when product variant is disabled', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.UpdateProductMutation, Codegen.UpdateProductMutationVariables >(UPDATE_PRODUCT, { input: { id: bonsaiProductId, enabled: true, }, }); await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: bonsaiVariantId, enabled: false, }, ], }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: bonsaiVariantId, quantity: 1, }); }, 'No ProductVariant with the id "34" could be found'), ); it( 'addItemToOrder errors when product is deleted', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.DeleteProductMutation, Codegen.DeleteProductMutationVariables >(DELETE_PRODUCT, { id: bonsaiProductId, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: bonsaiVariantId, quantity: 1, }); }, 'No ProductVariant with the id "34" could be found'), ); it( 'addItemToOrder errors when product variant is deleted', assertThrowsWithMessage(async () => { await adminClient.query< Codegen.DeleteProductVariantMutation, Codegen.DeleteProductVariantMutationVariables >(DELETE_PRODUCT_VARIANT, { id: bonsaiVariantId, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: bonsaiVariantId, quantity: 1, }); }, 'No ProductVariant with the id "34" could be found'), ); let orderWithDeletedProductVariantId: string; it('errors when transitioning to ArrangingPayment with deleted variant', async () => { const orchidProductId = 'T_19'; const orchidVariantId = 'T_33'; await shopClient.asUserWithCredentials('marques.sawayn@hotmail.com', 'test'); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: orchidVariantId, quantity: 1, }); orderResultGuard.assertSuccess(addItemToOrder); orderWithDeletedProductVariantId = addItemToOrder.id; await adminClient.query<Codegen.DeleteProductMutation, Codegen.DeleteProductMutationVariables>( DELETE_PRODUCT, { id: orchidProductId, }, ); const { transitionOrderToState } = await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment', }); orderResultGuard.assertErrorResult(transitionOrderToState); expect(transitionOrderToState!.transitionError).toBe( 'Cannot transition to "ArrangingPayment" because the Order contains ProductVariants which are no longer available', ); expect(transitionOrderToState!.errorCode).toBe(ErrorCode.ORDER_STATE_TRANSITION_ERROR); }); // https://github.com/vendure-ecommerce/vendure/issues/1567 it('allows transitioning to Cancelled with deleted variant', async () => { const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId: orderWithDeletedProductVariantId, }, }); orderResultGuard.assertSuccess(cancelOrder); expect(cancelOrder.state).toBe('Cancelled'); }); }); // https://github.com/vendure-ecommerce/vendure/issues/1195 describe('shipping method invalidation', () => { let GBShippingMethodId: string; let ATShippingMethodId: string; beforeAll(async () => { // First we will remove all ShippingMethods and set up 2 specialized ones const { shippingMethods } = await adminClient.query<Codegen.GetShippingMethodListQuery>(GET_SHIPPING_METHOD_LIST); for (const method of shippingMethods.items) { await adminClient.query< Codegen.DeleteShippingMethodMutation, Codegen.DeleteShippingMethodMutationVariables >(DELETE_SHIPPING_METHOD, { id: method.id, }); } function createCountryCodeShippingMethodInput(countryCode: string): CreateShippingMethodInput { return { code: `${countryCode}-shipping`, translations: [ { languageCode: LanguageCode.en, name: `${countryCode} shipping`, description: '' }, ], fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: countryCodeShippingEligibilityChecker.code, arguments: [{ name: 'countryCode', value: countryCode }], }, calculator: { code: defaultShippingCalculator.code, arguments: [ { name: 'rate', value: '1000' }, { name: 'taxRate', value: '0' }, { name: 'includesTax', value: 'auto' }, ], }, }; } // Now create 2 shipping methods, valid only for a single country const result1 = await adminClient.query< Codegen.CreateShippingMethodMutation, Codegen.CreateShippingMethodMutationVariables >(CREATE_SHIPPING_METHOD, { input: createCountryCodeShippingMethodInput('GB'), }); GBShippingMethodId = result1.createShippingMethod.id; const result2 = await adminClient.query< Codegen.CreateShippingMethodMutation, Codegen.CreateShippingMethodMutationVariables >(CREATE_SHIPPING_METHOD, { input: createCountryCodeShippingMethodInput('AT'), }); ATShippingMethodId = result2.createShippingMethod.id; // Now create an order to GB and set the GB shipping method const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); await shopClient.query< CodegenShop.SetCustomerForOrderMutation, CodegenShop.SetCustomerForOrderMutationVariables >(SET_CUSTOMER, { input: { emailAddress: 'test-2@test.com', firstName: 'Test', lastName: 'Person 2', }, }); await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { streetLine1: '12 the street', countryCode: 'GB', }, }); await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: GBShippingMethodId, }); }); it('if selected method no longer eligible, next best is set automatically', async () => { const result1 = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result1.activeOrder?.shippingLines[0].shippingMethod.id).toBe(GBShippingMethodId); await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { streetLine1: '12 the street', countryCode: 'AT', }, }); const result2 = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result2.activeOrder?.shippingLines[0].shippingMethod.id).toBe(ATShippingMethodId); }); it('if no method is eligible, shipping lines are cleared', async () => { await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { streetLine1: '12 the street', countryCode: 'US', }, }); const result = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result.activeOrder?.shippingLines).toEqual([]); }); // https://github.com/vendure-ecommerce/vendure/issues/1441 it('shipping methods are re-evaluated when all OrderLines are removed', async () => { const { createShippingMethod } = await adminClient.query< CreateShippingMethod.Mutation, CreateShippingMethod.Variables >(CREATE_SHIPPING_METHOD, { input: { code: 'min-price-shipping', translations: [ { languageCode: LanguageCode.en, name: 'min price shipping', description: '' }, ], fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: defaultShippingEligibilityChecker.code, arguments: [{ name: 'orderMinimum', value: '100' }], }, calculator: { code: defaultShippingCalculator.code, arguments: [ { name: 'rate', value: '1000' }, { name: 'taxRate', value: '0' }, { name: 'includesTax', value: 'auto' }, ], }, }, }); const minPriceShippingMethodId = createShippingMethod.id; await shopClient.query<SetShippingMethod.Mutation, SetShippingMethod.Variables>( SET_SHIPPING_METHOD, { id: minPriceShippingMethodId, }, ); const result1 = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result1.activeOrder?.shippingLines[0].shippingMethod.id).toBe(minPriceShippingMethodId); const { removeAllOrderLines } = await shopClient.query< CodegenShop.RemoveAllOrderLinesMutation, CodegenShop.RemoveAllOrderLinesMutationVariables >(REMOVE_ALL_ORDER_LINES); orderResultGuard.assertSuccess(removeAllOrderLines); expect(removeAllOrderLines.shippingLines.length).toBe(0); expect(removeAllOrderLines.shippingWithTax).toBe(0); }); }); describe('edge cases', () => { it('calling setShippingMethod and setBillingMethod in parallel does not introduce race condition', async () => { const shippingAddress: CreateAddressInput = { fullName: 'name', company: 'company', streetLine1: '12 Shipping Street', streetLine2: null, city: 'foo', province: 'bar', postalCode: '123456', countryCode: 'US', phoneNumber: '4444444', }; const billingAddress: CreateAddressInput = { fullName: 'name', company: 'company', streetLine1: '22 Billing Avenue', streetLine2: null, city: 'foo', province: 'bar', postalCode: '123456', countryCode: 'US', phoneNumber: '4444444', }; await Promise.all([ shopClient.query< CodegenShop.SetBillingAddressMutation, CodegenShop.SetBillingAddressMutationVariables >(SET_BILLING_ADDRESS, { input: billingAddress, }), shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: shippingAddress, }), ]); const { activeOrder } = await shopClient.query(gql` query { activeOrder { shippingAddress { ...OrderAddress } billingAddress { ...OrderAddress } } } fragment OrderAddress on OrderAddress { fullName company streetLine1 streetLine2 city province postalCode countryCode phoneNumber } `); expect(activeOrder.shippingAddress).toEqual(shippingAddress); expect(activeOrder.billingAddress).toEqual(billingAddress); }); // https://github.com/vendure-ecommerce/vendure/issues/2548 it('hydrating Order in the ShippingEligibilityChecker does not break order modification', async () => { // First we'll create a ShippingMethod that uses the hydrating checker await adminClient.query(CreateShippingMethodDocument, { input: { code: 'hydrating-checker', translations: [ { languageCode: LanguageCode.en, name: 'hydrating checker', description: '' }, ], fulfillmentHandler: manualFulfillmentHandler.code, checker: { code: hydratingShippingEligibilityChecker.code, arguments: [], }, calculator: { code: defaultShippingCalculator.code, arguments: [ { name: 'rate', value: '1000' }, { name: 'taxRate', value: '0' }, { name: 'includesTax', value: 'auto' }, ], }, }, }); await shopClient.asAnonymousUser(); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_1', quantity: 1, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: 'T_2', quantity: 3, }); const result1 = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result1.activeOrder?.lines.map(l => l.linePriceWithTax).sort()).toEqual([155880, 503640]); expect(result1.activeOrder?.subTotalWithTax).toBe(659520); // set the shipping method that uses the hydrating checker const { eligibleShippingMethods } = await shopClient.query<CodegenShop.GetShippingMethodsQuery>( GET_ELIGIBLE_SHIPPING_METHODS, ); const { setOrderShippingMethod } = await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: eligibleShippingMethods.find(m => m.code === 'hydrating-checker')!.id, }); orderResultGuard.assertSuccess(setOrderShippingMethod); // Remove an item from the order const { removeOrderLine } = await shopClient.query(RemoveItemFromOrderDocument, { orderLineId: result1.activeOrder!.lines[0].id, }); orderResultGuard.assertSuccess(removeOrderLine); expect(removeOrderLine.lines.length).toBe(1); const result2 = await shopClient.query<CodegenShop.GetActiveOrderQuery>(GET_ACTIVE_ORDER); expect(result2.activeOrder?.lines.map(l => l.linePriceWithTax).sort()).toEqual([503640]); expect(result2.activeOrder?.subTotalWithTax).toBe(503640); }); }); }); const GET_ORDER_CUSTOM_FIELDS = gql` query GetOrderCustomFields { activeOrder { id customFields { giftWrap orderImage { id } } } } `; const SET_ORDER_CUSTOM_FIELDS = gql` mutation SetOrderCustomFields($input: UpdateOrderInput!) { setOrderCustomFields(input: $input) { ... on Order { id customFields { giftWrap orderImage { id } } } ... on ErrorResult { errorCode message } } } `; export const LOG_OUT = gql` mutation LogOut { logout { success } } `; export const ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS = gql` mutation AddItemToOrderWithCustomFields( $productVariantId: ID! $quantity: Int! $customFields: OrderLineCustomFieldsInput ) { addItemToOrder( productVariantId: $productVariantId quantity: $quantity customFields: $customFields ) { ...UpdatedOrder ... on ErrorResult { errorCode message } } } ${UPDATED_ORDER_FRAGMENT} `; const ADJUST_ORDER_LINE_WITH_CUSTOM_FIELDS = gql` mutation ($orderLineId: ID!, $quantity: Int!, $customFields: OrderLineCustomFieldsInput) { adjustOrderLine(orderLineId: $orderLineId, quantity: $quantity, customFields: $customFields) { ... on Order { lines { id customFields { notes lineImage { id } lineImages { id } } } } } } `;
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { manualFulfillmentHandler, mergeConfig } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { testSuccessfulPaymentMethod, twoStagePaymentMethod } from './fixtures/test-payment-methods'; import { TestMultiLocationStockPlugin, TestStockDisplayStrategy, TestStockLocationStrategy, } from './fixtures/test-plugins/multi-location-stock-plugin'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { CreateAddressInput, FulfillmentFragment } from './graphql/generated-e2e-admin-types'; import { PaymentInput } from './graphql/generated-e2e-shop-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { CANCEL_ORDER, CREATE_FULFILLMENT, GET_ORDER, GET_STOCK_MOVEMENT, UPDATE_GLOBAL_SETTINGS, UPDATE_PRODUCT_VARIANTS, } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER, ADD_PAYMENT, GET_ELIGIBLE_SHIPPING_METHODS, GET_PRODUCT_WITH_STOCK_LEVEL, SET_SHIPPING_ADDRESS, SET_SHIPPING_METHOD, TRANSITION_TO_STATE, } from './graphql/shop-definitions'; describe('Stock control', () => { let defaultStockLocationId: string; let secondStockLocationId: string; const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { paymentOptions: { paymentMethodHandlers: [testSuccessfulPaymentMethod], }, plugins: [TestMultiLocationStockPlugin], }), ); const orderGuard: ErrorResultGuard< CodegenShop.TestOrderFragmentFragment | CodegenShop.UpdatedOrderFragment > = createErrorResultGuard(input => !!input.lines); const fulfillmentGuard: ErrorResultGuard<FulfillmentFragment> = createErrorResultGuard( input => !!input.state, ); async function getProductWithStockMovement(productId: string) { const { product } = await adminClient.query< Codegen.GetStockMovementQuery, Codegen.GetStockMovementQueryVariables >(GET_STOCK_MOVEMENT, { id: productId }); return product; } async function setFirstEligibleShippingMethod() { const { eligibleShippingMethods } = await shopClient.query<CodegenShop.GetShippingMethodsQuery>( GET_ELIGIBLE_SHIPPING_METHODS, ); await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: eligibleShippingMethods[0].id, }); } beforeAll(async () => { await server.init({ initialData: { ...initialData, paymentMethods: [ { name: testSuccessfulPaymentMethod.code, handler: { code: testSuccessfulPaymentMethod.code, arguments: [] }, }, { name: twoStagePaymentMethod.code, handler: { code: twoStagePaymentMethod.code, arguments: [] }, }, ], }, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-stock-control-multi.csv'), customerCount: 3, }); await adminClient.asSuperAdmin(); await adminClient.query< Codegen.UpdateGlobalSettingsMutation, Codegen.UpdateGlobalSettingsMutationVariables >(UPDATE_GLOBAL_SETTINGS, { input: { trackInventory: false, }, }); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('default StockLocation exists', async () => { const { stockLocations } = await adminClient.query<Codegen.GetStockLocationsQuery>( GET_STOCK_LOCATIONS, ); expect(stockLocations.items.length).toBe(1); expect(stockLocations.items[0].name).toBe('Default Stock Location'); defaultStockLocationId = stockLocations.items[0].id; }); it('variant stock is all at default StockLocation', async () => { const { productVariants } = await adminClient.query< Codegen.GetVariantStockLevelsQuery, Codegen.GetVariantStockLevelsQueryVariables >(GET_VARIANT_STOCK_LEVELS, {}); expect(productVariants.items.every(variant => variant.stockLevels.length === 1)).toBe(true); expect( productVariants.items.every( variant => variant.stockLevels[0].stockLocationId === defaultStockLocationId, ), ).toBe(true); }); it('create StockLocation', async () => { const { createStockLocation } = await adminClient.query< Codegen.CreateStockLocationMutation, Codegen.CreateStockLocationMutationVariables >(CREATE_STOCK_LOCATION, { input: { name: 'StockLocation1', description: 'StockLocation1', }, }); expect(createStockLocation).toEqual({ id: 'T_2', name: 'StockLocation1', description: 'StockLocation1', }); secondStockLocationId = createStockLocation.id; }); it('update StockLocation', async () => { const { updateStockLocation } = await adminClient.query< Codegen.UpdateStockLocationMutation, Codegen.UpdateStockLocationMutationVariables >(UPDATE_STOCK_LOCATION, { input: { id: 'T_2', name: 'Warehouse 2', description: 'The secondary warehouse', }, }); expect(updateStockLocation).toEqual({ id: 'T_2', name: 'Warehouse 2', description: 'The secondary warehouse', }); }); it('update ProductVariants with stock levels in second location', async () => { const { productVariants } = await adminClient.query< Codegen.GetVariantStockLevelsQuery, Codegen.GetVariantStockLevelsQueryVariables >(GET_VARIANT_STOCK_LEVELS, {}); const { updateProductVariants } = await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: productVariants.items.map(variant => ({ id: variant.id, stockLevels: [{ stockLocationId: secondStockLocationId, stockOnHand: 120 }], })), }); const { productVariants: { items }, } = await adminClient.query< Codegen.GetVariantStockLevelsQuery, Codegen.GetVariantStockLevelsQueryVariables >(GET_VARIANT_STOCK_LEVELS, {}); expect(items.every(variant => variant.stockLevels.length === 2)).toBe(true); expect( items.every(variant => { return ( variant.stockLevels[0].stockLocationId === defaultStockLocationId && variant.stockLevels[1].stockLocationId === secondStockLocationId ); }), ).toBe(true); }); it('StockLocationStrategy.getAvailableStock() is used to calculate saleable stock level', async () => { const result1 = await shopClient.query< CodegenShop.GetProductStockLevelQuery, CodegenShop.GetProductStockLevelQueryVariables >(GET_PRODUCT_WITH_STOCK_LEVEL, { id: 'T_1', }); expect(result1.product?.variants[0].stockLevel).toBe('220'); const result2 = await shopClient.query< CodegenShop.GetProductStockLevelQuery, CodegenShop.GetProductStockLevelQueryVariables >( GET_PRODUCT_WITH_STOCK_LEVEL, { id: 'T_1', }, { fromLocation: 1 }, ); expect(result2.product?.variants[0].stockLevel).toBe('100'); const result3 = await shopClient.query< CodegenShop.GetProductStockLevelQuery, CodegenShop.GetProductStockLevelQueryVariables >( GET_PRODUCT_WITH_STOCK_LEVEL, { id: 'T_1', }, { fromLocation: 2 }, ); expect(result3.product?.variants[0].stockLevel).toBe('120'); }); describe('stock movements', () => { const ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS = ` mutation AddItemToOrderWithCustomFields( $productVariantId: ID! $quantity: Int! $customFields: OrderLineCustomFieldsInput ) { addItemToOrder( productVariantId: $productVariantId quantity: $quantity customFields: $customFields ) { ... on Order { id lines { id } } ... on ErrorResult { errorCode message } } } `; let orderId: string; it('creates Allocations according to StockLocationStrategy', async () => { await shopClient.asUserWithCredentials('trevor_donnelly96@hotmail.com', 'test'); await shopClient.query(gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: 'T_1', quantity: 2, customFields: { stockLocationId: '1', }, }); const { addItemToOrder } = await shopClient.query(gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: 'T_2', quantity: 2, customFields: { stockLocationId: '2', }, }); orderId = addItemToOrder.id; expect(addItemToOrder.lines.length).toBe(2); // Do all steps to check out await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { streetLine1: '1 Test Street', countryCode: 'GB', } as CreateAddressInput, }); const { eligibleShippingMethods } = await shopClient.query<CodegenShop.GetShippingMethodsQuery>( GET_ELIGIBLE_SHIPPING_METHODS, ); await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: eligibleShippingMethods[0].id, }); await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment', }); const { addPaymentToOrder: order } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: testSuccessfulPaymentMethod.code, metadata: {}, } as PaymentInput, }); orderGuard.assertSuccess(order); const { productVariants } = await adminClient.query< Codegen.GetVariantStockLevelsQuery, Codegen.GetVariantStockLevelsQueryVariables >(GET_VARIANT_STOCK_LEVELS, { options: { filter: { id: { in: ['T_1', 'T_2'] }, }, }, }); // First variant gets stock allocated from location 1 expect(productVariants.items.find(v => v.id === 'T_1')?.stockLevels).toEqual([ { stockLocationId: 'T_1', stockOnHand: 100, stockAllocated: 2, }, { stockLocationId: 'T_2', stockOnHand: 120, stockAllocated: 0, }, ]); // Second variant gets stock allocated from location 2 expect(productVariants.items.find(v => v.id === 'T_2')?.stockLevels).toEqual([ { stockLocationId: 'T_1', stockOnHand: 100, stockAllocated: 0, }, { stockLocationId: 'T_2', stockOnHand: 120, stockAllocated: 2, }, ]); }); it('creates Releases according to StockLocationStrategy', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId }, ); const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId, lines: order?.lines .filter(l => l.productVariant.id === 'T_2') .map(l => ({ orderLineId: l.id, quantity: 1, })), }, }); const { productVariants } = await adminClient.query< Codegen.GetVariantStockLevelsQuery, Codegen.GetVariantStockLevelsQueryVariables >(GET_VARIANT_STOCK_LEVELS, { options: { filter: { id: { eq: 'T_2' }, }, }, }); // Second variant gets stock allocated from location 2 expect(productVariants.items.find(v => v.id === 'T_2')?.stockLevels).toEqual([ { stockLocationId: 'T_1', stockOnHand: 100, stockAllocated: 0, }, { stockLocationId: 'T_2', stockOnHand: 120, stockAllocated: 1, }, ]); }); it('creates Sales according to StockLocationStrategy', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId }, ); await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { handler: { code: manualFulfillmentHandler.code, arguments: [{ name: 'method', value: 'Test1' }], }, lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity, })), }, }); const { productVariants } = await adminClient.query< Codegen.GetVariantStockLevelsQuery, Codegen.GetVariantStockLevelsQueryVariables >(GET_VARIANT_STOCK_LEVELS, { options: { filter: { id: { in: ['T_1', 'T_2'] }, }, }, }); // Second variant gets stock allocated from location 2 expect(productVariants.items.find(v => v.id === 'T_1')?.stockLevels).toEqual([ { stockLocationId: 'T_1', stockOnHand: 98, stockAllocated: 0, }, { stockLocationId: 'T_2', stockOnHand: 120, stockAllocated: 0, }, ]); // Second variant gets stock allocated from location 2 expect(productVariants.items.find(v => v.id === 'T_2')?.stockLevels).toEqual([ { stockLocationId: 'T_1', stockOnHand: 100, stockAllocated: 0, }, { stockLocationId: 'T_2', stockOnHand: 119, stockAllocated: 0, }, ]); }); it('creates Cancellations according to StockLocationStrategy', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId }, ); await adminClient.query<Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables>( CANCEL_ORDER, { input: { orderId, cancelShipping: true, reason: 'No longer needed', }, }, ); const { productVariants } = await adminClient.query< Codegen.GetVariantStockLevelsQuery, Codegen.GetVariantStockLevelsQueryVariables >(GET_VARIANT_STOCK_LEVELS, { options: { filter: { id: { in: ['T_1', 'T_2'] }, }, }, }); // Second variant gets stock allocated from location 2 expect(productVariants.items.find(v => v.id === 'T_1')?.stockLevels).toEqual([ { stockLocationId: 'T_1', stockOnHand: 100, stockAllocated: 0, }, { stockLocationId: 'T_2', stockOnHand: 120, stockAllocated: 0, }, ]); // Second variant gets stock allocated from location 2 expect(productVariants.items.find(v => v.id === 'T_2')?.stockLevels).toEqual([ { stockLocationId: 'T_1', stockOnHand: 100, stockAllocated: 0, }, { stockLocationId: 'T_2', stockOnHand: 120, stockAllocated: 0, }, ]); }); }); }); const STOCK_LOCATION_FRAGMENT = gql` fragment StockLocation on StockLocation { id name description } `; const GET_STOCK_LOCATION = gql` query GetStockLocation($id: ID!) { stockLocation(id: $id) { ...StockLocation } } ${STOCK_LOCATION_FRAGMENT} `; const GET_STOCK_LOCATIONS = gql` query GetStockLocations($options: StockLocationListOptions) { stockLocations(options: $options) { items { ...StockLocation } totalItems } } ${STOCK_LOCATION_FRAGMENT} `; const CREATE_STOCK_LOCATION = gql` mutation CreateStockLocation($input: CreateStockLocationInput!) { createStockLocation(input: $input) { ...StockLocation } } ${STOCK_LOCATION_FRAGMENT} `; const UPDATE_STOCK_LOCATION = gql` mutation UpdateStockLocation($input: UpdateStockLocationInput!) { updateStockLocation(input: $input) { ...StockLocation } } ${STOCK_LOCATION_FRAGMENT} `; const GET_VARIANT_STOCK_LEVELS = gql` query GetVariantStockLevels($options: ProductVariantListOptions) { productVariants(options: $options) { items { id name stockOnHand stockAllocated stockLevels { stockLocationId stockOnHand stockAllocated } } } } `;
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { pick } from '@vendure/common/lib/pick'; import { DefaultOrderPlacedStrategy, manualFulfillmentHandler, mergeConfig, Order, OrderState, RequestContext, } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, ErrorResultGuard } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { testSuccessfulPaymentMethod, twoStagePaymentMethod } from './fixtures/test-payment-methods'; import { VARIANT_WITH_STOCK_FRAGMENT } from './graphql/fragments'; import { CreateAddressInput, ErrorCode as AdminErrorCode, FulfillmentFragment, GlobalFlag, StockMovementType, UpdateProductVariantInput, VariantWithStockFragment, } from './graphql/generated-e2e-admin-types'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { ErrorCode, PaymentInput } from './graphql/generated-e2e-shop-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { CANCEL_ORDER, CREATE_FULFILLMENT, GET_ORDER, GET_STOCK_MOVEMENT, SETTLE_PAYMENT, UPDATE_GLOBAL_SETTINGS, UPDATE_PRODUCT_VARIANTS, } from './graphql/shared-definitions'; import { ADD_ITEM_TO_ORDER, ADD_PAYMENT, ADJUST_ITEM_QUANTITY, GET_ACTIVE_ORDER, GET_ELIGIBLE_SHIPPING_METHODS, GET_PRODUCT_WITH_STOCK_LEVEL, SET_SHIPPING_ADDRESS, SET_SHIPPING_METHOD, TRANSITION_TO_STATE, } from './graphql/shop-definitions'; import { assertThrowsWithMessage } from './utils/assert-throws-with-message'; import { addPaymentToOrder, proceedToArrangingPayment } from './utils/test-order-utils'; class TestOrderPlacedStrategy extends DefaultOrderPlacedStrategy { shouldSetAsPlaced( ctx: RequestContext, fromState: OrderState, toState: OrderState, order: Order, ): boolean { if ((order.customFields as any).test1557) { // This branch is used in testing https://github.com/vendure-ecommerce/vendure/issues/1557 // i.e. it will cause the Order to be set to `active: false` but without creating any // Allocations for the OrderLines. if (fromState === 'AddingItems' && toState === 'ArrangingPayment') { return true; } return false; } return super.shouldSetAsPlaced(ctx, fromState, toState, order); } } describe('Stock control', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { paymentOptions: { paymentMethodHandlers: [testSuccessfulPaymentMethod, twoStagePaymentMethod], }, orderOptions: { orderPlacedStrategy: new TestOrderPlacedStrategy(), }, customFields: { Order: [ { name: 'test1557', type: 'boolean', defaultValue: false, }, ], OrderLine: [{ name: 'customization', type: 'string', nullable: true }], }, }), ); const orderGuard: ErrorResultGuard< CodegenShop.TestOrderFragmentFragment | CodegenShop.UpdatedOrderFragment > = createErrorResultGuard(input => !!input.lines); const fulfillmentGuard: ErrorResultGuard<FulfillmentFragment> = createErrorResultGuard( input => !!input.state, ); async function getProductWithStockMovement(productId: string) { const { product } = await adminClient.query< Codegen.GetStockMovementQuery, Codegen.GetStockMovementQueryVariables >(GET_STOCK_MOVEMENT, { id: productId }); return product; } async function setFirstEligibleShippingMethod() { const { eligibleShippingMethods } = await shopClient.query<CodegenShop.GetShippingMethodsQuery>( GET_ELIGIBLE_SHIPPING_METHODS, ); await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: eligibleShippingMethods[0].id, }); } beforeAll(async () => { await server.init({ initialData: { ...initialData, paymentMethods: [ { name: testSuccessfulPaymentMethod.code, handler: { code: testSuccessfulPaymentMethod.code, arguments: [] }, }, { name: twoStagePaymentMethod.code, handler: { code: twoStagePaymentMethod.code, arguments: [] }, }, ], }, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-stock-control.csv'), customerCount: 3, }); await adminClient.asSuperAdmin(); await adminClient.query< Codegen.UpdateGlobalSettingsMutation, Codegen.UpdateGlobalSettingsMutationVariables >(UPDATE_GLOBAL_SETTINGS, { input: { trackInventory: false, }, }); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); describe('stock adjustments', () => { let variants: VariantWithStockFragment[]; it('stockMovements are initially empty', async () => { const { product } = await adminClient.query< Codegen.GetStockMovementQuery, Codegen.GetStockMovementQueryVariables >(GET_STOCK_MOVEMENT, { id: 'T_1' }); variants = product!.variants; for (const variant of variants) { expect(variant.stockMovements.items).toEqual([]); expect(variant.stockMovements.totalItems).toEqual(0); } }); it('updating ProductVariant with same stockOnHand does not create a StockMovement', async () => { const { updateProductVariants } = await adminClient.query< Codegen.UpdateStockMutation, Codegen.UpdateStockMutationVariables >(UPDATE_STOCK_ON_HAND, { input: [ { id: variants[0].id, stockOnHand: variants[0].stockOnHand, }, ] as UpdateProductVariantInput[], }); expect(updateProductVariants[0]!.stockMovements.items).toEqual([]); expect(updateProductVariants[0]!.stockMovements.totalItems).toEqual(0); }); it('increasing stockOnHand creates a StockMovement with correct quantity', async () => { const { updateProductVariants } = await adminClient.query< Codegen.UpdateStockMutation, Codegen.UpdateStockMutationVariables >(UPDATE_STOCK_ON_HAND, { input: [ { id: variants[0].id, stockOnHand: variants[0].stockOnHand + 5, }, ] as UpdateProductVariantInput[], }); expect(updateProductVariants[0]!.stockOnHand).toBe(5); expect(updateProductVariants[0]!.stockMovements.totalItems).toEqual(1); expect(updateProductVariants[0]!.stockMovements.items[0].type).toBe(StockMovementType.ADJUSTMENT); expect(updateProductVariants[0]!.stockMovements.items[0].quantity).toBe(5); }); it('decreasing stockOnHand creates a StockMovement with correct quantity', async () => { const { updateProductVariants } = await adminClient.query< Codegen.UpdateStockMutation, Codegen.UpdateStockMutationVariables >(UPDATE_STOCK_ON_HAND, { input: [ { id: variants[0].id, stockOnHand: variants[0].stockOnHand + 5 - 2, }, ] as UpdateProductVariantInput[], }); expect(updateProductVariants[0]!.stockOnHand).toBe(3); expect(updateProductVariants[0]!.stockMovements.totalItems).toEqual(2); expect(updateProductVariants[0]!.stockMovements.items[1].type).toBe(StockMovementType.ADJUSTMENT); expect(updateProductVariants[0]!.stockMovements.items[1].quantity).toBe(-2); }); it( 'attempting to set stockOnHand below saleable stock level throws', assertThrowsWithMessage(async () => { const result = await adminClient.query< Codegen.UpdateStockMutation, Codegen.UpdateStockMutationVariables >(UPDATE_STOCK_ON_HAND, { input: [ { id: variants[0].id, stockOnHand: -1, }, ] as UpdateProductVariantInput[], }); }, 'stockOnHand cannot be a negative value'), ); }); describe('sales', () => { let orderId: string; beforeAll(async () => { const product = await getProductWithStockMovement('T_2'); const [variant1, variant2, variant3] = product!.variants; await adminClient.query<Codegen.UpdateStockMutation, Codegen.UpdateStockMutationVariables>( UPDATE_STOCK_ON_HAND, { input: [ { id: variant1.id, stockOnHand: 5, trackInventory: GlobalFlag.FALSE, }, { id: variant2.id, stockOnHand: 5, trackInventory: GlobalFlag.TRUE, }, { id: variant3.id, stockOnHand: 5, trackInventory: GlobalFlag.INHERIT, }, ] as UpdateProductVariantInput[], }, ); // Add items to order and check out await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variant1.id, quantity: 2, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variant2.id, quantity: 3, }); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variant3.id, quantity: 4, }); await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { streetLine1: '1 Test Street', countryCode: 'GB', } as CreateAddressInput, }); await setFirstEligibleShippingMethod(); await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment' as OrderState }); }); it('creates an Allocation when order completed', async () => { const { addPaymentToOrder: order } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: testSuccessfulPaymentMethod.code, metadata: {}, } as PaymentInput, }); orderGuard.assertSuccess(order); expect(order).not.toBeNull(); orderId = order.id; const product = await getProductWithStockMovement('T_2'); const [variant1, variant2, variant3] = product!.variants; expect(variant1.stockMovements.totalItems).toBe(2); expect(variant1.stockMovements.items[1].type).toBe(StockMovementType.ALLOCATION); expect(variant1.stockMovements.items[1].quantity).toBe(2); expect(variant2.stockMovements.totalItems).toBe(2); expect(variant2.stockMovements.items[1].type).toBe(StockMovementType.ALLOCATION); expect(variant2.stockMovements.items[1].quantity).toBe(3); expect(variant3.stockMovements.totalItems).toBe(2); expect(variant3.stockMovements.items[1].type).toBe(StockMovementType.ALLOCATION); expect(variant3.stockMovements.items[1].quantity).toBe(4); }); it('stockAllocated is updated according to trackInventory setting', async () => { const product = await getProductWithStockMovement('T_2'); const [variant1, variant2, variant3] = product!.variants; // stockOnHand not changed yet expect(variant1.stockOnHand).toBe(5); expect(variant2.stockOnHand).toBe(5); expect(variant3.stockOnHand).toBe(5); expect(variant1.stockAllocated).toBe(0); // untracked inventory expect(variant2.stockAllocated).toBe(3); // tracked inventory expect(variant3.stockAllocated).toBe(0); // inherited untracked inventory }); it('creates a Release on cancelling an allocated order item and updates stockAllocated', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); await adminClient.query<Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables>( CANCEL_ORDER, { input: { orderId: order!.id, lines: [{ orderLineId: order!.lines.find(l => l.quantity === 3)!.id, quantity: 1 }], reason: 'Not needed', }, }, ); const product = await getProductWithStockMovement('T_2'); const [_, variant2, __] = product!.variants; expect(variant2.stockMovements.totalItems).toBe(3); expect(variant2.stockMovements.items[2].type).toBe(StockMovementType.RELEASE); expect(variant2.stockMovements.items[2].quantity).toBe(1); expect(variant2.stockAllocated).toBe(2); }); it('creates a Sale on Fulfillment creation', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: order?.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })) ?? [], handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'test method' }, { name: 'trackingCode', value: 'ABC123' }, ], }, }, }); const product = await getProductWithStockMovement('T_2'); const [variant1, variant2, variant3] = product!.variants; expect(variant1.stockMovements.totalItems).toBe(3); expect(variant1.stockMovements.items[2].type).toBe(StockMovementType.SALE); expect(variant1.stockMovements.items[2].quantity).toBe(-2); // 4 rather than 3 since a Release was created in the previous test expect(variant2.stockMovements.totalItems).toBe(4); expect(variant2.stockMovements.items[3].type).toBe(StockMovementType.SALE); expect(variant2.stockMovements.items[3].quantity).toBe(-2); expect(variant3.stockMovements.totalItems).toBe(3); expect(variant3.stockMovements.items[2].type).toBe(StockMovementType.SALE); expect(variant3.stockMovements.items[2].quantity).toBe(-4); }); it('updates stockOnHand and stockAllocated when Sales are created', async () => { const product = await getProductWithStockMovement('T_2'); const [variant1, variant2, variant3] = product!.variants; expect(variant1.stockOnHand).toBe(5); // untracked inventory expect(variant2.stockOnHand).toBe(3); // tracked inventory expect(variant3.stockOnHand).toBe(5); // inherited untracked inventory expect(variant1.stockAllocated).toBe(0); // untracked inventory expect(variant2.stockAllocated).toBe(0); // tracked inventory expect(variant3.stockAllocated).toBe(0); // inherited untracked inventory }); it('creates Cancellations when cancelling items which are part of a Fulfillment', async () => { const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); await adminClient.query<Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables>( CANCEL_ORDER, { input: { orderId: order!.id, lines: order!.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })), reason: 'Faulty', }, }, ); const product = await getProductWithStockMovement('T_2'); const [variant1, variant2, variant3] = product!.variants; expect(variant1.stockMovements.totalItems).toBe(4); expect(variant1.stockMovements.items[3].type).toBe(StockMovementType.CANCELLATION); expect(variant1.stockMovements.items[3].quantity).toBe(2); expect(variant2.stockMovements.totalItems).toBe(5); expect(variant2.stockMovements.items[4].type).toBe(StockMovementType.CANCELLATION); expect(variant2.stockMovements.items[4].quantity).toBe(2); expect(variant3.stockMovements.totalItems).toBe(4); expect(variant3.stockMovements.items[3].type).toBe(StockMovementType.CANCELLATION); expect(variant3.stockMovements.items[3].quantity).toBe(4); }); // https://github.com/vendure-ecommerce/vendure/issues/1198 it('creates Cancellations & adjusts stock when cancelling a Fulfillment', async () => { async function getTrackedVariant() { const result = await getProductWithStockMovement('T_2'); return result!.variants[1]; } const trackedVariant1 = await getTrackedVariant(); expect(trackedVariant1.stockOnHand).toBe(5); // Add items to order and check out await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: trackedVariant1.id, quantity: 1, }); await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { streetLine1: '1 Test Street', countryCode: 'GB', } as CreateAddressInput, }); await setFirstEligibleShippingMethod(); await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment' as OrderState }); const { addPaymentToOrder: order } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: testSuccessfulPaymentMethod.code, metadata: {}, } as PaymentInput, }); orderGuard.assertSuccess(order); expect(order).not.toBeNull(); const trackedVariant2 = await getTrackedVariant(); expect(trackedVariant2.stockOnHand).toBe(5); expect(trackedVariant2.stockAllocated).toBe(1); const linesInput = order?.lines .filter(l => l.productVariant.id === trackedVariant2.id) .map(l => ({ orderLineId: l.id, quantity: l.quantity })) ?? []; const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: linesInput, handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'test method' }, { name: 'trackingCode', value: 'ABC123' }, ], }, }, }); const trackedVariant3 = await getTrackedVariant(); expect(trackedVariant3.stockOnHand).toBe(4); expect(trackedVariant3.stockAllocated).toBe(0); const { transitionFulfillmentToState } = await adminClient.query< Codegen.TransitionFulfillmentToStateMutation, Codegen.TransitionFulfillmentToStateMutationVariables >(TRANSITION_FULFILLMENT_TO_STATE, { state: 'Cancelled', id: (addFulfillmentToOrder as any).id, }); const trackedVariant4 = await getTrackedVariant(); expect(trackedVariant4.stockOnHand).toBe(5); expect(trackedVariant4.stockAllocated).toBe(1); expect(trackedVariant4.stockMovements.items.map(pick(['quantity', 'type']))).toEqual([ { quantity: 5, type: 'ADJUSTMENT' }, { quantity: 3, type: 'ALLOCATION' }, { quantity: 1, type: 'RELEASE' }, { quantity: -2, type: 'SALE' }, { quantity: 2, type: 'CANCELLATION' }, { quantity: 1, type: 'ALLOCATION' }, { quantity: -1, type: 'SALE' }, // This is the cancellation & allocation we are testing for { quantity: 1, type: 'CANCELLATION' }, { quantity: 1, type: 'ALLOCATION' }, ]); const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId: order.id, reason: 'Not needed', }, }); orderGuard.assertSuccess(cancelOrder); const trackedVariant5 = await getTrackedVariant(); expect(trackedVariant5.stockOnHand).toBe(5); expect(trackedVariant5.stockAllocated).toBe(0); }); }); describe('saleable stock level', () => { let order: CodegenShop.TestOrderWithPaymentsFragment; beforeAll(async () => { await adminClient.query< Codegen.UpdateGlobalSettingsMutation, Codegen.UpdateGlobalSettingsMutationVariables >(UPDATE_GLOBAL_SETTINGS, { input: { trackInventory: true, outOfStockThreshold: -5, }, }); await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: 'T_1', stockOnHand: 3, outOfStockThreshold: 0, trackInventory: GlobalFlag.TRUE, useGlobalOutOfStockThreshold: false, }, { id: 'T_2', stockOnHand: 3, outOfStockThreshold: 0, trackInventory: GlobalFlag.FALSE, useGlobalOutOfStockThreshold: false, }, { id: 'T_3', stockOnHand: 3, outOfStockThreshold: 2, trackInventory: GlobalFlag.TRUE, useGlobalOutOfStockThreshold: false, }, { id: 'T_4', stockOnHand: 3, outOfStockThreshold: 0, trackInventory: GlobalFlag.TRUE, useGlobalOutOfStockThreshold: true, }, { id: 'T_5', stockOnHand: 0, outOfStockThreshold: 0, trackInventory: GlobalFlag.TRUE, useGlobalOutOfStockThreshold: false, }, ], }); await shopClient.asUserWithCredentials('trevor_donnelly96@hotmail.com', 'test'); }); it('stockLevel uses DefaultStockDisplayStrategy', async () => { const { product } = await shopClient.query< CodegenShop.GetProductStockLevelQuery, CodegenShop.GetProductStockLevelQueryVariables >(GET_PRODUCT_WITH_STOCK_LEVEL, { id: 'T_2', }); expect(product?.variants.map(v => v.stockLevel)).toEqual([ 'OUT_OF_STOCK', 'IN_STOCK', 'IN_STOCK', ]); }); it('does not add an empty OrderLine if zero saleable stock', async () => { const variantId = 'T_5'; const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variantId, quantity: 1, }); orderGuard.assertErrorResult(addItemToOrder); expect(addItemToOrder.errorCode).toBe(ErrorCode.INSUFFICIENT_STOCK_ERROR); expect(addItemToOrder.message).toBe('No items were added to the order due to insufficient stock'); expect((addItemToOrder as any).quantityAvailable).toBe(0); expect((addItemToOrder as any).order.lines.length).toBe(0); }); it('returns InsufficientStockError when tracking inventory & adding too many at once', async () => { const variantId = 'T_1'; const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variantId, quantity: 5, }); orderGuard.assertErrorResult(addItemToOrder); expect(addItemToOrder.errorCode).toBe(ErrorCode.INSUFFICIENT_STOCK_ERROR); expect(addItemToOrder.message).toBe( 'Only 3 items were added to the order due to insufficient stock', ); expect((addItemToOrder as any).quantityAvailable).toBe(3); // Still adds as many as available to the Order expect((addItemToOrder as any).order.lines[0].productVariant.id).toBe(variantId); expect((addItemToOrder as any).order.lines[0].quantity).toBe(3); const product = await getProductWithStockMovement('T_1'); const variant = product!.variants[0]; expect(variant.id).toBe(variantId); expect(variant.stockAllocated).toBe(0); expect(variant.stockOnHand).toBe(3); }); it('does not return error when not tracking inventory', async () => { const variantId = 'T_2'; const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variantId, quantity: 5, }); orderGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(2); expect(addItemToOrder.lines[1].productVariant.id).toBe(variantId); expect(addItemToOrder.lines[1].quantity).toBe(5); const product = await getProductWithStockMovement('T_1'); const variant = product!.variants[1]; expect(variant.id).toBe(variantId); expect(variant.stockAllocated).toBe(0); expect(variant.stockOnHand).toBe(3); }); it('returns InsufficientStockError for positive threshold', async () => { const variantId = 'T_3'; const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variantId, quantity: 2, }); orderGuard.assertErrorResult(addItemToOrder); expect(addItemToOrder.errorCode).toBe(ErrorCode.INSUFFICIENT_STOCK_ERROR); expect(addItemToOrder.message).toBe( 'Only 1 item was added to the order due to insufficient stock', ); expect((addItemToOrder as any).quantityAvailable).toBe(1); // Still adds as many as available to the Order expect((addItemToOrder as any).order.lines.length).toBe(3); expect((addItemToOrder as any).order.lines[2].productVariant.id).toBe(variantId); expect((addItemToOrder as any).order.lines[2].quantity).toBe(1); const product = await getProductWithStockMovement('T_1'); const variant = product!.variants[2]; expect(variant.id).toBe(variantId); expect(variant.stockAllocated).toBe(0); expect(variant.stockOnHand).toBe(3); }); it('negative threshold allows backorder', async () => { const variantId = 'T_4'; const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variantId, quantity: 8, }); orderGuard.assertSuccess(addItemToOrder); expect(addItemToOrder.lines.length).toBe(4); expect(addItemToOrder.lines[3].productVariant.id).toBe(variantId); expect(addItemToOrder.lines[3].quantity).toBe(8); const product = await getProductWithStockMovement('T_1'); const variant = product!.variants[3]; expect(variant.id).toBe(variantId); expect(variant.stockAllocated).toBe(0); expect(variant.stockOnHand).toBe(3); }); it('allocates stock', async () => { await proceedToArrangingPayment(shopClient); const result = await addPaymentToOrder(shopClient, twoStagePaymentMethod); orderGuard.assertSuccess(result); order = result; const product = await getProductWithStockMovement('T_1'); const [variant1, variant2, variant3, variant4] = product!.variants; expect(variant1.stockAllocated).toBe(3); expect(variant1.stockOnHand).toBe(3); expect(variant2.stockAllocated).toBe(0); // inventory not tracked expect(variant2.stockOnHand).toBe(3); expect(variant3.stockAllocated).toBe(1); expect(variant3.stockOnHand).toBe(3); expect(variant4.stockAllocated).toBe(8); expect(variant4.stockOnHand).toBe(3); }); it('does not re-allocate stock when transitioning Payment from Authorized -> Settled', async () => { await adminClient.query<Codegen.SettlePaymentMutation, Codegen.SettlePaymentMutationVariables>( SETTLE_PAYMENT, { id: order.id, }, ); const product = await getProductWithStockMovement('T_1'); const [variant1, variant2, variant3, variant4] = product!.variants; expect(variant1.stockAllocated).toBe(3); expect(variant1.stockOnHand).toBe(3); expect(variant2.stockAllocated).toBe(0); // inventory not tracked expect(variant2.stockOnHand).toBe(3); expect(variant3.stockAllocated).toBe(1); expect(variant3.stockOnHand).toBe(3); expect(variant4.stockAllocated).toBe(8); expect(variant4.stockOnHand).toBe(3); }); it('addFulfillmentToOrder returns ErrorResult when insufficient stock on hand', async () => { const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: order.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })), handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'test method' }, { name: 'trackingCode', value: 'ABC123' }, ], }, }, }); fulfillmentGuard.assertErrorResult(addFulfillmentToOrder); expect(addFulfillmentToOrder.errorCode).toBe(AdminErrorCode.INSUFFICIENT_STOCK_ON_HAND_ERROR); expect(addFulfillmentToOrder.message).toBe( 'Cannot create a Fulfillment as "Laptop 15 inch 16GB" has insufficient stockOnHand (3)', ); }); it('addFulfillmentToOrder succeeds when there is sufficient stockOnHand', async () => { const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: order.lines .filter(l => l.productVariant.id === 'T_1') .map(l => ({ orderLineId: l.id, quantity: l.quantity })), handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'test method' }, { name: 'trackingCode', value: 'ABC123' }, ], }, }, }); fulfillmentGuard.assertSuccess(addFulfillmentToOrder); const product = await getProductWithStockMovement('T_1'); const variant = product!.variants[0]; expect(variant.stockOnHand).toBe(0); expect(variant.stockAllocated).toBe(0); }); it('addFulfillmentToOrder succeeds when inventory is not being tracked', async () => { const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: order.lines .filter(l => l.productVariant.id === 'T_2') .map(l => ({ orderLineId: l.id, quantity: l.quantity })), handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'test method' }, { name: 'trackingCode', value: 'ABC123' }, ], }, }, }); fulfillmentGuard.assertSuccess(addFulfillmentToOrder); const product = await getProductWithStockMovement('T_1'); const variant = product!.variants[1]; expect(variant.stockOnHand).toBe(3); expect(variant.stockAllocated).toBe(0); }); it('addFulfillmentToOrder succeeds when making a partial Fulfillment with quantity equal to stockOnHand', async () => { const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: order.lines .filter(l => l.productVariant.id === 'T_4') .map(l => ({ orderLineId: l.id, quantity: 3 })), // we know there are only 3 on hand handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'test method' }, { name: 'trackingCode', value: 'ABC123' }, ], }, }, }); fulfillmentGuard.assertSuccess(addFulfillmentToOrder); const product = await getProductWithStockMovement('T_1'); const variant = product!.variants[3]; expect(variant.stockOnHand).toBe(0); expect(variant.stockAllocated).toBe(5); }); it('fulfillment can be created after adjusting stockOnHand to be sufficient', async () => { const { updateProductVariants } = await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: 'T_4', stockOnHand: 10, }, ], }); expect(updateProductVariants[0]!.stockOnHand).toBe(10); const { addFulfillmentToOrder } = await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: order.lines .filter(l => l.productVariant.id === 'T_4') .map(l => ({ orderLineId: l.id, quantity: 5 })), handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'test method' }, { name: 'trackingCode', value: 'ABC123' }, ], }, }, }); fulfillmentGuard.assertSuccess(addFulfillmentToOrder); const product = await getProductWithStockMovement('T_1'); const variant = product!.variants[3]; expect(variant.stockOnHand).toBe(5); expect(variant.stockAllocated).toBe(0); }); describe('adjusting stockOnHand with negative outOfStockThreshold', () => { const variant1Id = 'T_1'; beforeAll(async () => { await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: variant1Id, stockOnHand: 0, outOfStockThreshold: -20, trackInventory: GlobalFlag.TRUE, useGlobalOutOfStockThreshold: false, }, ], }); }); it( 'attempting to set stockOnHand below outOfStockThreshold throws', assertThrowsWithMessage(async () => { const result = await adminClient.query< Codegen.UpdateStockMutation, Codegen.UpdateStockMutationVariables >(UPDATE_STOCK_ON_HAND, { input: [ { id: variant1Id, stockOnHand: -21, }, ] as UpdateProductVariantInput[], }); }, 'stockOnHand cannot be a negative value'), ); it('can set negative stockOnHand that is not less than outOfStockThreshold', async () => { const result = await adminClient.query< Codegen.UpdateStockMutation, Codegen.UpdateStockMutationVariables >(UPDATE_STOCK_ON_HAND, { input: [ { id: variant1Id, stockOnHand: -10, }, ] as UpdateProductVariantInput[], }); expect(result.updateProductVariants[0]!.stockOnHand).toBe(-10); }); }); describe('edge cases', () => { const variant5Id = 'T_5'; const variant6Id = 'T_6'; const variant7Id = 'T_7'; beforeAll(async () => { // First place an order which creates a backorder (excess of allocated units) await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: variant5Id, stockOnHand: 5, outOfStockThreshold: -20, trackInventory: GlobalFlag.TRUE, useGlobalOutOfStockThreshold: false, }, { id: variant6Id, stockOnHand: 3, outOfStockThreshold: 0, trackInventory: GlobalFlag.TRUE, useGlobalOutOfStockThreshold: false, }, { id: variant7Id, stockOnHand: 3, outOfStockThreshold: 0, trackInventory: GlobalFlag.TRUE, useGlobalOutOfStockThreshold: false, }, ], }); await shopClient.asUserWithCredentials('trevor_donnelly96@hotmail.com', 'test'); const { addItemToOrder: add1 } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variant5Id, quantity: 25, }); orderGuard.assertSuccess(add1); await proceedToArrangingPayment(shopClient); await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); }); it('zero saleable stock', async () => { await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); // The saleable stock level is now 0 (25 allocated, 5 on hand, -20 threshold) const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variant5Id, quantity: 1, }); orderGuard.assertErrorResult(addItemToOrder); expect(addItemToOrder.errorCode).toBe(ErrorCode.INSUFFICIENT_STOCK_ERROR); expect(addItemToOrder.message).toBe( 'No items were added to the order due to insufficient stock', ); }); it('negative saleable stock', async () => { await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: variant5Id, outOfStockThreshold: -10, }, ], }); // The saleable stock level is now -10 (25 allocated, 5 on hand, -10 threshold) await shopClient.asUserWithCredentials('marques.sawayn@hotmail.com', 'test'); const { addItemToOrder } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variant5Id, quantity: 1, }); orderGuard.assertErrorResult(addItemToOrder); expect(addItemToOrder.errorCode).toBe(ErrorCode.INSUFFICIENT_STOCK_ERROR); expect(addItemToOrder.message).toBe( 'No items were added to the order due to insufficient stock', ); }); // https://github.com/vendure-ecommerce/vendure/issues/691 it('returns InsufficientStockError when tracking inventory & adding too many individually', async () => { await shopClient.asAnonymousUser(); const { addItemToOrder: add1 } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variant6Id, quantity: 3, }); orderGuard.assertSuccess(add1); const { addItemToOrder: add2 } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variant6Id, quantity: 1, }); orderGuard.assertErrorResult(add2); expect(add2.errorCode).toBe(ErrorCode.INSUFFICIENT_STOCK_ERROR); expect(add2.message).toBe('No items were added to the order due to insufficient stock'); expect((add2 as any).quantityAvailable).toBe(0); // Still adds as many as available to the Order expect((add2 as any).order.lines[0].productVariant.id).toBe(variant6Id); expect((add2 as any).order.lines[0].quantity).toBe(3); }); // https://github.com/vendure-ecommerce/vendure/issues/1273 it('adjustOrderLine when saleable stock changes to zero', async () => { await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: variant7Id, stockOnHand: 10, }, ], }); await shopClient.asAnonymousUser(); const { addItemToOrder: add1 } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variant7Id, quantity: 1, }); orderGuard.assertSuccess(add1); expect(add1.lines.length).toBe(1); await adminClient.query< Codegen.UpdateProductVariantsMutation, Codegen.UpdateProductVariantsMutationVariables >(UPDATE_PRODUCT_VARIANTS, { input: [ { id: variant7Id, stockOnHand: 0, }, ], }); const { adjustOrderLine: add2 } = await shopClient.query< CodegenShop.AdjustItemQuantityMutation, CodegenShop.AdjustItemQuantityMutationVariables >(ADJUST_ITEM_QUANTITY, { orderLineId: add1.lines[0].id, quantity: 2, }); orderGuard.assertErrorResult(add2); expect(add2.errorCode).toBe(ErrorCode.INSUFFICIENT_STOCK_ERROR); const { activeOrder } = await shopClient.query<CodegenShop.GetActiveOrderQuery>( GET_ACTIVE_ORDER, ); expect(activeOrder!.lines.length).toBe(0); }); // https://github.com/vendure-ecommerce/vendure/issues/1557 it('cancelling an Order only creates Releases for OrderItems that have actually been allocated', async () => { const product = await getProductWithStockMovement('T_2'); const variant6 = product!.variants.find(v => v.id === variant6Id)!; expect(variant6.stockOnHand).toBe(3); expect(variant6.stockAllocated).toBe(0); await shopClient.asUserWithCredentials('trevor_donnelly96@hotmail.com', 'test'); const { addItemToOrder: add1 } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variant6.id, quantity: 1, }); orderGuard.assertSuccess(add1); // Set this flag so that our custom OrderPlacedStrategy uses the special logic // designed to test this scenario. const res = await shopClient.query(UPDATE_ORDER_CUSTOM_FIELDS, { input: { customFields: { test1557: true } }, }); await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { streetLine1: '1 Test Street', countryCode: 'GB', } as CreateAddressInput, }); await setFirstEligibleShippingMethod(); const { transitionOrderToState } = await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment' }); orderGuard.assertSuccess(transitionOrderToState); expect(transitionOrderToState.state).toBe('ArrangingPayment'); expect(transitionOrderToState.active).toBe(false); const product2 = await getProductWithStockMovement('T_2'); const variant6_2 = product2!.variants.find(v => v.id === variant6Id)!; expect(variant6_2.stockOnHand).toBe(3); expect(variant6_2.stockAllocated).toBe(0); const { cancelOrder } = await adminClient.query< Codegen.CancelOrderMutation, Codegen.CancelOrderMutationVariables >(CANCEL_ORDER, { input: { orderId: transitionOrderToState.id, lines: transitionOrderToState.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity, })), reason: 'Cancelled by test', }, }); orderGuard.assertSuccess(cancelOrder); const product3 = await getProductWithStockMovement('T_2'); const variant6_3 = product3!.variants.find(v => v.id === variant6Id)!; expect(variant6_3.stockOnHand).toBe(3); expect(variant6_3.stockAllocated).toBe(0); }); }); }); // https://github.com/vendure-ecommerce/vendure/issues/1028 describe('OrderLines with same variant but different custom fields', () => { let orderId: string; const ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS = ` mutation AddItemToOrderWithCustomFields( $productVariantId: ID! $quantity: Int! $customFields: OrderLineCustomFieldsInput ) { addItemToOrder( productVariantId: $productVariantId quantity: $quantity customFields: $customFields ) { ... on Order { id lines { id } } ... on ErrorResult { errorCode message } } } `; it('correctly allocates stock', async () => { await shopClient.asUserWithCredentials('trevor_donnelly96@hotmail.com', 'test'); const product = await getProductWithStockMovement('T_2'); const [variant1, variant2, variant3] = product!.variants; expect(variant2.stockAllocated).toBe(0); await shopClient.query<CodegenShop.AddItemToOrderMutation, any>( gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: variant2.id, quantity: 1, customFields: { customization: 'foo', }, }, ); const { addItemToOrder } = await shopClient.query<CodegenShop.AddItemToOrderMutation, any>( gql(ADD_ITEM_TO_ORDER_WITH_CUSTOM_FIELDS), { productVariantId: variant2.id, quantity: 1, customFields: { customization: 'bar', }, }, ); orderGuard.assertSuccess(addItemToOrder); orderId = addItemToOrder.id; // Assert that separate order lines have been created expect(addItemToOrder.lines.length).toBe(2); await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { streetLine1: '1 Test Street', countryCode: 'GB', } as CreateAddressInput, }); await setFirstEligibleShippingMethod(); await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment', }); const { addPaymentToOrder: order } = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: testSuccessfulPaymentMethod.code, metadata: {}, } as PaymentInput, }); orderGuard.assertSuccess(order); const product2 = await getProductWithStockMovement('T_2'); const [variant1_2, variant2_2, variant3_2] = product2!.variants; expect(variant2_2.stockAllocated).toBe(2); }); it('correctly creates Sales', async () => { const product = await getProductWithStockMovement('T_2'); const [variant1, variant2, variant3] = product!.variants; expect(variant2.stockOnHand).toBe(3); const { order } = await adminClient.query<Codegen.GetOrderQuery, Codegen.GetOrderQueryVariables>( GET_ORDER, { id: orderId, }, ); await adminClient.query< Codegen.CreateFulfillmentMutation, Codegen.CreateFulfillmentMutationVariables >(CREATE_FULFILLMENT, { input: { lines: order?.lines.map(l => ({ orderLineId: l.id, quantity: l.quantity })) ?? [], handler: { code: manualFulfillmentHandler.code, arguments: [ { name: 'method', value: 'test method' }, { name: 'trackingCode', value: 'ABC123' }, ], }, }, }); const product2 = await getProductWithStockMovement('T_2'); const [variant1_2, variant2_2, variant3_2] = product2!.variants; expect(variant2_2.stockAllocated).toBe(0); expect(variant2_2.stockOnHand).toBe(1); }); }); // https://github.com/vendure-ecommerce/vendure/issues/1738 describe('going out of stock after being added to order', () => { const variantId = 'T_1'; beforeAll(async () => { const { updateProductVariants } = await adminClient.query< Codegen.UpdateStockMutation, Codegen.UpdateStockMutationVariables >(UPDATE_STOCK_ON_HAND, { input: [ { id: variantId, stockOnHand: 1, trackInventory: GlobalFlag.TRUE, useGlobalOutOfStockThreshold: false, outOfStockThreshold: 0, }, ] as UpdateProductVariantInput[], }); }); it('prevents checkout if no saleable stock', async () => { // First customer adds to order await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); const { addItemToOrder: add1 } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variantId, quantity: 1, }); orderGuard.assertSuccess(add1); // Second customer adds to order await shopClient.asUserWithCredentials('marques.sawayn@hotmail.com', 'test'); const { addItemToOrder: add2 } = await shopClient.query< CodegenShop.AddItemToOrderMutation, CodegenShop.AddItemToOrderMutationVariables >(ADD_ITEM_TO_ORDER, { productVariantId: variantId, quantity: 1, }); orderGuard.assertSuccess(add2); // first customer can check out await shopClient.asUserWithCredentials('hayden.zieme12@hotmail.com', 'test'); await proceedToArrangingPayment(shopClient); const result1 = await addPaymentToOrder(shopClient, testSuccessfulPaymentMethod); orderGuard.assertSuccess(result1); const product1 = await getProductWithStockMovement('T_1'); const variant = product1?.variants.find(v => v.id === variantId); expect(variant!.stockOnHand).toBe(1); expect(variant!.stockAllocated).toBe(1); // second customer CANNOT check out await shopClient.asUserWithCredentials('marques.sawayn@hotmail.com', 'test'); await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { fullName: 'name', streetLine1: '12 the street', city: 'foo', postalCode: '123456', countryCode: 'US', }, }); const { eligibleShippingMethods } = await shopClient.query<CodegenShop.GetShippingMethodsQuery>( GET_ELIGIBLE_SHIPPING_METHODS, ); const { setOrderShippingMethod } = await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: eligibleShippingMethods[1].id, }); orderGuard.assertSuccess(setOrderShippingMethod); const { transitionOrderToState } = await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment' }); orderGuard.assertErrorResult(transitionOrderToState); expect(transitionOrderToState!.transitionError).toBe( 'Cannot transition Order to the "ArrangingPayment" state due to insufficient stock of Laptop 13 inch 8GB', ); }); }); }); const UPDATE_STOCK_ON_HAND = gql` mutation UpdateStock($input: [UpdateProductVariantInput!]!) { updateProductVariants(input: $input) { ...VariantWithStock } } ${VARIANT_WITH_STOCK_FRAGMENT} `; export const TRANSITION_FULFILLMENT_TO_STATE = gql` mutation TransitionFulfillmentToState($id: ID!, $state: String!) { transitionFulfillmentToState(id: $id, state: $state) { ... on Fulfillment { id state nextStates createdAt } ... on ErrorResult { errorCode message } ... on FulfillmentStateTransitionError { transitionError } } } `; export const UPDATE_ORDER_CUSTOM_FIELDS = gql` mutation UpdateOrderCustomFields($input: UpdateOrderInput!) { setOrderCustomFields(input: $input) { ... on Order { id } } } `;
import { mergeConfig } from '@vendure/core'; import { createErrorResultGuard, createTestEnvironment, E2E_DEFAULT_CHANNEL_TOKEN, ErrorResultGuard, } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { TEST_SETUP_TIMEOUT_MS, testConfig } from '../../../e2e-common/test-config'; import { testSuccessfulPaymentMethod } from './fixtures/test-payment-methods'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { AssignProductsToChannelDocument, CurrencyCode, DeletionResult, LanguageCode, SortOrder, TestAssignStockLocationToChannelDocument, TestCreateStockLocationDocument, TestDeleteStockLocationDocument, TestGetStockLevelsForVariantDocument, TestGetStockLocationsListDocument, TestRemoveStockLocationsFromChannelDocument, TestSetStockLevelInLocationDocument, TestUpdateStockLocationDocument, } from './graphql/generated-e2e-admin-types'; import * as CodegenShop from './graphql/generated-e2e-shop-types'; import { CREATE_CHANNEL } from './graphql/shared-definitions'; describe('Stock location', () => { const defaultStockLocationId = 'T_1'; let secondStockLocationId: string; const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { paymentOptions: { paymentMethodHandlers: [testSuccessfulPaymentMethod], }, }), ); const orderGuard: ErrorResultGuard< CodegenShop.TestOrderFragmentFragment | CodegenShop.UpdatedOrderFragment > = createErrorResultGuard(input => !!input.lines); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-stock-control-multi.csv'), customerCount: 3, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('createStockLocation', async () => { const { createStockLocation } = await adminClient.query(TestCreateStockLocationDocument, { input: { name: 'Second location', description: 'Second location description', }, }); expect(createStockLocation.name).toBe('Second location'); expect(createStockLocation.description).toBe('Second location description'); secondStockLocationId = createStockLocation.id; }); it('updateStockLocation', async () => { const { updateStockLocation } = await adminClient.query(TestUpdateStockLocationDocument, { input: { id: secondStockLocationId, name: 'Second location updated', description: 'Second location description updated', }, }); expect(updateStockLocation.name).toBe('Second location updated'); expect(updateStockLocation.description).toBe('Second location description updated'); }); it('get stock locations list', async () => { const { stockLocations } = await adminClient.query(TestGetStockLocationsListDocument, { options: { sort: { id: SortOrder.ASC, }, }, }); expect(stockLocations.items.length).toBe(2); expect(stockLocations.items[0].name).toBe('Default Stock Location'); expect(stockLocations.items[1].name).toBe('Second location updated'); }); it('assign stock to second location', async () => { const { updateProductVariants } = await adminClient.query(TestSetStockLevelInLocationDocument, { input: { id: 'T_1', stockLevels: [ { stockLocationId: secondStockLocationId, stockOnHand: 50, }, ], }, }); expect( updateProductVariants[0]?.stockLevels.find(sl => sl.stockLocationId === defaultStockLocationId), ).toEqual({ stockOnHand: 100, stockAllocated: 0, stockLocationId: defaultStockLocationId, }); expect( updateProductVariants[0]?.stockLevels.find(sl => sl.stockLocationId === secondStockLocationId), ).toEqual({ stockOnHand: 50, stockAllocated: 0, stockLocationId: secondStockLocationId, }); }); it('delete second stock location and assign stock to default location', async () => { const { deleteStockLocation } = await adminClient.query(TestDeleteStockLocationDocument, { input: { id: secondStockLocationId, transferToLocationId: defaultStockLocationId, }, }); expect(deleteStockLocation.result).toBe(DeletionResult.DELETED); const { productVariant } = await adminClient.query(TestGetStockLevelsForVariantDocument, { id: 'T_1', }); expect(productVariant?.stockLevels.length).toBe(1); expect(productVariant?.stockLevels[0]).toEqual({ stockOnHand: 150, stockAllocated: 0, stockLocationId: defaultStockLocationId, }); }); it('cannot delete last remaining stock location', async () => { const { deleteStockLocation } = await adminClient.query(TestDeleteStockLocationDocument, { input: { id: defaultStockLocationId, }, }); expect(deleteStockLocation.result).toBe(DeletionResult.NOT_DELETED); expect(deleteStockLocation.message).toBe('The last remaining StockLocation cannot be deleted'); const { stockLocations } = await adminClient.query(TestGetStockLocationsListDocument); expect(stockLocations.items.length).toBe(1); }); describe('multi channel', () => { const SECOND_CHANNEL_TOKEN = 'second_channel_token'; let channelStockLocationId: string; let secondChannelId: string; const channelGuard: ErrorResultGuard<Codegen.ChannelFragment> = createErrorResultGuard<Codegen.ChannelFragment>(input => !!input.defaultLanguageCode); beforeAll(async () => { const { createStockLocation } = await adminClient.query(TestCreateStockLocationDocument, { input: { name: 'Channel location', }, }); channelStockLocationId = createStockLocation.id; const { createChannel } = await adminClient.query< Codegen.CreateChannelMutation, Codegen.CreateChannelMutationVariables >(CREATE_CHANNEL, { input: { code: 'second-channel', token: SECOND_CHANNEL_TOKEN, defaultLanguageCode: LanguageCode.en, currencyCode: CurrencyCode.GBP, pricesIncludeTax: true, defaultShippingZoneId: 'T_1', defaultTaxZoneId: 'T_1', }, }); channelGuard.assertSuccess(createChannel); secondChannelId = createChannel.id; await adminClient.query(AssignProductsToChannelDocument, { input: { channelId: secondChannelId, productIds: ['T_1'], }, }); }); it('stock location not visible in channel before being assigned', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { stockLocations } = await adminClient.query(TestGetStockLocationsListDocument); expect(stockLocations.items.length).toBe(0); }); it('assign stock location to channel', async () => { adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { assignStockLocationsToChannel } = await adminClient.query( TestAssignStockLocationToChannelDocument, { input: { stockLocationIds: [channelStockLocationId], channelId: secondChannelId, }, }, ); expect(assignStockLocationsToChannel.length).toBe(1); expect(assignStockLocationsToChannel[0].name).toBe('Channel location'); }); it('stock location visible in channel once assigned', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { stockLocations } = await adminClient.query(TestGetStockLocationsListDocument); expect(stockLocations.items.length).toBe(1); expect(stockLocations.items[0].name).toBe('Channel location'); }); it('assign stock to location in channel', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { updateProductVariants } = await adminClient.query(TestSetStockLevelInLocationDocument, { input: { id: 'T_1', stockLevels: [ { stockLocationId: channelStockLocationId, stockOnHand: 10, }, ], }, }); }); it('assigned variant stock level visible in channel', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { productVariant } = await adminClient.query(TestGetStockLevelsForVariantDocument, { id: 'T_1', }); expect(productVariant?.stockLevels.length).toBe(1); expect(productVariant?.stockLevels[0]).toEqual({ stockOnHand: 10, stockAllocated: 0, stockLocationId: channelStockLocationId, }); }); it('remove stock location from channel', async () => { adminClient.setChannelToken(E2E_DEFAULT_CHANNEL_TOKEN); const { removeStockLocationsFromChannel } = await adminClient.query( TestRemoveStockLocationsFromChannelDocument, { input: { stockLocationIds: [channelStockLocationId], channelId: secondChannelId, }, }, ); expect(removeStockLocationsFromChannel.length).toBe(1); expect(removeStockLocationsFromChannel[0].name).toBe('Channel location'); }); it('variant stock level no longer visible once removed from channel', async () => { adminClient.setChannelToken(SECOND_CHANNEL_TOKEN); const { productVariant } = await adminClient.query(TestGetStockLevelsForVariantDocument, { id: 'T_1', }); expect(productVariant?.stockLevels.length).toBe(0); }); }); }); const GET_STOCK_LOCATIONS_LIST = gql` query TestGetStockLocationsList($options: StockLocationListOptions) { stockLocations(options: $options) { items { id name description } totalItems } } `; const GET_STOCK_LOCATION = gql` query TestGetStockLocation($id: ID!) { stockLocation(id: $id) { id name description } } `; const CREATE_STOCK_LOCATION = gql` mutation TestCreateStockLocation($input: CreateStockLocationInput!) { createStockLocation(input: $input) { id name description } } `; const UPDATE_STOCK_LOCATION = gql` mutation TestUpdateStockLocation($input: UpdateStockLocationInput!) { updateStockLocation(input: $input) { id name description } } `; const DELETE_STOCK_LOCATION = gql` mutation TestDeleteStockLocation($input: DeleteStockLocationInput!) { deleteStockLocation(input: $input) { result message } } `; const GET_STOCK_LEVELS_FOR_VARIANT = gql` query TestGetStockLevelsForVariant($id: ID!) { productVariant(id: $id) { id stockLevels { stockOnHand stockAllocated stockLocationId } } } `; const SET_STOCK_LEVEL_IN_LOCATION = gql` mutation TestSetStockLevelInLocation($input: UpdateProductVariantInput!) { updateProductVariants(input: [$input]) { id stockLevels { stockOnHand stockAllocated stockLocationId } } } `; const ASSIGN_STOCK_LOCATION_TO_CHANNEL = gql` mutation TestAssignStockLocationToChannel($input: AssignStockLocationsToChannelInput!) { assignStockLocationsToChannel(input: $input) { id name } } `; const REMOVE_STOCK_LOCATIONS_FROM_CHANNEL = gql` mutation TestRemoveStockLocationsFromChannel($input: RemoveStockLocationsFromChannelInput!) { removeStockLocationsFromChannel(input: $input) { id name } } `;
import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { createTestEnvironment } from '../../testing/lib/create-test-environment'; import * as Codegen from './graphql/generated-e2e-admin-types'; describe('Tag resolver', () => { const { server, adminClient } = createTestEnvironment(testConfig()); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('create', async () => { const { createTag } = await adminClient.query< Codegen.CreateTagMutation, Codegen.CreateTagMutationVariables >(CREATE_TAG, { input: { value: 'tag1' }, }); expect(createTag).toEqual({ id: 'T_1', value: 'tag1', }); }); it('create with existing value returns existing tag', async () => { const { createTag } = await adminClient.query< Codegen.CreateTagMutation, Codegen.CreateTagMutationVariables >(CREATE_TAG, { input: { value: 'tag1' }, }); expect(createTag).toEqual({ id: 'T_1', value: 'tag1', }); }); it('update', async () => { const { updateTag } = await adminClient.query< Codegen.UpdateTagMutation, Codegen.UpdateTagMutationVariables >(UPDATE_TAG, { input: { id: 'T_1', value: 'tag1-updated' }, }); expect(updateTag).toEqual({ id: 'T_1', value: 'tag1-updated', }); }); it('tag', async () => { const { tag } = await adminClient.query<Codegen.GetTagQuery, Codegen.GetTagQueryVariables>(GET_TAG, { id: 'T_1', }); expect(tag).toEqual({ id: 'T_1', value: 'tag1-updated', }); }); it('tags', async () => { const { tags } = await adminClient.query<Codegen.GetTagListQuery, Codegen.GetTagListQueryVariables>( GET_TAG_LIST, ); expect(tags).toEqual({ items: [ { id: 'T_1', value: 'tag1-updated', }, ], totalItems: 1, }); }); }); const GET_TAG_LIST = gql` query GetTagList($options: TagListOptions) { tags(options: $options) { items { id value } totalItems } } `; const GET_TAG = gql` query GetTag($id: ID!) { tag(id: $id) { id value } } `; const CREATE_TAG = gql` mutation CreateTag($input: CreateTagInput!) { createTag(input: $input) { id value } } `; const UPDATE_TAG = gql` mutation UpdateTag($input: UpdateTagInput!) { updateTag(input: $input) { id value } } `; const DELETE_TAG = gql` mutation DeleteTag($id: ID!) { deleteTag(id: $id) { message result } } `;
import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { DeletionResult } from './graphql/generated-e2e-admin-types'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { sortById } from './utils/test-order-utils'; describe('TaxCategory resolver', () => { const { server, adminClient, shopClient } = createTestEnvironment(testConfig()); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 2, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('taxCategories', async () => { const { taxCategories } = await adminClient.query<Codegen.GetTaxCategoryListQuery>( GET_TAX_CATEGORY_LIST, ); expect(taxCategories.items.sort(sortById)).toEqual([ { id: 'T_1', name: 'Standard Tax', isDefault: false }, { id: 'T_2', name: 'Reduced Tax', isDefault: false }, { id: 'T_3', name: 'Zero Tax', isDefault: false }, ]); }); it('taxCategory', async () => { const { taxCategory } = await adminClient.query< Codegen.GetTaxCategoryQuery, Codegen.GetTaxCategoryQueryVariables >(GET_TAX_CATEGORY, { id: 'T_2', }); expect(taxCategory).toEqual({ id: 'T_2', name: 'Reduced Tax', isDefault: false, }); }); it('createTaxCategory', async () => { const { createTaxCategory } = await adminClient.query< Codegen.CreateTaxCategoryMutation, Codegen.CreateTaxCategoryMutationVariables >(CREATE_TAX_CATEGORY, { input: { name: 'New Category', }, }); expect(createTaxCategory).toEqual({ id: 'T_4', name: 'New Category', isDefault: false, }); }); it('updateCategory', async () => { const { updateTaxCategory } = await adminClient.query< Codegen.UpdateTaxCategoryMutation, Codegen.UpdateTaxCategoryMutationVariables >(UPDATE_TAX_CATEGORY, { input: { id: 'T_4', name: 'New Category Updated', }, }); expect(updateTaxCategory).toEqual({ id: 'T_4', name: 'New Category Updated', isDefault: false, }); }); it('set default', async () => { const { updateTaxCategory } = await adminClient.query< Codegen.UpdateTaxCategoryMutation, Codegen.UpdateTaxCategoryMutationVariables >(UPDATE_TAX_CATEGORY, { input: { id: 'T_2', isDefault: true, }, }); expect(updateTaxCategory).toEqual({ id: 'T_2', name: 'Reduced Tax', isDefault: true, }); const { taxCategories } = await adminClient.query<Codegen.GetTaxCategoryListQuery>( GET_TAX_CATEGORY_LIST, ); expect(taxCategories.items.sort(sortById)).toEqual([ { id: 'T_1', name: 'Standard Tax', isDefault: false }, { id: 'T_2', name: 'Reduced Tax', isDefault: true }, { id: 'T_3', name: 'Zero Tax', isDefault: false }, { id: 'T_4', name: 'New Category Updated', isDefault: false }, ]); }); it('set a different default', async () => { const { updateTaxCategory } = await adminClient.query< Codegen.UpdateTaxCategoryMutation, Codegen.UpdateTaxCategoryMutationVariables >(UPDATE_TAX_CATEGORY, { input: { id: 'T_1', isDefault: true, }, }); expect(updateTaxCategory).toEqual({ id: 'T_1', name: 'Standard Tax', isDefault: true, }); const { taxCategories } = await adminClient.query<Codegen.GetTaxCategoryListQuery>( GET_TAX_CATEGORY_LIST, ); expect(taxCategories.items.sort(sortById)).toEqual([ { id: 'T_1', name: 'Standard Tax', isDefault: true }, { id: 'T_2', name: 'Reduced Tax', isDefault: false }, { id: 'T_3', name: 'Zero Tax', isDefault: false }, { id: 'T_4', name: 'New Category Updated', isDefault: false }, ]); }); describe('deletion', () => { it('cannot delete if used by a TaxRate', async () => { const { deleteTaxCategory } = await adminClient.query< Codegen.DeleteTaxCategoryMutation, Codegen.DeleteTaxCategoryMutationVariables >(DELETE_TAX_CATEGORY, { id: 'T_2', }); expect(deleteTaxCategory.result).toBe(DeletionResult.NOT_DELETED); expect(deleteTaxCategory.message).toBe( 'Cannot remove TaxCategory "Reduced Tax" as it is referenced by 5 TaxRates', ); }); it('can delete if not used by TaxRate', async () => { const { deleteTaxCategory } = await adminClient.query< Codegen.DeleteTaxCategoryMutation, Codegen.DeleteTaxCategoryMutationVariables >(DELETE_TAX_CATEGORY, { id: 'T_4', }); expect(deleteTaxCategory.result).toBe(DeletionResult.DELETED); expect(deleteTaxCategory.message).toBeNull(); const { taxCategory } = await adminClient.query< Codegen.GetTaxCategoryQuery, Codegen.GetTaxCategoryQueryVariables >(GET_TAX_CATEGORY, { id: 'T_4', }); expect(taxCategory).toBeNull(); }); }); }); const GET_TAX_CATEGORY_LIST = gql` query GetTaxCategoryList { taxCategories { items { id name isDefault } } } `; const GET_TAX_CATEGORY = gql` query GetTaxCategory($id: ID!) { taxCategory(id: $id) { id name isDefault } } `; const CREATE_TAX_CATEGORY = gql` mutation CreateTaxCategory($input: CreateTaxCategoryInput!) { createTaxCategory(input: $input) { id name isDefault } } `; const UPDATE_TAX_CATEGORY = gql` mutation UpdateTaxCategory($input: UpdateTaxCategoryInput!) { updateTaxCategory(input: $input) { id name isDefault } } `; const DELETE_TAX_CATEGORY = gql` mutation DeleteTaxCategory($id: ID!) { deleteTaxCategory(id: $id) { result message } } `;
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { pick } from '@vendure/common/lib/pick'; import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { TAX_RATE_FRAGMENT } from './graphql/fragments'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { DeletionResult } from './graphql/generated-e2e-admin-types'; import { GET_TAX_RATES_LIST, UPDATE_TAX_RATE } from './graphql/shared-definitions'; describe('TaxRate resolver', () => { const { server, adminClient, shopClient } = createTestEnvironment(testConfig()); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 2, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('taxRates list', async () => { const { taxRates } = await adminClient.query<Codegen.GetTaxRatesQuery>(GET_TAX_RATES_LIST); expect(taxRates.totalItems).toBe(15); }); it('taxRate', async () => { const { taxRate } = await adminClient.query< Codegen.GetTaxRateQuery, Codegen.GetTaxRateQueryVariables >(GET_TAX_RATE, { id: 'T_1', }); expect(pick(taxRate!, ['id', 'name', 'enabled', 'value'])).toEqual({ id: 'T_1', name: 'Standard Tax Oceania', enabled: true, value: 20, }); expect(taxRate!.category.name).toBe('Standard Tax'); expect(taxRate!.zone.name).toBe('Oceania'); }); it('createTaxRate', async () => { const { createTaxRate } = await adminClient.query< Codegen.CreateTaxRateMutation, Codegen.CreateTaxRateMutationVariables >(CREATE_TAX_RATE, { input: { name: 'My Tax Rate', categoryId: 'T_1', zoneId: 'T_1', enabled: true, value: 17.5, }, }); expect(createTaxRate.name).toBe('My Tax Rate'); expect(createTaxRate.value).toBe(17.5); }); it('updateTaxRate', async () => { const { updateTaxRate } = await adminClient.query< Codegen.UpdateTaxRateMutation, Codegen.UpdateTaxRateMutationVariables >(UPDATE_TAX_RATE, { input: { id: 'T_1', value: 17.5, }, }); expect(updateTaxRate.value).toBe(17.5); }); it('deleteTaxRate', async () => { const { deleteTaxRate } = await adminClient.query< Codegen.DeleteTaxRateMutation, Codegen.DeleteTaxRateMutationVariables >(DELETE_TAX_RATE, { id: 'T_3', }); expect(deleteTaxRate.result).toBe(DeletionResult.DELETED); expect(deleteTaxRate.message).toBeNull(); const { taxRates } = await adminClient.query<Codegen.GetTaxRatesQuery>(GET_TAX_RATES_LIST); expect(taxRates.items.find(x => x.id === 'T_3')).toBeUndefined(); }); }); export const GET_TAX_RATE = gql` query GetTaxRate($id: ID!) { taxRate(id: $id) { ...TaxRate } } ${TAX_RATE_FRAGMENT} `; export const CREATE_TAX_RATE = gql` mutation CreateTaxRate($input: CreateTaxRateInput!) { createTaxRate(input: $input) { ...TaxRate } } ${TAX_RATE_FRAGMENT} `; export const DELETE_TAX_RATE = gql` mutation DeleteTaxRate($id: ID!) { deleteTaxRate(id: $id) { result message } } `;
import { LanguageCode, mergeConfig } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import * as DE from './fixtures/i18n/de.json'; import * as EN from './fixtures/i18n/en.json'; import { CUSTOM_ERROR_MESSAGE_TRANSLATION, TranslationTestPlugin, } from './fixtures/test-plugins/translation-test-plugin'; describe('Translation', () => { const { server, adminClient } = createTestEnvironment( mergeConfig(testConfig(), { plugins: [TranslationTestPlugin], }), ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 0, }); await adminClient.asSuperAdmin(); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); describe('translations added manualy', () => { it('shall receive custom error message', async () => { const { customErrorMessage } = await adminClient.query(gql(CUSTOM_ERROR)); expect(customErrorMessage.errorCode).toBe('CUSTOM_ERROR'); expect(customErrorMessage.message).toBe(CUSTOM_ERROR_MESSAGE_TRANSLATION); }); it('shall receive german error message', async () => { const { customErrorMessage } = await adminClient.query( gql(CUSTOM_ERROR), {}, { languageCode: LanguageCode.de }, ); expect(customErrorMessage.errorCode).toBe('CUSTOM_ERROR'); expect(customErrorMessage.message).toBe('DE_' + CUSTOM_ERROR_MESSAGE_TRANSLATION); }); }); describe('translation added by file', () => { it('shall receive custom error message', async () => { const { newErrorMessage } = await adminClient.query(gql(NEW_ERROR)); expect(newErrorMessage.errorCode).toBe('NEW_ERROR'); expect(newErrorMessage.message).toBe(EN.errorResult.NEW_ERROR); }); it('shall receive german error message', async () => { const { newErrorMessage } = await adminClient.query( gql(NEW_ERROR), {}, { languageCode: LanguageCode.de }, ); expect(newErrorMessage.errorCode).toBe('NEW_ERROR'); expect(newErrorMessage.message).toBe(DE.errorResult.NEW_ERROR); }); }); }); const CUSTOM_ERROR = ` query CustomError { customErrorMessage { ... on ErrorResult { errorCode message } } } `; const NEW_ERROR = ` query NewError { newErrorMessage { ... on ErrorResult { errorCode message } } } `;
import { createTestEnvironment } from '@vendure/testing'; import gql from 'graphql-tag'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../e2e-common/test-config'; import { ZONE_FRAGMENT } from './graphql/fragments'; import * as Codegen from './graphql/generated-e2e-admin-types'; import { DeletionResult } from './graphql/generated-e2e-admin-types'; import { GET_COUNTRY_LIST, UPDATE_CHANNEL } from './graphql/shared-definitions'; /* eslint-disable @typescript-eslint/no-non-null-assertion */ describe('Zone resolver', () => { const { server, adminClient } = createTestEnvironment(testConfig()); let countries: Codegen.GetCountryListQuery['countries']['items']; let zones: Array<{ id: string; name: string }>; let oceania: { id: string; name: string }; let pangaea: { id: string; name: string; members: any[] }; beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); const result = await adminClient.query<Codegen.GetCountryListQuery>(GET_COUNTRY_LIST, {}); countries = result.countries.items; }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await server.destroy(); }); it('zones', async () => { const result = await adminClient.query<Codegen.GetZonesQuery>(GET_ZONE_LIST); expect(result.zones.items.length).toBe(5); zones = result.zones.items; oceania = zones[0]; }); it('zone', async () => { const result = await adminClient.query<Codegen.GetZoneQuery, Codegen.GetZoneQueryVariables>( GET_ZONE, { id: oceania.id, }, ); expect(result.zone!.name).toBe('Oceania'); }); it('zone.members field resolver', async () => { const { activeChannel } = await adminClient.query<Codegen.GetActiveChannelWithZoneMembersQuery>( GET_ACTIVE_CHANNEL_WITH_ZONE_MEMBERS, ); expect(activeChannel.defaultShippingZone?.members.length).toBe(2); }); it('updateZone', async () => { const result = await adminClient.query< Codegen.UpdateZoneMutation, Codegen.UpdateZoneMutationVariables >(UPDATE_ZONE, { input: { id: oceania.id, name: 'oceania2', }, }); expect(result.updateZone.name).toBe('oceania2'); }); it('createZone', async () => { const result = await adminClient.query< Codegen.CreateZoneMutation, Codegen.CreateZoneMutationVariables >(CREATE_ZONE, { input: { name: 'Pangaea', memberIds: [countries[0].id, countries[1].id], }, }); pangaea = result.createZone; expect(pangaea.name).toBe('Pangaea'); expect(pangaea.members.map(m => m.name)).toEqual([countries[0].name, countries[1].name]); }); it('addMembersToZone', async () => { const result = await adminClient.query< Codegen.AddMembersToZoneMutation, Codegen.AddMembersToZoneMutationVariables >(ADD_MEMBERS_TO_ZONE, { zoneId: oceania.id, memberIds: [countries[2].id, countries[3].id], }); expect(!!result.addMembersToZone.members.find(m => m.name === countries[2].name)).toBe(true); expect(!!result.addMembersToZone.members.find(m => m.name === countries[3].name)).toBe(true); }); it('removeMembersFromZone', async () => { const result = await adminClient.query< Codegen.RemoveMembersFromZoneMutation, Codegen.RemoveMembersFromZoneMutationVariables >(REMOVE_MEMBERS_FROM_ZONE, { zoneId: oceania.id, memberIds: [countries[0].id, countries[2].id], }); expect(!!result.removeMembersFromZone.members.find(m => m.name === countries[0].name)).toBe(false); expect(!!result.removeMembersFromZone.members.find(m => m.name === countries[2].name)).toBe(false); expect(!!result.removeMembersFromZone.members.find(m => m.name === countries[3].name)).toBe(true); }); describe('deletion', () => { it('deletes Zone not used in any TaxRate', async () => { const result1 = await adminClient.query< Codegen.DeleteZoneMutation, Codegen.DeleteZoneMutationVariables >(DELETE_ZONE, { id: pangaea.id, }); expect(result1.deleteZone).toEqual({ result: DeletionResult.DELETED, message: '', }); const result2 = await adminClient.query<Codegen.GetZonesQuery>(GET_ZONE_LIST); expect(result2.zones.items.find(c => c.id === pangaea.id)).toBeUndefined(); }); it('does not delete Zone that is used in one or more TaxRates', async () => { const result1 = await adminClient.query< Codegen.DeleteZoneMutation, Codegen.DeleteZoneMutationVariables >(DELETE_ZONE, { id: oceania.id, }); expect(result1.deleteZone).toEqual({ result: DeletionResult.NOT_DELETED, message: 'The selected Zone cannot be deleted as it is used in the following ' + 'TaxRates: Standard Tax Oceania, Reduced Tax Oceania, Zero Tax Oceania', }); const result2 = await adminClient.query<Codegen.GetZonesQuery>(GET_ZONE_LIST); expect(result2.zones.items.find(c => c.id === oceania.id)).not.toBeUndefined(); }); it('does not delete Zone that is used as a Channel defaultTaxZone', async () => { await adminClient.query<Codegen.UpdateChannelMutation, Codegen.UpdateChannelMutationVariables>( UPDATE_CHANNEL, { input: { id: 'T_1', defaultTaxZoneId: oceania.id, }, }, ); const result1 = await adminClient.query< Codegen.DeleteZoneMutation, Codegen.DeleteZoneMutationVariables >(DELETE_ZONE, { id: oceania.id, }); expect(result1.deleteZone).toEqual({ result: DeletionResult.NOT_DELETED, message: 'The selected Zone cannot be deleted as it used as a default in the following Channels: ' + '__default_channel__', }); const result2 = await adminClient.query<Codegen.GetZonesQuery>(GET_ZONE_LIST); expect(result2.zones.items.find(c => c.id === oceania.id)).not.toBeUndefined(); }); it('does not delete Zone that is used as a Channel defaultShippingZone', async () => { await adminClient.query<Codegen.UpdateChannelMutation, Codegen.UpdateChannelMutationVariables>( UPDATE_CHANNEL, { input: { id: 'T_1', defaultTaxZoneId: 'T_1', defaultShippingZoneId: oceania.id, }, }, ); const result1 = await adminClient.query< Codegen.DeleteZoneMutation, Codegen.DeleteZoneMutationVariables >(DELETE_ZONE, { id: oceania.id, }); expect(result1.deleteZone).toEqual({ result: DeletionResult.NOT_DELETED, message: 'The selected Zone cannot be deleted as it used as a default in the following Channels: ' + '__default_channel__', }); const result2 = await adminClient.query<Codegen.GetZonesQuery>(GET_ZONE_LIST); expect(result2.zones.items.find(c => c.id === oceania.id)).not.toBeUndefined(); }); }); }); const DELETE_ZONE = gql` mutation DeleteZone($id: ID!) { deleteZone(id: $id) { result message } } `; const GET_ZONE_LIST = gql` query GetZones($options: ZoneListOptions) { zones(options: $options) { items { id name } totalItems } } `; export const GET_ZONE = gql` query GetZone($id: ID!) { zone(id: $id) { ...Zone } } ${ZONE_FRAGMENT} `; export const GET_ACTIVE_CHANNEL_WITH_ZONE_MEMBERS = gql` query GetActiveChannelWithZoneMembers { activeChannel { id defaultShippingZone { id members { name } } } } `; export const CREATE_ZONE = gql` mutation CreateZone($input: CreateZoneInput!) { createZone(input: $input) { ...Zone } } ${ZONE_FRAGMENT} `; export const UPDATE_ZONE = gql` mutation UpdateZone($input: UpdateZoneInput!) { updateZone(input: $input) { ...Zone } } ${ZONE_FRAGMENT} `; export const ADD_MEMBERS_TO_ZONE = gql` mutation AddMembersToZone($zoneId: ID!, $memberIds: [ID!]!) { addMembersToZone(zoneId: $zoneId, memberIds: $memberIds) { ...Zone } } ${ZONE_FRAGMENT} `; export const REMOVE_MEMBERS_FROM_ZONE = gql` mutation RemoveMembersFromZone($zoneId: ID!, $memberIds: [ID!]!) { removeMembersFromZone(zoneId: $zoneId, memberIds: $memberIds) { ...Zone } } ${ZONE_FRAGMENT} `;
import { DefaultJobQueuePlugin, DefaultSearchPlugin, mergeConfig } from '@vendure/core'; import { createTestEnvironment } from '@vendure/testing'; import path from 'path'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import { initialData } from '../../../../e2e-common/e2e-initial-data'; import { testConfig, TEST_SETUP_TIMEOUT_MS } from '../../../../e2e-common/test-config'; import { SEARCH_PRODUCTS_ADMIN } from '../graphql/admin-definitions'; import { SearchResultSortParameter, SortOrder, SearchProductsAdminQuery, SearchProductsAdminQueryVariables, } from '../graphql/generated-e2e-admin-types'; import { SearchProductsShopQuery, SearchProductsShopQueryVariables, } from '../graphql/generated-e2e-shop-types'; import { SEARCH_PRODUCTS_SHOP } from '../graphql/shop-definitions'; import { awaitRunningJobs } from '../utils/await-running-jobs'; describe('Default search plugin', () => { const { server, adminClient, shopClient } = createTestEnvironment( mergeConfig(testConfig(), { plugins: [ DefaultSearchPlugin.init({ indexStockStatus: true, }), DefaultJobQueuePlugin, ], }), ); beforeAll(async () => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures', 'default-search-plugin-sort-by.csv'), customerCount: 1, }); await adminClient.asSuperAdmin(); await awaitRunningJobs(adminClient); }, TEST_SETUP_TIMEOUT_MS); afterAll(async () => { await awaitRunningJobs(adminClient); await server.destroy(); }); function searchProductsShop(queryVariables: SearchProductsShopQueryVariables) { return shopClient.query<SearchProductsShopQuery, SearchProductsShopQueryVariables>( SEARCH_PRODUCTS_SHOP, queryVariables, ); } function searchProductsAdmin(queryVariables: SearchProductsAdminQueryVariables) { return adminClient.query<SearchProductsAdminQuery, SearchProductsAdminQueryVariables>( SEARCH_PRODUCTS_ADMIN, queryVariables, ); } type SearchProducts = ( queryVariables: SearchProductsShopQueryVariables | SearchProductsAdminQueryVariables, ) => Promise<SearchProductsShopQuery | SearchProductsAdminQuery>; async function testSearchProducts( searchProducts: SearchProducts, groupByProduct: boolean, sortBy: keyof SearchResultSortParameter, sortOrder: (typeof SortOrder)[keyof typeof SortOrder], skip: number, take: number, ) { return searchProducts({ input: { groupByProduct, sort: { [sortBy]: sortOrder, }, skip, take, }, }); } async function testSortByPriceAsc(searchProducts: SearchProducts) { const resultPage1 = await testSearchProducts(searchProducts, false, 'price', SortOrder.ASC, 0, 3); const resultPage2 = await testSearchProducts(searchProducts, false, 'price', SortOrder.ASC, 3, 3); const pvIds1 = resultPage1.search.items.map(i => i.productVariantId); const pvIds2 = resultPage2.search.items.map(i => i.productVariantId); const pvIds3 = pvIds1.concat(pvIds2); expect(new Set(pvIds3).size).equals(6); expect(resultPage1.search.items.map(i => i.productVariantId)).toEqual(['T_4', 'T_5', 'T_6']); expect(resultPage2.search.items.map(i => i.productVariantId)).toEqual(['T_7', 'T_8', 'T_9']); } async function testSortByPriceDesc(searchProducts: SearchProducts) { const resultPage1 = await testSearchProducts(searchProducts, false, 'price', SortOrder.DESC, 0, 3); const resultPage2 = await testSearchProducts(searchProducts, false, 'price', SortOrder.DESC, 3, 3); const pvIds1 = resultPage1.search.items.map(i => i.productVariantId); const pvIds2 = resultPage2.search.items.map(i => i.productVariantId); const pvIds3 = pvIds1.concat(pvIds2); expect(new Set(pvIds3).size).equals(6); expect(resultPage1.search.items.map(i => i.productVariantId)).toEqual(['T_1', 'T_2', 'T_3']); expect(resultPage2.search.items.map(i => i.productVariantId)).toEqual(['T_4', 'T_5', 'T_6']); } async function testSortByPriceAscGroupByProduct(searchProducts: SearchProducts) { const resultPage1 = await testSearchProducts(searchProducts, true, 'price', SortOrder.ASC, 0, 3); const resultPage2 = await testSearchProducts(searchProducts, true, 'price', SortOrder.ASC, 3, 3); const pvIds1 = resultPage1.search.items.map(i => i.productVariantId); const pvIds2 = resultPage2.search.items.map(i => i.productVariantId); const pvIds3 = pvIds1.concat(pvIds2); expect(new Set(pvIds3).size).equals(6); expect(resultPage1.search.items.map(i => i.productId)).toEqual(['T_4', 'T_5', 'T_6']); expect(resultPage2.search.items.map(i => i.productId)).toEqual(['T_1', 'T_2', 'T_3']); } async function testSortByPriceDescGroupByProduct(searchProducts: SearchProducts) { const resultPage1 = await testSearchProducts(searchProducts, true, 'price', SortOrder.DESC, 0, 3); const resultPage2 = await testSearchProducts(searchProducts, true, 'price', SortOrder.DESC, 3, 3); const pvIds1 = resultPage1.search.items.map(i => i.productVariantId); const pvIds2 = resultPage2.search.items.map(i => i.productVariantId); const pvIds3 = pvIds1.concat(pvIds2); expect(new Set(pvIds3).size).equals(6); expect(resultPage1.search.items.map(i => i.productId)).toEqual(['T_1', 'T_2', 'T_3']); expect(resultPage2.search.items.map(i => i.productId)).toEqual(['T_4', 'T_5', 'T_6']); } describe('Search products shop', () => { const searchProducts = searchProductsShop; it('sort by price ASC', () => testSortByPriceAsc(searchProducts)); it('sort by price DESC', () => testSortByPriceDesc(searchProducts)); it('sort by price ASC group by product', () => testSortByPriceAscGroupByProduct(searchProducts)); it('sort by price DESC group by product', () => testSortByPriceDescGroupByProduct(searchProducts)); }); describe('Search products admin', () => { const searchProducts = searchProductsAdmin; it('sort by price ACS', () => testSortByPriceAsc(searchProducts)); it('sort by price DESC', () => testSortByPriceDesc(searchProducts)); it('sort by price ASC group by product', () => testSortByPriceAscGroupByProduct(searchProducts)); it('sort by price DESC group by product', () => testSortByPriceDescGroupByProduct(searchProducts)); }); });
import { AuthenticationStrategy, ExternalAuthenticationService, Injector, RequestContext, RoleService, User, } from '@vendure/core'; import { DocumentNode } from 'graphql'; import gql from 'graphql-tag'; export const VALID_AUTH_TOKEN = 'valid-auth-token'; export type TestAuthPayload = { token: string; userData: { email: string; firstName: string; lastName: string; }; }; export class TestAuthenticationStrategy implements AuthenticationStrategy<TestAuthPayload> { readonly name = 'test_strategy'; private externalAuthenticationService: ExternalAuthenticationService; init(injector: Injector) { this.externalAuthenticationService = injector.get(ExternalAuthenticationService); } defineInputType(): DocumentNode { return gql` input TestAuthInput { token: String! userData: UserDataInput } input UserDataInput { email: String! firstName: String! lastName: String! } `; } async authenticate(ctx: RequestContext, data: TestAuthPayload): Promise<User | false | string> { const { token, userData } = data; if (token === 'expired-token') { return 'Expired token'; } if (data.token !== VALID_AUTH_TOKEN) { return false; } const user = await this.externalAuthenticationService.findUser(ctx, this.name, data.token); if (user) { return user; } return this.externalAuthenticationService.createCustomerAndUser(ctx, { strategy: this.name, externalIdentifier: data.token, emailAddress: userData.email, firstName: userData.firstName, lastName: userData.lastName, verified: true, }); } } export class TestSSOStrategyAdmin implements AuthenticationStrategy<{ email: string }> { readonly name = 'test_sso_strategy_admin'; private externalAuthenticationService: ExternalAuthenticationService; private roleService: RoleService; init(injector: Injector) { this.externalAuthenticationService = injector.get(ExternalAuthenticationService); this.roleService = injector.get(RoleService); } defineInputType(): DocumentNode { return gql` input TestSSOInputAdmin { email: String! } `; } async authenticate(ctx: RequestContext, data: { email: string }): Promise<User | false | string> { const { email } = data; const user = await this.externalAuthenticationService.findUser(ctx, this.name, email); if (user) { return user; } const superAdminRole = await this.roleService.getSuperAdminRole(); return this.externalAuthenticationService.createAdministratorAndUser(ctx, { strategy: this.name, externalIdentifier: email, emailAddress: email, firstName: 'SSO Admin First Name', lastName: 'SSO Admin Last Name', identifier: email, roles: [superAdminRole], }); } } export class TestSSOStrategyShop implements AuthenticationStrategy<{ email: string }> { readonly name = 'test_sso_strategy_shop'; private externalAuthenticationService: ExternalAuthenticationService; init(injector: Injector) { this.externalAuthenticationService = injector.get(ExternalAuthenticationService); } defineInputType(): DocumentNode { return gql` input TestSSOInputShop { email: String! } `; } async authenticate(ctx: RequestContext, data: { email: string }): Promise<User | false | string> { const { email } = data; const user = await this.externalAuthenticationService.findUser(ctx, this.name, email); if (user) { return user; } return this.externalAuthenticationService.createCustomerAndUser(ctx, { strategy: this.name, externalIdentifier: email, emailAddress: email, firstName: 'SSO Customer First Name', lastName: 'SSO Customer Last Name', verified: true, }); } } export class TestAuthenticationStrategy2 implements AuthenticationStrategy<{ token: string; email: string }> { readonly name = 'test_strategy2'; private externalAuthenticationService: ExternalAuthenticationService; init(injector: Injector) { this.externalAuthenticationService = injector.get(ExternalAuthenticationService); } defineInputType(): DocumentNode { return gql` input TestAuth2Input { token: String! email: String! } `; } async authenticate( ctx: RequestContext, data: { token: string; email: string }, ): Promise<User | false | string> { const { token, email } = data; if (token !== VALID_AUTH_TOKEN) { return false; } const user = await this.externalAuthenticationService.findCustomerUser(ctx, this.name, token); if (user) { return user; } const result = await this.externalAuthenticationService.createCustomerAndUser(ctx, { strategy: this.name, externalIdentifier: data.token, emailAddress: email, firstName: 'test', lastName: 'test', verified: true, }); return result; } }
import { PriceCalculationResult, Order, OrderItemPriceCalculationStrategy, ProductVariant, RequestContext, roundMoney, } from '@vendure/core'; /** * Adds $5 for items with gift wrapping, halves the price when buying 3 or more */ export class TestOrderItemPriceCalculationStrategy implements OrderItemPriceCalculationStrategy { calculateUnitPrice( ctx: RequestContext, productVariant: ProductVariant, orderLineCustomFields: { [p: string]: any }, order: Order, quantity: number, ): PriceCalculationResult | Promise<PriceCalculationResult> { let price = productVariant.price; if (orderLineCustomFields.giftWrap) { price += 500; } if (quantity > 3) { price = roundMoney(price / 2); } return { price, priceIncludesTax: productVariant.listPriceIncludesTax, }; } }
import { Payment, PaymentMethodHandler, TransactionalConnection } from '@vendure/core'; import { vi } from 'vitest'; import { LanguageCode } from '../graphql/generated-e2e-admin-types'; export const testSuccessfulPaymentMethod = new PaymentMethodHandler({ code: 'test-payment-method', description: [{ languageCode: LanguageCode.en, value: 'Test Payment Method' }], args: {}, createPayment: (ctx, order, amount, args, metadata) => { return { amount, state: 'Settled', transactionId: '12345', metadata: { public: metadata }, }; }, settlePayment: () => ({ success: true, }), }); export const onTransitionSpy = vi.fn(); export const onCancelPaymentSpy = vi.fn(); /** * A two-stage (authorize, capture) payment method, with no createRefund method. */ export const twoStagePaymentMethod = new PaymentMethodHandler({ code: 'authorize-only-payment-method', description: [{ languageCode: LanguageCode.en, value: 'Test Payment Method' }], args: {}, createPayment: (ctx, order, amount, args, metadata) => { return { amount, state: 'Authorized', transactionId: '12345-' + order.code, metadata: { public: metadata }, }; }, settlePayment: () => { return { success: true, metadata: { moreData: 42, }, }; }, cancelPayment: (...args) => { onCancelPaymentSpy(...args); return { success: true, metadata: { cancellationCode: '12345', }, }; }, onStateTransitionStart: (fromState, toState, data) => { onTransitionSpy(fromState, toState, data); }, }); /** * A method that can be used to pay for only part of the order (allowing us to test multiple payments * per order). */ export const partialPaymentMethod = new PaymentMethodHandler({ code: 'partial-payment-method', description: [{ languageCode: LanguageCode.en, value: 'Partial Payment Method' }], args: {}, createPayment: (ctx, order, amount, args, metadata) => { return { amount: metadata.amount, state: metadata.authorizeOnly ? 'Authorized' : 'Settled', transactionId: '12345', metadata: { public: metadata }, }; }, settlePayment: () => { return { success: true, }; }, }); /** * A payment method which includes a createRefund method. */ export const singleStageRefundablePaymentMethod = new PaymentMethodHandler({ code: 'single-stage-refundable-payment-method', description: [{ languageCode: LanguageCode.en, value: 'Test Payment Method' }], args: {}, createPayment: (ctx, order, amount, args, metadata) => { return { amount, state: 'Settled', transactionId: '12345', metadata, }; }, settlePayment: () => { return { success: true }; }, createRefund: (ctx, input, amount, order, payment, args) => { return { state: 'Settled', transactionId: 'abc123', metadata: { amount }, }; }, }); let connection: TransactionalConnection; /** * A payment method where a Refund attempt will fail the first time */ export const singleStageRefundFailingPaymentMethod = new PaymentMethodHandler({ code: 'single-stage-refund-failing-payment-method', description: [{ languageCode: LanguageCode.en, value: 'Test Payment Method' }], args: {}, init: injector => { connection = injector.get(TransactionalConnection); }, createPayment: (ctx, order, amount, args, metadata) => { return { amount, state: 'Settled', transactionId: '12345', metadata, }; }, settlePayment: () => { return { success: true }; }, createRefund: async (ctx, input, amount, order, payment, args) => { const paymentWithRefunds = await connection .getRepository(ctx, Payment) .findOne({ where: { id: payment.id }, relations: ['refunds'] }); const isFirstRefundAttempt = paymentWithRefunds?.refunds.length === 0; const metadata = isFirstRefundAttempt ? { errorMessage: 'Service temporarily unavailable' } : {}; return { state: isFirstRefundAttempt ? 'Failed' : 'Settled', metadata, }; }, }); /** * A payment method where calling `settlePayment` always fails. */ export const failsToSettlePaymentMethod = new PaymentMethodHandler({ code: 'fails-to-settle-payment-method', description: [{ languageCode: LanguageCode.en, value: 'Test Payment Method' }], args: {}, createPayment: (ctx, order, amount, args, metadata) => { return { amount, state: 'Authorized', transactionId: '12345-' + order.code, metadata: { privateCreatePaymentData: 'secret', public: { publicCreatePaymentData: 'public', }, }, }; }, settlePayment: () => { return { success: false, state: 'Cancelled', errorMessage: 'Something went horribly wrong', metadata: { privateSettlePaymentData: 'secret', public: { publicSettlePaymentData: 'public', }, }, }; }, }); /** * A payment method where calling `settlePayment` always fails. */ export const failsToCancelPaymentMethod = new PaymentMethodHandler({ code: 'fails-to-cancel-payment-method', description: [{ languageCode: LanguageCode.en, value: 'Test Payment Method' }], args: {}, createPayment: (ctx, order, amount, args, metadata) => { return { amount, state: 'Authorized', transactionId: '12345-' + order.code, }; }, settlePayment: () => { return { success: true, }; }, cancelPayment: (ctx, order, payment) => { return { success: false, errorMessage: 'something went horribly wrong', state: payment.state !== 'Cancelled' ? payment.state : undefined, metadata: { cancellationData: 'foo', }, }; }, }); export const testFailingPaymentMethod = new PaymentMethodHandler({ code: 'test-failing-payment-method', description: [{ languageCode: LanguageCode.en, value: 'Test Failing Payment Method' }], args: {}, createPayment: (ctx, order, amount, args, metadata) => { return { amount, state: 'Declined', errorMessage: 'Insufficient funds', metadata: { public: metadata }, }; }, settlePayment: () => ({ success: true, }), }); export const testErrorPaymentMethod = new PaymentMethodHandler({ code: 'test-error-payment-method', description: [{ languageCode: LanguageCode.en, value: 'Test Error Payment Method' }], args: {}, createPayment: (ctx, order, amount, args, metadata) => { return { amount, state: 'Error', errorMessage: 'Something went horribly wrong', metadata, }; }, settlePayment: () => ({ success: true, }), });
import { LanguageCode } from '@vendure/common/lib/generated-types'; import { EntityHydrator, ShippingEligibilityChecker } from '@vendure/core'; export const countryCodeShippingEligibilityChecker = new ShippingEligibilityChecker({ code: 'country-code-shipping-eligibility-checker', description: [{ languageCode: LanguageCode.en, value: 'Country Shipping Eligibility Checker' }], args: { countryCode: { type: 'string', }, }, check: (ctx, order, args) => { return order.shippingAddress?.countryCode === args.countryCode; }, }); let entityHydrator: EntityHydrator; /** * @description * This checker does nothing except for hydrating the Order in order to test * an edge-case which would cause inconsistencies when modifying the Order in which * the OrderService would e.g. remove an OrderLine, but then this step would re-add it * because the removal had not yet been persisted by the time the `applyPriceAdjustments()` * step was run (during which this checker will run). * * See https://github.com/vendure-ecommerce/vendure/issues/2548 */ export const hydratingShippingEligibilityChecker = new ShippingEligibilityChecker({ code: 'hydrating-shipping-eligibility-checker', description: [{ languageCode: LanguageCode.en, value: 'Hydrating Shipping Eligibility Checker' }], args: {}, init(injector) { entityHydrator = injector.get(EntityHydrator); }, check: async (ctx, order) => { await entityHydrator.hydrate(ctx, order, { relations: ['lines.sellerChannel'] }); return true; }, });
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { Args, Query, Resolver } from '@nestjs/graphql'; import { Asset, ChannelService, Ctx, DeepPartial, EntityHydrator, ID, LanguageCode, OrderService, PluginCommonModule, Product, ProductService, ProductVariantService, RequestContext, TransactionalConnection, VendureEntity, VendurePlugin, } from '@vendure/core'; import gql from 'graphql-tag'; import { Entity, ManyToOne } from 'typeorm'; @Resolver() export class TestAdminPluginResolver { constructor( private connection: TransactionalConnection, private orderService: OrderService, private channelService: ChannelService, private productVariantService: ProductVariantService, private productService: ProductService, private entityHydrator: EntityHydrator, ) {} @Query() async hydrateProduct(@Ctx() ctx: RequestContext, @Args() args: { id: ID }) { const product = await this.connection.getRepository(ctx, Product).findOne({ where: { id: args.id }, relations: ['facetValues'], }); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion await this.entityHydrator.hydrate(ctx, product!, { relations: [ 'variants.options', 'variants.product', 'assets.product', 'facetValues.facet', 'featuredAsset', 'variants.stockMovements', ], applyProductVariantPrices: true, }); return product; } // Test case for https://github.com/vendure-ecommerce/vendure/issues/1153 @Query() async hydrateProductAsset(@Ctx() ctx: RequestContext, @Args() args: { id: ID }) { const product = await this.connection.getRepository(ctx, Product).findOne({ where: { id: args.id } }); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion await this.entityHydrator.hydrate(ctx, product!, { relations: ['assets'], }); return product; } // Test case for https://github.com/vendure-ecommerce/vendure/issues/1161 @Query() async hydrateProductVariant(@Ctx() ctx: RequestContext, @Args() args: { id: ID }) { const [variant] = await this.productVariantService.findByIds(ctx, [args.id]); await this.entityHydrator.hydrate(ctx, variant, { relations: ['product.facetValues.facet'], }); return variant; } // Test case for https://github.com/vendure-ecommerce/vendure/issues/1324 @Query() async hydrateProductWithNoFacets(@Ctx() ctx: RequestContext) { const product = await this.productService.create(ctx, { enabled: true, translations: [ { languageCode: LanguageCode.en, name: 'test', slug: 'test', description: 'test', }, ], }); await this.entityHydrator.hydrate(ctx, product, { relations: ['facetValues', 'facetValues.facet'], }); return product; } // Test case for https://github.com/vendure-ecommerce/vendure/issues/1172 @Query() async hydrateOrder(@Ctx() ctx: RequestContext, @Args() args: { id: ID }) { const order = await this.orderService.findOne(ctx, args.id); await this.entityHydrator.hydrate(ctx, order!, { relations: ['payments'], }); return order; } // Test case for https://github.com/vendure-ecommerce/vendure/issues/1229 @Query() async hydrateOrderReturnQuantities(@Ctx() ctx: RequestContext, @Args() args: { id: ID }) { const order = await this.orderService.findOne(ctx, args.id); await this.entityHydrator.hydrate(ctx, order!, { relations: [ 'lines', 'lines.productVariant', 'lines.productVariant.product', 'lines.productVariant.product.assets', ], }); return order?.lines.map(line => line.quantity); } // Test case for https://github.com/vendure-ecommerce/vendure/issues/1284 @Query() async hydrateChannel(@Ctx() ctx: RequestContext, @Args() args: { id: ID }) { const channel = await this.channelService.findOne(ctx, args.id); await this.entityHydrator.hydrate(ctx, channel!, { relations: ['customFields.thumb'], }); return channel; } @Query() async hydrateChannelWithNestedRelation(@Ctx() ctx: RequestContext, @Args() args: { id: ID }) { const channel = await this.channelService.findOne(ctx, args.id); await this.entityHydrator.hydrate(ctx, channel!, { relations: [ 'customFields.thumb', 'customFields.additionalConfig', 'customFields.additionalConfig.backgroundImage', ], }); return channel; } } @Entity() export class AdditionalConfig extends VendureEntity { constructor(input?: DeepPartial<AdditionalConfig>) { super(input); } @ManyToOne(() => Asset, { onDelete: 'SET NULL', nullable: true }) backgroundImage: Asset; } @VendurePlugin({ imports: [PluginCommonModule], entities: [AdditionalConfig], adminApiExtensions: { resolvers: [TestAdminPluginResolver], schema: gql` extend type Query { hydrateProduct(id: ID!): JSON hydrateProductWithNoFacets: JSON hydrateProductAsset(id: ID!): JSON hydrateProductVariant(id: ID!): JSON hydrateOrder(id: ID!): JSON hydrateOrderReturnQuantities(id: ID!): JSON hydrateChannel(id: ID!): JSON hydrateChannelWithNestedRelation(id: ID!): JSON } `, }, configuration: config => { config.customFields.Channel.push({ name: 'thumb', type: 'relation', entity: Asset, nullable: true }); config.customFields.Channel.push({ name: 'additionalConfig', type: 'relation', entity: AdditionalConfig, graphQLType: 'JSON', nullable: true, }); return config; }, }) export class HydrationTestPlugin {}
import { Logger, OnApplicationBootstrap } from '@nestjs/common'; import { Args, Query, Resolver } from '@nestjs/graphql'; import { LanguageCode } from '@vendure/common/lib/generated-types'; import { DeepPartial, ID } from '@vendure/common/lib/shared-types'; import { Ctx, Customer, CustomerService, HasCustomFields, ListQueryBuilder, LocaleString, Order, OrderService, PluginCommonModule, RequestContext, RequestContextService, TransactionalConnection, Translatable, translateDeep, Translation, VendureEntity, VendurePlugin, } from '@vendure/core'; import gql from 'graphql-tag'; import { Column, Entity, JoinColumn, JoinTable, ManyToOne, OneToMany, OneToOne, Relation } from 'typeorm'; import { Calculated } from '../../../src/common/calculated-decorator'; @Entity() export class CustomFieldRelationTestEntity extends VendureEntity { constructor(input: Partial<CustomFieldRelationTestEntity>) { super(input); } @Column() data: string; @ManyToOne(() => TestEntity, testEntity => testEntity.customFields.relation) parent: Relation<TestEntity>; } @Entity() export class CustomFieldOtherRelationTestEntity extends VendureEntity { constructor(input: Partial<CustomFieldOtherRelationTestEntity>) { super(input); } @Column() data: string; @ManyToOne(() => TestEntity, testEntity => testEntity.customFields.otherRelation) parent: Relation<TestEntity>; } class TestEntityCustomFields { @OneToMany(() => CustomFieldRelationTestEntity, child => child.parent) relation: Relation<CustomFieldRelationTestEntity[]>; @OneToMany(() => CustomFieldOtherRelationTestEntity, child => child.parent) otherRelation: Relation<CustomFieldOtherRelationTestEntity[]>; } @Entity() export class TestEntity extends VendureEntity implements Translatable, HasCustomFields { constructor(input: Partial<TestEntity>) { super(input); } @Column() label: string; name: LocaleString; @Column() description: string; @Column() active: boolean; @Column() order: number; @Column('varchar') ownerId: ID; @Column() date: Date; @Calculated({ query: qb => qb .leftJoin( qb1 => { return qb1 .from(TestEntity, 'entity') .select('LENGTH(entity.description)', 'deslen') .addSelect('entity.id', 'eid'); }, 't1', 't1.eid = testentity.id', ) .addSelect('t1.deslen', 'deslen'), expression: 'deslen', }) get descriptionLength() { return this.description.length || 0; } @Calculated({ relations: ['prices'], expression: 'prices.price', }) get price() { return this.activePrice; } // calculated at runtime activePrice: number; @OneToMany(type => TestEntityPrice, price => price.parent) prices: TestEntityPrice[]; @OneToMany(type => TestEntityTranslation, translation => translation.base, { eager: true }) translations: Array<Translation<TestEntity>>; @OneToOne(type => Order) @JoinColumn() orderRelation: Order; @Column({ nullable: true }) nullableString: string; @Column({ nullable: true }) nullableBoolean: boolean; @Column({ nullable: true }) nullableNumber: number; @Column('varchar', { nullable: true }) nullableId: ID; @Column({ nullable: true }) nullableDate: Date; @Column(() => TestEntityCustomFields) customFields: TestEntityCustomFields; @ManyToOne(() => TestEntity, (type) => type.parent) parent: TestEntity | null; @Column('int', { nullable: true }) parentId: ID | null; } @Entity() export class TestEntityTranslation extends VendureEntity implements Translation<TestEntity> { constructor(input?: DeepPartial<Translation<TestEntity>>) { super(input); } @Column('varchar') languageCode: LanguageCode; @Column() name: string; @ManyToOne(type => TestEntity, base => base.translations) base: TestEntity; customFields: never; } @Entity() export class TestEntityPrice extends VendureEntity { constructor(input: Partial<TestEntityPrice>) { super(input); } @Column() channelId: number; @Column() price: number; @ManyToOne(type => TestEntity, parent => parent.prices) parent: TestEntity; } @Resolver() export class ListQueryResolver { constructor(private listQueryBuilder: ListQueryBuilder) {} @Query() testEntities(@Ctx() ctx: RequestContext, @Args() args: any) { return this.listQueryBuilder .build(TestEntity, args.options, { ctx, relations: [ 'parent', 'orderRelation', 'orderRelation.customer', 'customFields.relation', 'customFields.otherRelation', ], customPropertyMap: { customerLastName: 'orderRelation.customer.lastName', }, }) .getManyAndCount() .then(([items, totalItems]) => { for (const item of items) { if (item.prices && item.prices.length) { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion item.activePrice = item.prices.find(p => p.channelId === 1)!.price; } } return { items: items.map(i => translateDeep(i, ctx.languageCode, ['parent'])), totalItems, }; }); } @Query() testEntitiesGetMany(@Ctx() ctx: RequestContext, @Args() args: any) { return this.listQueryBuilder .build(TestEntity, args.options, { ctx, relations: ['prices', 'parent'] }) .getMany() .then(items => { for (const item of items) { if (item.prices && item.prices.length) { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion item.activePrice = item.prices.find(p => p.channelId === 1)!.price; } } return items.map(i => translateDeep(i, ctx.languageCode, ['parent'])); }); } } const apiExtensions = gql` type TestEntityTranslation implements Node { id: ID! createdAt: DateTime! updatedAt: DateTime! languageCode: LanguageCode! name: String! } type CustomFieldRelationTestEntity implements Node { id: ID! data: String! } type CustomFieldOtherRelationTestEntity implements Node { id: ID! data: String! } type TestEntityCustomFields { relation: [CustomFieldRelationTestEntity!]! otherRelation: [CustomFieldOtherRelationTestEntity!]! } type TestEntity implements Node { id: ID! createdAt: DateTime! updatedAt: DateTime! label: String! name: String! description: String! active: Boolean! order: Int! date: DateTime! descriptionLength: Int! price: Int! ownerId: ID! translations: [TestEntityTranslation!]! orderRelation: Order nullableString: String nullableBoolean: Boolean nullableNumber: Int nullableId: ID nullableDate: DateTime customFields: TestEntityCustomFields! parent: TestEntity } type TestEntityList implements PaginatedList { totalItems: Int! items: [TestEntity!]! } extend type Query { testEntities(options: TestEntityListOptions): TestEntityList! testEntitiesGetMany(options: TestEntityListOptions): [TestEntity!]! } input TestEntityFilterParameter { customerLastName: StringOperators } input TestEntitySortParameter { customerLastName: SortOrder } input TestEntityListOptions `; @VendurePlugin({ imports: [PluginCommonModule], entities: [ TestEntity, TestEntityPrice, TestEntityTranslation, CustomFieldRelationTestEntity, CustomFieldOtherRelationTestEntity, ], adminApiExtensions: { schema: apiExtensions, resolvers: [ListQueryResolver], }, shopApiExtensions: { schema: apiExtensions, resolvers: [ListQueryResolver], }, }) export class ListQueryPlugin implements OnApplicationBootstrap { constructor( private connection: TransactionalConnection, private requestContextService: RequestContextService, private customerService: CustomerService, private orderService: OrderService, ) {} async onApplicationBootstrap() { const count = await this.connection.rawConnection.getRepository(TestEntity).count(); if (count === 0) { const testEntities = await this.connection.rawConnection.getRepository(TestEntity).save([ new TestEntity({ label: 'A', description: 'Lorem ipsum', // 11 date: new Date('2020-01-05T10:00:00.000Z'), active: true, order: 0, ownerId: 10, nullableString: 'lorem', nullableBoolean: true, nullableNumber: 42, nullableId: 123, nullableDate: new Date('2022-01-05T10:00:00.000Z'), }), new TestEntity({ label: 'B', description: 'dolor sit', // 9 date: new Date('2020-01-15T10:00:00.000Z'), active: true, order: 1, ownerId: 11, }), new TestEntity({ label: 'C', description: 'consectetur adipiscing', // 22 date: new Date('2020-01-25T10:00:00.000Z'), active: false, order: 2, ownerId: 12, nullableString: 'lorem', nullableBoolean: true, nullableNumber: 42, nullableId: 123, nullableDate: new Date('2022-01-05T10:00:00.000Z'), }), new TestEntity({ label: 'D', description: 'eiusmod tempor', // 14 date: new Date('2020-01-30T10:00:00.000Z'), active: true, order: 3, ownerId: 13, }), new TestEntity({ label: 'E', description: 'incididunt ut', // 13 date: new Date('2020-02-05T10:00:00.000Z'), active: false, order: 4, ownerId: 14, nullableString: 'lorem', nullableBoolean: true, nullableNumber: 42, nullableId: 123, nullableDate: new Date('2022-01-05T10:00:00.000Z'), }), new TestEntity({ label: 'F', description: 'quis nostrud exercitation ullamco', // 33 date: new Date('2020-02-07T10:00:00.000Z'), active: false, order: 5, ownerId: 15, }), ]); // test entity with self-referencing relation without tree structure decorator testEntities[0].parent = testEntities[1]; testEntities[3].parent = testEntities[1]; await this.connection.rawConnection.getRepository(TestEntity).save([testEntities[0], testEntities[3]]); const translations: any = { A: { [LanguageCode.en]: 'apple', [LanguageCode.de]: 'apfel' }, B: { [LanguageCode.en]: 'bike', [LanguageCode.de]: 'fahrrad' }, C: { [LanguageCode.en]: 'cake', [LanguageCode.de]: 'kuchen' }, D: { [LanguageCode.en]: 'dog', [LanguageCode.de]: 'hund' }, E: { [LanguageCode.en]: 'egg' }, F: { [LanguageCode.de]: 'baum' }, }; const nestedData: Record<string, Array<{ data: string }>> = { A: [{ data: 'A' }], B: [{ data: 'B' }], C: [{ data: 'C' }], }; for (const testEntity of testEntities) { await this.connection.rawConnection.getRepository(TestEntityPrice).save([ new TestEntityPrice({ price: testEntity.description.length, channelId: 1, parent: testEntity, }), new TestEntityPrice({ price: testEntity.description.length * 100, channelId: 2, parent: testEntity, }), ]); for (const code of [LanguageCode.en, LanguageCode.de]) { const translation = translations[testEntity.label][code]; if (translation) { await this.connection.rawConnection.getRepository(TestEntityTranslation).save( new TestEntityTranslation({ name: translation, base: testEntity, languageCode: code, }), ); } } if (nestedData[testEntity.label]) { for (const nestedContent of nestedData[testEntity.label]) { await this.connection.rawConnection.getRepository(CustomFieldRelationTestEntity).save( new CustomFieldRelationTestEntity({ parent: testEntity, data: nestedContent.data, }), ); await this.connection.rawConnection.getRepository(CustomFieldOtherRelationTestEntity).save( new CustomFieldOtherRelationTestEntity({ parent: testEntity, data: nestedContent.data, }), ); } } } } else { const testEntities = await this.connection.rawConnection.getRepository(TestEntity).find(); const ctx = await this.requestContextService.create({ apiType: 'admin' }); const customers = await this.connection.rawConnection.getRepository(Customer).find(); let i = 0; for (const testEntity of testEntities) { const customer = customers[i % customers.length]; try { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const order = await this.orderService.create(ctx, customer.user!.id); testEntity.orderRelation = order; await this.connection.rawConnection.getRepository(TestEntity).save(testEntity); } catch (e: any) { Logger.error(e); } i++; } } } }
import { AvailableStock, DefaultStockLocationStrategy, ID, idsAreEqual, Injector, LocationWithQuantity, OrderLine, PluginCommonModule, ProductVariant, RequestContext, StockDisplayStrategy, StockLevel, StockLocation, TransactionalConnection, VendurePlugin, } from '@vendure/core'; declare module '@vendure/core/dist/entity/custom-entity-fields' { interface CustomOrderLineFields { stockLocationId?: string; } } export class TestStockLocationStrategy extends DefaultStockLocationStrategy { forAllocation( ctx: RequestContext, stockLocations: StockLocation[], orderLine: OrderLine, quantity: number, ): LocationWithQuantity[] | Promise<LocationWithQuantity[]> { const selectedLocation = stockLocations.find(location => idsAreEqual(location.id, orderLine.customFields.stockLocationId), ); return [{ location: selectedLocation ?? stockLocations[0], quantity }]; } getAvailableStock(ctx: RequestContext, productVariantId: ID, stockLevels: StockLevel[]): AvailableStock { const locationId = ctx.req?.query.fromLocation; const locationStock = locationId && stockLevels.find(level => idsAreEqual(level.stockLocationId, locationId.toString())); if (locationStock) { return { stockOnHand: locationStock.stockOnHand, stockAllocated: locationStock.stockAllocated, }; } return stockLevels.reduce( (all, level) => ({ stockOnHand: all.stockOnHand + level.stockOnHand, stockAllocated: all.stockAllocated + level.stockAllocated, }), { stockOnHand: 0, stockAllocated: 0 }, ); } } export class TestStockDisplayStrategy implements StockDisplayStrategy { getStockLevel(ctx: RequestContext, productVariant: ProductVariant, saleableStockLevel: number) { return saleableStockLevel.toString(); } } @VendurePlugin({ imports: [PluginCommonModule], configuration: config => { config.catalogOptions.stockLocationStrategy = new TestStockLocationStrategy(); config.catalogOptions.stockDisplayStrategy = new TestStockDisplayStrategy(); config.customFields.OrderLine.push({ name: 'stockLocationId', type: 'string', nullable: true }); return config; }, }) export class TestMultiLocationStockPlugin {}
import { Injectable } from '@nestjs/common'; import { Args, Query, Resolver } from '@nestjs/graphql'; import { QueryOrdersArgs } from '@vendure/common/lib/generated-types'; import { PaginatedList } from '@vendure/common/lib/shared-types'; import { Ctx, Order, OrderService, RequestContext, VendurePlugin, Relations, RelationPaths, PluginCommonModule, } from '@vendure/core'; import gql from 'graphql-tag'; @Injectable() export class RelationDecoratorTestService { private lastRelations: string[]; getRelations() { return this.lastRelations; } reset() { this.lastRelations = []; } recordRelations(relations: string[]) { this.lastRelations = relations; } } @Resolver() export class TestResolver { constructor(private orderService: OrderService, private testService: RelationDecoratorTestService) {} @Query() orders( @Ctx() ctx: RequestContext, @Args() args: QueryOrdersArgs, @Relations(Order) relations: RelationPaths<Order>, ): Promise<PaginatedList<Order>> { this.testService.recordRelations(relations); return this.orderService.findAll(ctx, args.options || undefined, relations); } @Query() ordersWithDepth5( @Ctx() ctx: RequestContext, @Args() args: QueryOrdersArgs, @Relations({ entity: Order, depth: 5 }) relations: RelationPaths<Order>, ): Promise<PaginatedList<Order>> { this.testService.recordRelations(relations); return this.orderService.findAll(ctx, args.options || undefined, relations); } } @VendurePlugin({ imports: [PluginCommonModule], shopApiExtensions: { resolvers: () => [TestResolver], schema: () => gql` extend type Query { orders(options: OrderListOptions): OrderList! ordersWithDepth5(options: OrderListOptions): OrderList! } `, }, providers: [RelationDecoratorTestService], exports: [RelationDecoratorTestService], }) export class RelationsDecoratorTestPlugin {}
import { Args, Mutation, Resolver } from '@nestjs/graphql'; import { Asset, AssetType, Country, Ctx, PluginCommonModule, Product, ProductAsset, RequestContext, Transaction, TransactionalConnection, VendurePlugin, } from '@vendure/core'; import gql from 'graphql-tag'; @Resolver() export class SlowMutationResolver { constructor(private connection: TransactionalConnection) {} /** * A mutation which simulates some slow DB operations occurring within a transaction. */ @Transaction() @Mutation() async slowMutation(@Ctx() ctx: RequestContext, @Args() args: { delay: number }) { const delay = Math.round(args.delay / 2); const country = await this.connection.getRepository(ctx, Country).findOneOrFail({ where: { code: 'AT', }, }); country.enabled = false; await new Promise(resolve => setTimeout(resolve, delay)); await this.connection.getRepository(ctx, Country).save(country); country.enabled = true; await new Promise(resolve => setTimeout(resolve, delay)); await this.connection.getRepository(ctx, Country).save(country); return true; } /** * This mutation attempts to cause a deadlock */ @Transaction() @Mutation() async attemptDeadlock(@Ctx() ctx: RequestContext) { const product = await this.connection.getRepository(ctx, Product).findOneOrFail({ where: { id: 1 } }); const asset = await this.connection.getRepository(ctx, Asset).save( new Asset({ name: 'test', type: AssetType.BINARY, mimeType: 'test/test', fileSize: 1, source: '', preview: '', }), ); await new Promise(resolve => setTimeout(resolve, 100)); const productAsset = await this.connection.getRepository(ctx, ProductAsset).save( new ProductAsset({ assetId: asset.id, productId: product.id, position: 0, }), ); await this.connection.getRepository(ctx, Product).update(product.id, { enabled: false }); return true; } } @VendurePlugin({ imports: [PluginCommonModule], adminApiExtensions: { resolvers: [SlowMutationResolver], schema: gql` extend type Mutation { slowMutation(delay: Int!): Boolean! attemptDeadlock: Boolean! } `, }, }) export class SlowMutationPlugin {}
import { Args, Mutation, Parent, ResolveField, Resolver } from '@nestjs/graphql'; import { ID } from '@vendure/common/lib/shared-types'; import { ActiveOrderStrategy, Ctx, CustomerService, idsAreEqual, Injector, Order, OrderService, PluginCommonModule, RequestContext, Transaction, TransactionalConnection, UserInputError, VendurePlugin, } from '@vendure/core'; import gql from 'graphql-tag'; declare module '@vendure/core/dist/entity/custom-entity-fields' { interface CustomOrderFields { orderToken: string; } } class TokenActiveOrderStrategy implements ActiveOrderStrategy<{ token: string }> { readonly name = 'orderToken'; private connection: TransactionalConnection; private orderService: OrderService; init(injector: Injector) { this.connection = injector.get(TransactionalConnection); this.orderService = injector.get(OrderService); } defineInputType = () => gql` input OrderTokenActiveOrderInput { token: String } `; async determineActiveOrder(ctx: RequestContext, input: { token: string }) { const qb = this.connection .getRepository(ctx, Order) .createQueryBuilder('order') .leftJoinAndSelect('order.customer', 'customer') .leftJoinAndSelect('customer.user', 'user') .where('order.customFields.orderToken = :orderToken', { orderToken: input.token }); const order = await qb.getOne(); if (!order) { return; } const orderUserId = order.customer && order.customer.user && order.customer.user.id; if (order.customer && idsAreEqual(orderUserId, ctx.activeUserId)) { return order; } } } @Resolver('Order') export class OrderTokenResolver { @ResolveField() orderToken(@Parent() order: Order) { return order.customFields.orderToken; } } @Resolver() export class CreateOrderResolver { constructor(private orderService: OrderService, private customerService: CustomerService) {} @Mutation() @Transaction() async createOrder(@Ctx() ctx: RequestContext, @Args() args: { customerId: ID }) { const customer = await this.customerService.findOne(ctx, args.customerId); if (!customer) { throw new UserInputError('No customer found'); } const order = await this.orderService.create(ctx, customer.user?.id); return this.orderService.updateCustomFields(ctx, order.id, { orderToken: `token-${args.customerId}`, }); } } @VendurePlugin({ imports: [PluginCommonModule], configuration: config => { config.customFields.Order.push({ name: 'orderToken', type: 'string', internal: true, }); config.orderOptions.activeOrderStrategy = new TokenActiveOrderStrategy(); return config; }, shopApiExtensions: { schema: gql` extend type Mutation { createOrder(customerId: ID!): Order! } extend type Order { orderToken: String! } `, resolvers: [OrderTokenResolver, CreateOrderResolver], }, }) export class TokenActiveOrderPlugin {}
/* eslint-disable @typescript-eslint/restrict-template-expressions */ import { Injectable, OnApplicationBootstrap } from '@nestjs/common'; import { Args, Mutation, Query, Resolver } from '@nestjs/graphql'; import { Administrator, Ctx, EventBus, InternalServerError, NativeAuthenticationMethod, PluginCommonModule, RequestContext, Transaction, TransactionalConnection, User, VendureEvent, VendurePlugin, } from '@vendure/core'; import gql from 'graphql-tag'; import { ReplaySubject, Subscription } from 'rxjs'; import { vi } from 'vitest'; export class TestEvent extends VendureEvent { constructor( public ctx: RequestContext, public administrator: Administrator, ) { super(); } } export const TRIGGER_NO_OPERATION = 'trigger-no-operation'; export const TRIGGER_ATTEMPTED_UPDATE_EMAIL = 'trigger-attempted-update-email'; export const TRIGGER_ATTEMPTED_READ_EMAIL = 'trigger-attempted-read-email'; @Injectable() class TestUserService { constructor(private connection: TransactionalConnection) {} async createUser(ctx: RequestContext, identifier: string) { const authMethod = await this.connection.getRepository(ctx, NativeAuthenticationMethod).save( new NativeAuthenticationMethod({ identifier, passwordHash: 'abc', }), ); await this.connection.getRepository(ctx, User).insert( new User({ authenticationMethods: [authMethod], identifier, roles: [], verified: true, }), ); return this.connection.getRepository(ctx, User).findOne({ where: { identifier }, }); } } @Injectable() class TestAdminService { constructor( private connection: TransactionalConnection, private userService: TestUserService, ) {} async createAdministrator(ctx: RequestContext, emailAddress: string, fail: boolean) { const user = await this.userService.createUser(ctx, emailAddress); if (fail) { throw new InternalServerError('Failed!'); } const admin = await this.connection.getRepository(ctx, Administrator).save( new Administrator({ emailAddress, user, firstName: 'jim', lastName: 'jiminy', }), ); return admin; } } @Resolver() class TestResolver { constructor( private testAdminService: TestAdminService, private connection: TransactionalConnection, private eventBus: EventBus, ) {} @Mutation() @Transaction() async createTestAdministrator(@Ctx() ctx: RequestContext, @Args() args: any) { const admin = await this.testAdminService.createAdministrator(ctx, args.emailAddress, args.fail); await this.eventBus.publish(new TestEvent(ctx, admin)); return admin; } @Mutation() @Transaction('manual') async createTestAdministrator2(@Ctx() ctx: RequestContext, @Args() args: any) { await this.connection.startTransaction(ctx); return this.testAdminService.createAdministrator(ctx, args.emailAddress, args.fail); } @Mutation() @Transaction('manual') async createTestAdministrator3(@Ctx() ctx: RequestContext, @Args() args: any) { // no transaction started return this.testAdminService.createAdministrator(ctx, args.emailAddress, args.fail); } @Mutation() @Transaction() async createTestAdministrator4(@Ctx() ctx: RequestContext, @Args() args: any) { const admin = await this.testAdminService.createAdministrator(ctx, args.emailAddress, args.fail); await this.eventBus.publish(new TestEvent(ctx, admin)); await new Promise(resolve => setTimeout(resolve, 50)); return admin; } @Mutation() async createTestAdministrator5(@Ctx() ctx: RequestContext, @Args() args: any) { if (args.noContext === true) { return this.connection.withTransaction(async _ctx => { const admin = await this.testAdminService.createAdministrator( _ctx, args.emailAddress, args.fail, ); return admin; }); } else { return this.connection.withTransaction(ctx, async _ctx => { const admin = await this.testAdminService.createAdministrator( _ctx, args.emailAddress, args.fail, ); return admin; }); } } @Mutation() @Transaction() async createNTestAdministrators(@Ctx() ctx: RequestContext, @Args() args: any) { let error: any; const promises: Array<Promise<any>> = []; for (let i = 0; i < args.n; i++) { promises.push( new Promise(resolve => setTimeout(resolve, i * 10)) .then(() => this.testAdminService.createAdministrator( ctx, `${args.emailAddress}${i}`, i < args.n * args.failFactor, ), ) .then(async admin => { await this.eventBus.publish(new TestEvent(ctx, admin)); return admin; }), ); } const result = await Promise.all(promises).catch((e: any) => { error = e; }); await this.allSettled(promises); if (error) { throw error; } return result; } @Mutation() async createNTestAdministrators2(@Ctx() ctx: RequestContext, @Args() args: any) { let error: any; const promises: Array<Promise<any>> = []; const result = await this.connection .withTransaction(ctx, _ctx => { for (let i = 0; i < args.n; i++) { promises.push( new Promise(resolve => setTimeout(resolve, i * 10)).then(() => this.testAdminService.createAdministrator( _ctx, `${args.emailAddress}${i}`, i < args.n * args.failFactor, ), ), ); } return Promise.all(promises); }) .catch((e: any) => { error = e; }); await this.allSettled(promises); if (error) { throw error; } return result; } @Mutation() @Transaction() async createNTestAdministrators3(@Ctx() ctx: RequestContext, @Args() args: any) { const result: any[] = []; const admin = await this.testAdminService.createAdministrator( ctx, `${args.emailAddress}${args.n}`, args.failFactor >= 1, ); result.push(admin); if (args.n > 0) { try { const admins = await this.connection.withTransaction(ctx, _ctx => this.createNTestAdministrators3(_ctx, { ...args, n: args.n - 1, failFactor: (args.n * args.failFactor) / (args.n - 1), }), ); result.push(...admins); } catch (e) { /* */ } } return result; } @Query() async verify() { const admins = await this.connection.getRepository(Administrator).find(); const users = await this.connection.getRepository(User).find(); return { admins, users, }; } // Promise.allSettled polyfill // Same as Promise.all but waits until all promises will be fulfilled or rejected. private allSettled<T>( promises: Array<Promise<T>>, ): Promise<Array<{ status: 'fulfilled'; value: T } | { status: 'rejected'; reason: any }>> { return Promise.all( promises.map((promise, i) => promise .then(value => ({ status: 'fulfilled' as const, value, })) .catch(reason => ({ status: 'rejected' as const, reason, })), ), ); } } @VendurePlugin({ imports: [PluginCommonModule], providers: [TestAdminService, TestUserService], adminApiExtensions: { schema: gql` extend type Mutation { createTestAdministrator(emailAddress: String!, fail: Boolean!): Administrator createTestAdministrator2(emailAddress: String!, fail: Boolean!): Administrator createTestAdministrator3(emailAddress: String!, fail: Boolean!): Administrator createTestAdministrator4(emailAddress: String!, fail: Boolean!): Administrator createTestAdministrator5( emailAddress: String! fail: Boolean! noContext: Boolean! ): Administrator createNTestAdministrators(emailAddress: String!, failFactor: Float!, n: Int!): JSON createNTestAdministrators2(emailAddress: String!, failFactor: Float!, n: Int!): JSON createNTestAdministrators3(emailAddress: String!, failFactor: Float!, n: Int!): JSON } type VerifyResult { admins: [Administrator!]! users: [User!]! } extend type Query { verify: VerifyResult! } `, resolvers: [TestResolver], }, }) export class TransactionTestPlugin implements OnApplicationBootstrap { private subscription: Subscription; static callHandler = vi.fn(); static errorHandler = vi.fn(); static eventHandlerComplete$ = new ReplaySubject(1); constructor( private eventBus: EventBus, private connection: TransactionalConnection, ) {} static reset() { this.eventHandlerComplete$ = new ReplaySubject(1); this.callHandler.mockClear(); this.errorHandler.mockClear(); } onApplicationBootstrap(): any { // This part is used to test how RequestContext with transactions behave // when used in an Event subscription this.subscription = this.eventBus.ofType(TestEvent).subscribe(async event => { const { ctx, administrator } = event; if (administrator.emailAddress?.includes(TRIGGER_NO_OPERATION)) { TransactionTestPlugin.callHandler(); TransactionTestPlugin.eventHandlerComplete$.complete(); } if (administrator.emailAddress?.includes(TRIGGER_ATTEMPTED_UPDATE_EMAIL)) { TransactionTestPlugin.callHandler(); const adminRepository = this.connection.getRepository(ctx, Administrator); await new Promise(resolve => setTimeout(resolve, 50)); administrator.lastName = 'modified'; try { await adminRepository.save(administrator); } catch (e: any) { TransactionTestPlugin.errorHandler(e); } finally { TransactionTestPlugin.eventHandlerComplete$.complete(); } } if (administrator.emailAddress?.includes(TRIGGER_ATTEMPTED_READ_EMAIL)) { TransactionTestPlugin.callHandler(); // note the ctx is not passed here, so we are not inside the ongoing transaction const adminRepository = this.connection.getRepository(Administrator); try { await adminRepository.findOneOrFail({ where: { id: administrator.id } }); } catch (e: any) { TransactionTestPlugin.errorHandler(e); } finally { TransactionTestPlugin.eventHandlerComplete$.complete(); } } }); } }
import { OnApplicationBootstrap } from '@nestjs/common'; import { Args, Query, Resolver } from '@nestjs/graphql'; import { Ctx, ErrorResult, I18nService, PluginCommonModule, RequestContext, VendurePlugin, } from '@vendure/core'; import gql from 'graphql-tag'; import path from 'path'; class CustomError extends ErrorResult { readonly __typename = 'CustomError'; readonly errorCode = 'CUSTOM_ERROR'; readonly message = 'CUSTOM_ERROR'; } class NewError extends ErrorResult { readonly __typename = 'NewError'; readonly errorCode = 'NEW_ERROR'; readonly message = 'NEW_ERROR'; } @Resolver() class TestResolver { @Query() async customErrorMessage(@Ctx() ctx: RequestContext, @Args() args: any) { return new CustomError(); } @Query() async newErrorMessage(@Ctx() ctx: RequestContext, @Args() args: any) { return new NewError(); } } export const CUSTOM_ERROR_MESSAGE_TRANSLATION = 'A custom error message'; @VendurePlugin({ imports: [PluginCommonModule], providers: [I18nService], adminApiExtensions: { schema: gql` extend type Query { customErrorMessage: CustomResult newErrorMessage: CustomResult } type CustomError implements ErrorResult { errorCode: ErrorCode! message: String! } type NewError implements ErrorResult { errorCode: ErrorCode! message: String! } "Return anything and the error that should be thrown" union CustomResult = Product | CustomError | NewError `, resolvers: [TestResolver], }, }) export class TranslationTestPlugin implements OnApplicationBootstrap { constructor(private i18nService: I18nService) {} onApplicationBootstrap(): any { this.i18nService.addTranslation('en', { errorResult: { CUSTOM_ERROR: CUSTOM_ERROR_MESSAGE_TRANSLATION, }, }); this.i18nService.addTranslation('de', { errorResult: { CUSTOM_ERROR: 'DE_' + CUSTOM_ERROR_MESSAGE_TRANSLATION, }, }); this.i18nService.addTranslationFile('en', path.join(__dirname, '../i18n/en.json')); this.i18nService.addTranslationFile('de', path.join(__dirname, '../i18n/de.json')); } }
import { INestApplication, INestMicroservice } from '@nestjs/common'; export class TestPluginWithAllLifecycleHooks { private static onConstructorFn: any; static init(constructorFn: any) { this.onConstructorFn = constructorFn; return this; } constructor() { TestPluginWithAllLifecycleHooks.onConstructorFn(); } /** * This is required because on the first run, the Vendure server will be bootstrapped twice - * once to populate the database and the second time for the actual tests. Thus the call counts * for the plugin lifecycles will be doubled. This method resets them after the initial * (population) run. */ private resetSpies() { TestPluginWithAllLifecycleHooks.onConstructorFn.mockClear(); } }
import { Query, Resolver } from '@nestjs/graphql'; import { VendurePlugin } from '@vendure/core'; import { GraphQLScalarType } from 'graphql'; import gql from 'graphql-tag'; @Resolver() export class TestAdminPluginResolver { @Query() foo() { return ['bar']; } @Query() barList() { return { items: [{ id: 1, name: 'Test', pizzaType: 'Cheese' }], totalItems: 1, }; } } @Resolver() export class TestShopPluginResolver { @Query() baz() { return ['quux']; } } const PizzaScalar = new GraphQLScalarType({ name: 'Pizza', description: 'Everything is pizza', serialize(value) { return ((value as any).toString() as string) + ' pizza!'; }, parseValue(value) { return value; }, }); @VendurePlugin({ shopApiExtensions: { resolvers: [TestShopPluginResolver], schema: gql` extend type Query { baz: [String]! } `, }, adminApiExtensions: { resolvers: [TestAdminPluginResolver], schema: gql` scalar Pizza extend type Query { foo: [String]! barList(options: BarListOptions): BarList! } input BarListOptions type Bar implements Node { id: ID! name: String! pizzaType: Pizza! } type BarList implements PaginatedList { items: [Bar!]! totalItems: Int! } `, scalars: { Pizza: PizzaScalar }, }, }) export class TestAPIExtensionPlugin {}
import { LanguageCode } from '@vendure/common/lib/generated-types'; import { ConfigModule, VendurePlugin } from '@vendure/core'; @VendurePlugin({ imports: [ConfigModule], configuration: config => { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion config.defaultLanguageCode = LanguageCode.zh; return config; }, }) export class TestPluginWithConfig { static setup() { return TestPluginWithConfig; } }
import { Collection, PluginCommonModule, VendureEntity, VendurePlugin } from '@vendure/core'; import gql from 'graphql-tag'; import { DeepPartial, Entity, ManyToMany, OneToMany } from 'typeorm'; declare module '@vendure/core/dist/entity/custom-entity-fields' { interface CustomCollectionFields { customEntity: TestCustomEntity; customEntityList: TestCustomEntity[]; } } @Entity() export class TestCustomEntity extends VendureEntity { constructor(input?: DeepPartial<TestCustomEntity>) { super(input); } @ManyToMany(() => Collection, c => c.customFields?.customEntityList, { eager: true, }) customEntityListInverse: Collection[]; @OneToMany(() => Collection, c => c.customFields.customEntity) customEntityInverse: Collection[]; } @VendurePlugin({ imports: [PluginCommonModule], entities: [TestCustomEntity], adminApiExtensions: { schema: gql` type TestCustomEntity { id: ID! } `, }, configuration: config => { config.customFields = { ...(config.customFields ?? {}), Collection: [ ...(config.customFields?.Collection ?? []), { name: 'customEntity', type: 'relation', entity: TestCustomEntity, list: false, public: false, inverseSide: (t: TestCustomEntity) => t.customEntityInverse, graphQLType: 'TestCustomEntity', }, { name: 'customEntityList', type: 'relation', entity: TestCustomEntity, list: true, public: false, inverseSide: (t: TestCustomEntity) => t.customEntityListInverse, graphQLType: 'TestCustomEntity', }, ], }; return config; }, }) export class WithCustomEntity {}
import { Mutation, Query, Resolver } from '@nestjs/graphql'; import { LanguageCode } from '@vendure/common/lib/generated-types'; import { Allow, CrudPermissionDefinition, PermissionDefinition, VendurePlugin } from '@vendure/core'; import gql from 'graphql-tag'; export const sync = new PermissionDefinition({ name: 'SyncWishlists', description: 'Allows syncing wishlists via Admin API', }); export const wishlist = new CrudPermissionDefinition('Wishlist'); @Resolver() export class TestWishlistResolver { @Allow(wishlist.Read) @Query() wishlist() { return true; } @Allow(wishlist.Create) @Mutation() createWishlist() { return true; } @Allow(wishlist.Update) @Mutation() updateWishlist() { return true; } @Allow(wishlist.Delete) @Mutation() deleteWishlist() { return true; } @Allow(sync.Permission) @Mutation() syncWishlist() { return true; } } @VendurePlugin({ imports: [], adminApiExtensions: { resolvers: [TestWishlistResolver], schema: gql` extend type Query { wishlist: Boolean! } extend type Mutation { createWishlist: Boolean! updateWishlist: Boolean! deleteWishlist: Boolean! syncWishlist: Boolean! } `, }, configuration: config => { config.authOptions.customPermissions = [sync, wishlist]; return config; }, }) export class TestPluginWithCustomPermissions {}
import { ArgumentMetadata, ArgumentsHost, CallHandler, CanActivate, Catch, ExceptionFilter, ExecutionContext, HttpException, Injectable, NestInterceptor, PipeTransform, } from '@nestjs/common'; import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR, APP_PIPE } from '@nestjs/core'; import { VendurePlugin } from '@vendure/core'; import { Observable } from 'rxjs'; @Injectable() export class TestInterceptor implements NestInterceptor { intercept(context: ExecutionContext, next: CallHandler): Observable<any> { return next.handle(); } } @Injectable() export class TestPipe implements PipeTransform<any> { async transform(value: any, { metatype }: ArgumentMetadata) { return value; } } @Injectable() export class TestGuard implements CanActivate { canActivate(context: ExecutionContext) { return true; } } @Catch(HttpException) export class HttpExceptionFilter implements ExceptionFilter { catch(exception: HttpException, host: ArgumentsHost) { const ctx = host.switchToHttp(); const response = ctx.getResponse<any>(); const request = ctx.getRequest<any>(); const status = exception.getStatus(); response.status(status).json({ statusCode: status, timestamp: new Date().toISOString(), path: request.url, }); } } /** * This plugin doesn't do anything other than attempt to register the global Nest providers * in order to test https://github.com/vendure-ecommerce/vendure/issues/837 */ @VendurePlugin({ providers: [ { provide: APP_INTERCEPTOR, useClass: TestInterceptor, }, { provide: APP_PIPE, useClass: TestPipe, }, { provide: APP_GUARD, useClass: TestGuard, }, { provide: APP_FILTER, useClass: HttpExceptionFilter, }, ], }) export class PluginWithGlobalProviders {}
import { Controller, Get, OnModuleInit } from '@nestjs/common'; import { JobQueue, JobQueueService, PluginCommonModule, VendurePlugin } from '@vendure/core'; import { Subject } from 'rxjs'; import { take } from 'rxjs/operators'; @Controller('run-job') class TestController implements OnModuleInit { private queue: JobQueue<{ returnValue?: string }>; constructor(private jobQueueService: JobQueueService) {} async onModuleInit(): Promise<void> { this.queue = await this.jobQueueService.createQueue({ name: 'test', process: async job => { if (job.data.returnValue) { await new Promise(resolve => setTimeout(resolve, 50)); return job.data.returnValue; } else { return PluginWithJobQueue.jobSubject .pipe(take(1)) .toPromise() .then(() => { PluginWithJobQueue.jobHasDoneWork = true; return job.data.returnValue; }); } }, }); } @Get() async runJob() { await this.queue.add({}); return true; } @Get('subscribe') async runJobAndSubscribe() { const job = await this.queue.add({ returnValue: '42!' }); return job .updates() .toPromise() .then(update => update?.result); } } @VendurePlugin({ imports: [PluginCommonModule], controllers: [TestController], }) export class PluginWithJobQueue { static jobHasDoneWork = false; static jobSubject = new Subject<void>(); }
import { Query, Resolver } from '@nestjs/graphql'; import { VendurePlugin } from '@vendure/core'; import gql from 'graphql-tag'; @Resolver() export class TestLazyResolver { @Query() lazy() { return 'sleeping'; } } @VendurePlugin({ shopApiExtensions: { resolvers: () => [TestLazyResolver], schema: () => gql` extend type Query { lazy: String! } `, }, }) export class TestLazyExtensionPlugin {}
import { ResolveField, Resolver } from '@nestjs/graphql'; import { Allow, PermissionDefinition, VendurePlugin } from '@vendure/core'; import gql from 'graphql-tag'; export const transactions = new PermissionDefinition({ name: 'Transactions', description: 'Allows reading of transaction data', }); @Resolver('Product') export class ProductEntityResolver { @Allow(transactions.Permission) @ResolveField() transactions() { return [ { id: 1, amount: 100, description: 'credit' }, { id: 2, amount: -50, description: 'debit' }, ]; } } @VendurePlugin({ adminApiExtensions: { resolvers: [ProductEntityResolver], schema: gql` extend type Query { transactions: [Transaction!]! } extend type Product { transactions: [Transaction!]! } type Transaction implements Node { id: ID! amount: Int! description: String! } `, }, configuration: config => { config.authOptions.customPermissions.push(transactions); return config; }, }) export class ProtectedFieldsPlugin {}
import { Injectable } from '@nestjs/common'; import { Query, Resolver } from '@nestjs/graphql'; import { VendurePlugin } from '@vendure/core'; import gql from 'graphql-tag'; @Injectable() export class NameService { getNames(): string[] { return ['seon', 'linda', 'hong']; } } @Resolver() export class TestResolverWithInjection { constructor(private nameService: NameService) {} @Query() names() { return this.nameService.getNames(); } } @VendurePlugin({ providers: [NameService], shopApiExtensions: { resolvers: [TestResolverWithInjection], schema: gql` extend type Query { names: [String]! } `, }, }) export class TestPluginWithProvider {}
import { Controller, Get } from '@nestjs/common'; import { Permission } from '@vendure/common/lib/generated-shop-types'; import { Allow, InternalServerError, VendurePlugin } from '@vendure/core'; @Controller('test') export class TestController { @Get('public') publicRoute() { return 'success'; } @Allow(Permission.Authenticated) @Get('restricted') restrictedRoute() { return 'success'; } @Get('bad') badRoute() { throw new InternalServerError('uh oh!'); } } @VendurePlugin({ controllers: [TestController], }) export class TestRestPlugin {}
import { OnApplicationBootstrap } from '@nestjs/common'; import { Args, Query, Resolver } from '@nestjs/graphql'; import { ID } from '@vendure/common/lib/shared-types'; import { Asset, Channel, Ctx, Customer, PluginCommonModule, Product, RequestContext, TransactionalConnection, User, VendureEntity, VendurePlugin, } from '@vendure/core'; import gql from 'graphql-tag'; import { Entity, JoinColumn, OneToOne } from 'typeorm'; import { vi } from 'vitest'; import { ProfileAsset } from './profile-asset.entity'; import { Profile } from './profile.entity'; @Entity() export class Vendor extends VendureEntity { constructor() { super(); } @OneToOne(type => Product, { eager: true }) @JoinColumn() featuredProduct: Product; } @Resolver() class TestResolver1636 { constructor(private connection: TransactionalConnection) {} @Query() async getAssetTest(@Ctx() ctx: RequestContext, @Args() args: { id: ID }) { const asset = await this.connection.findOneInChannel(ctx, Asset, args.id, ctx.channelId, { relations: ['customFields.single', 'customFields.multi'], }); TestPlugin1636_1664.testResolverSpy(asset); return true; } } const profileType = gql` type Profile implements Node { id: ID! createdAt: DateTime! updatedAt: DateTime! name: String! user: User! } `; /** * Testing https://github.com/vendure-ecommerce/vendure/issues/1636 * * and * * https://github.com/vendure-ecommerce/vendure/issues/1664 */ @VendurePlugin({ imports: [PluginCommonModule], entities: [Vendor, Profile, ProfileAsset], shopApiExtensions: { schema: gql` extend type Query { getAssetTest(id: ID!): Boolean! } type Vendor { id: ID featuredProduct: Product } `, resolvers: [TestResolver1636], }, adminApiExtensions: { schema: gql` type Vendor { id: ID featuredProduct: Product } type Profile implements Node { id: ID! createdAt: DateTime! updatedAt: DateTime! name: String! user: User! } `, resolvers: [], }, configuration: config => { config.customFields.Product.push( { name: 'cfVendor', type: 'relation', entity: Vendor, graphQLType: 'Vendor', list: false, internal: false, public: true, }, { name: 'owner', nullable: true, type: 'relation', // Using the Channel entity rather than User as in the example comment at // https://github.com/vendure-ecommerce/vendure/issues/1664#issuecomment-1293916504 // because using a User causes a recursive infinite loop in TypeORM between // Product > User > Vendor > Product etc. entity: Channel, public: false, eager: true, // needs to be eager to enable indexing of user->profile attributes like name, etc. readonly: true, }, ); config.customFields.User.push({ name: 'cfVendor', type: 'relation', entity: Vendor, graphQLType: 'Vendor', list: false, eager: true, internal: false, public: true, }); config.customFields.Channel.push({ name: 'profile', type: 'relation', entity: Profile, nullable: true, public: false, internal: false, readonly: true, eager: true, // needs to be eager to enable indexing of profile attributes like name, etc. }); config.customFields.Order.push({ name: 'productOwner', nullable: true, type: 'relation', entity: User, public: false, eager: true, readonly: true, }); return config; }, }) // eslint-disable-next-line @typescript-eslint/naming-convention export class TestPlugin1636_1664 implements OnApplicationBootstrap { static testResolverSpy = vi.fn(); constructor(private connection: TransactionalConnection) {} async onApplicationBootstrap() { const profilesCount = await this.connection.rawConnection.getRepository(Profile).count(); if (0 < profilesCount) { return; } // Create a Profile and assign it to all the products const channels = await this.connection.rawConnection.getRepository(Channel).find(); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const channel = channels[0]!; const profile = await this.connection.rawConnection.getRepository(Profile).save( new Profile({ name: 'Test Profile', }), ); (channel.customFields as any).profile = profile; await this.connection.rawConnection.getRepository(Channel).save(channel); const asset = await this.connection.rawConnection.getRepository(Asset).findOne({ where: { id: 1 } }); if (asset) { const profileAsset = this.connection.rawConnection.getRepository(ProfileAsset).save({ asset, profile, }); } const products = await this.connection.rawConnection.getRepository(Product).find(); for (const product of products) { (product.customFields as any).owner = channel; await this.connection.rawConnection.getRepository(Product).save(product); } } }
import { DeepPartial } from '@vendure/common/lib/shared-types'; import { Asset, VendureEntity } from '@vendure/core'; import { Entity, JoinColumn, ManyToOne, OneToOne } from 'typeorm'; import { Profile } from './profile.entity'; @Entity() export class ProfileAsset extends VendureEntity { constructor(input?: DeepPartial<ProfileAsset>) { super(input); } @OneToOne(() => Asset, { eager: true, onDelete: 'CASCADE' }) @JoinColumn() asset: Asset; @ManyToOne(() => Profile, { onDelete: 'CASCADE' }) profile: Profile; }
import { DeepPartial } from '@vendure/common/lib/shared-types'; import { User, VendureEntity } from '@vendure/core'; import { Column, Entity, JoinColumn, ManyToOne, OneToMany, OneToOne } from 'typeorm'; import { ProfileAsset } from './profile-asset.entity'; @Entity() export class Profile extends VendureEntity { constructor(input?: DeepPartial<Profile>) { super(input); } /** * The reference to a user */ @ManyToOne(() => User, user => (user as any).profileId, { onDelete: 'CASCADE' }) user: User; /** * Profile display name */ @Column() name: string; /** * The profile picture */ @OneToOne(() => ProfileAsset, profileAsset => profileAsset.profile, { onDelete: 'SET NULL', nullable: true, }) @JoinColumn() featuredAsset: ProfileAsset; /** * Other assets */ @OneToMany(() => ProfileAsset, profileAsset => profileAsset.profile, { onDelete: 'CASCADE', }) assets: ProfileAsset[]; }
import { PluginCommonModule, VendurePlugin } from '@vendure/core'; import { apiExtensions } from './api/index'; import { CampaignTranslation } from './entities/campaign-translation.entity'; import { Campaign } from './entities/campaign.entity'; import { collectionCustomFields } from './entities/custom-fields-collection.entity'; import { CampaignService } from './services/campaign.service'; @VendurePlugin({ imports: [PluginCommonModule], entities: [Campaign, CampaignTranslation], adminApiExtensions: { schema: apiExtensions, }, shopApiExtensions: { schema: apiExtensions, }, compatibility: '>=2.0.0', providers: [CampaignService], configuration: config => { config.customFields.Collection.push(...collectionCustomFields); return config; }, }) export class PluginIssue2453 { constructor(private campaignService: CampaignService) {} async onApplicationBootstrap() { await this.campaignService.initCampaigns(); } }
import { gql } from 'graphql-tag'; export const apiExtensions = gql` type Campaign implements Node { id: ID! createdAt: DateTime! updatedAt: DateTime! name: String code: String! promotion: Promotion promotionId: ID languageCode: LanguageCode! translations: [CampaignTranslation!]! } type CampaignTranslation implements Node { id: ID! languageCode: LanguageCode! name: String! } `;
import type { Translation } from '@vendure/core'; import { DeepPartial, LanguageCode, VendureEntity } from '@vendure/core'; import { Column, Entity, Relation, ManyToOne } from 'typeorm'; import { Campaign } from './campaign.entity'; /** * @description This entity represents a front end campaign * * @docsCategory entities */ @Entity('campaign_translation') export class CampaignTranslation extends VendureEntity implements Translation<Campaign> { constructor(input?: DeepPartial<Translation<Campaign>>) { super(input); } @Column('varchar') languageCode: LanguageCode; @Column('varchar') name: string; @ManyToOne(() => Campaign, base => base.translations, { onDelete: 'CASCADE', }) base: Relation<Campaign>; }
import type { ID, LocaleString, Translation } from '@vendure/core'; import { DeepPartial, Promotion, VendureEntity } from '@vendure/core'; import { Column, Entity, ManyToOne, OneToMany } from 'typeorm'; import { CampaignTranslation } from './campaign-translation.entity'; /** * @description This entity represents a front end campaign * * @docsCategory entities */ @Entity('campaign') export class Campaign extends VendureEntity { constructor(input?: DeepPartial<Campaign>) { super(input); } @Column({ unique: true }) code: string; name: LocaleString; @ManyToOne(() => Promotion, { onDelete: 'SET NULL' }) promotion: Promotion | null; @Column('int', { nullable: true }) promotionId: ID | null; @OneToMany(() => CampaignTranslation, translation => translation.base, { eager: true, }) translations: Array<Translation<Campaign>>; }
import type { CustomFieldConfig } from '@vendure/core'; import { LanguageCode } from '@vendure/core'; import { Campaign } from './campaign.entity.js'; /** * `Collection` basic custom fields for `campaign` */ export const collectionCustomFields: CustomFieldConfig[] = [ { type: 'relation', name: 'campaign', nullable: true, entity: Campaign, eager: true, // 当shop-api必须定义schema `Campaign` type,申明, 因为public=true public: true, graphQLType: 'Campaign', label: [ { languageCode: LanguageCode.en, value: 'Campaign', }, ], description: [ { languageCode: LanguageCode.en, value: 'Campaign of this collection page', }, ], }, { name: 'invisible', type: 'boolean', public: true, nullable: true, defaultValue: false, label: [ { languageCode: LanguageCode.en, value: 'Invisible', }, ], description: [ { languageCode: LanguageCode.en, value: 'This flag indicates if current collection is visible or inVisible, against `public`', }, ], }, ];
import { Injectable } from '@nestjs/common'; import { DeletionResponse, DeletionResult } from '@vendure/common/lib/generated-types'; import type { ID, ListQueryOptions, PaginatedList, Translated } from '@vendure/core'; import { assertFound, CollectionService, LanguageCode, ListQueryBuilder, RequestContext, TransactionalConnection, TranslatableSaver, translateDeep, } from '@vendure/core'; import { In } from 'typeorm'; import { CampaignTranslation } from '../entities/campaign-translation.entity'; import { Campaign } from '../entities/campaign.entity'; import { defaultCampaignData } from './default-campaigns/index'; @Injectable() export class CampaignService { constructor( private readonly connection: TransactionalConnection, private readonly listQueryBuilder: ListQueryBuilder, private readonly collectionService: CollectionService, private readonly translatableSaver: TranslatableSaver, ) {} async initCampaigns() { const item = await this.makeSureDefaultCampaigns(); // eslint-disable-next-line @typescript-eslint/no-non-null-assertion await this.makeSureDefaultCollections(item!); } findAll( ctx: RequestContext, options?: ListQueryOptions<Campaign>, ): Promise<PaginatedList<Translated<Campaign>>> { return this.listQueryBuilder .build(Campaign, options, { relations: ['promotion'], ctx }) .getManyAndCount() .then(([campaignItems, totalItems]) => { const items = campaignItems.map(campaignItem => translateDeep(campaignItem, ctx.languageCode, ['promotion']), ); return { items, totalItems, }; }); } findOne(ctx: RequestContext, id: ID): Promise<Translated<Campaign> | undefined | null> { return this.connection .getRepository(ctx, Campaign) .findOne({ where: { id }, relations: ['promotion'] }) .then(campaignItem => { return campaignItem && translateDeep(campaignItem, ctx.languageCode, ['promotion']); }); } findOneByCode(ctx: RequestContext, code: string): Promise<Translated<Campaign> | undefined | null> { return this.connection .getRepository(ctx, Campaign) .findOne({ where: { code }, relations: ['promotion'] }) .then(campaignItem => { return campaignItem && translateDeep(campaignItem, ctx.languageCode, ['promotion']); }); } async create(ctx: RequestContext, input: any): Promise<Translated<Campaign>> { const campaignItem = await this.translatableSaver.create({ ctx, // eslint-disable-next-line @typescript-eslint/no-explicit-any input, entityType: Campaign, translationType: CampaignTranslation, }); return assertFound(this.findOne(ctx, campaignItem.id)); } async update(ctx: RequestContext, input: any): Promise<Translated<Campaign>> { const campaignItem = await this.translatableSaver.update({ ctx, // eslint-disable-next-line @typescript-eslint/no-explicit-any input, entityType: Campaign, translationType: CampaignTranslation, }); return assertFound(this.findOne(ctx, campaignItem.id)); } async delete(ctx: RequestContext, ids: ID[]): Promise<DeletionResponse> { const items = await this.connection.getRepository(ctx, Campaign).find({ where: { id: In(ids), }, }); await this.connection.getRepository(ctx, Campaign).delete(items.map(s => String(s.id))); return { result: DeletionResult.DELETED, message: '', }; } private async makeSureDefaultCampaigns() { const ctx = RequestContext.empty(); const { items } = await this.findAll(ctx); let item; for (const campaignItem of defaultCampaignData()) { const hasOne = items.find(s => s.code === campaignItem.code); if (!hasOne) { item = await this.create(ctx, campaignItem); } else { item = await this.update(ctx, { ...campaignItem, id: hasOne.id, }); } } return item; } private async makeSureDefaultCollections(campaign: Translated<Campaign>) { const ctx = RequestContext.empty(); const { totalItems } = await this.collectionService.findAll(ctx); if (totalItems > 0) { return; } const parent = await this.collectionService.create(ctx, { filters: [], translations: [ { name: 'parent collection', slug: 'parent-collection', description: 'parent collection description', languageCode: LanguageCode.en, customFields: {}, }, ], }); await this.collectionService.create(ctx, { filters: [], parentId: parent?.id, customFields: { campaignId: campaign?.id, }, translations: [ { name: 'children collection', slug: 'children-collection', description: 'children collection description', languageCode: LanguageCode.en, customFields: {}, }, ], }); } }
import { LanguageCode } from '@vendure/common/lib/generated-types'; export const defaultCampaigns = () => [ { code: 'discount', campaignType: 'DirectDiscount', needClaimCoupon: false, enabled: true, translations: [ { languageCode: LanguageCode.en, name: 'Clearance Up to 70% Off frames', shortDesc: 'Clearance Up to 70% Off frames', }, { languageCode: LanguageCode.de, name: 'Clearance Up to 70% Off frames of de', shortDesc: 'Clearance Up to 70% Off frames of de', }, ], }, ] as any[];
import { defaultCampaigns } from './default-campaigns'; export const defaultCampaignData = () => [...defaultCampaigns()];
import gql from 'graphql-tag'; export const SEARCH_PRODUCTS_ADMIN = gql` query SearchProductsAdmin($input: SearchInput!) { search(input: $input) { totalItems items { enabled productId productName slug description productVariantId productVariantName sku } } } `;
import gql from 'graphql-tag'; export const ADMINISTRATOR_FRAGMENT = gql` fragment Administrator on Administrator { id firstName lastName emailAddress user { id identifier lastLogin roles { id code description permissions } } } `; export const ASSET_FRAGMENT = gql` fragment Asset on Asset { id name fileSize mimeType type preview source } `; export const PRODUCT_VARIANT_FRAGMENT = gql` fragment ProductVariant on ProductVariant { id createdAt updatedAt enabled languageCode name currencyCode price priceWithTax prices { currencyCode price } stockOnHand trackInventory taxRateApplied { id name value } taxCategory { id name } sku options { id code languageCode groupId name } facetValues { id code name facet { id name } } featuredAsset { ...Asset } assets { ...Asset } translations { id languageCode name } channels { id code } } ${ASSET_FRAGMENT} `; export const PRODUCT_WITH_VARIANTS_FRAGMENT = gql` fragment ProductWithVariants on Product { id enabled languageCode name slug description featuredAsset { ...Asset } assets { ...Asset } translations { languageCode name slug description } optionGroups { id languageCode code name } variants { ...ProductVariant } facetValues { id code name facet { id name } } channels { id code } } ${PRODUCT_VARIANT_FRAGMENT} ${ASSET_FRAGMENT} `; export const ROLE_FRAGMENT = gql` fragment Role on Role { id code description permissions channels { id code token } } `; export const CONFIGURABLE_FRAGMENT = gql` fragment ConfigurableOperation on ConfigurableOperation { args { name value } code } `; export const COLLECTION_FRAGMENT = gql` fragment Collection on Collection { id name slug description isPrivate languageCode featuredAsset { ...Asset } assets { ...Asset } filters { ...ConfigurableOperation } translations { id languageCode name slug description } parent { id name } children { id name position } } ${ASSET_FRAGMENT} ${CONFIGURABLE_FRAGMENT} `; export const FACET_VALUE_FRAGMENT = gql` fragment FacetValue on FacetValue { id languageCode code name translations { id languageCode name } facet { id name } } `; export const FACET_WITH_VALUES_FRAGMENT = gql` fragment FacetWithValues on Facet { id languageCode isPrivate code name translations { id languageCode name } values { ...FacetValue } } ${FACET_VALUE_FRAGMENT} `; export const COUNTRY_FRAGMENT = gql` fragment Country on Region { id code name enabled translations { id languageCode name } } `; export const ADDRESS_FRAGMENT = gql` fragment Address on Address { id fullName company streetLine1 streetLine2 city province postalCode country { id code name } phoneNumber defaultShippingAddress defaultBillingAddress } `; export const CUSTOMER_FRAGMENT = gql` fragment Customer on Customer { id title firstName lastName phoneNumber emailAddress user { id identifier verified lastLogin } addresses { ...Address } } ${ADDRESS_FRAGMENT} `; export const ADJUSTMENT_FRAGMENT = gql` fragment Adjustment on Adjustment { adjustmentSource amount description type } `; export const SHIPPING_ADDRESS_FRAGMENT = gql` fragment ShippingAddress on OrderAddress { fullName company streetLine1 streetLine2 city province postalCode country phoneNumber } `; export const ORDER_FRAGMENT = gql` fragment Order on Order { id createdAt updatedAt code active state total totalWithTax totalQuantity currencyCode customer { id firstName lastName } } `; export const PAYMENT_FRAGMENT = gql` fragment Payment on Payment { id transactionId amount method state nextStates metadata refunds { id total reason } } `; export const ORDER_WITH_LINES_FRAGMENT = gql` fragment OrderWithLines on Order { id createdAt updatedAt code state active customer { id firstName lastName } lines { id featuredAsset { preview } productVariant { id name sku } taxLines { description taxRate } unitPrice unitPriceWithTax quantity unitPrice unitPriceWithTax taxRate linePriceWithTax } surcharges { id description sku price priceWithTax } subTotal subTotalWithTax total totalWithTax totalQuantity currencyCode shipping shippingWithTax shippingLines { priceWithTax shippingMethod { id code name description } } shippingAddress { ...ShippingAddress } payments { ...Payment } fulfillments { id state method trackingCode lines { orderLineId quantity } } total } ${SHIPPING_ADDRESS_FRAGMENT} ${PAYMENT_FRAGMENT} `; export const PROMOTION_FRAGMENT = gql` fragment Promotion on Promotion { id createdAt updatedAt couponCode startsAt endsAt name description enabled perCustomerUsageLimit usageLimit conditions { ...ConfigurableOperation } actions { ...ConfigurableOperation } translations { id languageCode name description } } ${CONFIGURABLE_FRAGMENT} `; export const ZONE_FRAGMENT = gql` fragment Zone on Zone { id name members { ...Country } } ${COUNTRY_FRAGMENT} `; export const TAX_RATE_FRAGMENT = gql` fragment TaxRate on TaxRate { id name enabled value category { id name } zone { id name } customerGroup { id name } } `; export const CURRENT_USER_FRAGMENT = gql` fragment CurrentUser on CurrentUser { id identifier channels { code token permissions } } `; export const VARIANT_WITH_STOCK_FRAGMENT = gql` fragment VariantWithStock on ProductVariant { id stockOnHand stockAllocated stockMovements { items { ... on StockMovement { id type quantity } } totalItems } } `; export const FULFILLMENT_FRAGMENT = gql` fragment Fulfillment on Fulfillment { id state nextStates method trackingCode lines { orderLineId quantity } } `; export const CHANNEL_FRAGMENT = gql` fragment Channel on Channel { id code token currencyCode availableCurrencyCodes defaultCurrencyCode defaultLanguageCode defaultShippingZone { id } defaultTaxZone { id } pricesIncludeTax } `; export const GLOBAL_SETTINGS_FRAGMENT = gql` fragment GlobalSettings on GlobalSettings { id availableLanguages trackInventory outOfStockThreshold serverConfig { orderProcess { name to } permittedAssetTypes permissions { name description assignable } customFieldConfig { Customer { ... on CustomField { name } } } } } `; export const CUSTOMER_GROUP_FRAGMENT = gql` fragment CustomerGroup on CustomerGroup { id name customers { items { id } totalItems } } `; export const PRODUCT_OPTION_GROUP_FRAGMENT = gql` fragment ProductOptionGroup on ProductOptionGroup { id code name options { id code name } translations { id languageCode name } } `; export const PRODUCT_WITH_OPTIONS_FRAGMENT = gql` fragment ProductWithOptions on Product { id optionGroups { id code options { id code } } } `; export const SHIPPING_METHOD_FRAGMENT = gql` fragment ShippingMethod on ShippingMethod { id code name description calculator { code args { name value } } checker { code args { name value } } } `;
/* eslint-disable */ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; export type Maybe<T> = T | null; export type InputMaybe<T> = Maybe<T>; export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] }; export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> }; export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> }; export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never }; export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: { input: string; output: string; } String: { input: string; output: string; } Boolean: { input: boolean; output: boolean; } Int: { input: number; output: number; } Float: { input: number; output: number; } DateTime: { input: any; output: any; } JSON: { input: any; output: any; } Money: { input: number; output: number; } Upload: { input: any; output: any; } }; export type AddFulfillmentToOrderResult = CreateFulfillmentError | EmptyOrderLineSelectionError | Fulfillment | FulfillmentStateTransitionError | InsufficientStockOnHandError | InvalidFulfillmentHandlerError | ItemsAlreadyFulfilledError; export type AddItemInput = { productVariantId: Scalars['ID']['input']; quantity: Scalars['Int']['input']; }; export type AddItemToDraftOrderInput = { productVariantId: Scalars['ID']['input']; quantity: Scalars['Int']['input']; }; export type AddManualPaymentToOrderResult = ManualPaymentStateError | Order; export type AddNoteToCustomerInput = { id: Scalars['ID']['input']; isPublic: Scalars['Boolean']['input']; note: Scalars['String']['input']; }; export type AddNoteToOrderInput = { id: Scalars['ID']['input']; isPublic: Scalars['Boolean']['input']; note: Scalars['String']['input']; }; export type Address = Node & { city?: Maybe<Scalars['String']['output']>; company?: Maybe<Scalars['String']['output']>; country: Country; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; defaultBillingAddress?: Maybe<Scalars['Boolean']['output']>; defaultShippingAddress?: Maybe<Scalars['Boolean']['output']>; fullName?: Maybe<Scalars['String']['output']>; id: Scalars['ID']['output']; phoneNumber?: Maybe<Scalars['String']['output']>; postalCode?: Maybe<Scalars['String']['output']>; province?: Maybe<Scalars['String']['output']>; streetLine1: Scalars['String']['output']; streetLine2?: Maybe<Scalars['String']['output']>; updatedAt: Scalars['DateTime']['output']; }; export type AdjustDraftOrderLineInput = { orderLineId: Scalars['ID']['input']; quantity: Scalars['Int']['input']; }; export type Adjustment = { adjustmentSource: Scalars['String']['output']; amount: Scalars['Money']['output']; data?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; type: AdjustmentType; }; export enum AdjustmentType { DISTRIBUTED_ORDER_PROMOTION = 'DISTRIBUTED_ORDER_PROMOTION', OTHER = 'OTHER', PROMOTION = 'PROMOTION' } export type Administrator = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; emailAddress: Scalars['String']['output']; firstName: Scalars['String']['output']; id: Scalars['ID']['output']; lastName: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; user: User; }; export type AdministratorFilterParameter = { _and?: InputMaybe<Array<AdministratorFilterParameter>>; _or?: InputMaybe<Array<AdministratorFilterParameter>>; createdAt?: InputMaybe<DateOperators>; emailAddress?: InputMaybe<StringOperators>; firstName?: InputMaybe<StringOperators>; id?: InputMaybe<IdOperators>; lastName?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type AdministratorList = PaginatedList & { items: Array<Administrator>; totalItems: Scalars['Int']['output']; }; export type AdministratorListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<AdministratorFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<AdministratorSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type AdministratorPaymentInput = { metadata?: InputMaybe<Scalars['JSON']['input']>; paymentMethod?: InputMaybe<Scalars['String']['input']>; }; export type AdministratorRefundInput = { /** * The amount to be refunded to this particular Payment. This was introduced in * v2.2.0 as the preferred way to specify the refund amount. The `lines`, `shipping` and `adjustment` * fields will be removed in a future version. */ amount?: InputMaybe<Scalars['Money']['input']>; paymentId: Scalars['ID']['input']; reason?: InputMaybe<Scalars['String']['input']>; }; export type AdministratorSortParameter = { createdAt?: InputMaybe<SortOrder>; emailAddress?: InputMaybe<SortOrder>; firstName?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; lastName?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type Allocation = Node & StockMovement & { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; orderLine: OrderLine; productVariant: ProductVariant; quantity: Scalars['Int']['output']; type: StockMovementType; updatedAt: Scalars['DateTime']['output']; }; /** Returned if an attempting to refund an OrderItem which has already been refunded */ export type AlreadyRefundedError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; refundId: Scalars['ID']['output']; }; export type ApplyCouponCodeResult = CouponCodeExpiredError | CouponCodeInvalidError | CouponCodeLimitError | Order; export type Asset = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; fileSize: Scalars['Int']['output']; focalPoint?: Maybe<Coordinate>; height: Scalars['Int']['output']; id: Scalars['ID']['output']; mimeType: Scalars['String']['output']; name: Scalars['String']['output']; preview: Scalars['String']['output']; source: Scalars['String']['output']; tags: Array<Tag>; type: AssetType; updatedAt: Scalars['DateTime']['output']; width: Scalars['Int']['output']; }; export type AssetFilterParameter = { _and?: InputMaybe<Array<AssetFilterParameter>>; _or?: InputMaybe<Array<AssetFilterParameter>>; createdAt?: InputMaybe<DateOperators>; fileSize?: InputMaybe<NumberOperators>; height?: InputMaybe<NumberOperators>; id?: InputMaybe<IdOperators>; mimeType?: InputMaybe<StringOperators>; name?: InputMaybe<StringOperators>; preview?: InputMaybe<StringOperators>; source?: InputMaybe<StringOperators>; type?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; width?: InputMaybe<NumberOperators>; }; export type AssetList = PaginatedList & { items: Array<Asset>; totalItems: Scalars['Int']['output']; }; export type AssetListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<AssetFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<AssetSortParameter>; tags?: InputMaybe<Array<Scalars['String']['input']>>; tagsOperator?: InputMaybe<LogicalOperator>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type AssetSortParameter = { createdAt?: InputMaybe<SortOrder>; fileSize?: InputMaybe<SortOrder>; height?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; mimeType?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; preview?: InputMaybe<SortOrder>; source?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; width?: InputMaybe<SortOrder>; }; export enum AssetType { BINARY = 'BINARY', IMAGE = 'IMAGE', VIDEO = 'VIDEO' } export type AssignAssetsToChannelInput = { assetIds: Array<Scalars['ID']['input']>; channelId: Scalars['ID']['input']; }; export type AssignCollectionsToChannelInput = { channelId: Scalars['ID']['input']; collectionIds: Array<Scalars['ID']['input']>; }; export type AssignFacetsToChannelInput = { channelId: Scalars['ID']['input']; facetIds: Array<Scalars['ID']['input']>; }; export type AssignPaymentMethodsToChannelInput = { channelId: Scalars['ID']['input']; paymentMethodIds: Array<Scalars['ID']['input']>; }; export type AssignProductVariantsToChannelInput = { channelId: Scalars['ID']['input']; priceFactor?: InputMaybe<Scalars['Float']['input']>; productVariantIds: Array<Scalars['ID']['input']>; }; export type AssignProductsToChannelInput = { channelId: Scalars['ID']['input']; priceFactor?: InputMaybe<Scalars['Float']['input']>; productIds: Array<Scalars['ID']['input']>; }; export type AssignPromotionsToChannelInput = { channelId: Scalars['ID']['input']; promotionIds: Array<Scalars['ID']['input']>; }; export type AssignShippingMethodsToChannelInput = { channelId: Scalars['ID']['input']; shippingMethodIds: Array<Scalars['ID']['input']>; }; export type AssignStockLocationsToChannelInput = { channelId: Scalars['ID']['input']; stockLocationIds: Array<Scalars['ID']['input']>; }; export type AuthenticationInput = { native?: InputMaybe<NativeAuthInput>; }; export type AuthenticationMethod = Node & { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; strategy: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type AuthenticationResult = CurrentUser | InvalidCredentialsError; export type BooleanCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; /** Operators for filtering on a list of Boolean fields */ export type BooleanListOperators = { inList: Scalars['Boolean']['input']; }; /** Operators for filtering on a Boolean field */ export type BooleanOperators = { eq?: InputMaybe<Scalars['Boolean']['input']>; isNull?: InputMaybe<Scalars['Boolean']['input']>; }; /** Returned if an attempting to cancel lines from an Order which is still active */ export type CancelActiveOrderError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; orderState: Scalars['String']['output']; }; export type CancelOrderInput = { /** Specify whether the shipping charges should also be cancelled. Defaults to false */ cancelShipping?: InputMaybe<Scalars['Boolean']['input']>; /** Optionally specify which OrderLines to cancel. If not provided, all OrderLines will be cancelled */ lines?: InputMaybe<Array<OrderLineInput>>; /** The id of the order to be cancelled */ orderId: Scalars['ID']['input']; reason?: InputMaybe<Scalars['String']['input']>; }; export type CancelOrderResult = CancelActiveOrderError | EmptyOrderLineSelectionError | MultipleOrderError | Order | OrderStateTransitionError | QuantityTooGreatError; /** Returned if the Payment cancellation fails */ export type CancelPaymentError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; paymentErrorMessage: Scalars['String']['output']; }; export type CancelPaymentResult = CancelPaymentError | Payment | PaymentStateTransitionError; export type Cancellation = Node & StockMovement & { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; orderLine: OrderLine; productVariant: ProductVariant; quantity: Scalars['Int']['output']; type: StockMovementType; updatedAt: Scalars['DateTime']['output']; }; export type Channel = Node & { availableCurrencyCodes: Array<CurrencyCode>; availableLanguageCodes?: Maybe<Array<LanguageCode>>; code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; /** @deprecated Use defaultCurrencyCode instead */ currencyCode: CurrencyCode; customFields?: Maybe<Scalars['JSON']['output']>; defaultCurrencyCode: CurrencyCode; defaultLanguageCode: LanguageCode; defaultShippingZone?: Maybe<Zone>; defaultTaxZone?: Maybe<Zone>; id: Scalars['ID']['output']; /** Not yet used - will be implemented in a future release. */ outOfStockThreshold?: Maybe<Scalars['Int']['output']>; pricesIncludeTax: Scalars['Boolean']['output']; seller?: Maybe<Seller>; token: Scalars['String']['output']; /** Not yet used - will be implemented in a future release. */ trackInventory?: Maybe<Scalars['Boolean']['output']>; updatedAt: Scalars['DateTime']['output']; }; /** * Returned when the default LanguageCode of a Channel is no longer found in the `availableLanguages` * of the GlobalSettings */ export type ChannelDefaultLanguageError = ErrorResult & { channelCode: Scalars['String']['output']; errorCode: ErrorCode; language: Scalars['String']['output']; message: Scalars['String']['output']; }; export type ChannelFilterParameter = { _and?: InputMaybe<Array<ChannelFilterParameter>>; _or?: InputMaybe<Array<ChannelFilterParameter>>; code?: InputMaybe<StringOperators>; createdAt?: InputMaybe<DateOperators>; currencyCode?: InputMaybe<StringOperators>; defaultCurrencyCode?: InputMaybe<StringOperators>; defaultLanguageCode?: InputMaybe<StringOperators>; id?: InputMaybe<IdOperators>; outOfStockThreshold?: InputMaybe<NumberOperators>; pricesIncludeTax?: InputMaybe<BooleanOperators>; token?: InputMaybe<StringOperators>; trackInventory?: InputMaybe<BooleanOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type ChannelList = PaginatedList & { items: Array<Channel>; totalItems: Scalars['Int']['output']; }; export type ChannelListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<ChannelFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<ChannelSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type ChannelSortParameter = { code?: InputMaybe<SortOrder>; createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; outOfStockThreshold?: InputMaybe<SortOrder>; token?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type Collection = Node & { assets: Array<Asset>; breadcrumbs: Array<CollectionBreadcrumb>; children?: Maybe<Array<Collection>>; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; featuredAsset?: Maybe<Asset>; filters: Array<ConfigurableOperation>; id: Scalars['ID']['output']; inheritFilters: Scalars['Boolean']['output']; isPrivate: Scalars['Boolean']['output']; languageCode?: Maybe<LanguageCode>; name: Scalars['String']['output']; parent?: Maybe<Collection>; parentId: Scalars['ID']['output']; position: Scalars['Int']['output']; productVariants: ProductVariantList; slug: Scalars['String']['output']; translations: Array<CollectionTranslation>; updatedAt: Scalars['DateTime']['output']; }; export type CollectionProductVariantsArgs = { options?: InputMaybe<ProductVariantListOptions>; }; export type CollectionBreadcrumb = { id: Scalars['ID']['output']; name: Scalars['String']['output']; slug: Scalars['String']['output']; }; export type CollectionFilterParameter = { _and?: InputMaybe<Array<CollectionFilterParameter>>; _or?: InputMaybe<Array<CollectionFilterParameter>>; createdAt?: InputMaybe<DateOperators>; description?: InputMaybe<StringOperators>; id?: InputMaybe<IdOperators>; inheritFilters?: InputMaybe<BooleanOperators>; isPrivate?: InputMaybe<BooleanOperators>; languageCode?: InputMaybe<StringOperators>; name?: InputMaybe<StringOperators>; parentId?: InputMaybe<IdOperators>; position?: InputMaybe<NumberOperators>; slug?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type CollectionList = PaginatedList & { items: Array<Collection>; totalItems: Scalars['Int']['output']; }; export type CollectionListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<CollectionFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<CollectionSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; topLevelOnly?: InputMaybe<Scalars['Boolean']['input']>; }; /** * Which Collections are present in the products returned * by the search, and in what quantity. */ export type CollectionResult = { collection: Collection; count: Scalars['Int']['output']; }; export type CollectionSortParameter = { createdAt?: InputMaybe<SortOrder>; description?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; parentId?: InputMaybe<SortOrder>; position?: InputMaybe<SortOrder>; slug?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type CollectionTranslation = { createdAt: Scalars['DateTime']['output']; description: Scalars['String']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; slug: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type ConfigArg = { name: Scalars['String']['output']; value: Scalars['String']['output']; }; export type ConfigArgDefinition = { defaultValue?: Maybe<Scalars['JSON']['output']>; description?: Maybe<Scalars['String']['output']>; label?: Maybe<Scalars['String']['output']>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; required: Scalars['Boolean']['output']; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type ConfigArgInput = { name: Scalars['String']['input']; /** A JSON stringified representation of the actual value */ value: Scalars['String']['input']; }; export type ConfigurableOperation = { args: Array<ConfigArg>; code: Scalars['String']['output']; }; export type ConfigurableOperationDefinition = { args: Array<ConfigArgDefinition>; code: Scalars['String']['output']; description: Scalars['String']['output']; }; export type ConfigurableOperationInput = { arguments: Array<ConfigArgInput>; code: Scalars['String']['input']; }; export type Coordinate = { x: Scalars['Float']['output']; y: Scalars['Float']['output']; }; export type CoordinateInput = { x: Scalars['Float']['input']; y: Scalars['Float']['input']; }; export type Country = Node & Region & { code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; enabled: Scalars['Boolean']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; parent?: Maybe<Region>; parentId?: Maybe<Scalars['ID']['output']>; translations: Array<RegionTranslation>; type: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type CountryFilterParameter = { _and?: InputMaybe<Array<CountryFilterParameter>>; _or?: InputMaybe<Array<CountryFilterParameter>>; code?: InputMaybe<StringOperators>; createdAt?: InputMaybe<DateOperators>; enabled?: InputMaybe<BooleanOperators>; id?: InputMaybe<IdOperators>; languageCode?: InputMaybe<StringOperators>; name?: InputMaybe<StringOperators>; parentId?: InputMaybe<IdOperators>; type?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type CountryList = PaginatedList & { items: Array<Country>; totalItems: Scalars['Int']['output']; }; export type CountryListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<CountryFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<CountrySortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type CountrySortParameter = { code?: InputMaybe<SortOrder>; createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; parentId?: InputMaybe<SortOrder>; type?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type CountryTranslationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; id?: InputMaybe<Scalars['ID']['input']>; languageCode: LanguageCode; name?: InputMaybe<Scalars['String']['input']>; }; /** Returned if the provided coupon code is invalid */ export type CouponCodeExpiredError = ErrorResult & { couponCode: Scalars['String']['output']; errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned if the provided coupon code is invalid */ export type CouponCodeInvalidError = ErrorResult & { couponCode: Scalars['String']['output']; errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned if the provided coupon code is invalid */ export type CouponCodeLimitError = ErrorResult & { couponCode: Scalars['String']['output']; errorCode: ErrorCode; limit: Scalars['Int']['output']; message: Scalars['String']['output']; }; export type CreateAddressInput = { city?: InputMaybe<Scalars['String']['input']>; company?: InputMaybe<Scalars['String']['input']>; countryCode: Scalars['String']['input']; customFields?: InputMaybe<Scalars['JSON']['input']>; defaultBillingAddress?: InputMaybe<Scalars['Boolean']['input']>; defaultShippingAddress?: InputMaybe<Scalars['Boolean']['input']>; fullName?: InputMaybe<Scalars['String']['input']>; phoneNumber?: InputMaybe<Scalars['String']['input']>; postalCode?: InputMaybe<Scalars['String']['input']>; province?: InputMaybe<Scalars['String']['input']>; streetLine1: Scalars['String']['input']; streetLine2?: InputMaybe<Scalars['String']['input']>; }; export type CreateAdministratorInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; emailAddress: Scalars['String']['input']; firstName: Scalars['String']['input']; lastName: Scalars['String']['input']; password: Scalars['String']['input']; roleIds: Array<Scalars['ID']['input']>; }; export type CreateAssetInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; file: Scalars['Upload']['input']; tags?: InputMaybe<Array<Scalars['String']['input']>>; }; export type CreateAssetResult = Asset | MimeTypeError; export type CreateChannelInput = { availableCurrencyCodes?: InputMaybe<Array<CurrencyCode>>; availableLanguageCodes?: InputMaybe<Array<LanguageCode>>; code: Scalars['String']['input']; /** @deprecated Use defaultCurrencyCode instead */ currencyCode?: InputMaybe<CurrencyCode>; customFields?: InputMaybe<Scalars['JSON']['input']>; defaultCurrencyCode?: InputMaybe<CurrencyCode>; defaultLanguageCode: LanguageCode; defaultShippingZoneId: Scalars['ID']['input']; defaultTaxZoneId: Scalars['ID']['input']; outOfStockThreshold?: InputMaybe<Scalars['Int']['input']>; pricesIncludeTax: Scalars['Boolean']['input']; sellerId?: InputMaybe<Scalars['ID']['input']>; token: Scalars['String']['input']; trackInventory?: InputMaybe<Scalars['Boolean']['input']>; }; export type CreateChannelResult = Channel | LanguageNotAvailableError; export type CreateCollectionInput = { assetIds?: InputMaybe<Array<Scalars['ID']['input']>>; customFields?: InputMaybe<Scalars['JSON']['input']>; featuredAssetId?: InputMaybe<Scalars['ID']['input']>; filters: Array<ConfigurableOperationInput>; inheritFilters?: InputMaybe<Scalars['Boolean']['input']>; isPrivate?: InputMaybe<Scalars['Boolean']['input']>; parentId?: InputMaybe<Scalars['ID']['input']>; translations: Array<CreateCollectionTranslationInput>; }; export type CreateCollectionTranslationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; description: Scalars['String']['input']; languageCode: LanguageCode; name: Scalars['String']['input']; slug: Scalars['String']['input']; }; export type CreateCountryInput = { code: Scalars['String']['input']; customFields?: InputMaybe<Scalars['JSON']['input']>; enabled: Scalars['Boolean']['input']; translations: Array<CountryTranslationInput>; }; export type CreateCustomerGroupInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; customerIds?: InputMaybe<Array<Scalars['ID']['input']>>; name: Scalars['String']['input']; }; export type CreateCustomerInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; emailAddress: Scalars['String']['input']; firstName: Scalars['String']['input']; lastName: Scalars['String']['input']; phoneNumber?: InputMaybe<Scalars['String']['input']>; title?: InputMaybe<Scalars['String']['input']>; }; export type CreateCustomerResult = Customer | EmailAddressConflictError; export type CreateFacetInput = { code: Scalars['String']['input']; customFields?: InputMaybe<Scalars['JSON']['input']>; isPrivate: Scalars['Boolean']['input']; translations: Array<FacetTranslationInput>; values?: InputMaybe<Array<CreateFacetValueWithFacetInput>>; }; export type CreateFacetValueInput = { code: Scalars['String']['input']; customFields?: InputMaybe<Scalars['JSON']['input']>; facetId: Scalars['ID']['input']; translations: Array<FacetValueTranslationInput>; }; export type CreateFacetValueWithFacetInput = { code: Scalars['String']['input']; translations: Array<FacetValueTranslationInput>; }; /** Returned if an error is thrown in a FulfillmentHandler's createFulfillment method */ export type CreateFulfillmentError = ErrorResult & { errorCode: ErrorCode; fulfillmentHandlerError: Scalars['String']['output']; message: Scalars['String']['output']; }; export type CreateGroupOptionInput = { code: Scalars['String']['input']; translations: Array<ProductOptionGroupTranslationInput>; }; export type CreatePaymentMethodInput = { checker?: InputMaybe<ConfigurableOperationInput>; code: Scalars['String']['input']; customFields?: InputMaybe<Scalars['JSON']['input']>; enabled: Scalars['Boolean']['input']; handler: ConfigurableOperationInput; translations: Array<PaymentMethodTranslationInput>; }; export type CreateProductInput = { assetIds?: InputMaybe<Array<Scalars['ID']['input']>>; customFields?: InputMaybe<Scalars['JSON']['input']>; enabled?: InputMaybe<Scalars['Boolean']['input']>; facetValueIds?: InputMaybe<Array<Scalars['ID']['input']>>; featuredAssetId?: InputMaybe<Scalars['ID']['input']>; translations: Array<ProductTranslationInput>; }; export type CreateProductOptionGroupInput = { code: Scalars['String']['input']; customFields?: InputMaybe<Scalars['JSON']['input']>; options: Array<CreateGroupOptionInput>; translations: Array<ProductOptionGroupTranslationInput>; }; export type CreateProductOptionInput = { code: Scalars['String']['input']; customFields?: InputMaybe<Scalars['JSON']['input']>; productOptionGroupId: Scalars['ID']['input']; translations: Array<ProductOptionGroupTranslationInput>; }; export type CreateProductVariantInput = { assetIds?: InputMaybe<Array<Scalars['ID']['input']>>; customFields?: InputMaybe<Scalars['JSON']['input']>; facetValueIds?: InputMaybe<Array<Scalars['ID']['input']>>; featuredAssetId?: InputMaybe<Scalars['ID']['input']>; optionIds?: InputMaybe<Array<Scalars['ID']['input']>>; outOfStockThreshold?: InputMaybe<Scalars['Int']['input']>; price?: InputMaybe<Scalars['Money']['input']>; productId: Scalars['ID']['input']; sku: Scalars['String']['input']; stockLevels?: InputMaybe<Array<StockLevelInput>>; stockOnHand?: InputMaybe<Scalars['Int']['input']>; taxCategoryId?: InputMaybe<Scalars['ID']['input']>; trackInventory?: InputMaybe<GlobalFlag>; translations: Array<ProductVariantTranslationInput>; useGlobalOutOfStockThreshold?: InputMaybe<Scalars['Boolean']['input']>; }; export type CreateProductVariantOptionInput = { code: Scalars['String']['input']; optionGroupId: Scalars['ID']['input']; translations: Array<ProductOptionTranslationInput>; }; export type CreatePromotionInput = { actions: Array<ConfigurableOperationInput>; conditions: Array<ConfigurableOperationInput>; couponCode?: InputMaybe<Scalars['String']['input']>; customFields?: InputMaybe<Scalars['JSON']['input']>; enabled: Scalars['Boolean']['input']; endsAt?: InputMaybe<Scalars['DateTime']['input']>; perCustomerUsageLimit?: InputMaybe<Scalars['Int']['input']>; startsAt?: InputMaybe<Scalars['DateTime']['input']>; translations: Array<PromotionTranslationInput>; usageLimit?: InputMaybe<Scalars['Int']['input']>; }; export type CreatePromotionResult = MissingConditionsError | Promotion; export type CreateProvinceInput = { code: Scalars['String']['input']; customFields?: InputMaybe<Scalars['JSON']['input']>; enabled: Scalars['Boolean']['input']; translations: Array<ProvinceTranslationInput>; }; export type CreateRoleInput = { channelIds?: InputMaybe<Array<Scalars['ID']['input']>>; code: Scalars['String']['input']; description: Scalars['String']['input']; permissions: Array<Permission>; }; export type CreateSellerInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; name: Scalars['String']['input']; }; export type CreateShippingMethodInput = { calculator: ConfigurableOperationInput; checker: ConfigurableOperationInput; code: Scalars['String']['input']; customFields?: InputMaybe<Scalars['JSON']['input']>; fulfillmentHandler: Scalars['String']['input']; translations: Array<ShippingMethodTranslationInput>; }; export type CreateStockLocationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; description?: InputMaybe<Scalars['String']['input']>; name: Scalars['String']['input']; }; export type CreateTagInput = { value: Scalars['String']['input']; }; export type CreateTaxCategoryInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; isDefault?: InputMaybe<Scalars['Boolean']['input']>; name: Scalars['String']['input']; }; export type CreateTaxRateInput = { categoryId: Scalars['ID']['input']; customFields?: InputMaybe<Scalars['JSON']['input']>; customerGroupId?: InputMaybe<Scalars['ID']['input']>; enabled: Scalars['Boolean']['input']; name: Scalars['String']['input']; value: Scalars['Float']['input']; zoneId: Scalars['ID']['input']; }; export type CreateZoneInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; memberIds?: InputMaybe<Array<Scalars['ID']['input']>>; name: Scalars['String']['input']; }; /** * @description * ISO 4217 currency code * * @docsCategory common */ export enum CurrencyCode { /** United Arab Emirates dirham */ AED = 'AED', /** Afghan afghani */ AFN = 'AFN', /** Albanian lek */ ALL = 'ALL', /** Armenian dram */ AMD = 'AMD', /** Netherlands Antillean guilder */ ANG = 'ANG', /** Angolan kwanza */ AOA = 'AOA', /** Argentine peso */ ARS = 'ARS', /** Australian dollar */ AUD = 'AUD', /** Aruban florin */ AWG = 'AWG', /** Azerbaijani manat */ AZN = 'AZN', /** Bosnia and Herzegovina convertible mark */ BAM = 'BAM', /** Barbados dollar */ BBD = 'BBD', /** Bangladeshi taka */ BDT = 'BDT', /** Bulgarian lev */ BGN = 'BGN', /** Bahraini dinar */ BHD = 'BHD', /** Burundian franc */ BIF = 'BIF', /** Bermudian dollar */ BMD = 'BMD', /** Brunei dollar */ BND = 'BND', /** Boliviano */ BOB = 'BOB', /** Brazilian real */ BRL = 'BRL', /** Bahamian dollar */ BSD = 'BSD', /** Bhutanese ngultrum */ BTN = 'BTN', /** Botswana pula */ BWP = 'BWP', /** Belarusian ruble */ BYN = 'BYN', /** Belize dollar */ BZD = 'BZD', /** Canadian dollar */ CAD = 'CAD', /** Congolese franc */ CDF = 'CDF', /** Swiss franc */ CHF = 'CHF', /** Chilean peso */ CLP = 'CLP', /** Renminbi (Chinese) yuan */ CNY = 'CNY', /** Colombian peso */ COP = 'COP', /** Costa Rican colon */ CRC = 'CRC', /** Cuban convertible peso */ CUC = 'CUC', /** Cuban peso */ CUP = 'CUP', /** Cape Verde escudo */ CVE = 'CVE', /** Czech koruna */ CZK = 'CZK', /** Djiboutian franc */ DJF = 'DJF', /** Danish krone */ DKK = 'DKK', /** Dominican peso */ DOP = 'DOP', /** Algerian dinar */ DZD = 'DZD', /** Egyptian pound */ EGP = 'EGP', /** Eritrean nakfa */ ERN = 'ERN', /** Ethiopian birr */ ETB = 'ETB', /** Euro */ EUR = 'EUR', /** Fiji dollar */ FJD = 'FJD', /** Falkland Islands pound */ FKP = 'FKP', /** Pound sterling */ GBP = 'GBP', /** Georgian lari */ GEL = 'GEL', /** Ghanaian cedi */ GHS = 'GHS', /** Gibraltar pound */ GIP = 'GIP', /** Gambian dalasi */ GMD = 'GMD', /** Guinean franc */ GNF = 'GNF', /** Guatemalan quetzal */ GTQ = 'GTQ', /** Guyanese dollar */ GYD = 'GYD', /** Hong Kong dollar */ HKD = 'HKD', /** Honduran lempira */ HNL = 'HNL', /** Croatian kuna */ HRK = 'HRK', /** Haitian gourde */ HTG = 'HTG', /** Hungarian forint */ HUF = 'HUF', /** Indonesian rupiah */ IDR = 'IDR', /** Israeli new shekel */ ILS = 'ILS', /** Indian rupee */ INR = 'INR', /** Iraqi dinar */ IQD = 'IQD', /** Iranian rial */ IRR = 'IRR', /** Icelandic króna */ ISK = 'ISK', /** Jamaican dollar */ JMD = 'JMD', /** Jordanian dinar */ JOD = 'JOD', /** Japanese yen */ JPY = 'JPY', /** Kenyan shilling */ KES = 'KES', /** Kyrgyzstani som */ KGS = 'KGS', /** Cambodian riel */ KHR = 'KHR', /** Comoro franc */ KMF = 'KMF', /** North Korean won */ KPW = 'KPW', /** South Korean won */ KRW = 'KRW', /** Kuwaiti dinar */ KWD = 'KWD', /** Cayman Islands dollar */ KYD = 'KYD', /** Kazakhstani tenge */ KZT = 'KZT', /** Lao kip */ LAK = 'LAK', /** Lebanese pound */ LBP = 'LBP', /** Sri Lankan rupee */ LKR = 'LKR', /** Liberian dollar */ LRD = 'LRD', /** Lesotho loti */ LSL = 'LSL', /** Libyan dinar */ LYD = 'LYD', /** Moroccan dirham */ MAD = 'MAD', /** Moldovan leu */ MDL = 'MDL', /** Malagasy ariary */ MGA = 'MGA', /** Macedonian denar */ MKD = 'MKD', /** Myanmar kyat */ MMK = 'MMK', /** Mongolian tögrög */ MNT = 'MNT', /** Macanese pataca */ MOP = 'MOP', /** Mauritanian ouguiya */ MRU = 'MRU', /** Mauritian rupee */ MUR = 'MUR', /** Maldivian rufiyaa */ MVR = 'MVR', /** Malawian kwacha */ MWK = 'MWK', /** Mexican peso */ MXN = 'MXN', /** Malaysian ringgit */ MYR = 'MYR', /** Mozambican metical */ MZN = 'MZN', /** Namibian dollar */ NAD = 'NAD', /** Nigerian naira */ NGN = 'NGN', /** Nicaraguan córdoba */ NIO = 'NIO', /** Norwegian krone */ NOK = 'NOK', /** Nepalese rupee */ NPR = 'NPR', /** New Zealand dollar */ NZD = 'NZD', /** Omani rial */ OMR = 'OMR', /** Panamanian balboa */ PAB = 'PAB', /** Peruvian sol */ PEN = 'PEN', /** Papua New Guinean kina */ PGK = 'PGK', /** Philippine peso */ PHP = 'PHP', /** Pakistani rupee */ PKR = 'PKR', /** Polish złoty */ PLN = 'PLN', /** Paraguayan guaraní */ PYG = 'PYG', /** Qatari riyal */ QAR = 'QAR', /** Romanian leu */ RON = 'RON', /** Serbian dinar */ RSD = 'RSD', /** Russian ruble */ RUB = 'RUB', /** Rwandan franc */ RWF = 'RWF', /** Saudi riyal */ SAR = 'SAR', /** Solomon Islands dollar */ SBD = 'SBD', /** Seychelles rupee */ SCR = 'SCR', /** Sudanese pound */ SDG = 'SDG', /** Swedish krona/kronor */ SEK = 'SEK', /** Singapore dollar */ SGD = 'SGD', /** Saint Helena pound */ SHP = 'SHP', /** Sierra Leonean leone */ SLL = 'SLL', /** Somali shilling */ SOS = 'SOS', /** Surinamese dollar */ SRD = 'SRD', /** South Sudanese pound */ SSP = 'SSP', /** São Tomé and Príncipe dobra */ STN = 'STN', /** Salvadoran colón */ SVC = 'SVC', /** Syrian pound */ SYP = 'SYP', /** Swazi lilangeni */ SZL = 'SZL', /** Thai baht */ THB = 'THB', /** Tajikistani somoni */ TJS = 'TJS', /** Turkmenistan manat */ TMT = 'TMT', /** Tunisian dinar */ TND = 'TND', /** Tongan paʻanga */ TOP = 'TOP', /** Turkish lira */ TRY = 'TRY', /** Trinidad and Tobago dollar */ TTD = 'TTD', /** New Taiwan dollar */ TWD = 'TWD', /** Tanzanian shilling */ TZS = 'TZS', /** Ukrainian hryvnia */ UAH = 'UAH', /** Ugandan shilling */ UGX = 'UGX', /** United States dollar */ USD = 'USD', /** Uruguayan peso */ UYU = 'UYU', /** Uzbekistan som */ UZS = 'UZS', /** Venezuelan bolívar soberano */ VES = 'VES', /** Vietnamese đồng */ VND = 'VND', /** Vanuatu vatu */ VUV = 'VUV', /** Samoan tala */ WST = 'WST', /** CFA franc BEAC */ XAF = 'XAF', /** East Caribbean dollar */ XCD = 'XCD', /** CFA franc BCEAO */ XOF = 'XOF', /** CFP franc (franc Pacifique) */ XPF = 'XPF', /** Yemeni rial */ YER = 'YER', /** South African rand */ ZAR = 'ZAR', /** Zambian kwacha */ ZMW = 'ZMW', /** Zimbabwean dollar */ ZWL = 'ZWL' } export type CurrentUser = { channels: Array<CurrentUserChannel>; id: Scalars['ID']['output']; identifier: Scalars['String']['output']; }; export type CurrentUserChannel = { code: Scalars['String']['output']; id: Scalars['ID']['output']; permissions: Array<Permission>; token: Scalars['String']['output']; }; export type CustomField = { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type CustomFieldConfig = BooleanCustomFieldConfig | DateTimeCustomFieldConfig | FloatCustomFieldConfig | IntCustomFieldConfig | LocaleStringCustomFieldConfig | LocaleTextCustomFieldConfig | RelationCustomFieldConfig | StringCustomFieldConfig | TextCustomFieldConfig; /** * This type is deprecated in v2.2 in favor of the EntityCustomFields type, * which allows custom fields to be defined on user-supplies entities. */ export type CustomFields = { Address: Array<CustomFieldConfig>; Administrator: Array<CustomFieldConfig>; Asset: Array<CustomFieldConfig>; Channel: Array<CustomFieldConfig>; Collection: Array<CustomFieldConfig>; Customer: Array<CustomFieldConfig>; CustomerGroup: Array<CustomFieldConfig>; Facet: Array<CustomFieldConfig>; FacetValue: Array<CustomFieldConfig>; Fulfillment: Array<CustomFieldConfig>; GlobalSettings: Array<CustomFieldConfig>; Order: Array<CustomFieldConfig>; OrderLine: Array<CustomFieldConfig>; PaymentMethod: Array<CustomFieldConfig>; Product: Array<CustomFieldConfig>; ProductOption: Array<CustomFieldConfig>; ProductOptionGroup: Array<CustomFieldConfig>; ProductVariant: Array<CustomFieldConfig>; ProductVariantPrice: Array<CustomFieldConfig>; Promotion: Array<CustomFieldConfig>; Region: Array<CustomFieldConfig>; Seller: Array<CustomFieldConfig>; ShippingMethod: Array<CustomFieldConfig>; StockLocation: Array<CustomFieldConfig>; TaxCategory: Array<CustomFieldConfig>; TaxRate: Array<CustomFieldConfig>; User: Array<CustomFieldConfig>; Zone: Array<CustomFieldConfig>; }; export type Customer = Node & { addresses?: Maybe<Array<Address>>; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; emailAddress: Scalars['String']['output']; firstName: Scalars['String']['output']; groups: Array<CustomerGroup>; history: HistoryEntryList; id: Scalars['ID']['output']; lastName: Scalars['String']['output']; orders: OrderList; phoneNumber?: Maybe<Scalars['String']['output']>; title?: Maybe<Scalars['String']['output']>; updatedAt: Scalars['DateTime']['output']; user?: Maybe<User>; }; export type CustomerHistoryArgs = { options?: InputMaybe<HistoryEntryListOptions>; }; export type CustomerOrdersArgs = { options?: InputMaybe<OrderListOptions>; }; export type CustomerFilterParameter = { _and?: InputMaybe<Array<CustomerFilterParameter>>; _or?: InputMaybe<Array<CustomerFilterParameter>>; createdAt?: InputMaybe<DateOperators>; emailAddress?: InputMaybe<StringOperators>; firstName?: InputMaybe<StringOperators>; id?: InputMaybe<IdOperators>; lastName?: InputMaybe<StringOperators>; phoneNumber?: InputMaybe<StringOperators>; postalCode?: InputMaybe<StringOperators>; title?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type CustomerGroup = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; customers: CustomerList; id: Scalars['ID']['output']; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type CustomerGroupCustomersArgs = { options?: InputMaybe<CustomerListOptions>; }; export type CustomerGroupFilterParameter = { _and?: InputMaybe<Array<CustomerGroupFilterParameter>>; _or?: InputMaybe<Array<CustomerGroupFilterParameter>>; createdAt?: InputMaybe<DateOperators>; id?: InputMaybe<IdOperators>; name?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type CustomerGroupList = PaginatedList & { items: Array<CustomerGroup>; totalItems: Scalars['Int']['output']; }; export type CustomerGroupListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<CustomerGroupFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<CustomerGroupSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type CustomerGroupSortParameter = { createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type CustomerList = PaginatedList & { items: Array<Customer>; totalItems: Scalars['Int']['output']; }; export type CustomerListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<CustomerFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<CustomerSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type CustomerSortParameter = { createdAt?: InputMaybe<SortOrder>; emailAddress?: InputMaybe<SortOrder>; firstName?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; lastName?: InputMaybe<SortOrder>; phoneNumber?: InputMaybe<SortOrder>; title?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; /** Operators for filtering on a list of Date fields */ export type DateListOperators = { inList: Scalars['DateTime']['input']; }; /** Operators for filtering on a DateTime field */ export type DateOperators = { after?: InputMaybe<Scalars['DateTime']['input']>; before?: InputMaybe<Scalars['DateTime']['input']>; between?: InputMaybe<DateRange>; eq?: InputMaybe<Scalars['DateTime']['input']>; isNull?: InputMaybe<Scalars['Boolean']['input']>; }; export type DateRange = { end: Scalars['DateTime']['input']; start: Scalars['DateTime']['input']; }; /** * Expects the same validation formats as the `<input type="datetime-local">` HTML element. * See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local#Additional_attributes */ export type DateTimeCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; max?: Maybe<Scalars['String']['output']>; min?: Maybe<Scalars['String']['output']>; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; step?: Maybe<Scalars['Int']['output']>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type DeleteAssetInput = { assetId: Scalars['ID']['input']; deleteFromAllChannels?: InputMaybe<Scalars['Boolean']['input']>; force?: InputMaybe<Scalars['Boolean']['input']>; }; export type DeleteAssetsInput = { assetIds: Array<Scalars['ID']['input']>; deleteFromAllChannels?: InputMaybe<Scalars['Boolean']['input']>; force?: InputMaybe<Scalars['Boolean']['input']>; }; export type DeleteStockLocationInput = { id: Scalars['ID']['input']; transferToLocationId?: InputMaybe<Scalars['ID']['input']>; }; export type DeletionResponse = { message?: Maybe<Scalars['String']['output']>; result: DeletionResult; }; export enum DeletionResult { /** The entity was successfully deleted */ DELETED = 'DELETED', /** Deletion did not take place, reason given in message */ NOT_DELETED = 'NOT_DELETED' } export type Discount = { adjustmentSource: Scalars['String']['output']; amount: Scalars['Money']['output']; amountWithTax: Scalars['Money']['output']; description: Scalars['String']['output']; type: AdjustmentType; }; export type DuplicateEntityError = ErrorResult & { duplicationError: Scalars['String']['output']; errorCode: ErrorCode; message: Scalars['String']['output']; }; export type DuplicateEntityInput = { duplicatorInput: ConfigurableOperationInput; entityId: Scalars['ID']['input']; entityName: Scalars['String']['input']; }; export type DuplicateEntityResult = DuplicateEntityError | DuplicateEntitySuccess; export type DuplicateEntitySuccess = { newEntityId: Scalars['ID']['output']; }; /** Returned when attempting to create a Customer with an email address already registered to an existing User. */ export type EmailAddressConflictError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned if no OrderLines have been specified for the operation */ export type EmptyOrderLineSelectionError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type EntityCustomFields = { customFields: Array<CustomFieldConfig>; entityName: Scalars['String']['output']; }; export type EntityDuplicatorDefinition = { args: Array<ConfigArgDefinition>; code: Scalars['String']['output']; description: Scalars['String']['output']; forEntities: Array<Scalars['String']['output']>; requiresPermission: Array<Permission>; }; export enum ErrorCode { ALREADY_REFUNDED_ERROR = 'ALREADY_REFUNDED_ERROR', CANCEL_ACTIVE_ORDER_ERROR = 'CANCEL_ACTIVE_ORDER_ERROR', CANCEL_PAYMENT_ERROR = 'CANCEL_PAYMENT_ERROR', CHANNEL_DEFAULT_LANGUAGE_ERROR = 'CHANNEL_DEFAULT_LANGUAGE_ERROR', COUPON_CODE_EXPIRED_ERROR = 'COUPON_CODE_EXPIRED_ERROR', COUPON_CODE_INVALID_ERROR = 'COUPON_CODE_INVALID_ERROR', COUPON_CODE_LIMIT_ERROR = 'COUPON_CODE_LIMIT_ERROR', CREATE_FULFILLMENT_ERROR = 'CREATE_FULFILLMENT_ERROR', DUPLICATE_ENTITY_ERROR = 'DUPLICATE_ENTITY_ERROR', EMAIL_ADDRESS_CONFLICT_ERROR = 'EMAIL_ADDRESS_CONFLICT_ERROR', EMPTY_ORDER_LINE_SELECTION_ERROR = 'EMPTY_ORDER_LINE_SELECTION_ERROR', FACET_IN_USE_ERROR = 'FACET_IN_USE_ERROR', FULFILLMENT_STATE_TRANSITION_ERROR = 'FULFILLMENT_STATE_TRANSITION_ERROR', GUEST_CHECKOUT_ERROR = 'GUEST_CHECKOUT_ERROR', INELIGIBLE_SHIPPING_METHOD_ERROR = 'INELIGIBLE_SHIPPING_METHOD_ERROR', INSUFFICIENT_STOCK_ERROR = 'INSUFFICIENT_STOCK_ERROR', INSUFFICIENT_STOCK_ON_HAND_ERROR = 'INSUFFICIENT_STOCK_ON_HAND_ERROR', INVALID_CREDENTIALS_ERROR = 'INVALID_CREDENTIALS_ERROR', INVALID_FULFILLMENT_HANDLER_ERROR = 'INVALID_FULFILLMENT_HANDLER_ERROR', ITEMS_ALREADY_FULFILLED_ERROR = 'ITEMS_ALREADY_FULFILLED_ERROR', LANGUAGE_NOT_AVAILABLE_ERROR = 'LANGUAGE_NOT_AVAILABLE_ERROR', MANUAL_PAYMENT_STATE_ERROR = 'MANUAL_PAYMENT_STATE_ERROR', MIME_TYPE_ERROR = 'MIME_TYPE_ERROR', MISSING_CONDITIONS_ERROR = 'MISSING_CONDITIONS_ERROR', MULTIPLE_ORDER_ERROR = 'MULTIPLE_ORDER_ERROR', NATIVE_AUTH_STRATEGY_ERROR = 'NATIVE_AUTH_STRATEGY_ERROR', NEGATIVE_QUANTITY_ERROR = 'NEGATIVE_QUANTITY_ERROR', NOTHING_TO_REFUND_ERROR = 'NOTHING_TO_REFUND_ERROR', NO_ACTIVE_ORDER_ERROR = 'NO_ACTIVE_ORDER_ERROR', NO_CHANGES_SPECIFIED_ERROR = 'NO_CHANGES_SPECIFIED_ERROR', ORDER_LIMIT_ERROR = 'ORDER_LIMIT_ERROR', ORDER_MODIFICATION_ERROR = 'ORDER_MODIFICATION_ERROR', ORDER_MODIFICATION_STATE_ERROR = 'ORDER_MODIFICATION_STATE_ERROR', ORDER_STATE_TRANSITION_ERROR = 'ORDER_STATE_TRANSITION_ERROR', PAYMENT_METHOD_MISSING_ERROR = 'PAYMENT_METHOD_MISSING_ERROR', PAYMENT_ORDER_MISMATCH_ERROR = 'PAYMENT_ORDER_MISMATCH_ERROR', PAYMENT_STATE_TRANSITION_ERROR = 'PAYMENT_STATE_TRANSITION_ERROR', PRODUCT_OPTION_IN_USE_ERROR = 'PRODUCT_OPTION_IN_USE_ERROR', QUANTITY_TOO_GREAT_ERROR = 'QUANTITY_TOO_GREAT_ERROR', REFUND_AMOUNT_ERROR = 'REFUND_AMOUNT_ERROR', REFUND_ORDER_STATE_ERROR = 'REFUND_ORDER_STATE_ERROR', REFUND_PAYMENT_ID_MISSING_ERROR = 'REFUND_PAYMENT_ID_MISSING_ERROR', REFUND_STATE_TRANSITION_ERROR = 'REFUND_STATE_TRANSITION_ERROR', SETTLE_PAYMENT_ERROR = 'SETTLE_PAYMENT_ERROR', UNKNOWN_ERROR = 'UNKNOWN_ERROR' } export type ErrorResult = { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type Facet = Node & { code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; isPrivate: Scalars['Boolean']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; translations: Array<FacetTranslation>; updatedAt: Scalars['DateTime']['output']; /** Returns a paginated, sortable, filterable list of the Facet's values. Added in v2.1.0. */ valueList: FacetValueList; values: Array<FacetValue>; }; export type FacetValueListArgs = { options?: InputMaybe<FacetValueListOptions>; }; export type FacetFilterParameter = { _and?: InputMaybe<Array<FacetFilterParameter>>; _or?: InputMaybe<Array<FacetFilterParameter>>; code?: InputMaybe<StringOperators>; createdAt?: InputMaybe<DateOperators>; id?: InputMaybe<IdOperators>; isPrivate?: InputMaybe<BooleanOperators>; languageCode?: InputMaybe<StringOperators>; name?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type FacetInUseError = ErrorResult & { errorCode: ErrorCode; facetCode: Scalars['String']['output']; message: Scalars['String']['output']; productCount: Scalars['Int']['output']; variantCount: Scalars['Int']['output']; }; export type FacetList = PaginatedList & { items: Array<Facet>; totalItems: Scalars['Int']['output']; }; export type FacetListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<FacetFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<FacetSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type FacetSortParameter = { code?: InputMaybe<SortOrder>; createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type FacetTranslation = { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type FacetTranslationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; id?: InputMaybe<Scalars['ID']['input']>; languageCode: LanguageCode; name?: InputMaybe<Scalars['String']['input']>; }; export type FacetValue = Node & { code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; facet: Facet; facetId: Scalars['ID']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; translations: Array<FacetValueTranslation>; updatedAt: Scalars['DateTime']['output']; }; /** * Used to construct boolean expressions for filtering search results * by FacetValue ID. Examples: * * * ID=1 OR ID=2: `{ facetValueFilters: [{ or: [1,2] }] }` * * ID=1 AND ID=2: `{ facetValueFilters: [{ and: 1 }, { and: 2 }] }` * * ID=1 AND (ID=2 OR ID=3): `{ facetValueFilters: [{ and: 1 }, { or: [2,3] }] }` */ export type FacetValueFilterInput = { and?: InputMaybe<Scalars['ID']['input']>; or?: InputMaybe<Array<Scalars['ID']['input']>>; }; export type FacetValueFilterParameter = { _and?: InputMaybe<Array<FacetValueFilterParameter>>; _or?: InputMaybe<Array<FacetValueFilterParameter>>; code?: InputMaybe<StringOperators>; createdAt?: InputMaybe<DateOperators>; facetId?: InputMaybe<IdOperators>; id?: InputMaybe<IdOperators>; languageCode?: InputMaybe<StringOperators>; name?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type FacetValueList = PaginatedList & { items: Array<FacetValue>; totalItems: Scalars['Int']['output']; }; export type FacetValueListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<FacetValueFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<FacetValueSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; /** * Which FacetValues are present in the products returned * by the search, and in what quantity. */ export type FacetValueResult = { count: Scalars['Int']['output']; facetValue: FacetValue; }; export type FacetValueSortParameter = { code?: InputMaybe<SortOrder>; createdAt?: InputMaybe<SortOrder>; facetId?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type FacetValueTranslation = { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type FacetValueTranslationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; id?: InputMaybe<Scalars['ID']['input']>; languageCode: LanguageCode; name?: InputMaybe<Scalars['String']['input']>; }; export type FloatCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; max?: Maybe<Scalars['Float']['output']>; min?: Maybe<Scalars['Float']['output']>; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; step?: Maybe<Scalars['Float']['output']>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type FulfillOrderInput = { handler: ConfigurableOperationInput; lines: Array<OrderLineInput>; }; export type Fulfillment = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; lines: Array<FulfillmentLine>; method: Scalars['String']['output']; nextStates: Array<Scalars['String']['output']>; state: Scalars['String']['output']; /** @deprecated Use the `lines` field instead */ summary: Array<FulfillmentLine>; trackingCode?: Maybe<Scalars['String']['output']>; updatedAt: Scalars['DateTime']['output']; }; export type FulfillmentLine = { fulfillment: Fulfillment; fulfillmentId: Scalars['ID']['output']; orderLine: OrderLine; orderLineId: Scalars['ID']['output']; quantity: Scalars['Int']['output']; }; /** Returned when there is an error in transitioning the Fulfillment state */ export type FulfillmentStateTransitionError = ErrorResult & { errorCode: ErrorCode; fromState: Scalars['String']['output']; message: Scalars['String']['output']; toState: Scalars['String']['output']; transitionError: Scalars['String']['output']; }; export enum GlobalFlag { FALSE = 'FALSE', INHERIT = 'INHERIT', TRUE = 'TRUE' } export type GlobalSettings = { availableLanguages: Array<LanguageCode>; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; outOfStockThreshold: Scalars['Int']['output']; serverConfig: ServerConfig; trackInventory: Scalars['Boolean']['output']; updatedAt: Scalars['DateTime']['output']; }; /** Returned when attempting to set the Customer on a guest checkout when the configured GuestCheckoutStrategy does not allow it. */ export type GuestCheckoutError = ErrorResult & { errorCode: ErrorCode; errorDetail: Scalars['String']['output']; message: Scalars['String']['output']; }; export type HistoryEntry = Node & { administrator?: Maybe<Administrator>; createdAt: Scalars['DateTime']['output']; data: Scalars['JSON']['output']; id: Scalars['ID']['output']; isPublic: Scalars['Boolean']['output']; type: HistoryEntryType; updatedAt: Scalars['DateTime']['output']; }; export type HistoryEntryFilterParameter = { _and?: InputMaybe<Array<HistoryEntryFilterParameter>>; _or?: InputMaybe<Array<HistoryEntryFilterParameter>>; createdAt?: InputMaybe<DateOperators>; id?: InputMaybe<IdOperators>; isPublic?: InputMaybe<BooleanOperators>; type?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type HistoryEntryList = PaginatedList & { items: Array<HistoryEntry>; totalItems: Scalars['Int']['output']; }; export type HistoryEntryListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<HistoryEntryFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<HistoryEntrySortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type HistoryEntrySortParameter = { createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export enum HistoryEntryType { CUSTOMER_ADDED_TO_GROUP = 'CUSTOMER_ADDED_TO_GROUP', CUSTOMER_ADDRESS_CREATED = 'CUSTOMER_ADDRESS_CREATED', CUSTOMER_ADDRESS_DELETED = 'CUSTOMER_ADDRESS_DELETED', CUSTOMER_ADDRESS_UPDATED = 'CUSTOMER_ADDRESS_UPDATED', CUSTOMER_DETAIL_UPDATED = 'CUSTOMER_DETAIL_UPDATED', CUSTOMER_EMAIL_UPDATE_REQUESTED = 'CUSTOMER_EMAIL_UPDATE_REQUESTED', CUSTOMER_EMAIL_UPDATE_VERIFIED = 'CUSTOMER_EMAIL_UPDATE_VERIFIED', CUSTOMER_NOTE = 'CUSTOMER_NOTE', CUSTOMER_PASSWORD_RESET_REQUESTED = 'CUSTOMER_PASSWORD_RESET_REQUESTED', CUSTOMER_PASSWORD_RESET_VERIFIED = 'CUSTOMER_PASSWORD_RESET_VERIFIED', CUSTOMER_PASSWORD_UPDATED = 'CUSTOMER_PASSWORD_UPDATED', CUSTOMER_REGISTERED = 'CUSTOMER_REGISTERED', CUSTOMER_REMOVED_FROM_GROUP = 'CUSTOMER_REMOVED_FROM_GROUP', CUSTOMER_VERIFIED = 'CUSTOMER_VERIFIED', ORDER_CANCELLATION = 'ORDER_CANCELLATION', ORDER_COUPON_APPLIED = 'ORDER_COUPON_APPLIED', ORDER_COUPON_REMOVED = 'ORDER_COUPON_REMOVED', ORDER_CUSTOMER_UPDATED = 'ORDER_CUSTOMER_UPDATED', ORDER_FULFILLMENT = 'ORDER_FULFILLMENT', ORDER_FULFILLMENT_TRANSITION = 'ORDER_FULFILLMENT_TRANSITION', ORDER_MODIFIED = 'ORDER_MODIFIED', ORDER_NOTE = 'ORDER_NOTE', ORDER_PAYMENT_TRANSITION = 'ORDER_PAYMENT_TRANSITION', ORDER_REFUND_TRANSITION = 'ORDER_REFUND_TRANSITION', ORDER_STATE_TRANSITION = 'ORDER_STATE_TRANSITION' } /** Operators for filtering on a list of ID fields */ export type IdListOperators = { inList: Scalars['ID']['input']; }; /** Operators for filtering on an ID field */ export type IdOperators = { eq?: InputMaybe<Scalars['String']['input']>; in?: InputMaybe<Array<Scalars['String']['input']>>; isNull?: InputMaybe<Scalars['Boolean']['input']>; notEq?: InputMaybe<Scalars['String']['input']>; notIn?: InputMaybe<Array<Scalars['String']['input']>>; }; export type ImportInfo = { errors?: Maybe<Array<Scalars['String']['output']>>; imported: Scalars['Int']['output']; processed: Scalars['Int']['output']; }; /** Returned when attempting to set a ShippingMethod for which the Order is not eligible */ export type IneligibleShippingMethodError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned when attempting to add more items to the Order than are available */ export type InsufficientStockError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; order: Order; quantityAvailable: Scalars['Int']['output']; }; /** * Returned if attempting to create a Fulfillment when there is insufficient * stockOnHand of a ProductVariant to satisfy the requested quantity. */ export type InsufficientStockOnHandError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; productVariantId: Scalars['ID']['output']; productVariantName: Scalars['String']['output']; stockOnHand: Scalars['Int']['output']; }; export type IntCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; max?: Maybe<Scalars['Int']['output']>; min?: Maybe<Scalars['Int']['output']>; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; step?: Maybe<Scalars['Int']['output']>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; /** Returned if the user authentication credentials are not valid */ export type InvalidCredentialsError = ErrorResult & { authenticationError: Scalars['String']['output']; errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned if the specified FulfillmentHandler code is not valid */ export type InvalidFulfillmentHandlerError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned if the specified items are already part of a Fulfillment */ export type ItemsAlreadyFulfilledError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type Job = Node & { attempts: Scalars['Int']['output']; createdAt: Scalars['DateTime']['output']; data?: Maybe<Scalars['JSON']['output']>; duration: Scalars['Int']['output']; error?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; isSettled: Scalars['Boolean']['output']; progress: Scalars['Float']['output']; queueName: Scalars['String']['output']; result?: Maybe<Scalars['JSON']['output']>; retries: Scalars['Int']['output']; settledAt?: Maybe<Scalars['DateTime']['output']>; startedAt?: Maybe<Scalars['DateTime']['output']>; state: JobState; }; export type JobBufferSize = { bufferId: Scalars['String']['output']; size: Scalars['Int']['output']; }; export type JobFilterParameter = { _and?: InputMaybe<Array<JobFilterParameter>>; _or?: InputMaybe<Array<JobFilterParameter>>; attempts?: InputMaybe<NumberOperators>; createdAt?: InputMaybe<DateOperators>; duration?: InputMaybe<NumberOperators>; id?: InputMaybe<IdOperators>; isSettled?: InputMaybe<BooleanOperators>; progress?: InputMaybe<NumberOperators>; queueName?: InputMaybe<StringOperators>; retries?: InputMaybe<NumberOperators>; settledAt?: InputMaybe<DateOperators>; startedAt?: InputMaybe<DateOperators>; state?: InputMaybe<StringOperators>; }; export type JobList = PaginatedList & { items: Array<Job>; totalItems: Scalars['Int']['output']; }; export type JobListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<JobFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<JobSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type JobQueue = { name: Scalars['String']['output']; running: Scalars['Boolean']['output']; }; export type JobSortParameter = { attempts?: InputMaybe<SortOrder>; createdAt?: InputMaybe<SortOrder>; duration?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; progress?: InputMaybe<SortOrder>; queueName?: InputMaybe<SortOrder>; retries?: InputMaybe<SortOrder>; settledAt?: InputMaybe<SortOrder>; startedAt?: InputMaybe<SortOrder>; }; /** * @description * The state of a Job in the JobQueue * * @docsCategory common */ export enum JobState { CANCELLED = 'CANCELLED', COMPLETED = 'COMPLETED', FAILED = 'FAILED', PENDING = 'PENDING', RETRYING = 'RETRYING', RUNNING = 'RUNNING' } /** * @description * Languages in the form of a ISO 639-1 language code with optional * region or script modifier (e.g. de_AT). The selection available is based * on the [Unicode CLDR summary list](https://unicode-org.github.io/cldr-staging/charts/37/summary/root.html) * and includes the major spoken languages of the world and any widely-used variants. * * @docsCategory common */ export enum LanguageCode { /** Afrikaans */ af = 'af', /** Akan */ ak = 'ak', /** Amharic */ am = 'am', /** Arabic */ ar = 'ar', /** Assamese */ as = 'as', /** Azerbaijani */ az = 'az', /** Belarusian */ be = 'be', /** Bulgarian */ bg = 'bg', /** Bambara */ bm = 'bm', /** Bangla */ bn = 'bn', /** Tibetan */ bo = 'bo', /** Breton */ br = 'br', /** Bosnian */ bs = 'bs', /** Catalan */ ca = 'ca', /** Chechen */ ce = 'ce', /** Corsican */ co = 'co', /** Czech */ cs = 'cs', /** Church Slavic */ cu = 'cu', /** Welsh */ cy = 'cy', /** Danish */ da = 'da', /** German */ de = 'de', /** Austrian German */ de_AT = 'de_AT', /** Swiss High German */ de_CH = 'de_CH', /** Dzongkha */ dz = 'dz', /** Ewe */ ee = 'ee', /** Greek */ el = 'el', /** English */ en = 'en', /** Australian English */ en_AU = 'en_AU', /** Canadian English */ en_CA = 'en_CA', /** British English */ en_GB = 'en_GB', /** American English */ en_US = 'en_US', /** Esperanto */ eo = 'eo', /** Spanish */ es = 'es', /** European Spanish */ es_ES = 'es_ES', /** Mexican Spanish */ es_MX = 'es_MX', /** Estonian */ et = 'et', /** Basque */ eu = 'eu', /** Persian */ fa = 'fa', /** Dari */ fa_AF = 'fa_AF', /** Fulah */ ff = 'ff', /** Finnish */ fi = 'fi', /** Faroese */ fo = 'fo', /** French */ fr = 'fr', /** Canadian French */ fr_CA = 'fr_CA', /** Swiss French */ fr_CH = 'fr_CH', /** Western Frisian */ fy = 'fy', /** Irish */ ga = 'ga', /** Scottish Gaelic */ gd = 'gd', /** Galician */ gl = 'gl', /** Gujarati */ gu = 'gu', /** Manx */ gv = 'gv', /** Hausa */ ha = 'ha', /** Hebrew */ he = 'he', /** Hindi */ hi = 'hi', /** Croatian */ hr = 'hr', /** Haitian Creole */ ht = 'ht', /** Hungarian */ hu = 'hu', /** Armenian */ hy = 'hy', /** Interlingua */ ia = 'ia', /** Indonesian */ id = 'id', /** Igbo */ ig = 'ig', /** Sichuan Yi */ ii = 'ii', /** Icelandic */ is = 'is', /** Italian */ it = 'it', /** Japanese */ ja = 'ja', /** Javanese */ jv = 'jv', /** Georgian */ ka = 'ka', /** Kikuyu */ ki = 'ki', /** Kazakh */ kk = 'kk', /** Kalaallisut */ kl = 'kl', /** Khmer */ km = 'km', /** Kannada */ kn = 'kn', /** Korean */ ko = 'ko', /** Kashmiri */ ks = 'ks', /** Kurdish */ ku = 'ku', /** Cornish */ kw = 'kw', /** Kyrgyz */ ky = 'ky', /** Latin */ la = 'la', /** Luxembourgish */ lb = 'lb', /** Ganda */ lg = 'lg', /** Lingala */ ln = 'ln', /** Lao */ lo = 'lo', /** Lithuanian */ lt = 'lt', /** Luba-Katanga */ lu = 'lu', /** Latvian */ lv = 'lv', /** Malagasy */ mg = 'mg', /** Maori */ mi = 'mi', /** Macedonian */ mk = 'mk', /** Malayalam */ ml = 'ml', /** Mongolian */ mn = 'mn', /** Marathi */ mr = 'mr', /** Malay */ ms = 'ms', /** Maltese */ mt = 'mt', /** Burmese */ my = 'my', /** Norwegian Bokmål */ nb = 'nb', /** North Ndebele */ nd = 'nd', /** Nepali */ ne = 'ne', /** Dutch */ nl = 'nl', /** Flemish */ nl_BE = 'nl_BE', /** Norwegian Nynorsk */ nn = 'nn', /** Nyanja */ ny = 'ny', /** Oromo */ om = 'om', /** Odia */ or = 'or', /** Ossetic */ os = 'os', /** Punjabi */ pa = 'pa', /** Polish */ pl = 'pl', /** Pashto */ ps = 'ps', /** Portuguese */ pt = 'pt', /** Brazilian Portuguese */ pt_BR = 'pt_BR', /** European Portuguese */ pt_PT = 'pt_PT', /** Quechua */ qu = 'qu', /** Romansh */ rm = 'rm', /** Rundi */ rn = 'rn', /** Romanian */ ro = 'ro', /** Moldavian */ ro_MD = 'ro_MD', /** Russian */ ru = 'ru', /** Kinyarwanda */ rw = 'rw', /** Sanskrit */ sa = 'sa', /** Sindhi */ sd = 'sd', /** Northern Sami */ se = 'se', /** Sango */ sg = 'sg', /** Sinhala */ si = 'si', /** Slovak */ sk = 'sk', /** Slovenian */ sl = 'sl', /** Samoan */ sm = 'sm', /** Shona */ sn = 'sn', /** Somali */ so = 'so', /** Albanian */ sq = 'sq', /** Serbian */ sr = 'sr', /** Southern Sotho */ st = 'st', /** Sundanese */ su = 'su', /** Swedish */ sv = 'sv', /** Swahili */ sw = 'sw', /** Congo Swahili */ sw_CD = 'sw_CD', /** Tamil */ ta = 'ta', /** Telugu */ te = 'te', /** Tajik */ tg = 'tg', /** Thai */ th = 'th', /** Tigrinya */ ti = 'ti', /** Turkmen */ tk = 'tk', /** Tongan */ to = 'to', /** Turkish */ tr = 'tr', /** Tatar */ tt = 'tt', /** Uyghur */ ug = 'ug', /** Ukrainian */ uk = 'uk', /** Urdu */ ur = 'ur', /** Uzbek */ uz = 'uz', /** Vietnamese */ vi = 'vi', /** Volapük */ vo = 'vo', /** Wolof */ wo = 'wo', /** Xhosa */ xh = 'xh', /** Yiddish */ yi = 'yi', /** Yoruba */ yo = 'yo', /** Chinese */ zh = 'zh', /** Simplified Chinese */ zh_Hans = 'zh_Hans', /** Traditional Chinese */ zh_Hant = 'zh_Hant', /** Zulu */ zu = 'zu' } /** Returned if attempting to set a Channel's defaultLanguageCode to a language which is not enabled in GlobalSettings */ export type LanguageNotAvailableError = ErrorResult & { errorCode: ErrorCode; languageCode: Scalars['String']['output']; message: Scalars['String']['output']; }; export type LocaleStringCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; length?: Maybe<Scalars['Int']['output']>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; pattern?: Maybe<Scalars['String']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type LocaleTextCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type LocalizedString = { languageCode: LanguageCode; value: Scalars['String']['output']; }; export enum LogicalOperator { AND = 'AND', OR = 'OR' } export type ManualPaymentInput = { metadata?: InputMaybe<Scalars['JSON']['input']>; method: Scalars['String']['input']; orderId: Scalars['ID']['input']; transactionId?: InputMaybe<Scalars['String']['input']>; }; /** * Returned when a call to addManualPaymentToOrder is made but the Order * is not in the required state. */ export type ManualPaymentStateError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export enum MetricInterval { Daily = 'Daily' } export type MetricSummary = { entries: Array<MetricSummaryEntry>; interval: MetricInterval; title: Scalars['String']['output']; type: MetricType; }; export type MetricSummaryEntry = { label: Scalars['String']['output']; value: Scalars['Float']['output']; }; export type MetricSummaryInput = { interval: MetricInterval; refresh?: InputMaybe<Scalars['Boolean']['input']>; types: Array<MetricType>; }; export enum MetricType { AverageOrderValue = 'AverageOrderValue', OrderCount = 'OrderCount', OrderTotal = 'OrderTotal' } export type MimeTypeError = ErrorResult & { errorCode: ErrorCode; fileName: Scalars['String']['output']; message: Scalars['String']['output']; mimeType: Scalars['String']['output']; }; /** Returned if a PromotionCondition has neither a couponCode nor any conditions set */ export type MissingConditionsError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type ModifyOrderInput = { addItems?: InputMaybe<Array<AddItemInput>>; adjustOrderLines?: InputMaybe<Array<OrderLineInput>>; couponCodes?: InputMaybe<Array<Scalars['String']['input']>>; dryRun: Scalars['Boolean']['input']; note?: InputMaybe<Scalars['String']['input']>; options?: InputMaybe<ModifyOrderOptions>; orderId: Scalars['ID']['input']; /** * Deprecated in v2.2.0. Use `refunds` instead to allow multiple refunds to be * applied in the case that multiple payment methods have been used on the order. */ refund?: InputMaybe<AdministratorRefundInput>; refunds?: InputMaybe<Array<AdministratorRefundInput>>; /** Added in v2.2 */ shippingMethodIds?: InputMaybe<Array<Scalars['ID']['input']>>; surcharges?: InputMaybe<Array<SurchargeInput>>; updateBillingAddress?: InputMaybe<UpdateOrderAddressInput>; updateShippingAddress?: InputMaybe<UpdateOrderAddressInput>; }; export type ModifyOrderOptions = { freezePromotions?: InputMaybe<Scalars['Boolean']['input']>; recalculateShipping?: InputMaybe<Scalars['Boolean']['input']>; }; export type ModifyOrderResult = CouponCodeExpiredError | CouponCodeInvalidError | CouponCodeLimitError | IneligibleShippingMethodError | InsufficientStockError | NegativeQuantityError | NoChangesSpecifiedError | Order | OrderLimitError | OrderModificationStateError | PaymentMethodMissingError | RefundPaymentIdMissingError; export type MoveCollectionInput = { collectionId: Scalars['ID']['input']; index: Scalars['Int']['input']; parentId: Scalars['ID']['input']; }; /** Returned if an operation has specified OrderLines from multiple Orders */ export type MultipleOrderError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type Mutation = { /** Add Customers to a CustomerGroup */ addCustomersToGroup: CustomerGroup; addFulfillmentToOrder: AddFulfillmentToOrderResult; /** Adds an item to the draft Order. */ addItemToDraftOrder: UpdateOrderItemsResult; /** * Used to manually create a new Payment against an Order. * This can be used by an Administrator when an Order is in the ArrangingPayment state. * * It is also used when a completed Order * has been modified (using `modifyOrder`) and the price has increased. The extra payment * can then be manually arranged by the administrator, and the details used to create a new * Payment. */ addManualPaymentToOrder: AddManualPaymentToOrderResult; /** Add members to a Zone */ addMembersToZone: Zone; addNoteToCustomer: Customer; addNoteToOrder: Order; /** Add an OptionGroup to a Product */ addOptionGroupToProduct: Product; /** Adjusts a draft OrderLine. If custom fields are defined on the OrderLine entity, a third argument 'customFields' of type `OrderLineCustomFieldsInput` will be available. */ adjustDraftOrderLine: UpdateOrderItemsResult; /** Applies the given coupon code to the draft Order */ applyCouponCodeToDraftOrder: ApplyCouponCodeResult; /** Assign assets to channel */ assignAssetsToChannel: Array<Asset>; /** Assigns Collections to the specified Channel */ assignCollectionsToChannel: Array<Collection>; /** Assigns Facets to the specified Channel */ assignFacetsToChannel: Array<Facet>; /** Assigns PaymentMethods to the specified Channel */ assignPaymentMethodsToChannel: Array<PaymentMethod>; /** Assigns ProductVariants to the specified Channel */ assignProductVariantsToChannel: Array<ProductVariant>; /** Assigns all ProductVariants of Product to the specified Channel */ assignProductsToChannel: Array<Product>; /** Assigns Promotions to the specified Channel */ assignPromotionsToChannel: Array<Promotion>; /** Assign a Role to an Administrator */ assignRoleToAdministrator: Administrator; /** Assigns ShippingMethods to the specified Channel */ assignShippingMethodsToChannel: Array<ShippingMethod>; /** Assigns StockLocations to the specified Channel */ assignStockLocationsToChannel: Array<StockLocation>; /** Authenticates the user using a named authentication strategy */ authenticate: AuthenticationResult; cancelJob: Job; cancelOrder: CancelOrderResult; cancelPayment: CancelPaymentResult; /** Create a new Administrator */ createAdministrator: Administrator; /** Create a new Asset */ createAssets: Array<CreateAssetResult>; /** Create a new Channel */ createChannel: CreateChannelResult; /** Create a new Collection */ createCollection: Collection; /** Create a new Country */ createCountry: Country; /** Create a new Customer. If a password is provided, a new User will also be created an linked to the Customer. */ createCustomer: CreateCustomerResult; /** Create a new Address and associate it with the Customer specified by customerId */ createCustomerAddress: Address; /** Create a new CustomerGroup */ createCustomerGroup: CustomerGroup; /** Creates a draft Order */ createDraftOrder: Order; /** Create a new Facet */ createFacet: Facet; /** Create one or more FacetValues */ createFacetValues: Array<FacetValue>; /** Create existing PaymentMethod */ createPaymentMethod: PaymentMethod; /** Create a new Product */ createProduct: Product; /** Create a new ProductOption within a ProductOptionGroup */ createProductOption: ProductOption; /** Create a new ProductOptionGroup */ createProductOptionGroup: ProductOptionGroup; /** Create a set of ProductVariants based on the OptionGroups assigned to the given Product */ createProductVariants: Array<Maybe<ProductVariant>>; createPromotion: CreatePromotionResult; /** Create a new Province */ createProvince: Province; /** Create a new Role */ createRole: Role; /** Create a new Seller */ createSeller: Seller; /** Create a new ShippingMethod */ createShippingMethod: ShippingMethod; createStockLocation: StockLocation; /** Create a new Tag */ createTag: Tag; /** Create a new TaxCategory */ createTaxCategory: TaxCategory; /** Create a new TaxRate */ createTaxRate: TaxRate; /** Create a new Zone */ createZone: Zone; /** Delete an Administrator */ deleteAdministrator: DeletionResponse; /** Delete multiple Administrators */ deleteAdministrators: Array<DeletionResponse>; /** Delete an Asset */ deleteAsset: DeletionResponse; /** Delete multiple Assets */ deleteAssets: DeletionResponse; /** Delete a Channel */ deleteChannel: DeletionResponse; /** Delete multiple Channels */ deleteChannels: Array<DeletionResponse>; /** Delete a Collection and all of its descendants */ deleteCollection: DeletionResponse; /** Delete multiple Collections and all of their descendants */ deleteCollections: Array<DeletionResponse>; /** Delete multiple Countries */ deleteCountries: Array<DeletionResponse>; /** Delete a Country */ deleteCountry: DeletionResponse; /** Delete a Customer */ deleteCustomer: DeletionResponse; /** Update an existing Address */ deleteCustomerAddress: Success; /** Delete a CustomerGroup */ deleteCustomerGroup: DeletionResponse; /** Delete multiple CustomerGroups */ deleteCustomerGroups: Array<DeletionResponse>; deleteCustomerNote: DeletionResponse; /** Deletes Customers */ deleteCustomers: Array<DeletionResponse>; /** Deletes a draft Order */ deleteDraftOrder: DeletionResponse; /** Delete an existing Facet */ deleteFacet: DeletionResponse; /** Delete one or more FacetValues */ deleteFacetValues: Array<DeletionResponse>; /** Delete multiple existing Facets */ deleteFacets: Array<DeletionResponse>; deleteOrderNote: DeletionResponse; /** Delete a PaymentMethod */ deletePaymentMethod: DeletionResponse; /** Delete multiple PaymentMethods */ deletePaymentMethods: Array<DeletionResponse>; /** Delete a Product */ deleteProduct: DeletionResponse; /** Delete a ProductOption */ deleteProductOption: DeletionResponse; /** Delete a ProductVariant */ deleteProductVariant: DeletionResponse; /** Delete multiple ProductVariants */ deleteProductVariants: Array<DeletionResponse>; /** Delete multiple Products */ deleteProducts: Array<DeletionResponse>; deletePromotion: DeletionResponse; deletePromotions: Array<DeletionResponse>; /** Delete a Province */ deleteProvince: DeletionResponse; /** Delete an existing Role */ deleteRole: DeletionResponse; /** Delete multiple Roles */ deleteRoles: Array<DeletionResponse>; /** Delete a Seller */ deleteSeller: DeletionResponse; /** Delete multiple Sellers */ deleteSellers: Array<DeletionResponse>; /** Delete a ShippingMethod */ deleteShippingMethod: DeletionResponse; /** Delete multiple ShippingMethods */ deleteShippingMethods: Array<DeletionResponse>; deleteStockLocation: DeletionResponse; deleteStockLocations: Array<DeletionResponse>; /** Delete an existing Tag */ deleteTag: DeletionResponse; /** Deletes multiple TaxCategories */ deleteTaxCategories: Array<DeletionResponse>; /** Deletes a TaxCategory */ deleteTaxCategory: DeletionResponse; /** Delete a TaxRate */ deleteTaxRate: DeletionResponse; /** Delete multiple TaxRates */ deleteTaxRates: Array<DeletionResponse>; /** Delete a Zone */ deleteZone: DeletionResponse; /** Delete a Zone */ deleteZones: Array<DeletionResponse>; duplicateEntity: DuplicateEntityResult; flushBufferedJobs: Success; importProducts?: Maybe<ImportInfo>; /** Authenticates the user using the native authentication strategy. This mutation is an alias for `authenticate({ native: { ... }})` */ login: NativeAuthenticationResult; logout: Success; /** * Allows an Order to be modified after it has been completed by the Customer. The Order must first * be in the `Modifying` state. */ modifyOrder: ModifyOrderResult; /** Move a Collection to a different parent or index */ moveCollection: Collection; refundOrder: RefundOrderResult; reindex: Job; /** Removes Collections from the specified Channel */ removeCollectionsFromChannel: Array<Collection>; /** Removes the given coupon code from the draft Order */ removeCouponCodeFromDraftOrder?: Maybe<Order>; /** Remove Customers from a CustomerGroup */ removeCustomersFromGroup: CustomerGroup; /** Remove an OrderLine from the draft Order */ removeDraftOrderLine: RemoveOrderItemsResult; /** Removes Facets from the specified Channel */ removeFacetsFromChannel: Array<RemoveFacetFromChannelResult>; /** Remove members from a Zone */ removeMembersFromZone: Zone; /** * Remove an OptionGroup from a Product. If the OptionGroup is in use by any ProductVariants * the mutation will return a ProductOptionInUseError, and the OptionGroup will not be removed. * Setting the `force` argument to `true` will override this and remove the OptionGroup anyway, * as well as removing any of the group's options from the Product's ProductVariants. */ removeOptionGroupFromProduct: RemoveOptionGroupFromProductResult; /** Removes PaymentMethods from the specified Channel */ removePaymentMethodsFromChannel: Array<PaymentMethod>; /** Removes ProductVariants from the specified Channel */ removeProductVariantsFromChannel: Array<ProductVariant>; /** Removes all ProductVariants of Product from the specified Channel */ removeProductsFromChannel: Array<Product>; /** Removes Promotions from the specified Channel */ removePromotionsFromChannel: Array<Promotion>; /** Remove all settled jobs in the given queues older than the given date. Returns the number of jobs deleted. */ removeSettledJobs: Scalars['Int']['output']; /** Removes ShippingMethods from the specified Channel */ removeShippingMethodsFromChannel: Array<ShippingMethod>; /** Removes StockLocations from the specified Channel */ removeStockLocationsFromChannel: Array<StockLocation>; runPendingSearchIndexUpdates: Success; setCustomerForDraftOrder: SetCustomerForDraftOrderResult; /** Sets the billing address for a draft Order */ setDraftOrderBillingAddress: Order; /** Allows any custom fields to be set for the active order */ setDraftOrderCustomFields: Order; /** Sets the shipping address for a draft Order */ setDraftOrderShippingAddress: Order; /** Sets the shipping method by id, which can be obtained with the `eligibleShippingMethodsForDraftOrder` query */ setDraftOrderShippingMethod: SetOrderShippingMethodResult; setOrderCustomFields?: Maybe<Order>; /** Allows a different Customer to be assigned to an Order. Added in v2.2.0. */ setOrderCustomer?: Maybe<Order>; settlePayment: SettlePaymentResult; settleRefund: SettleRefundResult; transitionFulfillmentToState: TransitionFulfillmentToStateResult; transitionOrderToState?: Maybe<TransitionOrderToStateResult>; transitionPaymentToState: TransitionPaymentToStateResult; /** Update the active (currently logged-in) Administrator */ updateActiveAdministrator: Administrator; /** Update an existing Administrator */ updateAdministrator: Administrator; /** Update an existing Asset */ updateAsset: Asset; /** Update an existing Channel */ updateChannel: UpdateChannelResult; /** Update an existing Collection */ updateCollection: Collection; /** Update an existing Country */ updateCountry: Country; /** Update an existing Customer */ updateCustomer: UpdateCustomerResult; /** Update an existing Address */ updateCustomerAddress: Address; /** Update an existing CustomerGroup */ updateCustomerGroup: CustomerGroup; updateCustomerNote: HistoryEntry; /** Update an existing Facet */ updateFacet: Facet; /** Update one or more FacetValues */ updateFacetValues: Array<FacetValue>; updateGlobalSettings: UpdateGlobalSettingsResult; updateOrderNote: HistoryEntry; /** Update an existing PaymentMethod */ updatePaymentMethod: PaymentMethod; /** Update an existing Product */ updateProduct: Product; /** Create a new ProductOption within a ProductOptionGroup */ updateProductOption: ProductOption; /** Update an existing ProductOptionGroup */ updateProductOptionGroup: ProductOptionGroup; /** Update existing ProductVariants */ updateProductVariants: Array<Maybe<ProductVariant>>; /** Update multiple existing Products */ updateProducts: Array<Product>; updatePromotion: UpdatePromotionResult; /** Update an existing Province */ updateProvince: Province; /** Update an existing Role */ updateRole: Role; /** Update an existing Seller */ updateSeller: Seller; /** Update an existing ShippingMethod */ updateShippingMethod: ShippingMethod; updateStockLocation: StockLocation; /** Update an existing Tag */ updateTag: Tag; /** Update an existing TaxCategory */ updateTaxCategory: TaxCategory; /** Update an existing TaxRate */ updateTaxRate: TaxRate; /** Update an existing Zone */ updateZone: Zone; }; export type MutationAddCustomersToGroupArgs = { customerGroupId: Scalars['ID']['input']; customerIds: Array<Scalars['ID']['input']>; }; export type MutationAddFulfillmentToOrderArgs = { input: FulfillOrderInput; }; export type MutationAddItemToDraftOrderArgs = { input: AddItemToDraftOrderInput; orderId: Scalars['ID']['input']; }; export type MutationAddManualPaymentToOrderArgs = { input: ManualPaymentInput; }; export type MutationAddMembersToZoneArgs = { memberIds: Array<Scalars['ID']['input']>; zoneId: Scalars['ID']['input']; }; export type MutationAddNoteToCustomerArgs = { input: AddNoteToCustomerInput; }; export type MutationAddNoteToOrderArgs = { input: AddNoteToOrderInput; }; export type MutationAddOptionGroupToProductArgs = { optionGroupId: Scalars['ID']['input']; productId: Scalars['ID']['input']; }; export type MutationAdjustDraftOrderLineArgs = { input: AdjustDraftOrderLineInput; orderId: Scalars['ID']['input']; }; export type MutationApplyCouponCodeToDraftOrderArgs = { couponCode: Scalars['String']['input']; orderId: Scalars['ID']['input']; }; export type MutationAssignAssetsToChannelArgs = { input: AssignAssetsToChannelInput; }; export type MutationAssignCollectionsToChannelArgs = { input: AssignCollectionsToChannelInput; }; export type MutationAssignFacetsToChannelArgs = { input: AssignFacetsToChannelInput; }; export type MutationAssignPaymentMethodsToChannelArgs = { input: AssignPaymentMethodsToChannelInput; }; export type MutationAssignProductVariantsToChannelArgs = { input: AssignProductVariantsToChannelInput; }; export type MutationAssignProductsToChannelArgs = { input: AssignProductsToChannelInput; }; export type MutationAssignPromotionsToChannelArgs = { input: AssignPromotionsToChannelInput; }; export type MutationAssignRoleToAdministratorArgs = { administratorId: Scalars['ID']['input']; roleId: Scalars['ID']['input']; }; export type MutationAssignShippingMethodsToChannelArgs = { input: AssignShippingMethodsToChannelInput; }; export type MutationAssignStockLocationsToChannelArgs = { input: AssignStockLocationsToChannelInput; }; export type MutationAuthenticateArgs = { input: AuthenticationInput; rememberMe?: InputMaybe<Scalars['Boolean']['input']>; }; export type MutationCancelJobArgs = { jobId: Scalars['ID']['input']; }; export type MutationCancelOrderArgs = { input: CancelOrderInput; }; export type MutationCancelPaymentArgs = { id: Scalars['ID']['input']; }; export type MutationCreateAdministratorArgs = { input: CreateAdministratorInput; }; export type MutationCreateAssetsArgs = { input: Array<CreateAssetInput>; }; export type MutationCreateChannelArgs = { input: CreateChannelInput; }; export type MutationCreateCollectionArgs = { input: CreateCollectionInput; }; export type MutationCreateCountryArgs = { input: CreateCountryInput; }; export type MutationCreateCustomerArgs = { input: CreateCustomerInput; password?: InputMaybe<Scalars['String']['input']>; }; export type MutationCreateCustomerAddressArgs = { customerId: Scalars['ID']['input']; input: CreateAddressInput; }; export type MutationCreateCustomerGroupArgs = { input: CreateCustomerGroupInput; }; export type MutationCreateFacetArgs = { input: CreateFacetInput; }; export type MutationCreateFacetValuesArgs = { input: Array<CreateFacetValueInput>; }; export type MutationCreatePaymentMethodArgs = { input: CreatePaymentMethodInput; }; export type MutationCreateProductArgs = { input: CreateProductInput; }; export type MutationCreateProductOptionArgs = { input: CreateProductOptionInput; }; export type MutationCreateProductOptionGroupArgs = { input: CreateProductOptionGroupInput; }; export type MutationCreateProductVariantsArgs = { input: Array<CreateProductVariantInput>; }; export type MutationCreatePromotionArgs = { input: CreatePromotionInput; }; export type MutationCreateProvinceArgs = { input: CreateProvinceInput; }; export type MutationCreateRoleArgs = { input: CreateRoleInput; }; export type MutationCreateSellerArgs = { input: CreateSellerInput; }; export type MutationCreateShippingMethodArgs = { input: CreateShippingMethodInput; }; export type MutationCreateStockLocationArgs = { input: CreateStockLocationInput; }; export type MutationCreateTagArgs = { input: CreateTagInput; }; export type MutationCreateTaxCategoryArgs = { input: CreateTaxCategoryInput; }; export type MutationCreateTaxRateArgs = { input: CreateTaxRateInput; }; export type MutationCreateZoneArgs = { input: CreateZoneInput; }; export type MutationDeleteAdministratorArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteAdministratorsArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteAssetArgs = { input: DeleteAssetInput; }; export type MutationDeleteAssetsArgs = { input: DeleteAssetsInput; }; export type MutationDeleteChannelArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteChannelsArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteCollectionArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteCollectionsArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteCountriesArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteCountryArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteCustomerArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteCustomerAddressArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteCustomerGroupArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteCustomerGroupsArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteCustomerNoteArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteCustomersArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteDraftOrderArgs = { orderId: Scalars['ID']['input']; }; export type MutationDeleteFacetArgs = { force?: InputMaybe<Scalars['Boolean']['input']>; id: Scalars['ID']['input']; }; export type MutationDeleteFacetValuesArgs = { force?: InputMaybe<Scalars['Boolean']['input']>; ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteFacetsArgs = { force?: InputMaybe<Scalars['Boolean']['input']>; ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteOrderNoteArgs = { id: Scalars['ID']['input']; }; export type MutationDeletePaymentMethodArgs = { force?: InputMaybe<Scalars['Boolean']['input']>; id: Scalars['ID']['input']; }; export type MutationDeletePaymentMethodsArgs = { force?: InputMaybe<Scalars['Boolean']['input']>; ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteProductArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteProductOptionArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteProductVariantArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteProductVariantsArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteProductsArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDeletePromotionArgs = { id: Scalars['ID']['input']; }; export type MutationDeletePromotionsArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteProvinceArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteRoleArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteRolesArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteSellerArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteSellersArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteShippingMethodArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteShippingMethodsArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteStockLocationArgs = { input: DeleteStockLocationInput; }; export type MutationDeleteStockLocationsArgs = { input: Array<DeleteStockLocationInput>; }; export type MutationDeleteTagArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteTaxCategoriesArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteTaxCategoryArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteTaxRateArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteTaxRatesArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDeleteZoneArgs = { id: Scalars['ID']['input']; }; export type MutationDeleteZonesArgs = { ids: Array<Scalars['ID']['input']>; }; export type MutationDuplicateEntityArgs = { input: DuplicateEntityInput; }; export type MutationFlushBufferedJobsArgs = { bufferIds?: InputMaybe<Array<Scalars['String']['input']>>; }; export type MutationImportProductsArgs = { csvFile: Scalars['Upload']['input']; }; export type MutationLoginArgs = { password: Scalars['String']['input']; rememberMe?: InputMaybe<Scalars['Boolean']['input']>; username: Scalars['String']['input']; }; export type MutationModifyOrderArgs = { input: ModifyOrderInput; }; export type MutationMoveCollectionArgs = { input: MoveCollectionInput; }; export type MutationRefundOrderArgs = { input: RefundOrderInput; }; export type MutationRemoveCollectionsFromChannelArgs = { input: RemoveCollectionsFromChannelInput; }; export type MutationRemoveCouponCodeFromDraftOrderArgs = { couponCode: Scalars['String']['input']; orderId: Scalars['ID']['input']; }; export type MutationRemoveCustomersFromGroupArgs = { customerGroupId: Scalars['ID']['input']; customerIds: Array<Scalars['ID']['input']>; }; export type MutationRemoveDraftOrderLineArgs = { orderId: Scalars['ID']['input']; orderLineId: Scalars['ID']['input']; }; export type MutationRemoveFacetsFromChannelArgs = { input: RemoveFacetsFromChannelInput; }; export type MutationRemoveMembersFromZoneArgs = { memberIds: Array<Scalars['ID']['input']>; zoneId: Scalars['ID']['input']; }; export type MutationRemoveOptionGroupFromProductArgs = { force?: InputMaybe<Scalars['Boolean']['input']>; optionGroupId: Scalars['ID']['input']; productId: Scalars['ID']['input']; }; export type MutationRemovePaymentMethodsFromChannelArgs = { input: RemovePaymentMethodsFromChannelInput; }; export type MutationRemoveProductVariantsFromChannelArgs = { input: RemoveProductVariantsFromChannelInput; }; export type MutationRemoveProductsFromChannelArgs = { input: RemoveProductsFromChannelInput; }; export type MutationRemovePromotionsFromChannelArgs = { input: RemovePromotionsFromChannelInput; }; export type MutationRemoveSettledJobsArgs = { olderThan?: InputMaybe<Scalars['DateTime']['input']>; queueNames?: InputMaybe<Array<Scalars['String']['input']>>; }; export type MutationRemoveShippingMethodsFromChannelArgs = { input: RemoveShippingMethodsFromChannelInput; }; export type MutationRemoveStockLocationsFromChannelArgs = { input: RemoveStockLocationsFromChannelInput; }; export type MutationSetCustomerForDraftOrderArgs = { customerId?: InputMaybe<Scalars['ID']['input']>; input?: InputMaybe<CreateCustomerInput>; orderId: Scalars['ID']['input']; }; export type MutationSetDraftOrderBillingAddressArgs = { input: CreateAddressInput; orderId: Scalars['ID']['input']; }; export type MutationSetDraftOrderCustomFieldsArgs = { input: UpdateOrderInput; orderId: Scalars['ID']['input']; }; export type MutationSetDraftOrderShippingAddressArgs = { input: CreateAddressInput; orderId: Scalars['ID']['input']; }; export type MutationSetDraftOrderShippingMethodArgs = { orderId: Scalars['ID']['input']; shippingMethodId: Scalars['ID']['input']; }; export type MutationSetOrderCustomFieldsArgs = { input: UpdateOrderInput; }; export type MutationSetOrderCustomerArgs = { input: SetOrderCustomerInput; }; export type MutationSettlePaymentArgs = { id: Scalars['ID']['input']; }; export type MutationSettleRefundArgs = { input: SettleRefundInput; }; export type MutationTransitionFulfillmentToStateArgs = { id: Scalars['ID']['input']; state: Scalars['String']['input']; }; export type MutationTransitionOrderToStateArgs = { id: Scalars['ID']['input']; state: Scalars['String']['input']; }; export type MutationTransitionPaymentToStateArgs = { id: Scalars['ID']['input']; state: Scalars['String']['input']; }; export type MutationUpdateActiveAdministratorArgs = { input: UpdateActiveAdministratorInput; }; export type MutationUpdateAdministratorArgs = { input: UpdateAdministratorInput; }; export type MutationUpdateAssetArgs = { input: UpdateAssetInput; }; export type MutationUpdateChannelArgs = { input: UpdateChannelInput; }; export type MutationUpdateCollectionArgs = { input: UpdateCollectionInput; }; export type MutationUpdateCountryArgs = { input: UpdateCountryInput; }; export type MutationUpdateCustomerArgs = { input: UpdateCustomerInput; }; export type MutationUpdateCustomerAddressArgs = { input: UpdateAddressInput; }; export type MutationUpdateCustomerGroupArgs = { input: UpdateCustomerGroupInput; }; export type MutationUpdateCustomerNoteArgs = { input: UpdateCustomerNoteInput; }; export type MutationUpdateFacetArgs = { input: UpdateFacetInput; }; export type MutationUpdateFacetValuesArgs = { input: Array<UpdateFacetValueInput>; }; export type MutationUpdateGlobalSettingsArgs = { input: UpdateGlobalSettingsInput; }; export type MutationUpdateOrderNoteArgs = { input: UpdateOrderNoteInput; }; export type MutationUpdatePaymentMethodArgs = { input: UpdatePaymentMethodInput; }; export type MutationUpdateProductArgs = { input: UpdateProductInput; }; export type MutationUpdateProductOptionArgs = { input: UpdateProductOptionInput; }; export type MutationUpdateProductOptionGroupArgs = { input: UpdateProductOptionGroupInput; }; export type MutationUpdateProductVariantsArgs = { input: Array<UpdateProductVariantInput>; }; export type MutationUpdateProductsArgs = { input: Array<UpdateProductInput>; }; export type MutationUpdatePromotionArgs = { input: UpdatePromotionInput; }; export type MutationUpdateProvinceArgs = { input: UpdateProvinceInput; }; export type MutationUpdateRoleArgs = { input: UpdateRoleInput; }; export type MutationUpdateSellerArgs = { input: UpdateSellerInput; }; export type MutationUpdateShippingMethodArgs = { input: UpdateShippingMethodInput; }; export type MutationUpdateStockLocationArgs = { input: UpdateStockLocationInput; }; export type MutationUpdateTagArgs = { input: UpdateTagInput; }; export type MutationUpdateTaxCategoryArgs = { input: UpdateTaxCategoryInput; }; export type MutationUpdateTaxRateArgs = { input: UpdateTaxRateInput; }; export type MutationUpdateZoneArgs = { input: UpdateZoneInput; }; export type NativeAuthInput = { password: Scalars['String']['input']; username: Scalars['String']['input']; }; /** Returned when attempting an operation that relies on the NativeAuthStrategy, if that strategy is not configured. */ export type NativeAuthStrategyError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type NativeAuthenticationResult = CurrentUser | InvalidCredentialsError | NativeAuthStrategyError; /** Returned when attempting to set a negative OrderLine quantity. */ export type NegativeQuantityError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** * Returned when invoking a mutation which depends on there being an active Order on the * current session. */ export type NoActiveOrderError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned when a call to modifyOrder fails to specify any changes */ export type NoChangesSpecifiedError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type Node = { id: Scalars['ID']['output']; }; /** Returned if an attempting to refund an Order but neither items nor shipping refund was specified */ export type NothingToRefundError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Operators for filtering on a list of Number fields */ export type NumberListOperators = { inList: Scalars['Float']['input']; }; /** Operators for filtering on a Int or Float field */ export type NumberOperators = { between?: InputMaybe<NumberRange>; eq?: InputMaybe<Scalars['Float']['input']>; gt?: InputMaybe<Scalars['Float']['input']>; gte?: InputMaybe<Scalars['Float']['input']>; isNull?: InputMaybe<Scalars['Boolean']['input']>; lt?: InputMaybe<Scalars['Float']['input']>; lte?: InputMaybe<Scalars['Float']['input']>; }; export type NumberRange = { end: Scalars['Float']['input']; start: Scalars['Float']['input']; }; export type Order = Node & { /** An order is active as long as the payment process has not been completed */ active: Scalars['Boolean']['output']; aggregateOrder?: Maybe<Order>; aggregateOrderId?: Maybe<Scalars['ID']['output']>; billingAddress?: Maybe<OrderAddress>; channels: Array<Channel>; /** A unique code for the Order */ code: Scalars['String']['output']; /** An array of all coupon codes applied to the Order */ couponCodes: Array<Scalars['String']['output']>; createdAt: Scalars['DateTime']['output']; currencyCode: CurrencyCode; customFields?: Maybe<Scalars['JSON']['output']>; customer?: Maybe<Customer>; discounts: Array<Discount>; fulfillments?: Maybe<Array<Fulfillment>>; history: HistoryEntryList; id: Scalars['ID']['output']; lines: Array<OrderLine>; modifications: Array<OrderModification>; nextStates: Array<Scalars['String']['output']>; /** * The date & time that the Order was placed, i.e. the Customer * completed the checkout and the Order is no longer "active" */ orderPlacedAt?: Maybe<Scalars['DateTime']['output']>; payments?: Maybe<Array<Payment>>; /** Promotions applied to the order. Only gets populated after the payment process has completed. */ promotions: Array<Promotion>; sellerOrders?: Maybe<Array<Order>>; shipping: Scalars['Money']['output']; shippingAddress?: Maybe<OrderAddress>; shippingLines: Array<ShippingLine>; shippingWithTax: Scalars['Money']['output']; state: Scalars['String']['output']; /** * The subTotal is the total of all OrderLines in the Order. This figure also includes any Order-level * discounts which have been prorated (proportionally distributed) amongst the items of each OrderLine. * To get a total of all OrderLines which does not account for prorated discounts, use the * sum of `OrderLine.discountedLinePrice` values. */ subTotal: Scalars['Money']['output']; /** Same as subTotal, but inclusive of tax */ subTotalWithTax: Scalars['Money']['output']; /** * Surcharges are arbitrary modifications to the Order total which are neither * ProductVariants nor discounts resulting from applied Promotions. For example, * one-off discounts based on customer interaction, or surcharges based on payment * methods. */ surcharges: Array<Surcharge>; /** A summary of the taxes being applied to this Order */ taxSummary: Array<OrderTaxSummary>; /** Equal to subTotal plus shipping */ total: Scalars['Money']['output']; totalQuantity: Scalars['Int']['output']; /** The final payable amount. Equal to subTotalWithTax plus shippingWithTax */ totalWithTax: Scalars['Money']['output']; type: OrderType; updatedAt: Scalars['DateTime']['output']; }; export type OrderHistoryArgs = { options?: InputMaybe<HistoryEntryListOptions>; }; export type OrderAddress = { city?: Maybe<Scalars['String']['output']>; company?: Maybe<Scalars['String']['output']>; country?: Maybe<Scalars['String']['output']>; countryCode?: Maybe<Scalars['String']['output']>; customFields?: Maybe<Scalars['JSON']['output']>; fullName?: Maybe<Scalars['String']['output']>; phoneNumber?: Maybe<Scalars['String']['output']>; postalCode?: Maybe<Scalars['String']['output']>; province?: Maybe<Scalars['String']['output']>; streetLine1?: Maybe<Scalars['String']['output']>; streetLine2?: Maybe<Scalars['String']['output']>; }; export type OrderFilterParameter = { _and?: InputMaybe<Array<OrderFilterParameter>>; _or?: InputMaybe<Array<OrderFilterParameter>>; active?: InputMaybe<BooleanOperators>; aggregateOrderId?: InputMaybe<IdOperators>; code?: InputMaybe<StringOperators>; createdAt?: InputMaybe<DateOperators>; currencyCode?: InputMaybe<StringOperators>; customerLastName?: InputMaybe<StringOperators>; id?: InputMaybe<IdOperators>; orderPlacedAt?: InputMaybe<DateOperators>; shipping?: InputMaybe<NumberOperators>; shippingWithTax?: InputMaybe<NumberOperators>; state?: InputMaybe<StringOperators>; subTotal?: InputMaybe<NumberOperators>; subTotalWithTax?: InputMaybe<NumberOperators>; total?: InputMaybe<NumberOperators>; totalQuantity?: InputMaybe<NumberOperators>; totalWithTax?: InputMaybe<NumberOperators>; transactionId?: InputMaybe<StringOperators>; type?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; /** Returned when the maximum order size limit has been reached. */ export type OrderLimitError = ErrorResult & { errorCode: ErrorCode; maxItems: Scalars['Int']['output']; message: Scalars['String']['output']; }; export type OrderLine = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; /** The price of the line including discounts, excluding tax */ discountedLinePrice: Scalars['Money']['output']; /** The price of the line including discounts and tax */ discountedLinePriceWithTax: Scalars['Money']['output']; /** * The price of a single unit including discounts, excluding tax. * * If Order-level discounts have been applied, this will not be the * actual taxable unit price (see `proratedUnitPrice`), but is generally the * correct price to display to customers to avoid confusion * about the internal handling of distributed Order-level discounts. */ discountedUnitPrice: Scalars['Money']['output']; /** The price of a single unit including discounts and tax */ discountedUnitPriceWithTax: Scalars['Money']['output']; discounts: Array<Discount>; featuredAsset?: Maybe<Asset>; fulfillmentLines?: Maybe<Array<FulfillmentLine>>; id: Scalars['ID']['output']; /** The total price of the line excluding tax and discounts. */ linePrice: Scalars['Money']['output']; /** The total price of the line including tax but excluding discounts. */ linePriceWithTax: Scalars['Money']['output']; /** The total tax on this line */ lineTax: Scalars['Money']['output']; order: Order; /** The quantity at the time the Order was placed */ orderPlacedQuantity: Scalars['Int']['output']; productVariant: ProductVariant; /** * The actual line price, taking into account both item discounts _and_ prorated (proportionally-distributed) * Order-level discounts. This value is the true economic value of the OrderLine, and is used in tax * and refund calculations. */ proratedLinePrice: Scalars['Money']['output']; /** The proratedLinePrice including tax */ proratedLinePriceWithTax: Scalars['Money']['output']; /** * The actual unit price, taking into account both item discounts _and_ prorated (proportionally-distributed) * Order-level discounts. This value is the true economic value of the OrderItem, and is used in tax * and refund calculations. */ proratedUnitPrice: Scalars['Money']['output']; /** The proratedUnitPrice including tax */ proratedUnitPriceWithTax: Scalars['Money']['output']; /** The quantity of items purchased */ quantity: Scalars['Int']['output']; taxLines: Array<TaxLine>; taxRate: Scalars['Float']['output']; /** The price of a single unit, excluding tax and discounts */ unitPrice: Scalars['Money']['output']; /** Non-zero if the unitPrice has changed since it was initially added to Order */ unitPriceChangeSinceAdded: Scalars['Money']['output']; /** The price of a single unit, including tax but excluding discounts */ unitPriceWithTax: Scalars['Money']['output']; /** Non-zero if the unitPriceWithTax has changed since it was initially added to Order */ unitPriceWithTaxChangeSinceAdded: Scalars['Money']['output']; updatedAt: Scalars['DateTime']['output']; }; export type OrderLineInput = { orderLineId: Scalars['ID']['input']; quantity: Scalars['Int']['input']; }; export type OrderList = PaginatedList & { items: Array<Order>; totalItems: Scalars['Int']['output']; }; export type OrderListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<OrderFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<OrderSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type OrderModification = Node & { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; isSettled: Scalars['Boolean']['output']; lines: Array<OrderModificationLine>; note: Scalars['String']['output']; payment?: Maybe<Payment>; priceChange: Scalars['Money']['output']; refund?: Maybe<Refund>; surcharges?: Maybe<Array<Surcharge>>; updatedAt: Scalars['DateTime']['output']; }; /** Returned when attempting to modify the contents of an Order that is not in the `AddingItems` state. */ export type OrderModificationError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type OrderModificationLine = { modification: OrderModification; modificationId: Scalars['ID']['output']; orderLine: OrderLine; orderLineId: Scalars['ID']['output']; quantity: Scalars['Int']['output']; }; /** Returned when attempting to modify the contents of an Order that is not in the `Modifying` state. */ export type OrderModificationStateError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type OrderProcessState = { name: Scalars['String']['output']; to: Array<Scalars['String']['output']>; }; export type OrderSortParameter = { aggregateOrderId?: InputMaybe<SortOrder>; code?: InputMaybe<SortOrder>; createdAt?: InputMaybe<SortOrder>; customerLastName?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; orderPlacedAt?: InputMaybe<SortOrder>; shipping?: InputMaybe<SortOrder>; shippingWithTax?: InputMaybe<SortOrder>; state?: InputMaybe<SortOrder>; subTotal?: InputMaybe<SortOrder>; subTotalWithTax?: InputMaybe<SortOrder>; total?: InputMaybe<SortOrder>; totalQuantity?: InputMaybe<SortOrder>; totalWithTax?: InputMaybe<SortOrder>; transactionId?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; /** Returned if there is an error in transitioning the Order state */ export type OrderStateTransitionError = ErrorResult & { errorCode: ErrorCode; fromState: Scalars['String']['output']; message: Scalars['String']['output']; toState: Scalars['String']['output']; transitionError: Scalars['String']['output']; }; /** * A summary of the taxes being applied to this order, grouped * by taxRate. */ export type OrderTaxSummary = { /** A description of this tax */ description: Scalars['String']['output']; /** The total net price of OrderLines to which this taxRate applies */ taxBase: Scalars['Money']['output']; /** The taxRate as a percentage */ taxRate: Scalars['Float']['output']; /** The total tax being applied to the Order at this taxRate */ taxTotal: Scalars['Money']['output']; }; export enum OrderType { Aggregate = 'Aggregate', Regular = 'Regular', Seller = 'Seller' } export type PaginatedList = { items: Array<Node>; totalItems: Scalars['Int']['output']; }; export type Payment = Node & { amount: Scalars['Money']['output']; createdAt: Scalars['DateTime']['output']; errorMessage?: Maybe<Scalars['String']['output']>; id: Scalars['ID']['output']; metadata?: Maybe<Scalars['JSON']['output']>; method: Scalars['String']['output']; nextStates: Array<Scalars['String']['output']>; refunds: Array<Refund>; state: Scalars['String']['output']; transactionId?: Maybe<Scalars['String']['output']>; updatedAt: Scalars['DateTime']['output']; }; export type PaymentMethod = Node & { checker?: Maybe<ConfigurableOperation>; code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; enabled: Scalars['Boolean']['output']; handler: ConfigurableOperation; id: Scalars['ID']['output']; name: Scalars['String']['output']; translations: Array<PaymentMethodTranslation>; updatedAt: Scalars['DateTime']['output']; }; export type PaymentMethodFilterParameter = { _and?: InputMaybe<Array<PaymentMethodFilterParameter>>; _or?: InputMaybe<Array<PaymentMethodFilterParameter>>; code?: InputMaybe<StringOperators>; createdAt?: InputMaybe<DateOperators>; description?: InputMaybe<StringOperators>; enabled?: InputMaybe<BooleanOperators>; id?: InputMaybe<IdOperators>; name?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type PaymentMethodList = PaginatedList & { items: Array<PaymentMethod>; totalItems: Scalars['Int']['output']; }; export type PaymentMethodListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<PaymentMethodFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<PaymentMethodSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; /** * Returned when a call to modifyOrder fails to include a paymentMethod even * though the price has increased as a result of the changes. */ export type PaymentMethodMissingError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type PaymentMethodQuote = { code: Scalars['String']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; eligibilityMessage?: Maybe<Scalars['String']['output']>; id: Scalars['ID']['output']; isEligible: Scalars['Boolean']['output']; name: Scalars['String']['output']; }; export type PaymentMethodSortParameter = { code?: InputMaybe<SortOrder>; createdAt?: InputMaybe<SortOrder>; description?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type PaymentMethodTranslation = { createdAt: Scalars['DateTime']['output']; description: Scalars['String']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type PaymentMethodTranslationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; description?: InputMaybe<Scalars['String']['input']>; id?: InputMaybe<Scalars['ID']['input']>; languageCode: LanguageCode; name?: InputMaybe<Scalars['String']['input']>; }; /** Returned if an attempting to refund a Payment against OrderLines from a different Order */ export type PaymentOrderMismatchError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned when there is an error in transitioning the Payment state */ export type PaymentStateTransitionError = ErrorResult & { errorCode: ErrorCode; fromState: Scalars['String']['output']; message: Scalars['String']['output']; toState: Scalars['String']['output']; transitionError: Scalars['String']['output']; }; /** * @description * Permissions for administrators and customers. Used to control access to * GraphQL resolvers via the {@link Allow} decorator. * * ## Understanding Permission.Owner * * `Permission.Owner` is a special permission which is used in some Vendure resolvers to indicate that that resolver should only * be accessible to the "owner" of that resource. * * For example, the Shop API `activeCustomer` query resolver should only return the Customer object for the "owner" of that Customer, i.e. * based on the activeUserId of the current session. As a result, the resolver code looks like this: * * @example * ```TypeScript * \@Query() * \@Allow(Permission.Owner) * async activeCustomer(\@Ctx() ctx: RequestContext): Promise<Customer | undefined> { * const userId = ctx.activeUserId; * if (userId) { * return this.customerService.findOneByUserId(ctx, userId); * } * } * ``` * * Here we can see that the "ownership" must be enforced by custom logic inside the resolver. Since "ownership" cannot be defined generally * nor statically encoded at build-time, any resolvers using `Permission.Owner` **must** include logic to enforce that only the owner * of the resource has access. If not, then it is the equivalent of using `Permission.Public`. * * * @docsCategory common */ export enum Permission { /** Authenticated means simply that the user is logged in */ Authenticated = 'Authenticated', /** Grants permission to create Administrator */ CreateAdministrator = 'CreateAdministrator', /** Grants permission to create Asset */ CreateAsset = 'CreateAsset', /** Grants permission to create Products, Facets, Assets, Collections */ CreateCatalog = 'CreateCatalog', /** Grants permission to create Channel */ CreateChannel = 'CreateChannel', /** Grants permission to create Collection */ CreateCollection = 'CreateCollection', /** Grants permission to create Country */ CreateCountry = 'CreateCountry', /** Grants permission to create Customer */ CreateCustomer = 'CreateCustomer', /** Grants permission to create CustomerGroup */ CreateCustomerGroup = 'CreateCustomerGroup', /** Grants permission to create Facet */ CreateFacet = 'CreateFacet', /** Grants permission to create Order */ CreateOrder = 'CreateOrder', /** Grants permission to create PaymentMethod */ CreatePaymentMethod = 'CreatePaymentMethod', /** Grants permission to create Product */ CreateProduct = 'CreateProduct', /** Grants permission to create Promotion */ CreatePromotion = 'CreatePromotion', /** Grants permission to create Seller */ CreateSeller = 'CreateSeller', /** Grants permission to create PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings */ CreateSettings = 'CreateSettings', /** Grants permission to create ShippingMethod */ CreateShippingMethod = 'CreateShippingMethod', /** Grants permission to create StockLocation */ CreateStockLocation = 'CreateStockLocation', /** Grants permission to create System */ CreateSystem = 'CreateSystem', /** Grants permission to create Tag */ CreateTag = 'CreateTag', /** Grants permission to create TaxCategory */ CreateTaxCategory = 'CreateTaxCategory', /** Grants permission to create TaxRate */ CreateTaxRate = 'CreateTaxRate', /** Grants permission to create Zone */ CreateZone = 'CreateZone', /** Grants permission to delete Administrator */ DeleteAdministrator = 'DeleteAdministrator', /** Grants permission to delete Asset */ DeleteAsset = 'DeleteAsset', /** Grants permission to delete Products, Facets, Assets, Collections */ DeleteCatalog = 'DeleteCatalog', /** Grants permission to delete Channel */ DeleteChannel = 'DeleteChannel', /** Grants permission to delete Collection */ DeleteCollection = 'DeleteCollection', /** Grants permission to delete Country */ DeleteCountry = 'DeleteCountry', /** Grants permission to delete Customer */ DeleteCustomer = 'DeleteCustomer', /** Grants permission to delete CustomerGroup */ DeleteCustomerGroup = 'DeleteCustomerGroup', /** Grants permission to delete Facet */ DeleteFacet = 'DeleteFacet', /** Grants permission to delete Order */ DeleteOrder = 'DeleteOrder', /** Grants permission to delete PaymentMethod */ DeletePaymentMethod = 'DeletePaymentMethod', /** Grants permission to delete Product */ DeleteProduct = 'DeleteProduct', /** Grants permission to delete Promotion */ DeletePromotion = 'DeletePromotion', /** Grants permission to delete Seller */ DeleteSeller = 'DeleteSeller', /** Grants permission to delete PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings */ DeleteSettings = 'DeleteSettings', /** Grants permission to delete ShippingMethod */ DeleteShippingMethod = 'DeleteShippingMethod', /** Grants permission to delete StockLocation */ DeleteStockLocation = 'DeleteStockLocation', /** Grants permission to delete System */ DeleteSystem = 'DeleteSystem', /** Grants permission to delete Tag */ DeleteTag = 'DeleteTag', /** Grants permission to delete TaxCategory */ DeleteTaxCategory = 'DeleteTaxCategory', /** Grants permission to delete TaxRate */ DeleteTaxRate = 'DeleteTaxRate', /** Grants permission to delete Zone */ DeleteZone = 'DeleteZone', /** Owner means the user owns this entity, e.g. a Customer's own Order */ Owner = 'Owner', /** Public means any unauthenticated user may perform the operation */ Public = 'Public', /** Grants permission to read Administrator */ ReadAdministrator = 'ReadAdministrator', /** Grants permission to read Asset */ ReadAsset = 'ReadAsset', /** Grants permission to read Products, Facets, Assets, Collections */ ReadCatalog = 'ReadCatalog', /** Grants permission to read Channel */ ReadChannel = 'ReadChannel', /** Grants permission to read Collection */ ReadCollection = 'ReadCollection', /** Grants permission to read Country */ ReadCountry = 'ReadCountry', /** Grants permission to read Customer */ ReadCustomer = 'ReadCustomer', /** Grants permission to read CustomerGroup */ ReadCustomerGroup = 'ReadCustomerGroup', /** Grants permission to read Facet */ ReadFacet = 'ReadFacet', /** Grants permission to read Order */ ReadOrder = 'ReadOrder', /** Grants permission to read PaymentMethod */ ReadPaymentMethod = 'ReadPaymentMethod', /** Grants permission to read Product */ ReadProduct = 'ReadProduct', /** Grants permission to read Promotion */ ReadPromotion = 'ReadPromotion', /** Grants permission to read Seller */ ReadSeller = 'ReadSeller', /** Grants permission to read PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings */ ReadSettings = 'ReadSettings', /** Grants permission to read ShippingMethod */ ReadShippingMethod = 'ReadShippingMethod', /** Grants permission to read StockLocation */ ReadStockLocation = 'ReadStockLocation', /** Grants permission to read System */ ReadSystem = 'ReadSystem', /** Grants permission to read Tag */ ReadTag = 'ReadTag', /** Grants permission to read TaxCategory */ ReadTaxCategory = 'ReadTaxCategory', /** Grants permission to read TaxRate */ ReadTaxRate = 'ReadTaxRate', /** Grants permission to read Zone */ ReadZone = 'ReadZone', /** SuperAdmin has unrestricted access to all operations */ SuperAdmin = 'SuperAdmin', /** Grants permission to update Administrator */ UpdateAdministrator = 'UpdateAdministrator', /** Grants permission to update Asset */ UpdateAsset = 'UpdateAsset', /** Grants permission to update Products, Facets, Assets, Collections */ UpdateCatalog = 'UpdateCatalog', /** Grants permission to update Channel */ UpdateChannel = 'UpdateChannel', /** Grants permission to update Collection */ UpdateCollection = 'UpdateCollection', /** Grants permission to update Country */ UpdateCountry = 'UpdateCountry', /** Grants permission to update Customer */ UpdateCustomer = 'UpdateCustomer', /** Grants permission to update CustomerGroup */ UpdateCustomerGroup = 'UpdateCustomerGroup', /** Grants permission to update Facet */ UpdateFacet = 'UpdateFacet', /** Grants permission to update GlobalSettings */ UpdateGlobalSettings = 'UpdateGlobalSettings', /** Grants permission to update Order */ UpdateOrder = 'UpdateOrder', /** Grants permission to update PaymentMethod */ UpdatePaymentMethod = 'UpdatePaymentMethod', /** Grants permission to update Product */ UpdateProduct = 'UpdateProduct', /** Grants permission to update Promotion */ UpdatePromotion = 'UpdatePromotion', /** Grants permission to update Seller */ UpdateSeller = 'UpdateSeller', /** Grants permission to update PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings */ UpdateSettings = 'UpdateSettings', /** Grants permission to update ShippingMethod */ UpdateShippingMethod = 'UpdateShippingMethod', /** Grants permission to update StockLocation */ UpdateStockLocation = 'UpdateStockLocation', /** Grants permission to update System */ UpdateSystem = 'UpdateSystem', /** Grants permission to update Tag */ UpdateTag = 'UpdateTag', /** Grants permission to update TaxCategory */ UpdateTaxCategory = 'UpdateTaxCategory', /** Grants permission to update TaxRate */ UpdateTaxRate = 'UpdateTaxRate', /** Grants permission to update Zone */ UpdateZone = 'UpdateZone' } export type PermissionDefinition = { assignable: Scalars['Boolean']['output']; description: Scalars['String']['output']; name: Scalars['String']['output']; }; export type PreviewCollectionVariantsInput = { filters: Array<ConfigurableOperationInput>; inheritFilters: Scalars['Boolean']['input']; parentId?: InputMaybe<Scalars['ID']['input']>; }; /** The price range where the result has more than one price */ export type PriceRange = { max: Scalars['Money']['output']; min: Scalars['Money']['output']; }; export type Product = Node & { assets: Array<Asset>; channels: Array<Channel>; collections: Array<Collection>; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; enabled: Scalars['Boolean']['output']; facetValues: Array<FacetValue>; featuredAsset?: Maybe<Asset>; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; optionGroups: Array<ProductOptionGroup>; slug: Scalars['String']['output']; translations: Array<ProductTranslation>; updatedAt: Scalars['DateTime']['output']; /** Returns a paginated, sortable, filterable list of ProductVariants */ variantList: ProductVariantList; /** Returns all ProductVariants */ variants: Array<ProductVariant>; }; export type ProductVariantListArgs = { options?: InputMaybe<ProductVariantListOptions>; }; export type ProductFilterParameter = { _and?: InputMaybe<Array<ProductFilterParameter>>; _or?: InputMaybe<Array<ProductFilterParameter>>; createdAt?: InputMaybe<DateOperators>; description?: InputMaybe<StringOperators>; enabled?: InputMaybe<BooleanOperators>; facetValueId?: InputMaybe<IdOperators>; id?: InputMaybe<IdOperators>; languageCode?: InputMaybe<StringOperators>; name?: InputMaybe<StringOperators>; sku?: InputMaybe<StringOperators>; slug?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type ProductList = PaginatedList & { items: Array<Product>; totalItems: Scalars['Int']['output']; }; export type ProductListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<ProductFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<ProductSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type ProductOption = Node & { code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; group: ProductOptionGroup; groupId: Scalars['ID']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; translations: Array<ProductOptionTranslation>; updatedAt: Scalars['DateTime']['output']; }; export type ProductOptionGroup = Node & { code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; options: Array<ProductOption>; translations: Array<ProductOptionGroupTranslation>; updatedAt: Scalars['DateTime']['output']; }; export type ProductOptionGroupTranslation = { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type ProductOptionGroupTranslationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; id?: InputMaybe<Scalars['ID']['input']>; languageCode: LanguageCode; name?: InputMaybe<Scalars['String']['input']>; }; export type ProductOptionInUseError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; optionGroupCode: Scalars['String']['output']; productVariantCount: Scalars['Int']['output']; }; export type ProductOptionTranslation = { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type ProductOptionTranslationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; id?: InputMaybe<Scalars['ID']['input']>; languageCode: LanguageCode; name?: InputMaybe<Scalars['String']['input']>; }; export type ProductSortParameter = { createdAt?: InputMaybe<SortOrder>; description?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; slug?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type ProductTranslation = { createdAt: Scalars['DateTime']['output']; description: Scalars['String']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; slug: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type ProductTranslationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; description?: InputMaybe<Scalars['String']['input']>; id?: InputMaybe<Scalars['ID']['input']>; languageCode: LanguageCode; name?: InputMaybe<Scalars['String']['input']>; slug?: InputMaybe<Scalars['String']['input']>; }; export type ProductVariant = Node & { assets: Array<Asset>; channels: Array<Channel>; createdAt: Scalars['DateTime']['output']; currencyCode: CurrencyCode; customFields?: Maybe<Scalars['JSON']['output']>; enabled: Scalars['Boolean']['output']; facetValues: Array<FacetValue>; featuredAsset?: Maybe<Asset>; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; options: Array<ProductOption>; outOfStockThreshold: Scalars['Int']['output']; price: Scalars['Money']['output']; priceWithTax: Scalars['Money']['output']; prices: Array<ProductVariantPrice>; product: Product; productId: Scalars['ID']['output']; sku: Scalars['String']['output']; /** @deprecated use stockLevels */ stockAllocated: Scalars['Int']['output']; stockLevel: Scalars['String']['output']; stockLevels: Array<StockLevel>; stockMovements: StockMovementList; /** @deprecated use stockLevels */ stockOnHand: Scalars['Int']['output']; taxCategory: TaxCategory; taxRateApplied: TaxRate; trackInventory: GlobalFlag; translations: Array<ProductVariantTranslation>; updatedAt: Scalars['DateTime']['output']; useGlobalOutOfStockThreshold: Scalars['Boolean']['output']; }; export type ProductVariantStockMovementsArgs = { options?: InputMaybe<StockMovementListOptions>; }; export type ProductVariantFilterParameter = { _and?: InputMaybe<Array<ProductVariantFilterParameter>>; _or?: InputMaybe<Array<ProductVariantFilterParameter>>; createdAt?: InputMaybe<DateOperators>; currencyCode?: InputMaybe<StringOperators>; enabled?: InputMaybe<BooleanOperators>; facetValueId?: InputMaybe<IdOperators>; id?: InputMaybe<IdOperators>; languageCode?: InputMaybe<StringOperators>; name?: InputMaybe<StringOperators>; outOfStockThreshold?: InputMaybe<NumberOperators>; price?: InputMaybe<NumberOperators>; priceWithTax?: InputMaybe<NumberOperators>; productId?: InputMaybe<IdOperators>; sku?: InputMaybe<StringOperators>; stockAllocated?: InputMaybe<NumberOperators>; stockLevel?: InputMaybe<StringOperators>; stockOnHand?: InputMaybe<NumberOperators>; trackInventory?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; useGlobalOutOfStockThreshold?: InputMaybe<BooleanOperators>; }; export type ProductVariantList = PaginatedList & { items: Array<ProductVariant>; totalItems: Scalars['Int']['output']; }; export type ProductVariantListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<ProductVariantFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<ProductVariantSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type ProductVariantPrice = { currencyCode: CurrencyCode; customFields?: Maybe<Scalars['JSON']['output']>; price: Scalars['Money']['output']; }; /** * Used to set up update the price of a ProductVariant in a particular Channel. * If the `delete` flag is `true`, the price will be deleted for the given Channel. */ export type ProductVariantPriceInput = { currencyCode: CurrencyCode; delete?: InputMaybe<Scalars['Boolean']['input']>; price: Scalars['Money']['input']; }; export type ProductVariantSortParameter = { createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; outOfStockThreshold?: InputMaybe<SortOrder>; price?: InputMaybe<SortOrder>; priceWithTax?: InputMaybe<SortOrder>; productId?: InputMaybe<SortOrder>; sku?: InputMaybe<SortOrder>; stockAllocated?: InputMaybe<SortOrder>; stockLevel?: InputMaybe<SortOrder>; stockOnHand?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type ProductVariantTranslation = { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type ProductVariantTranslationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; id?: InputMaybe<Scalars['ID']['input']>; languageCode: LanguageCode; name?: InputMaybe<Scalars['String']['input']>; }; export type Promotion = Node & { actions: Array<ConfigurableOperation>; conditions: Array<ConfigurableOperation>; couponCode?: Maybe<Scalars['String']['output']>; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; enabled: Scalars['Boolean']['output']; endsAt?: Maybe<Scalars['DateTime']['output']>; id: Scalars['ID']['output']; name: Scalars['String']['output']; perCustomerUsageLimit?: Maybe<Scalars['Int']['output']>; startsAt?: Maybe<Scalars['DateTime']['output']>; translations: Array<PromotionTranslation>; updatedAt: Scalars['DateTime']['output']; usageLimit?: Maybe<Scalars['Int']['output']>; }; export type PromotionFilterParameter = { _and?: InputMaybe<Array<PromotionFilterParameter>>; _or?: InputMaybe<Array<PromotionFilterParameter>>; couponCode?: InputMaybe<StringOperators>; createdAt?: InputMaybe<DateOperators>; description?: InputMaybe<StringOperators>; enabled?: InputMaybe<BooleanOperators>; endsAt?: InputMaybe<DateOperators>; id?: InputMaybe<IdOperators>; name?: InputMaybe<StringOperators>; perCustomerUsageLimit?: InputMaybe<NumberOperators>; startsAt?: InputMaybe<DateOperators>; updatedAt?: InputMaybe<DateOperators>; usageLimit?: InputMaybe<NumberOperators>; }; export type PromotionList = PaginatedList & { items: Array<Promotion>; totalItems: Scalars['Int']['output']; }; export type PromotionListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<PromotionFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<PromotionSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type PromotionSortParameter = { couponCode?: InputMaybe<SortOrder>; createdAt?: InputMaybe<SortOrder>; description?: InputMaybe<SortOrder>; endsAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; perCustomerUsageLimit?: InputMaybe<SortOrder>; startsAt?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; usageLimit?: InputMaybe<SortOrder>; }; export type PromotionTranslation = { createdAt: Scalars['DateTime']['output']; description: Scalars['String']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type PromotionTranslationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; description?: InputMaybe<Scalars['String']['input']>; id?: InputMaybe<Scalars['ID']['input']>; languageCode: LanguageCode; name?: InputMaybe<Scalars['String']['input']>; }; export type Province = Node & Region & { code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; enabled: Scalars['Boolean']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; parent?: Maybe<Region>; parentId?: Maybe<Scalars['ID']['output']>; translations: Array<RegionTranslation>; type: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type ProvinceFilterParameter = { _and?: InputMaybe<Array<ProvinceFilterParameter>>; _or?: InputMaybe<Array<ProvinceFilterParameter>>; code?: InputMaybe<StringOperators>; createdAt?: InputMaybe<DateOperators>; enabled?: InputMaybe<BooleanOperators>; id?: InputMaybe<IdOperators>; languageCode?: InputMaybe<StringOperators>; name?: InputMaybe<StringOperators>; parentId?: InputMaybe<IdOperators>; type?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type ProvinceList = PaginatedList & { items: Array<Province>; totalItems: Scalars['Int']['output']; }; export type ProvinceListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<ProvinceFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<ProvinceSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type ProvinceSortParameter = { code?: InputMaybe<SortOrder>; createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; parentId?: InputMaybe<SortOrder>; type?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type ProvinceTranslationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; id?: InputMaybe<Scalars['ID']['input']>; languageCode: LanguageCode; name?: InputMaybe<Scalars['String']['input']>; }; /** Returned if the specified quantity of an OrderLine is greater than the number of items in that line */ export type QuantityTooGreatError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type Query = { activeAdministrator?: Maybe<Administrator>; activeChannel: Channel; administrator?: Maybe<Administrator>; administrators: AdministratorList; /** Get a single Asset by id */ asset?: Maybe<Asset>; /** Get a list of Assets */ assets: AssetList; channel?: Maybe<Channel>; channels: ChannelList; /** Get a Collection either by id or slug. If neither id nor slug is specified, an error will result. */ collection?: Maybe<Collection>; collectionFilters: Array<ConfigurableOperationDefinition>; collections: CollectionList; countries: CountryList; country?: Maybe<Country>; customer?: Maybe<Customer>; customerGroup?: Maybe<CustomerGroup>; customerGroups: CustomerGroupList; customers: CustomerList; /** Returns a list of eligible shipping methods for the draft Order */ eligibleShippingMethodsForDraftOrder: Array<ShippingMethodQuote>; entityDuplicators: Array<EntityDuplicatorDefinition>; facet?: Maybe<Facet>; facetValues: FacetValueList; facets: FacetList; fulfillmentHandlers: Array<ConfigurableOperationDefinition>; globalSettings: GlobalSettings; job?: Maybe<Job>; jobBufferSize: Array<JobBufferSize>; jobQueues: Array<JobQueue>; jobs: JobList; jobsById: Array<Job>; me?: Maybe<CurrentUser>; /** Get metrics for the given interval and metric types. */ metricSummary: Array<MetricSummary>; order?: Maybe<Order>; orders: OrderList; paymentMethod?: Maybe<PaymentMethod>; paymentMethodEligibilityCheckers: Array<ConfigurableOperationDefinition>; paymentMethodHandlers: Array<ConfigurableOperationDefinition>; paymentMethods: PaymentMethodList; pendingSearchIndexUpdates: Scalars['Int']['output']; /** Used for real-time previews of the contents of a Collection */ previewCollectionVariants: ProductVariantList; /** Get a Product either by id or slug. If neither id nor slug is specified, an error will result. */ product?: Maybe<Product>; productOptionGroup?: Maybe<ProductOptionGroup>; productOptionGroups: Array<ProductOptionGroup>; /** Get a ProductVariant by id */ productVariant?: Maybe<ProductVariant>; /** List ProductVariants either all or for the specific product. */ productVariants: ProductVariantList; /** List Products */ products: ProductList; promotion?: Maybe<Promotion>; promotionActions: Array<ConfigurableOperationDefinition>; promotionConditions: Array<ConfigurableOperationDefinition>; promotions: PromotionList; province?: Maybe<Province>; provinces: ProvinceList; role?: Maybe<Role>; roles: RoleList; search: SearchResponse; seller?: Maybe<Seller>; sellers: SellerList; shippingCalculators: Array<ConfigurableOperationDefinition>; shippingEligibilityCheckers: Array<ConfigurableOperationDefinition>; shippingMethod?: Maybe<ShippingMethod>; shippingMethods: ShippingMethodList; stockLocation?: Maybe<StockLocation>; stockLocations: StockLocationList; tag: Tag; tags: TagList; taxCategories: TaxCategoryList; taxCategory?: Maybe<TaxCategory>; taxRate?: Maybe<TaxRate>; taxRates: TaxRateList; testEligibleShippingMethods: Array<ShippingMethodQuote>; testShippingMethod: TestShippingMethodResult; zone?: Maybe<Zone>; zones: ZoneList; }; export type QueryAdministratorArgs = { id: Scalars['ID']['input']; }; export type QueryAdministratorsArgs = { options?: InputMaybe<AdministratorListOptions>; }; export type QueryAssetArgs = { id: Scalars['ID']['input']; }; export type QueryAssetsArgs = { options?: InputMaybe<AssetListOptions>; }; export type QueryChannelArgs = { id: Scalars['ID']['input']; }; export type QueryChannelsArgs = { options?: InputMaybe<ChannelListOptions>; }; export type QueryCollectionArgs = { id?: InputMaybe<Scalars['ID']['input']>; slug?: InputMaybe<Scalars['String']['input']>; }; export type QueryCollectionsArgs = { options?: InputMaybe<CollectionListOptions>; }; export type QueryCountriesArgs = { options?: InputMaybe<CountryListOptions>; }; export type QueryCountryArgs = { id: Scalars['ID']['input']; }; export type QueryCustomerArgs = { id: Scalars['ID']['input']; }; export type QueryCustomerGroupArgs = { id: Scalars['ID']['input']; }; export type QueryCustomerGroupsArgs = { options?: InputMaybe<CustomerGroupListOptions>; }; export type QueryCustomersArgs = { options?: InputMaybe<CustomerListOptions>; }; export type QueryEligibleShippingMethodsForDraftOrderArgs = { orderId: Scalars['ID']['input']; }; export type QueryFacetArgs = { id: Scalars['ID']['input']; }; export type QueryFacetValuesArgs = { options?: InputMaybe<FacetValueListOptions>; }; export type QueryFacetsArgs = { options?: InputMaybe<FacetListOptions>; }; export type QueryJobArgs = { jobId: Scalars['ID']['input']; }; export type QueryJobBufferSizeArgs = { bufferIds?: InputMaybe<Array<Scalars['String']['input']>>; }; export type QueryJobsArgs = { options?: InputMaybe<JobListOptions>; }; export type QueryJobsByIdArgs = { jobIds: Array<Scalars['ID']['input']>; }; export type QueryMetricSummaryArgs = { input?: InputMaybe<MetricSummaryInput>; }; export type QueryOrderArgs = { id: Scalars['ID']['input']; }; export type QueryOrdersArgs = { options?: InputMaybe<OrderListOptions>; }; export type QueryPaymentMethodArgs = { id: Scalars['ID']['input']; }; export type QueryPaymentMethodsArgs = { options?: InputMaybe<PaymentMethodListOptions>; }; export type QueryPreviewCollectionVariantsArgs = { input: PreviewCollectionVariantsInput; options?: InputMaybe<ProductVariantListOptions>; }; export type QueryProductArgs = { id?: InputMaybe<Scalars['ID']['input']>; slug?: InputMaybe<Scalars['String']['input']>; }; export type QueryProductOptionGroupArgs = { id: Scalars['ID']['input']; }; export type QueryProductOptionGroupsArgs = { filterTerm?: InputMaybe<Scalars['String']['input']>; }; export type QueryProductVariantArgs = { id: Scalars['ID']['input']; }; export type QueryProductVariantsArgs = { options?: InputMaybe<ProductVariantListOptions>; productId?: InputMaybe<Scalars['ID']['input']>; }; export type QueryProductsArgs = { options?: InputMaybe<ProductListOptions>; }; export type QueryPromotionArgs = { id: Scalars['ID']['input']; }; export type QueryPromotionsArgs = { options?: InputMaybe<PromotionListOptions>; }; export type QueryProvinceArgs = { id: Scalars['ID']['input']; }; export type QueryProvincesArgs = { options?: InputMaybe<ProvinceListOptions>; }; export type QueryRoleArgs = { id: Scalars['ID']['input']; }; export type QueryRolesArgs = { options?: InputMaybe<RoleListOptions>; }; export type QuerySearchArgs = { input: SearchInput; }; export type QuerySellerArgs = { id: Scalars['ID']['input']; }; export type QuerySellersArgs = { options?: InputMaybe<SellerListOptions>; }; export type QueryShippingMethodArgs = { id: Scalars['ID']['input']; }; export type QueryShippingMethodsArgs = { options?: InputMaybe<ShippingMethodListOptions>; }; export type QueryStockLocationArgs = { id: Scalars['ID']['input']; }; export type QueryStockLocationsArgs = { options?: InputMaybe<StockLocationListOptions>; }; export type QueryTagArgs = { id: Scalars['ID']['input']; }; export type QueryTagsArgs = { options?: InputMaybe<TagListOptions>; }; export type QueryTaxCategoriesArgs = { options?: InputMaybe<TaxCategoryListOptions>; }; export type QueryTaxCategoryArgs = { id: Scalars['ID']['input']; }; export type QueryTaxRateArgs = { id: Scalars['ID']['input']; }; export type QueryTaxRatesArgs = { options?: InputMaybe<TaxRateListOptions>; }; export type QueryTestEligibleShippingMethodsArgs = { input: TestEligibleShippingMethodsInput; }; export type QueryTestShippingMethodArgs = { input: TestShippingMethodInput; }; export type QueryZoneArgs = { id: Scalars['ID']['input']; }; export type QueryZonesArgs = { options?: InputMaybe<ZoneListOptions>; }; export type Refund = Node & { adjustment: Scalars['Money']['output']; createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; items: Scalars['Money']['output']; lines: Array<RefundLine>; metadata?: Maybe<Scalars['JSON']['output']>; method?: Maybe<Scalars['String']['output']>; paymentId: Scalars['ID']['output']; reason?: Maybe<Scalars['String']['output']>; shipping: Scalars['Money']['output']; state: Scalars['String']['output']; total: Scalars['Money']['output']; transactionId?: Maybe<Scalars['String']['output']>; updatedAt: Scalars['DateTime']['output']; }; /** Returned if `amount` is greater than the maximum un-refunded amount of the Payment */ export type RefundAmountError = ErrorResult & { errorCode: ErrorCode; maximumRefundable: Scalars['Int']['output']; message: Scalars['String']['output']; }; export type RefundLine = { orderLine: OrderLine; orderLineId: Scalars['ID']['output']; quantity: Scalars['Int']['output']; refund: Refund; refundId: Scalars['ID']['output']; }; export type RefundOrderInput = { adjustment: Scalars['Money']['input']; /** * If an amount is specified, this value will be used to create a Refund rather than calculating the * amount automatically. This was added in v2.2 and will be the preferred way to specify the refund * amount in the future. The `lines`, `shipping` and `adjustment` fields will likely be removed in a future * version. */ amount?: InputMaybe<Scalars['Money']['input']>; lines: Array<OrderLineInput>; paymentId: Scalars['ID']['input']; reason?: InputMaybe<Scalars['String']['input']>; shipping: Scalars['Money']['input']; }; export type RefundOrderResult = AlreadyRefundedError | MultipleOrderError | NothingToRefundError | OrderStateTransitionError | PaymentOrderMismatchError | QuantityTooGreatError | Refund | RefundAmountError | RefundOrderStateError | RefundStateTransitionError; /** Returned if an attempting to refund an Order which is not in the expected state */ export type RefundOrderStateError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; orderState: Scalars['String']['output']; }; /** * Returned when a call to modifyOrder fails to include a refundPaymentId even * though the price has decreased as a result of the changes. */ export type RefundPaymentIdMissingError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned when there is an error in transitioning the Refund state */ export type RefundStateTransitionError = ErrorResult & { errorCode: ErrorCode; fromState: Scalars['String']['output']; message: Scalars['String']['output']; toState: Scalars['String']['output']; transitionError: Scalars['String']['output']; }; export type Region = { code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; enabled: Scalars['Boolean']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; parent?: Maybe<Region>; parentId?: Maybe<Scalars['ID']['output']>; translations: Array<RegionTranslation>; type: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type RegionTranslation = { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type RelationCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; entity: Scalars['String']['output']; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; scalarFields: Array<Scalars['String']['output']>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type Release = Node & StockMovement & { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; productVariant: ProductVariant; quantity: Scalars['Int']['output']; type: StockMovementType; updatedAt: Scalars['DateTime']['output']; }; export type RemoveCollectionsFromChannelInput = { channelId: Scalars['ID']['input']; collectionIds: Array<Scalars['ID']['input']>; }; export type RemoveFacetFromChannelResult = Facet | FacetInUseError; export type RemoveFacetsFromChannelInput = { channelId: Scalars['ID']['input']; facetIds: Array<Scalars['ID']['input']>; force?: InputMaybe<Scalars['Boolean']['input']>; }; export type RemoveOptionGroupFromProductResult = Product | ProductOptionInUseError; export type RemoveOrderItemsResult = Order | OrderModificationError; export type RemovePaymentMethodsFromChannelInput = { channelId: Scalars['ID']['input']; paymentMethodIds: Array<Scalars['ID']['input']>; }; export type RemoveProductVariantsFromChannelInput = { channelId: Scalars['ID']['input']; productVariantIds: Array<Scalars['ID']['input']>; }; export type RemoveProductsFromChannelInput = { channelId: Scalars['ID']['input']; productIds: Array<Scalars['ID']['input']>; }; export type RemovePromotionsFromChannelInput = { channelId: Scalars['ID']['input']; promotionIds: Array<Scalars['ID']['input']>; }; export type RemoveShippingMethodsFromChannelInput = { channelId: Scalars['ID']['input']; shippingMethodIds: Array<Scalars['ID']['input']>; }; export type RemoveStockLocationsFromChannelInput = { channelId: Scalars['ID']['input']; stockLocationIds: Array<Scalars['ID']['input']>; }; export type Return = Node & StockMovement & { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; productVariant: ProductVariant; quantity: Scalars['Int']['output']; type: StockMovementType; updatedAt: Scalars['DateTime']['output']; }; export type Role = Node & { channels: Array<Channel>; code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; description: Scalars['String']['output']; id: Scalars['ID']['output']; permissions: Array<Permission>; updatedAt: Scalars['DateTime']['output']; }; export type RoleFilterParameter = { _and?: InputMaybe<Array<RoleFilterParameter>>; _or?: InputMaybe<Array<RoleFilterParameter>>; code?: InputMaybe<StringOperators>; createdAt?: InputMaybe<DateOperators>; description?: InputMaybe<StringOperators>; id?: InputMaybe<IdOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type RoleList = PaginatedList & { items: Array<Role>; totalItems: Scalars['Int']['output']; }; export type RoleListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<RoleFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<RoleSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type RoleSortParameter = { code?: InputMaybe<SortOrder>; createdAt?: InputMaybe<SortOrder>; description?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type Sale = Node & StockMovement & { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; productVariant: ProductVariant; quantity: Scalars['Int']['output']; type: StockMovementType; updatedAt: Scalars['DateTime']['output']; }; export type SearchInput = { collectionId?: InputMaybe<Scalars['ID']['input']>; collectionSlug?: InputMaybe<Scalars['String']['input']>; facetValueFilters?: InputMaybe<Array<FacetValueFilterInput>>; /** @deprecated Use `facetValueFilters` instead */ facetValueIds?: InputMaybe<Array<Scalars['ID']['input']>>; /** @deprecated Use `facetValueFilters` instead */ facetValueOperator?: InputMaybe<LogicalOperator>; groupByProduct?: InputMaybe<Scalars['Boolean']['input']>; skip?: InputMaybe<Scalars['Int']['input']>; sort?: InputMaybe<SearchResultSortParameter>; take?: InputMaybe<Scalars['Int']['input']>; term?: InputMaybe<Scalars['String']['input']>; }; export type SearchReindexResponse = { success: Scalars['Boolean']['output']; }; export type SearchResponse = { collections: Array<CollectionResult>; facetValues: Array<FacetValueResult>; items: Array<SearchResult>; totalItems: Scalars['Int']['output']; }; export type SearchResult = { /** An array of ids of the Channels in which this result appears */ channelIds: Array<Scalars['ID']['output']>; /** An array of ids of the Collections in which this result appears */ collectionIds: Array<Scalars['ID']['output']>; currencyCode: CurrencyCode; description: Scalars['String']['output']; enabled: Scalars['Boolean']['output']; facetIds: Array<Scalars['ID']['output']>; facetValueIds: Array<Scalars['ID']['output']>; price: SearchResultPrice; priceWithTax: SearchResultPrice; productAsset?: Maybe<SearchResultAsset>; productId: Scalars['ID']['output']; productName: Scalars['String']['output']; productVariantAsset?: Maybe<SearchResultAsset>; productVariantId: Scalars['ID']['output']; productVariantName: Scalars['String']['output']; /** A relevance score for the result. Differs between database implementations */ score: Scalars['Float']['output']; sku: Scalars['String']['output']; slug: Scalars['String']['output']; }; export type SearchResultAsset = { focalPoint?: Maybe<Coordinate>; id: Scalars['ID']['output']; preview: Scalars['String']['output']; }; /** The price of a search result product, either as a range or as a single price */ export type SearchResultPrice = PriceRange | SinglePrice; export type SearchResultSortParameter = { name?: InputMaybe<SortOrder>; price?: InputMaybe<SortOrder>; }; export type Seller = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type SellerFilterParameter = { _and?: InputMaybe<Array<SellerFilterParameter>>; _or?: InputMaybe<Array<SellerFilterParameter>>; createdAt?: InputMaybe<DateOperators>; id?: InputMaybe<IdOperators>; name?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type SellerList = PaginatedList & { items: Array<Seller>; totalItems: Scalars['Int']['output']; }; export type SellerListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<SellerFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<SellerSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type SellerSortParameter = { createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type ServerConfig = { /** * This field is deprecated in v2.2 in favor of the entityCustomFields field, * which allows custom fields to be defined on user-supplies entities. */ customFieldConfig: CustomFields; entityCustomFields: Array<EntityCustomFields>; moneyStrategyPrecision: Scalars['Int']['output']; orderProcess: Array<OrderProcessState>; permissions: Array<PermissionDefinition>; permittedAssetTypes: Array<Scalars['String']['output']>; }; export type SetCustomerForDraftOrderResult = EmailAddressConflictError | Order; export type SetOrderCustomerInput = { customerId: Scalars['ID']['input']; note?: InputMaybe<Scalars['String']['input']>; orderId: Scalars['ID']['input']; }; export type SetOrderShippingMethodResult = IneligibleShippingMethodError | NoActiveOrderError | Order | OrderModificationError; /** Returned if the Payment settlement fails */ export type SettlePaymentError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; paymentErrorMessage: Scalars['String']['output']; }; export type SettlePaymentResult = OrderStateTransitionError | Payment | PaymentStateTransitionError | SettlePaymentError; export type SettleRefundInput = { id: Scalars['ID']['input']; transactionId: Scalars['String']['input']; }; export type SettleRefundResult = Refund | RefundStateTransitionError; export type ShippingLine = { discountedPrice: Scalars['Money']['output']; discountedPriceWithTax: Scalars['Money']['output']; discounts: Array<Discount>; id: Scalars['ID']['output']; price: Scalars['Money']['output']; priceWithTax: Scalars['Money']['output']; shippingMethod: ShippingMethod; }; export type ShippingMethod = Node & { calculator: ConfigurableOperation; checker: ConfigurableOperation; code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; fulfillmentHandlerCode: Scalars['String']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; translations: Array<ShippingMethodTranslation>; updatedAt: Scalars['DateTime']['output']; }; export type ShippingMethodFilterParameter = { _and?: InputMaybe<Array<ShippingMethodFilterParameter>>; _or?: InputMaybe<Array<ShippingMethodFilterParameter>>; code?: InputMaybe<StringOperators>; createdAt?: InputMaybe<DateOperators>; description?: InputMaybe<StringOperators>; fulfillmentHandlerCode?: InputMaybe<StringOperators>; id?: InputMaybe<IdOperators>; languageCode?: InputMaybe<StringOperators>; name?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type ShippingMethodList = PaginatedList & { items: Array<ShippingMethod>; totalItems: Scalars['Int']['output']; }; export type ShippingMethodListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<ShippingMethodFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<ShippingMethodSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type ShippingMethodQuote = { code: Scalars['String']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; id: Scalars['ID']['output']; /** Any optional metadata returned by the ShippingCalculator in the ShippingCalculationResult */ metadata?: Maybe<Scalars['JSON']['output']>; name: Scalars['String']['output']; price: Scalars['Money']['output']; priceWithTax: Scalars['Money']['output']; }; export type ShippingMethodSortParameter = { code?: InputMaybe<SortOrder>; createdAt?: InputMaybe<SortOrder>; description?: InputMaybe<SortOrder>; fulfillmentHandlerCode?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type ShippingMethodTranslation = { createdAt: Scalars['DateTime']['output']; description: Scalars['String']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type ShippingMethodTranslationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; description?: InputMaybe<Scalars['String']['input']>; id?: InputMaybe<Scalars['ID']['input']>; languageCode: LanguageCode; name?: InputMaybe<Scalars['String']['input']>; }; /** The price value where the result has a single price */ export type SinglePrice = { value: Scalars['Money']['output']; }; export enum SortOrder { ASC = 'ASC', DESC = 'DESC' } export type StockAdjustment = Node & StockMovement & { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; productVariant: ProductVariant; quantity: Scalars['Int']['output']; type: StockMovementType; updatedAt: Scalars['DateTime']['output']; }; export type StockLevel = Node & { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; stockAllocated: Scalars['Int']['output']; stockLocation: StockLocation; stockLocationId: Scalars['ID']['output']; stockOnHand: Scalars['Int']['output']; updatedAt: Scalars['DateTime']['output']; }; export type StockLevelInput = { stockLocationId: Scalars['ID']['input']; stockOnHand: Scalars['Int']['input']; }; export type StockLocation = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; id: Scalars['ID']['output']; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type StockLocationFilterParameter = { _and?: InputMaybe<Array<StockLocationFilterParameter>>; _or?: InputMaybe<Array<StockLocationFilterParameter>>; createdAt?: InputMaybe<DateOperators>; description?: InputMaybe<StringOperators>; id?: InputMaybe<IdOperators>; name?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type StockLocationList = PaginatedList & { items: Array<StockLocation>; totalItems: Scalars['Int']['output']; }; export type StockLocationListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<StockLocationFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<StockLocationSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type StockLocationSortParameter = { createdAt?: InputMaybe<SortOrder>; description?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type StockMovement = { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; productVariant: ProductVariant; quantity: Scalars['Int']['output']; type: StockMovementType; updatedAt: Scalars['DateTime']['output']; }; export type StockMovementItem = Allocation | Cancellation | Release | Return | Sale | StockAdjustment; export type StockMovementList = { items: Array<StockMovementItem>; totalItems: Scalars['Int']['output']; }; export type StockMovementListOptions = { skip?: InputMaybe<Scalars['Int']['input']>; take?: InputMaybe<Scalars['Int']['input']>; type?: InputMaybe<StockMovementType>; }; export enum StockMovementType { ADJUSTMENT = 'ADJUSTMENT', ALLOCATION = 'ALLOCATION', CANCELLATION = 'CANCELLATION', RELEASE = 'RELEASE', RETURN = 'RETURN', SALE = 'SALE' } export type StringCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; length?: Maybe<Scalars['Int']['output']>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; options?: Maybe<Array<StringFieldOption>>; pattern?: Maybe<Scalars['String']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type StringFieldOption = { label?: Maybe<Array<LocalizedString>>; value: Scalars['String']['output']; }; /** Operators for filtering on a list of String fields */ export type StringListOperators = { inList: Scalars['String']['input']; }; /** Operators for filtering on a String field */ export type StringOperators = { contains?: InputMaybe<Scalars['String']['input']>; eq?: InputMaybe<Scalars['String']['input']>; in?: InputMaybe<Array<Scalars['String']['input']>>; isNull?: InputMaybe<Scalars['Boolean']['input']>; notContains?: InputMaybe<Scalars['String']['input']>; notEq?: InputMaybe<Scalars['String']['input']>; notIn?: InputMaybe<Array<Scalars['String']['input']>>; regex?: InputMaybe<Scalars['String']['input']>; }; /** Indicates that an operation succeeded, where we do not want to return any more specific information. */ export type Success = { success: Scalars['Boolean']['output']; }; export type Surcharge = Node & { createdAt: Scalars['DateTime']['output']; description: Scalars['String']['output']; id: Scalars['ID']['output']; price: Scalars['Money']['output']; priceWithTax: Scalars['Money']['output']; sku?: Maybe<Scalars['String']['output']>; taxLines: Array<TaxLine>; taxRate: Scalars['Float']['output']; updatedAt: Scalars['DateTime']['output']; }; export type SurchargeInput = { description: Scalars['String']['input']; price: Scalars['Money']['input']; priceIncludesTax: Scalars['Boolean']['input']; sku?: InputMaybe<Scalars['String']['input']>; taxDescription?: InputMaybe<Scalars['String']['input']>; taxRate?: InputMaybe<Scalars['Float']['input']>; }; export type Tag = Node & { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; updatedAt: Scalars['DateTime']['output']; value: Scalars['String']['output']; }; export type TagFilterParameter = { _and?: InputMaybe<Array<TagFilterParameter>>; _or?: InputMaybe<Array<TagFilterParameter>>; createdAt?: InputMaybe<DateOperators>; id?: InputMaybe<IdOperators>; updatedAt?: InputMaybe<DateOperators>; value?: InputMaybe<StringOperators>; }; export type TagList = PaginatedList & { items: Array<Tag>; totalItems: Scalars['Int']['output']; }; export type TagListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<TagFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<TagSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type TagSortParameter = { createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; value?: InputMaybe<SortOrder>; }; export type TaxCategory = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; isDefault: Scalars['Boolean']['output']; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type TaxCategoryFilterParameter = { _and?: InputMaybe<Array<TaxCategoryFilterParameter>>; _or?: InputMaybe<Array<TaxCategoryFilterParameter>>; createdAt?: InputMaybe<DateOperators>; id?: InputMaybe<IdOperators>; isDefault?: InputMaybe<BooleanOperators>; name?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type TaxCategoryList = PaginatedList & { items: Array<TaxCategory>; totalItems: Scalars['Int']['output']; }; export type TaxCategoryListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<TaxCategoryFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<TaxCategorySortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type TaxCategorySortParameter = { createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type TaxLine = { description: Scalars['String']['output']; taxRate: Scalars['Float']['output']; }; export type TaxRate = Node & { category: TaxCategory; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; customerGroup?: Maybe<CustomerGroup>; enabled: Scalars['Boolean']['output']; id: Scalars['ID']['output']; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; value: Scalars['Float']['output']; zone: Zone; }; export type TaxRateFilterParameter = { _and?: InputMaybe<Array<TaxRateFilterParameter>>; _or?: InputMaybe<Array<TaxRateFilterParameter>>; createdAt?: InputMaybe<DateOperators>; enabled?: InputMaybe<BooleanOperators>; id?: InputMaybe<IdOperators>; name?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; value?: InputMaybe<NumberOperators>; }; export type TaxRateList = PaginatedList & { items: Array<TaxRate>; totalItems: Scalars['Int']['output']; }; export type TaxRateListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<TaxRateFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<TaxRateSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type TaxRateSortParameter = { createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; value?: InputMaybe<SortOrder>; }; export type TestEligibleShippingMethodsInput = { lines: Array<TestShippingMethodOrderLineInput>; shippingAddress: CreateAddressInput; }; export type TestShippingMethodInput = { calculator: ConfigurableOperationInput; checker: ConfigurableOperationInput; lines: Array<TestShippingMethodOrderLineInput>; shippingAddress: CreateAddressInput; }; export type TestShippingMethodOrderLineInput = { productVariantId: Scalars['ID']['input']; quantity: Scalars['Int']['input']; }; export type TestShippingMethodQuote = { metadata?: Maybe<Scalars['JSON']['output']>; price: Scalars['Money']['output']; priceWithTax: Scalars['Money']['output']; }; export type TestShippingMethodResult = { eligible: Scalars['Boolean']['output']; quote?: Maybe<TestShippingMethodQuote>; }; export type TextCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type TransitionFulfillmentToStateResult = Fulfillment | FulfillmentStateTransitionError; export type TransitionOrderToStateResult = Order | OrderStateTransitionError; export type TransitionPaymentToStateResult = Payment | PaymentStateTransitionError; export type UpdateActiveAdministratorInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; emailAddress?: InputMaybe<Scalars['String']['input']>; firstName?: InputMaybe<Scalars['String']['input']>; lastName?: InputMaybe<Scalars['String']['input']>; password?: InputMaybe<Scalars['String']['input']>; }; export type UpdateAddressInput = { city?: InputMaybe<Scalars['String']['input']>; company?: InputMaybe<Scalars['String']['input']>; countryCode?: InputMaybe<Scalars['String']['input']>; customFields?: InputMaybe<Scalars['JSON']['input']>; defaultBillingAddress?: InputMaybe<Scalars['Boolean']['input']>; defaultShippingAddress?: InputMaybe<Scalars['Boolean']['input']>; fullName?: InputMaybe<Scalars['String']['input']>; id: Scalars['ID']['input']; phoneNumber?: InputMaybe<Scalars['String']['input']>; postalCode?: InputMaybe<Scalars['String']['input']>; province?: InputMaybe<Scalars['String']['input']>; streetLine1?: InputMaybe<Scalars['String']['input']>; streetLine2?: InputMaybe<Scalars['String']['input']>; }; export type UpdateAdministratorInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; emailAddress?: InputMaybe<Scalars['String']['input']>; firstName?: InputMaybe<Scalars['String']['input']>; id: Scalars['ID']['input']; lastName?: InputMaybe<Scalars['String']['input']>; password?: InputMaybe<Scalars['String']['input']>; roleIds?: InputMaybe<Array<Scalars['ID']['input']>>; }; export type UpdateAssetInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; focalPoint?: InputMaybe<CoordinateInput>; id: Scalars['ID']['input']; name?: InputMaybe<Scalars['String']['input']>; tags?: InputMaybe<Array<Scalars['String']['input']>>; }; export type UpdateChannelInput = { availableCurrencyCodes?: InputMaybe<Array<CurrencyCode>>; availableLanguageCodes?: InputMaybe<Array<LanguageCode>>; code?: InputMaybe<Scalars['String']['input']>; /** @deprecated Use defaultCurrencyCode instead */ currencyCode?: InputMaybe<CurrencyCode>; customFields?: InputMaybe<Scalars['JSON']['input']>; defaultCurrencyCode?: InputMaybe<CurrencyCode>; defaultLanguageCode?: InputMaybe<LanguageCode>; defaultShippingZoneId?: InputMaybe<Scalars['ID']['input']>; defaultTaxZoneId?: InputMaybe<Scalars['ID']['input']>; id: Scalars['ID']['input']; outOfStockThreshold?: InputMaybe<Scalars['Int']['input']>; pricesIncludeTax?: InputMaybe<Scalars['Boolean']['input']>; sellerId?: InputMaybe<Scalars['ID']['input']>; token?: InputMaybe<Scalars['String']['input']>; trackInventory?: InputMaybe<Scalars['Boolean']['input']>; }; export type UpdateChannelResult = Channel | LanguageNotAvailableError; export type UpdateCollectionInput = { assetIds?: InputMaybe<Array<Scalars['ID']['input']>>; customFields?: InputMaybe<Scalars['JSON']['input']>; featuredAssetId?: InputMaybe<Scalars['ID']['input']>; filters?: InputMaybe<Array<ConfigurableOperationInput>>; id: Scalars['ID']['input']; inheritFilters?: InputMaybe<Scalars['Boolean']['input']>; isPrivate?: InputMaybe<Scalars['Boolean']['input']>; parentId?: InputMaybe<Scalars['ID']['input']>; translations?: InputMaybe<Array<UpdateCollectionTranslationInput>>; }; export type UpdateCollectionTranslationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; description?: InputMaybe<Scalars['String']['input']>; id?: InputMaybe<Scalars['ID']['input']>; languageCode: LanguageCode; name?: InputMaybe<Scalars['String']['input']>; slug?: InputMaybe<Scalars['String']['input']>; }; export type UpdateCountryInput = { code?: InputMaybe<Scalars['String']['input']>; customFields?: InputMaybe<Scalars['JSON']['input']>; enabled?: InputMaybe<Scalars['Boolean']['input']>; id: Scalars['ID']['input']; translations?: InputMaybe<Array<CountryTranslationInput>>; }; export type UpdateCustomerGroupInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; id: Scalars['ID']['input']; name?: InputMaybe<Scalars['String']['input']>; }; export type UpdateCustomerInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; emailAddress?: InputMaybe<Scalars['String']['input']>; firstName?: InputMaybe<Scalars['String']['input']>; id: Scalars['ID']['input']; lastName?: InputMaybe<Scalars['String']['input']>; phoneNumber?: InputMaybe<Scalars['String']['input']>; title?: InputMaybe<Scalars['String']['input']>; }; export type UpdateCustomerNoteInput = { note: Scalars['String']['input']; noteId: Scalars['ID']['input']; }; export type UpdateCustomerResult = Customer | EmailAddressConflictError; export type UpdateFacetInput = { code?: InputMaybe<Scalars['String']['input']>; customFields?: InputMaybe<Scalars['JSON']['input']>; id: Scalars['ID']['input']; isPrivate?: InputMaybe<Scalars['Boolean']['input']>; translations?: InputMaybe<Array<FacetTranslationInput>>; }; export type UpdateFacetValueInput = { code?: InputMaybe<Scalars['String']['input']>; customFields?: InputMaybe<Scalars['JSON']['input']>; id: Scalars['ID']['input']; translations?: InputMaybe<Array<FacetValueTranslationInput>>; }; export type UpdateGlobalSettingsInput = { availableLanguages?: InputMaybe<Array<LanguageCode>>; customFields?: InputMaybe<Scalars['JSON']['input']>; outOfStockThreshold?: InputMaybe<Scalars['Int']['input']>; trackInventory?: InputMaybe<Scalars['Boolean']['input']>; }; export type UpdateGlobalSettingsResult = ChannelDefaultLanguageError | GlobalSettings; export type UpdateOrderAddressInput = { city?: InputMaybe<Scalars['String']['input']>; company?: InputMaybe<Scalars['String']['input']>; countryCode?: InputMaybe<Scalars['String']['input']>; fullName?: InputMaybe<Scalars['String']['input']>; phoneNumber?: InputMaybe<Scalars['String']['input']>; postalCode?: InputMaybe<Scalars['String']['input']>; province?: InputMaybe<Scalars['String']['input']>; streetLine1?: InputMaybe<Scalars['String']['input']>; streetLine2?: InputMaybe<Scalars['String']['input']>; }; export type UpdateOrderInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; id: Scalars['ID']['input']; }; export type UpdateOrderItemsResult = InsufficientStockError | NegativeQuantityError | Order | OrderLimitError | OrderModificationError; export type UpdateOrderNoteInput = { isPublic?: InputMaybe<Scalars['Boolean']['input']>; note?: InputMaybe<Scalars['String']['input']>; noteId: Scalars['ID']['input']; }; export type UpdatePaymentMethodInput = { checker?: InputMaybe<ConfigurableOperationInput>; code?: InputMaybe<Scalars['String']['input']>; customFields?: InputMaybe<Scalars['JSON']['input']>; enabled?: InputMaybe<Scalars['Boolean']['input']>; handler?: InputMaybe<ConfigurableOperationInput>; id: Scalars['ID']['input']; translations?: InputMaybe<Array<PaymentMethodTranslationInput>>; }; export type UpdateProductInput = { assetIds?: InputMaybe<Array<Scalars['ID']['input']>>; customFields?: InputMaybe<Scalars['JSON']['input']>; enabled?: InputMaybe<Scalars['Boolean']['input']>; facetValueIds?: InputMaybe<Array<Scalars['ID']['input']>>; featuredAssetId?: InputMaybe<Scalars['ID']['input']>; id: Scalars['ID']['input']; translations?: InputMaybe<Array<ProductTranslationInput>>; }; export type UpdateProductOptionGroupInput = { code?: InputMaybe<Scalars['String']['input']>; customFields?: InputMaybe<Scalars['JSON']['input']>; id: Scalars['ID']['input']; translations?: InputMaybe<Array<ProductOptionGroupTranslationInput>>; }; export type UpdateProductOptionInput = { code?: InputMaybe<Scalars['String']['input']>; customFields?: InputMaybe<Scalars['JSON']['input']>; id: Scalars['ID']['input']; translations?: InputMaybe<Array<ProductOptionGroupTranslationInput>>; }; export type UpdateProductVariantInput = { assetIds?: InputMaybe<Array<Scalars['ID']['input']>>; customFields?: InputMaybe<Scalars['JSON']['input']>; enabled?: InputMaybe<Scalars['Boolean']['input']>; facetValueIds?: InputMaybe<Array<Scalars['ID']['input']>>; featuredAssetId?: InputMaybe<Scalars['ID']['input']>; id: Scalars['ID']['input']; optionIds?: InputMaybe<Array<Scalars['ID']['input']>>; outOfStockThreshold?: InputMaybe<Scalars['Int']['input']>; /** Sets the price for the ProductVariant in the Channel's default currency */ price?: InputMaybe<Scalars['Money']['input']>; /** Allows multiple prices to be set for the ProductVariant in different currencies. */ prices?: InputMaybe<Array<ProductVariantPriceInput>>; sku?: InputMaybe<Scalars['String']['input']>; stockLevels?: InputMaybe<Array<StockLevelInput>>; stockOnHand?: InputMaybe<Scalars['Int']['input']>; taxCategoryId?: InputMaybe<Scalars['ID']['input']>; trackInventory?: InputMaybe<GlobalFlag>; translations?: InputMaybe<Array<ProductVariantTranslationInput>>; useGlobalOutOfStockThreshold?: InputMaybe<Scalars['Boolean']['input']>; }; export type UpdatePromotionInput = { actions?: InputMaybe<Array<ConfigurableOperationInput>>; conditions?: InputMaybe<Array<ConfigurableOperationInput>>; couponCode?: InputMaybe<Scalars['String']['input']>; customFields?: InputMaybe<Scalars['JSON']['input']>; enabled?: InputMaybe<Scalars['Boolean']['input']>; endsAt?: InputMaybe<Scalars['DateTime']['input']>; id: Scalars['ID']['input']; perCustomerUsageLimit?: InputMaybe<Scalars['Int']['input']>; startsAt?: InputMaybe<Scalars['DateTime']['input']>; translations?: InputMaybe<Array<PromotionTranslationInput>>; usageLimit?: InputMaybe<Scalars['Int']['input']>; }; export type UpdatePromotionResult = MissingConditionsError | Promotion; export type UpdateProvinceInput = { code?: InputMaybe<Scalars['String']['input']>; customFields?: InputMaybe<Scalars['JSON']['input']>; enabled?: InputMaybe<Scalars['Boolean']['input']>; id: Scalars['ID']['input']; translations?: InputMaybe<Array<ProvinceTranslationInput>>; }; export type UpdateRoleInput = { channelIds?: InputMaybe<Array<Scalars['ID']['input']>>; code?: InputMaybe<Scalars['String']['input']>; description?: InputMaybe<Scalars['String']['input']>; id: Scalars['ID']['input']; permissions?: InputMaybe<Array<Permission>>; }; export type UpdateSellerInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; id: Scalars['ID']['input']; name?: InputMaybe<Scalars['String']['input']>; }; export type UpdateShippingMethodInput = { calculator?: InputMaybe<ConfigurableOperationInput>; checker?: InputMaybe<ConfigurableOperationInput>; code?: InputMaybe<Scalars['String']['input']>; customFields?: InputMaybe<Scalars['JSON']['input']>; fulfillmentHandler?: InputMaybe<Scalars['String']['input']>; id: Scalars['ID']['input']; translations: Array<ShippingMethodTranslationInput>; }; export type UpdateStockLocationInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; description?: InputMaybe<Scalars['String']['input']>; id: Scalars['ID']['input']; name?: InputMaybe<Scalars['String']['input']>; }; export type UpdateTagInput = { id: Scalars['ID']['input']; value?: InputMaybe<Scalars['String']['input']>; }; export type UpdateTaxCategoryInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; id: Scalars['ID']['input']; isDefault?: InputMaybe<Scalars['Boolean']['input']>; name?: InputMaybe<Scalars['String']['input']>; }; export type UpdateTaxRateInput = { categoryId?: InputMaybe<Scalars['ID']['input']>; customFields?: InputMaybe<Scalars['JSON']['input']>; customerGroupId?: InputMaybe<Scalars['ID']['input']>; enabled?: InputMaybe<Scalars['Boolean']['input']>; id: Scalars['ID']['input']; name?: InputMaybe<Scalars['String']['input']>; value?: InputMaybe<Scalars['Float']['input']>; zoneId?: InputMaybe<Scalars['ID']['input']>; }; export type UpdateZoneInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; id: Scalars['ID']['input']; name?: InputMaybe<Scalars['String']['input']>; }; export type User = Node & { authenticationMethods: Array<AuthenticationMethod>; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; identifier: Scalars['String']['output']; lastLogin?: Maybe<Scalars['DateTime']['output']>; roles: Array<Role>; updatedAt: Scalars['DateTime']['output']; verified: Scalars['Boolean']['output']; }; export type Zone = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; members: Array<Region>; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type ZoneFilterParameter = { _and?: InputMaybe<Array<ZoneFilterParameter>>; _or?: InputMaybe<Array<ZoneFilterParameter>>; createdAt?: InputMaybe<DateOperators>; id?: InputMaybe<IdOperators>; name?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type ZoneList = PaginatedList & { items: Array<Zone>; totalItems: Scalars['Int']['output']; }; export type ZoneListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<ZoneFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<ZoneSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type ZoneSortParameter = { createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type GetAdministratorsQueryVariables = Exact<{ options?: InputMaybe<AdministratorListOptions>; }>; export type GetAdministratorsQuery = { administrators: { totalItems: number, items: Array<{ id: string, firstName: string, lastName: string, emailAddress: string, user: { id: string, identifier: string, lastLogin?: any | null, roles: Array<{ id: string, code: string, description: string, permissions: Array<Permission> }> } }> } }; export type GetAdministratorQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetAdministratorQuery = { administrator?: { id: string, firstName: string, lastName: string, emailAddress: string, user: { id: string, identifier: string, lastLogin?: any | null, roles: Array<{ id: string, code: string, description: string, permissions: Array<Permission> }> } } | null }; export type ActiveAdministratorQueryVariables = Exact<{ [key: string]: never; }>; export type ActiveAdministratorQuery = { activeAdministrator?: { id: string, firstName: string, lastName: string, emailAddress: string, user: { id: string, identifier: string, lastLogin?: any | null, roles: Array<{ id: string, code: string, description: string, permissions: Array<Permission> }> } } | null }; export type UpdateActiveAdministratorMutationVariables = Exact<{ input: UpdateActiveAdministratorInput; }>; export type UpdateActiveAdministratorMutation = { updateActiveAdministrator: { id: string, firstName: string, lastName: string, emailAddress: string, user: { id: string, identifier: string, lastLogin?: any | null, roles: Array<{ id: string, code: string, description: string, permissions: Array<Permission> }> } } }; export type DeleteAdministratorMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteAdministratorMutation = { deleteAdministrator: { message?: string | null, result: DeletionResult } }; export type Q1QueryVariables = Exact<{ [key: string]: never; }>; export type Q1Query = { product?: { id: string, name: string } | null }; export type Q2QueryVariables = Exact<{ [key: string]: never; }>; export type Q2Query = { product?: { id: string, name: string } | null }; export type GetCollectionWithAssetsQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetCollectionWithAssetsQuery = { collection?: { id: string, name: string, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }> } | null }; export type AssignAssetsToChannelMutationVariables = Exact<{ input: AssignAssetsToChannelInput; }>; export type AssignAssetsToChannelMutation = { assignAssetsToChannel: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }> }; export type CanCreateCustomerMutationVariables = Exact<{ input: CreateCustomerInput; }>; export type CanCreateCustomerMutation = { createCustomer: { id: string } | {} }; export type GetCustomerCountQueryVariables = Exact<{ [key: string]: never; }>; export type GetCustomerCountQuery = { customers: { totalItems: number } }; export type DeepFieldResolutionTestQueryQueryVariables = Exact<{ [key: string]: never; }>; export type DeepFieldResolutionTestQueryQuery = { product?: { variants: Array<{ taxRateApplied: { customerGroup?: { customers: { items: Array<{ id: string, emailAddress: string }> } } | null } }> } | null }; export type AuthenticateMutationVariables = Exact<{ input: AuthenticationInput; }>; export type AuthenticateMutation = { authenticate: { id: string, identifier: string, channels: Array<{ code: string, token: string, permissions: Array<Permission> }> } | { authenticationError: string, errorCode: ErrorCode, message: string } }; export type GetCustomersQueryVariables = Exact<{ [key: string]: never; }>; export type GetCustomersQuery = { customers: { totalItems: number, items: Array<{ id: string, emailAddress: string }> } }; export type GetCustomerUserAuthQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetCustomerUserAuthQuery = { customer?: { id: string, user?: { id: string, verified: boolean, authenticationMethods: Array<{ id: string, strategy: string }> } | null } | null }; export type DeleteChannelMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteChannelMutation = { deleteChannel: { message?: string | null, result: DeletionResult } }; export type GetChannelQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetChannelQuery = { channel?: { id: string, code: string, token: string, defaultCurrencyCode: CurrencyCode, availableCurrencyCodes: Array<CurrencyCode>, defaultLanguageCode: LanguageCode, availableLanguageCodes?: Array<LanguageCode> | null, outOfStockThreshold?: number | null, pricesIncludeTax: boolean } | null }; export type UpdateGlobalLanguagesMutationVariables = Exact<{ input: UpdateGlobalSettingsInput; }>; export type UpdateGlobalLanguagesMutation = { updateGlobalSettings: { id: string, availableLanguages: Array<LanguageCode> } | {} }; export type GetCollectionsWithAssetsQueryVariables = Exact<{ [key: string]: never; }>; export type GetCollectionsWithAssetsQuery = { collections: { items: Array<{ assets: Array<{ name: string }> }> } }; export type GetProductsWithVariantIdsQueryVariables = Exact<{ [key: string]: never; }>; export type GetProductsWithVariantIdsQuery = { products: { items: Array<{ id: string, name: string, variants: Array<{ id: string, name: string }> }> } }; export type GetCollectionListAdminQueryVariables = Exact<{ options?: InputMaybe<CollectionListOptions>; }>; export type GetCollectionListAdminQuery = { collections: { totalItems: number, items: Array<{ id: string, name: string, slug: string, description: string, isPrivate: boolean, languageCode?: LanguageCode | null, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, filters: Array<{ code: string, args: Array<{ name: string, value: string }> }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string, slug: string, description: string }>, parent?: { id: string, name: string } | null, children?: Array<{ id: string, name: string, position: number }> | null }> } }; export type MoveCollectionMutationVariables = Exact<{ input: MoveCollectionInput; }>; export type MoveCollectionMutation = { moveCollection: { id: string, name: string, slug: string, description: string, isPrivate: boolean, languageCode?: LanguageCode | null, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, filters: Array<{ code: string, args: Array<{ name: string, value: string }> }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string, slug: string, description: string }>, parent?: { id: string, name: string } | null, children?: Array<{ id: string, name: string, position: number }> | null } }; export type GetFacetValuesQueryVariables = Exact<{ [key: string]: never; }>; export type GetFacetValuesQuery = { facets: { items: Array<{ values: Array<{ id: string, languageCode: LanguageCode, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, facet: { id: string, name: string } }> }> } }; export type GetCollectionProductsQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetCollectionProductsQuery = { collection?: { productVariants: { items: Array<{ id: string, name: string, productId: string, facetValues: Array<{ code: string }> }> } } | null }; export type CreateCollectionSelectVariantsMutationVariables = Exact<{ input: CreateCollectionInput; }>; export type CreateCollectionSelectVariantsMutation = { createCollection: { id: string, productVariants: { totalItems: number, items: Array<{ name: string }> } } }; export type GetCollectionBreadcrumbsQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetCollectionBreadcrumbsQuery = { collection?: { breadcrumbs: Array<{ id: string, name: string, slug: string }> } | null }; export type GetCollectionsForProductsQueryVariables = Exact<{ term: Scalars['String']['input']; }>; export type GetCollectionsForProductsQuery = { products: { items: Array<{ id: string, name: string, collections: Array<{ id: string, name: string }> }> } }; export type DeleteCollectionMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteCollectionMutation = { deleteCollection: { result: DeletionResult, message?: string | null } }; export type GetProductCollectionsQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetProductCollectionsQuery = { product?: { id: string, collections: Array<{ id: string, name: string }> } | null }; export type GetProductCollectionsWithParentQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetProductCollectionsWithParentQuery = { product?: { id: string, collections: Array<{ id: string, name: string, parent?: { id: string, name: string } | null }> } | null }; export type GetCollectionNestedParentsQueryVariables = Exact<{ [key: string]: never; }>; export type GetCollectionNestedParentsQuery = { collections: { items: Array<{ id: string, name: string, parent?: { name: string, parent?: { name: string, parent?: { name: string } | null } | null } | null }> } }; export type PreviewCollectionVariantsQueryVariables = Exact<{ input: PreviewCollectionVariantsInput; options?: InputMaybe<ProductVariantListOptions>; }>; export type PreviewCollectionVariantsQuery = { previewCollectionVariants: { totalItems: number, items: Array<{ id: string, name: string }> } }; export type RemoveCollectionsFromChannelMutationVariables = Exact<{ input: RemoveCollectionsFromChannelInput; }>; export type RemoveCollectionsFromChannelMutation = { removeCollectionsFromChannel: Array<{ id: string, name: string, slug: string, description: string, isPrivate: boolean, languageCode?: LanguageCode | null, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, filters: Array<{ code: string, args: Array<{ name: string, value: string }> }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string, slug: string, description: string }>, parent?: { id: string, name: string } | null, children?: Array<{ id: string, name: string, position: number }> | null }> }; export type DeleteCollectionsBulkMutationVariables = Exact<{ ids: Array<Scalars['ID']['input']> | Scalars['ID']['input']; }>; export type DeleteCollectionsBulkMutation = { deleteCollections: Array<{ message?: string | null, result: DeletionResult }> }; export type GetCheckersQueryVariables = Exact<{ [key: string]: never; }>; export type GetCheckersQuery = { shippingEligibilityCheckers: Array<{ code: string, args: Array<{ defaultValue?: any | null, description?: string | null, label?: string | null, list: boolean, name: string, required: boolean, type: string }> }> }; export type DeleteCountryMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteCountryMutation = { deleteCountry: { result: DeletionResult, message?: string | null } }; export type GetCountryQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetCountryQuery = { country?: { id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> } | null }; export type CreateCountryMutationVariables = Exact<{ input: CreateCountryInput; }>; export type CreateCountryMutation = { createCountry: { id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> } }; export type DeleteCustomerAddressMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteCustomerAddressMutation = { deleteCustomerAddress: { success: boolean } }; export type GetCustomerWithUserQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetCustomerWithUserQuery = { customer?: { id: string, user?: { id: string, identifier: string, verified: boolean } | null } | null }; export type GetCustomerOrdersQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetCustomerOrdersQuery = { customer?: { orders: { totalItems: number, items: Array<{ id: string }> } } | null }; export type AddNoteToCustomerMutationVariables = Exact<{ input: AddNoteToCustomerInput; }>; export type AddNoteToCustomerMutation = { addNoteToCustomer: { id: string, title?: string | null, firstName: string, lastName: string, phoneNumber?: string | null, emailAddress: string, user?: { id: string, identifier: string, verified: boolean, lastLogin?: any | null } | null, addresses?: Array<{ id: string, fullName?: string | null, company?: string | null, streetLine1: string, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, phoneNumber?: string | null, defaultShippingAddress?: boolean | null, defaultBillingAddress?: boolean | null, country: { id: string, code: string, name: string } }> | null } }; export type ReindexMutationVariables = Exact<{ [key: string]: never; }>; export type ReindexMutation = { reindex: { id: string } }; export type SearchFacetValuesQueryVariables = Exact<{ input: SearchInput; }>; export type SearchFacetValuesQuery = { search: { totalItems: number, facetValues: Array<{ count: number, facetValue: { id: string, name: string } }> } }; export type SearchCollectionsQueryVariables = Exact<{ input: SearchInput; }>; export type SearchCollectionsQuery = { search: { totalItems: number, collections: Array<{ count: number, collection: { id: string, name: string } }> } }; export type SearchGetAssetsQueryVariables = Exact<{ input: SearchInput; }>; export type SearchGetAssetsQuery = { search: { totalItems: number, items: Array<{ productId: string, productName: string, productVariantName: string, productAsset?: { id: string, preview: string, focalPoint?: { x: number, y: number } | null } | null, productVariantAsset?: { id: string, preview: string, focalPoint?: { x: number, y: number } | null } | null }> } }; export type SearchGetPricesQueryVariables = Exact<{ input: SearchInput; }>; export type SearchGetPricesQuery = { search: { items: Array<{ price: { min: number, max: number } | { value: number }, priceWithTax: { min: number, max: number } | { value: number } }> } }; export type CreateDraftOrderMutationVariables = Exact<{ [key: string]: never; }>; export type CreateDraftOrderMutation = { createDraftOrder: { id: string, createdAt: any, updatedAt: any, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, shipping: number, shippingWithTax: number, customer?: { id: string, firstName: string, lastName: string } | null, lines: Array<{ id: string, unitPrice: number, unitPriceWithTax: number, quantity: number, taxRate: number, linePriceWithTax: number, featuredAsset?: { preview: string } | null, productVariant: { id: string, name: string, sku: string }, taxLines: Array<{ description: string, taxRate: number }> }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, name: string, description: string } }>, shippingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null, payments?: Array<{ id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> }> | null, fulfillments?: Array<{ id: string, state: string, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }> | null } }; export type AddItemToDraftOrderMutationVariables = Exact<{ orderId: Scalars['ID']['input']; input: AddItemToDraftOrderInput; }>; export type AddItemToDraftOrderMutation = { addItemToDraftOrder: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { id: string, createdAt: any, updatedAt: any, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, shipping: number, shippingWithTax: number, customer?: { id: string, firstName: string, lastName: string } | null, lines: Array<{ id: string, unitPrice: number, unitPriceWithTax: number, quantity: number, taxRate: number, linePriceWithTax: number, featuredAsset?: { preview: string } | null, productVariant: { id: string, name: string, sku: string }, taxLines: Array<{ description: string, taxRate: number }> }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, name: string, description: string } }>, shippingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null, payments?: Array<{ id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> }> | null, fulfillments?: Array<{ id: string, state: string, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }> | null } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } }; export type AdjustDraftOrderLineMutationVariables = Exact<{ orderId: Scalars['ID']['input']; input: AdjustDraftOrderLineInput; }>; export type AdjustDraftOrderLineMutation = { adjustDraftOrderLine: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { id: string, createdAt: any, updatedAt: any, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, shipping: number, shippingWithTax: number, customer?: { id: string, firstName: string, lastName: string } | null, lines: Array<{ id: string, unitPrice: number, unitPriceWithTax: number, quantity: number, taxRate: number, linePriceWithTax: number, featuredAsset?: { preview: string } | null, productVariant: { id: string, name: string, sku: string }, taxLines: Array<{ description: string, taxRate: number }> }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, name: string, description: string } }>, shippingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null, payments?: Array<{ id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> }> | null, fulfillments?: Array<{ id: string, state: string, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }> | null } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } }; export type RemoveDraftOrderLineMutationVariables = Exact<{ orderId: Scalars['ID']['input']; orderLineId: Scalars['ID']['input']; }>; export type RemoveDraftOrderLineMutation = { removeDraftOrderLine: { id: string, createdAt: any, updatedAt: any, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, shipping: number, shippingWithTax: number, customer?: { id: string, firstName: string, lastName: string } | null, lines: Array<{ id: string, unitPrice: number, unitPriceWithTax: number, quantity: number, taxRate: number, linePriceWithTax: number, featuredAsset?: { preview: string } | null, productVariant: { id: string, name: string, sku: string }, taxLines: Array<{ description: string, taxRate: number }> }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, name: string, description: string } }>, shippingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null, payments?: Array<{ id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> }> | null, fulfillments?: Array<{ id: string, state: string, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }> | null } | { errorCode: ErrorCode, message: string } }; export type SetCustomerForDraftOrderMutationVariables = Exact<{ orderId: Scalars['ID']['input']; customerId?: InputMaybe<Scalars['ID']['input']>; input?: InputMaybe<CreateCustomerInput>; }>; export type SetCustomerForDraftOrderMutation = { setCustomerForDraftOrder: { errorCode: ErrorCode, message: string } | { id: string, createdAt: any, updatedAt: any, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, shipping: number, shippingWithTax: number, customer?: { id: string, firstName: string, lastName: string } | null, lines: Array<{ id: string, unitPrice: number, unitPriceWithTax: number, quantity: number, taxRate: number, linePriceWithTax: number, featuredAsset?: { preview: string } | null, productVariant: { id: string, name: string, sku: string }, taxLines: Array<{ description: string, taxRate: number }> }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, name: string, description: string } }>, shippingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null, payments?: Array<{ id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> }> | null, fulfillments?: Array<{ id: string, state: string, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }> | null } }; export type SetDraftOrderShippingAddressMutationVariables = Exact<{ orderId: Scalars['ID']['input']; input: CreateAddressInput; }>; export type SetDraftOrderShippingAddressMutation = { setDraftOrderShippingAddress: { id: string, createdAt: any, updatedAt: any, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, shipping: number, shippingWithTax: number, customer?: { id: string, firstName: string, lastName: string } | null, lines: Array<{ id: string, unitPrice: number, unitPriceWithTax: number, quantity: number, taxRate: number, linePriceWithTax: number, featuredAsset?: { preview: string } | null, productVariant: { id: string, name: string, sku: string }, taxLines: Array<{ description: string, taxRate: number }> }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, name: string, description: string } }>, shippingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null, payments?: Array<{ id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> }> | null, fulfillments?: Array<{ id: string, state: string, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }> | null } }; export type SetDraftOrderBillingAddressMutationVariables = Exact<{ orderId: Scalars['ID']['input']; input: CreateAddressInput; }>; export type SetDraftOrderBillingAddressMutation = { setDraftOrderBillingAddress: { id: string, createdAt: any, updatedAt: any, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, shipping: number, shippingWithTax: number, billingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null, customer?: { id: string, firstName: string, lastName: string } | null, lines: Array<{ id: string, unitPrice: number, unitPriceWithTax: number, quantity: number, taxRate: number, linePriceWithTax: number, featuredAsset?: { preview: string } | null, productVariant: { id: string, name: string, sku: string }, taxLines: Array<{ description: string, taxRate: number }> }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, name: string, description: string } }>, shippingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null, payments?: Array<{ id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> }> | null, fulfillments?: Array<{ id: string, state: string, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }> | null } }; export type ApplyCouponCodeToDraftOrderMutationVariables = Exact<{ orderId: Scalars['ID']['input']; couponCode: Scalars['String']['input']; }>; export type ApplyCouponCodeToDraftOrderMutation = { applyCouponCodeToDraftOrder: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { couponCodes: Array<string>, id: string, createdAt: any, updatedAt: any, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, shipping: number, shippingWithTax: number, customer?: { id: string, firstName: string, lastName: string } | null, lines: Array<{ id: string, unitPrice: number, unitPriceWithTax: number, quantity: number, taxRate: number, linePriceWithTax: number, featuredAsset?: { preview: string } | null, productVariant: { id: string, name: string, sku: string }, taxLines: Array<{ description: string, taxRate: number }> }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, name: string, description: string } }>, shippingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null, payments?: Array<{ id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> }> | null, fulfillments?: Array<{ id: string, state: string, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }> | null } }; export type RemoveCouponCodeFromDraftOrderMutationVariables = Exact<{ orderId: Scalars['ID']['input']; couponCode: Scalars['String']['input']; }>; export type RemoveCouponCodeFromDraftOrderMutation = { removeCouponCodeFromDraftOrder?: { couponCodes: Array<string>, id: string, createdAt: any, updatedAt: any, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, shipping: number, shippingWithTax: number, customer?: { id: string, firstName: string, lastName: string } | null, lines: Array<{ id: string, unitPrice: number, unitPriceWithTax: number, quantity: number, taxRate: number, linePriceWithTax: number, featuredAsset?: { preview: string } | null, productVariant: { id: string, name: string, sku: string }, taxLines: Array<{ description: string, taxRate: number }> }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, name: string, description: string } }>, shippingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null, payments?: Array<{ id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> }> | null, fulfillments?: Array<{ id: string, state: string, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }> | null } | null }; export type DraftOrderEligibleShippingMethodsQueryVariables = Exact<{ orderId: Scalars['ID']['input']; }>; export type DraftOrderEligibleShippingMethodsQuery = { eligibleShippingMethodsForDraftOrder: Array<{ id: string, name: string, code: string, description: string, price: number, priceWithTax: number, metadata?: any | null }> }; export type SetDraftOrderShippingMethodMutationVariables = Exact<{ orderId: Scalars['ID']['input']; shippingMethodId: Scalars['ID']['input']; }>; export type SetDraftOrderShippingMethodMutation = { setDraftOrderShippingMethod: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { id: string, createdAt: any, updatedAt: any, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, shipping: number, shippingWithTax: number, customer?: { id: string, firstName: string, lastName: string } | null, lines: Array<{ id: string, unitPrice: number, unitPriceWithTax: number, quantity: number, taxRate: number, linePriceWithTax: number, featuredAsset?: { preview: string } | null, productVariant: { id: string, name: string, sku: string }, taxLines: Array<{ description: string, taxRate: number }> }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, name: string, description: string } }>, shippingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null, payments?: Array<{ id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> }> | null, fulfillments?: Array<{ id: string, state: string, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }> | null } | { errorCode: ErrorCode, message: string } }; export type GetOrderPlacedAtQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetOrderPlacedAtQuery = { order?: { id: string, createdAt: any, updatedAt: any, state: string, orderPlacedAt?: any | null } | null }; export type GetEntityDuplicatorsQueryVariables = Exact<{ [key: string]: never; }>; export type GetEntityDuplicatorsQuery = { entityDuplicators: Array<{ code: string, description: string, requiresPermission: Array<Permission>, forEntities: Array<string>, args: Array<{ name: string, type: string, defaultValue?: any | null }> }> }; export type DuplicateEntityMutationVariables = Exact<{ input: DuplicateEntityInput; }>; export type DuplicateEntityMutation = { duplicateEntity: { message: string, duplicationError: string } | { newEntityId: string } }; export type IdTest1QueryVariables = Exact<{ [key: string]: never; }>; export type IdTest1Query = { products: { items: Array<{ id: string }> } }; export type IdTest2QueryVariables = Exact<{ [key: string]: never; }>; export type IdTest2Query = { products: { items: Array<{ id: string, variants: Array<{ id: string, options: Array<{ id: string, name: string }> }> }> } }; export type IdTest3QueryVariables = Exact<{ [key: string]: never; }>; export type IdTest3Query = { product?: { id: string } | null }; export type IdTest4MutationVariables = Exact<{ [key: string]: never; }>; export type IdTest4Mutation = { updateProduct: { id: string, featuredAsset?: { id: string } | null } }; export type IdTest5MutationVariables = Exact<{ [key: string]: never; }>; export type IdTest5Mutation = { updateProduct: { id: string, name: string } }; export type IdTest6QueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type IdTest6Query = { product?: { id: string } | null }; export type IdTest7MutationVariables = Exact<{ input: UpdateProductInput; }>; export type IdTest7Mutation = { updateProduct: { id: string, featuredAsset?: { id: string } | null } }; export type IdTest8MutationVariables = Exact<{ input: UpdateProductInput; }>; export type IdTest8Mutation = { updateProduct: { id: string, name: string } }; export type IdTest9QueryVariables = Exact<{ [key: string]: never; }>; export type IdTest9Query = { products: { items: Array<{ id: string, featuredAsset?: { id: string } | null }> } }; export type ProdFragmentFragment = { id: string, featuredAsset?: { id: string } | null }; export type IdTest10QueryVariables = Exact<{ [key: string]: never; }>; export type IdTest10Query = { products: { items: Array<{ id: string, featuredAsset?: { id: string } | null }> } }; export type ProdFragment1Fragment = { id: string, featuredAsset?: { id: string } | null }; export type ProdFragment2Fragment = { id: string, featuredAsset?: { id: string } | null }; export type IdTest11QueryVariables = Exact<{ [key: string]: never; }>; export type IdTest11Query = { products: { items: Array<{ id: string, featuredAsset?: { id: string } | null }> } }; export type ProdFragment1_1Fragment = { id: string, featuredAsset?: { id: string } | null }; export type ProdFragment2_1Fragment = { id: string, featuredAsset?: { id: string } | null }; export type ProdFragment3_1Fragment = { id: string, featuredAsset?: { id: string } | null }; export type GetFacetWithValueListQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetFacetWithValueListQuery = { facet?: { id: string, languageCode: LanguageCode, isPrivate: boolean, code: string, name: string, valueList: { totalItems: number, items: Array<{ id: string, languageCode: LanguageCode, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, facet: { id: string, name: string } }> } } | null }; export type DeleteFacetValuesMutationVariables = Exact<{ ids: Array<Scalars['ID']['input']> | Scalars['ID']['input']; force?: InputMaybe<Scalars['Boolean']['input']>; }>; export type DeleteFacetValuesMutation = { deleteFacetValues: Array<{ result: DeletionResult, message?: string | null }> }; export type DeleteFacetMutationVariables = Exact<{ id: Scalars['ID']['input']; force?: InputMaybe<Scalars['Boolean']['input']>; }>; export type DeleteFacetMutation = { deleteFacet: { result: DeletionResult, message?: string | null } }; export type GetProductWithFacetValuesQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetProductWithFacetValuesQuery = { product?: { id: string, facetValues: Array<{ id: string, name: string, code: string }>, variants: Array<{ id: string, facetValues: Array<{ id: string, name: string, code: string }> }> } | null }; export type GetProductListWithVariantsQueryVariables = Exact<{ [key: string]: never; }>; export type GetProductListWithVariantsQuery = { products: { totalItems: number, items: Array<{ id: string, name: string, variants: Array<{ id: string, name: string }> }> } }; export type CreateFacetValuesMutationVariables = Exact<{ input: Array<CreateFacetValueInput> | CreateFacetValueInput; }>; export type CreateFacetValuesMutation = { createFacetValues: Array<{ id: string, languageCode: LanguageCode, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, facet: { id: string, name: string } }> }; export type UpdateFacetValuesMutationVariables = Exact<{ input: Array<UpdateFacetValueInput> | UpdateFacetValueInput; }>; export type UpdateFacetValuesMutation = { updateFacetValues: Array<{ id: string, languageCode: LanguageCode, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, facet: { id: string, name: string } }> }; export type AssignFacetsToChannelMutationVariables = Exact<{ input: AssignFacetsToChannelInput; }>; export type AssignFacetsToChannelMutation = { assignFacetsToChannel: Array<{ id: string, name: string }> }; export type RemoveFacetsFromChannelMutationVariables = Exact<{ input: RemoveFacetsFromChannelInput; }>; export type RemoveFacetsFromChannelMutation = { removeFacetsFromChannel: Array<{ id: string, name: string } | { errorCode: ErrorCode, message: string, productCount: number, variantCount: number }> }; export type GetGlobalSettingsQueryVariables = Exact<{ [key: string]: never; }>; export type GetGlobalSettingsQuery = { globalSettings: { id: string, availableLanguages: Array<LanguageCode>, trackInventory: boolean, outOfStockThreshold: number, serverConfig: { permittedAssetTypes: Array<string>, orderProcess: Array<{ name: string, to: Array<string> }>, permissions: Array<{ name: string, description: string, assignable: boolean }>, customFieldConfig: { Customer: Array<{ name: string } | { name: string } | { name: string } | { name: string } | { name: string } | { name: string } | { name: string } | { name: string } | { name: string }> } } } }; export type SearchProductsAdminQueryVariables = Exact<{ input: SearchInput; }>; export type SearchProductsAdminQuery = { search: { totalItems: number, items: Array<{ enabled: boolean, productId: string, productName: string, slug: string, description: string, productVariantId: string, productVariantName: string, sku: string }> } }; export type AdministratorFragment = { id: string, firstName: string, lastName: string, emailAddress: string, user: { id: string, identifier: string, lastLogin?: any | null, roles: Array<{ id: string, code: string, description: string, permissions: Array<Permission> }> } }; export type AssetFragment = { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }; export type ProductVariantFragment = { id: string, createdAt: any, updatedAt: any, enabled: boolean, languageCode: LanguageCode, name: string, currencyCode: CurrencyCode, price: number, priceWithTax: number, stockOnHand: number, trackInventory: GlobalFlag, sku: string, prices: Array<{ currencyCode: CurrencyCode, price: number }>, taxRateApplied: { id: string, name: string, value: number }, taxCategory: { id: string, name: string }, options: Array<{ id: string, code: string, languageCode: LanguageCode, groupId: string, name: string }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, channels: Array<{ id: string, code: string }> }; export type ProductWithVariantsFragment = { id: string, enabled: boolean, languageCode: LanguageCode, name: string, slug: string, description: string, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ languageCode: LanguageCode, name: string, slug: string, description: string }>, optionGroups: Array<{ id: string, languageCode: LanguageCode, code: string, name: string }>, variants: Array<{ id: string, createdAt: any, updatedAt: any, enabled: boolean, languageCode: LanguageCode, name: string, currencyCode: CurrencyCode, price: number, priceWithTax: number, stockOnHand: number, trackInventory: GlobalFlag, sku: string, prices: Array<{ currencyCode: CurrencyCode, price: number }>, taxRateApplied: { id: string, name: string, value: number }, taxCategory: { id: string, name: string }, options: Array<{ id: string, code: string, languageCode: LanguageCode, groupId: string, name: string }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, channels: Array<{ id: string, code: string }> }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, channels: Array<{ id: string, code: string }> }; export type RoleFragment = { id: string, code: string, description: string, permissions: Array<Permission>, channels: Array<{ id: string, code: string, token: string }> }; export type ConfigurableOperationFragment = { code: string, args: Array<{ name: string, value: string }> }; export type CollectionFragment = { id: string, name: string, slug: string, description: string, isPrivate: boolean, languageCode?: LanguageCode | null, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, filters: Array<{ code: string, args: Array<{ name: string, value: string }> }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string, slug: string, description: string }>, parent?: { id: string, name: string } | null, children?: Array<{ id: string, name: string, position: number }> | null }; export type FacetValueFragment = { id: string, languageCode: LanguageCode, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, facet: { id: string, name: string } }; export type FacetWithValuesFragment = { id: string, languageCode: LanguageCode, isPrivate: boolean, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, values: Array<{ id: string, languageCode: LanguageCode, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, facet: { id: string, name: string } }> }; type Country_Country_Fragment = { id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> }; type Country_Province_Fragment = { id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> }; export type CountryFragment = Country_Country_Fragment | Country_Province_Fragment; export type AddressFragment = { id: string, fullName?: string | null, company?: string | null, streetLine1: string, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, phoneNumber?: string | null, defaultShippingAddress?: boolean | null, defaultBillingAddress?: boolean | null, country: { id: string, code: string, name: string } }; export type CustomerFragment = { id: string, title?: string | null, firstName: string, lastName: string, phoneNumber?: string | null, emailAddress: string, user?: { id: string, identifier: string, verified: boolean, lastLogin?: any | null } | null, addresses?: Array<{ id: string, fullName?: string | null, company?: string | null, streetLine1: string, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, phoneNumber?: string | null, defaultShippingAddress?: boolean | null, defaultBillingAddress?: boolean | null, country: { id: string, code: string, name: string } }> | null }; export type AdjustmentFragment = { adjustmentSource: string, amount: number, description: string, type: AdjustmentType }; export type ShippingAddressFragment = { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null }; export type OrderFragment = { id: string, createdAt: any, updatedAt: any, code: string, active: boolean, state: string, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, customer?: { id: string, firstName: string, lastName: string } | null }; export type PaymentFragment = { id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> }; export type OrderWithLinesFragment = { id: string, createdAt: any, updatedAt: any, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, shipping: number, shippingWithTax: number, customer?: { id: string, firstName: string, lastName: string } | null, lines: Array<{ id: string, unitPrice: number, unitPriceWithTax: number, quantity: number, taxRate: number, linePriceWithTax: number, featuredAsset?: { preview: string } | null, productVariant: { id: string, name: string, sku: string }, taxLines: Array<{ description: string, taxRate: number }> }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, name: string, description: string } }>, shippingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null, payments?: Array<{ id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> }> | null, fulfillments?: Array<{ id: string, state: string, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }> | null }; export type PromotionFragment = { id: string, createdAt: any, updatedAt: any, couponCode?: string | null, startsAt?: any | null, endsAt?: any | null, name: string, description: string, enabled: boolean, perCustomerUsageLimit?: number | null, usageLimit?: number | null, conditions: Array<{ code: string, args: Array<{ name: string, value: string }> }>, actions: Array<{ code: string, args: Array<{ name: string, value: string }> }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string, description: string }> }; export type ZoneFragment = { id: string, name: string, members: Array<{ id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> } | { id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> }> }; export type TaxRateFragment = { id: string, name: string, enabled: boolean, value: number, category: { id: string, name: string }, zone: { id: string, name: string }, customerGroup?: { id: string, name: string } | null }; export type CurrentUserFragment = { id: string, identifier: string, channels: Array<{ code: string, token: string, permissions: Array<Permission> }> }; export type VariantWithStockFragment = { id: string, stockOnHand: number, stockAllocated: number, stockMovements: { totalItems: number, items: Array<{ id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number }> } }; export type FulfillmentFragment = { id: string, state: string, nextStates: Array<string>, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }; export type ChannelFragment = { id: string, code: string, token: string, currencyCode: CurrencyCode, availableCurrencyCodes: Array<CurrencyCode>, defaultCurrencyCode: CurrencyCode, defaultLanguageCode: LanguageCode, pricesIncludeTax: boolean, defaultShippingZone?: { id: string } | null, defaultTaxZone?: { id: string } | null }; export type GlobalSettingsFragment = { id: string, availableLanguages: Array<LanguageCode>, trackInventory: boolean, outOfStockThreshold: number, serverConfig: { permittedAssetTypes: Array<string>, orderProcess: Array<{ name: string, to: Array<string> }>, permissions: Array<{ name: string, description: string, assignable: boolean }>, customFieldConfig: { Customer: Array<{ name: string } | { name: string } | { name: string } | { name: string } | { name: string } | { name: string } | { name: string } | { name: string } | { name: string }> } } }; export type CustomerGroupFragment = { id: string, name: string, customers: { totalItems: number, items: Array<{ id: string }> } }; export type ProductOptionGroupFragment = { id: string, code: string, name: string, options: Array<{ id: string, code: string, name: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> }; export type ProductWithOptionsFragment = { id: string, optionGroups: Array<{ id: string, code: string, options: Array<{ id: string, code: string }> }> }; export type ShippingMethodFragment = { id: string, code: string, name: string, description: string, calculator: { code: string, args: Array<{ name: string, value: string }> }, checker: { code: string, args: Array<{ name: string, value: string }> } }; export type CreateAdministratorMutationVariables = Exact<{ input: CreateAdministratorInput; }>; export type CreateAdministratorMutation = { createAdministrator: { id: string, firstName: string, lastName: string, emailAddress: string, user: { id: string, identifier: string, lastLogin?: any | null, roles: Array<{ id: string, code: string, description: string, permissions: Array<Permission> }> } } }; export type UpdateProductMutationVariables = Exact<{ input: UpdateProductInput; }>; export type UpdateProductMutation = { updateProduct: { id: string, enabled: boolean, languageCode: LanguageCode, name: string, slug: string, description: string, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ languageCode: LanguageCode, name: string, slug: string, description: string }>, optionGroups: Array<{ id: string, languageCode: LanguageCode, code: string, name: string }>, variants: Array<{ id: string, createdAt: any, updatedAt: any, enabled: boolean, languageCode: LanguageCode, name: string, currencyCode: CurrencyCode, price: number, priceWithTax: number, stockOnHand: number, trackInventory: GlobalFlag, sku: string, prices: Array<{ currencyCode: CurrencyCode, price: number }>, taxRateApplied: { id: string, name: string, value: number }, taxCategory: { id: string, name: string }, options: Array<{ id: string, code: string, languageCode: LanguageCode, groupId: string, name: string }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, channels: Array<{ id: string, code: string }> }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, channels: Array<{ id: string, code: string }> } }; export type CreateProductMutationVariables = Exact<{ input: CreateProductInput; }>; export type CreateProductMutation = { createProduct: { id: string, enabled: boolean, languageCode: LanguageCode, name: string, slug: string, description: string, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ languageCode: LanguageCode, name: string, slug: string, description: string }>, optionGroups: Array<{ id: string, languageCode: LanguageCode, code: string, name: string }>, variants: Array<{ id: string, createdAt: any, updatedAt: any, enabled: boolean, languageCode: LanguageCode, name: string, currencyCode: CurrencyCode, price: number, priceWithTax: number, stockOnHand: number, trackInventory: GlobalFlag, sku: string, prices: Array<{ currencyCode: CurrencyCode, price: number }>, taxRateApplied: { id: string, name: string, value: number }, taxCategory: { id: string, name: string }, options: Array<{ id: string, code: string, languageCode: LanguageCode, groupId: string, name: string }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, channels: Array<{ id: string, code: string }> }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, channels: Array<{ id: string, code: string }> } }; export type GetProductWithVariantsQueryVariables = Exact<{ id?: InputMaybe<Scalars['ID']['input']>; slug?: InputMaybe<Scalars['String']['input']>; }>; export type GetProductWithVariantsQuery = { product?: { id: string, enabled: boolean, languageCode: LanguageCode, name: string, slug: string, description: string, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ languageCode: LanguageCode, name: string, slug: string, description: string }>, optionGroups: Array<{ id: string, languageCode: LanguageCode, code: string, name: string }>, variants: Array<{ id: string, createdAt: any, updatedAt: any, enabled: boolean, languageCode: LanguageCode, name: string, currencyCode: CurrencyCode, price: number, priceWithTax: number, stockOnHand: number, trackInventory: GlobalFlag, sku: string, prices: Array<{ currencyCode: CurrencyCode, price: number }>, taxRateApplied: { id: string, name: string, value: number }, taxCategory: { id: string, name: string }, options: Array<{ id: string, code: string, languageCode: LanguageCode, groupId: string, name: string }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, channels: Array<{ id: string, code: string }> }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, channels: Array<{ id: string, code: string }> } | null }; export type GetProductListQueryVariables = Exact<{ options?: InputMaybe<ProductListOptions>; }>; export type GetProductListQuery = { products: { totalItems: number, items: Array<{ id: string, languageCode: LanguageCode, name: string, slug: string, featuredAsset?: { id: string, preview: string } | null }> } }; export type CreateProductVariantsMutationVariables = Exact<{ input: Array<CreateProductVariantInput> | CreateProductVariantInput; }>; export type CreateProductVariantsMutation = { createProductVariants: Array<{ id: string, createdAt: any, updatedAt: any, enabled: boolean, languageCode: LanguageCode, name: string, currencyCode: CurrencyCode, price: number, priceWithTax: number, stockOnHand: number, trackInventory: GlobalFlag, sku: string, prices: Array<{ currencyCode: CurrencyCode, price: number }>, taxRateApplied: { id: string, name: string, value: number }, taxCategory: { id: string, name: string }, options: Array<{ id: string, code: string, languageCode: LanguageCode, groupId: string, name: string }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, channels: Array<{ id: string, code: string }> } | null> }; export type UpdateProductVariantsMutationVariables = Exact<{ input: Array<UpdateProductVariantInput> | UpdateProductVariantInput; }>; export type UpdateProductVariantsMutation = { updateProductVariants: Array<{ id: string, createdAt: any, updatedAt: any, enabled: boolean, languageCode: LanguageCode, name: string, currencyCode: CurrencyCode, price: number, priceWithTax: number, stockOnHand: number, trackInventory: GlobalFlag, sku: string, prices: Array<{ currencyCode: CurrencyCode, price: number }>, taxRateApplied: { id: string, name: string, value: number }, taxCategory: { id: string, name: string }, options: Array<{ id: string, code: string, languageCode: LanguageCode, groupId: string, name: string }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, channels: Array<{ id: string, code: string }> } | null> }; export type UpdateTaxRateMutationVariables = Exact<{ input: UpdateTaxRateInput; }>; export type UpdateTaxRateMutation = { updateTaxRate: { id: string, name: string, enabled: boolean, value: number, category: { id: string, name: string }, zone: { id: string, name: string }, customerGroup?: { id: string, name: string } | null } }; export type CreateFacetMutationVariables = Exact<{ input: CreateFacetInput; }>; export type CreateFacetMutation = { createFacet: { id: string, languageCode: LanguageCode, isPrivate: boolean, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, values: Array<{ id: string, languageCode: LanguageCode, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, facet: { id: string, name: string } }> } }; export type UpdateFacetMutationVariables = Exact<{ input: UpdateFacetInput; }>; export type UpdateFacetMutation = { updateFacet: { id: string, languageCode: LanguageCode, isPrivate: boolean, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, values: Array<{ id: string, languageCode: LanguageCode, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, facet: { id: string, name: string } }> } }; export type GetCustomerListQueryVariables = Exact<{ options?: InputMaybe<CustomerListOptions>; }>; export type GetCustomerListQuery = { customers: { totalItems: number, items: Array<{ id: string, title?: string | null, firstName: string, lastName: string, emailAddress: string, phoneNumber?: string | null, user?: { id: string, identifier: string, verified: boolean } | null }> } }; export type GetAssetListQueryVariables = Exact<{ options?: InputMaybe<AssetListOptions>; }>; export type GetAssetListQuery = { assets: { totalItems: number, items: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }> } }; export type CreateRoleMutationVariables = Exact<{ input: CreateRoleInput; }>; export type CreateRoleMutation = { createRole: { id: string, code: string, description: string, permissions: Array<Permission>, channels: Array<{ id: string, code: string, token: string }> } }; export type CreateCollectionMutationVariables = Exact<{ input: CreateCollectionInput; }>; export type CreateCollectionMutation = { createCollection: { id: string, name: string, slug: string, description: string, isPrivate: boolean, languageCode?: LanguageCode | null, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, filters: Array<{ code: string, args: Array<{ name: string, value: string }> }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string, slug: string, description: string }>, parent?: { id: string, name: string } | null, children?: Array<{ id: string, name: string, position: number }> | null } }; export type UpdateCollectionMutationVariables = Exact<{ input: UpdateCollectionInput; }>; export type UpdateCollectionMutation = { updateCollection: { id: string, name: string, slug: string, description: string, isPrivate: boolean, languageCode?: LanguageCode | null, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, filters: Array<{ code: string, args: Array<{ name: string, value: string }> }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string, slug: string, description: string }>, parent?: { id: string, name: string } | null, children?: Array<{ id: string, name: string, position: number }> | null } }; export type GetCustomerQueryVariables = Exact<{ id: Scalars['ID']['input']; orderListOptions?: InputMaybe<OrderListOptions>; }>; export type GetCustomerQuery = { customer?: { id: string, title?: string | null, firstName: string, lastName: string, phoneNumber?: string | null, emailAddress: string, orders: { totalItems: number, items: Array<{ id: string, code: string, state: string, total: number, currencyCode: CurrencyCode, updatedAt: any }> }, user?: { id: string, identifier: string, verified: boolean, lastLogin?: any | null } | null, addresses?: Array<{ id: string, fullName?: string | null, company?: string | null, streetLine1: string, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, phoneNumber?: string | null, defaultShippingAddress?: boolean | null, defaultBillingAddress?: boolean | null, country: { id: string, code: string, name: string } }> | null } | null }; export type AttemptLoginMutationVariables = Exact<{ username: Scalars['String']['input']; password: Scalars['String']['input']; rememberMe?: InputMaybe<Scalars['Boolean']['input']>; }>; export type AttemptLoginMutation = { login: { id: string, identifier: string, channels: Array<{ code: string, token: string, permissions: Array<Permission> }> } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } }; export type GetCountryListQueryVariables = Exact<{ options?: InputMaybe<CountryListOptions>; }>; export type GetCountryListQuery = { countries: { totalItems: number, items: Array<{ id: string, code: string, name: string, enabled: boolean }> } }; export type UpdateCountryMutationVariables = Exact<{ input: UpdateCountryInput; }>; export type UpdateCountryMutation = { updateCountry: { id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> } }; export type GetFacetListQueryVariables = Exact<{ options?: InputMaybe<FacetListOptions>; }>; export type GetFacetListQuery = { facets: { totalItems: number, items: Array<{ id: string, languageCode: LanguageCode, isPrivate: boolean, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, values: Array<{ id: string, languageCode: LanguageCode, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, facet: { id: string, name: string } }> }> } }; export type GetFacetListSimpleQueryVariables = Exact<{ options?: InputMaybe<FacetListOptions>; }>; export type GetFacetListSimpleQuery = { facets: { totalItems: number, items: Array<{ id: string, name: string }> } }; export type DeleteProductMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteProductMutation = { deleteProduct: { result: DeletionResult } }; export type GetProductSimpleQueryVariables = Exact<{ id?: InputMaybe<Scalars['ID']['input']>; slug?: InputMaybe<Scalars['String']['input']>; }>; export type GetProductSimpleQuery = { product?: { id: string, slug: string } | null }; export type GetStockMovementQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetStockMovementQuery = { product?: { id: string, variants: Array<{ id: string, stockOnHand: number, stockAllocated: number, stockMovements: { totalItems: number, items: Array<{ id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number }> } }> } | null }; export type GetRunningJobsQueryVariables = Exact<{ options?: InputMaybe<JobListOptions>; }>; export type GetRunningJobsQuery = { jobs: { totalItems: number, items: Array<{ id: string, queueName: string, state: JobState, isSettled: boolean, duration: number }> } }; export type CreatePromotionMutationVariables = Exact<{ input: CreatePromotionInput; }>; export type CreatePromotionMutation = { createPromotion: { errorCode: ErrorCode, message: string } | { id: string, createdAt: any, updatedAt: any, couponCode?: string | null, startsAt?: any | null, endsAt?: any | null, name: string, description: string, enabled: boolean, perCustomerUsageLimit?: number | null, usageLimit?: number | null, conditions: Array<{ code: string, args: Array<{ name: string, value: string }> }>, actions: Array<{ code: string, args: Array<{ name: string, value: string }> }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string, description: string }> } }; export type MeQueryVariables = Exact<{ [key: string]: never; }>; export type MeQuery = { me?: { id: string, identifier: string, channels: Array<{ code: string, token: string, permissions: Array<Permission> }> } | null }; export type CreateChannelMutationVariables = Exact<{ input: CreateChannelInput; }>; export type CreateChannelMutation = { createChannel: { id: string, code: string, token: string, currencyCode: CurrencyCode, availableCurrencyCodes: Array<CurrencyCode>, defaultCurrencyCode: CurrencyCode, defaultLanguageCode: LanguageCode, pricesIncludeTax: boolean, defaultShippingZone?: { id: string } | null, defaultTaxZone?: { id: string } | null } | { errorCode: ErrorCode, message: string, languageCode: string } }; export type DeleteProductVariantMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteProductVariantMutation = { deleteProductVariant: { result: DeletionResult, message?: string | null } }; export type AssignProductsToChannelMutationVariables = Exact<{ input: AssignProductsToChannelInput; }>; export type AssignProductsToChannelMutation = { assignProductsToChannel: Array<{ id: string, enabled: boolean, languageCode: LanguageCode, name: string, slug: string, description: string, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ languageCode: LanguageCode, name: string, slug: string, description: string }>, optionGroups: Array<{ id: string, languageCode: LanguageCode, code: string, name: string }>, variants: Array<{ id: string, createdAt: any, updatedAt: any, enabled: boolean, languageCode: LanguageCode, name: string, currencyCode: CurrencyCode, price: number, priceWithTax: number, stockOnHand: number, trackInventory: GlobalFlag, sku: string, prices: Array<{ currencyCode: CurrencyCode, price: number }>, taxRateApplied: { id: string, name: string, value: number }, taxCategory: { id: string, name: string }, options: Array<{ id: string, code: string, languageCode: LanguageCode, groupId: string, name: string }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, channels: Array<{ id: string, code: string }> }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, channels: Array<{ id: string, code: string }> }> }; export type RemoveProductsFromChannelMutationVariables = Exact<{ input: RemoveProductsFromChannelInput; }>; export type RemoveProductsFromChannelMutation = { removeProductsFromChannel: Array<{ id: string, enabled: boolean, languageCode: LanguageCode, name: string, slug: string, description: string, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ languageCode: LanguageCode, name: string, slug: string, description: string }>, optionGroups: Array<{ id: string, languageCode: LanguageCode, code: string, name: string }>, variants: Array<{ id: string, createdAt: any, updatedAt: any, enabled: boolean, languageCode: LanguageCode, name: string, currencyCode: CurrencyCode, price: number, priceWithTax: number, stockOnHand: number, trackInventory: GlobalFlag, sku: string, prices: Array<{ currencyCode: CurrencyCode, price: number }>, taxRateApplied: { id: string, name: string, value: number }, taxCategory: { id: string, name: string }, options: Array<{ id: string, code: string, languageCode: LanguageCode, groupId: string, name: string }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, channels: Array<{ id: string, code: string }> }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, channels: Array<{ id: string, code: string }> }> }; export type AssignProductVariantsToChannelMutationVariables = Exact<{ input: AssignProductVariantsToChannelInput; }>; export type AssignProductVariantsToChannelMutation = { assignProductVariantsToChannel: Array<{ id: string, createdAt: any, updatedAt: any, enabled: boolean, languageCode: LanguageCode, name: string, currencyCode: CurrencyCode, price: number, priceWithTax: number, stockOnHand: number, trackInventory: GlobalFlag, sku: string, prices: Array<{ currencyCode: CurrencyCode, price: number }>, taxRateApplied: { id: string, name: string, value: number }, taxCategory: { id: string, name: string }, options: Array<{ id: string, code: string, languageCode: LanguageCode, groupId: string, name: string }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, channels: Array<{ id: string, code: string }> }> }; export type RemoveProductVariantsFromChannelMutationVariables = Exact<{ input: RemoveProductVariantsFromChannelInput; }>; export type RemoveProductVariantsFromChannelMutation = { removeProductVariantsFromChannel: Array<{ id: string, createdAt: any, updatedAt: any, enabled: boolean, languageCode: LanguageCode, name: string, currencyCode: CurrencyCode, price: number, priceWithTax: number, stockOnHand: number, trackInventory: GlobalFlag, sku: string, prices: Array<{ currencyCode: CurrencyCode, price: number }>, taxRateApplied: { id: string, name: string, value: number }, taxCategory: { id: string, name: string }, options: Array<{ id: string, code: string, languageCode: LanguageCode, groupId: string, name: string }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, channels: Array<{ id: string, code: string }> }> }; export type UpdateAssetMutationVariables = Exact<{ input: UpdateAssetInput; }>; export type UpdateAssetMutation = { updateAsset: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string, tags: Array<{ id: string, value: string }>, focalPoint?: { x: number, y: number } | null } }; export type DeleteAssetMutationVariables = Exact<{ input: DeleteAssetInput; }>; export type DeleteAssetMutation = { deleteAsset: { result: DeletionResult, message?: string | null } }; export type UpdateChannelMutationVariables = Exact<{ input: UpdateChannelInput; }>; export type UpdateChannelMutation = { updateChannel: { id: string, code: string, token: string, currencyCode: CurrencyCode, availableCurrencyCodes: Array<CurrencyCode>, defaultCurrencyCode: CurrencyCode, defaultLanguageCode: LanguageCode, pricesIncludeTax: boolean, defaultShippingZone?: { id: string } | null, defaultTaxZone?: { id: string } | null } | { errorCode: ErrorCode, message: string, languageCode: string } }; export type GetCustomerHistoryQueryVariables = Exact<{ id: Scalars['ID']['input']; options?: InputMaybe<HistoryEntryListOptions>; }>; export type GetCustomerHistoryQuery = { customer?: { id: string, history: { totalItems: number, items: Array<{ id: string, type: HistoryEntryType, data: any, administrator?: { id: string } | null }> } } | null }; export type GetOrderQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetOrderQuery = { order?: { id: string, createdAt: any, updatedAt: any, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, shipping: number, shippingWithTax: number, customer?: { id: string, firstName: string, lastName: string } | null, lines: Array<{ id: string, unitPrice: number, unitPriceWithTax: number, quantity: number, taxRate: number, linePriceWithTax: number, featuredAsset?: { preview: string } | null, productVariant: { id: string, name: string, sku: string }, taxLines: Array<{ description: string, taxRate: number }> }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, name: string, description: string } }>, shippingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null, payments?: Array<{ id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> }> | null, fulfillments?: Array<{ id: string, state: string, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }> | null } | null }; export type CreateCustomerGroupMutationVariables = Exact<{ input: CreateCustomerGroupInput; }>; export type CreateCustomerGroupMutation = { createCustomerGroup: { id: string, name: string, customers: { totalItems: number, items: Array<{ id: string }> } } }; export type RemoveCustomersFromGroupMutationVariables = Exact<{ groupId: Scalars['ID']['input']; customerIds: Array<Scalars['ID']['input']> | Scalars['ID']['input']; }>; export type RemoveCustomersFromGroupMutation = { removeCustomersFromGroup: { id: string, name: string, customers: { totalItems: number, items: Array<{ id: string }> } } }; export type CreateFulfillmentMutationVariables = Exact<{ input: FulfillOrderInput; }>; export type CreateFulfillmentMutation = { addFulfillmentToOrder: { errorCode: ErrorCode, message: string, fulfillmentHandlerError: string } | { errorCode: ErrorCode, message: string } | { id: string, state: string, nextStates: Array<string>, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } }; export type TransitFulfillmentMutationVariables = Exact<{ id: Scalars['ID']['input']; state: Scalars['String']['input']; }>; export type TransitFulfillmentMutation = { transitionFulfillmentToState: { id: string, state: string, nextStates: Array<string>, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> } | { errorCode: ErrorCode, message: string, transitionError: string, fromState: string, toState: string } }; export type GetOrderFulfillmentsQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetOrderFulfillmentsQuery = { order?: { id: string, state: string, fulfillments?: Array<{ id: string, state: string, nextStates: Array<string>, method: string, summary: Array<{ quantity: number, orderLine: { id: string } }> }> | null } | null }; export type GetOrderListQueryVariables = Exact<{ options?: InputMaybe<OrderListOptions>; }>; export type GetOrderListQuery = { orders: { totalItems: number, items: Array<{ id: string, createdAt: any, updatedAt: any, code: string, active: boolean, state: string, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, customer?: { id: string, firstName: string, lastName: string } | null }> } }; export type CreateAddressMutationVariables = Exact<{ id: Scalars['ID']['input']; input: CreateAddressInput; }>; export type CreateAddressMutation = { createCustomerAddress: { id: string, fullName?: string | null, company?: string | null, streetLine1: string, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, phoneNumber?: string | null, defaultShippingAddress?: boolean | null, defaultBillingAddress?: boolean | null, country: { code: string, name: string } } }; export type UpdateAddressMutationVariables = Exact<{ input: UpdateAddressInput; }>; export type UpdateAddressMutation = { updateCustomerAddress: { id: string, defaultShippingAddress?: boolean | null, defaultBillingAddress?: boolean | null, country: { code: string, name: string } } }; export type CreateCustomerMutationVariables = Exact<{ input: CreateCustomerInput; password?: InputMaybe<Scalars['String']['input']>; }>; export type CreateCustomerMutation = { createCustomer: { id: string, title?: string | null, firstName: string, lastName: string, phoneNumber?: string | null, emailAddress: string, user?: { id: string, identifier: string, verified: boolean, lastLogin?: any | null } | null, addresses?: Array<{ id: string, fullName?: string | null, company?: string | null, streetLine1: string, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, phoneNumber?: string | null, defaultShippingAddress?: boolean | null, defaultBillingAddress?: boolean | null, country: { id: string, code: string, name: string } }> | null } | { errorCode: ErrorCode, message: string } }; export type UpdateCustomerMutationVariables = Exact<{ input: UpdateCustomerInput; }>; export type UpdateCustomerMutation = { updateCustomer: { id: string, title?: string | null, firstName: string, lastName: string, phoneNumber?: string | null, emailAddress: string, user?: { id: string, identifier: string, verified: boolean, lastLogin?: any | null } | null, addresses?: Array<{ id: string, fullName?: string | null, company?: string | null, streetLine1: string, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, phoneNumber?: string | null, defaultShippingAddress?: boolean | null, defaultBillingAddress?: boolean | null, country: { id: string, code: string, name: string } }> | null } | { errorCode: ErrorCode, message: string } }; export type DeleteCustomerMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteCustomerMutation = { deleteCustomer: { result: DeletionResult } }; export type UpdateCustomerNoteMutationVariables = Exact<{ input: UpdateCustomerNoteInput; }>; export type UpdateCustomerNoteMutation = { updateCustomerNote: { id: string, data: any, isPublic: boolean } }; export type DeleteCustomerNoteMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteCustomerNoteMutation = { deleteCustomerNote: { result: DeletionResult, message?: string | null } }; export type UpdateCustomerGroupMutationVariables = Exact<{ input: UpdateCustomerGroupInput; }>; export type UpdateCustomerGroupMutation = { updateCustomerGroup: { id: string, name: string, customers: { totalItems: number, items: Array<{ id: string }> } } }; export type DeleteCustomerGroupMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteCustomerGroupMutation = { deleteCustomerGroup: { result: DeletionResult, message?: string | null } }; export type GetCustomerGroupsQueryVariables = Exact<{ options?: InputMaybe<CustomerGroupListOptions>; }>; export type GetCustomerGroupsQuery = { customerGroups: { totalItems: number, items: Array<{ id: string, name: string }> } }; export type GetCustomerGroupQueryVariables = Exact<{ id: Scalars['ID']['input']; options?: InputMaybe<CustomerListOptions>; }>; export type GetCustomerGroupQuery = { customerGroup?: { id: string, name: string, customers: { totalItems: number, items: Array<{ id: string }> } } | null }; export type AddCustomersToGroupMutationVariables = Exact<{ groupId: Scalars['ID']['input']; customerIds: Array<Scalars['ID']['input']> | Scalars['ID']['input']; }>; export type AddCustomersToGroupMutation = { addCustomersToGroup: { id: string, name: string, customers: { totalItems: number, items: Array<{ id: string }> } } }; export type GetCustomerWithGroupsQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetCustomerWithGroupsQuery = { customer?: { id: string, groups: Array<{ id: string, name: string }> } | null }; export type AdminTransitionMutationVariables = Exact<{ id: Scalars['ID']['input']; state: Scalars['String']['input']; }>; export type AdminTransitionMutation = { transitionOrderToState?: { id: string, createdAt: any, updatedAt: any, code: string, active: boolean, state: string, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, customer?: { id: string, firstName: string, lastName: string } | null } | { errorCode: ErrorCode, message: string, transitionError: string, fromState: string, toState: string } | null }; export type CancelOrderMutationVariables = Exact<{ input: CancelOrderInput; }>; export type CancelOrderMutation = { cancelOrder: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { id: string, state: string, lines: Array<{ id: string, quantity: number }> } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } }; export type CanceledOrderFragment = { id: string, state: string, lines: Array<{ id: string, quantity: number }> }; export type UpdateGlobalSettingsMutationVariables = Exact<{ input: UpdateGlobalSettingsInput; }>; export type UpdateGlobalSettingsMutation = { updateGlobalSettings: { errorCode: ErrorCode, message: string } | { id: string, availableLanguages: Array<LanguageCode>, trackInventory: boolean, outOfStockThreshold: number, serverConfig: { permittedAssetTypes: Array<string>, orderProcess: Array<{ name: string, to: Array<string> }>, permissions: Array<{ name: string, description: string, assignable: boolean }>, customFieldConfig: { Customer: Array<{ name: string } | { name: string } | { name: string } | { name: string } | { name: string } | { name: string } | { name: string } | { name: string } | { name: string }> } } } }; export type UpdateRoleMutationVariables = Exact<{ input: UpdateRoleInput; }>; export type UpdateRoleMutation = { updateRole: { id: string, code: string, description: string, permissions: Array<Permission>, channels: Array<{ id: string, code: string, token: string }> } }; export type GetProductsWithVariantPricesQueryVariables = Exact<{ [key: string]: never; }>; export type GetProductsWithVariantPricesQuery = { products: { items: Array<{ id: string, slug: string, variants: Array<{ id: string, price: number, priceWithTax: number, currencyCode: CurrencyCode, sku: string, facetValues: Array<{ id: string, code: string }> }> }> } }; export type CreateProductOptionGroupMutationVariables = Exact<{ input: CreateProductOptionGroupInput; }>; export type CreateProductOptionGroupMutation = { createProductOptionGroup: { id: string, code: string, name: string, options: Array<{ id: string, code: string, name: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> } }; export type AddOptionGroupToProductMutationVariables = Exact<{ productId: Scalars['ID']['input']; optionGroupId: Scalars['ID']['input']; }>; export type AddOptionGroupToProductMutation = { addOptionGroupToProduct: { id: string, optionGroups: Array<{ id: string, code: string, options: Array<{ id: string, code: string }> }> } }; export type CreateShippingMethodMutationVariables = Exact<{ input: CreateShippingMethodInput; }>; export type CreateShippingMethodMutation = { createShippingMethod: { id: string, code: string, name: string, description: string, calculator: { code: string, args: Array<{ name: string, value: string }> }, checker: { code: string, args: Array<{ name: string, value: string }> } } }; export type SettlePaymentMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type SettlePaymentMutation = { settlePayment: { errorCode: ErrorCode, message: string } | { id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string, paymentErrorMessage: string } }; export type GetOrderHistoryQueryVariables = Exact<{ id: Scalars['ID']['input']; options?: InputMaybe<HistoryEntryListOptions>; }>; export type GetOrderHistoryQuery = { order?: { id: string, history: { totalItems: number, items: Array<{ id: string, type: HistoryEntryType, data: any, administrator?: { id: string } | null }> } } | null }; export type UpdateShippingMethodMutationVariables = Exact<{ input: UpdateShippingMethodInput; }>; export type UpdateShippingMethodMutation = { updateShippingMethod: { id: string, code: string, name: string, description: string, calculator: { code: string, args: Array<{ name: string, value: string }> }, checker: { code: string, args: Array<{ name: string, value: string }> } } }; export type GetAssetQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetAssetQuery = { asset?: { width: number, height: number, id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null }; export type AssetFragFirstFragment = { id: string, preview: string }; export type GetAssetFragmentFirstQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetAssetFragmentFirstQuery = { asset?: { id: string, preview: string } | null }; export type AssetWithTagsAndFocalPointFragment = { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string, focalPoint?: { x: number, y: number } | null, tags: Array<{ id: string, value: string }> }; export type CreateAssetsMutationVariables = Exact<{ input: Array<CreateAssetInput> | CreateAssetInput; }>; export type CreateAssetsMutation = { createAssets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string, focalPoint?: { x: number, y: number } | null, tags: Array<{ id: string, value: string }> } | { message: string, fileName: string, mimeType: string }> }; export type DeleteShippingMethodMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteShippingMethodMutation = { deleteShippingMethod: { result: DeletionResult, message?: string | null } }; export type AssignPromotionToChannelMutationVariables = Exact<{ input: AssignPromotionsToChannelInput; }>; export type AssignPromotionToChannelMutation = { assignPromotionsToChannel: Array<{ id: string, name: string }> }; export type RemovePromotionFromChannelMutationVariables = Exact<{ input: RemovePromotionsFromChannelInput; }>; export type RemovePromotionFromChannelMutation = { removePromotionsFromChannel: Array<{ id: string, name: string }> }; export type GetTaxRatesQueryVariables = Exact<{ options?: InputMaybe<TaxRateListOptions>; }>; export type GetTaxRatesQuery = { taxRates: { totalItems: number, items: Array<{ id: string, name: string, enabled: boolean, value: number, category: { id: string, name: string }, zone: { id: string, name: string }, customerGroup?: { id: string, name: string } | null }> } }; export type GetShippingMethodListQueryVariables = Exact<{ [key: string]: never; }>; export type GetShippingMethodListQuery = { shippingMethods: { totalItems: number, items: Array<{ id: string, code: string, name: string, description: string, calculator: { code: string, args: Array<{ name: string, value: string }> }, checker: { code: string, args: Array<{ name: string, value: string }> } }> } }; export type GetCollectionsQueryVariables = Exact<{ [key: string]: never; }>; export type GetCollectionsQuery = { collections: { items: Array<{ id: string, name: string, position: number, parent?: { id: string, name: string } | null }> } }; export type TransitionPaymentToStateMutationVariables = Exact<{ id: Scalars['ID']['input']; state: Scalars['String']['input']; }>; export type TransitionPaymentToStateMutation = { transitionPaymentToState: { id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> } | { errorCode: ErrorCode, message: string, transitionError: string } }; export type GetProductVariantListQueryVariables = Exact<{ options?: InputMaybe<ProductVariantListOptions>; productId?: InputMaybe<Scalars['ID']['input']>; }>; export type GetProductVariantListQuery = { productVariants: { totalItems: number, items: Array<{ id: string, name: string, sku: string, price: number, priceWithTax: number, currencyCode: CurrencyCode, prices: Array<{ currencyCode: CurrencyCode, price: number }> }> } }; export type DeletePromotionMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeletePromotionMutation = { deletePromotion: { result: DeletionResult } }; export type GetChannelsQueryVariables = Exact<{ [key: string]: never; }>; export type GetChannelsQuery = { channels: { items: Array<{ id: string, code: string, token: string }> } }; export type UpdateAdministratorMutationVariables = Exact<{ input: UpdateAdministratorInput; }>; export type UpdateAdministratorMutation = { updateAdministrator: { id: string, firstName: string, lastName: string, emailAddress: string, user: { id: string, identifier: string, lastLogin?: any | null, roles: Array<{ id: string, code: string, description: string, permissions: Array<Permission> }> } } }; export type AssignCollectionsToChannelMutationVariables = Exact<{ input: AssignCollectionsToChannelInput; }>; export type AssignCollectionsToChannelMutation = { assignCollectionsToChannel: Array<{ id: string, name: string, slug: string, description: string, isPrivate: boolean, languageCode?: LanguageCode | null, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, filters: Array<{ code: string, args: Array<{ name: string, value: string }> }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string, slug: string, description: string }>, parent?: { id: string, name: string } | null, children?: Array<{ id: string, name: string, position: number }> | null }> }; export type GetCollectionQueryVariables = Exact<{ id?: InputMaybe<Scalars['ID']['input']>; slug?: InputMaybe<Scalars['String']['input']>; variantListOptions?: InputMaybe<ProductVariantListOptions>; }>; export type GetCollectionQuery = { collection?: { id: string, name: string, slug: string, description: string, isPrivate: boolean, languageCode?: LanguageCode | null, productVariants: { items: Array<{ id: string, name: string, price: number }> }, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, filters: Array<{ code: string, args: Array<{ name: string, value: string }> }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string, slug: string, description: string }>, parent?: { id: string, name: string } | null, children?: Array<{ id: string, name: string, position: number }> | null } | null }; export type GetFacetWithValuesQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetFacetWithValuesQuery = { facet?: { id: string, languageCode: LanguageCode, isPrivate: boolean, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, values: Array<{ id: string, languageCode: LanguageCode, code: string, name: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, facet: { id: string, name: string } }> } | null }; export type GetPromotionQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetPromotionQuery = { promotion?: { id: string, createdAt: any, updatedAt: any, couponCode?: string | null, startsAt?: any | null, endsAt?: any | null, name: string, description: string, enabled: boolean, perCustomerUsageLimit?: number | null, usageLimit?: number | null, conditions: Array<{ code: string, args: Array<{ name: string, value: string }> }>, actions: Array<{ code: string, args: Array<{ name: string, value: string }> }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string, description: string }> } | null }; export type CancelJobMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type CancelJobMutation = { cancelJob: { id: string, state: JobState, isSettled: boolean, settledAt?: any | null } }; export type UpdateOptionGroupMutationVariables = Exact<{ input: UpdateProductOptionGroupInput; }>; export type UpdateOptionGroupMutation = { updateProductOptionGroup: { id: string } }; export type GetFulfillmentHandlersQueryVariables = Exact<{ [key: string]: never; }>; export type GetFulfillmentHandlersQuery = { fulfillmentHandlers: Array<{ code: string, description: string, args: Array<{ name: string, type: string, description?: string | null, label?: string | null, ui?: any | null }> }> }; export type OrderWithModificationsFragment = { id: string, state: string, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, lines: Array<{ id: string, quantity: number, orderPlacedQuantity: number, linePrice: number, linePriceWithTax: number, unitPriceWithTax: number, discountedLinePriceWithTax: number, proratedLinePriceWithTax: number, proratedUnitPriceWithTax: number, discounts: Array<{ description: string, amountWithTax: number }>, productVariant: { id: string, name: string } }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number, taxRate: number }>, payments?: Array<{ id: string, transactionId?: string | null, state: string, amount: number, method: string, metadata?: any | null, refunds: Array<{ id: string, state: string, total: number, paymentId: string }> }> | null, modifications: Array<{ id: string, note: string, priceChange: number, isSettled: boolean, lines: Array<{ orderLineId: string, quantity: number }>, surcharges?: Array<{ id: string }> | null, payment?: { id: string, state: string, amount: number, method: string } | null, refund?: { id: string, state: string, total: number, paymentId: string } | null }>, promotions: Array<{ id: string, name: string, couponCode?: string | null }>, discounts: Array<{ description: string, adjustmentSource: string, amount: number, amountWithTax: number }>, shippingAddress?: { streetLine1?: string | null, city?: string | null, postalCode?: string | null, province?: string | null, countryCode?: string | null, country?: string | null } | null, billingAddress?: { streetLine1?: string | null, city?: string | null, postalCode?: string | null, province?: string | null, countryCode?: string | null, country?: string | null } | null, shippingLines: Array<{ id: string, discountedPriceWithTax: number, shippingMethod: { id: string, name: string } }> }; export type GetOrderWithModificationsQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetOrderWithModificationsQuery = { order?: { id: string, state: string, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, lines: Array<{ id: string, quantity: number, orderPlacedQuantity: number, linePrice: number, linePriceWithTax: number, unitPriceWithTax: number, discountedLinePriceWithTax: number, proratedLinePriceWithTax: number, proratedUnitPriceWithTax: number, discounts: Array<{ description: string, amountWithTax: number }>, productVariant: { id: string, name: string } }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number, taxRate: number }>, payments?: Array<{ id: string, transactionId?: string | null, state: string, amount: number, method: string, metadata?: any | null, refunds: Array<{ id: string, state: string, total: number, paymentId: string }> }> | null, modifications: Array<{ id: string, note: string, priceChange: number, isSettled: boolean, lines: Array<{ orderLineId: string, quantity: number }>, surcharges?: Array<{ id: string }> | null, payment?: { id: string, state: string, amount: number, method: string } | null, refund?: { id: string, state: string, total: number, paymentId: string } | null }>, promotions: Array<{ id: string, name: string, couponCode?: string | null }>, discounts: Array<{ description: string, adjustmentSource: string, amount: number, amountWithTax: number }>, shippingAddress?: { streetLine1?: string | null, city?: string | null, postalCode?: string | null, province?: string | null, countryCode?: string | null, country?: string | null } | null, billingAddress?: { streetLine1?: string | null, city?: string | null, postalCode?: string | null, province?: string | null, countryCode?: string | null, country?: string | null } | null, shippingLines: Array<{ id: string, discountedPriceWithTax: number, shippingMethod: { id: string, name: string } }> } | null }; export type ModifyOrderMutationVariables = Exact<{ input: ModifyOrderInput; }>; export type ModifyOrderMutation = { modifyOrder: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { id: string, state: string, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, lines: Array<{ id: string, quantity: number, orderPlacedQuantity: number, linePrice: number, linePriceWithTax: number, unitPriceWithTax: number, discountedLinePriceWithTax: number, proratedLinePriceWithTax: number, proratedUnitPriceWithTax: number, discounts: Array<{ description: string, amountWithTax: number }>, productVariant: { id: string, name: string } }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number, taxRate: number }>, payments?: Array<{ id: string, transactionId?: string | null, state: string, amount: number, method: string, metadata?: any | null, refunds: Array<{ id: string, state: string, total: number, paymentId: string }> }> | null, modifications: Array<{ id: string, note: string, priceChange: number, isSettled: boolean, lines: Array<{ orderLineId: string, quantity: number }>, surcharges?: Array<{ id: string }> | null, payment?: { id: string, state: string, amount: number, method: string } | null, refund?: { id: string, state: string, total: number, paymentId: string } | null }>, promotions: Array<{ id: string, name: string, couponCode?: string | null }>, discounts: Array<{ description: string, adjustmentSource: string, amount: number, amountWithTax: number }>, shippingAddress?: { streetLine1?: string | null, city?: string | null, postalCode?: string | null, province?: string | null, countryCode?: string | null, country?: string | null } | null, billingAddress?: { streetLine1?: string | null, city?: string | null, postalCode?: string | null, province?: string | null, countryCode?: string | null, country?: string | null } | null, shippingLines: Array<{ id: string, discountedPriceWithTax: number, shippingMethod: { id: string, name: string } }> } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } }; export type AddManualPaymentMutationVariables = Exact<{ input: ManualPaymentInput; }>; export type AddManualPaymentMutation = { addManualPaymentToOrder: { errorCode: ErrorCode, message: string } | { id: string, state: string, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, lines: Array<{ id: string, quantity: number, orderPlacedQuantity: number, linePrice: number, linePriceWithTax: number, unitPriceWithTax: number, discountedLinePriceWithTax: number, proratedLinePriceWithTax: number, proratedUnitPriceWithTax: number, discounts: Array<{ description: string, amountWithTax: number }>, productVariant: { id: string, name: string } }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number, taxRate: number }>, payments?: Array<{ id: string, transactionId?: string | null, state: string, amount: number, method: string, metadata?: any | null, refunds: Array<{ id: string, state: string, total: number, paymentId: string }> }> | null, modifications: Array<{ id: string, note: string, priceChange: number, isSettled: boolean, lines: Array<{ orderLineId: string, quantity: number }>, surcharges?: Array<{ id: string }> | null, payment?: { id: string, state: string, amount: number, method: string } | null, refund?: { id: string, state: string, total: number, paymentId: string } | null }>, promotions: Array<{ id: string, name: string, couponCode?: string | null }>, discounts: Array<{ description: string, adjustmentSource: string, amount: number, amountWithTax: number }>, shippingAddress?: { streetLine1?: string | null, city?: string | null, postalCode?: string | null, province?: string | null, countryCode?: string | null, country?: string | null } | null, billingAddress?: { streetLine1?: string | null, city?: string | null, postalCode?: string | null, province?: string | null, countryCode?: string | null, country?: string | null } | null, shippingLines: Array<{ id: string, discountedPriceWithTax: number, shippingMethod: { id: string, name: string } }> } }; export type DeletePromotionAdHoc1MutationVariables = Exact<{ [key: string]: never; }>; export type DeletePromotionAdHoc1Mutation = { deletePromotion: { result: DeletionResult } }; export type GetTaxRateListQueryVariables = Exact<{ options?: InputMaybe<TaxRateListOptions>; }>; export type GetTaxRateListQuery = { taxRates: { totalItems: number, items: Array<{ id: string, name: string, enabled: boolean, value: number, category: { id: string, name: string }, zone: { id: string, name: string } }> } }; export type GetOrderWithLineCalculatedPropsQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetOrderWithLineCalculatedPropsQuery = { order?: { id: string, lines: Array<{ id: string, linePriceWithTax: number, quantity: number }> } | null }; export type GetOrderListFulfillmentsQueryVariables = Exact<{ [key: string]: never; }>; export type GetOrderListFulfillmentsQuery = { orders: { items: Array<{ id: string, state: string, fulfillments?: Array<{ id: string, state: string, nextStates: Array<string>, method: string }> | null }> } }; export type GetOrderFulfillmentItemsQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetOrderFulfillmentItemsQuery = { order?: { id: string, state: string, fulfillments?: Array<{ id: string, state: string, nextStates: Array<string>, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }> | null } | null }; export type RefundFragment = { id: string, state: string, items: number, transactionId?: string | null, shipping: number, total: number, metadata?: any | null }; export type RefundOrderMutationVariables = Exact<{ input: RefundOrderInput; }>; export type RefundOrderMutation = { refundOrder: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { id: string, state: string, items: number, transactionId?: string | null, shipping: number, total: number, metadata?: any | null } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } }; export type SettleRefundMutationVariables = Exact<{ input: SettleRefundInput; }>; export type SettleRefundMutation = { settleRefund: { id: string, state: string, items: number, transactionId?: string | null, shipping: number, total: number, metadata?: any | null } | { errorCode: ErrorCode, message: string } }; export type AddNoteToOrderMutationVariables = Exact<{ input: AddNoteToOrderInput; }>; export type AddNoteToOrderMutation = { addNoteToOrder: { id: string } }; export type UpdateOrderNoteMutationVariables = Exact<{ input: UpdateOrderNoteInput; }>; export type UpdateOrderNoteMutation = { updateOrderNote: { id: string, data: any, isPublic: boolean } }; export type DeleteOrderNoteMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteOrderNoteMutation = { deleteOrderNote: { result: DeletionResult, message?: string | null } }; export type GetOrderWithPaymentsQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetOrderWithPaymentsQuery = { order?: { id: string, payments?: Array<{ id: string, errorMessage?: string | null, metadata?: any | null, refunds: Array<{ id: string, total: number }> }> | null } | null }; export type GetOrderLineFulfillmentsQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetOrderLineFulfillmentsQuery = { order?: { id: string, lines: Array<{ id: string, fulfillmentLines?: Array<{ orderLineId: string, quantity: number, fulfillment: { id: string, state: string } }> | null }> } | null }; export type GetOrderListWithQtyQueryVariables = Exact<{ options?: InputMaybe<OrderListOptions>; }>; export type GetOrderListWithQtyQuery = { orders: { items: Array<{ id: string, code: string, totalQuantity: number, lines: Array<{ id: string, quantity: number }> }> } }; export type CancelPaymentMutationVariables = Exact<{ paymentId: Scalars['ID']['input']; }>; export type CancelPaymentMutation = { cancelPayment: { errorCode: ErrorCode, message: string, paymentErrorMessage: string } | { id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> } | { errorCode: ErrorCode, message: string, transitionError: string } }; export type SetOrderCustomerMutationVariables = Exact<{ input: SetOrderCustomerInput; }>; export type SetOrderCustomerMutation = { setOrderCustomer?: { id: string, customer?: { id: string } | null } | null }; export type PaymentMethodFragment = { id: string, code: string, name: string, description: string, enabled: boolean, checker?: { code: string, args: Array<{ name: string, value: string }> } | null, handler: { code: string, args: Array<{ name: string, value: string }> }, translations: Array<{ id: string, languageCode: LanguageCode, name: string, description: string }> }; export type CreatePaymentMethodMutationVariables = Exact<{ input: CreatePaymentMethodInput; }>; export type CreatePaymentMethodMutation = { createPaymentMethod: { id: string, code: string, name: string, description: string, enabled: boolean, checker?: { code: string, args: Array<{ name: string, value: string }> } | null, handler: { code: string, args: Array<{ name: string, value: string }> }, translations: Array<{ id: string, languageCode: LanguageCode, name: string, description: string }> } }; export type UpdatePaymentMethodMutationVariables = Exact<{ input: UpdatePaymentMethodInput; }>; export type UpdatePaymentMethodMutation = { updatePaymentMethod: { id: string, code: string, name: string, description: string, enabled: boolean, checker?: { code: string, args: Array<{ name: string, value: string }> } | null, handler: { code: string, args: Array<{ name: string, value: string }> }, translations: Array<{ id: string, languageCode: LanguageCode, name: string, description: string }> } }; export type GetPaymentMethodHandlersQueryVariables = Exact<{ [key: string]: never; }>; export type GetPaymentMethodHandlersQuery = { paymentMethodHandlers: Array<{ code: string, args: Array<{ name: string, type: string }> }> }; export type GetPaymentMethodCheckersQueryVariables = Exact<{ [key: string]: never; }>; export type GetPaymentMethodCheckersQuery = { paymentMethodEligibilityCheckers: Array<{ code: string, args: Array<{ name: string, type: string }> }> }; export type GetPaymentMethodQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetPaymentMethodQuery = { paymentMethod?: { id: string, code: string, name: string, description: string, enabled: boolean, checker?: { code: string, args: Array<{ name: string, value: string }> } | null, handler: { code: string, args: Array<{ name: string, value: string }> }, translations: Array<{ id: string, languageCode: LanguageCode, name: string, description: string }> } | null }; export type GetPaymentMethodListQueryVariables = Exact<{ options?: InputMaybe<PaymentMethodListOptions>; }>; export type GetPaymentMethodListQuery = { paymentMethods: { totalItems: number, items: Array<{ id: string, code: string, name: string, description: string, enabled: boolean, checker?: { code: string, args: Array<{ name: string, value: string }> } | null, handler: { code: string, args: Array<{ name: string, value: string }> }, translations: Array<{ id: string, languageCode: LanguageCode, name: string, description: string }> }> } }; export type DeletePaymentMethodMutationVariables = Exact<{ id: Scalars['ID']['input']; force?: InputMaybe<Scalars['Boolean']['input']>; }>; export type DeletePaymentMethodMutation = { deletePaymentMethod: { message?: string | null, result: DeletionResult } }; export type AddManualPayment2MutationVariables = Exact<{ input: ManualPaymentInput; }>; export type AddManualPayment2Mutation = { addManualPaymentToOrder: { errorCode: ErrorCode, message: string } | { id: string, createdAt: any, updatedAt: any, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, total: number, totalWithTax: number, totalQuantity: number, currencyCode: CurrencyCode, shipping: number, shippingWithTax: number, customer?: { id: string, firstName: string, lastName: string } | null, lines: Array<{ id: string, unitPrice: number, unitPriceWithTax: number, quantity: number, taxRate: number, linePriceWithTax: number, featuredAsset?: { preview: string } | null, productVariant: { id: string, name: string, sku: string }, taxLines: Array<{ description: string, taxRate: number }> }>, surcharges: Array<{ id: string, description: string, sku?: string | null, price: number, priceWithTax: number }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, name: string, description: string } }>, shippingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null, payments?: Array<{ id: string, transactionId?: string | null, amount: number, method: string, state: string, nextStates: Array<string>, metadata?: any | null, refunds: Array<{ id: string, total: number, reason?: string | null }> }> | null, fulfillments?: Array<{ id: string, state: string, method: string, trackingCode?: string | null, lines: Array<{ orderLineId: string, quantity: number }> }> | null } }; export type GetProductOptionGroupQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetProductOptionGroupQuery = { productOptionGroup?: { id: string, code: string, name: string, options: Array<{ id: string, code: string, name: string }> } | null }; export type UpdateProductOptionGroupMutationVariables = Exact<{ input: UpdateProductOptionGroupInput; }>; export type UpdateProductOptionGroupMutation = { updateProductOptionGroup: { id: string, code: string, name: string, options: Array<{ id: string, code: string, name: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> } }; export type CreateProductOptionMutationVariables = Exact<{ input: CreateProductOptionInput; }>; export type CreateProductOptionMutation = { createProductOption: { id: string, code: string, name: string, groupId: string, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> } }; export type UpdateProductOptionMutationVariables = Exact<{ input: UpdateProductOptionInput; }>; export type UpdateProductOptionMutation = { updateProductOption: { id: string, code: string, name: string, groupId: string } }; export type DeleteProductOptionMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteProductOptionMutation = { deleteProductOption: { result: DeletionResult, message?: string | null } }; export type RemoveOptionGroupFromProductMutationVariables = Exact<{ productId: Scalars['ID']['input']; optionGroupId: Scalars['ID']['input']; force?: InputMaybe<Scalars['Boolean']['input']>; }>; export type RemoveOptionGroupFromProductMutation = { removeOptionGroupFromProduct: { id: string, optionGroups: Array<{ id: string, code: string, options: Array<{ id: string, code: string }> }> } | { errorCode: ErrorCode, message: string, optionGroupCode: string, productVariantCount: number } }; export type GetOptionGroupQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetOptionGroupQuery = { productOptionGroup?: { id: string, code: string, options: Array<{ id: string, code: string }> } | null }; export type GetProductVariantQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetProductVariantQuery = { productVariant?: { id: string, name: string } | null }; export type GetProductWithVariantListQueryVariables = Exact<{ id?: InputMaybe<Scalars['ID']['input']>; variantListOptions?: InputMaybe<ProductVariantListOptions>; }>; export type GetProductWithVariantListQuery = { product?: { id: string, variantList: { totalItems: number, items: Array<{ id: string, createdAt: any, updatedAt: any, enabled: boolean, languageCode: LanguageCode, name: string, currencyCode: CurrencyCode, price: number, priceWithTax: number, stockOnHand: number, trackInventory: GlobalFlag, sku: string, prices: Array<{ currencyCode: CurrencyCode, price: number }>, taxRateApplied: { id: string, name: string, value: number }, taxCategory: { id: string, name: string }, options: Array<{ id: string, code: string, languageCode: LanguageCode, groupId: string, name: string }>, facetValues: Array<{ id: string, code: string, name: string, facet: { id: string, name: string } }>, featuredAsset?: { id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string } | null, assets: Array<{ id: string, name: string, fileSize: number, mimeType: string, type: AssetType, preview: string, source: string }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string }>, channels: Array<{ id: string, code: string }> }> } } | null }; export type GetPromotionListQueryVariables = Exact<{ options?: InputMaybe<PromotionListOptions>; }>; export type GetPromotionListQuery = { promotions: { totalItems: number, items: Array<{ id: string, createdAt: any, updatedAt: any, couponCode?: string | null, startsAt?: any | null, endsAt?: any | null, name: string, description: string, enabled: boolean, perCustomerUsageLimit?: number | null, usageLimit?: number | null, conditions: Array<{ code: string, args: Array<{ name: string, value: string }> }>, actions: Array<{ code: string, args: Array<{ name: string, value: string }> }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string, description: string }> }> } }; export type UpdatePromotionMutationVariables = Exact<{ input: UpdatePromotionInput; }>; export type UpdatePromotionMutation = { updatePromotion: { errorCode: ErrorCode, message: string } | { id: string, createdAt: any, updatedAt: any, couponCode?: string | null, startsAt?: any | null, endsAt?: any | null, name: string, description: string, enabled: boolean, perCustomerUsageLimit?: number | null, usageLimit?: number | null, conditions: Array<{ code: string, args: Array<{ name: string, value: string }> }>, actions: Array<{ code: string, args: Array<{ name: string, value: string }> }>, translations: Array<{ id: string, languageCode: LanguageCode, name: string, description: string }> } }; export type ConfigurableOperationDefFragment = { code: string, description: string, args: Array<{ name: string, type: string, ui?: any | null }> }; export type GetAdjustmentOperationsQueryVariables = Exact<{ [key: string]: never; }>; export type GetAdjustmentOperationsQuery = { promotionActions: Array<{ code: string, description: string, args: Array<{ name: string, type: string, ui?: any | null }> }>, promotionConditions: Array<{ code: string, description: string, args: Array<{ name: string, type: string, ui?: any | null }> }> }; export type GetRolesQueryVariables = Exact<{ options?: InputMaybe<RoleListOptions>; }>; export type GetRolesQuery = { roles: { totalItems: number, items: Array<{ id: string, code: string, description: string, permissions: Array<Permission>, channels: Array<{ id: string, code: string, token: string }> }> } }; export type GetRoleQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetRoleQuery = { role?: { id: string, code: string, description: string, permissions: Array<Permission>, channels: Array<{ id: string, code: string, token: string }> } | null }; export type DeleteRoleMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteRoleMutation = { deleteRole: { result: DeletionResult, message?: string | null } }; export type LogoutMutationVariables = Exact<{ [key: string]: never; }>; export type LogoutMutation = { logout: { success: boolean } }; export type GetShippingMethodQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetShippingMethodQuery = { shippingMethod?: { id: string, code: string, name: string, description: string, calculator: { code: string, args: Array<{ name: string, value: string }> }, checker: { code: string, args: Array<{ name: string, value: string }> } } | null }; export type GetEligibilityCheckersQueryVariables = Exact<{ [key: string]: never; }>; export type GetEligibilityCheckersQuery = { shippingEligibilityCheckers: Array<{ code: string, description: string, args: Array<{ name: string, type: string, description?: string | null, label?: string | null, ui?: any | null }> }> }; export type GetCalculatorsQueryVariables = Exact<{ [key: string]: never; }>; export type GetCalculatorsQuery = { shippingCalculators: Array<{ code: string, description: string, args: Array<{ name: string, type: string, description?: string | null, label?: string | null, ui?: any | null }> }> }; export type TestShippingMethodQueryVariables = Exact<{ input: TestShippingMethodInput; }>; export type TestShippingMethodQuery = { testShippingMethod: { eligible: boolean, quote?: { price: number, priceWithTax: number, metadata?: any | null } | null } }; export type TestEligibleMethodsQueryVariables = Exact<{ input: TestEligibleShippingMethodsInput; }>; export type TestEligibleMethodsQuery = { testEligibleShippingMethods: Array<{ id: string, name: string, description: string, price: number, priceWithTax: number, metadata?: any | null }> }; export type GetMeQueryVariables = Exact<{ [key: string]: never; }>; export type GetMeQuery = { me?: { identifier: string } | null }; export type GetProductsTake3QueryVariables = Exact<{ [key: string]: never; }>; export type GetProductsTake3Query = { products: { items: Array<{ id: string }> } }; export type GetProduct1QueryVariables = Exact<{ [key: string]: never; }>; export type GetProduct1Query = { product?: { id: string } | null }; export type GetProduct2VariantsQueryVariables = Exact<{ [key: string]: never; }>; export type GetProduct2VariantsQuery = { product?: { id: string, variants: Array<{ id: string, name: string }> } | null }; export type GetProductCollectionQueryVariables = Exact<{ [key: string]: never; }>; export type GetProductCollectionQuery = { product?: { collections: Array<{ id: string, name: string }> } | null }; export type GetCollectionShopQueryVariables = Exact<{ id?: InputMaybe<Scalars['ID']['input']>; slug?: InputMaybe<Scalars['String']['input']>; }>; export type GetCollectionShopQuery = { collection?: { id: string, name: string, slug: string, description: string, parent?: { id: string, name: string } | null, children?: Array<{ id: string, name: string }> | null } | null }; export type DisableProductMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DisableProductMutation = { updateProduct: { id: string } }; export type GetCollectionVariantsQueryVariables = Exact<{ id?: InputMaybe<Scalars['ID']['input']>; slug?: InputMaybe<Scalars['String']['input']>; }>; export type GetCollectionVariantsQuery = { collection?: { id: string, productVariants: { items: Array<{ id: string, name: string }> } } | null }; export type GetCollectionListQueryVariables = Exact<{ [key: string]: never; }>; export type GetCollectionListQuery = { collections: { items: Array<{ id: string, name: string }> } }; export type GetProductFacetValuesQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetProductFacetValuesQuery = { product?: { id: string, name: string, facetValues: Array<{ name: string }> } | null }; export type GetVariantFacetValuesQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetVariantFacetValuesQuery = { product?: { id: string, name: string, variants: Array<{ id: string, facetValues: Array<{ name: string }> }> } | null }; export type GetCustomerIdsQueryVariables = Exact<{ [key: string]: never; }>; export type GetCustomerIdsQuery = { customers: { items: Array<{ id: string }> } }; export type StockLocationFragment = { id: string, name: string, description: string }; export type GetStockLocationQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetStockLocationQuery = { stockLocation?: { id: string, name: string, description: string } | null }; export type GetStockLocationsQueryVariables = Exact<{ options?: InputMaybe<StockLocationListOptions>; }>; export type GetStockLocationsQuery = { stockLocations: { totalItems: number, items: Array<{ id: string, name: string, description: string }> } }; export type CreateStockLocationMutationVariables = Exact<{ input: CreateStockLocationInput; }>; export type CreateStockLocationMutation = { createStockLocation: { id: string, name: string, description: string } }; export type UpdateStockLocationMutationVariables = Exact<{ input: UpdateStockLocationInput; }>; export type UpdateStockLocationMutation = { updateStockLocation: { id: string, name: string, description: string } }; export type GetVariantStockLevelsQueryVariables = Exact<{ options?: InputMaybe<ProductVariantListOptions>; }>; export type GetVariantStockLevelsQuery = { productVariants: { items: Array<{ id: string, name: string, stockOnHand: number, stockAllocated: number, stockLevels: Array<{ stockLocationId: string, stockOnHand: number, stockAllocated: number }> }> } }; export type UpdateStockMutationVariables = Exact<{ input: Array<UpdateProductVariantInput> | UpdateProductVariantInput; }>; export type UpdateStockMutation = { updateProductVariants: Array<{ id: string, stockOnHand: number, stockAllocated: number, stockMovements: { totalItems: number, items: Array<{ id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number } | { id: string, type: StockMovementType, quantity: number }> } } | null> }; export type TransitionFulfillmentToStateMutationVariables = Exact<{ id: Scalars['ID']['input']; state: Scalars['String']['input']; }>; export type TransitionFulfillmentToStateMutation = { transitionFulfillmentToState: { id: string, state: string, nextStates: Array<string>, createdAt: any } | { errorCode: ErrorCode, message: string, transitionError: string } }; export type UpdateOrderCustomFieldsMutationVariables = Exact<{ input: UpdateOrderInput; }>; export type UpdateOrderCustomFieldsMutation = { setOrderCustomFields?: { id: string } | null }; export type TestGetStockLocationsListQueryVariables = Exact<{ options?: InputMaybe<StockLocationListOptions>; }>; export type TestGetStockLocationsListQuery = { stockLocations: { totalItems: number, items: Array<{ id: string, name: string, description: string }> } }; export type TestGetStockLocationQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type TestGetStockLocationQuery = { stockLocation?: { id: string, name: string, description: string } | null }; export type TestCreateStockLocationMutationVariables = Exact<{ input: CreateStockLocationInput; }>; export type TestCreateStockLocationMutation = { createStockLocation: { id: string, name: string, description: string } }; export type TestUpdateStockLocationMutationVariables = Exact<{ input: UpdateStockLocationInput; }>; export type TestUpdateStockLocationMutation = { updateStockLocation: { id: string, name: string, description: string } }; export type TestDeleteStockLocationMutationVariables = Exact<{ input: DeleteStockLocationInput; }>; export type TestDeleteStockLocationMutation = { deleteStockLocation: { result: DeletionResult, message?: string | null } }; export type TestGetStockLevelsForVariantQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type TestGetStockLevelsForVariantQuery = { productVariant?: { id: string, stockLevels: Array<{ stockOnHand: number, stockAllocated: number, stockLocationId: string }> } | null }; export type TestSetStockLevelInLocationMutationVariables = Exact<{ input: UpdateProductVariantInput; }>; export type TestSetStockLevelInLocationMutation = { updateProductVariants: Array<{ id: string, stockLevels: Array<{ stockOnHand: number, stockAllocated: number, stockLocationId: string }> } | null> }; export type TestAssignStockLocationToChannelMutationVariables = Exact<{ input: AssignStockLocationsToChannelInput; }>; export type TestAssignStockLocationToChannelMutation = { assignStockLocationsToChannel: Array<{ id: string, name: string }> }; export type TestRemoveStockLocationsFromChannelMutationVariables = Exact<{ input: RemoveStockLocationsFromChannelInput; }>; export type TestRemoveStockLocationsFromChannelMutation = { removeStockLocationsFromChannel: Array<{ id: string, name: string }> }; export type GetTagListQueryVariables = Exact<{ options?: InputMaybe<TagListOptions>; }>; export type GetTagListQuery = { tags: { totalItems: number, items: Array<{ id: string, value: string }> } }; export type GetTagQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetTagQuery = { tag: { id: string, value: string } }; export type CreateTagMutationVariables = Exact<{ input: CreateTagInput; }>; export type CreateTagMutation = { createTag: { id: string, value: string } }; export type UpdateTagMutationVariables = Exact<{ input: UpdateTagInput; }>; export type UpdateTagMutation = { updateTag: { id: string, value: string } }; export type DeleteTagMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteTagMutation = { deleteTag: { message?: string | null, result: DeletionResult } }; export type GetTaxCategoryListQueryVariables = Exact<{ [key: string]: never; }>; export type GetTaxCategoryListQuery = { taxCategories: { items: Array<{ id: string, name: string, isDefault: boolean }> } }; export type GetTaxCategoryQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetTaxCategoryQuery = { taxCategory?: { id: string, name: string, isDefault: boolean } | null }; export type CreateTaxCategoryMutationVariables = Exact<{ input: CreateTaxCategoryInput; }>; export type CreateTaxCategoryMutation = { createTaxCategory: { id: string, name: string, isDefault: boolean } }; export type UpdateTaxCategoryMutationVariables = Exact<{ input: UpdateTaxCategoryInput; }>; export type UpdateTaxCategoryMutation = { updateTaxCategory: { id: string, name: string, isDefault: boolean } }; export type DeleteTaxCategoryMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteTaxCategoryMutation = { deleteTaxCategory: { result: DeletionResult, message?: string | null } }; export type GetTaxRateQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetTaxRateQuery = { taxRate?: { id: string, name: string, enabled: boolean, value: number, category: { id: string, name: string }, zone: { id: string, name: string }, customerGroup?: { id: string, name: string } | null } | null }; export type CreateTaxRateMutationVariables = Exact<{ input: CreateTaxRateInput; }>; export type CreateTaxRateMutation = { createTaxRate: { id: string, name: string, enabled: boolean, value: number, category: { id: string, name: string }, zone: { id: string, name: string }, customerGroup?: { id: string, name: string } | null } }; export type DeleteTaxRateMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteTaxRateMutation = { deleteTaxRate: { result: DeletionResult, message?: string | null } }; export type DeleteZoneMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteZoneMutation = { deleteZone: { result: DeletionResult, message?: string | null } }; export type GetZonesQueryVariables = Exact<{ options?: InputMaybe<ZoneListOptions>; }>; export type GetZonesQuery = { zones: { totalItems: number, items: Array<{ id: string, name: string }> } }; export type GetZoneQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetZoneQuery = { zone?: { id: string, name: string, members: Array<{ id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> } | { id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> }> } | null }; export type GetActiveChannelWithZoneMembersQueryVariables = Exact<{ [key: string]: never; }>; export type GetActiveChannelWithZoneMembersQuery = { activeChannel: { id: string, defaultShippingZone?: { id: string, members: Array<{ name: string } | { name: string }> } | null } }; export type CreateZoneMutationVariables = Exact<{ input: CreateZoneInput; }>; export type CreateZoneMutation = { createZone: { id: string, name: string, members: Array<{ id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> } | { id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> }> } }; export type UpdateZoneMutationVariables = Exact<{ input: UpdateZoneInput; }>; export type UpdateZoneMutation = { updateZone: { id: string, name: string, members: Array<{ id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> } | { id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> }> } }; export type AddMembersToZoneMutationVariables = Exact<{ zoneId: Scalars['ID']['input']; memberIds: Array<Scalars['ID']['input']> | Scalars['ID']['input']; }>; export type AddMembersToZoneMutation = { addMembersToZone: { id: string, name: string, members: Array<{ id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> } | { id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> }> } }; export type RemoveMembersFromZoneMutationVariables = Exact<{ zoneId: Scalars['ID']['input']; memberIds: Array<Scalars['ID']['input']> | Scalars['ID']['input']; }>; export type RemoveMembersFromZoneMutation = { removeMembersFromZone: { id: string, name: string, members: Array<{ id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> } | { id: string, code: string, name: string, enabled: boolean, translations: Array<{ id: string, languageCode: LanguageCode, name: string }> }> } }; export const ProdFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<ProdFragmentFragment, unknown>; export const ProdFragment2FragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment2"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<ProdFragment2Fragment, unknown>; export const ProdFragment1FragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment1"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProdFragment2"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment2"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<ProdFragment1Fragment, unknown>; export const ProdFragment3_1FragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment3_1"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<ProdFragment3_1Fragment, unknown>; export const ProdFragment2_1FragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment2_1"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProdFragment3_1"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment3_1"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<ProdFragment2_1Fragment, unknown>; export const ProdFragment1_1FragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment1_1"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProdFragment2_1"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment3_1"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment2_1"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProdFragment3_1"}}]}}]} as unknown as DocumentNode<ProdFragment1_1Fragment, unknown>; export const AdministratorFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Administrator"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Administrator"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"lastLogin"}},{"kind":"Field","name":{"kind":"Name","value":"roles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}}]}}]}}]}}]} as unknown as DocumentNode<AdministratorFragment, unknown>; export const AssetFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}}]} as unknown as DocumentNode<AssetFragment, unknown>; export const ProductVariantFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductVariant"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"taxRateApplied"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxCategory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"groupId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}}]} as unknown as DocumentNode<ProductVariantFragment, unknown>; export const ProductWithVariantsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductWithVariants"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"optionGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductVariant"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductVariant"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"taxRateApplied"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxCategory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"groupId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]} as unknown as DocumentNode<ProductWithVariantsFragment, unknown>; export const RoleFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Role"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}}]}}]}}]} as unknown as DocumentNode<RoleFragment, unknown>; export const ConfigurableOperationFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]} as unknown as DocumentNode<ConfigurableOperationFragment, unknown>; export const CollectionFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Collection"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Collection"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"isPrivate"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"filters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"children"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"position"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]} as unknown as DocumentNode<CollectionFragment, unknown>; export const FacetValueFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetValue"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FacetValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<FacetValueFragment, unknown>; export const FacetWithValuesFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetWithValues"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Facet"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"isPrivate"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"values"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"FacetValue"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetValue"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FacetValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<FacetWithValuesFragment, unknown>; export const AddressFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Address"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Address"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}},{"kind":"Field","name":{"kind":"Name","value":"defaultShippingAddress"}},{"kind":"Field","name":{"kind":"Name","value":"defaultBillingAddress"}}]}}]} as unknown as DocumentNode<AddressFragment, unknown>; export const CustomerFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Customer"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"verified"}},{"kind":"Field","name":{"kind":"Name","value":"lastLogin"}}]}},{"kind":"Field","name":{"kind":"Name","value":"addresses"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Address"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Address"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Address"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}},{"kind":"Field","name":{"kind":"Name","value":"defaultShippingAddress"}},{"kind":"Field","name":{"kind":"Name","value":"defaultBillingAddress"}}]}}]} as unknown as DocumentNode<CustomerFragment, unknown>; export const AdjustmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Adjustment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Adjustment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]} as unknown as DocumentNode<AdjustmentFragment, unknown>; export const OrderFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Order"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}}]}}]} as unknown as DocumentNode<OrderFragment, unknown>; export const ShippingAddressFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingAddress"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderAddress"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}}]} as unknown as DocumentNode<ShippingAddressFragment, unknown>; export const PaymentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}}]} as unknown as DocumentNode<PaymentFragment, unknown>; export const OrderWithLinesFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithLines"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingAddress"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"total"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingAddress"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderAddress"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}}]} as unknown as DocumentNode<OrderWithLinesFragment, unknown>; export const PromotionFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Promotion"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Promotion"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"couponCode"}},{"kind":"Field","name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"perCustomerUsageLimit"}},{"kind":"Field","name":{"kind":"Name","value":"usageLimit"}},{"kind":"Field","name":{"kind":"Name","value":"conditions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"actions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]} as unknown as DocumentNode<PromotionFragment, unknown>; export const CountryFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Country"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Region"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<CountryFragment, unknown>; export const ZoneFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Zone"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Zone"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"members"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Country"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Country"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Region"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<ZoneFragment, unknown>; export const TaxRateFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TaxRate"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"TaxRate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"category"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"zone"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"customerGroup"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<TaxRateFragment, unknown>; export const CurrentUserFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentUser"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CurrentUser"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}}]}}]}}]} as unknown as DocumentNode<CurrentUserFragment, unknown>; export const VariantWithStockFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"VariantWithStock"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"stockAllocated"}},{"kind":"Field","name":{"kind":"Name","value":"stockMovements"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StockMovement"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<VariantWithStockFragment, unknown>; export const FulfillmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Fulfillment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Fulfillment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}}]} as unknown as DocumentNode<FulfillmentFragment, unknown>; export const ChannelFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Channel"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Channel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"availableCurrencyCodes"}},{"kind":"Field","name":{"kind":"Name","value":"defaultCurrencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"defaultLanguageCode"}},{"kind":"Field","name":{"kind":"Name","value":"defaultShippingZone"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"defaultTaxZone"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"pricesIncludeTax"}}]}}]} as unknown as DocumentNode<ChannelFragment, unknown>; export const GlobalSettingsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GlobalSettings"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GlobalSettings"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"availableLanguages"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"outOfStockThreshold"}},{"kind":"Field","name":{"kind":"Name","value":"serverConfig"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderProcess"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"to"}}]}},{"kind":"Field","name":{"kind":"Name","value":"permittedAssetTypes"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"assignable"}}]}},{"kind":"Field","name":{"kind":"Name","value":"customFieldConfig"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"Customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CustomField"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<GlobalSettingsFragment, unknown>; export const CustomerGroupFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerGroup"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CustomerGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"customers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<CustomerGroupFragment, unknown>; export const ProductOptionGroupFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductOptionGroup"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductOptionGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<ProductOptionGroupFragment, unknown>; export const ProductWithOptionsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductWithOptions"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"optionGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]}}]} as unknown as DocumentNode<ProductWithOptionsFragment, unknown>; export const ShippingMethodFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingMethod"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ShippingMethod"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"calculator"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"checker"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]}}]} as unknown as DocumentNode<ShippingMethodFragment, unknown>; export const CanceledOrderFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CanceledOrder"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}}]} as unknown as DocumentNode<CanceledOrderFragment, unknown>; export const AssetFragFirstFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AssetFragFirst"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}}]} as unknown as DocumentNode<AssetFragFirstFragment, unknown>; export const AssetWithTagsAndFocalPointFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AssetWithTagsAndFocalPoint"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}},{"kind":"Field","name":{"kind":"Name","value":"focalPoint"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"x"}},{"kind":"Field","name":{"kind":"Name","value":"y"}}]}},{"kind":"Field","name":{"kind":"Name","value":"tags"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}}]} as unknown as DocumentNode<AssetWithTagsAndFocalPointFragment, unknown>; export const OrderWithModificationsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithModifications"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"orderPlacedQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"discountedLinePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedLinePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"modifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"note"}},{"kind":"Field","name":{"kind":"Name","value":"priceChange"}},{"kind":"Field","name":{"kind":"Name","value":"isSettled"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}}]}},{"kind":"Field","name":{"kind":"Name","value":"refund"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"promotions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"couponCode"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"countryCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"countryCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"discountedPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<OrderWithModificationsFragment, unknown>; export const RefundFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Refund"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Refund"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"items"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}}]}}]} as unknown as DocumentNode<RefundFragment, unknown>; export const PaymentMethodFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PaymentMethod"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PaymentMethod"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"checker"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"handler"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]} as unknown as DocumentNode<PaymentMethodFragment, unknown>; export const ConfigurableOperationDefFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperationDef"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperationDefinition"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"ui"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode<ConfigurableOperationDefFragment, unknown>; export const StockLocationFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StockLocation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StockLocation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode<StockLocationFragment, unknown>; export const GetAdministratorsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAdministrators"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"AdministratorListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"administrators"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Administrator"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Administrator"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Administrator"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"lastLogin"}},{"kind":"Field","name":{"kind":"Name","value":"roles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}}]}}]}}]}}]} as unknown as DocumentNode<GetAdministratorsQuery, GetAdministratorsQueryVariables>; export const GetAdministratorDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAdministrator"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"administrator"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Administrator"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Administrator"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Administrator"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"lastLogin"}},{"kind":"Field","name":{"kind":"Name","value":"roles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}}]}}]}}]}}]} as unknown as DocumentNode<GetAdministratorQuery, GetAdministratorQueryVariables>; export const ActiveAdministratorDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ActiveAdministrator"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeAdministrator"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Administrator"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Administrator"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Administrator"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"lastLogin"}},{"kind":"Field","name":{"kind":"Name","value":"roles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}}]}}]}}]}}]} as unknown as DocumentNode<ActiveAdministratorQuery, ActiveAdministratorQueryVariables>; export const UpdateActiveAdministratorDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateActiveAdministrator"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateActiveAdministratorInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateActiveAdministrator"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Administrator"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Administrator"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Administrator"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"lastLogin"}},{"kind":"Field","name":{"kind":"Name","value":"roles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}}]}}]}}]}}]} as unknown as DocumentNode<UpdateActiveAdministratorMutation, UpdateActiveAdministratorMutationVariables>; export const DeleteAdministratorDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteAdministrator"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteAdministrator"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"result"}}]}}]}}]} as unknown as DocumentNode<DeleteAdministratorMutation, DeleteAdministratorMutationVariables>; export const Q1Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Q1"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"StringValue","value":"T_1","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<Q1Query, Q1QueryVariables>; export const Q2Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Q2"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"StringValue","value":"T_1","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<Q2Query, Q2QueryVariables>; export const GetCollectionWithAssetsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCollectionWithAssets"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"collection"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}}]} as unknown as DocumentNode<GetCollectionWithAssetsQuery, GetCollectionWithAssetsQueryVariables>; export const AssignAssetsToChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"assignAssetsToChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AssignAssetsToChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignAssetsToChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}}]} as unknown as DocumentNode<AssignAssetsToChannelMutation, AssignAssetsToChannelMutationVariables>; export const CanCreateCustomerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CanCreateCustomer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateCustomerInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createCustomer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]} as unknown as DocumentNode<CanCreateCustomerMutation, CanCreateCustomerMutationVariables>; export const GetCustomerCountDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomerCount"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<GetCustomerCountQuery, GetCustomerCountQueryVariables>; export const DeepFieldResolutionTestQueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"DeepFieldResolutionTestQuery"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"StringValue","value":"T_1","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taxRateApplied"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customerGroup"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<DeepFieldResolutionTestQueryQuery, DeepFieldResolutionTestQueryQueryVariables>; export const AuthenticateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"Authenticate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AuthenticationInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"authenticate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentUser"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"InvalidCredentialsError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"authenticationError"}},{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentUser"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CurrentUser"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}}]}}]}}]} as unknown as DocumentNode<AuthenticateMutation, AuthenticateMutationVariables>; export const GetCustomersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalItems"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}}]}}]}}]}}]} as unknown as DocumentNode<GetCustomersQuery, GetCustomersQueryVariables>; export const GetCustomerUserAuthDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomerUserAuth"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"verified"}},{"kind":"Field","name":{"kind":"Name","value":"authenticationMethods"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"strategy"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetCustomerUserAuthQuery, GetCustomerUserAuthQueryVariables>; export const DeleteChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"result"}}]}}]}}]} as unknown as DocumentNode<DeleteChannelMutation, DeleteChannelMutationVariables>; export const GetChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"defaultCurrencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"availableCurrencyCodes"}},{"kind":"Field","name":{"kind":"Name","value":"defaultLanguageCode"}},{"kind":"Field","name":{"kind":"Name","value":"availableLanguageCodes"}},{"kind":"Field","name":{"kind":"Name","value":"outOfStockThreshold"}},{"kind":"Field","name":{"kind":"Name","value":"pricesIncludeTax"}}]}}]}}]} as unknown as DocumentNode<GetChannelQuery, GetChannelQueryVariables>; export const UpdateGlobalLanguagesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateGlobalLanguages"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateGlobalSettingsInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateGlobalSettings"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GlobalSettings"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"availableLanguages"}}]}}]}}]}}]} as unknown as DocumentNode<UpdateGlobalLanguagesMutation, UpdateGlobalLanguagesMutationVariables>; export const GetCollectionsWithAssetsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCollectionsWithAssets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"collections"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetCollectionsWithAssetsQuery, GetCollectionsWithAssetsQueryVariables>; export const GetProductsWithVariantIdsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductsWithVariantIds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"products"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"sort"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"EnumValue","value":"ASC"}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetProductsWithVariantIdsQuery, GetProductsWithVariantIdsQueryVariables>; export const GetCollectionListAdminDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCollectionListAdmin"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"CollectionListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"collections"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Collection"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Collection"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Collection"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"isPrivate"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"filters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"children"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"position"}}]}}]}}]} as unknown as DocumentNode<GetCollectionListAdminQuery, GetCollectionListAdminQueryVariables>; export const MoveCollectionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"MoveCollection"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"MoveCollectionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"moveCollection"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Collection"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Collection"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Collection"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"isPrivate"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"filters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"children"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"position"}}]}}]}}]} as unknown as DocumentNode<MoveCollectionMutation, MoveCollectionMutationVariables>; export const GetFacetValuesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFacetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"facets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"values"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"FacetValue"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetValue"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FacetValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<GetFacetValuesQuery, GetFacetValuesQueryVariables>; export const GetCollectionProductsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCollectionProducts"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"collection"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productVariants"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"sort"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"EnumValue","value":"ASC"}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productId"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetCollectionProductsQuery, GetCollectionProductsQueryVariables>; export const CreateCollectionSelectVariantsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateCollectionSelectVariants"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateCollectionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createCollection"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"productVariants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]}}]} as unknown as DocumentNode<CreateCollectionSelectVariantsMutation, CreateCollectionSelectVariantsMutationVariables>; export const GetCollectionBreadcrumbsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCollectionBreadcrumbs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"collection"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"breadcrumbs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}}]}}]}}]} as unknown as DocumentNode<GetCollectionBreadcrumbsQuery, GetCollectionBreadcrumbsQueryVariables>; export const GetCollectionsForProductsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCollectionsForProducts"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"term"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"products"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"filter"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"name"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"contains"},"value":{"kind":"Variable","name":{"kind":"Name","value":"term"}}}]}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"collections"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetCollectionsForProductsQuery, GetCollectionsForProductsQueryVariables>; export const DeleteCollectionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteCollection"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteCollection"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteCollectionMutation, DeleteCollectionMutationVariables>; export const GetProductCollectionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductCollections"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"collections"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<GetProductCollectionsQuery, GetProductCollectionsQueryVariables>; export const GetProductCollectionsWithParentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductCollectionsWithParent"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"collections"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetProductCollectionsWithParentQuery, GetProductCollectionsWithParentQueryVariables>; export const GetCollectionNestedParentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCollectionNestedParents"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"collections"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetCollectionNestedParentsQuery, GetCollectionNestedParentsQueryVariables>; export const PreviewCollectionVariantsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"PreviewCollectionVariants"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"PreviewCollectionVariantsInput"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariantListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"previewCollectionVariants"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}},{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<PreviewCollectionVariantsQuery, PreviewCollectionVariantsQueryVariables>; export const RemoveCollectionsFromChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveCollectionsFromChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RemoveCollectionsFromChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeCollectionsFromChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Collection"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Collection"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Collection"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"isPrivate"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"filters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"children"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"position"}}]}}]}}]} as unknown as DocumentNode<RemoveCollectionsFromChannelMutation, RemoveCollectionsFromChannelMutationVariables>; export const DeleteCollectionsBulkDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteCollectionsBulk"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ids"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteCollections"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"ids"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ids"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"result"}}]}}]}}]} as unknown as DocumentNode<DeleteCollectionsBulkMutation, DeleteCollectionsBulkMutationVariables>; export const GetCheckersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCheckers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"shippingEligibilityCheckers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"defaultValue"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"list"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"required"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}}]}}]} as unknown as DocumentNode<GetCheckersQuery, GetCheckersQueryVariables>; export const DeleteCountryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteCountry"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteCountry"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteCountryMutation, DeleteCountryMutationVariables>; export const GetCountryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCountry"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"country"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Country"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Country"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Region"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<GetCountryQuery, GetCountryQueryVariables>; export const CreateCountryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateCountry"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateCountryInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createCountry"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Country"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Country"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Region"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<CreateCountryMutation, CreateCountryMutationVariables>; export const DeleteCustomerAddressDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteCustomerAddress"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteCustomerAddress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"success"}}]}}]}}]} as unknown as DocumentNode<DeleteCustomerAddressMutation, DeleteCustomerAddressMutationVariables>; export const GetCustomerWithUserDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomerWithUser"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"verified"}}]}}]}}]}}]} as unknown as DocumentNode<GetCustomerWithUserQuery, GetCustomerWithUserQueryVariables>; export const GetCustomerOrdersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomerOrders"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]}}]} as unknown as DocumentNode<GetCustomerOrdersQuery, GetCustomerOrdersQueryVariables>; export const AddNoteToCustomerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AddNoteToCustomer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AddNoteToCustomerInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addNoteToCustomer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Customer"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Address"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Address"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}},{"kind":"Field","name":{"kind":"Name","value":"defaultShippingAddress"}},{"kind":"Field","name":{"kind":"Name","value":"defaultBillingAddress"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Customer"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"verified"}},{"kind":"Field","name":{"kind":"Name","value":"lastLogin"}}]}},{"kind":"Field","name":{"kind":"Name","value":"addresses"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Address"}}]}}]}}]} as unknown as DocumentNode<AddNoteToCustomerMutation, AddNoteToCustomerMutationVariables>; export const ReindexDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"Reindex"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"reindex"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<ReindexMutation, ReindexMutationVariables>; export const SearchFacetValuesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SearchFacetValues"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SearchInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"search"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalItems"}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"count"}},{"kind":"Field","name":{"kind":"Name","value":"facetValue"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<SearchFacetValuesQuery, SearchFacetValuesQueryVariables>; export const SearchCollectionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SearchCollections"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SearchInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"search"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalItems"}},{"kind":"Field","name":{"kind":"Name","value":"collections"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"count"}},{"kind":"Field","name":{"kind":"Name","value":"collection"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<SearchCollectionsQuery, SearchCollectionsQueryVariables>; export const SearchGetAssetsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SearchGetAssets"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SearchInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"search"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalItems"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productId"}},{"kind":"Field","name":{"kind":"Name","value":"productName"}},{"kind":"Field","name":{"kind":"Name","value":"productVariantName"}},{"kind":"Field","name":{"kind":"Name","value":"productAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"focalPoint"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"x"}},{"kind":"Field","name":{"kind":"Name","value":"y"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariantAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"focalPoint"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"x"}},{"kind":"Field","name":{"kind":"Name","value":"y"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<SearchGetAssetsQuery, SearchGetAssetsQueryVariables>; export const SearchGetPricesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SearchGetPrices"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SearchInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"search"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PriceRange"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"min"}},{"kind":"Field","name":{"kind":"Name","value":"max"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SinglePrice"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PriceRange"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"min"}},{"kind":"Field","name":{"kind":"Name","value":"max"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SinglePrice"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<SearchGetPricesQuery, SearchGetPricesQueryVariables>; export const CreateDraftOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateDraftOrder"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createDraftOrder"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithLines"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingAddress"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderAddress"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithLines"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingAddress"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"total"}}]}}]} as unknown as DocumentNode<CreateDraftOrderMutation, CreateDraftOrderMutationVariables>; export const AddItemToDraftOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AddItemToDraftOrder"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AddItemToDraftOrderInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addItemToDraftOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"orderId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}}},{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithLines"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingAddress"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderAddress"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithLines"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingAddress"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"total"}}]}}]} as unknown as DocumentNode<AddItemToDraftOrderMutation, AddItemToDraftOrderMutationVariables>; export const AdjustDraftOrderLineDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AdjustDraftOrderLine"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AdjustDraftOrderLineInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustDraftOrderLine"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"orderId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}}},{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithLines"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingAddress"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderAddress"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithLines"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingAddress"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"total"}}]}}]} as unknown as DocumentNode<AdjustDraftOrderLineMutation, AdjustDraftOrderLineMutationVariables>; export const RemoveDraftOrderLineDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveDraftOrderLine"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderLineId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeDraftOrderLine"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"orderId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderLineId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderLineId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithLines"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingAddress"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderAddress"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithLines"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingAddress"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"total"}}]}}]} as unknown as DocumentNode<RemoveDraftOrderLineMutation, RemoveDraftOrderLineMutationVariables>; export const SetCustomerForDraftOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetCustomerForDraftOrder"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"customerId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateCustomerInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setCustomerForDraftOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"orderId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}}},{"kind":"Argument","name":{"kind":"Name","value":"customerId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"customerId"}}},{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithLines"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingAddress"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderAddress"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithLines"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingAddress"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"total"}}]}}]} as unknown as DocumentNode<SetCustomerForDraftOrderMutation, SetCustomerForDraftOrderMutationVariables>; export const SetDraftOrderShippingAddressDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetDraftOrderShippingAddress"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateAddressInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setDraftOrderShippingAddress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"orderId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}}},{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithLines"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingAddress"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderAddress"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithLines"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingAddress"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"total"}}]}}]} as unknown as DocumentNode<SetDraftOrderShippingAddressMutation, SetDraftOrderShippingAddressMutationVariables>; export const SetDraftOrderBillingAddressDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetDraftOrderBillingAddress"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateAddressInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setDraftOrderBillingAddress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"orderId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}}},{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithLines"}},{"kind":"Field","name":{"kind":"Name","value":"billingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingAddress"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingAddress"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderAddress"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithLines"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingAddress"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"total"}}]}}]} as unknown as DocumentNode<SetDraftOrderBillingAddressMutation, SetDraftOrderBillingAddressMutationVariables>; export const ApplyCouponCodeToDraftOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ApplyCouponCodeToDraftOrder"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"couponCode"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"applyCouponCodeToDraftOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"orderId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}}},{"kind":"Argument","name":{"kind":"Name","value":"couponCode"},"value":{"kind":"Variable","name":{"kind":"Name","value":"couponCode"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithLines"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingAddress"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderAddress"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithLines"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingAddress"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"total"}}]}}]} as unknown as DocumentNode<ApplyCouponCodeToDraftOrderMutation, ApplyCouponCodeToDraftOrderMutationVariables>; export const RemoveCouponCodeFromDraftOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveCouponCodeFromDraftOrder"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"couponCode"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeCouponCodeFromDraftOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"orderId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}}},{"kind":"Argument","name":{"kind":"Name","value":"couponCode"},"value":{"kind":"Variable","name":{"kind":"Name","value":"couponCode"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithLines"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingAddress"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderAddress"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithLines"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingAddress"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"total"}}]}}]} as unknown as DocumentNode<RemoveCouponCodeFromDraftOrderMutation, RemoveCouponCodeFromDraftOrderMutationVariables>; export const DraftOrderEligibleShippingMethodsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"DraftOrderEligibleShippingMethods"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"eligibleShippingMethodsForDraftOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"orderId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}}]}}]}}]} as unknown as DocumentNode<DraftOrderEligibleShippingMethodsQuery, DraftOrderEligibleShippingMethodsQueryVariables>; export const SetDraftOrderShippingMethodDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetDraftOrderShippingMethod"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"shippingMethodId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setDraftOrderShippingMethod"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"orderId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderId"}}},{"kind":"Argument","name":{"kind":"Name","value":"shippingMethodId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"shippingMethodId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithLines"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingAddress"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderAddress"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithLines"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingAddress"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"total"}}]}}]} as unknown as DocumentNode<SetDraftOrderShippingMethodMutation, SetDraftOrderShippingMethodMutationVariables>; export const GetOrderPlacedAtDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderPlacedAt"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"order"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"orderPlacedAt"}}]}}]}}]} as unknown as DocumentNode<GetOrderPlacedAtQuery, GetOrderPlacedAtQueryVariables>; export const GetEntityDuplicatorsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetEntityDuplicators"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityDuplicators"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"requiresPermission"}},{"kind":"Field","name":{"kind":"Name","value":"forEntities"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"defaultValue"}}]}}]}}]}}]} as unknown as DocumentNode<GetEntityDuplicatorsQuery, GetEntityDuplicatorsQueryVariables>; export const DuplicateEntityDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DuplicateEntity"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DuplicateEntityInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"duplicateEntity"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"DuplicateEntitySuccess"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"newEntityId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"DuplicateEntityError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"duplicationError"}}]}}]}}]}}]} as unknown as DocumentNode<DuplicateEntityMutation, DuplicateEntityMutationVariables>; export const IdTest1Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"IdTest1"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"products"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"take"},"value":{"kind":"IntValue","value":"5"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]} as unknown as DocumentNode<IdTest1Query, IdTest1QueryVariables>; export const IdTest2Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"IdTest2"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"products"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"take"},"value":{"kind":"IntValue","value":"1"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<IdTest2Query, IdTest2QueryVariables>; export const IdTest3Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"IdTest3"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"StringValue","value":"T_1","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<IdTest3Query, IdTest3QueryVariables>; export const IdTest4Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"IdTest4"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateProduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"StringValue","value":"T_1","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"featuredAssetId"},"value":{"kind":"StringValue","value":"T_3","block":false}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]} as unknown as DocumentNode<IdTest4Mutation, IdTest4MutationVariables>; export const IdTest5Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"IdTest5"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateProduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"StringValue","value":"T_1","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"translations"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"StringValue","value":"T_1","block":false}},{"kind":"ObjectField","name":{"kind":"Name","value":"languageCode"},"value":{"kind":"EnumValue","value":"en"}},{"kind":"ObjectField","name":{"kind":"Name","value":"name"},"value":{"kind":"StringValue","value":"changed","block":false}}]}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<IdTest5Mutation, IdTest5MutationVariables>; export const IdTest6Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"IdTest6"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<IdTest6Query, IdTest6QueryVariables>; export const IdTest7Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"IdTest7"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateProductInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateProduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]} as unknown as DocumentNode<IdTest7Mutation, IdTest7MutationVariables>; export const IdTest8Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"IdTest8"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateProductInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateProduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<IdTest8Mutation, IdTest8MutationVariables>; export const IdTest9Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"IdTest9"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"products"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"take"},"value":{"kind":"IntValue","value":"1"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProdFragment"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<IdTest9Query, IdTest9QueryVariables>; export const IdTest10Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"IdTest10"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"products"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"take"},"value":{"kind":"IntValue","value":"1"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProdFragment1"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment2"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment1"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProdFragment2"}}]}}]} as unknown as DocumentNode<IdTest10Query, IdTest10QueryVariables>; export const IdTest11Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"IdTest11"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"products"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"take"},"value":{"kind":"IntValue","value":"1"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProdFragment1_1"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment3_1"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment2_1"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProdFragment3_1"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProdFragment1_1"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProdFragment2_1"}}]}}]} as unknown as DocumentNode<IdTest11Query, IdTest11QueryVariables>; export const GetFacetWithValueListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFacetWithValueList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"facet"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"isPrivate"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"valueList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"FacetValue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetValue"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FacetValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<GetFacetWithValueListQuery, GetFacetWithValueListQueryVariables>; export const DeleteFacetValuesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteFacetValues"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ids"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"force"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteFacetValues"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"ids"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ids"}}},{"kind":"Argument","name":{"kind":"Name","value":"force"},"value":{"kind":"Variable","name":{"kind":"Name","value":"force"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteFacetValuesMutation, DeleteFacetValuesMutationVariables>; export const DeleteFacetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteFacet"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"force"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteFacet"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"force"},"value":{"kind":"Variable","name":{"kind":"Name","value":"force"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteFacetMutation, DeleteFacetMutationVariables>; export const GetProductWithFacetValuesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductWithFacetValues"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetProductWithFacetValuesQuery, GetProductWithFacetValuesQueryVariables>; export const GetProductListWithVariantsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductListWithVariants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"products"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<GetProductListWithVariantsQuery, GetProductListWithVariantsQueryVariables>; export const CreateFacetValuesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateFacetValues"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateFacetValueInput"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createFacetValues"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"FacetValue"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetValue"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FacetValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<CreateFacetValuesMutation, CreateFacetValuesMutationVariables>; export const UpdateFacetValuesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateFacetValues"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateFacetValueInput"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateFacetValues"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"FacetValue"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetValue"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FacetValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<UpdateFacetValuesMutation, UpdateFacetValuesMutationVariables>; export const AssignFacetsToChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AssignFacetsToChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AssignFacetsToChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignFacetsToChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<AssignFacetsToChannelMutation, AssignFacetsToChannelMutationVariables>; export const RemoveFacetsFromChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveFacetsFromChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RemoveFacetsFromChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeFacetsFromChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Facet"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FacetInUseError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"productCount"}},{"kind":"Field","name":{"kind":"Name","value":"variantCount"}}]}}]}}]}}]} as unknown as DocumentNode<RemoveFacetsFromChannelMutation, RemoveFacetsFromChannelMutationVariables>; export const GetGlobalSettingsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetGlobalSettings"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"globalSettings"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"GlobalSettings"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GlobalSettings"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GlobalSettings"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"availableLanguages"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"outOfStockThreshold"}},{"kind":"Field","name":{"kind":"Name","value":"serverConfig"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderProcess"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"to"}}]}},{"kind":"Field","name":{"kind":"Name","value":"permittedAssetTypes"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"assignable"}}]}},{"kind":"Field","name":{"kind":"Name","value":"customFieldConfig"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"Customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CustomField"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetGlobalSettingsQuery, GetGlobalSettingsQueryVariables>; export const SearchProductsAdminDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SearchProductsAdmin"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SearchInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"search"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalItems"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"productId"}},{"kind":"Field","name":{"kind":"Name","value":"productName"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"productVariantId"}},{"kind":"Field","name":{"kind":"Name","value":"productVariantName"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}}]}}]}}]}}]} as unknown as DocumentNode<SearchProductsAdminQuery, SearchProductsAdminQueryVariables>; export const CreateAdministratorDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateAdministrator"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateAdministratorInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createAdministrator"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Administrator"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Administrator"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Administrator"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"lastLogin"}},{"kind":"Field","name":{"kind":"Name","value":"roles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}}]}}]}}]}}]} as unknown as DocumentNode<CreateAdministratorMutation, CreateAdministratorMutationVariables>; export const UpdateProductDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateProduct"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateProductInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateProduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductWithVariants"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductVariant"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"taxRateApplied"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxCategory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"groupId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductWithVariants"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"optionGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductVariant"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]} as unknown as DocumentNode<UpdateProductMutation, UpdateProductMutationVariables>; export const CreateProductDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateProduct"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateProductInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createProduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductWithVariants"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductVariant"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"taxRateApplied"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxCategory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"groupId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductWithVariants"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"optionGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductVariant"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]} as unknown as DocumentNode<CreateProductMutation, CreateProductMutationVariables>; export const GetProductWithVariantsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductWithVariants"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"slug"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"slug"}}},{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductWithVariants"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductVariant"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"taxRateApplied"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxCategory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"groupId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductWithVariants"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"optionGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductVariant"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]} as unknown as DocumentNode<GetProductWithVariantsQuery, GetProductWithVariantsQueryVariables>; export const GetProductListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ProductListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"products"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<GetProductListQuery, GetProductListQueryVariables>; export const CreateProductVariantsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateProductVariants"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateProductVariantInput"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createProductVariants"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductVariant"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductVariant"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"taxRateApplied"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxCategory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"groupId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]} as unknown as DocumentNode<CreateProductVariantsMutation, CreateProductVariantsMutationVariables>; export const UpdateProductVariantsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateProductVariants"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateProductVariantInput"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateProductVariants"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductVariant"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductVariant"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"taxRateApplied"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxCategory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"groupId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]} as unknown as DocumentNode<UpdateProductVariantsMutation, UpdateProductVariantsMutationVariables>; export const UpdateTaxRateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateTaxRate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateTaxRateInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateTaxRate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TaxRate"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TaxRate"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"TaxRate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"category"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"zone"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"customerGroup"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<UpdateTaxRateMutation, UpdateTaxRateMutationVariables>; export const CreateFacetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateFacet"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateFacetInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createFacet"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"FacetWithValues"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetValue"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FacetValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetWithValues"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Facet"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"isPrivate"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"values"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"FacetValue"}}]}}]}}]} as unknown as DocumentNode<CreateFacetMutation, CreateFacetMutationVariables>; export const UpdateFacetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateFacet"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateFacetInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateFacet"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"FacetWithValues"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetValue"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FacetValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetWithValues"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Facet"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"isPrivate"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"values"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"FacetValue"}}]}}]}}]} as unknown as DocumentNode<UpdateFacetMutation, UpdateFacetMutationVariables>; export const GetCustomerListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomerList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"CustomerListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customers"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"verified"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<GetCustomerListQuery, GetCustomerListQueryVariables>; export const GetAssetListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAssetList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"AssetListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assets"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}}]} as unknown as DocumentNode<GetAssetListQuery, GetAssetListQueryVariables>; export const CreateRoleDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateRole"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateRoleInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createRole"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Role"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Role"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}}]}}]}}]} as unknown as DocumentNode<CreateRoleMutation, CreateRoleMutationVariables>; export const CreateCollectionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateCollection"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateCollectionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createCollection"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Collection"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Collection"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Collection"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"isPrivate"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"filters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"children"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"position"}}]}}]}}]} as unknown as DocumentNode<CreateCollectionMutation, CreateCollectionMutationVariables>; export const UpdateCollectionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateCollection"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateCollectionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateCollection"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Collection"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Collection"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Collection"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"isPrivate"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"filters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"children"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"position"}}]}}]}}]} as unknown as DocumentNode<UpdateCollectionMutation, UpdateCollectionMutationVariables>; export const GetCustomerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderListOptions"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"OrderListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Customer"}},{"kind":"Field","name":{"kind":"Name","value":"orders"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Address"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Address"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}},{"kind":"Field","name":{"kind":"Name","value":"defaultShippingAddress"}},{"kind":"Field","name":{"kind":"Name","value":"defaultBillingAddress"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Customer"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"verified"}},{"kind":"Field","name":{"kind":"Name","value":"lastLogin"}}]}},{"kind":"Field","name":{"kind":"Name","value":"addresses"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Address"}}]}}]}}]} as unknown as DocumentNode<GetCustomerQuery, GetCustomerQueryVariables>; export const AttemptLoginDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AttemptLogin"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"username"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"password"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"rememberMe"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"login"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"username"},"value":{"kind":"Variable","name":{"kind":"Name","value":"username"}}},{"kind":"Argument","name":{"kind":"Name","value":"password"},"value":{"kind":"Variable","name":{"kind":"Name","value":"password"}}},{"kind":"Argument","name":{"kind":"Name","value":"rememberMe"},"value":{"kind":"Variable","name":{"kind":"Name","value":"rememberMe"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentUser"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentUser"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CurrentUser"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}}]}}]}}]} as unknown as DocumentNode<AttemptLoginMutation, AttemptLoginMutationVariables>; export const GetCountryListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCountryList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"CountryListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"countries"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<GetCountryListQuery, GetCountryListQueryVariables>; export const UpdateCountryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateCountry"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateCountryInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateCountry"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Country"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Country"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Region"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<UpdateCountryMutation, UpdateCountryMutationVariables>; export const GetFacetListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFacetList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"FacetListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"facets"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"FacetWithValues"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetValue"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FacetValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetWithValues"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Facet"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"isPrivate"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"values"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"FacetValue"}}]}}]}}]} as unknown as DocumentNode<GetFacetListQuery, GetFacetListQueryVariables>; export const GetFacetListSimpleDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFacetListSimple"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"FacetListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"facets"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<GetFacetListSimpleQuery, GetFacetListSimpleQueryVariables>; export const DeleteProductDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteProduct"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteProduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}}]}}]}}]} as unknown as DocumentNode<DeleteProductMutation, DeleteProductMutationVariables>; export const GetProductSimpleDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductSimple"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"slug"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"slug"}}},{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}}]}}]} as unknown as DocumentNode<GetProductSimpleQuery, GetProductSimpleQueryVariables>; export const GetStockMovementDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetStockMovement"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"VariantWithStock"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"VariantWithStock"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"stockAllocated"}},{"kind":"Field","name":{"kind":"Name","value":"stockMovements"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StockMovement"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<GetStockMovementQuery, GetStockMovementQueryVariables>; export const GetRunningJobsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRunningJobs"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"JobListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"jobs"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"queueName"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"isSettled"}},{"kind":"Field","name":{"kind":"Name","value":"duration"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<GetRunningJobsQuery, GetRunningJobsQueryVariables>; export const CreatePromotionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreatePromotion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreatePromotionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createPromotion"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Promotion"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Promotion"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Promotion"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"couponCode"}},{"kind":"Field","name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"perCustomerUsageLimit"}},{"kind":"Field","name":{"kind":"Name","value":"usageLimit"}},{"kind":"Field","name":{"kind":"Name","value":"conditions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"actions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]} as unknown as DocumentNode<CreatePromotionMutation, CreatePromotionMutationVariables>; export const MeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Me"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"me"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentUser"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentUser"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CurrentUser"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}}]}}]}}]} as unknown as DocumentNode<MeQuery, MeQueryVariables>; export const CreateChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Channel"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"LanguageNotAvailableError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Channel"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Channel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"availableCurrencyCodes"}},{"kind":"Field","name":{"kind":"Name","value":"defaultCurrencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"defaultLanguageCode"}},{"kind":"Field","name":{"kind":"Name","value":"defaultShippingZone"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"defaultTaxZone"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"pricesIncludeTax"}}]}}]} as unknown as DocumentNode<CreateChannelMutation, CreateChannelMutationVariables>; export const DeleteProductVariantDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteProductVariant"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteProductVariant"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteProductVariantMutation, DeleteProductVariantMutationVariables>; export const AssignProductsToChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AssignProductsToChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AssignProductsToChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignProductsToChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductWithVariants"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductVariant"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"taxRateApplied"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxCategory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"groupId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductWithVariants"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"optionGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductVariant"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]} as unknown as DocumentNode<AssignProductsToChannelMutation, AssignProductsToChannelMutationVariables>; export const RemoveProductsFromChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveProductsFromChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RemoveProductsFromChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeProductsFromChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductWithVariants"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductVariant"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"taxRateApplied"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxCategory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"groupId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductWithVariants"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"optionGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductVariant"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]} as unknown as DocumentNode<RemoveProductsFromChannelMutation, RemoveProductsFromChannelMutationVariables>; export const AssignProductVariantsToChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AssignProductVariantsToChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AssignProductVariantsToChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignProductVariantsToChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductVariant"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductVariant"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"taxRateApplied"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxCategory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"groupId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]} as unknown as DocumentNode<AssignProductVariantsToChannelMutation, AssignProductVariantsToChannelMutationVariables>; export const RemoveProductVariantsFromChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveProductVariantsFromChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RemoveProductVariantsFromChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeProductVariantsFromChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductVariant"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductVariant"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"taxRateApplied"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxCategory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"groupId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]} as unknown as DocumentNode<RemoveProductVariantsFromChannelMutation, RemoveProductVariantsFromChannelMutationVariables>; export const UpdateAssetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateAsset"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateAssetInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateAsset"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tags"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"focalPoint"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"x"}},{"kind":"Field","name":{"kind":"Name","value":"y"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}}]} as unknown as DocumentNode<UpdateAssetMutation, UpdateAssetMutationVariables>; export const DeleteAssetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteAsset"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DeleteAssetInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteAsset"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteAssetMutation, DeleteAssetMutationVariables>; export const UpdateChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Channel"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"LanguageNotAvailableError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Channel"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Channel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"availableCurrencyCodes"}},{"kind":"Field","name":{"kind":"Name","value":"defaultCurrencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"defaultLanguageCode"}},{"kind":"Field","name":{"kind":"Name","value":"defaultShippingZone"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"defaultTaxZone"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"pricesIncludeTax"}}]}}]} as unknown as DocumentNode<UpdateChannelMutation, UpdateChannelMutationVariables>; export const GetCustomerHistoryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomerHistory"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"HistoryEntryListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"history"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalItems"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"administrator"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetCustomerHistoryQuery, GetCustomerHistoryQueryVariables>; export const GetOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrder"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"order"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithLines"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingAddress"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderAddress"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithLines"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingAddress"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"total"}}]}}]} as unknown as DocumentNode<GetOrderQuery, GetOrderQueryVariables>; export const CreateCustomerGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateCustomerGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateCustomerGroupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createCustomerGroup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerGroup"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerGroup"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CustomerGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"customers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<CreateCustomerGroupMutation, CreateCustomerGroupMutationVariables>; export const RemoveCustomersFromGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveCustomersFromGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"groupId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"customerIds"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeCustomersFromGroup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"customerGroupId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"groupId"}}},{"kind":"Argument","name":{"kind":"Name","value":"customerIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"customerIds"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerGroup"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerGroup"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CustomerGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"customers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<RemoveCustomersFromGroupMutation, RemoveCustomersFromGroupMutationVariables>; export const CreateFulfillmentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateFulfillment"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"FulfillOrderInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addFulfillmentToOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Fulfillment"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CreateFulfillmentError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fulfillmentHandlerError"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Fulfillment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Fulfillment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}}]} as unknown as DocumentNode<CreateFulfillmentMutation, CreateFulfillmentMutationVariables>; export const TransitFulfillmentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"TransitFulfillment"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"state"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transitionFulfillmentToState"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"state"},"value":{"kind":"Variable","name":{"kind":"Name","value":"state"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Fulfillment"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FulfillmentStateTransitionError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"transitionError"}},{"kind":"Field","name":{"kind":"Name","value":"fromState"}},{"kind":"Field","name":{"kind":"Name","value":"toState"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Fulfillment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Fulfillment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}}]} as unknown as DocumentNode<TransitFulfillmentMutation, TransitFulfillmentMutationVariables>; export const GetOrderFulfillmentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderFulfillments"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"order"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"summary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLine"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderFulfillmentsQuery, GetOrderFulfillmentsQueryVariables>; export const GetOrderListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"OrderListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orders"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Order"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Order"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}}]}}]} as unknown as DocumentNode<GetOrderListQuery, GetOrderListQueryVariables>; export const CreateAddressDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateAddress"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateAddressInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createCustomerAddress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"customerId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}},{"kind":"Field","name":{"kind":"Name","value":"defaultShippingAddress"}},{"kind":"Field","name":{"kind":"Name","value":"defaultBillingAddress"}}]}}]}}]} as unknown as DocumentNode<CreateAddressMutation, CreateAddressMutationVariables>; export const UpdateAddressDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateAddress"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateAddressInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateCustomerAddress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"defaultShippingAddress"}},{"kind":"Field","name":{"kind":"Name","value":"defaultBillingAddress"}},{"kind":"Field","name":{"kind":"Name","value":"country"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<UpdateAddressMutation, UpdateAddressMutationVariables>; export const CreateCustomerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateCustomer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateCustomerInput"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"password"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createCustomer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}},{"kind":"Argument","name":{"kind":"Name","value":"password"},"value":{"kind":"Variable","name":{"kind":"Name","value":"password"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Customer"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Address"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Address"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}},{"kind":"Field","name":{"kind":"Name","value":"defaultShippingAddress"}},{"kind":"Field","name":{"kind":"Name","value":"defaultBillingAddress"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Customer"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"verified"}},{"kind":"Field","name":{"kind":"Name","value":"lastLogin"}}]}},{"kind":"Field","name":{"kind":"Name","value":"addresses"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Address"}}]}}]}}]} as unknown as DocumentNode<CreateCustomerMutation, CreateCustomerMutationVariables>; export const UpdateCustomerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateCustomer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateCustomerInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateCustomer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Customer"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Address"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Address"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}},{"kind":"Field","name":{"kind":"Name","value":"defaultShippingAddress"}},{"kind":"Field","name":{"kind":"Name","value":"defaultBillingAddress"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Customer"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Customer"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"verified"}},{"kind":"Field","name":{"kind":"Name","value":"lastLogin"}}]}},{"kind":"Field","name":{"kind":"Name","value":"addresses"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Address"}}]}}]}}]} as unknown as DocumentNode<UpdateCustomerMutation, UpdateCustomerMutationVariables>; export const DeleteCustomerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteCustomer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteCustomer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}}]}}]}}]} as unknown as DocumentNode<DeleteCustomerMutation, DeleteCustomerMutationVariables>; export const UpdateCustomerNoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateCustomerNote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateCustomerNoteInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateCustomerNote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"data"}},{"kind":"Field","name":{"kind":"Name","value":"isPublic"}}]}}]}}]} as unknown as DocumentNode<UpdateCustomerNoteMutation, UpdateCustomerNoteMutationVariables>; export const DeleteCustomerNoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteCustomerNote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteCustomerNote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteCustomerNoteMutation, DeleteCustomerNoteMutationVariables>; export const UpdateCustomerGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateCustomerGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateCustomerGroupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateCustomerGroup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerGroup"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerGroup"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CustomerGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"customers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<UpdateCustomerGroupMutation, UpdateCustomerGroupMutationVariables>; export const DeleteCustomerGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteCustomerGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteCustomerGroup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteCustomerGroupMutation, DeleteCustomerGroupMutationVariables>; export const GetCustomerGroupsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomerGroups"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"CustomerGroupListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customerGroups"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<GetCustomerGroupsQuery, GetCustomerGroupsQueryVariables>; export const GetCustomerGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomerGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"CustomerListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customerGroup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"customers"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]}}]} as unknown as DocumentNode<GetCustomerGroupQuery, GetCustomerGroupQueryVariables>; export const AddCustomersToGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AddCustomersToGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"groupId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"customerIds"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addCustomersToGroup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"customerGroupId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"groupId"}}},{"kind":"Argument","name":{"kind":"Name","value":"customerIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"customerIds"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CustomerGroup"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CustomerGroup"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CustomerGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"customers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<AddCustomersToGroupMutation, AddCustomersToGroupMutationVariables>; export const GetCustomerWithGroupsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomerWithGroups"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"groups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<GetCustomerWithGroupsQuery, GetCustomerWithGroupsQueryVariables>; export const AdminTransitionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AdminTransition"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"state"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transitionOrderToState"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"state"},"value":{"kind":"Variable","name":{"kind":"Name","value":"state"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Order"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderStateTransitionError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"transitionError"}},{"kind":"Field","name":{"kind":"Name","value":"fromState"}},{"kind":"Field","name":{"kind":"Name","value":"toState"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Order"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}}]}}]} as unknown as DocumentNode<AdminTransitionMutation, AdminTransitionMutationVariables>; export const CancelOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CancelOrder"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CancelOrderInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cancelOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CanceledOrder"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CanceledOrder"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}}]} as unknown as DocumentNode<CancelOrderMutation, CancelOrderMutationVariables>; export const UpdateGlobalSettingsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateGlobalSettings"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateGlobalSettingsInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateGlobalSettings"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"GlobalSettings"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GlobalSettings"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GlobalSettings"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"availableLanguages"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"outOfStockThreshold"}},{"kind":"Field","name":{"kind":"Name","value":"serverConfig"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderProcess"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"to"}}]}},{"kind":"Field","name":{"kind":"Name","value":"permittedAssetTypes"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"assignable"}}]}},{"kind":"Field","name":{"kind":"Name","value":"customFieldConfig"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"Customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CustomField"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<UpdateGlobalSettingsMutation, UpdateGlobalSettingsMutationVariables>; export const UpdateRoleDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateRole"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateRoleInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateRole"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Role"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Role"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}}]}}]}}]} as unknown as DocumentNode<UpdateRoleMutation, UpdateRoleMutationVariables>; export const GetProductsWithVariantPricesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductsWithVariantPrices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"products"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetProductsWithVariantPricesQuery, GetProductsWithVariantPricesQueryVariables>; export const CreateProductOptionGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateProductOptionGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateProductOptionGroupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createProductOptionGroup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductOptionGroup"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductOptionGroup"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductOptionGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<CreateProductOptionGroupMutation, CreateProductOptionGroupMutationVariables>; export const AddOptionGroupToProductDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AddOptionGroupToProduct"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"productId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"optionGroupId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addOptionGroupToProduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"productId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"productId"}}},{"kind":"Argument","name":{"kind":"Name","value":"optionGroupId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"optionGroupId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductWithOptions"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductWithOptions"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"optionGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]}}]} as unknown as DocumentNode<AddOptionGroupToProductMutation, AddOptionGroupToProductMutationVariables>; export const CreateShippingMethodDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateShippingMethod"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateShippingMethodInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createShippingMethod"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingMethod"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingMethod"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ShippingMethod"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"calculator"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"checker"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]}}]} as unknown as DocumentNode<CreateShippingMethodMutation, CreateShippingMethodMutationVariables>; export const SettlePaymentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SettlePayment"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"settlePayment"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SettlePaymentError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"paymentErrorMessage"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}}]} as unknown as DocumentNode<SettlePaymentMutation, SettlePaymentMutationVariables>; export const GetOrderHistoryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderHistory"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"HistoryEntryListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"order"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"history"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalItems"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"administrator"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderHistoryQuery, GetOrderHistoryQueryVariables>; export const UpdateShippingMethodDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateShippingMethod"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateShippingMethodInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateShippingMethod"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingMethod"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingMethod"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ShippingMethod"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"calculator"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"checker"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]}}]} as unknown as DocumentNode<UpdateShippingMethodMutation, UpdateShippingMethodMutationVariables>; export const GetAssetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAsset"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"asset"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}},{"kind":"Field","name":{"kind":"Name","value":"width"}},{"kind":"Field","name":{"kind":"Name","value":"height"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}}]} as unknown as DocumentNode<GetAssetQuery, GetAssetQueryVariables>; export const GetAssetFragmentFirstDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAssetFragmentFirst"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"asset"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AssetFragFirst"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AssetFragFirst"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}}]} as unknown as DocumentNode<GetAssetFragmentFirstQuery, GetAssetFragmentFirstQueryVariables>; export const CreateAssetsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateAssets"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateAssetInput"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createAssets"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AssetWithTagsAndFocalPoint"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"MimeTypeError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AssetWithTagsAndFocalPoint"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}},{"kind":"Field","name":{"kind":"Name","value":"focalPoint"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"x"}},{"kind":"Field","name":{"kind":"Name","value":"y"}}]}},{"kind":"Field","name":{"kind":"Name","value":"tags"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]} as unknown as DocumentNode<CreateAssetsMutation, CreateAssetsMutationVariables>; export const DeleteShippingMethodDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteShippingMethod"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteShippingMethod"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteShippingMethodMutation, DeleteShippingMethodMutationVariables>; export const AssignPromotionToChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AssignPromotionToChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AssignPromotionsToChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignPromotionsToChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<AssignPromotionToChannelMutation, AssignPromotionToChannelMutationVariables>; export const RemovePromotionFromChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemovePromotionFromChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RemovePromotionsFromChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removePromotionsFromChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<RemovePromotionFromChannelMutation, RemovePromotionFromChannelMutationVariables>; export const GetTaxRatesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTaxRates"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"TaxRateListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taxRates"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TaxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TaxRate"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"TaxRate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"category"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"zone"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"customerGroup"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<GetTaxRatesQuery, GetTaxRatesQueryVariables>; export const GetShippingMethodListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetShippingMethodList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"shippingMethods"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingMethod"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingMethod"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ShippingMethod"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"calculator"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"checker"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]}}]} as unknown as DocumentNode<GetShippingMethodListQuery, GetShippingMethodListQueryVariables>; export const GetCollectionsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCollections"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"collections"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetCollectionsQuery, GetCollectionsQueryVariables>; export const TransitionPaymentToStateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"TransitionPaymentToState"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"state"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transitionPaymentToState"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"state"},"value":{"kind":"Variable","name":{"kind":"Name","value":"state"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PaymentStateTransitionError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transitionError"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}}]} as unknown as DocumentNode<TransitionPaymentToStateMutation, TransitionPaymentToStateMutationVariables>; export const GetProductVariantListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductVariantList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariantListOptions"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"productId"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productVariants"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}},{"kind":"Argument","name":{"kind":"Name","value":"productId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"productId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<GetProductVariantListQuery, GetProductVariantListQueryVariables>; export const DeletePromotionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeletePromotion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deletePromotion"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}}]}}]}}]} as unknown as DocumentNode<DeletePromotionMutation, DeletePromotionMutationVariables>; export const GetChannelsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetChannels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}}]}}]}}]}}]} as unknown as DocumentNode<GetChannelsQuery, GetChannelsQueryVariables>; export const UpdateAdministratorDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateAdministrator"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateAdministratorInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateAdministrator"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Administrator"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Administrator"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Administrator"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"lastLogin"}},{"kind":"Field","name":{"kind":"Name","value":"roles"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}}]}}]}}]}}]} as unknown as DocumentNode<UpdateAdministratorMutation, UpdateAdministratorMutationVariables>; export const AssignCollectionsToChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AssignCollectionsToChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AssignCollectionsToChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignCollectionsToChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Collection"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Collection"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Collection"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"isPrivate"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"filters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"children"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"position"}}]}}]}}]} as unknown as DocumentNode<AssignCollectionsToChannelMutation, AssignCollectionsToChannelMutationVariables>; export const GetCollectionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCollection"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"slug"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"variantListOptions"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariantListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"collection"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"slug"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Collection"}},{"kind":"Field","name":{"kind":"Name","value":"productVariants"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"variantListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Collection"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Collection"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"isPrivate"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"filters"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"children"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"position"}}]}}]}}]} as unknown as DocumentNode<GetCollectionQuery, GetCollectionQueryVariables>; export const GetFacetWithValuesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFacetWithValues"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"facet"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"FacetWithValues"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetValue"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FacetValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"FacetWithValues"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Facet"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"isPrivate"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"values"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"FacetValue"}}]}}]}}]} as unknown as DocumentNode<GetFacetWithValuesQuery, GetFacetWithValuesQueryVariables>; export const GetPromotionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPromotion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"promotion"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Promotion"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Promotion"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Promotion"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"couponCode"}},{"kind":"Field","name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"perCustomerUsageLimit"}},{"kind":"Field","name":{"kind":"Name","value":"usageLimit"}},{"kind":"Field","name":{"kind":"Name","value":"conditions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"actions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]} as unknown as DocumentNode<GetPromotionQuery, GetPromotionQueryVariables>; export const CancelJobDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CancelJob"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cancelJob"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"jobId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"isSettled"}},{"kind":"Field","name":{"kind":"Name","value":"settledAt"}}]}}]}}]} as unknown as DocumentNode<CancelJobMutation, CancelJobMutationVariables>; export const UpdateOptionGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateOptionGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateProductOptionGroupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateProductOptionGroup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<UpdateOptionGroupMutation, UpdateOptionGroupMutationVariables>; export const GetFulfillmentHandlersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetFulfillmentHandlers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fulfillmentHandlers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"ui"}}]}}]}}]}}]} as unknown as DocumentNode<GetFulfillmentHandlersQuery, GetFulfillmentHandlersQueryVariables>; export const GetOrderWithModificationsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderWithModifications"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"order"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithModifications"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithModifications"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"orderPlacedQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"discountedLinePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedLinePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"modifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"note"}},{"kind":"Field","name":{"kind":"Name","value":"priceChange"}},{"kind":"Field","name":{"kind":"Name","value":"isSettled"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}}]}},{"kind":"Field","name":{"kind":"Name","value":"refund"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"promotions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"couponCode"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"countryCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"countryCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"discountedPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderWithModificationsQuery, GetOrderWithModificationsQueryVariables>; export const ModifyOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ModifyOrder"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ModifyOrderInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"modifyOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithModifications"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithModifications"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"orderPlacedQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"discountedLinePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedLinePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"modifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"note"}},{"kind":"Field","name":{"kind":"Name","value":"priceChange"}},{"kind":"Field","name":{"kind":"Name","value":"isSettled"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}}]}},{"kind":"Field","name":{"kind":"Name","value":"refund"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"promotions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"couponCode"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"countryCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"countryCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"discountedPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<ModifyOrderMutation, ModifyOrderMutationVariables>; export const AddManualPaymentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AddManualPayment"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ManualPaymentInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addManualPaymentToOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithModifications"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithModifications"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"orderPlacedQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"discountedLinePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedLinePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"modifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"note"}},{"kind":"Field","name":{"kind":"Name","value":"priceChange"}},{"kind":"Field","name":{"kind":"Name","value":"isSettled"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}}]}},{"kind":"Field","name":{"kind":"Name","value":"refund"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"paymentId"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"promotions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"couponCode"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"countryCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}}]}},{"kind":"Field","name":{"kind":"Name","value":"billingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"countryCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"discountedPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<AddManualPaymentMutation, AddManualPaymentMutationVariables>; export const DeletePromotionAdHoc1Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeletePromotionAdHoc1"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deletePromotion"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"StringValue","value":"","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}}]}}]}}]} as unknown as DocumentNode<DeletePromotionAdHoc1Mutation, DeletePromotionAdHoc1MutationVariables>; export const GetTaxRateListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTaxRateList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"TaxRateListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taxRates"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"category"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"zone"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<GetTaxRateListQuery, GetTaxRateListQueryVariables>; export const GetOrderWithLineCalculatedPropsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderWithLineCalculatedProps"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"order"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderWithLineCalculatedPropsQuery, GetOrderWithLineCalculatedPropsQueryVariables>; export const GetOrderListFulfillmentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderListFulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"method"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderListFulfillmentsQuery, GetOrderListFulfillmentsQueryVariables>; export const GetOrderFulfillmentItemsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderFulfillmentItems"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"order"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Fulfillment"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Fulfillment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Fulfillment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}}]} as unknown as DocumentNode<GetOrderFulfillmentItemsQuery, GetOrderFulfillmentItemsQueryVariables>; export const RefundOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RefundOrder"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RefundOrderInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"refundOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Refund"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Refund"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Refund"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"items"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}}]}}]} as unknown as DocumentNode<RefundOrderMutation, RefundOrderMutationVariables>; export const SettleRefundDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SettleRefund"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SettleRefundInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"settleRefund"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Refund"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Refund"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Refund"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"items"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}}]}}]} as unknown as DocumentNode<SettleRefundMutation, SettleRefundMutationVariables>; export const AddNoteToOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AddNoteToOrder"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AddNoteToOrderInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addNoteToOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<AddNoteToOrderMutation, AddNoteToOrderMutationVariables>; export const UpdateOrderNoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateOrderNote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateOrderNoteInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateOrderNote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"data"}},{"kind":"Field","name":{"kind":"Name","value":"isPublic"}}]}}]}}]} as unknown as DocumentNode<UpdateOrderNoteMutation, UpdateOrderNoteMutationVariables>; export const DeleteOrderNoteDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteOrderNote"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteOrderNote"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteOrderNoteMutation, DeleteOrderNoteMutationVariables>; export const GetOrderWithPaymentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderWithPayments"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"order"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"errorMessage"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderWithPaymentsQuery, GetOrderWithPaymentsQueryVariables>; export const GetOrderLineFulfillmentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderLineFulfillments"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"order"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"fulfillmentLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fulfillment"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}}]}},{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderLineFulfillmentsQuery, GetOrderLineFulfillmentsQueryVariables>; export const GetOrderListWithQtyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderListWithQty"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"OrderListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orders"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderListWithQtyQuery, GetOrderListWithQtyQueryVariables>; export const CancelPaymentDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CancelPayment"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"paymentId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"cancelPayment"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"paymentId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PaymentStateTransitionError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transitionError"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CancelPaymentError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"paymentErrorMessage"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}}]} as unknown as DocumentNode<CancelPaymentMutation, CancelPaymentMutationVariables>; export const SetOrderCustomerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetOrderCustomer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SetOrderCustomerInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setOrderCustomer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]} as unknown as DocumentNode<SetOrderCustomerMutation, SetOrderCustomerMutationVariables>; export const CreatePaymentMethodDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreatePaymentMethod"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreatePaymentMethodInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createPaymentMethod"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"PaymentMethod"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PaymentMethod"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PaymentMethod"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"checker"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"handler"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]} as unknown as DocumentNode<CreatePaymentMethodMutation, CreatePaymentMethodMutationVariables>; export const UpdatePaymentMethodDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdatePaymentMethod"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdatePaymentMethodInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updatePaymentMethod"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"PaymentMethod"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PaymentMethod"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PaymentMethod"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"checker"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"handler"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]} as unknown as DocumentNode<UpdatePaymentMethodMutation, UpdatePaymentMethodMutationVariables>; export const GetPaymentMethodHandlersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPaymentMethodHandlers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"paymentMethodHandlers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}}]}}]} as unknown as DocumentNode<GetPaymentMethodHandlersQuery, GetPaymentMethodHandlersQueryVariables>; export const GetPaymentMethodCheckersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPaymentMethodCheckers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"paymentMethodEligibilityCheckers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}}]}}]} as unknown as DocumentNode<GetPaymentMethodCheckersQuery, GetPaymentMethodCheckersQueryVariables>; export const GetPaymentMethodDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPaymentMethod"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"paymentMethod"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"PaymentMethod"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PaymentMethod"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PaymentMethod"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"checker"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"handler"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]} as unknown as DocumentNode<GetPaymentMethodQuery, GetPaymentMethodQueryVariables>; export const GetPaymentMethodListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPaymentMethodList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"PaymentMethodListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"paymentMethods"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"PaymentMethod"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"PaymentMethod"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PaymentMethod"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"checker"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"handler"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]} as unknown as DocumentNode<GetPaymentMethodListQuery, GetPaymentMethodListQueryVariables>; export const DeletePaymentMethodDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeletePaymentMethod"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"force"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deletePaymentMethod"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"force"},"value":{"kind":"Variable","name":{"kind":"Name","value":"force"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"result"}}]}}]}}]} as unknown as DocumentNode<DeletePaymentMethodMutation, DeletePaymentMethodMutationVariables>; export const AddManualPayment2Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AddManualPayment2"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ManualPaymentInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addManualPaymentToOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"OrderWithLines"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingAddress"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderAddress"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Payment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Payment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}},{"kind":"Field","name":{"kind":"Name","value":"refunds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"reason"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"OrderWithLines"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"preview"}}]}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"surcharges"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}}]}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"totalQuantity"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingAddress"}}]}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Payment"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderLineId"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"total"}}]}}]} as unknown as DocumentNode<AddManualPayment2Mutation, AddManualPayment2MutationVariables>; export const GetProductOptionGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductOptionGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productOptionGroup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<GetProductOptionGroupQuery, GetProductOptionGroupQueryVariables>; export const UpdateProductOptionGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateProductOptionGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateProductOptionGroupInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateProductOptionGroup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductOptionGroup"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductOptionGroup"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductOptionGroup"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<UpdateProductOptionGroupMutation, UpdateProductOptionGroupMutationVariables>; export const CreateProductOptionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateProductOption"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateProductOptionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createProductOption"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"groupId"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<CreateProductOptionMutation, CreateProductOptionMutationVariables>; export const UpdateProductOptionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateProductOption"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateProductOptionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateProductOption"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"groupId"}}]}}]}}]} as unknown as DocumentNode<UpdateProductOptionMutation, UpdateProductOptionMutationVariables>; export const DeleteProductOptionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteProductOption"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteProductOption"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteProductOptionMutation, DeleteProductOptionMutationVariables>; export const RemoveOptionGroupFromProductDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveOptionGroupFromProduct"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"productId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"optionGroupId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"force"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Boolean"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeOptionGroupFromProduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"productId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"productId"}}},{"kind":"Argument","name":{"kind":"Name","value":"optionGroupId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"optionGroupId"}}},{"kind":"Argument","name":{"kind":"Name","value":"force"},"value":{"kind":"Variable","name":{"kind":"Name","value":"force"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductWithOptions"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductOptionInUseError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"optionGroupCode"}},{"kind":"Field","name":{"kind":"Name","value":"productVariantCount"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductWithOptions"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Product"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"optionGroups"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]}}]} as unknown as DocumentNode<RemoveOptionGroupFromProductMutation, RemoveOptionGroupFromProductMutationVariables>; export const GetOptionGroupDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOptionGroup"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productOptionGroup"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]}}]} as unknown as DocumentNode<GetOptionGroupQuery, GetOptionGroupQueryVariables>; export const GetProductVariantDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductVariant"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<GetProductVariantQuery, GetProductVariantQueryVariables>; export const GetProductWithVariantListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductWithVariantList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"variantListOptions"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariantListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"variantList"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"variantListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ProductVariant"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Asset"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Asset"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"fileSize"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"preview"}},{"kind":"Field","name":{"kind":"Name","value":"source"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ProductVariant"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"prices"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"trackInventory"}},{"kind":"Field","name":{"kind":"Name","value":"taxRateApplied"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxCategory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"options"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"groupId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facet"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"featuredAsset"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"assets"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Asset"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]} as unknown as DocumentNode<GetProductWithVariantListQuery, GetProductWithVariantListQueryVariables>; export const GetPromotionListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetPromotionList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"PromotionListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"promotions"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Promotion"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Promotion"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Promotion"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"couponCode"}},{"kind":"Field","name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"perCustomerUsageLimit"}},{"kind":"Field","name":{"kind":"Name","value":"usageLimit"}},{"kind":"Field","name":{"kind":"Name","value":"conditions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"actions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]} as unknown as DocumentNode<GetPromotionListQuery, GetPromotionListQueryVariables>; export const UpdatePromotionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdatePromotion"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdatePromotionInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updatePromotion"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Promotion"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Promotion"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Promotion"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"couponCode"}},{"kind":"Field","name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"perCustomerUsageLimit"}},{"kind":"Field","name":{"kind":"Name","value":"usageLimit"}},{"kind":"Field","name":{"kind":"Name","value":"conditions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"actions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]} as unknown as DocumentNode<UpdatePromotionMutation, UpdatePromotionMutationVariables>; export const GetAdjustmentOperationsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAdjustmentOperations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"promotionActions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperationDef"}}]}},{"kind":"Field","name":{"kind":"Name","value":"promotionConditions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ConfigurableOperationDef"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ConfigurableOperationDef"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ConfigurableOperationDefinition"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"ui"}}]}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode<GetAdjustmentOperationsQuery, GetAdjustmentOperationsQueryVariables>; export const GetRolesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRoles"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"RoleListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"roles"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Role"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Role"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}}]}}]}}]} as unknown as DocumentNode<GetRolesQuery, GetRolesQueryVariables>; export const GetRoleDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetRole"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"role"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Role"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Role"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Role"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}}]}}]}}]} as unknown as DocumentNode<GetRoleQuery, GetRoleQueryVariables>; export const DeleteRoleDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteRole"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteRole"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteRoleMutation, DeleteRoleMutationVariables>; export const LogoutDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"Logout"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"logout"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"success"}}]}}]}}]} as unknown as DocumentNode<LogoutMutation, LogoutMutationVariables>; export const GetShippingMethodDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetShippingMethod"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ShippingMethod"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ShippingMethod"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ShippingMethod"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"calculator"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"checker"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]}}]} as unknown as DocumentNode<GetShippingMethodQuery, GetShippingMethodQueryVariables>; export const GetEligibilityCheckersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetEligibilityCheckers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"shippingEligibilityCheckers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"ui"}}]}}]}}]}}]} as unknown as DocumentNode<GetEligibilityCheckersQuery, GetEligibilityCheckersQueryVariables>; export const GetCalculatorsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCalculators"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"shippingCalculators"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"args"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"ui"}}]}}]}}]}}]} as unknown as DocumentNode<GetCalculatorsQuery, GetCalculatorsQueryVariables>; export const TestShippingMethodDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"TestShippingMethod"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"TestShippingMethodInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"testShippingMethod"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"eligible"}},{"kind":"Field","name":{"kind":"Name","value":"quote"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}}]}}]}}]}}]} as unknown as DocumentNode<TestShippingMethodQuery, TestShippingMethodQueryVariables>; export const TestEligibleMethodsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"TestEligibleMethods"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"TestEligibleShippingMethodsInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"testEligibleShippingMethods"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}}]}}]}}]} as unknown as DocumentNode<TestEligibleMethodsQuery, TestEligibleMethodsQueryVariables>; export const GetMeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetMe"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"me"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}}]} as unknown as DocumentNode<GetMeQuery, GetMeQueryVariables>; export const GetProductsTake3Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductsTake3"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"products"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"take"},"value":{"kind":"IntValue","value":"3"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]} as unknown as DocumentNode<GetProductsTake3Query, GetProductsTake3QueryVariables>; export const GetProduct1Document = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProduct1"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"StringValue","value":"T_1","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<GetProduct1Query, GetProduct1QueryVariables>; export const GetProduct2VariantsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProduct2Variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"StringValue","value":"T_2","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<GetProduct2VariantsQuery, GetProduct2VariantsQueryVariables>; export const GetProductCollectionDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductCollection"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"StringValue","value":"T_12","block":false}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"collections"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<GetProductCollectionQuery, GetProductCollectionQueryVariables>; export const GetCollectionShopDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCollectionShop"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"slug"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"collection"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"slug"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"parent"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"children"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<GetCollectionShopQuery, GetCollectionShopQueryVariables>; export const DisableProductDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DisableProduct"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateProduct"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"enabled"},"value":{"kind":"BooleanValue","value":false}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<DisableProductMutation, DisableProductMutationVariables>; export const GetCollectionVariantsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCollectionVariants"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"slug"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"collection"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"slug"},"value":{"kind":"Variable","name":{"kind":"Name","value":"slug"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"productVariants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetCollectionVariantsQuery, GetCollectionVariantsQueryVariables>; export const GetCollectionListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCollectionList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"collections"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<GetCollectionListQuery, GetCollectionListQueryVariables>; export const GetProductFacetValuesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductFacetValues"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]} as unknown as DocumentNode<GetProductFacetValuesQuery, GetProductFacetValuesQueryVariables>; export const GetVariantFacetValuesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetVariantFacetValues"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"facetValues"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetVariantFacetValuesQuery, GetVariantFacetValuesQueryVariables>; export const GetCustomerIdsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomerIds"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]} as unknown as DocumentNode<GetCustomerIdsQuery, GetCustomerIdsQueryVariables>; export const GetStockLocationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetStockLocation"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"stockLocation"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StockLocation"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StockLocation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StockLocation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode<GetStockLocationQuery, GetStockLocationQueryVariables>; export const GetStockLocationsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetStockLocations"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"StockLocationListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"stockLocations"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StockLocation"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StockLocation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StockLocation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode<GetStockLocationsQuery, GetStockLocationsQueryVariables>; export const CreateStockLocationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateStockLocation"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateStockLocationInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createStockLocation"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StockLocation"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StockLocation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StockLocation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode<CreateStockLocationMutation, CreateStockLocationMutationVariables>; export const UpdateStockLocationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateStockLocation"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateStockLocationInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateStockLocation"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"StockLocation"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"StockLocation"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StockLocation"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]} as unknown as DocumentNode<UpdateStockLocationMutation, UpdateStockLocationMutationVariables>; export const GetVariantStockLevelsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetVariantStockLevels"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariantListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productVariants"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"stockAllocated"}},{"kind":"Field","name":{"kind":"Name","value":"stockLevels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"stockLocationId"}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"stockAllocated"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetVariantStockLevelsQuery, GetVariantStockLevelsQueryVariables>; export const UpdateStockDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateStock"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateProductVariantInput"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateProductVariants"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"VariantWithStock"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"VariantWithStock"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ProductVariant"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"stockAllocated"}},{"kind":"Field","name":{"kind":"Name","value":"stockMovements"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"StockMovement"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<UpdateStockMutation, UpdateStockMutationVariables>; export const TransitionFulfillmentToStateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"TransitionFulfillmentToState"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"state"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transitionFulfillmentToState"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"Argument","name":{"kind":"Name","value":"state"},"value":{"kind":"Variable","name":{"kind":"Name","value":"state"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Fulfillment"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"nextStates"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"FulfillmentStateTransitionError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transitionError"}}]}}]}}]}}]} as unknown as DocumentNode<TransitionFulfillmentToStateMutation, TransitionFulfillmentToStateMutationVariables>; export const UpdateOrderCustomFieldsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateOrderCustomFields"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateOrderInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setOrderCustomFields"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]} as unknown as DocumentNode<UpdateOrderCustomFieldsMutation, UpdateOrderCustomFieldsMutationVariables>; export const TestGetStockLocationsListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"TestGetStockLocationsList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"StockLocationListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"stockLocations"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<TestGetStockLocationsListQuery, TestGetStockLocationsListQueryVariables>; export const TestGetStockLocationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"TestGetStockLocation"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"stockLocation"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]} as unknown as DocumentNode<TestGetStockLocationQuery, TestGetStockLocationQueryVariables>; export const TestCreateStockLocationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"TestCreateStockLocation"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateStockLocationInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createStockLocation"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]} as unknown as DocumentNode<TestCreateStockLocationMutation, TestCreateStockLocationMutationVariables>; export const TestUpdateStockLocationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"TestUpdateStockLocation"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateStockLocationInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateStockLocation"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]} as unknown as DocumentNode<TestUpdateStockLocationMutation, TestUpdateStockLocationMutationVariables>; export const TestDeleteStockLocationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"TestDeleteStockLocation"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DeleteStockLocationInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteStockLocation"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<TestDeleteStockLocationMutation, TestDeleteStockLocationMutationVariables>; export const TestGetStockLevelsForVariantDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"TestGetStockLevelsForVariant"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"stockLevels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"stockAllocated"}},{"kind":"Field","name":{"kind":"Name","value":"stockLocationId"}}]}}]}}]}}]} as unknown as DocumentNode<TestGetStockLevelsForVariantQuery, TestGetStockLevelsForVariantQueryVariables>; export const TestSetStockLevelInLocationDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"TestSetStockLevelInLocation"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateProductVariantInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateProductVariants"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"ListValue","values":[{"kind":"Variable","name":{"kind":"Name","value":"input"}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"stockLevels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"stockOnHand"}},{"kind":"Field","name":{"kind":"Name","value":"stockAllocated"}},{"kind":"Field","name":{"kind":"Name","value":"stockLocationId"}}]}}]}}]}}]} as unknown as DocumentNode<TestSetStockLevelInLocationMutation, TestSetStockLevelInLocationMutationVariables>; export const TestAssignStockLocationToChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"TestAssignStockLocationToChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AssignStockLocationsToChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"assignStockLocationsToChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<TestAssignStockLocationToChannelMutation, TestAssignStockLocationToChannelMutationVariables>; export const TestRemoveStockLocationsFromChannelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"TestRemoveStockLocationsFromChannel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RemoveStockLocationsFromChannelInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeStockLocationsFromChannel"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<TestRemoveStockLocationsFromChannelMutation, TestRemoveStockLocationsFromChannelMutationVariables>; export const GetTagListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTagList"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"TagListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tags"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<GetTagListQuery, GetTagListQueryVariables>; export const GetTagDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTag"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tag"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]} as unknown as DocumentNode<GetTagQuery, GetTagQueryVariables>; export const CreateTagDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateTag"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateTagInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createTag"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]} as unknown as DocumentNode<CreateTagMutation, CreateTagMutationVariables>; export const UpdateTagDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateTag"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateTagInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateTag"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"value"}}]}}]}}]} as unknown as DocumentNode<UpdateTagMutation, UpdateTagMutationVariables>; export const DeleteTagDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteTag"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteTag"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"result"}}]}}]}}]} as unknown as DocumentNode<DeleteTagMutation, DeleteTagMutationVariables>; export const GetTaxCategoryListDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTaxCategoryList"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taxCategories"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isDefault"}}]}}]}}]}}]} as unknown as DocumentNode<GetTaxCategoryListQuery, GetTaxCategoryListQueryVariables>; export const GetTaxCategoryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTaxCategory"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taxCategory"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isDefault"}}]}}]}}]} as unknown as DocumentNode<GetTaxCategoryQuery, GetTaxCategoryQueryVariables>; export const CreateTaxCategoryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateTaxCategory"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateTaxCategoryInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createTaxCategory"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isDefault"}}]}}]}}]} as unknown as DocumentNode<CreateTaxCategoryMutation, CreateTaxCategoryMutationVariables>; export const UpdateTaxCategoryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateTaxCategory"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateTaxCategoryInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateTaxCategory"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isDefault"}}]}}]}}]} as unknown as DocumentNode<UpdateTaxCategoryMutation, UpdateTaxCategoryMutationVariables>; export const DeleteTaxCategoryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteTaxCategory"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteTaxCategory"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteTaxCategoryMutation, DeleteTaxCategoryMutationVariables>; export const GetTaxRateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTaxRate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taxRate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TaxRate"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TaxRate"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"TaxRate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"category"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"zone"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"customerGroup"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<GetTaxRateQuery, GetTaxRateQueryVariables>; export const CreateTaxRateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateTaxRate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateTaxRateInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createTaxRate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TaxRate"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TaxRate"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"TaxRate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"category"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"zone"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"customerGroup"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode<CreateTaxRateMutation, CreateTaxRateMutationVariables>; export const DeleteTaxRateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteTaxRate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteTaxRate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteTaxRateMutation, DeleteTaxRateMutationVariables>; export const DeleteZoneDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteZone"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteZone"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"result"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]} as unknown as DocumentNode<DeleteZoneMutation, DeleteZoneMutationVariables>; export const GetZonesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetZones"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ZoneListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"zones"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"totalItems"}}]}}]}}]} as unknown as DocumentNode<GetZonesQuery, GetZonesQueryVariables>; export const GetZoneDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetZone"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"zone"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Zone"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Country"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Region"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Zone"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Zone"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"members"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Country"}}]}}]}}]} as unknown as DocumentNode<GetZoneQuery, GetZoneQueryVariables>; export const GetActiveChannelWithZoneMembersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetActiveChannelWithZoneMembers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeChannel"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"defaultShippingZone"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"members"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetActiveChannelWithZoneMembersQuery, GetActiveChannelWithZoneMembersQueryVariables>; export const CreateZoneDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateZone"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateZoneInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createZone"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Zone"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Country"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Region"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Zone"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Zone"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"members"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Country"}}]}}]}}]} as unknown as DocumentNode<CreateZoneMutation, CreateZoneMutationVariables>; export const UpdateZoneDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateZone"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateZoneInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateZone"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Zone"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Country"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Region"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Zone"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Zone"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"members"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Country"}}]}}]}}]} as unknown as DocumentNode<UpdateZoneMutation, UpdateZoneMutationVariables>; export const AddMembersToZoneDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AddMembersToZone"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"zoneId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"memberIds"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addMembersToZone"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"zoneId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"zoneId"}}},{"kind":"Argument","name":{"kind":"Name","value":"memberIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"memberIds"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Zone"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Country"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Region"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Zone"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Zone"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"members"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Country"}}]}}]}}]} as unknown as DocumentNode<AddMembersToZoneMutation, AddMembersToZoneMutationVariables>; export const RemoveMembersFromZoneDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveMembersFromZone"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"zoneId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"memberIds"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeMembersFromZone"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"zoneId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"zoneId"}}},{"kind":"Argument","name":{"kind":"Name","value":"memberIds"},"value":{"kind":"Variable","name":{"kind":"Name","value":"memberIds"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Zone"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Country"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Region"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"enabled"}},{"kind":"Field","name":{"kind":"Name","value":"translations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"languageCode"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"Zone"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Zone"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"members"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"Country"}}]}}]}}]} as unknown as DocumentNode<RemoveMembersFromZoneMutation, RemoveMembersFromZoneMutationVariables>;
/* eslint-disable */ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core'; export type Maybe<T> = T | null; export type InputMaybe<T> = Maybe<T>; export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] }; export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> }; export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> }; export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never }; export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { ID: { input: string; output: string; } String: { input: string; output: string; } Boolean: { input: boolean; output: boolean; } Int: { input: number; output: number; } Float: { input: number; output: number; } DateTime: { input: any; output: any; } JSON: { input: any; output: any; } Money: { input: number; output: number; } Upload: { input: any; output: any; } }; export type ActiveOrderResult = NoActiveOrderError | Order; export type AddPaymentToOrderResult = IneligiblePaymentMethodError | NoActiveOrderError | Order | OrderPaymentStateError | OrderStateTransitionError | PaymentDeclinedError | PaymentFailedError; export type Address = Node & { city?: Maybe<Scalars['String']['output']>; company?: Maybe<Scalars['String']['output']>; country: Country; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; defaultBillingAddress?: Maybe<Scalars['Boolean']['output']>; defaultShippingAddress?: Maybe<Scalars['Boolean']['output']>; fullName?: Maybe<Scalars['String']['output']>; id: Scalars['ID']['output']; phoneNumber?: Maybe<Scalars['String']['output']>; postalCode?: Maybe<Scalars['String']['output']>; province?: Maybe<Scalars['String']['output']>; streetLine1: Scalars['String']['output']; streetLine2?: Maybe<Scalars['String']['output']>; updatedAt: Scalars['DateTime']['output']; }; export type Adjustment = { adjustmentSource: Scalars['String']['output']; amount: Scalars['Money']['output']; data?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; type: AdjustmentType; }; export enum AdjustmentType { DISTRIBUTED_ORDER_PROMOTION = 'DISTRIBUTED_ORDER_PROMOTION', OTHER = 'OTHER', PROMOTION = 'PROMOTION' } /** Returned when attempting to set the Customer for an Order when already logged in. */ export type AlreadyLoggedInError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type ApplyCouponCodeResult = CouponCodeExpiredError | CouponCodeInvalidError | CouponCodeLimitError | Order; export type Asset = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; fileSize: Scalars['Int']['output']; focalPoint?: Maybe<Coordinate>; height: Scalars['Int']['output']; id: Scalars['ID']['output']; mimeType: Scalars['String']['output']; name: Scalars['String']['output']; preview: Scalars['String']['output']; source: Scalars['String']['output']; tags: Array<Tag>; type: AssetType; updatedAt: Scalars['DateTime']['output']; width: Scalars['Int']['output']; }; export type AssetList = PaginatedList & { items: Array<Asset>; totalItems: Scalars['Int']['output']; }; export enum AssetType { BINARY = 'BINARY', IMAGE = 'IMAGE', VIDEO = 'VIDEO' } export type AuthenticationInput = { native?: InputMaybe<NativeAuthInput>; }; export type AuthenticationMethod = Node & { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; strategy: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type AuthenticationResult = CurrentUser | InvalidCredentialsError | NotVerifiedError; export type BooleanCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; /** Operators for filtering on a list of Boolean fields */ export type BooleanListOperators = { inList: Scalars['Boolean']['input']; }; /** Operators for filtering on a Boolean field */ export type BooleanOperators = { eq?: InputMaybe<Scalars['Boolean']['input']>; isNull?: InputMaybe<Scalars['Boolean']['input']>; }; export type Channel = Node & { availableCurrencyCodes: Array<CurrencyCode>; availableLanguageCodes?: Maybe<Array<LanguageCode>>; code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; /** @deprecated Use defaultCurrencyCode instead */ currencyCode: CurrencyCode; customFields?: Maybe<Scalars['JSON']['output']>; defaultCurrencyCode: CurrencyCode; defaultLanguageCode: LanguageCode; defaultShippingZone?: Maybe<Zone>; defaultTaxZone?: Maybe<Zone>; id: Scalars['ID']['output']; /** Not yet used - will be implemented in a future release. */ outOfStockThreshold?: Maybe<Scalars['Int']['output']>; pricesIncludeTax: Scalars['Boolean']['output']; seller?: Maybe<Seller>; token: Scalars['String']['output']; /** Not yet used - will be implemented in a future release. */ trackInventory?: Maybe<Scalars['Boolean']['output']>; updatedAt: Scalars['DateTime']['output']; }; export type Collection = Node & { assets: Array<Asset>; breadcrumbs: Array<CollectionBreadcrumb>; children?: Maybe<Array<Collection>>; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; featuredAsset?: Maybe<Asset>; filters: Array<ConfigurableOperation>; id: Scalars['ID']['output']; languageCode?: Maybe<LanguageCode>; name: Scalars['String']['output']; parent?: Maybe<Collection>; parentId: Scalars['ID']['output']; position: Scalars['Int']['output']; productVariants: ProductVariantList; slug: Scalars['String']['output']; translations: Array<CollectionTranslation>; updatedAt: Scalars['DateTime']['output']; }; export type CollectionProductVariantsArgs = { options?: InputMaybe<ProductVariantListOptions>; }; export type CollectionBreadcrumb = { id: Scalars['ID']['output']; name: Scalars['String']['output']; slug: Scalars['String']['output']; }; export type CollectionFilterParameter = { _and?: InputMaybe<Array<CollectionFilterParameter>>; _or?: InputMaybe<Array<CollectionFilterParameter>>; createdAt?: InputMaybe<DateOperators>; description?: InputMaybe<StringOperators>; id?: InputMaybe<IdOperators>; languageCode?: InputMaybe<StringOperators>; name?: InputMaybe<StringOperators>; parentId?: InputMaybe<IdOperators>; position?: InputMaybe<NumberOperators>; slug?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type CollectionList = PaginatedList & { items: Array<Collection>; totalItems: Scalars['Int']['output']; }; export type CollectionListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<CollectionFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<CollectionSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; topLevelOnly?: InputMaybe<Scalars['Boolean']['input']>; }; /** * Which Collections are present in the products returned * by the search, and in what quantity. */ export type CollectionResult = { collection: Collection; count: Scalars['Int']['output']; }; export type CollectionSortParameter = { createdAt?: InputMaybe<SortOrder>; description?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; parentId?: InputMaybe<SortOrder>; position?: InputMaybe<SortOrder>; slug?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type CollectionTranslation = { createdAt: Scalars['DateTime']['output']; description: Scalars['String']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; slug: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type ConfigArg = { name: Scalars['String']['output']; value: Scalars['String']['output']; }; export type ConfigArgDefinition = { defaultValue?: Maybe<Scalars['JSON']['output']>; description?: Maybe<Scalars['String']['output']>; label?: Maybe<Scalars['String']['output']>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; required: Scalars['Boolean']['output']; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type ConfigArgInput = { name: Scalars['String']['input']; /** A JSON stringified representation of the actual value */ value: Scalars['String']['input']; }; export type ConfigurableOperation = { args: Array<ConfigArg>; code: Scalars['String']['output']; }; export type ConfigurableOperationDefinition = { args: Array<ConfigArgDefinition>; code: Scalars['String']['output']; description: Scalars['String']['output']; }; export type ConfigurableOperationInput = { arguments: Array<ConfigArgInput>; code: Scalars['String']['input']; }; export type Coordinate = { x: Scalars['Float']['output']; y: Scalars['Float']['output']; }; export type Country = Node & Region & { code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; enabled: Scalars['Boolean']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; parent?: Maybe<Region>; parentId?: Maybe<Scalars['ID']['output']>; translations: Array<RegionTranslation>; type: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type CountryList = PaginatedList & { items: Array<Country>; totalItems: Scalars['Int']['output']; }; /** Returned if the provided coupon code is invalid */ export type CouponCodeExpiredError = ErrorResult & { couponCode: Scalars['String']['output']; errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned if the provided coupon code is invalid */ export type CouponCodeInvalidError = ErrorResult & { couponCode: Scalars['String']['output']; errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned if the provided coupon code is invalid */ export type CouponCodeLimitError = ErrorResult & { couponCode: Scalars['String']['output']; errorCode: ErrorCode; limit: Scalars['Int']['output']; message: Scalars['String']['output']; }; export type CreateAddressInput = { city?: InputMaybe<Scalars['String']['input']>; company?: InputMaybe<Scalars['String']['input']>; countryCode: Scalars['String']['input']; customFields?: InputMaybe<Scalars['JSON']['input']>; defaultBillingAddress?: InputMaybe<Scalars['Boolean']['input']>; defaultShippingAddress?: InputMaybe<Scalars['Boolean']['input']>; fullName?: InputMaybe<Scalars['String']['input']>; phoneNumber?: InputMaybe<Scalars['String']['input']>; postalCode?: InputMaybe<Scalars['String']['input']>; province?: InputMaybe<Scalars['String']['input']>; streetLine1: Scalars['String']['input']; streetLine2?: InputMaybe<Scalars['String']['input']>; }; export type CreateCustomerInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; emailAddress: Scalars['String']['input']; firstName: Scalars['String']['input']; lastName: Scalars['String']['input']; phoneNumber?: InputMaybe<Scalars['String']['input']>; title?: InputMaybe<Scalars['String']['input']>; }; /** * @description * ISO 4217 currency code * * @docsCategory common */ export enum CurrencyCode { /** United Arab Emirates dirham */ AED = 'AED', /** Afghan afghani */ AFN = 'AFN', /** Albanian lek */ ALL = 'ALL', /** Armenian dram */ AMD = 'AMD', /** Netherlands Antillean guilder */ ANG = 'ANG', /** Angolan kwanza */ AOA = 'AOA', /** Argentine peso */ ARS = 'ARS', /** Australian dollar */ AUD = 'AUD', /** Aruban florin */ AWG = 'AWG', /** Azerbaijani manat */ AZN = 'AZN', /** Bosnia and Herzegovina convertible mark */ BAM = 'BAM', /** Barbados dollar */ BBD = 'BBD', /** Bangladeshi taka */ BDT = 'BDT', /** Bulgarian lev */ BGN = 'BGN', /** Bahraini dinar */ BHD = 'BHD', /** Burundian franc */ BIF = 'BIF', /** Bermudian dollar */ BMD = 'BMD', /** Brunei dollar */ BND = 'BND', /** Boliviano */ BOB = 'BOB', /** Brazilian real */ BRL = 'BRL', /** Bahamian dollar */ BSD = 'BSD', /** Bhutanese ngultrum */ BTN = 'BTN', /** Botswana pula */ BWP = 'BWP', /** Belarusian ruble */ BYN = 'BYN', /** Belize dollar */ BZD = 'BZD', /** Canadian dollar */ CAD = 'CAD', /** Congolese franc */ CDF = 'CDF', /** Swiss franc */ CHF = 'CHF', /** Chilean peso */ CLP = 'CLP', /** Renminbi (Chinese) yuan */ CNY = 'CNY', /** Colombian peso */ COP = 'COP', /** Costa Rican colon */ CRC = 'CRC', /** Cuban convertible peso */ CUC = 'CUC', /** Cuban peso */ CUP = 'CUP', /** Cape Verde escudo */ CVE = 'CVE', /** Czech koruna */ CZK = 'CZK', /** Djiboutian franc */ DJF = 'DJF', /** Danish krone */ DKK = 'DKK', /** Dominican peso */ DOP = 'DOP', /** Algerian dinar */ DZD = 'DZD', /** Egyptian pound */ EGP = 'EGP', /** Eritrean nakfa */ ERN = 'ERN', /** Ethiopian birr */ ETB = 'ETB', /** Euro */ EUR = 'EUR', /** Fiji dollar */ FJD = 'FJD', /** Falkland Islands pound */ FKP = 'FKP', /** Pound sterling */ GBP = 'GBP', /** Georgian lari */ GEL = 'GEL', /** Ghanaian cedi */ GHS = 'GHS', /** Gibraltar pound */ GIP = 'GIP', /** Gambian dalasi */ GMD = 'GMD', /** Guinean franc */ GNF = 'GNF', /** Guatemalan quetzal */ GTQ = 'GTQ', /** Guyanese dollar */ GYD = 'GYD', /** Hong Kong dollar */ HKD = 'HKD', /** Honduran lempira */ HNL = 'HNL', /** Croatian kuna */ HRK = 'HRK', /** Haitian gourde */ HTG = 'HTG', /** Hungarian forint */ HUF = 'HUF', /** Indonesian rupiah */ IDR = 'IDR', /** Israeli new shekel */ ILS = 'ILS', /** Indian rupee */ INR = 'INR', /** Iraqi dinar */ IQD = 'IQD', /** Iranian rial */ IRR = 'IRR', /** Icelandic króna */ ISK = 'ISK', /** Jamaican dollar */ JMD = 'JMD', /** Jordanian dinar */ JOD = 'JOD', /** Japanese yen */ JPY = 'JPY', /** Kenyan shilling */ KES = 'KES', /** Kyrgyzstani som */ KGS = 'KGS', /** Cambodian riel */ KHR = 'KHR', /** Comoro franc */ KMF = 'KMF', /** North Korean won */ KPW = 'KPW', /** South Korean won */ KRW = 'KRW', /** Kuwaiti dinar */ KWD = 'KWD', /** Cayman Islands dollar */ KYD = 'KYD', /** Kazakhstani tenge */ KZT = 'KZT', /** Lao kip */ LAK = 'LAK', /** Lebanese pound */ LBP = 'LBP', /** Sri Lankan rupee */ LKR = 'LKR', /** Liberian dollar */ LRD = 'LRD', /** Lesotho loti */ LSL = 'LSL', /** Libyan dinar */ LYD = 'LYD', /** Moroccan dirham */ MAD = 'MAD', /** Moldovan leu */ MDL = 'MDL', /** Malagasy ariary */ MGA = 'MGA', /** Macedonian denar */ MKD = 'MKD', /** Myanmar kyat */ MMK = 'MMK', /** Mongolian tögrög */ MNT = 'MNT', /** Macanese pataca */ MOP = 'MOP', /** Mauritanian ouguiya */ MRU = 'MRU', /** Mauritian rupee */ MUR = 'MUR', /** Maldivian rufiyaa */ MVR = 'MVR', /** Malawian kwacha */ MWK = 'MWK', /** Mexican peso */ MXN = 'MXN', /** Malaysian ringgit */ MYR = 'MYR', /** Mozambican metical */ MZN = 'MZN', /** Namibian dollar */ NAD = 'NAD', /** Nigerian naira */ NGN = 'NGN', /** Nicaraguan córdoba */ NIO = 'NIO', /** Norwegian krone */ NOK = 'NOK', /** Nepalese rupee */ NPR = 'NPR', /** New Zealand dollar */ NZD = 'NZD', /** Omani rial */ OMR = 'OMR', /** Panamanian balboa */ PAB = 'PAB', /** Peruvian sol */ PEN = 'PEN', /** Papua New Guinean kina */ PGK = 'PGK', /** Philippine peso */ PHP = 'PHP', /** Pakistani rupee */ PKR = 'PKR', /** Polish złoty */ PLN = 'PLN', /** Paraguayan guaraní */ PYG = 'PYG', /** Qatari riyal */ QAR = 'QAR', /** Romanian leu */ RON = 'RON', /** Serbian dinar */ RSD = 'RSD', /** Russian ruble */ RUB = 'RUB', /** Rwandan franc */ RWF = 'RWF', /** Saudi riyal */ SAR = 'SAR', /** Solomon Islands dollar */ SBD = 'SBD', /** Seychelles rupee */ SCR = 'SCR', /** Sudanese pound */ SDG = 'SDG', /** Swedish krona/kronor */ SEK = 'SEK', /** Singapore dollar */ SGD = 'SGD', /** Saint Helena pound */ SHP = 'SHP', /** Sierra Leonean leone */ SLL = 'SLL', /** Somali shilling */ SOS = 'SOS', /** Surinamese dollar */ SRD = 'SRD', /** South Sudanese pound */ SSP = 'SSP', /** São Tomé and Príncipe dobra */ STN = 'STN', /** Salvadoran colón */ SVC = 'SVC', /** Syrian pound */ SYP = 'SYP', /** Swazi lilangeni */ SZL = 'SZL', /** Thai baht */ THB = 'THB', /** Tajikistani somoni */ TJS = 'TJS', /** Turkmenistan manat */ TMT = 'TMT', /** Tunisian dinar */ TND = 'TND', /** Tongan paʻanga */ TOP = 'TOP', /** Turkish lira */ TRY = 'TRY', /** Trinidad and Tobago dollar */ TTD = 'TTD', /** New Taiwan dollar */ TWD = 'TWD', /** Tanzanian shilling */ TZS = 'TZS', /** Ukrainian hryvnia */ UAH = 'UAH', /** Ugandan shilling */ UGX = 'UGX', /** United States dollar */ USD = 'USD', /** Uruguayan peso */ UYU = 'UYU', /** Uzbekistan som */ UZS = 'UZS', /** Venezuelan bolívar soberano */ VES = 'VES', /** Vietnamese đồng */ VND = 'VND', /** Vanuatu vatu */ VUV = 'VUV', /** Samoan tala */ WST = 'WST', /** CFA franc BEAC */ XAF = 'XAF', /** East Caribbean dollar */ XCD = 'XCD', /** CFA franc BCEAO */ XOF = 'XOF', /** CFP franc (franc Pacifique) */ XPF = 'XPF', /** Yemeni rial */ YER = 'YER', /** South African rand */ ZAR = 'ZAR', /** Zambian kwacha */ ZMW = 'ZMW', /** Zimbabwean dollar */ ZWL = 'ZWL' } export type CurrentUser = { channels: Array<CurrentUserChannel>; id: Scalars['ID']['output']; identifier: Scalars['String']['output']; }; export type CurrentUserChannel = { code: Scalars['String']['output']; id: Scalars['ID']['output']; permissions: Array<Permission>; token: Scalars['String']['output']; }; export type CustomField = { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type CustomFieldConfig = BooleanCustomFieldConfig | DateTimeCustomFieldConfig | FloatCustomFieldConfig | IntCustomFieldConfig | LocaleStringCustomFieldConfig | LocaleTextCustomFieldConfig | RelationCustomFieldConfig | StringCustomFieldConfig | TextCustomFieldConfig; export type Customer = Node & { addresses?: Maybe<Array<Address>>; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; emailAddress: Scalars['String']['output']; firstName: Scalars['String']['output']; id: Scalars['ID']['output']; lastName: Scalars['String']['output']; orders: OrderList; phoneNumber?: Maybe<Scalars['String']['output']>; title?: Maybe<Scalars['String']['output']>; updatedAt: Scalars['DateTime']['output']; user?: Maybe<User>; }; export type CustomerOrdersArgs = { options?: InputMaybe<OrderListOptions>; }; export type CustomerFilterParameter = { _and?: InputMaybe<Array<CustomerFilterParameter>>; _or?: InputMaybe<Array<CustomerFilterParameter>>; createdAt?: InputMaybe<DateOperators>; emailAddress?: InputMaybe<StringOperators>; firstName?: InputMaybe<StringOperators>; id?: InputMaybe<IdOperators>; lastName?: InputMaybe<StringOperators>; phoneNumber?: InputMaybe<StringOperators>; title?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type CustomerGroup = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; customers: CustomerList; id: Scalars['ID']['output']; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type CustomerGroupCustomersArgs = { options?: InputMaybe<CustomerListOptions>; }; export type CustomerList = PaginatedList & { items: Array<Customer>; totalItems: Scalars['Int']['output']; }; export type CustomerListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<CustomerFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<CustomerSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type CustomerSortParameter = { createdAt?: InputMaybe<SortOrder>; emailAddress?: InputMaybe<SortOrder>; firstName?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; lastName?: InputMaybe<SortOrder>; phoneNumber?: InputMaybe<SortOrder>; title?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; /** Operators for filtering on a list of Date fields */ export type DateListOperators = { inList: Scalars['DateTime']['input']; }; /** Operators for filtering on a DateTime field */ export type DateOperators = { after?: InputMaybe<Scalars['DateTime']['input']>; before?: InputMaybe<Scalars['DateTime']['input']>; between?: InputMaybe<DateRange>; eq?: InputMaybe<Scalars['DateTime']['input']>; isNull?: InputMaybe<Scalars['Boolean']['input']>; }; export type DateRange = { end: Scalars['DateTime']['input']; start: Scalars['DateTime']['input']; }; /** * Expects the same validation formats as the `<input type="datetime-local">` HTML element. * See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local#Additional_attributes */ export type DateTimeCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; max?: Maybe<Scalars['String']['output']>; min?: Maybe<Scalars['String']['output']>; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; step?: Maybe<Scalars['Int']['output']>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type DeletionResponse = { message?: Maybe<Scalars['String']['output']>; result: DeletionResult; }; export enum DeletionResult { /** The entity was successfully deleted */ DELETED = 'DELETED', /** Deletion did not take place, reason given in message */ NOT_DELETED = 'NOT_DELETED' } export type Discount = { adjustmentSource: Scalars['String']['output']; amount: Scalars['Money']['output']; amountWithTax: Scalars['Money']['output']; description: Scalars['String']['output']; type: AdjustmentType; }; /** Returned when attempting to create a Customer with an email address already registered to an existing User. */ export type EmailAddressConflictError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export enum ErrorCode { ALREADY_LOGGED_IN_ERROR = 'ALREADY_LOGGED_IN_ERROR', COUPON_CODE_EXPIRED_ERROR = 'COUPON_CODE_EXPIRED_ERROR', COUPON_CODE_INVALID_ERROR = 'COUPON_CODE_INVALID_ERROR', COUPON_CODE_LIMIT_ERROR = 'COUPON_CODE_LIMIT_ERROR', EMAIL_ADDRESS_CONFLICT_ERROR = 'EMAIL_ADDRESS_CONFLICT_ERROR', GUEST_CHECKOUT_ERROR = 'GUEST_CHECKOUT_ERROR', IDENTIFIER_CHANGE_TOKEN_EXPIRED_ERROR = 'IDENTIFIER_CHANGE_TOKEN_EXPIRED_ERROR', IDENTIFIER_CHANGE_TOKEN_INVALID_ERROR = 'IDENTIFIER_CHANGE_TOKEN_INVALID_ERROR', INELIGIBLE_PAYMENT_METHOD_ERROR = 'INELIGIBLE_PAYMENT_METHOD_ERROR', INELIGIBLE_SHIPPING_METHOD_ERROR = 'INELIGIBLE_SHIPPING_METHOD_ERROR', INSUFFICIENT_STOCK_ERROR = 'INSUFFICIENT_STOCK_ERROR', INVALID_CREDENTIALS_ERROR = 'INVALID_CREDENTIALS_ERROR', MISSING_PASSWORD_ERROR = 'MISSING_PASSWORD_ERROR', NATIVE_AUTH_STRATEGY_ERROR = 'NATIVE_AUTH_STRATEGY_ERROR', NEGATIVE_QUANTITY_ERROR = 'NEGATIVE_QUANTITY_ERROR', NOT_VERIFIED_ERROR = 'NOT_VERIFIED_ERROR', NO_ACTIVE_ORDER_ERROR = 'NO_ACTIVE_ORDER_ERROR', ORDER_LIMIT_ERROR = 'ORDER_LIMIT_ERROR', ORDER_MODIFICATION_ERROR = 'ORDER_MODIFICATION_ERROR', ORDER_PAYMENT_STATE_ERROR = 'ORDER_PAYMENT_STATE_ERROR', ORDER_STATE_TRANSITION_ERROR = 'ORDER_STATE_TRANSITION_ERROR', PASSWORD_ALREADY_SET_ERROR = 'PASSWORD_ALREADY_SET_ERROR', PASSWORD_RESET_TOKEN_EXPIRED_ERROR = 'PASSWORD_RESET_TOKEN_EXPIRED_ERROR', PASSWORD_RESET_TOKEN_INVALID_ERROR = 'PASSWORD_RESET_TOKEN_INVALID_ERROR', PASSWORD_VALIDATION_ERROR = 'PASSWORD_VALIDATION_ERROR', PAYMENT_DECLINED_ERROR = 'PAYMENT_DECLINED_ERROR', PAYMENT_FAILED_ERROR = 'PAYMENT_FAILED_ERROR', UNKNOWN_ERROR = 'UNKNOWN_ERROR', VERIFICATION_TOKEN_EXPIRED_ERROR = 'VERIFICATION_TOKEN_EXPIRED_ERROR', VERIFICATION_TOKEN_INVALID_ERROR = 'VERIFICATION_TOKEN_INVALID_ERROR' } export type ErrorResult = { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type Facet = Node & { code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; translations: Array<FacetTranslation>; updatedAt: Scalars['DateTime']['output']; /** Returns a paginated, sortable, filterable list of the Facet's values. Added in v2.1.0. */ valueList: FacetValueList; values: Array<FacetValue>; }; export type FacetValueListArgs = { options?: InputMaybe<FacetValueListOptions>; }; export type FacetFilterParameter = { _and?: InputMaybe<Array<FacetFilterParameter>>; _or?: InputMaybe<Array<FacetFilterParameter>>; code?: InputMaybe<StringOperators>; createdAt?: InputMaybe<DateOperators>; id?: InputMaybe<IdOperators>; languageCode?: InputMaybe<StringOperators>; name?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type FacetList = PaginatedList & { items: Array<Facet>; totalItems: Scalars['Int']['output']; }; export type FacetListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<FacetFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<FacetSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type FacetSortParameter = { code?: InputMaybe<SortOrder>; createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type FacetTranslation = { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type FacetValue = Node & { code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; facet: Facet; facetId: Scalars['ID']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; translations: Array<FacetValueTranslation>; updatedAt: Scalars['DateTime']['output']; }; /** * Used to construct boolean expressions for filtering search results * by FacetValue ID. Examples: * * * ID=1 OR ID=2: `{ facetValueFilters: [{ or: [1,2] }] }` * * ID=1 AND ID=2: `{ facetValueFilters: [{ and: 1 }, { and: 2 }] }` * * ID=1 AND (ID=2 OR ID=3): `{ facetValueFilters: [{ and: 1 }, { or: [2,3] }] }` */ export type FacetValueFilterInput = { and?: InputMaybe<Scalars['ID']['input']>; or?: InputMaybe<Array<Scalars['ID']['input']>>; }; export type FacetValueFilterParameter = { _and?: InputMaybe<Array<FacetValueFilterParameter>>; _or?: InputMaybe<Array<FacetValueFilterParameter>>; code?: InputMaybe<StringOperators>; createdAt?: InputMaybe<DateOperators>; facetId?: InputMaybe<IdOperators>; id?: InputMaybe<IdOperators>; languageCode?: InputMaybe<StringOperators>; name?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type FacetValueList = PaginatedList & { items: Array<FacetValue>; totalItems: Scalars['Int']['output']; }; export type FacetValueListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<FacetValueFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<FacetValueSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; /** * Which FacetValues are present in the products returned * by the search, and in what quantity. */ export type FacetValueResult = { count: Scalars['Int']['output']; facetValue: FacetValue; }; export type FacetValueSortParameter = { code?: InputMaybe<SortOrder>; createdAt?: InputMaybe<SortOrder>; facetId?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type FacetValueTranslation = { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type FloatCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; max?: Maybe<Scalars['Float']['output']>; min?: Maybe<Scalars['Float']['output']>; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; step?: Maybe<Scalars['Float']['output']>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type Fulfillment = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; lines: Array<FulfillmentLine>; method: Scalars['String']['output']; state: Scalars['String']['output']; /** @deprecated Use the `lines` field instead */ summary: Array<FulfillmentLine>; trackingCode?: Maybe<Scalars['String']['output']>; updatedAt: Scalars['DateTime']['output']; }; export type FulfillmentLine = { fulfillment: Fulfillment; fulfillmentId: Scalars['ID']['output']; orderLine: OrderLine; orderLineId: Scalars['ID']['output']; quantity: Scalars['Int']['output']; }; export enum GlobalFlag { FALSE = 'FALSE', INHERIT = 'INHERIT', TRUE = 'TRUE' } /** Returned when attempting to set the Customer on a guest checkout when the configured GuestCheckoutStrategy does not allow it. */ export type GuestCheckoutError = ErrorResult & { errorCode: ErrorCode; errorDetail: Scalars['String']['output']; message: Scalars['String']['output']; }; export type HistoryEntry = Node & { createdAt: Scalars['DateTime']['output']; data: Scalars['JSON']['output']; id: Scalars['ID']['output']; type: HistoryEntryType; updatedAt: Scalars['DateTime']['output']; }; export type HistoryEntryFilterParameter = { _and?: InputMaybe<Array<HistoryEntryFilterParameter>>; _or?: InputMaybe<Array<HistoryEntryFilterParameter>>; createdAt?: InputMaybe<DateOperators>; id?: InputMaybe<IdOperators>; type?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type HistoryEntryList = PaginatedList & { items: Array<HistoryEntry>; totalItems: Scalars['Int']['output']; }; export type HistoryEntryListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<HistoryEntryFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<HistoryEntrySortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type HistoryEntrySortParameter = { createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export enum HistoryEntryType { CUSTOMER_ADDED_TO_GROUP = 'CUSTOMER_ADDED_TO_GROUP', CUSTOMER_ADDRESS_CREATED = 'CUSTOMER_ADDRESS_CREATED', CUSTOMER_ADDRESS_DELETED = 'CUSTOMER_ADDRESS_DELETED', CUSTOMER_ADDRESS_UPDATED = 'CUSTOMER_ADDRESS_UPDATED', CUSTOMER_DETAIL_UPDATED = 'CUSTOMER_DETAIL_UPDATED', CUSTOMER_EMAIL_UPDATE_REQUESTED = 'CUSTOMER_EMAIL_UPDATE_REQUESTED', CUSTOMER_EMAIL_UPDATE_VERIFIED = 'CUSTOMER_EMAIL_UPDATE_VERIFIED', CUSTOMER_NOTE = 'CUSTOMER_NOTE', CUSTOMER_PASSWORD_RESET_REQUESTED = 'CUSTOMER_PASSWORD_RESET_REQUESTED', CUSTOMER_PASSWORD_RESET_VERIFIED = 'CUSTOMER_PASSWORD_RESET_VERIFIED', CUSTOMER_PASSWORD_UPDATED = 'CUSTOMER_PASSWORD_UPDATED', CUSTOMER_REGISTERED = 'CUSTOMER_REGISTERED', CUSTOMER_REMOVED_FROM_GROUP = 'CUSTOMER_REMOVED_FROM_GROUP', CUSTOMER_VERIFIED = 'CUSTOMER_VERIFIED', ORDER_CANCELLATION = 'ORDER_CANCELLATION', ORDER_COUPON_APPLIED = 'ORDER_COUPON_APPLIED', ORDER_COUPON_REMOVED = 'ORDER_COUPON_REMOVED', ORDER_CUSTOMER_UPDATED = 'ORDER_CUSTOMER_UPDATED', ORDER_FULFILLMENT = 'ORDER_FULFILLMENT', ORDER_FULFILLMENT_TRANSITION = 'ORDER_FULFILLMENT_TRANSITION', ORDER_MODIFIED = 'ORDER_MODIFIED', ORDER_NOTE = 'ORDER_NOTE', ORDER_PAYMENT_TRANSITION = 'ORDER_PAYMENT_TRANSITION', ORDER_REFUND_TRANSITION = 'ORDER_REFUND_TRANSITION', ORDER_STATE_TRANSITION = 'ORDER_STATE_TRANSITION' } /** Operators for filtering on a list of ID fields */ export type IdListOperators = { inList: Scalars['ID']['input']; }; /** Operators for filtering on an ID field */ export type IdOperators = { eq?: InputMaybe<Scalars['String']['input']>; in?: InputMaybe<Array<Scalars['String']['input']>>; isNull?: InputMaybe<Scalars['Boolean']['input']>; notEq?: InputMaybe<Scalars['String']['input']>; notIn?: InputMaybe<Array<Scalars['String']['input']>>; }; /** * Returned if the token used to change a Customer's email address is valid, but has * expired according to the `verificationTokenDuration` setting in the AuthOptions. */ export type IdentifierChangeTokenExpiredError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** * Returned if the token used to change a Customer's email address is either * invalid or does not match any expected tokens. */ export type IdentifierChangeTokenInvalidError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned when attempting to add a Payment using a PaymentMethod for which the Order is not eligible. */ export type IneligiblePaymentMethodError = ErrorResult & { eligibilityCheckerMessage?: Maybe<Scalars['String']['output']>; errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned when attempting to set a ShippingMethod for which the Order is not eligible */ export type IneligibleShippingMethodError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned when attempting to add more items to the Order than are available */ export type InsufficientStockError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; order: Order; quantityAvailable: Scalars['Int']['output']; }; export type IntCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; max?: Maybe<Scalars['Int']['output']>; min?: Maybe<Scalars['Int']['output']>; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; step?: Maybe<Scalars['Int']['output']>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; /** Returned if the user authentication credentials are not valid */ export type InvalidCredentialsError = ErrorResult & { authenticationError: Scalars['String']['output']; errorCode: ErrorCode; message: Scalars['String']['output']; }; /** * @description * Languages in the form of a ISO 639-1 language code with optional * region or script modifier (e.g. de_AT). The selection available is based * on the [Unicode CLDR summary list](https://unicode-org.github.io/cldr-staging/charts/37/summary/root.html) * and includes the major spoken languages of the world and any widely-used variants. * * @docsCategory common */ export enum LanguageCode { /** Afrikaans */ af = 'af', /** Akan */ ak = 'ak', /** Amharic */ am = 'am', /** Arabic */ ar = 'ar', /** Assamese */ as = 'as', /** Azerbaijani */ az = 'az', /** Belarusian */ be = 'be', /** Bulgarian */ bg = 'bg', /** Bambara */ bm = 'bm', /** Bangla */ bn = 'bn', /** Tibetan */ bo = 'bo', /** Breton */ br = 'br', /** Bosnian */ bs = 'bs', /** Catalan */ ca = 'ca', /** Chechen */ ce = 'ce', /** Corsican */ co = 'co', /** Czech */ cs = 'cs', /** Church Slavic */ cu = 'cu', /** Welsh */ cy = 'cy', /** Danish */ da = 'da', /** German */ de = 'de', /** Austrian German */ de_AT = 'de_AT', /** Swiss High German */ de_CH = 'de_CH', /** Dzongkha */ dz = 'dz', /** Ewe */ ee = 'ee', /** Greek */ el = 'el', /** English */ en = 'en', /** Australian English */ en_AU = 'en_AU', /** Canadian English */ en_CA = 'en_CA', /** British English */ en_GB = 'en_GB', /** American English */ en_US = 'en_US', /** Esperanto */ eo = 'eo', /** Spanish */ es = 'es', /** European Spanish */ es_ES = 'es_ES', /** Mexican Spanish */ es_MX = 'es_MX', /** Estonian */ et = 'et', /** Basque */ eu = 'eu', /** Persian */ fa = 'fa', /** Dari */ fa_AF = 'fa_AF', /** Fulah */ ff = 'ff', /** Finnish */ fi = 'fi', /** Faroese */ fo = 'fo', /** French */ fr = 'fr', /** Canadian French */ fr_CA = 'fr_CA', /** Swiss French */ fr_CH = 'fr_CH', /** Western Frisian */ fy = 'fy', /** Irish */ ga = 'ga', /** Scottish Gaelic */ gd = 'gd', /** Galician */ gl = 'gl', /** Gujarati */ gu = 'gu', /** Manx */ gv = 'gv', /** Hausa */ ha = 'ha', /** Hebrew */ he = 'he', /** Hindi */ hi = 'hi', /** Croatian */ hr = 'hr', /** Haitian Creole */ ht = 'ht', /** Hungarian */ hu = 'hu', /** Armenian */ hy = 'hy', /** Interlingua */ ia = 'ia', /** Indonesian */ id = 'id', /** Igbo */ ig = 'ig', /** Sichuan Yi */ ii = 'ii', /** Icelandic */ is = 'is', /** Italian */ it = 'it', /** Japanese */ ja = 'ja', /** Javanese */ jv = 'jv', /** Georgian */ ka = 'ka', /** Kikuyu */ ki = 'ki', /** Kazakh */ kk = 'kk', /** Kalaallisut */ kl = 'kl', /** Khmer */ km = 'km', /** Kannada */ kn = 'kn', /** Korean */ ko = 'ko', /** Kashmiri */ ks = 'ks', /** Kurdish */ ku = 'ku', /** Cornish */ kw = 'kw', /** Kyrgyz */ ky = 'ky', /** Latin */ la = 'la', /** Luxembourgish */ lb = 'lb', /** Ganda */ lg = 'lg', /** Lingala */ ln = 'ln', /** Lao */ lo = 'lo', /** Lithuanian */ lt = 'lt', /** Luba-Katanga */ lu = 'lu', /** Latvian */ lv = 'lv', /** Malagasy */ mg = 'mg', /** Maori */ mi = 'mi', /** Macedonian */ mk = 'mk', /** Malayalam */ ml = 'ml', /** Mongolian */ mn = 'mn', /** Marathi */ mr = 'mr', /** Malay */ ms = 'ms', /** Maltese */ mt = 'mt', /** Burmese */ my = 'my', /** Norwegian Bokmål */ nb = 'nb', /** North Ndebele */ nd = 'nd', /** Nepali */ ne = 'ne', /** Dutch */ nl = 'nl', /** Flemish */ nl_BE = 'nl_BE', /** Norwegian Nynorsk */ nn = 'nn', /** Nyanja */ ny = 'ny', /** Oromo */ om = 'om', /** Odia */ or = 'or', /** Ossetic */ os = 'os', /** Punjabi */ pa = 'pa', /** Polish */ pl = 'pl', /** Pashto */ ps = 'ps', /** Portuguese */ pt = 'pt', /** Brazilian Portuguese */ pt_BR = 'pt_BR', /** European Portuguese */ pt_PT = 'pt_PT', /** Quechua */ qu = 'qu', /** Romansh */ rm = 'rm', /** Rundi */ rn = 'rn', /** Romanian */ ro = 'ro', /** Moldavian */ ro_MD = 'ro_MD', /** Russian */ ru = 'ru', /** Kinyarwanda */ rw = 'rw', /** Sanskrit */ sa = 'sa', /** Sindhi */ sd = 'sd', /** Northern Sami */ se = 'se', /** Sango */ sg = 'sg', /** Sinhala */ si = 'si', /** Slovak */ sk = 'sk', /** Slovenian */ sl = 'sl', /** Samoan */ sm = 'sm', /** Shona */ sn = 'sn', /** Somali */ so = 'so', /** Albanian */ sq = 'sq', /** Serbian */ sr = 'sr', /** Southern Sotho */ st = 'st', /** Sundanese */ su = 'su', /** Swedish */ sv = 'sv', /** Swahili */ sw = 'sw', /** Congo Swahili */ sw_CD = 'sw_CD', /** Tamil */ ta = 'ta', /** Telugu */ te = 'te', /** Tajik */ tg = 'tg', /** Thai */ th = 'th', /** Tigrinya */ ti = 'ti', /** Turkmen */ tk = 'tk', /** Tongan */ to = 'to', /** Turkish */ tr = 'tr', /** Tatar */ tt = 'tt', /** Uyghur */ ug = 'ug', /** Ukrainian */ uk = 'uk', /** Urdu */ ur = 'ur', /** Uzbek */ uz = 'uz', /** Vietnamese */ vi = 'vi', /** Volapük */ vo = 'vo', /** Wolof */ wo = 'wo', /** Xhosa */ xh = 'xh', /** Yiddish */ yi = 'yi', /** Yoruba */ yo = 'yo', /** Chinese */ zh = 'zh', /** Simplified Chinese */ zh_Hans = 'zh_Hans', /** Traditional Chinese */ zh_Hant = 'zh_Hant', /** Zulu */ zu = 'zu' } export type LocaleStringCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; length?: Maybe<Scalars['Int']['output']>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; pattern?: Maybe<Scalars['String']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type LocaleTextCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type LocalizedString = { languageCode: LanguageCode; value: Scalars['String']['output']; }; export enum LogicalOperator { AND = 'AND', OR = 'OR' } /** Returned when attempting to register or verify a customer account without a password, when one is required. */ export type MissingPasswordError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type Mutation = { /** Adds an item to the order. If custom fields are defined on the OrderLine entity, a third argument 'customFields' will be available. */ addItemToOrder: UpdateOrderItemsResult; /** Add a Payment to the Order */ addPaymentToOrder: AddPaymentToOrderResult; /** Adjusts an OrderLine. If custom fields are defined on the OrderLine entity, a third argument 'customFields' of type `OrderLineCustomFieldsInput` will be available. */ adjustOrderLine: UpdateOrderItemsResult; /** Applies the given coupon code to the active Order */ applyCouponCode: ApplyCouponCodeResult; /** Authenticates the user using a named authentication strategy */ authenticate: AuthenticationResult; /** Create a new Customer Address */ createCustomerAddress: Address; /** Delete an existing Address */ deleteCustomerAddress: Success; /** Authenticates the user using the native authentication strategy. This mutation is an alias for `authenticate({ native: { ... }})` */ login: NativeAuthenticationResult; /** End the current authenticated session */ logout: Success; /** Regenerate and send a verification token for a new Customer registration. Only applicable if `authOptions.requireVerification` is set to true. */ refreshCustomerVerification: RefreshCustomerVerificationResult; /** * Register a Customer account with the given credentials. There are three possible registration flows: * * _If `authOptions.requireVerification` is set to `true`:_ * * 1. **The Customer is registered _with_ a password**. A verificationToken will be created (and typically emailed to the Customer). That * verificationToken would then be passed to the `verifyCustomerAccount` mutation _without_ a password. The Customer is then * verified and authenticated in one step. * 2. **The Customer is registered _without_ a password**. A verificationToken will be created (and typically emailed to the Customer). That * verificationToken would then be passed to the `verifyCustomerAccount` mutation _with_ the chosen password of the Customer. The Customer is then * verified and authenticated in one step. * * _If `authOptions.requireVerification` is set to `false`:_ * * 3. The Customer _must_ be registered _with_ a password. No further action is needed - the Customer is able to authenticate immediately. */ registerCustomerAccount: RegisterCustomerAccountResult; /** Remove all OrderLine from the Order */ removeAllOrderLines: RemoveOrderItemsResult; /** Removes the given coupon code from the active Order */ removeCouponCode?: Maybe<Order>; /** Remove an OrderLine from the Order */ removeOrderLine: RemoveOrderItemsResult; /** Requests a password reset email to be sent */ requestPasswordReset?: Maybe<RequestPasswordResetResult>; /** * Request to update the emailAddress of the active Customer. If `authOptions.requireVerification` is enabled * (as is the default), then the `identifierChangeToken` will be assigned to the current User and * a IdentifierChangeRequestEvent will be raised. This can then be used e.g. by the EmailPlugin to email * that verification token to the Customer, which is then used to verify the change of email address. */ requestUpdateCustomerEmailAddress: RequestUpdateCustomerEmailAddressResult; /** Resets a Customer's password based on the provided token */ resetPassword: ResetPasswordResult; /** Set the Customer for the Order. Required only if the Customer is not currently logged in */ setCustomerForOrder: SetCustomerForOrderResult; /** Sets the billing address for this order */ setOrderBillingAddress: ActiveOrderResult; /** Allows any custom fields to be set for the active order */ setOrderCustomFields: ActiveOrderResult; /** Sets the shipping address for this order */ setOrderShippingAddress: ActiveOrderResult; /** * Sets the shipping method by id, which can be obtained with the `eligibleShippingMethods` query. * An Order can have multiple shipping methods, in which case you can pass an array of ids. In this case, * you should configure a custom ShippingLineAssignmentStrategy in order to know which OrderLines each * shipping method will apply to. */ setOrderShippingMethod: SetOrderShippingMethodResult; /** Transitions an Order to a new state. Valid next states can be found by querying `nextOrderStates` */ transitionOrderToState?: Maybe<TransitionOrderToStateResult>; /** Update an existing Customer */ updateCustomer: Customer; /** Update an existing Address */ updateCustomerAddress: Address; /** * Confirm the update of the emailAddress with the provided token, which has been generated by the * `requestUpdateCustomerEmailAddress` mutation. */ updateCustomerEmailAddress: UpdateCustomerEmailAddressResult; /** Update the password of the active Customer */ updateCustomerPassword: UpdateCustomerPasswordResult; /** * Verify a Customer email address with the token sent to that address. Only applicable if `authOptions.requireVerification` is set to true. * * If the Customer was not registered with a password in the `registerCustomerAccount` mutation, the password _must_ be * provided here. */ verifyCustomerAccount: VerifyCustomerAccountResult; }; export type MutationAddItemToOrderArgs = { productVariantId: Scalars['ID']['input']; quantity: Scalars['Int']['input']; }; export type MutationAddPaymentToOrderArgs = { input: PaymentInput; }; export type MutationAdjustOrderLineArgs = { orderLineId: Scalars['ID']['input']; quantity: Scalars['Int']['input']; }; export type MutationApplyCouponCodeArgs = { couponCode: Scalars['String']['input']; }; export type MutationAuthenticateArgs = { input: AuthenticationInput; rememberMe?: InputMaybe<Scalars['Boolean']['input']>; }; export type MutationCreateCustomerAddressArgs = { input: CreateAddressInput; }; export type MutationDeleteCustomerAddressArgs = { id: Scalars['ID']['input']; }; export type MutationLoginArgs = { password: Scalars['String']['input']; rememberMe?: InputMaybe<Scalars['Boolean']['input']>; username: Scalars['String']['input']; }; export type MutationRefreshCustomerVerificationArgs = { emailAddress: Scalars['String']['input']; }; export type MutationRegisterCustomerAccountArgs = { input: RegisterCustomerInput; }; export type MutationRemoveCouponCodeArgs = { couponCode: Scalars['String']['input']; }; export type MutationRemoveOrderLineArgs = { orderLineId: Scalars['ID']['input']; }; export type MutationRequestPasswordResetArgs = { emailAddress: Scalars['String']['input']; }; export type MutationRequestUpdateCustomerEmailAddressArgs = { newEmailAddress: Scalars['String']['input']; password: Scalars['String']['input']; }; export type MutationResetPasswordArgs = { password: Scalars['String']['input']; token: Scalars['String']['input']; }; export type MutationSetCustomerForOrderArgs = { input: CreateCustomerInput; }; export type MutationSetOrderBillingAddressArgs = { input: CreateAddressInput; }; export type MutationSetOrderCustomFieldsArgs = { input: UpdateOrderInput; }; export type MutationSetOrderShippingAddressArgs = { input: CreateAddressInput; }; export type MutationSetOrderShippingMethodArgs = { shippingMethodId: Array<Scalars['ID']['input']>; }; export type MutationTransitionOrderToStateArgs = { state: Scalars['String']['input']; }; export type MutationUpdateCustomerArgs = { input: UpdateCustomerInput; }; export type MutationUpdateCustomerAddressArgs = { input: UpdateAddressInput; }; export type MutationUpdateCustomerEmailAddressArgs = { token: Scalars['String']['input']; }; export type MutationUpdateCustomerPasswordArgs = { currentPassword: Scalars['String']['input']; newPassword: Scalars['String']['input']; }; export type MutationVerifyCustomerAccountArgs = { password?: InputMaybe<Scalars['String']['input']>; token: Scalars['String']['input']; }; export type NativeAuthInput = { password: Scalars['String']['input']; username: Scalars['String']['input']; }; /** Returned when attempting an operation that relies on the NativeAuthStrategy, if that strategy is not configured. */ export type NativeAuthStrategyError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type NativeAuthenticationResult = CurrentUser | InvalidCredentialsError | NativeAuthStrategyError | NotVerifiedError; /** Returned when attempting to set a negative OrderLine quantity. */ export type NegativeQuantityError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** * Returned when invoking a mutation which depends on there being an active Order on the * current session. */ export type NoActiveOrderError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type Node = { id: Scalars['ID']['output']; }; /** * Returned if `authOptions.requireVerification` is set to `true` (which is the default) * and an unverified user attempts to authenticate. */ export type NotVerifiedError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Operators for filtering on a list of Number fields */ export type NumberListOperators = { inList: Scalars['Float']['input']; }; /** Operators for filtering on a Int or Float field */ export type NumberOperators = { between?: InputMaybe<NumberRange>; eq?: InputMaybe<Scalars['Float']['input']>; gt?: InputMaybe<Scalars['Float']['input']>; gte?: InputMaybe<Scalars['Float']['input']>; isNull?: InputMaybe<Scalars['Boolean']['input']>; lt?: InputMaybe<Scalars['Float']['input']>; lte?: InputMaybe<Scalars['Float']['input']>; }; export type NumberRange = { end: Scalars['Float']['input']; start: Scalars['Float']['input']; }; export type Order = Node & { /** An order is active as long as the payment process has not been completed */ active: Scalars['Boolean']['output']; billingAddress?: Maybe<OrderAddress>; /** A unique code for the Order */ code: Scalars['String']['output']; /** An array of all coupon codes applied to the Order */ couponCodes: Array<Scalars['String']['output']>; createdAt: Scalars['DateTime']['output']; currencyCode: CurrencyCode; customFields?: Maybe<Scalars['JSON']['output']>; customer?: Maybe<Customer>; discounts: Array<Discount>; fulfillments?: Maybe<Array<Fulfillment>>; history: HistoryEntryList; id: Scalars['ID']['output']; lines: Array<OrderLine>; /** * The date & time that the Order was placed, i.e. the Customer * completed the checkout and the Order is no longer "active" */ orderPlacedAt?: Maybe<Scalars['DateTime']['output']>; payments?: Maybe<Array<Payment>>; /** Promotions applied to the order. Only gets populated after the payment process has completed. */ promotions: Array<Promotion>; shipping: Scalars['Money']['output']; shippingAddress?: Maybe<OrderAddress>; shippingLines: Array<ShippingLine>; shippingWithTax: Scalars['Money']['output']; state: Scalars['String']['output']; /** * The subTotal is the total of all OrderLines in the Order. This figure also includes any Order-level * discounts which have been prorated (proportionally distributed) amongst the items of each OrderLine. * To get a total of all OrderLines which does not account for prorated discounts, use the * sum of `OrderLine.discountedLinePrice` values. */ subTotal: Scalars['Money']['output']; /** Same as subTotal, but inclusive of tax */ subTotalWithTax: Scalars['Money']['output']; /** * Surcharges are arbitrary modifications to the Order total which are neither * ProductVariants nor discounts resulting from applied Promotions. For example, * one-off discounts based on customer interaction, or surcharges based on payment * methods. */ surcharges: Array<Surcharge>; /** A summary of the taxes being applied to this Order */ taxSummary: Array<OrderTaxSummary>; /** Equal to subTotal plus shipping */ total: Scalars['Money']['output']; totalQuantity: Scalars['Int']['output']; /** The final payable amount. Equal to subTotalWithTax plus shippingWithTax */ totalWithTax: Scalars['Money']['output']; type: OrderType; updatedAt: Scalars['DateTime']['output']; }; export type OrderHistoryArgs = { options?: InputMaybe<HistoryEntryListOptions>; }; export type OrderAddress = { city?: Maybe<Scalars['String']['output']>; company?: Maybe<Scalars['String']['output']>; country?: Maybe<Scalars['String']['output']>; countryCode?: Maybe<Scalars['String']['output']>; customFields?: Maybe<Scalars['JSON']['output']>; fullName?: Maybe<Scalars['String']['output']>; phoneNumber?: Maybe<Scalars['String']['output']>; postalCode?: Maybe<Scalars['String']['output']>; province?: Maybe<Scalars['String']['output']>; streetLine1?: Maybe<Scalars['String']['output']>; streetLine2?: Maybe<Scalars['String']['output']>; }; export type OrderFilterParameter = { _and?: InputMaybe<Array<OrderFilterParameter>>; _or?: InputMaybe<Array<OrderFilterParameter>>; active?: InputMaybe<BooleanOperators>; code?: InputMaybe<StringOperators>; createdAt?: InputMaybe<DateOperators>; currencyCode?: InputMaybe<StringOperators>; id?: InputMaybe<IdOperators>; orderPlacedAt?: InputMaybe<DateOperators>; shipping?: InputMaybe<NumberOperators>; shippingWithTax?: InputMaybe<NumberOperators>; state?: InputMaybe<StringOperators>; subTotal?: InputMaybe<NumberOperators>; subTotalWithTax?: InputMaybe<NumberOperators>; total?: InputMaybe<NumberOperators>; totalQuantity?: InputMaybe<NumberOperators>; totalWithTax?: InputMaybe<NumberOperators>; type?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; /** Returned when the maximum order size limit has been reached. */ export type OrderLimitError = ErrorResult & { errorCode: ErrorCode; maxItems: Scalars['Int']['output']; message: Scalars['String']['output']; }; export type OrderLine = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; /** The price of the line including discounts, excluding tax */ discountedLinePrice: Scalars['Money']['output']; /** The price of the line including discounts and tax */ discountedLinePriceWithTax: Scalars['Money']['output']; /** * The price of a single unit including discounts, excluding tax. * * If Order-level discounts have been applied, this will not be the * actual taxable unit price (see `proratedUnitPrice`), but is generally the * correct price to display to customers to avoid confusion * about the internal handling of distributed Order-level discounts. */ discountedUnitPrice: Scalars['Money']['output']; /** The price of a single unit including discounts and tax */ discountedUnitPriceWithTax: Scalars['Money']['output']; discounts: Array<Discount>; featuredAsset?: Maybe<Asset>; fulfillmentLines?: Maybe<Array<FulfillmentLine>>; id: Scalars['ID']['output']; /** The total price of the line excluding tax and discounts. */ linePrice: Scalars['Money']['output']; /** The total price of the line including tax but excluding discounts. */ linePriceWithTax: Scalars['Money']['output']; /** The total tax on this line */ lineTax: Scalars['Money']['output']; order: Order; /** The quantity at the time the Order was placed */ orderPlacedQuantity: Scalars['Int']['output']; productVariant: ProductVariant; /** * The actual line price, taking into account both item discounts _and_ prorated (proportionally-distributed) * Order-level discounts. This value is the true economic value of the OrderLine, and is used in tax * and refund calculations. */ proratedLinePrice: Scalars['Money']['output']; /** The proratedLinePrice including tax */ proratedLinePriceWithTax: Scalars['Money']['output']; /** * The actual unit price, taking into account both item discounts _and_ prorated (proportionally-distributed) * Order-level discounts. This value is the true economic value of the OrderItem, and is used in tax * and refund calculations. */ proratedUnitPrice: Scalars['Money']['output']; /** The proratedUnitPrice including tax */ proratedUnitPriceWithTax: Scalars['Money']['output']; /** The quantity of items purchased */ quantity: Scalars['Int']['output']; taxLines: Array<TaxLine>; taxRate: Scalars['Float']['output']; /** The price of a single unit, excluding tax and discounts */ unitPrice: Scalars['Money']['output']; /** Non-zero if the unitPrice has changed since it was initially added to Order */ unitPriceChangeSinceAdded: Scalars['Money']['output']; /** The price of a single unit, including tax but excluding discounts */ unitPriceWithTax: Scalars['Money']['output']; /** Non-zero if the unitPriceWithTax has changed since it was initially added to Order */ unitPriceWithTaxChangeSinceAdded: Scalars['Money']['output']; updatedAt: Scalars['DateTime']['output']; }; export type OrderList = PaginatedList & { items: Array<Order>; totalItems: Scalars['Int']['output']; }; export type OrderListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<OrderFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<OrderSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; /** Returned when attempting to modify the contents of an Order that is not in the `AddingItems` state. */ export type OrderModificationError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned when attempting to add a Payment to an Order that is not in the `ArrangingPayment` state. */ export type OrderPaymentStateError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type OrderSortParameter = { code?: InputMaybe<SortOrder>; createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; orderPlacedAt?: InputMaybe<SortOrder>; shipping?: InputMaybe<SortOrder>; shippingWithTax?: InputMaybe<SortOrder>; state?: InputMaybe<SortOrder>; subTotal?: InputMaybe<SortOrder>; subTotalWithTax?: InputMaybe<SortOrder>; total?: InputMaybe<SortOrder>; totalQuantity?: InputMaybe<SortOrder>; totalWithTax?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; /** Returned if there is an error in transitioning the Order state */ export type OrderStateTransitionError = ErrorResult & { errorCode: ErrorCode; fromState: Scalars['String']['output']; message: Scalars['String']['output']; toState: Scalars['String']['output']; transitionError: Scalars['String']['output']; }; /** * A summary of the taxes being applied to this order, grouped * by taxRate. */ export type OrderTaxSummary = { /** A description of this tax */ description: Scalars['String']['output']; /** The total net price of OrderLines to which this taxRate applies */ taxBase: Scalars['Money']['output']; /** The taxRate as a percentage */ taxRate: Scalars['Float']['output']; /** The total tax being applied to the Order at this taxRate */ taxTotal: Scalars['Money']['output']; }; export enum OrderType { Aggregate = 'Aggregate', Regular = 'Regular', Seller = 'Seller' } export type PaginatedList = { items: Array<Node>; totalItems: Scalars['Int']['output']; }; /** Returned when attempting to verify a customer account with a password, when a password has already been set. */ export type PasswordAlreadySetError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** * Returned if the token used to reset a Customer's password is valid, but has * expired according to the `verificationTokenDuration` setting in the AuthOptions. */ export type PasswordResetTokenExpiredError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** * Returned if the token used to reset a Customer's password is either * invalid or does not match any expected tokens. */ export type PasswordResetTokenInvalidError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** Returned when attempting to register or verify a customer account where the given password fails password validation. */ export type PasswordValidationError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; validationErrorMessage: Scalars['String']['output']; }; export type Payment = Node & { amount: Scalars['Money']['output']; createdAt: Scalars['DateTime']['output']; errorMessage?: Maybe<Scalars['String']['output']>; id: Scalars['ID']['output']; metadata?: Maybe<Scalars['JSON']['output']>; method: Scalars['String']['output']; refunds: Array<Refund>; state: Scalars['String']['output']; transactionId?: Maybe<Scalars['String']['output']>; updatedAt: Scalars['DateTime']['output']; }; /** Returned when a Payment is declined by the payment provider. */ export type PaymentDeclinedError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; paymentErrorMessage: Scalars['String']['output']; }; /** Returned when a Payment fails due to an error. */ export type PaymentFailedError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; paymentErrorMessage: Scalars['String']['output']; }; /** Passed as input to the `addPaymentToOrder` mutation. */ export type PaymentInput = { /** * This field should contain arbitrary data passed to the specified PaymentMethodHandler's `createPayment()` method * as the "metadata" argument. For example, it could contain an ID for the payment and other * data generated by the payment provider. */ metadata: Scalars['JSON']['input']; /** This field should correspond to the `code` property of a PaymentMethod. */ method: Scalars['String']['input']; }; export type PaymentMethod = Node & { checker?: Maybe<ConfigurableOperation>; code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; enabled: Scalars['Boolean']['output']; handler: ConfigurableOperation; id: Scalars['ID']['output']; name: Scalars['String']['output']; translations: Array<PaymentMethodTranslation>; updatedAt: Scalars['DateTime']['output']; }; export type PaymentMethodQuote = { code: Scalars['String']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; eligibilityMessage?: Maybe<Scalars['String']['output']>; id: Scalars['ID']['output']; isEligible: Scalars['Boolean']['output']; name: Scalars['String']['output']; }; export type PaymentMethodTranslation = { createdAt: Scalars['DateTime']['output']; description: Scalars['String']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; /** * @description * Permissions for administrators and customers. Used to control access to * GraphQL resolvers via the {@link Allow} decorator. * * ## Understanding Permission.Owner * * `Permission.Owner` is a special permission which is used in some Vendure resolvers to indicate that that resolver should only * be accessible to the "owner" of that resource. * * For example, the Shop API `activeCustomer` query resolver should only return the Customer object for the "owner" of that Customer, i.e. * based on the activeUserId of the current session. As a result, the resolver code looks like this: * * @example * ```TypeScript * \@Query() * \@Allow(Permission.Owner) * async activeCustomer(\@Ctx() ctx: RequestContext): Promise<Customer | undefined> { * const userId = ctx.activeUserId; * if (userId) { * return this.customerService.findOneByUserId(ctx, userId); * } * } * ``` * * Here we can see that the "ownership" must be enforced by custom logic inside the resolver. Since "ownership" cannot be defined generally * nor statically encoded at build-time, any resolvers using `Permission.Owner` **must** include logic to enforce that only the owner * of the resource has access. If not, then it is the equivalent of using `Permission.Public`. * * * @docsCategory common */ export enum Permission { /** Authenticated means simply that the user is logged in */ Authenticated = 'Authenticated', /** Grants permission to create Administrator */ CreateAdministrator = 'CreateAdministrator', /** Grants permission to create Asset */ CreateAsset = 'CreateAsset', /** Grants permission to create Products, Facets, Assets, Collections */ CreateCatalog = 'CreateCatalog', /** Grants permission to create Channel */ CreateChannel = 'CreateChannel', /** Grants permission to create Collection */ CreateCollection = 'CreateCollection', /** Grants permission to create Country */ CreateCountry = 'CreateCountry', /** Grants permission to create Customer */ CreateCustomer = 'CreateCustomer', /** Grants permission to create CustomerGroup */ CreateCustomerGroup = 'CreateCustomerGroup', /** Grants permission to create Facet */ CreateFacet = 'CreateFacet', /** Grants permission to create Order */ CreateOrder = 'CreateOrder', /** Grants permission to create PaymentMethod */ CreatePaymentMethod = 'CreatePaymentMethod', /** Grants permission to create Product */ CreateProduct = 'CreateProduct', /** Grants permission to create Promotion */ CreatePromotion = 'CreatePromotion', /** Grants permission to create Seller */ CreateSeller = 'CreateSeller', /** Grants permission to create PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings */ CreateSettings = 'CreateSettings', /** Grants permission to create ShippingMethod */ CreateShippingMethod = 'CreateShippingMethod', /** Grants permission to create StockLocation */ CreateStockLocation = 'CreateStockLocation', /** Grants permission to create System */ CreateSystem = 'CreateSystem', /** Grants permission to create Tag */ CreateTag = 'CreateTag', /** Grants permission to create TaxCategory */ CreateTaxCategory = 'CreateTaxCategory', /** Grants permission to create TaxRate */ CreateTaxRate = 'CreateTaxRate', /** Grants permission to create Zone */ CreateZone = 'CreateZone', /** Grants permission to delete Administrator */ DeleteAdministrator = 'DeleteAdministrator', /** Grants permission to delete Asset */ DeleteAsset = 'DeleteAsset', /** Grants permission to delete Products, Facets, Assets, Collections */ DeleteCatalog = 'DeleteCatalog', /** Grants permission to delete Channel */ DeleteChannel = 'DeleteChannel', /** Grants permission to delete Collection */ DeleteCollection = 'DeleteCollection', /** Grants permission to delete Country */ DeleteCountry = 'DeleteCountry', /** Grants permission to delete Customer */ DeleteCustomer = 'DeleteCustomer', /** Grants permission to delete CustomerGroup */ DeleteCustomerGroup = 'DeleteCustomerGroup', /** Grants permission to delete Facet */ DeleteFacet = 'DeleteFacet', /** Grants permission to delete Order */ DeleteOrder = 'DeleteOrder', /** Grants permission to delete PaymentMethod */ DeletePaymentMethod = 'DeletePaymentMethod', /** Grants permission to delete Product */ DeleteProduct = 'DeleteProduct', /** Grants permission to delete Promotion */ DeletePromotion = 'DeletePromotion', /** Grants permission to delete Seller */ DeleteSeller = 'DeleteSeller', /** Grants permission to delete PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings */ DeleteSettings = 'DeleteSettings', /** Grants permission to delete ShippingMethod */ DeleteShippingMethod = 'DeleteShippingMethod', /** Grants permission to delete StockLocation */ DeleteStockLocation = 'DeleteStockLocation', /** Grants permission to delete System */ DeleteSystem = 'DeleteSystem', /** Grants permission to delete Tag */ DeleteTag = 'DeleteTag', /** Grants permission to delete TaxCategory */ DeleteTaxCategory = 'DeleteTaxCategory', /** Grants permission to delete TaxRate */ DeleteTaxRate = 'DeleteTaxRate', /** Grants permission to delete Zone */ DeleteZone = 'DeleteZone', /** Owner means the user owns this entity, e.g. a Customer's own Order */ Owner = 'Owner', /** Public means any unauthenticated user may perform the operation */ Public = 'Public', /** Grants permission to read Administrator */ ReadAdministrator = 'ReadAdministrator', /** Grants permission to read Asset */ ReadAsset = 'ReadAsset', /** Grants permission to read Products, Facets, Assets, Collections */ ReadCatalog = 'ReadCatalog', /** Grants permission to read Channel */ ReadChannel = 'ReadChannel', /** Grants permission to read Collection */ ReadCollection = 'ReadCollection', /** Grants permission to read Country */ ReadCountry = 'ReadCountry', /** Grants permission to read Customer */ ReadCustomer = 'ReadCustomer', /** Grants permission to read CustomerGroup */ ReadCustomerGroup = 'ReadCustomerGroup', /** Grants permission to read Facet */ ReadFacet = 'ReadFacet', /** Grants permission to read Order */ ReadOrder = 'ReadOrder', /** Grants permission to read PaymentMethod */ ReadPaymentMethod = 'ReadPaymentMethod', /** Grants permission to read Product */ ReadProduct = 'ReadProduct', /** Grants permission to read Promotion */ ReadPromotion = 'ReadPromotion', /** Grants permission to read Seller */ ReadSeller = 'ReadSeller', /** Grants permission to read PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings */ ReadSettings = 'ReadSettings', /** Grants permission to read ShippingMethod */ ReadShippingMethod = 'ReadShippingMethod', /** Grants permission to read StockLocation */ ReadStockLocation = 'ReadStockLocation', /** Grants permission to read System */ ReadSystem = 'ReadSystem', /** Grants permission to read Tag */ ReadTag = 'ReadTag', /** Grants permission to read TaxCategory */ ReadTaxCategory = 'ReadTaxCategory', /** Grants permission to read TaxRate */ ReadTaxRate = 'ReadTaxRate', /** Grants permission to read Zone */ ReadZone = 'ReadZone', /** SuperAdmin has unrestricted access to all operations */ SuperAdmin = 'SuperAdmin', /** Grants permission to update Administrator */ UpdateAdministrator = 'UpdateAdministrator', /** Grants permission to update Asset */ UpdateAsset = 'UpdateAsset', /** Grants permission to update Products, Facets, Assets, Collections */ UpdateCatalog = 'UpdateCatalog', /** Grants permission to update Channel */ UpdateChannel = 'UpdateChannel', /** Grants permission to update Collection */ UpdateCollection = 'UpdateCollection', /** Grants permission to update Country */ UpdateCountry = 'UpdateCountry', /** Grants permission to update Customer */ UpdateCustomer = 'UpdateCustomer', /** Grants permission to update CustomerGroup */ UpdateCustomerGroup = 'UpdateCustomerGroup', /** Grants permission to update Facet */ UpdateFacet = 'UpdateFacet', /** Grants permission to update GlobalSettings */ UpdateGlobalSettings = 'UpdateGlobalSettings', /** Grants permission to update Order */ UpdateOrder = 'UpdateOrder', /** Grants permission to update PaymentMethod */ UpdatePaymentMethod = 'UpdatePaymentMethod', /** Grants permission to update Product */ UpdateProduct = 'UpdateProduct', /** Grants permission to update Promotion */ UpdatePromotion = 'UpdatePromotion', /** Grants permission to update Seller */ UpdateSeller = 'UpdateSeller', /** Grants permission to update PaymentMethods, ShippingMethods, TaxCategories, TaxRates, Zones, Countries, System & GlobalSettings */ UpdateSettings = 'UpdateSettings', /** Grants permission to update ShippingMethod */ UpdateShippingMethod = 'UpdateShippingMethod', /** Grants permission to update StockLocation */ UpdateStockLocation = 'UpdateStockLocation', /** Grants permission to update System */ UpdateSystem = 'UpdateSystem', /** Grants permission to update Tag */ UpdateTag = 'UpdateTag', /** Grants permission to update TaxCategory */ UpdateTaxCategory = 'UpdateTaxCategory', /** Grants permission to update TaxRate */ UpdateTaxRate = 'UpdateTaxRate', /** Grants permission to update Zone */ UpdateZone = 'UpdateZone' } /** The price range where the result has more than one price */ export type PriceRange = { max: Scalars['Money']['output']; min: Scalars['Money']['output']; }; export type Product = Node & { assets: Array<Asset>; collections: Array<Collection>; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; enabled: Scalars['Boolean']['output']; facetValues: Array<FacetValue>; featuredAsset?: Maybe<Asset>; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; optionGroups: Array<ProductOptionGroup>; slug: Scalars['String']['output']; translations: Array<ProductTranslation>; updatedAt: Scalars['DateTime']['output']; /** Returns a paginated, sortable, filterable list of ProductVariants */ variantList: ProductVariantList; /** Returns all ProductVariants */ variants: Array<ProductVariant>; }; export type ProductVariantListArgs = { options?: InputMaybe<ProductVariantListOptions>; }; export type ProductFilterParameter = { _and?: InputMaybe<Array<ProductFilterParameter>>; _or?: InputMaybe<Array<ProductFilterParameter>>; createdAt?: InputMaybe<DateOperators>; description?: InputMaybe<StringOperators>; enabled?: InputMaybe<BooleanOperators>; id?: InputMaybe<IdOperators>; languageCode?: InputMaybe<StringOperators>; name?: InputMaybe<StringOperators>; slug?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type ProductList = PaginatedList & { items: Array<Product>; totalItems: Scalars['Int']['output']; }; export type ProductListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<ProductFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<ProductSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type ProductOption = Node & { code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; group: ProductOptionGroup; groupId: Scalars['ID']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; translations: Array<ProductOptionTranslation>; updatedAt: Scalars['DateTime']['output']; }; export type ProductOptionGroup = Node & { code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; options: Array<ProductOption>; translations: Array<ProductOptionGroupTranslation>; updatedAt: Scalars['DateTime']['output']; }; export type ProductOptionGroupTranslation = { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type ProductOptionTranslation = { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type ProductSortParameter = { createdAt?: InputMaybe<SortOrder>; description?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; slug?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type ProductTranslation = { createdAt: Scalars['DateTime']['output']; description: Scalars['String']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; slug: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type ProductVariant = Node & { assets: Array<Asset>; createdAt: Scalars['DateTime']['output']; currencyCode: CurrencyCode; customFields?: Maybe<Scalars['JSON']['output']>; facetValues: Array<FacetValue>; featuredAsset?: Maybe<Asset>; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; options: Array<ProductOption>; price: Scalars['Money']['output']; priceWithTax: Scalars['Money']['output']; product: Product; productId: Scalars['ID']['output']; sku: Scalars['String']['output']; stockLevel: Scalars['String']['output']; taxCategory: TaxCategory; taxRateApplied: TaxRate; translations: Array<ProductVariantTranslation>; updatedAt: Scalars['DateTime']['output']; }; export type ProductVariantFilterParameter = { _and?: InputMaybe<Array<ProductVariantFilterParameter>>; _or?: InputMaybe<Array<ProductVariantFilterParameter>>; createdAt?: InputMaybe<DateOperators>; currencyCode?: InputMaybe<StringOperators>; id?: InputMaybe<IdOperators>; languageCode?: InputMaybe<StringOperators>; name?: InputMaybe<StringOperators>; price?: InputMaybe<NumberOperators>; priceWithTax?: InputMaybe<NumberOperators>; productId?: InputMaybe<IdOperators>; sku?: InputMaybe<StringOperators>; stockLevel?: InputMaybe<StringOperators>; updatedAt?: InputMaybe<DateOperators>; }; export type ProductVariantList = PaginatedList & { items: Array<ProductVariant>; totalItems: Scalars['Int']['output']; }; export type ProductVariantListOptions = { /** Allows the results to be filtered */ filter?: InputMaybe<ProductVariantFilterParameter>; /** Specifies whether multiple top-level "filter" fields should be combined with a logical AND or OR operation. Defaults to AND. */ filterOperator?: InputMaybe<LogicalOperator>; /** Skips the first n results, for use in pagination */ skip?: InputMaybe<Scalars['Int']['input']>; /** Specifies which properties to sort the results by */ sort?: InputMaybe<ProductVariantSortParameter>; /** Takes n results, for use in pagination */ take?: InputMaybe<Scalars['Int']['input']>; }; export type ProductVariantSortParameter = { createdAt?: InputMaybe<SortOrder>; id?: InputMaybe<SortOrder>; name?: InputMaybe<SortOrder>; price?: InputMaybe<SortOrder>; priceWithTax?: InputMaybe<SortOrder>; productId?: InputMaybe<SortOrder>; sku?: InputMaybe<SortOrder>; stockLevel?: InputMaybe<SortOrder>; updatedAt?: InputMaybe<SortOrder>; }; export type ProductVariantTranslation = { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type Promotion = Node & { actions: Array<ConfigurableOperation>; conditions: Array<ConfigurableOperation>; couponCode?: Maybe<Scalars['String']['output']>; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; enabled: Scalars['Boolean']['output']; endsAt?: Maybe<Scalars['DateTime']['output']>; id: Scalars['ID']['output']; name: Scalars['String']['output']; perCustomerUsageLimit?: Maybe<Scalars['Int']['output']>; startsAt?: Maybe<Scalars['DateTime']['output']>; translations: Array<PromotionTranslation>; updatedAt: Scalars['DateTime']['output']; usageLimit?: Maybe<Scalars['Int']['output']>; }; export type PromotionList = PaginatedList & { items: Array<Promotion>; totalItems: Scalars['Int']['output']; }; export type PromotionTranslation = { createdAt: Scalars['DateTime']['output']; description: Scalars['String']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type Province = Node & Region & { code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; enabled: Scalars['Boolean']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; parent?: Maybe<Region>; parentId?: Maybe<Scalars['ID']['output']>; translations: Array<RegionTranslation>; type: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type ProvinceList = PaginatedList & { items: Array<Province>; totalItems: Scalars['Int']['output']; }; export type Query = { /** The active Channel */ activeChannel: Channel; /** The active Customer */ activeCustomer?: Maybe<Customer>; /** * The active Order. Will be `null` until an Order is created via `addItemToOrder`. Once an Order reaches the * state of `PaymentAuthorized` or `PaymentSettled`, then that Order is no longer considered "active" and this * query will once again return `null`. */ activeOrder?: Maybe<Order>; /** An array of supported Countries */ availableCountries: Array<Country>; /** Returns a Collection either by its id or slug. If neither 'id' nor 'slug' is specified, an error will result. */ collection?: Maybe<Collection>; /** A list of Collections available to the shop */ collections: CollectionList; /** Returns a list of payment methods and their eligibility based on the current active Order */ eligiblePaymentMethods: Array<PaymentMethodQuote>; /** Returns a list of eligible shipping methods based on the current active Order */ eligibleShippingMethods: Array<ShippingMethodQuote>; /** Returns a Facet by its id */ facet?: Maybe<Facet>; /** A list of Facets available to the shop */ facets: FacetList; /** Returns information about the current authenticated User */ me?: Maybe<CurrentUser>; /** Returns the possible next states that the activeOrder can transition to */ nextOrderStates: Array<Scalars['String']['output']>; /** * Returns an Order based on the id. Note that in the Shop API, only orders belonging to the * currently-authenticated User may be queried. */ order?: Maybe<Order>; /** * Returns an Order based on the order `code`. For guest Orders (i.e. Orders placed by non-authenticated Customers) * this query will only return the Order within 2 hours of the Order being placed. This allows an Order confirmation * screen to be shown immediately after completion of a guest checkout, yet prevents security risks of allowing * general anonymous access to Order data. */ orderByCode?: Maybe<Order>; /** Get a Product either by id or slug. If neither 'id' nor 'slug' is specified, an error will result. */ product?: Maybe<Product>; /** Get a list of Products */ products: ProductList; /** Search Products based on the criteria set by the `SearchInput` */ search: SearchResponse; }; export type QueryCollectionArgs = { id?: InputMaybe<Scalars['ID']['input']>; slug?: InputMaybe<Scalars['String']['input']>; }; export type QueryCollectionsArgs = { options?: InputMaybe<CollectionListOptions>; }; export type QueryFacetArgs = { id: Scalars['ID']['input']; }; export type QueryFacetsArgs = { options?: InputMaybe<FacetListOptions>; }; export type QueryOrderArgs = { id: Scalars['ID']['input']; }; export type QueryOrderByCodeArgs = { code: Scalars['String']['input']; }; export type QueryProductArgs = { id?: InputMaybe<Scalars['ID']['input']>; slug?: InputMaybe<Scalars['String']['input']>; }; export type QueryProductsArgs = { options?: InputMaybe<ProductListOptions>; }; export type QuerySearchArgs = { input: SearchInput; }; export type RefreshCustomerVerificationResult = NativeAuthStrategyError | Success; export type Refund = Node & { adjustment: Scalars['Money']['output']; createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; items: Scalars['Money']['output']; lines: Array<RefundLine>; metadata?: Maybe<Scalars['JSON']['output']>; method?: Maybe<Scalars['String']['output']>; paymentId: Scalars['ID']['output']; reason?: Maybe<Scalars['String']['output']>; shipping: Scalars['Money']['output']; state: Scalars['String']['output']; total: Scalars['Money']['output']; transactionId?: Maybe<Scalars['String']['output']>; updatedAt: Scalars['DateTime']['output']; }; export type RefundLine = { orderLine: OrderLine; orderLineId: Scalars['ID']['output']; quantity: Scalars['Int']['output']; refund: Refund; refundId: Scalars['ID']['output']; }; export type Region = { code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; enabled: Scalars['Boolean']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; parent?: Maybe<Region>; parentId?: Maybe<Scalars['ID']['output']>; translations: Array<RegionTranslation>; type: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type RegionTranslation = { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type RegisterCustomerAccountResult = MissingPasswordError | NativeAuthStrategyError | PasswordValidationError | Success; export type RegisterCustomerInput = { emailAddress: Scalars['String']['input']; firstName?: InputMaybe<Scalars['String']['input']>; lastName?: InputMaybe<Scalars['String']['input']>; password?: InputMaybe<Scalars['String']['input']>; phoneNumber?: InputMaybe<Scalars['String']['input']>; title?: InputMaybe<Scalars['String']['input']>; }; export type RelationCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; entity: Scalars['String']['output']; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; scalarFields: Array<Scalars['String']['output']>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type RemoveOrderItemsResult = Order | OrderModificationError; export type RequestPasswordResetResult = NativeAuthStrategyError | Success; export type RequestUpdateCustomerEmailAddressResult = EmailAddressConflictError | InvalidCredentialsError | NativeAuthStrategyError | Success; export type ResetPasswordResult = CurrentUser | NativeAuthStrategyError | NotVerifiedError | PasswordResetTokenExpiredError | PasswordResetTokenInvalidError | PasswordValidationError; export type Role = Node & { channels: Array<Channel>; code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; description: Scalars['String']['output']; id: Scalars['ID']['output']; permissions: Array<Permission>; updatedAt: Scalars['DateTime']['output']; }; export type RoleList = PaginatedList & { items: Array<Role>; totalItems: Scalars['Int']['output']; }; export type SearchInput = { collectionId?: InputMaybe<Scalars['ID']['input']>; collectionSlug?: InputMaybe<Scalars['String']['input']>; facetValueFilters?: InputMaybe<Array<FacetValueFilterInput>>; /** @deprecated Use `facetValueFilters` instead */ facetValueIds?: InputMaybe<Array<Scalars['ID']['input']>>; /** @deprecated Use `facetValueFilters` instead */ facetValueOperator?: InputMaybe<LogicalOperator>; groupByProduct?: InputMaybe<Scalars['Boolean']['input']>; skip?: InputMaybe<Scalars['Int']['input']>; sort?: InputMaybe<SearchResultSortParameter>; take?: InputMaybe<Scalars['Int']['input']>; term?: InputMaybe<Scalars['String']['input']>; }; export type SearchReindexResponse = { success: Scalars['Boolean']['output']; }; export type SearchResponse = { collections: Array<CollectionResult>; facetValues: Array<FacetValueResult>; items: Array<SearchResult>; totalItems: Scalars['Int']['output']; }; export type SearchResult = { /** An array of ids of the Collections in which this result appears */ collectionIds: Array<Scalars['ID']['output']>; currencyCode: CurrencyCode; description: Scalars['String']['output']; facetIds: Array<Scalars['ID']['output']>; facetValueIds: Array<Scalars['ID']['output']>; price: SearchResultPrice; priceWithTax: SearchResultPrice; productAsset?: Maybe<SearchResultAsset>; productId: Scalars['ID']['output']; productName: Scalars['String']['output']; productVariantAsset?: Maybe<SearchResultAsset>; productVariantId: Scalars['ID']['output']; productVariantName: Scalars['String']['output']; /** A relevance score for the result. Differs between database implementations */ score: Scalars['Float']['output']; sku: Scalars['String']['output']; slug: Scalars['String']['output']; }; export type SearchResultAsset = { focalPoint?: Maybe<Coordinate>; id: Scalars['ID']['output']; preview: Scalars['String']['output']; }; /** The price of a search result product, either as a range or as a single price */ export type SearchResultPrice = PriceRange | SinglePrice; export type SearchResultSortParameter = { name?: InputMaybe<SortOrder>; price?: InputMaybe<SortOrder>; }; export type Seller = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type SetCustomerForOrderResult = AlreadyLoggedInError | EmailAddressConflictError | GuestCheckoutError | NoActiveOrderError | Order; export type SetOrderShippingMethodResult = IneligibleShippingMethodError | NoActiveOrderError | Order | OrderModificationError; export type ShippingLine = { discountedPrice: Scalars['Money']['output']; discountedPriceWithTax: Scalars['Money']['output']; discounts: Array<Discount>; id: Scalars['ID']['output']; price: Scalars['Money']['output']; priceWithTax: Scalars['Money']['output']; shippingMethod: ShippingMethod; }; export type ShippingMethod = Node & { calculator: ConfigurableOperation; checker: ConfigurableOperation; code: Scalars['String']['output']; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; fulfillmentHandlerCode: Scalars['String']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; translations: Array<ShippingMethodTranslation>; updatedAt: Scalars['DateTime']['output']; }; export type ShippingMethodList = PaginatedList & { items: Array<ShippingMethod>; totalItems: Scalars['Int']['output']; }; export type ShippingMethodQuote = { code: Scalars['String']['output']; customFields?: Maybe<Scalars['JSON']['output']>; description: Scalars['String']['output']; id: Scalars['ID']['output']; /** Any optional metadata returned by the ShippingCalculator in the ShippingCalculationResult */ metadata?: Maybe<Scalars['JSON']['output']>; name: Scalars['String']['output']; price: Scalars['Money']['output']; priceWithTax: Scalars['Money']['output']; }; export type ShippingMethodTranslation = { createdAt: Scalars['DateTime']['output']; description: Scalars['String']['output']; id: Scalars['ID']['output']; languageCode: LanguageCode; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; /** The price value where the result has a single price */ export type SinglePrice = { value: Scalars['Money']['output']; }; export enum SortOrder { ASC = 'ASC', DESC = 'DESC' } export type StringCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; length?: Maybe<Scalars['Int']['output']>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; options?: Maybe<Array<StringFieldOption>>; pattern?: Maybe<Scalars['String']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type StringFieldOption = { label?: Maybe<Array<LocalizedString>>; value: Scalars['String']['output']; }; /** Operators for filtering on a list of String fields */ export type StringListOperators = { inList: Scalars['String']['input']; }; /** Operators for filtering on a String field */ export type StringOperators = { contains?: InputMaybe<Scalars['String']['input']>; eq?: InputMaybe<Scalars['String']['input']>; in?: InputMaybe<Array<Scalars['String']['input']>>; isNull?: InputMaybe<Scalars['Boolean']['input']>; notContains?: InputMaybe<Scalars['String']['input']>; notEq?: InputMaybe<Scalars['String']['input']>; notIn?: InputMaybe<Array<Scalars['String']['input']>>; regex?: InputMaybe<Scalars['String']['input']>; }; /** Indicates that an operation succeeded, where we do not want to return any more specific information. */ export type Success = { success: Scalars['Boolean']['output']; }; export type Surcharge = Node & { createdAt: Scalars['DateTime']['output']; description: Scalars['String']['output']; id: Scalars['ID']['output']; price: Scalars['Money']['output']; priceWithTax: Scalars['Money']['output']; sku?: Maybe<Scalars['String']['output']>; taxLines: Array<TaxLine>; taxRate: Scalars['Float']['output']; updatedAt: Scalars['DateTime']['output']; }; export type Tag = Node & { createdAt: Scalars['DateTime']['output']; id: Scalars['ID']['output']; updatedAt: Scalars['DateTime']['output']; value: Scalars['String']['output']; }; export type TagList = PaginatedList & { items: Array<Tag>; totalItems: Scalars['Int']['output']; }; export type TaxCategory = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; isDefault: Scalars['Boolean']['output']; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type TaxLine = { description: Scalars['String']['output']; taxRate: Scalars['Float']['output']; }; export type TaxRate = Node & { category: TaxCategory; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; customerGroup?: Maybe<CustomerGroup>; enabled: Scalars['Boolean']['output']; id: Scalars['ID']['output']; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; value: Scalars['Float']['output']; zone: Zone; }; export type TaxRateList = PaginatedList & { items: Array<TaxRate>; totalItems: Scalars['Int']['output']; }; export type TextCustomFieldConfig = CustomField & { description?: Maybe<Array<LocalizedString>>; internal?: Maybe<Scalars['Boolean']['output']>; label?: Maybe<Array<LocalizedString>>; list: Scalars['Boolean']['output']; name: Scalars['String']['output']; nullable?: Maybe<Scalars['Boolean']['output']>; readonly?: Maybe<Scalars['Boolean']['output']>; requiresPermission?: Maybe<Array<Permission>>; type: Scalars['String']['output']; ui?: Maybe<Scalars['JSON']['output']>; }; export type TransitionOrderToStateResult = Order | OrderStateTransitionError; export type UpdateAddressInput = { city?: InputMaybe<Scalars['String']['input']>; company?: InputMaybe<Scalars['String']['input']>; countryCode?: InputMaybe<Scalars['String']['input']>; customFields?: InputMaybe<Scalars['JSON']['input']>; defaultBillingAddress?: InputMaybe<Scalars['Boolean']['input']>; defaultShippingAddress?: InputMaybe<Scalars['Boolean']['input']>; fullName?: InputMaybe<Scalars['String']['input']>; id: Scalars['ID']['input']; phoneNumber?: InputMaybe<Scalars['String']['input']>; postalCode?: InputMaybe<Scalars['String']['input']>; province?: InputMaybe<Scalars['String']['input']>; streetLine1?: InputMaybe<Scalars['String']['input']>; streetLine2?: InputMaybe<Scalars['String']['input']>; }; export type UpdateCustomerEmailAddressResult = IdentifierChangeTokenExpiredError | IdentifierChangeTokenInvalidError | NativeAuthStrategyError | Success; export type UpdateCustomerInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; firstName?: InputMaybe<Scalars['String']['input']>; lastName?: InputMaybe<Scalars['String']['input']>; phoneNumber?: InputMaybe<Scalars['String']['input']>; title?: InputMaybe<Scalars['String']['input']>; }; export type UpdateCustomerPasswordResult = InvalidCredentialsError | NativeAuthStrategyError | PasswordValidationError | Success; export type UpdateOrderInput = { customFields?: InputMaybe<Scalars['JSON']['input']>; }; export type UpdateOrderItemsResult = InsufficientStockError | NegativeQuantityError | Order | OrderLimitError | OrderModificationError; export type User = Node & { authenticationMethods: Array<AuthenticationMethod>; createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; identifier: Scalars['String']['output']; lastLogin?: Maybe<Scalars['DateTime']['output']>; roles: Array<Role>; updatedAt: Scalars['DateTime']['output']; verified: Scalars['Boolean']['output']; }; /** * Returned if the verification token (used to verify a Customer's email address) is valid, but has * expired according to the `verificationTokenDuration` setting in the AuthOptions. */ export type VerificationTokenExpiredError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; /** * Returned if the verification token (used to verify a Customer's email address) is either * invalid or does not match any expected tokens. */ export type VerificationTokenInvalidError = ErrorResult & { errorCode: ErrorCode; message: Scalars['String']['output']; }; export type VerifyCustomerAccountResult = CurrentUser | MissingPasswordError | NativeAuthStrategyError | PasswordAlreadySetError | PasswordValidationError | VerificationTokenExpiredError | VerificationTokenInvalidError; export type Zone = Node & { createdAt: Scalars['DateTime']['output']; customFields?: Maybe<Scalars['JSON']['output']>; id: Scalars['ID']['output']; members: Array<Region>; name: Scalars['String']['output']; updatedAt: Scalars['DateTime']['output']; }; export type TestOrderFragmentFragment = { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } }; export type UpdatedOrderFragment = { id: string, code: string, state: string, active: boolean, total: number, totalWithTax: number, currencyCode: CurrencyCode, lines: Array<{ id: string, quantity: number, unitPrice: number, unitPriceWithTax: number, linePrice: number, linePriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }; export type AddItemToOrderMutationVariables = Exact<{ productVariantId: Scalars['ID']['input']; quantity: Scalars['Int']['input']; }>; export type AddItemToOrderMutation = { addItemToOrder: { errorCode: ErrorCode, message: string, quantityAvailable: number, order: { id: string, code: string, state: string, active: boolean, total: number, totalWithTax: number, currencyCode: CurrencyCode, lines: Array<{ id: string, quantity: number, unitPrice: number, unitPriceWithTax: number, linePrice: number, linePriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> } } | { errorCode: ErrorCode, message: string } | { id: string, code: string, state: string, active: boolean, total: number, totalWithTax: number, currencyCode: CurrencyCode, lines: Array<{ id: string, quantity: number, unitPrice: number, unitPriceWithTax: number, linePrice: number, linePriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } }; export type SearchProductsShopQueryVariables = Exact<{ input: SearchInput; }>; export type SearchProductsShopQuery = { search: { totalItems: number, items: Array<{ productId: string, productName: string, productVariantId: string, productVariantName: string, sku: string, collectionIds: Array<string>, price: { min: number, max: number } | { value: number } }> } }; export type RegisterMutationVariables = Exact<{ input: RegisterCustomerInput; }>; export type RegisterMutation = { registerCustomerAccount: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string, validationErrorMessage: string } | { success: boolean } }; export type CurrentUserShopFragment = { id: string, identifier: string, channels: Array<{ code: string, token: string, permissions: Array<Permission> }> }; export type VerifyMutationVariables = Exact<{ password?: InputMaybe<Scalars['String']['input']>; token: Scalars['String']['input']; }>; export type VerifyMutation = { verifyCustomerAccount: { id: string, identifier: string, channels: Array<{ code: string, token: string, permissions: Array<Permission> }> } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string, validationErrorMessage: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } }; export type RefreshTokenMutationVariables = Exact<{ emailAddress: Scalars['String']['input']; }>; export type RefreshTokenMutation = { refreshCustomerVerification: { errorCode: ErrorCode, message: string } | { success: boolean } }; export type RequestPasswordResetMutationVariables = Exact<{ identifier: Scalars['String']['input']; }>; export type RequestPasswordResetMutation = { requestPasswordReset?: { errorCode: ErrorCode, message: string } | { success: boolean } | null }; export type ResetPasswordMutationVariables = Exact<{ token: Scalars['String']['input']; password: Scalars['String']['input']; }>; export type ResetPasswordMutation = { resetPassword: { id: string, identifier: string, channels: Array<{ code: string, token: string, permissions: Array<Permission> }> } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string, validationErrorMessage: string } }; export type RequestUpdateEmailAddressMutationVariables = Exact<{ password: Scalars['String']['input']; newEmailAddress: Scalars['String']['input']; }>; export type RequestUpdateEmailAddressMutation = { requestUpdateCustomerEmailAddress: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { success: boolean } }; export type UpdateEmailAddressMutationVariables = Exact<{ token: Scalars['String']['input']; }>; export type UpdateEmailAddressMutation = { updateCustomerEmailAddress: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { success: boolean } }; export type GetActiveCustomerQueryVariables = Exact<{ [key: string]: never; }>; export type GetActiveCustomerQuery = { activeCustomer?: { id: string, emailAddress: string } | null }; export type CreateAddressShopMutationVariables = Exact<{ input: CreateAddressInput; }>; export type CreateAddressShopMutation = { createCustomerAddress: { id: string, streetLine1: string, country: { code: string } } }; export type UpdateAddressShopMutationVariables = Exact<{ input: UpdateAddressInput; }>; export type UpdateAddressShopMutation = { updateCustomerAddress: { streetLine1: string, country: { code: string } } }; export type DeleteAddressShopMutationVariables = Exact<{ id: Scalars['ID']['input']; }>; export type DeleteAddressShopMutation = { deleteCustomerAddress: { success: boolean } }; export type UpdateCustomerMutationVariables = Exact<{ input: UpdateCustomerInput; }>; export type UpdateCustomerMutation = { updateCustomer: { id: string, firstName: string, lastName: string } }; export type UpdatePasswordMutationVariables = Exact<{ old: Scalars['String']['input']; new: Scalars['String']['input']; }>; export type UpdatePasswordMutation = { updateCustomerPassword: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { success: boolean } }; export type GetActiveOrderQueryVariables = Exact<{ [key: string]: never; }>; export type GetActiveOrderQuery = { activeOrder?: { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } } | null }; export type GetActiveOrderWithPriceDataQueryVariables = Exact<{ [key: string]: never; }>; export type GetActiveOrderWithPriceDataQuery = { activeOrder?: { id: string, subTotal: number, subTotalWithTax: number, total: number, totalWithTax: number, lines: Array<{ id: string, unitPrice: number, unitPriceWithTax: number, taxRate: number, linePrice: number, lineTax: number, linePriceWithTax: number, taxLines: Array<{ taxRate: number, description: string }> }>, taxSummary: Array<{ description: string, taxRate: number, taxBase: number, taxTotal: number }> } | null }; export type AdjustItemQuantityMutationVariables = Exact<{ orderLineId: Scalars['ID']['input']; quantity: Scalars['Int']['input']; }>; export type AdjustItemQuantityMutation = { adjustOrderLine: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } }; export type RemoveItemFromOrderMutationVariables = Exact<{ orderLineId: Scalars['ID']['input']; }>; export type RemoveItemFromOrderMutation = { removeOrderLine: { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } } | { errorCode: ErrorCode, message: string } }; export type GetShippingMethodsQueryVariables = Exact<{ [key: string]: never; }>; export type GetShippingMethodsQuery = { eligibleShippingMethods: Array<{ id: string, code: string, price: number, name: string, description: string }> }; export type SetShippingMethodMutationVariables = Exact<{ id: Array<Scalars['ID']['input']> | Scalars['ID']['input']; }>; export type SetShippingMethodMutation = { setOrderShippingMethod: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } } | { errorCode: ErrorCode, message: string } }; export type ActiveOrderCustomerFragment = { id: string, customer?: { id: string, emailAddress: string, firstName: string, lastName: string } | null, lines: Array<{ id: string }> }; export type SetCustomerForOrderMutationVariables = Exact<{ input: CreateCustomerInput; }>; export type SetCustomerForOrderMutation = { setCustomerForOrder: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string, errorDetail: string } | { errorCode: ErrorCode, message: string } | { id: string, customer?: { id: string, emailAddress: string, firstName: string, lastName: string } | null, lines: Array<{ id: string }> } }; export type GetOrderByCodeQueryVariables = Exact<{ code: Scalars['String']['input']; }>; export type GetOrderByCodeQuery = { orderByCode?: { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } } | null }; export type GetOrderShopQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetOrderShopQuery = { order?: { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } } | null }; export type GetOrderPromotionsByCodeQueryVariables = Exact<{ code: Scalars['String']['input']; }>; export type GetOrderPromotionsByCodeQuery = { orderByCode?: { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, promotions: Array<{ id: string, name: string }>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } } | null }; export type GetAvailableCountriesQueryVariables = Exact<{ [key: string]: never; }>; export type GetAvailableCountriesQuery = { availableCountries: Array<{ id: string, code: string }> }; export type TransitionToStateMutationVariables = Exact<{ state: Scalars['String']['input']; }>; export type TransitionToStateMutation = { transitionOrderToState?: { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } } | { errorCode: ErrorCode, message: string, transitionError: string, fromState: string, toState: string } | null }; export type SetShippingAddressMutationVariables = Exact<{ input: CreateAddressInput; }>; export type SetShippingAddressMutation = { setOrderShippingAddress: { errorCode: ErrorCode, message: string } | { shippingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null } }; export type SetBillingAddressMutationVariables = Exact<{ input: CreateAddressInput; }>; export type SetBillingAddressMutation = { setOrderBillingAddress: { errorCode: ErrorCode, message: string } | { billingAddress?: { fullName?: string | null, company?: string | null, streetLine1?: string | null, streetLine2?: string | null, city?: string | null, province?: string | null, postalCode?: string | null, country?: string | null, phoneNumber?: string | null } | null } }; export type TestOrderWithPaymentsFragment = { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, payments?: Array<{ id: string, transactionId?: string | null, method: string, amount: number, state: string, metadata?: any | null }> | null, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } }; export type GetActiveOrderWithPaymentsQueryVariables = Exact<{ [key: string]: never; }>; export type GetActiveOrderWithPaymentsQuery = { activeOrder?: { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, payments?: Array<{ id: string, transactionId?: string | null, method: string, amount: number, state: string, metadata?: any | null }> | null, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } } | null }; export type AddPaymentToOrderMutationVariables = Exact<{ input: PaymentInput; }>; export type AddPaymentToOrderMutation = { addPaymentToOrder: { errorCode: ErrorCode, message: string, eligibilityCheckerMessage?: string | null } | { errorCode: ErrorCode, message: string } | { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, payments?: Array<{ id: string, transactionId?: string | null, method: string, amount: number, state: string, metadata?: any | null }> | null, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string, transitionError: string } | { errorCode: ErrorCode, message: string, paymentErrorMessage: string } | { errorCode: ErrorCode, message: string, paymentErrorMessage: string } }; export type GetActiveOrderPaymentsQueryVariables = Exact<{ [key: string]: never; }>; export type GetActiveOrderPaymentsQuery = { activeOrder?: { id: string, payments?: Array<{ id: string, transactionId?: string | null, method: string, amount: number, state: string, errorMessage?: string | null, metadata?: any | null }> | null } | null }; export type GetOrderByCodeWithPaymentsQueryVariables = Exact<{ code: Scalars['String']['input']; }>; export type GetOrderByCodeWithPaymentsQuery = { orderByCode?: { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, payments?: Array<{ id: string, transactionId?: string | null, method: string, amount: number, state: string, metadata?: any | null }> | null, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } } | null }; export type GetActiveCustomerOrderWithItemFulfillmentsQueryVariables = Exact<{ [key: string]: never; }>; export type GetActiveCustomerOrderWithItemFulfillmentsQuery = { activeCustomer?: { orders: { totalItems: number, items: Array<{ id: string, code: string, state: string, lines: Array<{ id: string }>, fulfillments?: Array<{ id: string, state: string, method: string, trackingCode?: string | null }> | null }> } } | null }; export type GetNextOrderStatesQueryVariables = Exact<{ [key: string]: never; }>; export type GetNextOrderStatesQuery = { nextOrderStates: Array<string> }; export type GetCustomerAddressesQueryVariables = Exact<{ [key: string]: never; }>; export type GetCustomerAddressesQuery = { activeOrder?: { customer?: { addresses?: Array<{ id: string, streetLine1: string }> | null } | null } | null }; export type GetCustomerOrdersQueryVariables = Exact<{ [key: string]: never; }>; export type GetCustomerOrdersQuery = { activeOrder?: { customer?: { orders: { items: Array<{ id: string }> } } | null } | null }; export type GetActiveCustomerOrdersQueryVariables = Exact<{ [key: string]: never; }>; export type GetActiveCustomerOrdersQuery = { activeCustomer?: { id: string, orders: { totalItems: number, items: Array<{ id: string, state: string }> } } | null }; export type ApplyCouponCodeMutationVariables = Exact<{ couponCode: Scalars['String']['input']; }>; export type ApplyCouponCodeMutation = { applyCouponCode: { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { errorCode: ErrorCode, message: string } | { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } } }; export type RemoveCouponCodeMutationVariables = Exact<{ couponCode: Scalars['String']['input']; }>; export type RemoveCouponCodeMutation = { removeCouponCode?: { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } } | null }; export type RemoveAllOrderLinesMutationVariables = Exact<{ [key: string]: never; }>; export type RemoveAllOrderLinesMutation = { removeAllOrderLines: { id: string, code: string, state: string, active: boolean, subTotal: number, subTotalWithTax: number, shipping: number, shippingWithTax: number, total: number, totalWithTax: number, currencyCode: CurrencyCode, couponCodes: Array<string>, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }>, lines: Array<{ id: string, quantity: number, linePrice: number, linePriceWithTax: number, unitPrice: number, unitPriceWithTax: number, unitPriceChangeSinceAdded: number, unitPriceWithTaxChangeSinceAdded: number, discountedUnitPriceWithTax: number, proratedUnitPriceWithTax: number, productVariant: { id: string }, discounts: Array<{ adjustmentSource: string, amount: number, amountWithTax: number, description: string, type: AdjustmentType }> }>, shippingLines: Array<{ priceWithTax: number, shippingMethod: { id: string, code: string, description: string } }>, customer?: { id: string, user?: { id: string, identifier: string } | null } | null, history: { items: Array<{ id: string, type: HistoryEntryType, data: any }> } } | { errorCode: ErrorCode, message: string } }; export type GetEligiblePaymentMethodsQueryVariables = Exact<{ [key: string]: never; }>; export type GetEligiblePaymentMethodsQuery = { eligiblePaymentMethods: Array<{ id: string, code: string, eligibilityMessage?: string | null, isEligible: boolean }> }; export type GetProductStockLevelQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; export type GetProductStockLevelQuery = { product?: { id: string, variants: Array<{ id: string, stockLevel: string }> } | null }; export type GetActiveCustomerWithOrdersProductSlugQueryVariables = Exact<{ options?: InputMaybe<OrderListOptions>; }>; export type GetActiveCustomerWithOrdersProductSlugQuery = { activeCustomer?: { orders: { items: Array<{ lines: Array<{ productVariant: { product: { slug: string } } }> }> } } | null }; export type GetActiveCustomerWithOrdersProductPriceQueryVariables = Exact<{ options?: InputMaybe<OrderListOptions>; }>; export type GetActiveCustomerWithOrdersProductPriceQuery = { activeCustomer?: { orders: { items: Array<{ lines: Array<{ linePrice: number, productVariant: { id: string, name: string, price: number } }> }> } } | null }; export const UpdatedOrderFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UpdatedOrder"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}}]} as unknown as DocumentNode<UpdatedOrderFragment, unknown>; export const CurrentUserShopFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentUserShop"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CurrentUser"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}}]}}]}}]} as unknown as DocumentNode<CurrentUserShopFragment, unknown>; export const ActiveOrderCustomerFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ActiveOrderCustomer"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<ActiveOrderCustomerFragment, unknown>; export const TestOrderFragmentFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]} as unknown as DocumentNode<TestOrderFragmentFragment, unknown>; export const TestOrderWithPaymentsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderWithPayments"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]} as unknown as DocumentNode<TestOrderWithPaymentsFragment, unknown>; export const AddItemToOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AddItemToOrder"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"productVariantId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quantity"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addItemToOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"productVariantId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"productVariantId"}}},{"kind":"Argument","name":{"kind":"Name","value":"quantity"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quantity"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"UpdatedOrder"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"InsufficientStockError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"quantityAvailable"}},{"kind":"Field","name":{"kind":"Name","value":"order"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"UpdatedOrder"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"UpdatedOrder"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}}]} as unknown as DocumentNode<AddItemToOrderMutation, AddItemToOrderMutationVariables>; export const SearchProductsShopDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"SearchProductsShop"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SearchInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"search"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalItems"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productId"}},{"kind":"Field","name":{"kind":"Name","value":"productName"}},{"kind":"Field","name":{"kind":"Name","value":"productVariantId"}},{"kind":"Field","name":{"kind":"Name","value":"productVariantName"}},{"kind":"Field","name":{"kind":"Name","value":"sku"}},{"kind":"Field","name":{"kind":"Name","value":"collectionIds"}},{"kind":"Field","name":{"kind":"Name","value":"price"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"SinglePrice"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PriceRange"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"min"}},{"kind":"Field","name":{"kind":"Name","value":"max"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<SearchProductsShopQuery, SearchProductsShopQueryVariables>; export const RegisterDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"Register"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"RegisterCustomerInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"registerCustomerAccount"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Success"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"success"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PasswordValidationError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"validationErrorMessage"}}]}}]}}]}}]} as unknown as DocumentNode<RegisterMutation, RegisterMutationVariables>; export const VerifyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"Verify"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"password"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"token"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"verifyCustomerAccount"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"password"},"value":{"kind":"Variable","name":{"kind":"Name","value":"password"}}},{"kind":"Argument","name":{"kind":"Name","value":"token"},"value":{"kind":"Variable","name":{"kind":"Name","value":"token"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentUserShop"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PasswordValidationError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"validationErrorMessage"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentUserShop"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CurrentUser"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}}]}}]}}]} as unknown as DocumentNode<VerifyMutation, VerifyMutationVariables>; export const RefreshTokenDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RefreshToken"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"emailAddress"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"refreshCustomerVerification"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"emailAddress"},"value":{"kind":"Variable","name":{"kind":"Name","value":"emailAddress"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Success"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"success"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}}]} as unknown as DocumentNode<RefreshTokenMutation, RefreshTokenMutationVariables>; export const RequestPasswordResetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RequestPasswordReset"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"identifier"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"requestPasswordReset"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"emailAddress"},"value":{"kind":"Variable","name":{"kind":"Name","value":"identifier"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Success"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"success"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}}]} as unknown as DocumentNode<RequestPasswordResetMutation, RequestPasswordResetMutationVariables>; export const ResetPasswordDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ResetPassword"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"token"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"password"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"resetPassword"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"token"},"value":{"kind":"Variable","name":{"kind":"Name","value":"token"}}},{"kind":"Argument","name":{"kind":"Name","value":"password"},"value":{"kind":"Variable","name":{"kind":"Name","value":"password"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"CurrentUserShop"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PasswordValidationError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"validationErrorMessage"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"CurrentUserShop"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"CurrentUser"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}},{"kind":"Field","name":{"kind":"Name","value":"channels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"permissions"}}]}}]}}]} as unknown as DocumentNode<ResetPasswordMutation, ResetPasswordMutationVariables>; export const RequestUpdateEmailAddressDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RequestUpdateEmailAddress"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"password"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"newEmailAddress"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"requestUpdateCustomerEmailAddress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"password"},"value":{"kind":"Variable","name":{"kind":"Name","value":"password"}}},{"kind":"Argument","name":{"kind":"Name","value":"newEmailAddress"},"value":{"kind":"Variable","name":{"kind":"Name","value":"newEmailAddress"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Success"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"success"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}}]} as unknown as DocumentNode<RequestUpdateEmailAddressMutation, RequestUpdateEmailAddressMutationVariables>; export const UpdateEmailAddressDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateEmailAddress"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"token"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateCustomerEmailAddress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"token"},"value":{"kind":"Variable","name":{"kind":"Name","value":"token"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Success"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"success"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}}]} as unknown as DocumentNode<UpdateEmailAddressMutation, UpdateEmailAddressMutationVariables>; export const GetActiveCustomerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetActiveCustomer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeCustomer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}}]}}]}}]} as unknown as DocumentNode<GetActiveCustomerQuery, GetActiveCustomerQueryVariables>; export const CreateAddressShopDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateAddressShop"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateAddressInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createCustomerAddress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"country"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]}}]} as unknown as DocumentNode<CreateAddressShopMutation, CreateAddressShopMutationVariables>; export const UpdateAddressShopDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateAddressShop"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateAddressInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateCustomerAddress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"country"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]}}]} as unknown as DocumentNode<UpdateAddressShopMutation, UpdateAddressShopMutationVariables>; export const DeleteAddressShopDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteAddressShop"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteCustomerAddress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"success"}}]}}]}}]} as unknown as DocumentNode<DeleteAddressShopMutation, DeleteAddressShopMutationVariables>; export const UpdateCustomerDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateCustomer"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"UpdateCustomerInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateCustomer"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}}]}}]} as unknown as DocumentNode<UpdateCustomerMutation, UpdateCustomerMutationVariables>; export const UpdatePasswordDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdatePassword"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"old"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"new"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateCustomerPassword"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"currentPassword"},"value":{"kind":"Variable","name":{"kind":"Name","value":"old"}}},{"kind":"Argument","name":{"kind":"Name","value":"newPassword"},"value":{"kind":"Variable","name":{"kind":"Name","value":"new"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Success"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"success"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}}]} as unknown as DocumentNode<UpdatePasswordMutation, UpdatePasswordMutationVariables>; export const GetActiveOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetActiveOrder"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeOrder"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]} as unknown as DocumentNode<GetActiveOrderQuery, GetActiveOrderQueryVariables>; export const GetActiveOrderWithPriceDataDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetActiveOrderWithPriceData"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeOrder"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"lineTax"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"taxLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"taxSummary"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"taxRate"}},{"kind":"Field","name":{"kind":"Name","value":"taxBase"}},{"kind":"Field","name":{"kind":"Name","value":"taxTotal"}}]}}]}}]}}]} as unknown as DocumentNode<GetActiveOrderWithPriceDataQuery, GetActiveOrderWithPriceDataQueryVariables>; export const AdjustItemQuantityDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AdjustItemQuantity"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderLineId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"quantity"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustOrderLine"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"orderLineId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderLineId"}}},{"kind":"Argument","name":{"kind":"Name","value":"quantity"},"value":{"kind":"Variable","name":{"kind":"Name","value":"quantity"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]} as unknown as DocumentNode<AdjustItemQuantityMutation, AdjustItemQuantityMutationVariables>; export const RemoveItemFromOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveItemFromOrder"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderLineId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeOrderLine"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"orderLineId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderLineId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]} as unknown as DocumentNode<RemoveItemFromOrderMutation, RemoveItemFromOrderMutationVariables>; export const GetShippingMethodsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetShippingMethods"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"eligibleShippingMethods"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"price"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]} as unknown as DocumentNode<GetShippingMethodsQuery, GetShippingMethodsQueryVariables>; export const SetShippingMethodDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetShippingMethod"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setOrderShippingMethod"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"shippingMethodId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]} as unknown as DocumentNode<SetShippingMethodMutation, SetShippingMethodMutationVariables>; export const SetCustomerForOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetCustomerForOrder"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateCustomerInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setCustomerForOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ActiveOrderCustomer"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GuestCheckoutError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorDetail"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ActiveOrderCustomer"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"emailAddress"}},{"kind":"Field","name":{"kind":"Name","value":"firstName"}},{"kind":"Field","name":{"kind":"Name","value":"lastName"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<SetCustomerForOrderMutation, SetCustomerForOrderMutationVariables>; export const GetOrderByCodeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderByCode"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"code"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderByCode"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"code"},"value":{"kind":"Variable","name":{"kind":"Name","value":"code"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderByCodeQuery, GetOrderByCodeQueryVariables>; export const GetOrderShopDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderShop"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"order"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderShopQuery, GetOrderShopQueryVariables>; export const GetOrderPromotionsByCodeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderPromotionsByCode"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"code"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderByCode"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"code"},"value":{"kind":"Variable","name":{"kind":"Name","value":"code"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}},{"kind":"Field","name":{"kind":"Name","value":"promotions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]} as unknown as DocumentNode<GetOrderPromotionsByCodeQuery, GetOrderPromotionsByCodeQueryVariables>; export const GetAvailableCountriesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetAvailableCountries"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"availableCountries"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}}]}}]}}]} as unknown as DocumentNode<GetAvailableCountriesQuery, GetAvailableCountriesQueryVariables>; export const TransitionToStateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"TransitionToState"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"state"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transitionOrderToState"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"state"},"value":{"kind":"Variable","name":{"kind":"Name","value":"state"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderStateTransitionError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}},{"kind":"Field","name":{"kind":"Name","value":"transitionError"}},{"kind":"Field","name":{"kind":"Name","value":"fromState"}},{"kind":"Field","name":{"kind":"Name","value":"toState"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]} as unknown as DocumentNode<TransitionToStateMutation, TransitionToStateMutationVariables>; export const SetShippingAddressDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetShippingAddress"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateAddressInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setOrderShippingAddress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"shippingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}}]} as unknown as DocumentNode<SetShippingAddressMutation, SetShippingAddressMutationVariables>; export const SetBillingAddressDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetBillingAddress"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"CreateAddressInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setOrderBillingAddress"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"billingAddress"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"fullName"}},{"kind":"Field","name":{"kind":"Name","value":"company"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine2"}},{"kind":"Field","name":{"kind":"Name","value":"city"}},{"kind":"Field","name":{"kind":"Name","value":"province"}},{"kind":"Field","name":{"kind":"Name","value":"postalCode"}},{"kind":"Field","name":{"kind":"Name","value":"country"}},{"kind":"Field","name":{"kind":"Name","value":"phoneNumber"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}}]} as unknown as DocumentNode<SetBillingAddressMutation, SetBillingAddressMutationVariables>; export const GetActiveOrderWithPaymentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetActiveOrderWithPayments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeOrder"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderWithPayments"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderWithPayments"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}}]}}]}}]} as unknown as DocumentNode<GetActiveOrderWithPaymentsQuery, GetActiveOrderWithPaymentsQueryVariables>; export const AddPaymentToOrderDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AddPaymentToOrder"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"PaymentInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addPaymentToOrder"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderWithPayments"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PaymentDeclinedError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"paymentErrorMessage"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"PaymentFailedError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"paymentErrorMessage"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"OrderStateTransitionError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transitionError"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"IneligiblePaymentMethodError"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"eligibilityCheckerMessage"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderWithPayments"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}}]}}]}}]} as unknown as DocumentNode<AddPaymentToOrderMutation, AddPaymentToOrderMutationVariables>; export const GetActiveOrderPaymentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetActiveOrderPayments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeOrder"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"errorMessage"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}}]}}]}}]}}]} as unknown as DocumentNode<GetActiveOrderPaymentsQuery, GetActiveOrderPaymentsQueryVariables>; export const GetOrderByCodeWithPaymentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetOrderByCodeWithPayments"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"code"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orderByCode"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"code"},"value":{"kind":"Variable","name":{"kind":"Name","value":"code"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderWithPayments"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderWithPayments"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}},{"kind":"Field","name":{"kind":"Name","value":"payments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"transactionId"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"}}]}}]}}]} as unknown as DocumentNode<GetOrderByCodeWithPaymentsQuery, GetOrderByCodeWithPaymentsQueryVariables>; export const GetActiveCustomerOrderWithItemFulfillmentsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetActiveCustomerOrderWithItemFulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeCustomer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orders"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"skip"},"value":{"kind":"IntValue","value":"0"}},{"kind":"ObjectField","name":{"kind":"Name","value":"take"},"value":{"kind":"IntValue","value":"5"}},{"kind":"ObjectField","name":{"kind":"Name","value":"sort"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"createdAt"},"value":{"kind":"EnumValue","value":"DESC"}}]}},{"kind":"ObjectField","name":{"kind":"Name","value":"filter"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"active"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"eq"},"value":{"kind":"BooleanValue","value":false}}]}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalItems"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"fulfillments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"method"}},{"kind":"Field","name":{"kind":"Name","value":"trackingCode"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetActiveCustomerOrderWithItemFulfillmentsQuery, GetActiveCustomerOrderWithItemFulfillmentsQueryVariables>; export const GetNextOrderStatesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetNextOrderStates"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"nextOrderStates"}}]}}]} as unknown as DocumentNode<GetNextOrderStatesQuery, GetNextOrderStatesQueryVariables>; export const GetCustomerAddressesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomerAddresses"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeOrder"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"addresses"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"streetLine1"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetCustomerAddressesQuery, GetCustomerAddressesQueryVariables>; export const GetCustomerOrdersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetCustomerOrders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeOrder"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetCustomerOrdersQuery, GetCustomerOrdersQueryVariables>; export const GetActiveCustomerOrdersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetActiveCustomerOrders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeCustomer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"orders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalItems"}},{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"state"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetActiveCustomerOrdersQuery, GetActiveCustomerOrdersQueryVariables>; export const ApplyCouponCodeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"ApplyCouponCode"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"couponCode"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"applyCouponCode"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"couponCode"},"value":{"kind":"Variable","name":{"kind":"Name","value":"couponCode"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]} as unknown as DocumentNode<ApplyCouponCodeMutation, ApplyCouponCodeMutationVariables>; export const RemoveCouponCodeDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveCouponCode"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"couponCode"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeCouponCode"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"couponCode"},"value":{"kind":"Variable","name":{"kind":"Name","value":"couponCode"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]} as unknown as DocumentNode<RemoveCouponCodeMutation, RemoveCouponCodeMutationVariables>; export const RemoveAllOrderLinesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"RemoveAllOrderLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"removeAllOrderLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"TestOrderFragment"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ErrorResult"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errorCode"}},{"kind":"Field","name":{"kind":"Name","value":"message"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"TestOrderFragment"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"Order"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"active"}},{"kind":"Field","name":{"kind":"Name","value":"subTotal"}},{"kind":"Field","name":{"kind":"Name","value":"subTotalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shipping"}},{"kind":"Field","name":{"kind":"Name","value":"shippingWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"total"}},{"kind":"Field","name":{"kind":"Name","value":"totalWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"currencyCode"}},{"kind":"Field","name":{"kind":"Name","value":"couponCodes"}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"quantity"}},{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"linePriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPrice"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"unitPriceWithTaxChangeSinceAdded"}},{"kind":"Field","name":{"kind":"Name","value":"discountedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"proratedUnitPriceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}},{"kind":"Field","name":{"kind":"Name","value":"discounts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"adjustmentSource"}},{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"amountWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"shippingLines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"priceWithTax"}},{"kind":"Field","name":{"kind":"Name","value":"shippingMethod"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"customer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"identifier"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"history"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"data"}}]}}]}}]}}]} as unknown as DocumentNode<RemoveAllOrderLinesMutation, RemoveAllOrderLinesMutationVariables>; export const GetEligiblePaymentMethodsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetEligiblePaymentMethods"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"eligiblePaymentMethods"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"code"}},{"kind":"Field","name":{"kind":"Name","value":"eligibilityMessage"}},{"kind":"Field","name":{"kind":"Name","value":"isEligible"}}]}}]}}]} as unknown as DocumentNode<GetEligiblePaymentMethodsQuery, GetEligiblePaymentMethodsQueryVariables>; export const GetProductStockLevelDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetProductStockLevel"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"variants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"stockLevel"}}]}}]}}]}}]} as unknown as DocumentNode<GetProductStockLevelQuery, GetProductStockLevelQueryVariables>; export const GetActiveCustomerWithOrdersProductSlugDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetActiveCustomerWithOrdersProductSlug"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"OrderListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeCustomer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orders"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"product"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetActiveCustomerWithOrdersProductSlugQuery, GetActiveCustomerWithOrdersProductSlugQueryVariables>; export const GetActiveCustomerWithOrdersProductPriceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetActiveCustomerWithOrdersProductPrice"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"options"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"OrderListOptions"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"activeCustomer"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"orders"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"options"},"value":{"kind":"Variable","name":{"kind":"Name","value":"options"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"items"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lines"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"linePrice"}},{"kind":"Field","name":{"kind":"Name","value":"productVariant"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"price"}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetActiveCustomerWithOrdersProductPriceQuery, GetActiveCustomerWithOrdersProductPriceQueryVariables>;
import gql from 'graphql-tag'; import { ADMINISTRATOR_FRAGMENT, ASSET_FRAGMENT, CHANNEL_FRAGMENT, COLLECTION_FRAGMENT, COUNTRY_FRAGMENT, CURRENT_USER_FRAGMENT, CUSTOMER_FRAGMENT, CUSTOMER_GROUP_FRAGMENT, FACET_WITH_VALUES_FRAGMENT, FULFILLMENT_FRAGMENT, GLOBAL_SETTINGS_FRAGMENT, ORDER_FRAGMENT, ORDER_WITH_LINES_FRAGMENT, PAYMENT_FRAGMENT, PRODUCT_OPTION_GROUP_FRAGMENT, PRODUCT_VARIANT_FRAGMENT, PRODUCT_WITH_OPTIONS_FRAGMENT, PRODUCT_WITH_VARIANTS_FRAGMENT, PROMOTION_FRAGMENT, ROLE_FRAGMENT, SHIPPING_METHOD_FRAGMENT, TAX_RATE_FRAGMENT, VARIANT_WITH_STOCK_FRAGMENT, } from './fragments'; export const CREATE_ADMINISTRATOR = gql` mutation CreateAdministrator($input: CreateAdministratorInput!) { createAdministrator(input: $input) { ...Administrator } } ${ADMINISTRATOR_FRAGMENT} `; export const UPDATE_PRODUCT = gql` mutation UpdateProduct($input: UpdateProductInput!) { updateProduct(input: $input) { ...ProductWithVariants } } ${PRODUCT_WITH_VARIANTS_FRAGMENT} `; export const CREATE_PRODUCT = gql` mutation CreateProduct($input: CreateProductInput!) { createProduct(input: $input) { ...ProductWithVariants } } ${PRODUCT_WITH_VARIANTS_FRAGMENT} `; export const GET_PRODUCT_WITH_VARIANTS = gql` query GetProductWithVariants($id: ID, $slug: String) { product(slug: $slug, id: $id) { ...ProductWithVariants } } ${PRODUCT_WITH_VARIANTS_FRAGMENT} `; export const GET_PRODUCT_LIST = gql` query GetProductList($options: ProductListOptions) { products(options: $options) { items { id languageCode name slug featuredAsset { id preview } } totalItems } } `; export const CREATE_PRODUCT_VARIANTS = gql` mutation CreateProductVariants($input: [CreateProductVariantInput!]!) { createProductVariants(input: $input) { ...ProductVariant } } ${PRODUCT_VARIANT_FRAGMENT} `; export const UPDATE_PRODUCT_VARIANTS = gql` mutation UpdateProductVariants($input: [UpdateProductVariantInput!]!) { updateProductVariants(input: $input) { ...ProductVariant } } ${PRODUCT_VARIANT_FRAGMENT} `; export const UPDATE_TAX_RATE = gql` mutation UpdateTaxRate($input: UpdateTaxRateInput!) { updateTaxRate(input: $input) { ...TaxRate } } ${TAX_RATE_FRAGMENT} `; export const CREATE_FACET = gql` mutation CreateFacet($input: CreateFacetInput!) { createFacet(input: $input) { ...FacetWithValues } } ${FACET_WITH_VALUES_FRAGMENT} `; export const UPDATE_FACET = gql` mutation UpdateFacet($input: UpdateFacetInput!) { updateFacet(input: $input) { ...FacetWithValues } } ${FACET_WITH_VALUES_FRAGMENT} `; export const GET_CUSTOMER_LIST = gql` query GetCustomerList($options: CustomerListOptions) { customers(options: $options) { items { id title firstName lastName emailAddress phoneNumber user { id identifier verified } } totalItems } } `; export const GET_ASSET_LIST = gql` query GetAssetList($options: AssetListOptions) { assets(options: $options) { items { ...Asset } totalItems } } ${ASSET_FRAGMENT} `; export const CREATE_ROLE = gql` mutation CreateRole($input: CreateRoleInput!) { createRole(input: $input) { ...Role } } ${ROLE_FRAGMENT} `; export const CREATE_COLLECTION = gql` mutation CreateCollection($input: CreateCollectionInput!) { createCollection(input: $input) { ...Collection } } ${COLLECTION_FRAGMENT} `; export const UPDATE_COLLECTION = gql` mutation UpdateCollection($input: UpdateCollectionInput!) { updateCollection(input: $input) { ...Collection } } ${COLLECTION_FRAGMENT} `; export const GET_CUSTOMER = gql` query GetCustomer($id: ID!, $orderListOptions: OrderListOptions) { customer(id: $id) { ...Customer orders(options: $orderListOptions) { items { id code state total currencyCode updatedAt } totalItems } } } ${CUSTOMER_FRAGMENT} `; export const ATTEMPT_LOGIN = gql` mutation AttemptLogin($username: String!, $password: String!, $rememberMe: Boolean) { login(username: $username, password: $password, rememberMe: $rememberMe) { ...CurrentUser ... on ErrorResult { errorCode message } } } ${CURRENT_USER_FRAGMENT} `; export const GET_COUNTRY_LIST = gql` query GetCountryList($options: CountryListOptions) { countries(options: $options) { items { id code name enabled } totalItems } } `; export const UPDATE_COUNTRY = gql` mutation UpdateCountry($input: UpdateCountryInput!) { updateCountry(input: $input) { ...Country } } ${COUNTRY_FRAGMENT} `; export const GET_FACET_LIST = gql` query GetFacetList($options: FacetListOptions) { facets(options: $options) { items { ...FacetWithValues } totalItems } } ${FACET_WITH_VALUES_FRAGMENT} `; export const GET_FACET_LIST_SIMPLE = gql` query GetFacetListSimple($options: FacetListOptions) { facets(options: $options) { items { id name } totalItems } } `; export const DELETE_PRODUCT = gql` mutation DeleteProduct($id: ID!) { deleteProduct(id: $id) { result } } `; export const GET_PRODUCT_SIMPLE = gql` query GetProductSimple($id: ID, $slug: String) { product(slug: $slug, id: $id) { id slug } } `; export const GET_STOCK_MOVEMENT = gql` query GetStockMovement($id: ID!) { product(id: $id) { id variants { ...VariantWithStock } } } ${VARIANT_WITH_STOCK_FRAGMENT} `; export const GET_RUNNING_JOBS = gql` query GetRunningJobs($options: JobListOptions) { jobs(options: $options) { items { id queueName state isSettled duration } totalItems } } `; export const CREATE_PROMOTION = gql` mutation CreatePromotion($input: CreatePromotionInput!) { createPromotion(input: $input) { ...Promotion ... on ErrorResult { errorCode message } } } ${PROMOTION_FRAGMENT} `; export const ME = gql` query Me { me { ...CurrentUser } } ${CURRENT_USER_FRAGMENT} `; export const CREATE_CHANNEL = gql` mutation CreateChannel($input: CreateChannelInput!) { createChannel(input: $input) { ...Channel ... on LanguageNotAvailableError { errorCode message languageCode } } } ${CHANNEL_FRAGMENT} `; export const DELETE_PRODUCT_VARIANT = gql` mutation DeleteProductVariant($id: ID!) { deleteProductVariant(id: $id) { result message } } `; export const ASSIGN_PRODUCT_TO_CHANNEL = gql` mutation AssignProductsToChannel($input: AssignProductsToChannelInput!) { assignProductsToChannel(input: $input) { ...ProductWithVariants } } ${PRODUCT_WITH_VARIANTS_FRAGMENT} `; export const REMOVE_PRODUCT_FROM_CHANNEL = gql` mutation RemoveProductsFromChannel($input: RemoveProductsFromChannelInput!) { removeProductsFromChannel(input: $input) { ...ProductWithVariants } } ${PRODUCT_WITH_VARIANTS_FRAGMENT} `; export const ASSIGN_PRODUCTVARIANT_TO_CHANNEL = gql` mutation AssignProductVariantsToChannel($input: AssignProductVariantsToChannelInput!) { assignProductVariantsToChannel(input: $input) { ...ProductVariant } } ${PRODUCT_VARIANT_FRAGMENT} `; export const REMOVE_PRODUCTVARIANT_FROM_CHANNEL = gql` mutation RemoveProductVariantsFromChannel($input: RemoveProductVariantsFromChannelInput!) { removeProductVariantsFromChannel(input: $input) { ...ProductVariant } } ${PRODUCT_VARIANT_FRAGMENT} `; export const UPDATE_ASSET = gql` mutation UpdateAsset($input: UpdateAssetInput!) { updateAsset(input: $input) { ...Asset ... on Asset { tags { id value } focalPoint { x y } } } } ${ASSET_FRAGMENT} `; export const DELETE_ASSET = gql` mutation DeleteAsset($input: DeleteAssetInput!) { deleteAsset(input: $input) { result message } } `; export const UPDATE_CHANNEL = gql` mutation UpdateChannel($input: UpdateChannelInput!) { updateChannel(input: $input) { ...Channel ... on LanguageNotAvailableError { errorCode message languageCode } } } ${CHANNEL_FRAGMENT} `; export const GET_CUSTOMER_HISTORY = gql` query GetCustomerHistory($id: ID!, $options: HistoryEntryListOptions) { customer(id: $id) { id history(options: $options) { totalItems items { id administrator { id } type data } } } } `; export const GET_ORDER = gql` query GetOrder($id: ID!) { order(id: $id) { ...OrderWithLines } } ${ORDER_WITH_LINES_FRAGMENT} `; export const CREATE_CUSTOMER_GROUP = gql` mutation CreateCustomerGroup($input: CreateCustomerGroupInput!) { createCustomerGroup(input: $input) { ...CustomerGroup } } ${CUSTOMER_GROUP_FRAGMENT} `; export const REMOVE_CUSTOMERS_FROM_GROUP = gql` mutation RemoveCustomersFromGroup($groupId: ID!, $customerIds: [ID!]!) { removeCustomersFromGroup(customerGroupId: $groupId, customerIds: $customerIds) { ...CustomerGroup } } ${CUSTOMER_GROUP_FRAGMENT} `; export const CREATE_FULFILLMENT = gql` mutation CreateFulfillment($input: FulfillOrderInput!) { addFulfillmentToOrder(input: $input) { ...Fulfillment ... on ErrorResult { errorCode message } ... on CreateFulfillmentError { fulfillmentHandlerError } } } ${FULFILLMENT_FRAGMENT} `; export const TRANSIT_FULFILLMENT = gql` mutation TransitFulfillment($id: ID!, $state: String!) { transitionFulfillmentToState(id: $id, state: $state) { ...Fulfillment ... on FulfillmentStateTransitionError { errorCode message transitionError fromState toState } } } ${FULFILLMENT_FRAGMENT} `; export const GET_ORDER_FULFILLMENTS = gql` query GetOrderFulfillments($id: ID!) { order(id: $id) { id state fulfillments { id state nextStates method summary { orderLine { id } quantity } } } } `; export const GET_ORDERS_LIST = gql` query GetOrderList($options: OrderListOptions) { orders(options: $options) { items { ...Order } totalItems } } ${ORDER_FRAGMENT} `; export const CREATE_ADDRESS = gql` mutation CreateAddress($id: ID!, $input: CreateAddressInput!) { createCustomerAddress(customerId: $id, input: $input) { id fullName company streetLine1 streetLine2 city province postalCode country { code name } phoneNumber defaultShippingAddress defaultBillingAddress } } `; export const UPDATE_ADDRESS = gql` mutation UpdateAddress($input: UpdateAddressInput!) { updateCustomerAddress(input: $input) { id defaultShippingAddress defaultBillingAddress country { code name } } } `; export const CREATE_CUSTOMER = gql` mutation CreateCustomer($input: CreateCustomerInput!, $password: String) { createCustomer(input: $input, password: $password) { ...Customer ... on ErrorResult { errorCode message } } } ${CUSTOMER_FRAGMENT} `; export const UPDATE_CUSTOMER = gql` mutation UpdateCustomer($input: UpdateCustomerInput!) { updateCustomer(input: $input) { ...Customer ... on ErrorResult { errorCode message } } } ${CUSTOMER_FRAGMENT} `; export const DELETE_CUSTOMER = gql` mutation DeleteCustomer($id: ID!) { deleteCustomer(id: $id) { result } } `; export const UPDATE_CUSTOMER_NOTE = gql` mutation UpdateCustomerNote($input: UpdateCustomerNoteInput!) { updateCustomerNote(input: $input) { id data isPublic } } `; export const DELETE_CUSTOMER_NOTE = gql` mutation DeleteCustomerNote($id: ID!) { deleteCustomerNote(id: $id) { result message } } `; export const UPDATE_CUSTOMER_GROUP = gql` mutation UpdateCustomerGroup($input: UpdateCustomerGroupInput!) { updateCustomerGroup(input: $input) { ...CustomerGroup } } ${CUSTOMER_GROUP_FRAGMENT} `; export const DELETE_CUSTOMER_GROUP = gql` mutation DeleteCustomerGroup($id: ID!) { deleteCustomerGroup(id: $id) { result message } } `; export const GET_CUSTOMER_GROUPS = gql` query GetCustomerGroups($options: CustomerGroupListOptions) { customerGroups(options: $options) { items { id name } totalItems } } `; export const GET_CUSTOMER_GROUP = gql` query GetCustomerGroup($id: ID!, $options: CustomerListOptions) { customerGroup(id: $id) { id name customers(options: $options) { items { id } totalItems } } } `; export const ADD_CUSTOMERS_TO_GROUP = gql` mutation AddCustomersToGroup($groupId: ID!, $customerIds: [ID!]!) { addCustomersToGroup(customerGroupId: $groupId, customerIds: $customerIds) { ...CustomerGroup } } ${CUSTOMER_GROUP_FRAGMENT} `; export const GET_CUSTOMER_WITH_GROUPS = gql` query GetCustomerWithGroups($id: ID!) { customer(id: $id) { id groups { id name } } } `; export const ADMIN_TRANSITION_TO_STATE = gql` mutation AdminTransition($id: ID!, $state: String!) { transitionOrderToState(id: $id, state: $state) { ...Order ... on OrderStateTransitionError { errorCode message transitionError fromState toState } } } ${ORDER_FRAGMENT} `; export const CANCEL_ORDER = gql` mutation CancelOrder($input: CancelOrderInput!) { cancelOrder(input: $input) { ...CanceledOrder ... on ErrorResult { errorCode message } } } fragment CanceledOrder on Order { id state lines { id quantity } } `; export const UPDATE_GLOBAL_SETTINGS = gql` mutation UpdateGlobalSettings($input: UpdateGlobalSettingsInput!) { updateGlobalSettings(input: $input) { ...GlobalSettings ... on ErrorResult { errorCode message } } } ${GLOBAL_SETTINGS_FRAGMENT} `; export const UPDATE_ROLE = gql` mutation UpdateRole($input: UpdateRoleInput!) { updateRole(input: $input) { ...Role } } ${ROLE_FRAGMENT} `; export const GET_PRODUCTS_WITH_VARIANT_PRICES = gql` query GetProductsWithVariantPrices { products { items { id slug variants { id price priceWithTax currencyCode sku facetValues { id code } } } } } `; export const CREATE_PRODUCT_OPTION_GROUP = gql` mutation CreateProductOptionGroup($input: CreateProductOptionGroupInput!) { createProductOptionGroup(input: $input) { ...ProductOptionGroup } } ${PRODUCT_OPTION_GROUP_FRAGMENT} `; export const ADD_OPTION_GROUP_TO_PRODUCT = gql` mutation AddOptionGroupToProduct($productId: ID!, $optionGroupId: ID!) { addOptionGroupToProduct(productId: $productId, optionGroupId: $optionGroupId) { ...ProductWithOptions } } ${PRODUCT_WITH_OPTIONS_FRAGMENT} `; export const CREATE_SHIPPING_METHOD = gql` mutation CreateShippingMethod($input: CreateShippingMethodInput!) { createShippingMethod(input: $input) { ...ShippingMethod } } ${SHIPPING_METHOD_FRAGMENT} `; export const SETTLE_PAYMENT = gql` mutation SettlePayment($id: ID!) { settlePayment(id: $id) { ...Payment ... on ErrorResult { errorCode message } ... on SettlePaymentError { paymentErrorMessage } } } ${PAYMENT_FRAGMENT} `; export const GET_ORDER_HISTORY = gql` query GetOrderHistory($id: ID!, $options: HistoryEntryListOptions) { order(id: $id) { id history(options: $options) { totalItems items { id type administrator { id } data } } } } `; export const UPDATE_SHIPPING_METHOD = gql` mutation UpdateShippingMethod($input: UpdateShippingMethodInput!) { updateShippingMethod(input: $input) { ...ShippingMethod } } ${SHIPPING_METHOD_FRAGMENT} `; export const GET_ASSET = gql` query GetAsset($id: ID!) { asset(id: $id) { ...Asset width height } } ${ASSET_FRAGMENT} `; export const GET_ASSET_FRAGMENT_FIRST = gql` fragment AssetFragFirst on Asset { id preview } query GetAssetFragmentFirst($id: ID!) { asset(id: $id) { ...AssetFragFirst } } `; export const ASSET_WITH_TAGS_AND_FOCAL_POINT_FRAGMENT = gql` fragment AssetWithTagsAndFocalPoint on Asset { ...Asset focalPoint { x y } tags { id value } } ${ASSET_FRAGMENT} `; export const CREATE_ASSETS = gql` mutation CreateAssets($input: [CreateAssetInput!]!) { createAssets(input: $input) { ...AssetWithTagsAndFocalPoint ... on MimeTypeError { message fileName mimeType } } } ${ASSET_WITH_TAGS_AND_FOCAL_POINT_FRAGMENT} `; export const DELETE_SHIPPING_METHOD = gql` mutation DeleteShippingMethod($id: ID!) { deleteShippingMethod(id: $id) { result message } } `; export const ASSIGN_PROMOTIONS_TO_CHANNEL = gql` mutation AssignPromotionToChannel($input: AssignPromotionsToChannelInput!) { assignPromotionsToChannel(input: $input) { id name } } `; export const REMOVE_PROMOTIONS_FROM_CHANNEL = gql` mutation RemovePromotionFromChannel($input: RemovePromotionsFromChannelInput!) { removePromotionsFromChannel(input: $input) { id name } } `; export const GET_TAX_RATES_LIST = gql` query GetTaxRates($options: TaxRateListOptions) { taxRates(options: $options) { items { ...TaxRate } totalItems } } ${TAX_RATE_FRAGMENT} `; export const GET_SHIPPING_METHOD_LIST = gql` query GetShippingMethodList { shippingMethods { items { ...ShippingMethod } totalItems } } ${SHIPPING_METHOD_FRAGMENT} `; export const GET_COLLECTIONS = gql` query GetCollections { collections { items { id name position parent { id name } } } } `; export const TRANSITION_PAYMENT_TO_STATE = gql` mutation TransitionPaymentToState($id: ID!, $state: String!) { transitionPaymentToState(id: $id, state: $state) { ...Payment ... on ErrorResult { errorCode message } ... on PaymentStateTransitionError { transitionError } } } ${PAYMENT_FRAGMENT} `; export const GET_PRODUCT_VARIANT_LIST = gql` query GetProductVariantList($options: ProductVariantListOptions, $productId: ID) { productVariants(options: $options, productId: $productId) { items { id name sku price priceWithTax currencyCode prices { currencyCode price } } totalItems } } `; export const DELETE_PROMOTION = gql` mutation DeletePromotion($id: ID!) { deletePromotion(id: $id) { result } } `; export const GET_CHANNELS = gql` query GetChannels { channels { items { id code token } } } `; export const UPDATE_ADMINISTRATOR = gql` mutation UpdateAdministrator($input: UpdateAdministratorInput!) { updateAdministrator(input: $input) { ...Administrator } } ${ADMINISTRATOR_FRAGMENT} `; export const ASSIGN_COLLECTIONS_TO_CHANNEL = gql` mutation AssignCollectionsToChannel($input: AssignCollectionsToChannelInput!) { assignCollectionsToChannel(input: $input) { ...Collection } } ${COLLECTION_FRAGMENT} `; export const GET_COLLECTION = gql` query GetCollection($id: ID, $slug: String, $variantListOptions: ProductVariantListOptions) { collection(id: $id, slug: $slug) { ...Collection productVariants(options: $variantListOptions) { items { id name price } } } } ${COLLECTION_FRAGMENT} `; export const GET_FACET_WITH_VALUES = gql` query GetFacetWithValues($id: ID!) { facet(id: $id) { ...FacetWithValues } } ${FACET_WITH_VALUES_FRAGMENT} `; export const GET_PROMOTION = gql` query GetPromotion($id: ID!) { promotion(id: $id) { ...Promotion } } ${PROMOTION_FRAGMENT} `;
import gql from 'graphql-tag'; export const TEST_ORDER_FRAGMENT = gql` fragment TestOrderFragment on Order { id code state active subTotal subTotalWithTax shipping shippingWithTax total totalWithTax currencyCode couponCodes discounts { adjustmentSource amount amountWithTax description type } lines { id quantity linePrice linePriceWithTax unitPrice unitPriceWithTax unitPriceChangeSinceAdded unitPriceWithTaxChangeSinceAdded discountedUnitPriceWithTax proratedUnitPriceWithTax productVariant { id } discounts { adjustmentSource amount amountWithTax description type } } shippingLines { priceWithTax shippingMethod { id code description } } customer { id user { id identifier } } history { items { id type data } } } `; export const UPDATED_ORDER_FRAGMENT = gql` fragment UpdatedOrder on Order { id code state active total totalWithTax currencyCode lines { id quantity productVariant { id } unitPrice unitPriceWithTax linePrice linePriceWithTax discounts { adjustmentSource amount amountWithTax description type } } discounts { adjustmentSource amount amountWithTax description type } } `; export const ADD_ITEM_TO_ORDER = gql` mutation AddItemToOrder($productVariantId: ID!, $quantity: Int!) { addItemToOrder(productVariantId: $productVariantId, quantity: $quantity) { ...UpdatedOrder ... on ErrorResult { errorCode message } ... on InsufficientStockError { quantityAvailable order { ...UpdatedOrder } } } } ${UPDATED_ORDER_FRAGMENT} `; export const SEARCH_PRODUCTS_SHOP = gql` query SearchProductsShop($input: SearchInput!) { search(input: $input) { totalItems items { productId productName productVariantId productVariantName sku collectionIds price { ... on SinglePrice { value } ... on PriceRange { min max } } } } } `; export const REGISTER_ACCOUNT = gql` mutation Register($input: RegisterCustomerInput!) { registerCustomerAccount(input: $input) { ... on Success { success } ... on ErrorResult { errorCode message } ... on PasswordValidationError { validationErrorMessage } } } `; export const CURRENT_USER_FRAGMENT = gql` fragment CurrentUserShop on CurrentUser { id identifier channels { code token permissions } } `; export const VERIFY_EMAIL = gql` mutation Verify($password: String, $token: String!) { verifyCustomerAccount(password: $password, token: $token) { ...CurrentUserShop ... on ErrorResult { errorCode message } ... on PasswordValidationError { validationErrorMessage } } } ${CURRENT_USER_FRAGMENT} `; export const REFRESH_TOKEN = gql` mutation RefreshToken($emailAddress: String!) { refreshCustomerVerification(emailAddress: $emailAddress) { ... on Success { success } ... on ErrorResult { errorCode message } } } `; export const REQUEST_PASSWORD_RESET = gql` mutation RequestPasswordReset($identifier: String!) { requestPasswordReset(emailAddress: $identifier) { ... on Success { success } ... on ErrorResult { errorCode message } } } `; export const RESET_PASSWORD = gql` mutation ResetPassword($token: String!, $password: String!) { resetPassword(token: $token, password: $password) { ...CurrentUserShop ... on ErrorResult { errorCode message } ... on PasswordValidationError { validationErrorMessage } } } ${CURRENT_USER_FRAGMENT} `; export const REQUEST_UPDATE_EMAIL_ADDRESS = gql` mutation RequestUpdateEmailAddress($password: String!, $newEmailAddress: String!) { requestUpdateCustomerEmailAddress(password: $password, newEmailAddress: $newEmailAddress) { ... on Success { success } ... on ErrorResult { errorCode message } } } `; export const UPDATE_EMAIL_ADDRESS = gql` mutation UpdateEmailAddress($token: String!) { updateCustomerEmailAddress(token: $token) { ... on Success { success } ... on ErrorResult { errorCode message } } } `; export const GET_ACTIVE_CUSTOMER = gql` query GetActiveCustomer { activeCustomer { id emailAddress } } `; export const CREATE_ADDRESS = gql` mutation CreateAddressShop($input: CreateAddressInput!) { createCustomerAddress(input: $input) { id streetLine1 country { code } } } `; export const UPDATE_ADDRESS = gql` mutation UpdateAddressShop($input: UpdateAddressInput!) { updateCustomerAddress(input: $input) { streetLine1 country { code } } } `; export const DELETE_ADDRESS = gql` mutation DeleteAddressShop($id: ID!) { deleteCustomerAddress(id: $id) { success } } `; export const UPDATE_CUSTOMER = gql` mutation UpdateCustomer($input: UpdateCustomerInput!) { updateCustomer(input: $input) { id firstName lastName } } `; export const UPDATE_PASSWORD = gql` mutation UpdatePassword($old: String!, $new: String!) { updateCustomerPassword(currentPassword: $old, newPassword: $new) { ... on Success { success } ... on ErrorResult { errorCode message } } } `; export const GET_ACTIVE_ORDER = gql` query GetActiveOrder { activeOrder { ...TestOrderFragment } } ${TEST_ORDER_FRAGMENT} `; export const GET_ACTIVE_ORDER_WITH_PRICE_DATA = gql` query GetActiveOrderWithPriceData { activeOrder { id subTotal subTotalWithTax total totalWithTax total lines { id unitPrice unitPriceWithTax taxRate linePrice lineTax linePriceWithTax taxLines { taxRate description } } taxSummary { description taxRate taxBase taxTotal } } } `; export const ADJUST_ITEM_QUANTITY = gql` mutation AdjustItemQuantity($orderLineId: ID!, $quantity: Int!) { adjustOrderLine(orderLineId: $orderLineId, quantity: $quantity) { ...TestOrderFragment ... on ErrorResult { errorCode message } } } ${TEST_ORDER_FRAGMENT} `; export const REMOVE_ITEM_FROM_ORDER = gql` mutation RemoveItemFromOrder($orderLineId: ID!) { removeOrderLine(orderLineId: $orderLineId) { ...TestOrderFragment ... on ErrorResult { errorCode message } } } ${TEST_ORDER_FRAGMENT} `; export const GET_ELIGIBLE_SHIPPING_METHODS = gql` query GetShippingMethods { eligibleShippingMethods { id code price name description } } `; export const SET_SHIPPING_METHOD = gql` mutation SetShippingMethod($id: [ID!]!) { setOrderShippingMethod(shippingMethodId: $id) { ...TestOrderFragment ... on ErrorResult { errorCode message } } } ${TEST_ORDER_FRAGMENT} `; export const ACTIVE_ORDER_CUSTOMER = gql` fragment ActiveOrderCustomer on Order { id customer { id emailAddress firstName lastName } lines { id } } `; export const SET_CUSTOMER = gql` mutation SetCustomerForOrder($input: CreateCustomerInput!) { setCustomerForOrder(input: $input) { ...ActiveOrderCustomer ... on ErrorResult { errorCode message } ... on GuestCheckoutError { errorDetail } } } ${ACTIVE_ORDER_CUSTOMER} `; export const GET_ORDER_BY_CODE = gql` query GetOrderByCode($code: String!) { orderByCode(code: $code) { ...TestOrderFragment } } ${TEST_ORDER_FRAGMENT} `; export const GET_ORDER_SHOP = gql` query GetOrderShop($id: ID!) { order(id: $id) { ...TestOrderFragment } } ${TEST_ORDER_FRAGMENT} `; export const GET_ORDER_PROMOTIONS_BY_CODE = gql` query GetOrderPromotionsByCode($code: String!) { orderByCode(code: $code) { ...TestOrderFragment promotions { id name } } } ${TEST_ORDER_FRAGMENT} `; export const GET_AVAILABLE_COUNTRIES = gql` query GetAvailableCountries { availableCountries { id code } } `; export const TRANSITION_TO_STATE = gql` mutation TransitionToState($state: String!) { transitionOrderToState(state: $state) { ...TestOrderFragment ... on OrderStateTransitionError { errorCode message transitionError fromState toState } } } ${TEST_ORDER_FRAGMENT} `; export const SET_SHIPPING_ADDRESS = gql` mutation SetShippingAddress($input: CreateAddressInput!) { setOrderShippingAddress(input: $input) { ... on Order { shippingAddress { fullName company streetLine1 streetLine2 city province postalCode country phoneNumber } } ... on ErrorResult { errorCode message } } } `; export const SET_BILLING_ADDRESS = gql` mutation SetBillingAddress($input: CreateAddressInput!) { setOrderBillingAddress(input: $input) { ... on Order { billingAddress { fullName company streetLine1 streetLine2 city province postalCode country phoneNumber } } ... on ErrorResult { errorCode message } } } `; export const TEST_ORDER_WITH_PAYMENTS_FRAGMENT = gql` fragment TestOrderWithPayments on Order { ...TestOrderFragment payments { id transactionId method amount state metadata } } ${TEST_ORDER_FRAGMENT} `; export const GET_ACTIVE_ORDER_WITH_PAYMENTS = gql` query GetActiveOrderWithPayments { activeOrder { ...TestOrderWithPayments } } ${TEST_ORDER_WITH_PAYMENTS_FRAGMENT} `; export const ADD_PAYMENT = gql` mutation AddPaymentToOrder($input: PaymentInput!) { addPaymentToOrder(input: $input) { ...TestOrderWithPayments ... on ErrorResult { errorCode message } ... on PaymentDeclinedError { paymentErrorMessage } ... on PaymentFailedError { paymentErrorMessage } ... on OrderStateTransitionError { transitionError } ... on IneligiblePaymentMethodError { eligibilityCheckerMessage } } } ${TEST_ORDER_WITH_PAYMENTS_FRAGMENT} `; export const GET_ACTIVE_ORDER_PAYMENTS = gql` query GetActiveOrderPayments { activeOrder { id payments { id transactionId method amount state errorMessage metadata } } } `; export const GET_ORDER_BY_CODE_WITH_PAYMENTS = gql` query GetOrderByCodeWithPayments($code: String!) { orderByCode(code: $code) { ...TestOrderWithPayments } } ${TEST_ORDER_WITH_PAYMENTS_FRAGMENT} `; export const GET_ACTIVE_ORDER_CUSTOMER_WITH_ITEM_FULFILLMENTS = gql` query GetActiveCustomerOrderWithItemFulfillments { activeCustomer { orders( options: { skip: 0, take: 5, sort: { createdAt: DESC }, filter: { active: { eq: false } } } ) { totalItems items { id code state lines { id } fulfillments { id state method trackingCode } } } } } `; export const GET_NEXT_STATES = gql` query GetNextOrderStates { nextOrderStates } `; export const GET_ACTIVE_ORDER_ADDRESSES = gql` query GetCustomerAddresses { activeOrder { customer { addresses { id streetLine1 } } } } `; export const GET_ACTIVE_ORDER_ORDERS = gql` query GetCustomerOrders { activeOrder { customer { orders { items { id } } } } } `; export const GET_ACTIVE_CUSTOMER_ORDERS = gql` query GetActiveCustomerOrders { activeCustomer { id orders { totalItems items { id state } } } } `; export const APPLY_COUPON_CODE = gql` mutation ApplyCouponCode($couponCode: String!) { applyCouponCode(couponCode: $couponCode) { ...TestOrderFragment ... on ErrorResult { errorCode message } } } ${TEST_ORDER_FRAGMENT} `; export const REMOVE_COUPON_CODE = gql` mutation RemoveCouponCode($couponCode: String!) { removeCouponCode(couponCode: $couponCode) { ...TestOrderFragment } } ${TEST_ORDER_FRAGMENT} `; export const REMOVE_ALL_ORDER_LINES = gql` mutation RemoveAllOrderLines { removeAllOrderLines { ...TestOrderFragment ... on ErrorResult { errorCode message } } } ${TEST_ORDER_FRAGMENT} `; export const GET_ELIGIBLE_PAYMENT_METHODS = gql` query GetEligiblePaymentMethods { eligiblePaymentMethods { id code eligibilityMessage isEligible } } `; export const GET_PRODUCT_WITH_STOCK_LEVEL = gql` query GetProductStockLevel($id: ID!) { product(id: $id) { id variants { id stockLevel } } } `; export const GET_ACTIVE_CUSTOMER_WITH_ORDERS_PRODUCT_SLUG = gql` query GetActiveCustomerWithOrdersProductSlug($options: OrderListOptions) { activeCustomer { orders(options: $options) { items { lines { productVariant { product { slug } } } } } } } `; export const GET_ACTIVE_CUSTOMER_WITH_ORDERS_PRODUCT_PRICE = gql` query GetActiveCustomerWithOrdersProductPrice($options: OrderListOptions) { activeCustomer { orders(options: $options) { items { lines { linePrice productVariant { id name price } } } } } } `;
import { fail } from 'assert'; import { expect } from 'vitest'; /** * Helper method for creating tests which assert a given error message when the operation is attempted. */ export function assertThrowsWithMessage(operation: () => Promise<any>, message: string | (() => string)) { return async () => { try { await operation(); fail('Should have thrown'); } catch (err: any) { const messageString = typeof message === 'function' ? message() : message; expect(err.message).toEqual(expect.stringContaining(messageString)); } }; }
import { SimpleGraphQLClient } from '@vendure/testing'; import { GetRunningJobsQuery, GetRunningJobsQueryVariables } from '../graphql/generated-e2e-admin-types'; import { GET_RUNNING_JOBS } from '../graphql/shared-definitions'; /** * For mutation which trigger background jobs, this can be used to "pause" the execution of * the test until those jobs have completed; */ export async function awaitRunningJobs( adminClient: SimpleGraphQLClient, timeout: number = 5000, delay = 100, ) { let runningJobs = 0; const startTime = +new Date(); let timedOut = false; // Allow a brief period for the jobs to start in the case that // e.g. event debouncing is used before triggering the job. await new Promise(resolve => setTimeout(resolve, delay)); do { const { jobs } = await adminClient.query<GetRunningJobsQuery, GetRunningJobsQueryVariables>( GET_RUNNING_JOBS, { options: { filter: { isSettled: { eq: false, }, }, }, }, ); runningJobs = jobs.totalItems; timedOut = timeout < +new Date() - startTime; } while (runningJobs > 0 && !timedOut); }
/** * Hack to fix pg driver date handling. See https://github.com/typeorm/typeorm/issues/2622#issuecomment-476416712 */ export function fixPostgresTimezone() { if (process.env.DB === 'postgres') { // eslint-disable-next-line @typescript-eslint/no-var-requires const pg = require('pg'); pg.types.setTypeParser(1114, (stringValue: string) => new Date(`${stringValue}+0000`)); } }
/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { ID } from '@vendure/common/lib/shared-types'; import { PaymentMethodHandler } from '@vendure/core'; import { SimpleGraphQLClient } from '@vendure/testing'; import { afterAll, beforeAll, describe, expect, it } from 'vitest'; import * as CodegenShop from '../graphql/generated-e2e-shop-types'; import { TestOrderFragmentFragment } from '../graphql/generated-e2e-shop-types'; import { ADD_PAYMENT, GET_ELIGIBLE_SHIPPING_METHODS, SET_SHIPPING_ADDRESS, SET_SHIPPING_METHOD, TRANSITION_TO_STATE, } from '../graphql/shop-definitions'; export async function proceedToArrangingPayment(shopClient: SimpleGraphQLClient): Promise<ID> { await shopClient.query< CodegenShop.SetShippingAddressMutation, CodegenShop.SetShippingAddressMutationVariables >(SET_SHIPPING_ADDRESS, { input: { fullName: 'name', streetLine1: '12 the street', city: 'foo', postalCode: '123456', countryCode: 'US', }, }); const { eligibleShippingMethods } = await shopClient.query<CodegenShop.GetShippingMethodsQuery>( GET_ELIGIBLE_SHIPPING_METHODS, ); await shopClient.query< CodegenShop.SetShippingMethodMutation, CodegenShop.SetShippingMethodMutationVariables >(SET_SHIPPING_METHOD, { id: eligibleShippingMethods[1].id, }); const { transitionOrderToState } = await shopClient.query< CodegenShop.TransitionToStateMutation, CodegenShop.TransitionToStateMutationVariables >(TRANSITION_TO_STATE, { state: 'ArrangingPayment' }); return (transitionOrderToState as TestOrderFragmentFragment)!.id; } export async function addPaymentToOrder( shopClient: SimpleGraphQLClient, handler: PaymentMethodHandler, ): Promise<NonNullable<CodegenShop.AddPaymentToOrderMutation['addPaymentToOrder']>> { const result = await shopClient.query< CodegenShop.AddPaymentToOrderMutation, CodegenShop.AddPaymentToOrderMutationVariables >(ADD_PAYMENT, { input: { method: handler.code, metadata: { baz: 'quux', }, }, }); const order = result.addPaymentToOrder; return order as any; } /** * Sorts an array of entities by the id key. Useful for compensating for the fact that different DBs * return arrays in different orders. */ export function sortById<T extends { id: string | number }>(a: T, b: T): 1 | -1 { return a.id < b.id ? -1 : 1; }
import { LanguageCode, Permission } from '@vendure/common/lib/generated-types'; import { InitialData } from '../../src/data-import'; export const initialData: InitialData = { defaultLanguage: LanguageCode.en, defaultZone: 'Europe', roles: [ { code: 'administrator', description: 'Administrator', permissions: [ Permission.CreateCatalog, Permission.ReadCatalog, Permission.UpdateCatalog, Permission.DeleteCatalog, Permission.CreateSettings, Permission.ReadSettings, Permission.UpdateSettings, Permission.DeleteSettings, Permission.CreateCustomer, Permission.ReadCustomer, Permission.UpdateCustomer, Permission.DeleteCustomer, Permission.CreateCustomerGroup, Permission.ReadCustomerGroup, Permission.UpdateCustomerGroup, Permission.DeleteCustomerGroup, Permission.CreateOrder, Permission.ReadOrder, Permission.UpdateOrder, Permission.DeleteOrder, Permission.CreateSystem, Permission.ReadSystem, Permission.UpdateSystem, Permission.DeleteSystem, ], }, { code: 'order-manager', description: 'Order manager', permissions: [ Permission.CreateOrder, Permission.ReadOrder, Permission.UpdateOrder, Permission.DeleteOrder, Permission.ReadCustomer, Permission.ReadPaymentMethod, Permission.ReadShippingMethod, Permission.ReadPromotion, Permission.ReadCountry, Permission.ReadZone, ], }, { code: 'inventory-manager', description: 'Inventory manager', permissions: [ Permission.CreateCatalog, Permission.ReadCatalog, Permission.UpdateCatalog, Permission.DeleteCatalog, Permission.CreateTag, Permission.ReadTag, Permission.UpdateTag, Permission.DeleteTag, Permission.ReadCustomer, ], }, ], taxRates: [ { name: 'Standard Tax', percentage: 20 }, { name: 'Reduced Tax', percentage: 10 }, { name: 'Zero Tax', percentage: 0 }, ], shippingMethods: [ { name: 'Standard Shipping', price: 500 }, { name: 'Express Shipping', price: 1000 }, ], paymentMethods: [ { name: 'Standard Payment', handler: { code: 'dummy-payment-handler', arguments: [{ name: 'automaticSettle', value: 'false' }], }, }, ], collections: [ { name: 'Electronics', filters: [ { code: 'facet-value-filter', args: { facetValueNames: ['Electronics'], containsAny: false }, }, ], assetPaths: ['jakob-owens-274337-unsplash.jpg'], }, { name: 'Computers', filters: [ { code: 'facet-value-filter', args: { facetValueNames: ['Computers'], containsAny: false } }, ], parentName: 'Electronics', assetPaths: ['alexandru-acea-686569-unsplash.jpg'], }, { name: 'Camera & Photo', filters: [ { code: 'facet-value-filter', args: { facetValueNames: ['Photo'], containsAny: false } }, ], parentName: 'Electronics', assetPaths: ['eniko-kis-663725-unsplash.jpg'], }, { name: 'Home & Garden', filters: [ { code: 'facet-value-filter', args: { facetValueNames: ['Home & Garden'], containsAny: false }, }, ], assetPaths: ['paul-weaver-1120584-unsplash.jpg'], }, { name: 'Furniture', filters: [ { code: 'facet-value-filter', args: { facetValueNames: ['Furniture'], containsAny: false } }, ], parentName: 'Home & Garden', assetPaths: ['nathan-fertig-249917-unsplash.jpg'], }, { name: 'Plants', filters: [ { code: 'facet-value-filter', args: { facetValueNames: ['Plants'], containsAny: false } }, ], parentName: 'Home & Garden', assetPaths: ['alex-rodriguez-santibanez-200278-unsplash.jpg'], }, { name: 'Sports & Outdoor', filters: [ { code: 'facet-value-filter', args: { facetValueNames: ['Sports & Outdoor'], containsAny: false }, }, ], assetPaths: ['michael-guite-571169-unsplash.jpg'], }, { name: 'Equipment', filters: [ { code: 'facet-value-filter', args: { facetValueNames: ['Equipment'], containsAny: false } }, ], parentName: 'Sports & Outdoor', assetPaths: ['neonbrand-428982-unsplash.jpg'], }, { name: 'Footwear', filters: [ { code: 'facet-value-filter', args: { facetValueNames: ['Footwear'], containsAny: false } }, ], parentName: 'Sports & Outdoor', assetPaths: ['thomas-serer-420833-unsplash.jpg'], }, ], countries: [ { name: 'Afghanistan', code: 'AF', zone: 'Asia' }, { name: 'Åland Islands', code: 'AX', zone: 'Europe' }, { name: 'Albania', code: 'AL', zone: 'Europe' }, { name: 'Algeria', code: 'DZ', zone: 'Africa' }, { name: 'American Samoa', code: 'AS', zone: 'Oceania' }, { name: 'Andorra', code: 'AD', zone: 'Europe' }, { name: 'Angola', code: 'AO', zone: 'Africa' }, { name: 'Anguilla', code: 'AI', zone: 'Americas' }, { name: 'Antigua and Barbuda', code: 'AG', zone: 'Americas' }, { name: 'Argentina', code: 'AR', zone: 'Americas' }, { name: 'Armenia', code: 'AM', zone: 'Asia' }, { name: 'Aruba', code: 'AW', zone: 'Americas' }, { name: 'Australia', code: 'AU', zone: 'Oceania' }, { name: 'Austria', code: 'AT', zone: 'Europe' }, { name: 'Azerbaijan', code: 'AZ', zone: 'Asia' }, { name: 'Bahamas', code: 'BS', zone: 'Americas' }, { name: 'Bahrain', code: 'BH', zone: 'Asia' }, { name: 'Bangladesh', code: 'BD', zone: 'Asia' }, { name: 'Barbados', code: 'BB', zone: 'Americas' }, { name: 'Belarus', code: 'BY', zone: 'Europe' }, { name: 'Belgium', code: 'BE', zone: 'Europe' }, { name: 'Belize', code: 'BZ', zone: 'Americas' }, { name: 'Benin', code: 'BJ', zone: 'Africa' }, { name: 'Bermuda', code: 'BM', zone: 'Americas' }, { name: 'Bhutan', code: 'BT', zone: 'Asia' }, { name: 'Bolivia (Plurinational State of)', code: 'BO', zone: 'Americas' }, { name: 'Bonaire, Sint Eustatius and Saba', code: 'BQ', zone: 'Americas' }, { name: 'Bosnia and Herzegovina', code: 'BA', zone: 'Europe' }, { name: 'Botswana', code: 'BW', zone: 'Africa' }, { name: 'Bouvet Island', code: 'BV', zone: 'Americas' }, { name: 'Brazil', code: 'BR', zone: 'Americas' }, { name: 'British Indian Ocean Territory', code: 'IO', zone: 'Africa' }, { name: 'Brunei Darussalam', code: 'BN', zone: 'Asia' }, { name: 'Bulgaria', code: 'BG', zone: 'Europe' }, { name: 'Burkina Faso', code: 'BF', zone: 'Africa' }, { name: 'Burundi', code: 'BI', zone: 'Africa' }, { name: 'Cabo Verde', code: 'CV', zone: 'Africa' }, { name: 'Cambodia', code: 'KH', zone: 'Asia' }, { name: 'Cameroon', code: 'CM', zone: 'Africa' }, { name: 'Canada', code: 'CA', zone: 'Americas' }, { name: 'Cayman Islands', code: 'KY', zone: 'Americas' }, { name: 'Central African Republic', code: 'CF', zone: 'Africa' }, { name: 'Chad', code: 'TD', zone: 'Africa' }, { name: 'Chile', code: 'CL', zone: 'Americas' }, { name: 'China', code: 'CN', zone: 'Asia' }, { name: 'Christmas Island', code: 'CX', zone: 'Oceania' }, { name: 'Cocos (Keeling) Islands', code: 'CC', zone: 'Oceania' }, { name: 'Colombia', code: 'CO', zone: 'Americas' }, { name: 'Comoros', code: 'KM', zone: 'Africa' }, { name: 'Congo', code: 'CG', zone: 'Africa' }, { name: 'Congo (Democratic Republic of the)', code: 'CD', zone: 'Africa' }, { name: 'Cook Islands', code: 'CK', zone: 'Oceania' }, { name: 'Costa Rica', code: 'CR', zone: 'Americas' }, { name: "Côte d'Ivoire", code: 'CI', zone: 'Africa' }, { name: 'Croatia', code: 'HR', zone: 'Europe' }, { name: 'Cuba', code: 'CU', zone: 'Americas' }, { name: 'Curaçao', code: 'CW', zone: 'Americas' }, { name: 'Cyprus', code: 'CY', zone: 'Asia' }, { name: 'Czechia', code: 'CZ', zone: 'Europe' }, { name: 'Denmark', code: 'DK', zone: 'Europe' }, { name: 'Djibouti', code: 'DJ', zone: 'Africa' }, { name: 'Dominica', code: 'DM', zone: 'Americas' }, { name: 'Dominican Republic', code: 'DO', zone: 'Americas' }, { name: 'Ecuador', code: 'EC', zone: 'Americas' }, { name: 'Egypt', code: 'EG', zone: 'Africa' }, { name: 'El Salvador', code: 'SV', zone: 'Americas' }, { name: 'Equatorial Guinea', code: 'GQ', zone: 'Africa' }, { name: 'Eritrea', code: 'ER', zone: 'Africa' }, { name: 'Estonia', code: 'EE', zone: 'Europe' }, { name: 'Eswatini', code: 'SZ', zone: 'Africa' }, { name: 'Ethiopia', code: 'ET', zone: 'Africa' }, { name: 'Falkland Islands (Malvinas)', code: 'FK', zone: 'Americas' }, { name: 'Faroe Islands', code: 'FO', zone: 'Europe' }, { name: 'Fiji', code: 'FJ', zone: 'Oceania' }, { name: 'Finland', code: 'FI', zone: 'Europe' }, { name: 'France', code: 'FR', zone: 'Europe' }, { name: 'French Guiana', code: 'GF', zone: 'Americas' }, { name: 'French Polynesia', code: 'PF', zone: 'Oceania' }, { name: 'French Southern Territories', code: 'TF', zone: 'Africa' }, { name: 'Gabon', code: 'GA', zone: 'Africa' }, { name: 'Gambia', code: 'GM', zone: 'Africa' }, { name: 'Georgia', code: 'GE', zone: 'Asia' }, { name: 'Germany', code: 'DE', zone: 'Europe' }, { name: 'Ghana', code: 'GH', zone: 'Africa' }, { name: 'Gibraltar', code: 'GI', zone: 'Europe' }, { name: 'Greece', code: 'GR', zone: 'Europe' }, { name: 'Greenland', code: 'GL', zone: 'Americas' }, { name: 'Grenada', code: 'GD', zone: 'Americas' }, { name: 'Guadeloupe', code: 'GP', zone: 'Americas' }, { name: 'Guam', code: 'GU', zone: 'Oceania' }, { name: 'Guatemala', code: 'GT', zone: 'Americas' }, { name: 'Guernsey', code: 'GG', zone: 'Europe' }, { name: 'Guinea', code: 'GN', zone: 'Africa' }, { name: 'Guinea-Bissau', code: 'GW', zone: 'Africa' }, { name: 'Guyana', code: 'GY', zone: 'Americas' }, { name: 'Haiti', code: 'HT', zone: 'Americas' }, { name: 'Heard Island and McDonald Islands', code: 'HM', zone: 'Oceania' }, { name: 'Holy See', code: 'VA', zone: 'Europe' }, { name: 'Honduras', code: 'HN', zone: 'Americas' }, { name: 'Hong Kong', code: 'HK', zone: 'Asia' }, { name: 'Hungary', code: 'HU', zone: 'Europe' }, { name: 'Iceland', code: 'IS', zone: 'Europe' }, { name: 'India', code: 'IN', zone: 'Asia' }, { name: 'Indonesia', code: 'ID', zone: 'Asia' }, { name: 'Iran (Islamic Republic of)', code: 'IR', zone: 'Asia' }, { name: 'Iraq', code: 'IQ', zone: 'Asia' }, { name: 'Ireland', code: 'IE', zone: 'Europe' }, { name: 'Isle of Man', code: 'IM', zone: 'Europe' }, { name: 'Israel', code: 'IL', zone: 'Asia' }, { name: 'Italy', code: 'IT', zone: 'Europe' }, { name: 'Jamaica', code: 'JM', zone: 'Americas' }, { name: 'Japan', code: 'JP', zone: 'Asia' }, { name: 'Jersey', code: 'JE', zone: 'Europe' }, { name: 'Jordan', code: 'JO', zone: 'Asia' }, { name: 'Kazakhstan', code: 'KZ', zone: 'Asia' }, { name: 'Kenya', code: 'KE', zone: 'Africa' }, { name: 'Kiribati', code: 'KI', zone: 'Oceania' }, { name: "Korea (Democratic People's Republic of)", code: 'KP', zone: 'Asia' }, { name: 'Korea (Republic of)', code: 'KR', zone: 'Asia' }, { name: 'Kuwait', code: 'KW', zone: 'Asia' }, { name: 'Kyrgyzstan', code: 'KG', zone: 'Asia' }, { name: "Lao People's Democratic Republic", code: 'LA', zone: 'Asia' }, { name: 'Latvia', code: 'LV', zone: 'Europe' }, { name: 'Lebanon', code: 'LB', zone: 'Asia' }, { name: 'Lesotho', code: 'LS', zone: 'Africa' }, { name: 'Liberia', code: 'LR', zone: 'Africa' }, { name: 'Libya', code: 'LY', zone: 'Africa' }, { name: 'Liechtenstein', code: 'LI', zone: 'Europe' }, { name: 'Lithuania', code: 'LT', zone: 'Europe' }, { name: 'Luxembourg', code: 'LU', zone: 'Europe' }, { name: 'Macao', code: 'MO', zone: 'Asia' }, { name: 'Macedonia (the former Yugoslav Republic of)', code: 'MK', zone: 'Europe' }, { name: 'Madagascar', code: 'MG', zone: 'Africa' }, { name: 'Malawi', code: 'MW', zone: 'Africa' }, { name: 'Malaysia', code: 'MY', zone: 'Asia' }, { name: 'Maldives', code: 'MV', zone: 'Asia' }, { name: 'Mali', code: 'ML', zone: 'Africa' }, { name: 'Malta', code: 'MT', zone: 'Europe' }, { name: 'Marshall Islands', code: 'MH', zone: 'Oceania' }, { name: 'Martinique', code: 'MQ', zone: 'Americas' }, { name: 'Mauritania', code: 'MR', zone: 'Africa' }, { name: 'Mauritius', code: 'MU', zone: 'Africa' }, { name: 'Mayotte', code: 'YT', zone: 'Africa' }, { name: 'Mexico', code: 'MX', zone: 'Americas' }, { name: 'Micronesia (Federated States of)', code: 'FM', zone: 'Oceania' }, { name: 'Moldova (Republic of)', code: 'MD', zone: 'Europe' }, { name: 'Monaco', code: 'MC', zone: 'Europe' }, { name: 'Mongolia', code: 'MN', zone: 'Asia' }, { name: 'Montenegro', code: 'ME', zone: 'Europe' }, { name: 'Montserrat', code: 'MS', zone: 'Americas' }, { name: 'Morocco', code: 'MA', zone: 'Africa' }, { name: 'Mozambique', code: 'MZ', zone: 'Africa' }, { name: 'Myanmar', code: 'MM', zone: 'Asia' }, { name: 'Namibia', code: 'NA', zone: 'Africa' }, { name: 'Nauru', code: 'NR', zone: 'Oceania' }, { name: 'Nepal', code: 'NP', zone: 'Asia' }, { name: 'Netherlands', code: 'NL', zone: 'Europe' }, { name: 'New Caledonia', code: 'NC', zone: 'Oceania' }, { name: 'New Zealand', code: 'NZ', zone: 'Oceania' }, { name: 'Nicaragua', code: 'NI', zone: 'Americas' }, { name: 'Niger', code: 'NE', zone: 'Africa' }, { name: 'Nigeria', code: 'NG', zone: 'Africa' }, { name: 'Niue', code: 'NU', zone: 'Oceania' }, { name: 'Norfolk Island', code: 'NF', zone: 'Oceania' }, { name: 'Northern Mariana Islands', code: 'MP', zone: 'Oceania' }, { name: 'Norway', code: 'NO', zone: 'Europe' }, { name: 'Oman', code: 'OM', zone: 'Asia' }, { name: 'Pakistan', code: 'PK', zone: 'Asia' }, { name: 'Palau', code: 'PW', zone: 'Oceania' }, { name: 'Palestine, State of', code: 'PS', zone: 'Asia' }, { name: 'Panama', code: 'PA', zone: 'Americas' }, { name: 'Papua New Guinea', code: 'PG', zone: 'Oceania' }, { name: 'Paraguay', code: 'PY', zone: 'Americas' }, { name: 'Peru', code: 'PE', zone: 'Americas' }, { name: 'Philippines', code: 'PH', zone: 'Asia' }, { name: 'Pitcairn', code: 'PN', zone: 'Oceania' }, { name: 'Poland', code: 'PL', zone: 'Europe' }, { name: 'Portugal', code: 'PT', zone: 'Europe' }, { name: 'Puerto Rico', code: 'PR', zone: 'Americas' }, { name: 'Qatar', code: 'QA', zone: 'Asia' }, { name: 'Réunion', code: 'RE', zone: 'Africa' }, { name: 'Romania', code: 'RO', zone: 'Europe' }, { name: 'Russian Federation', code: 'RU', zone: 'Europe' }, { name: 'Rwanda', code: 'RW', zone: 'Africa' }, { name: 'Saint Barthélemy', code: 'BL', zone: 'Americas' }, { name: 'Saint Helena, Ascension and Tristan da Cunha', code: 'SH', zone: 'Africa' }, { name: 'Saint Kitts and Nevis', code: 'KN', zone: 'Americas' }, { name: 'Saint Lucia', code: 'LC', zone: 'Americas' }, { name: 'Saint Martin (French part)', code: 'MF', zone: 'Americas' }, { name: 'Saint Pierre and Miquelon', code: 'PM', zone: 'Americas' }, { name: 'Saint Vincent and the Grenadines', code: 'VC', zone: 'Americas' }, { name: 'Samoa', code: 'WS', zone: 'Oceania' }, { name: 'San Marino', code: 'SM', zone: 'Europe' }, { name: 'Sao Tome and Principe', code: 'ST', zone: 'Africa' }, { name: 'Saudi Arabia', code: 'SA', zone: 'Asia' }, { name: 'Senegal', code: 'SN', zone: 'Africa' }, { name: 'Serbia', code: 'RS', zone: 'Europe' }, { name: 'Seychelles', code: 'SC', zone: 'Africa' }, { name: 'Sierra Leone', code: 'SL', zone: 'Africa' }, { name: 'Singapore', code: 'SG', zone: 'Asia' }, { name: 'Sint Maarten (Dutch part)', code: 'SX', zone: 'Americas' }, { name: 'Slovakia', code: 'SK', zone: 'Europe' }, { name: 'Slovenia', code: 'SI', zone: 'Europe' }, { name: 'Solomon Islands', code: 'SB', zone: 'Oceania' }, { name: 'Somalia', code: 'SO', zone: 'Africa' }, { name: 'South Africa', code: 'ZA', zone: 'Africa' }, { name: 'South Georgia and the South Sandwich Islands', code: 'GS', zone: 'Americas' }, { name: 'South Sudan', code: 'SS', zone: 'Africa' }, { name: 'Spain', code: 'ES', zone: 'Europe' }, { name: 'Sri Lanka', code: 'LK', zone: 'Asia' }, { name: 'Sudan', code: 'SD', zone: 'Africa' }, { name: 'Suriname', code: 'SR', zone: 'Americas' }, { name: 'Svalbard and Jan Mayen', code: 'SJ', zone: 'Europe' }, { name: 'Sweden', code: 'SE', zone: 'Europe' }, { name: 'Switzerland', code: 'CH', zone: 'Europe' }, { name: 'Syrian Arab Republic', code: 'SY', zone: 'Asia' }, { name: 'Taiwan, Province of China', code: 'TW', zone: 'Asia' }, { name: 'Tajikistan', code: 'TJ', zone: 'Asia' }, { name: 'Tanzania, United Republic of', code: 'TZ', zone: 'Africa' }, { name: 'Thailand', code: 'TH', zone: 'Asia' }, { name: 'Timor-Leste', code: 'TL', zone: 'Asia' }, { name: 'Togo', code: 'TG', zone: 'Africa' }, { name: 'Tokelau', code: 'TK', zone: 'Oceania' }, { name: 'Tonga', code: 'TO', zone: 'Oceania' }, { name: 'Trinidad and Tobago', code: 'TT', zone: 'Americas' }, { name: 'Tunisia', code: 'TN', zone: 'Africa' }, { name: 'Turkey', code: 'TR', zone: 'Asia' }, { name: 'Turkmenistan', code: 'TM', zone: 'Asia' }, { name: 'Turks and Caicos Islands', code: 'TC', zone: 'Americas' }, { name: 'Tuvalu', code: 'TV', zone: 'Oceania' }, { name: 'Uganda', code: 'UG', zone: 'Africa' }, { name: 'Ukraine', code: 'UA', zone: 'Europe' }, { name: 'United Arab Emirates', code: 'AE', zone: 'Asia' }, { name: 'United Kingdom', code: 'GB', zone: 'Europe' }, { name: 'United States of America', code: 'US', zone: 'Americas' }, { name: 'United States Minor Outlying Islands', code: 'UM', zone: 'Oceania' }, { name: 'Uruguay', code: 'UY', zone: 'Americas' }, { name: 'Uzbekistan', code: 'UZ', zone: 'Asia' }, { name: 'Vanuatu', code: 'VU', zone: 'Oceania' }, { name: 'Venezuela (Bolivarian Republic of)', code: 'VE', zone: 'Americas' }, { name: 'Viet Nam', code: 'VN', zone: 'Asia' }, { name: 'Virgin Islands (British)', code: 'VG', zone: 'Americas' }, { name: 'Virgin Islands (U.S.)', code: 'VI', zone: 'Americas' }, { name: 'Wallis and Futuna', code: 'WF', zone: 'Oceania' }, { name: 'Western Sahara', code: 'EH', zone: 'Africa' }, { name: 'Yemen', code: 'YE', zone: 'Asia' }, { name: 'Zambia', code: 'ZM', zone: 'Africa' }, { name: 'Zimbabwe', code: 'ZW', zone: 'Africa' }, ], };
import { MiddlewareConsumer, Module, NestModule, OnApplicationShutdown } from '@nestjs/common'; import { ApiModule } from './api/api.module'; import { Middleware, MiddlewareHandler } from './common'; import { ConfigModule } from './config/config.module'; import { ConfigService } from './config/config.service'; import { Logger } from './config/logger/vendure-logger'; import { ConnectionModule } from './connection/connection.module'; import { HealthCheckModule } from './health-check/health-check.module'; import { I18nModule } from './i18n/i18n.module'; import { I18nService } from './i18n/i18n.service'; import { PluginModule } from './plugin/plugin.module'; import { ProcessContextModule } from './process-context/process-context.module'; import { ServiceModule } from './service/service.module'; @Module({ imports: [ ProcessContextModule, ConfigModule, I18nModule, ApiModule, PluginModule.forRoot(), HealthCheckModule, ServiceModule, ConnectionModule, ], }) export class AppModule implements NestModule, OnApplicationShutdown { constructor(private configService: ConfigService, private i18nService: I18nService) {} configure(consumer: MiddlewareConsumer) { const { adminApiPath, shopApiPath, middleware } = this.configService.apiOptions; const i18nextHandler = this.i18nService.handle(); const defaultMiddleware: Middleware[] = [ { handler: i18nextHandler, route: adminApiPath }, { handler: i18nextHandler, route: shopApiPath }, ]; const allMiddleware = defaultMiddleware.concat(middleware); const consumableMiddlewares = allMiddleware.filter(mid => !mid.beforeListen); const middlewareByRoute = this.groupMiddlewareByRoute(consumableMiddlewares); for (const [route, handlers] of Object.entries(middlewareByRoute)) { consumer.apply(...handlers).forRoutes(route); } } async onApplicationShutdown(signal?: string) { if (signal) { Logger.info('Received shutdown signal:' + signal); } } /** * Groups middleware handler together in an object with the route as the key. */ private groupMiddlewareByRoute(middlewareArray: Middleware[]): { [route: string]: MiddlewareHandler[] } { const result = {} as { [route: string]: MiddlewareHandler[] }; for (const middleware of middlewareArray) { const route = middleware.route || this.configService.apiOptions.adminApiPath; if (!result[route]) { result[route] = []; } result[route].push(middleware.handler); } return result; } }
import { INestApplication, INestApplicationContext } from '@nestjs/common'; import { NestApplicationContextOptions } from '@nestjs/common/interfaces/nest-application-context-options.interface'; import { NestApplicationOptions } from '@nestjs/common/interfaces/nest-application-options.interface'; import { NestFactory } from '@nestjs/core'; import { getConnectionToken } from '@nestjs/typeorm'; import { DEFAULT_COOKIE_NAME } from '@vendure/common/lib/shared-constants'; import { Type } from '@vendure/common/lib/shared-types'; import cookieSession = require('cookie-session'); import { satisfies } from 'semver'; import { Connection, DataSourceOptions, EntitySubscriberInterface } from 'typeorm'; import { InternalServerError } from './common/error/errors'; import { getConfig, setConfig } from './config/config-helpers'; import { DefaultLogger } from './config/logger/default-logger'; import { Logger } from './config/logger/vendure-logger'; import { RuntimeVendureConfig, VendureConfig } from './config/vendure-config'; import { Administrator } from './entity/administrator/administrator.entity'; import { coreEntitiesMap } from './entity/entities'; import { registerCustomEntityFields } from './entity/register-custom-entity-fields'; import { runEntityMetadataModifiers } from './entity/run-entity-metadata-modifiers'; import { setEntityIdStrategy } from './entity/set-entity-id-strategy'; import { setMoneyStrategy } from './entity/set-money-strategy'; import { validateCustomFieldsConfig } from './entity/validate-custom-fields-config'; import { getCompatibility, getConfigurationFunction, getEntitiesFromPlugins } from './plugin/plugin-metadata'; import { getPluginStartupMessages } from './plugin/plugin-utils'; import { setProcessContext } from './process-context/process-context'; import { VENDURE_VERSION } from './version'; import { VendureWorker } from './worker/vendure-worker'; export type VendureBootstrapFunction = (config: VendureConfig) => Promise<INestApplication>; /** * @description * Additional options that can be used to configure the bootstrap process of the * Vendure server. * * @since 2.2.0 * @docsCategory common * @docsPage bootstrap */ export interface BootstrapOptions { /** * @description * These options get passed directly to the `NestFactory.create()` method. */ nestApplicationOptions: NestApplicationOptions; } /** * @description * Additional options that can be used to configure the bootstrap process of the * Vendure worker. * * @since 2.2.0 * @docsCategory worker * @docsPage bootstrapWorker */ export interface BootstrapWorkerOptions { /** * @description * These options get passed directly to the `NestFactory.createApplicationContext` method. */ nestApplicationContextOptions: NestApplicationContextOptions; } /** * @description * Bootstraps the Vendure server. This is the entry point to the application. * * @example * ```ts * import { bootstrap } from '\@vendure/core'; * import { config } from './vendure-config'; * * bootstrap(config).catch(err => { * console.log(err); * process.exit(1); * }); * ``` * * ### Passing additional options * * Since v2.2.0, you can pass additional options to the NestJs application via the `options` parameter. * For example, to integrate with the [Nest Devtools](https://docs.nestjs.com/devtools/overview), you need to * pass the `snapshot` option: * * ```ts * import { bootstrap } from '\@vendure/core'; * import { config } from './vendure-config'; * * bootstrap(config, { * // highlight-start * nestApplicationOptions: { * snapshot: true, * } * // highlight-end * }).catch(err => { * console.log(err); * process.exit(1); * }); * ``` * @docsCategory common * @docsPage bootstrap * @docsWeight 0 * */ export async function bootstrap( userConfig: Partial<VendureConfig>, options?: BootstrapOptions, ): Promise<INestApplication> { const config = await preBootstrapConfig(userConfig); Logger.useLogger(config.logger); Logger.info(`Bootstrapping Vendure Server (pid: ${process.pid})...`); checkPluginCompatibility(config); // The AppModule *must* be loaded only after the entities have been set in the // config, so that they are available when the AppModule decorator is evaluated. // eslint-disable-next-line const appModule = await import('./app.module.js'); setProcessContext('server'); const { hostname, port, cors, middleware } = config.apiOptions; DefaultLogger.hideNestBoostrapLogs(); const app = await NestFactory.create(appModule.AppModule, { cors, logger: new Logger(), ...options?.nestApplicationOptions, }); DefaultLogger.restoreOriginalLogLevel(); app.useLogger(new Logger()); const { tokenMethod } = config.authOptions; const usingCookie = tokenMethod === 'cookie' || (Array.isArray(tokenMethod) && tokenMethod.includes('cookie')); if (usingCookie) { configureSessionCookies(app, config); } const earlyMiddlewares = middleware.filter(mid => mid.beforeListen); earlyMiddlewares.forEach(mid => { app.use(mid.route, mid.handler); }); await app.listen(port, hostname || ''); app.enableShutdownHooks(); logWelcomeMessage(config); return app; } /** * @description * Bootstraps a Vendure worker. Resolves to a {@link VendureWorker} object containing a reference to the underlying * NestJs [standalone application](https://docs.nestjs.com/standalone-applications) as well as convenience * methods for starting the job queue and health check server. * * Read more about the [Vendure Worker](/guides/developer-guide/worker-job-queue/). * * @example * ```ts * import { bootstrapWorker } from '\@vendure/core'; * import { config } from './vendure-config'; * * bootstrapWorker(config) * .then(worker => worker.startJobQueue()) * .then(worker => worker.startHealthCheckServer({ port: 3020 })) * .catch(err => { * console.log(err); * process.exit(1); * }); * ``` * @docsCategory worker * @docsPage bootstrapWorker * @docsWeight 0 * */ export async function bootstrapWorker( userConfig: Partial<VendureConfig>, options?: BootstrapWorkerOptions, ): Promise<VendureWorker> { const vendureConfig = await preBootstrapConfig(userConfig); const config = disableSynchronize(vendureConfig); config.logger.setDefaultContext?.('Vendure Worker'); Logger.useLogger(config.logger); Logger.info(`Bootstrapping Vendure Worker (pid: ${process.pid})...`); checkPluginCompatibility(config); setProcessContext('worker'); DefaultLogger.hideNestBoostrapLogs(); const WorkerModule = await import('./worker/worker.module.js').then(m => m.WorkerModule); const workerApp = await NestFactory.createApplicationContext(WorkerModule, { logger: new Logger(), ...options?.nestApplicationContextOptions, }); DefaultLogger.restoreOriginalLogLevel(); workerApp.useLogger(new Logger()); workerApp.enableShutdownHooks(); await validateDbTablesForWorker(workerApp); Logger.info('Vendure Worker is ready'); return new VendureWorker(workerApp); } /** * Setting the global config must be done prior to loading the AppModule. */ export async function preBootstrapConfig( userConfig: Partial<VendureConfig>, ): Promise<Readonly<RuntimeVendureConfig>> { if (userConfig) { await setConfig(userConfig); } const entities = await getAllEntities(userConfig); const { coreSubscribersMap } = await import('./entity/subscribers.js'); await setConfig({ dbConnectionOptions: { entities, subscribers: [ ...((userConfig.dbConnectionOptions?.subscribers ?? []) as Array< Type<EntitySubscriberInterface> >), ...(Object.values(coreSubscribersMap) as Array<Type<EntitySubscriberInterface>>), ], }, }); let config = getConfig(); // The logger is set here so that we are able to log any messages prior to the final // logger (which may depend on config coming from a plugin) being set. Logger.useLogger(config.logger); config = await runPluginConfigurations(config); const entityIdStrategy = config.entityOptions.entityIdStrategy ?? config.entityIdStrategy; setEntityIdStrategy(entityIdStrategy, entities); const moneyStrategy = config.entityOptions.moneyStrategy; setMoneyStrategy(moneyStrategy, entities); const customFieldValidationResult = validateCustomFieldsConfig(config.customFields, entities); if (!customFieldValidationResult.valid) { process.exitCode = 1; throw new Error('CustomFields config error:\n- ' + customFieldValidationResult.errors.join('\n- ')); } registerCustomEntityFields(config); await runEntityMetadataModifiers(config); setExposedHeaders(config); return config; } function checkPluginCompatibility(config: RuntimeVendureConfig): void { for (const plugin of config.plugins) { const compatibility = getCompatibility(plugin); const pluginName = (plugin as any).name as string; if (!compatibility) { Logger.info( `The plugin "${pluginName}" does not specify a compatibility range, so it is not guaranteed to be compatible with this version of Vendure.`, ); } else { if (!satisfies(VENDURE_VERSION, compatibility, { loose: true, includePrerelease: true })) { Logger.error( `Plugin "${pluginName}" is not compatible with this version of Vendure. ` + `It specifies a semver range of "${compatibility}" but the current version is "${VENDURE_VERSION}".`, ); throw new InternalServerError( `Plugin "${pluginName}" is not compatible with this version of Vendure.`, ); } } } } /** * Initialize any configured plugins. */ async function runPluginConfigurations(config: RuntimeVendureConfig): Promise<RuntimeVendureConfig> { for (const plugin of config.plugins) { const configFn = getConfigurationFunction(plugin); if (typeof configFn === 'function') { config = await configFn(config); } } return config; } /** * Returns an array of core entities and any additional entities defined in plugins. */ export async function getAllEntities(userConfig: Partial<VendureConfig>): Promise<Array<Type<any>>> { const coreEntities = Object.values(coreEntitiesMap) as Array<Type<any>>; const pluginEntities = getEntitiesFromPlugins(userConfig.plugins); const allEntities: Array<Type<any>> = coreEntities; // Check to ensure that no plugins are defining entities with names // which conflict with existing entities. for (const pluginEntity of pluginEntities) { if (allEntities.find(e => e.name === pluginEntity.name)) { throw new InternalServerError('error.entity-name-conflict', { entityName: pluginEntity.name }); } else { allEntities.push(pluginEntity); } } return allEntities; } /** * If the 'bearer' tokenMethod is being used, then we automatically expose the authTokenHeaderKey header * in the CORS options, making sure to preserve any user-configured exposedHeaders. */ function setExposedHeaders(config: Readonly<RuntimeVendureConfig>) { const { tokenMethod } = config.authOptions; const isUsingBearerToken = tokenMethod === 'bearer' || (Array.isArray(tokenMethod) && tokenMethod.includes('bearer')); if (isUsingBearerToken) { const authTokenHeaderKey = config.authOptions.authTokenHeaderKey; const corsOptions = config.apiOptions.cors; if (typeof corsOptions !== 'boolean') { const { exposedHeaders } = corsOptions; let exposedHeadersWithAuthKey: string[]; if (!exposedHeaders) { exposedHeadersWithAuthKey = [authTokenHeaderKey]; } else if (typeof exposedHeaders === 'string') { exposedHeadersWithAuthKey = exposedHeaders .split(',') .map(x => x.trim()) .concat(authTokenHeaderKey); } else { exposedHeadersWithAuthKey = exposedHeaders.concat(authTokenHeaderKey); } corsOptions.exposedHeaders = exposedHeadersWithAuthKey; } } } function logWelcomeMessage(config: RuntimeVendureConfig) { const { port, shopApiPath, adminApiPath, hostname } = config.apiOptions; const apiCliGreetings: Array<readonly [string, string]> = []; const pathToUrl = (path: string) => `http://${hostname || 'localhost'}:${port}/${path}`; apiCliGreetings.push(['Shop API', pathToUrl(shopApiPath)]); apiCliGreetings.push(['Admin API', pathToUrl(adminApiPath)]); apiCliGreetings.push( ...getPluginStartupMessages().map(({ label, path }) => [label, pathToUrl(path)] as const), ); const columnarGreetings = arrangeCliGreetingsInColumns(apiCliGreetings); const title = `Vendure server (v${VENDURE_VERSION}) now running on port ${port}`; const maxLineLength = Math.max(title.length, ...columnarGreetings.map(l => l.length)); const titlePadLength = title.length < maxLineLength ? Math.floor((maxLineLength - title.length) / 2) : 0; Logger.info('='.repeat(maxLineLength)); Logger.info(title.padStart(title.length + titlePadLength)); Logger.info('-'.repeat(maxLineLength).padStart(titlePadLength)); columnarGreetings.forEach(line => Logger.info(line)); Logger.info('='.repeat(maxLineLength)); } function arrangeCliGreetingsInColumns(lines: Array<readonly [string, string]>): string[] { const columnWidth = Math.max(...lines.map(l => l[0].length)) + 2; return lines.map(l => `${(l[0] + ':').padEnd(columnWidth)}${l[1]}`); } /** * Fix race condition when modifying DB * See: https://github.com/vendure-ecommerce/vendure/issues/152 */ function disableSynchronize(userConfig: Readonly<RuntimeVendureConfig>): Readonly<RuntimeVendureConfig> { const config = { ...userConfig, dbConnectionOptions: { ...userConfig.dbConnectionOptions, synchronize: false, } as DataSourceOptions, }; return config; } /** * Check that the Database tables exist. When running Vendure server & worker * concurrently for the first time, the worker will attempt to access the * DB tables before the server has populated them (assuming synchronize = true * in config). This method will use polling to check the existence of a known table * before allowing the rest of the worker bootstrap to continue. * @param worker */ async function validateDbTablesForWorker(worker: INestApplicationContext) { const connection: Connection = worker.get(getConnectionToken()); await new Promise<void>(async (resolve, reject) => { const checkForTables = async (): Promise<boolean> => { try { const adminCount = await connection.getRepository(Administrator).count(); return 0 < adminCount; } catch (e: any) { return false; } }; const pollIntervalMs = 5000; let attempts = 0; const maxAttempts = 10; let validTableStructure = false; Logger.verbose('Checking for expected DB table structure...'); while (!validTableStructure && attempts < maxAttempts) { attempts++; validTableStructure = await checkForTables(); if (validTableStructure) { Logger.verbose('Table structure verified'); resolve(); return; } Logger.verbose( `Table structure could not be verified, trying again after ${pollIntervalMs}ms (attempt ${attempts} of ${maxAttempts})`, ); await new Promise(resolve1 => setTimeout(resolve1, pollIntervalMs)); } reject('Could not validate DB table structure. Aborting bootstrap.'); }); } export function configureSessionCookies( app: INestApplication, userConfig: Readonly<RuntimeVendureConfig>, ): void { const { cookieOptions } = userConfig.authOptions; app.use( cookieSession({ ...cookieOptions, name: typeof cookieOptions?.name === 'string' ? cookieOptions.name : DEFAULT_COOKIE_NAME, }), ); // If the Admin API and Shop API should have specific cookies names if (typeof cookieOptions?.name === 'object') { const shopApiCookieName = cookieOptions.name.shop; const adminApiCookieName = cookieOptions.name.admin; const { shopApiPath, adminApiPath } = userConfig.apiOptions; app.use(`/${shopApiPath}`, cookieSession({ ...cookieOptions, name: shopApiCookieName })); app.use(`/${adminApiPath}`, cookieSession({ ...cookieOptions, name: adminApiCookieName })); } }
export { bootstrap, bootstrapWorker } from './bootstrap'; export { VENDURE_VERSION } from './version'; export { generateMigration, revertLastMigration, runMigrations } from './migrate'; export * from './api/index'; export * from './cache/index'; export * from './common/index'; export * from './config/index'; export * from './connection/index'; export * from './event-bus/index'; export * from './health-check/index'; export * from './job-queue/index'; export * from './plugin/index'; export * from './process-context/index'; export * from './entity/index'; export * from './data-import/index'; export * from './service/index'; export * from './i18n/index'; export * from './worker/index'; export * from '@vendure/common/lib/shared-types'; export { Permission, LanguageCode, CurrencyCode, AssetType, AdjustmentType, } from '@vendure/common/lib/generated-types';
/* eslint-disable no-console */ import fs from 'fs-extra'; import path from 'path'; import pc from 'picocolors'; import { Connection, createConnection, DataSourceOptions } from 'typeorm'; import { MysqlDriver } from 'typeorm/driver/mysql/MysqlDriver'; import { camelCase } from 'typeorm/util/StringUtils'; import { preBootstrapConfig } from './bootstrap'; import { resetConfig } from './config/config-helpers'; import { VendureConfig } from './config/vendure-config'; /** * @description * Configuration for generating a new migration script via {@link generateMigration}. * * @docsCategory migration */ export interface MigrationOptions { /** * @description * The name of the migration. The resulting migration script will be named * `{TIMESTAMP}-{name}.ts`. */ name: string; /** * @description * The output directory of the generated migration scripts. */ outputDir?: string; } /** * @description * Runs any pending database migrations. See [TypeORM migration docs](https://typeorm.io/#/migrations) * for more information about the underlying migration mechanism. * * @docsCategory migration */ export async function runMigrations(userConfig: Partial<VendureConfig>): Promise<string[]> { const config = await preBootstrapConfig(userConfig); const connection = await createConnection(createConnectionOptions(config)); const migrationsRan: string[] = []; try { const migrations = await disableForeignKeysForSqLite(connection, () => connection.runMigrations({ transaction: 'each' }), ); for (const migration of migrations) { log(pc.green(`Successfully ran migration: ${migration.name}`)); migrationsRan.push(migration.name); } } catch (e: any) { log(pc.red('An error occurred when running migrations:')); log(e.message); if (isRunningFromVendureCli()) { throw e; } else { process.exitCode = 1; } } finally { await checkMigrationStatus(connection); await connection.close(); resetConfig(); } return migrationsRan; } async function checkMigrationStatus(connection: Connection) { const builderLog = await connection.driver.createSchemaBuilder().log(); if (builderLog.upQueries.length) { log( pc.yellow( 'Your database schema does not match your current configuration. Generate a new migration for the following changes:', ), ); for (const query of builderLog.upQueries) { log(' - ' + pc.yellow(query.query)); } } } /** * @description * Reverts the last applied database migration. See [TypeORM migration docs](https://typeorm.io/#/migrations) * for more information about the underlying migration mechanism. * * @docsCategory migration */ export async function revertLastMigration(userConfig: Partial<VendureConfig>) { const config = await preBootstrapConfig(userConfig); const connection = await createConnection(createConnectionOptions(config)); try { await disableForeignKeysForSqLite(connection, () => connection.undoLastMigration({ transaction: 'each' }), ); } catch (e: any) { log(pc.red('An error occurred when reverting migration:')); log(e.message); if (isRunningFromVendureCli()) { throw e; } else { process.exitCode = 1; } } finally { await connection.close(); resetConfig(); } } /** * @description * Generates a new migration file based on any schema changes (e.g. adding or removing CustomFields). * See [TypeORM migration docs](https://typeorm.io/#/migrations) for more information about the * underlying migration mechanism. * * @docsCategory migration */ export async function generateMigration( userConfig: Partial<VendureConfig>, options: MigrationOptions, ): Promise<string | undefined> { const config = await preBootstrapConfig(userConfig); const connection = await createConnection(createConnectionOptions(config)); // TODO: This can hopefully be simplified if/when TypeORM exposes this CLI command directly. // See https://github.com/typeorm/typeorm/issues/4494 const sqlInMemory = await connection.driver.createSchemaBuilder().log(); const upSqls: string[] = []; const downSqls: string[] = []; let migrationName: string | undefined; // mysql is exceptional here because it uses ` character in to escape names in queries, that's why for mysql // we are using simple quoted string instead of template string syntax if (connection.driver instanceof MysqlDriver) { sqlInMemory.upQueries.forEach(upQuery => { upSqls.push( ' await queryRunner.query("' + upQuery.query.replace(new RegExp('"', 'g'), '\\"') + '", ' + JSON.stringify(upQuery.parameters) + ');', ); }); sqlInMemory.downQueries.forEach(downQuery => { downSqls.push( ' await queryRunner.query("' + downQuery.query.replace(new RegExp('"', 'g'), '\\"') + '", ' + JSON.stringify(downQuery.parameters) + ');', ); }); } else { sqlInMemory.upQueries.forEach(upQuery => { upSqls.push( ' await queryRunner.query(`' + upQuery.query.replace(new RegExp('`', 'g'), '\\`') + '`, ' + JSON.stringify(upQuery.parameters) + ');', ); }); sqlInMemory.downQueries.forEach(downQuery => { downSqls.push( ' await queryRunner.query(`' + downQuery.query.replace(new RegExp('`', 'g'), '\\`') + '`, ' + JSON.stringify(downQuery.parameters) + ');', ); }); } if (upSqls.length) { if (options.name) { const timestamp = new Date().getTime(); const filename = timestamp.toString() + '-' + options.name + '.ts'; const directory = options.outputDir; const fileContent = getTemplate(options.name as any, timestamp, upSqls, downSqls.reverse()); const outputPath = directory ? path.join(directory, filename) : path.join(process.cwd(), filename); await fs.ensureFile(outputPath); fs.writeFileSync(outputPath, fileContent); log(pc.green(`Migration ${pc.blue(outputPath)} has been generated successfully.`)); migrationName = outputPath; } } else { log(pc.yellow('No changes in database schema were found - cannot generate a migration.')); } await connection.close(); resetConfig(); return migrationName; } function createConnectionOptions(userConfig: Partial<VendureConfig>): DataSourceOptions { return Object.assign({ logging: ['query', 'error', 'schema'] }, userConfig.dbConnectionOptions, { subscribers: [], synchronize: false, migrationsRun: false, dropSchema: false, logger: 'advanced-console', }); } /** * There is a bug in TypeORM which causes db schema changes to fail with SQLite. This * is a work-around for the issue. * See https://github.com/typeorm/typeorm/issues/2576#issuecomment-499506647 */ async function disableForeignKeysForSqLite<T>(connection: Connection, work: () => Promise<T>): Promise<T> { const isSqLite = connection.options.type === 'sqlite' || connection.options.type === 'better-sqlite3'; if (isSqLite) { await connection.query('PRAGMA foreign_keys=OFF'); } const result = await work(); if (isSqLite) { await connection.query('PRAGMA foreign_keys=ON'); } return result; } /** * Gets contents of the migration file. */ function getTemplate(name: string, timestamp: number, upSqls: string[], downSqls: string[]): string { return `import {MigrationInterface, QueryRunner} from "typeorm"; export class ${camelCase(name, true)}${timestamp} implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise<any> { ${upSqls.join(` `)} } public async down(queryRunner: QueryRunner): Promise<any> { ${downSqls.join(` `)} } } `; } function log(message: string) { // If running from within the Vendure CLI, we allow the CLI app // to handle the logging. if (isRunningFromVendureCli()) { return; } console.log(message); } function isRunningFromVendureCli(): boolean { return process.env.VENDURE_RUNNING_IN_CLI != null; }