From 703d2f5df67f3e7b877ef2bc5e4cf81bc9dc9936 Mon Sep 17 00:00:00 2001 From: Erik <9088720+erikdstock@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:03:19 -0500 Subject: [PATCH] chore(EMI-1517): delete legacy shipping route (#14695) * remove legacy shipping route: - remove legacy apps/Order/Shipping code and replace with Shipping2 code - find/replace on _2 endings, eg Shipping2 > Shipping - remove route selector feature flag code - rename to remove the -2 endings --- src/Apps/Order/Components/AddressModal.tsx | 300 -- src/Apps/Order/Components/CheckoutAddress.tsx | 235 -- .../Order/Components/SavedAddressItem.tsx | 102 - src/Apps/Order/Components/SavedAddresses.tsx | 274 -- .../Components/ShippingArtaSummaryItem.tsx | 2 +- src/Apps/Order/Components/ShippingQuotes.tsx | 123 - .../TransactionDetailsSummaryItem.tsx | 2 +- .../__tests__/AddressModal.jest.tsx | 330 -- .../__tests__/CheckoutAddress.jest.tsx | 183 -- .../__tests__/SavedAddresses.jest.tsx | 178 -- .../__tests__/ShippingAddress.jest.tsx | 76 - .../__tests__/ShippingQuotes.jest.tsx | 155 - src/Apps/Order/Hooks/useOrderTracking.tsx | 2 +- src/Apps/Order/Mutations/CreateUserAddress.ts | 92 - src/Apps/Order/Mutations/DeleteUserAddress.ts | 62 - .../Order/Mutations/SelectShippingOption.ts | 45 - src/Apps/Order/Mutations/SetShipping.ts | 69 - src/Apps/Order/Mutations/UpdateUserAddress.ts | 63 - .../Mutations/UpdateUserDefaultAddress.ts | 57 - .../Components/AddressModal.tsx} | 12 +- .../Components/CollapseDetails.tsx | 2 +- .../Components/FulfillmentDetails.tsx | 14 +- .../Components/FulfillmentDetailsForm.tsx | 10 +- .../Components/SaveAndContinueButton.tsx | 4 +- .../Components/SavedAddressItem.tsx} | 12 +- .../Components/SavedAddresses.tsx} | 10 +- .../Components/ShippingQuotes.tsx} | 12 +- .../__tests__/AddressModal.jest.tsx} | 14 +- .../__tests__/FulfillmentDetailsForm.jest.tsx | 12 +- .../__tests__/SavedAddresses.jest.tsx} | 20 +- .../__tests__/useUserAddressUpdates.jest.ts | 8 +- .../Hooks/useHandleExchangeError.tsx | 2 +- .../Hooks/useHandleSaveFulfillmentDetails.ts | 8 +- .../Hooks/useSaveSelectedShippingQuote.tsx | 8 +- .../Hooks/useShippingContext.ts | 2 +- .../Hooks/useUserAddressUpdates.ts | 14 +- .../Mutations/useCreateSavedAddress.ts | 2 +- .../Mutations/useDeleteSavedAddress.ts | 2 +- .../Mutations/useSaveFulfillmentDetails.ts | 2 +- .../Mutations/useSelectShippingQuote.ts | 2 +- .../Mutations/useUpdateSavedAddress.ts | 2 +- .../Mutations/useUpdateUserDefaultAddress.ts | 2 +- .../ShippingContext.tsx | 8 +- .../Utils/computeOrderData.ts | 4 +- .../Utils/shippingUtils.ts | 0 src/Apps/Order/Routes/Shipping/index.tsx | 1198 +------ .../Order/Routes/Shipping2/ShippingRoute.tsx | 13 - .../Shipping2/__tests__/Shipping2.jest.tsx | 2611 --------------- src/Apps/Order/Routes/Shipping2/index.tsx | 162 - .../MutationResults/saveAddress.ts | 28 +- .../Order/Routes/__tests__/Shipping.jest.tsx | 2823 +++++++++-------- src/Apps/Order/Utils/shippingUtils.ts | 203 -- src/Apps/Order/orderRoutes.tsx | 9 +- src/Components/Address/AddressModalFields.tsx | 99 - ...ql.ts => AddressModalTestQuery.graphql.ts} | 24 +- .../CreateUserAddressMutation.graphql.ts | 275 -- .../DeleteUserAddressMutation.graphql.ts | 263 -- ...vedAddressesMutation_Test_Query.graphql.ts | 361 --- .../SavedAddressesRefetchQuery.graphql.ts | 279 -- ....ts => SavedAddressesTestQuery.graphql.ts} | 24 +- .../SavedAddresses_me.graphql.ts | 267 -- .../SelectShippingOptionMutation.graphql.ts | 399 --- .../SetShippingMutation.graphql.ts | 545 ---- .../Shipping2TestQuery.graphql.ts | 1488 --------- src/__generated__/Shipping2_me.graphql.ts | 87 - src/__generated__/Shipping2_order.graphql.ts | 78 - .../ShippingQuotes_Test_Query.graphql.ts | 371 --- ...hql.ts => ShippingQuotes_order.graphql.ts} | 16 +- .../ShippingQuotes_shippingQuotes.graphql.ts | 95 - .../ShippingTestQuery.graphql.ts | 521 ++- src/__generated__/Shipping_me.graphql.ts | 176 +- src/__generated__/Shipping_order.graphql.ts | 346 +- .../UpdateUserAddressMutation.graphql.ts | 276 -- ...pdateUserDefaultAddressMutation.graphql.ts | 263 -- .../orderRoutes_ShippingQuery.graphql.ts | 264 +- .../useCreateSavedAddressMutation.graphql.ts | 12 +- .../useDeleteSavedAddressMutation.graphql.ts | 12 +- ...eSaveFulfillmentDetailsMutation.graphql.ts | 12 +- .../useSelectShippingQuoteMutation.graphql.ts | 12 +- .../useUpdateSavedAddressMutation.graphql.ts | 12 +- ...pdateUserDefaultAddressMutation.graphql.ts | 12 +- 81 files changed, 2127 insertions(+), 14047 deletions(-) delete mode 100644 src/Apps/Order/Components/AddressModal.tsx delete mode 100644 src/Apps/Order/Components/CheckoutAddress.tsx delete mode 100644 src/Apps/Order/Components/SavedAddressItem.tsx delete mode 100644 src/Apps/Order/Components/SavedAddresses.tsx delete mode 100644 src/Apps/Order/Components/ShippingQuotes.tsx delete mode 100644 src/Apps/Order/Components/__tests__/AddressModal.jest.tsx delete mode 100644 src/Apps/Order/Components/__tests__/CheckoutAddress.jest.tsx delete mode 100644 src/Apps/Order/Components/__tests__/SavedAddresses.jest.tsx delete mode 100644 src/Apps/Order/Components/__tests__/ShippingAddress.jest.tsx delete mode 100644 src/Apps/Order/Components/__tests__/ShippingQuotes.jest.tsx delete mode 100644 src/Apps/Order/Mutations/CreateUserAddress.ts delete mode 100644 src/Apps/Order/Mutations/DeleteUserAddress.ts delete mode 100644 src/Apps/Order/Mutations/SelectShippingOption.ts delete mode 100644 src/Apps/Order/Mutations/SetShipping.ts delete mode 100644 src/Apps/Order/Mutations/UpdateUserAddress.ts delete mode 100644 src/Apps/Order/Mutations/UpdateUserDefaultAddress.ts rename src/Apps/Order/Routes/{Shipping2/Components/AddressModal2.tsx => Shipping/Components/AddressModal.tsx} (97%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Components/CollapseDetails.tsx (86%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Components/FulfillmentDetails.tsx (96%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Components/FulfillmentDetailsForm.tsx (98%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Components/SaveAndContinueButton.tsx (93%) rename src/Apps/Order/Routes/{Shipping2/Components/SavedAddressItem2.tsx => Shipping/Components/SavedAddressItem.tsx} (90%) rename src/Apps/Order/Routes/{Shipping2/Components/SavedAddresses2.tsx => Shipping/Components/SavedAddresses.tsx} (93%) rename src/Apps/Order/Routes/{Shipping2/Components/ShippingQuotes2.tsx => Shipping/Components/ShippingQuotes.tsx} (93%) rename src/Apps/Order/Routes/{Shipping2/Components/__tests__/AddressModal2.jest.tsx => Shipping/Components/__tests__/AddressModal.jest.tsx} (96%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Components/__tests__/FulfillmentDetailsForm.jest.tsx (98%) rename src/Apps/Order/Routes/{Shipping2/Components/__tests__/SavedAddresses2.jest.tsx => Shipping/Components/__tests__/SavedAddresses.jest.tsx} (94%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Hooks/__tests__/useUserAddressUpdates.jest.ts (98%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Hooks/useHandleExchangeError.tsx (97%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Hooks/useHandleSaveFulfillmentDetails.ts (93%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Hooks/useSaveSelectedShippingQuote.tsx (91%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Hooks/useShippingContext.ts (60%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Hooks/useUserAddressUpdates.ts (96%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Mutations/useCreateSavedAddress.ts (97%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Mutations/useDeleteSavedAddress.ts (95%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Mutations/useSaveFulfillmentDetails.ts (96%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Mutations/useSelectShippingQuote.ts (96%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Mutations/useUpdateSavedAddress.ts (97%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Mutations/useUpdateUserDefaultAddress.ts (96%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/ShippingContext.tsx (98%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Utils/computeOrderData.ts (98%) rename src/Apps/Order/Routes/{Shipping2 => Shipping}/Utils/shippingUtils.ts (100%) delete mode 100644 src/Apps/Order/Routes/Shipping2/ShippingRoute.tsx delete mode 100644 src/Apps/Order/Routes/Shipping2/__tests__/Shipping2.jest.tsx delete mode 100644 src/Apps/Order/Routes/Shipping2/index.tsx delete mode 100644 src/Apps/Order/Utils/shippingUtils.ts delete mode 100644 src/Components/Address/AddressModalFields.tsx rename src/__generated__/{AddressModal2TestQuery.graphql.ts => AddressModalTestQuery.graphql.ts} (77%) delete mode 100644 src/__generated__/CreateUserAddressMutation.graphql.ts delete mode 100644 src/__generated__/DeleteUserAddressMutation.graphql.ts delete mode 100644 src/__generated__/SavedAddressesMutation_Test_Query.graphql.ts delete mode 100644 src/__generated__/SavedAddressesRefetchQuery.graphql.ts rename src/__generated__/{SavedAddresses2TestQuery.graphql.ts => SavedAddressesTestQuery.graphql.ts} (70%) delete mode 100644 src/__generated__/SavedAddresses_me.graphql.ts delete mode 100644 src/__generated__/SelectShippingOptionMutation.graphql.ts delete mode 100644 src/__generated__/SetShippingMutation.graphql.ts delete mode 100644 src/__generated__/Shipping2TestQuery.graphql.ts delete mode 100644 src/__generated__/Shipping2_me.graphql.ts delete mode 100644 src/__generated__/Shipping2_order.graphql.ts delete mode 100644 src/__generated__/ShippingQuotes_Test_Query.graphql.ts rename src/__generated__/{ShippingQuotes2_order.graphql.ts => ShippingQuotes_order.graphql.ts} (92%) delete mode 100644 src/__generated__/ShippingQuotes_shippingQuotes.graphql.ts delete mode 100644 src/__generated__/UpdateUserAddressMutation.graphql.ts delete mode 100644 src/__generated__/UpdateUserDefaultAddressMutation.graphql.ts diff --git a/src/Apps/Order/Components/AddressModal.tsx b/src/Apps/Order/Components/AddressModal.tsx deleted file mode 100644 index 9bc1d7670f3..00000000000 --- a/src/Apps/Order/Components/AddressModal.tsx +++ /dev/null @@ -1,300 +0,0 @@ -import { useState } from "react" -import * as React from "react" -import { - Button, - Clickable, - Checkbox, - Flex, - Input, - ModalDialog, - Spacer, - Text, - Banner, - PhoneInput, -} from "@artsy/palette" -import { - SavedAddressType, - convertShippingAddressToMutationInput, -} from "Apps/Order/Utils/shippingUtils" -import { Formik, FormikHelpers, FormikProps } from "formik" -import { - removeEmptyKeys, - validateAddress, - validatePhoneNumber, -} from "Apps/Order/Utils/formValidators" -import { updateUserAddress } from "Apps/Order/Mutations/UpdateUserAddress" -import { createUserAddress } from "Apps/Order/Mutations/CreateUserAddress" -import { SavedAddresses_me$data } from "__generated__/SavedAddresses_me.graphql" -import { AddressModalFields } from "Components/Address/AddressModalFields" -import { useSystemContext } from "System/Hooks/useSystemContext" -import { updateUserDefaultAddress } from "Apps/Order/Mutations/UpdateUserDefaultAddress" -import { UpdateUserAddressMutation$data } from "__generated__/UpdateUserAddressMutation.graphql" -import { CreateUserAddressMutation$data } from "__generated__/CreateUserAddressMutation.graphql" -import { countries } from "Utils/countries" -import { userHasLabFeature } from "Utils/user" - -export interface ModalDetails { - addressModalTitle: string - addressModalAction: AddressModalAction -} - -export interface Props { - show: boolean - closeModal: () => void - address?: SavedAddressType - onSuccess: ( - address?: UpdateUserAddressMutation$data & CreateUserAddressMutation$data - ) => void - onDeleteAddress: (addressID: string) => void - onError: (message: string) => void - modalDetails?: ModalDetails - me: SavedAddresses_me$data -} - -const SERVER_ERROR_MAP: Record> = { - "Validation failed for phone: not a valid phone number": { - field: "phoneNumber", - message: "Please enter a valid phone number", - }, - "Validation failed: Phone not a valid phone number": { - field: "phoneNumber", - message: "Please enter a valid phone number", - }, -} - -export const GENERIC_FAIL_MESSAGE = - "Sorry there has been an issue saving your address. Please try again." - -export type AddressModalAction = "editUserAddress" | "createUserAddress" - -export const AddressModal: React.FC = ({ - show, - closeModal, - address, - onSuccess, - onDeleteAddress, - onError, - modalDetails, - me, -}) => { - const [_countryCode, setCountryCode] = useState("us") - - const title = modalDetails?.addressModalTitle - const createMutation = - modalDetails?.addressModalAction === "createUserAddress" - const validator = (values: any) => { - const validationResult = validateAddress(values) - const phoneValidation = validatePhoneNumber(values.phoneNumber) - const errors = Object.assign({}, validationResult.errors, { - phoneNumber: phoneValidation.error, - }) - const errorsTrimmed = removeEmptyKeys(errors) - return errorsTrimmed - } - const { relayEnvironment, user } = useSystemContext() - - const [createUpdateError, setCreateUpdateError] = useState( - null - ) - const [showDialog, setShowDialog] = useState(false) - - if (!relayEnvironment) return null - - const handleModalClose = () => { - closeModal() - setCreateUpdateError(null) - } - - return ( - <> - {show && ( - - - ) => { - const handleError = message => { - const userMessage: Record | null = - SERVER_ERROR_MAP[message] - - if (userMessage) { - actions.setFieldError(userMessage.field, userMessage.message) - } else { - setCreateUpdateError(GENERIC_FAIL_MESSAGE) - } - actions?.setSubmitting(false) - onError && onError(message) - } - - const handleSuccess = savedAddress => { - // update default address only if isDefault changed or new - // address marked ad default - if ( - values?.isDefault && - values?.isDefault !== address?.isDefault - ) { - updateUserDefaultAddress( - relayEnvironment, - savedAddress?.createUserAddress?.userAddressOrErrors - ?.internalID || address?.internalID, - () => { - onSuccess(savedAddress) - }, - onError - ) - } else { - onSuccess && onSuccess(savedAddress) - } - - setCreateUpdateError(null) - } - const addressInput = convertShippingAddressToMutationInput(values) - if (createMutation) { - createUserAddress( - relayEnvironment, - addressInput, - handleSuccess, - handleError, - me, - closeModal - ) - } else { - if (address?.internalID) { - updateUserAddress( - relayEnvironment, - address.internalID, - addressInput, - closeModal, - handleSuccess, - handleError - ) - } - } - }} - > - {(formik: FormikProps) => ( -
- {createUpdateError && ( - - {createUpdateError} - - )} - - - {user && - !userHasLabFeature(user, "Phone Number Validation") && ( - - )} - {user && userHasLabFeature(user, "Phone Number Validation") && ( - { - setCountryCode(selected.value) - }} - description="Only used for shipping purposes" - placeholder="Add phone number" - name="phoneNumber" - type="tel" - onChange={formik.handleChange} - onBlur={formik.handleBlur} - error={ - formik.touched.phoneNumber && formik.errors.phoneNumber - } - value={formik.values?.phoneNumber ?? ""} - /> - )} - - {(!address?.isDefault || createMutation) && ( - { - formik.setFieldValue("isDefault", selected) - }} - selected={formik.values?.isDefault} - data-test="setAsDefault" - > - Set as default - - )} - {!createMutation && ( - - setShowDialog(true)} - > - - Delete address - - - - )} - - - )} -
-
- )} - {showDialog && ( - setShowDialog(false)} - width="350px" - > - - This will remove this address from your saved addressess. - - - - - - - - - )} - - ) -} diff --git a/src/Apps/Order/Components/CheckoutAddress.tsx b/src/Apps/Order/Components/CheckoutAddress.tsx deleted file mode 100644 index f12d1f701da..00000000000 --- a/src/Apps/Order/Components/CheckoutAddress.tsx +++ /dev/null @@ -1,235 +0,0 @@ -import * as Yup from "yup" -import { Button, Column, GridColumns, Input, Message } from "@artsy/palette" -import { Formik, Form } from "formik" -import { FC } from "react" -import { - CountrySelect, - ALL_COUNTRY_SELECT_OPTIONS, -} from "Components/CountrySelect" - -export interface AddressFormValues { - name: string - country: string - addressLine1: string - city: string - region: string - postalCode: string - addressLine2: string -} - -export type AddressChangeHandler = ( - address: AddressFormValues, - key: keyof AddressFormValues -) => void - -export const INITIAL_ADDRESS = { - name: "", - country: "", - addressLine1: "", - addressLine2: "", - city: "", - postalCode: "", - region: "", -} - -const INITIAL_VALUES = { - attributes: INITIAL_ADDRESS, -} - -const VALIDATION_SCHEMA = Yup.object().shape({ - attributes: Yup.object().shape({ - name: Yup.string().required("Name is required"), - country: Yup.string().required("Country is required"), - addressLine1: Yup.string().required("Address is required"), - city: Yup.string().required("City is required"), - region: Yup.string().required("Region is required"), - postalCode: Yup.string().required("Postal Code is required"), - }), -}) - -export const CheckoutAddress: FC<{ - userCountry: string - onChange: AddressChangeHandler -}> = ({ userCountry, onChange }) => { - const userDefaultCountry = getCountryNameOrCode(userCountry, true) - - return ( - console.log(attributes)} - > - {({ values, errors, touched, status, handleChange, handleBlur }) => { - const changeEventHandler = ( - e: React.FormEvent, - key: keyof AddressFormValues - ) => { - handleChange(e) - onChange( - { - ...values.attributes, - [key]: e.currentTarget.value, - }, - key - ) - } - return ( -
- - - changeEventHandler(e, "name")} - onBlur={handleBlur} - error={touched.attributes?.name && errors.attributes?.name} - required - /> - - - - changeEventHandler(e, "country")} - onBlur={handleBlur} - error={ - touched.attributes?.country && errors.attributes?.country - } - required - /> - - - - changeEventHandler(e, "addressLine1")} - onBlur={handleBlur} - error={ - touched.attributes?.addressLine1 && - errors.attributes?.addressLine1 - } - required - /> - - - - changeEventHandler(e, "addressLine2")} - onBlur={handleBlur} - error={ - touched.attributes?.addressLine2 && - errors.attributes?.addressLine2 - } - /> - - - - changeEventHandler(e, "postalCode")} - onBlur={handleBlur} - error={ - touched.attributes?.postalCode && - errors.attributes?.postalCode - } - required - /> - - - - changeEventHandler(e, "city")} - onBlur={handleBlur} - error={touched.attributes?.city && errors.attributes?.city} - required - /> - - - - changeEventHandler(e, "region")} - onBlur={handleBlur} - error={ - touched.attributes?.region && errors.attributes?.region - } - required - /> - - - {status?.error && ( - - - {status.message || - "Something went wrong. Please try again."} - - - )} - - - - -
- ) - }} -
- ) -} - -// get country code or name by code or name -const getCountryNameOrCode = (userCountry: string, code: boolean): string => { - if (code) { - const countryCode = ALL_COUNTRY_SELECT_OPTIONS.find( - country => country.text === userCountry - )?.value - return countryCode || "US" - } - - const countryName = ALL_COUNTRY_SELECT_OPTIONS.find( - country => country.value === userCountry - )?.text - return countryName || "United States" -} diff --git a/src/Apps/Order/Components/SavedAddressItem.tsx b/src/Apps/Order/Components/SavedAddressItem.tsx deleted file mode 100644 index 1294f5aa6ab..00000000000 --- a/src/Apps/Order/Components/SavedAddressItem.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import { Flex, Text, RadioProps } from "@artsy/palette" -import * as React from "react" -import styled from "styled-components" -import { SavedAddresses_me$data } from "__generated__/SavedAddresses_me.graphql" - -type AddressNode = NonNullable< - NonNullable< - NonNullable< - NonNullable["edges"] - >[number] - >["node"] -> - -interface SavedAddressItemProps { - address: AddressNode - handleClickEdit: (number) => void - index: number -} - -export const SavedAddressItem: React.FC = ( - props -): React.ReactElement> => { - const handleClickEdit = props?.handleClickEdit - const index = props?.index - const address = props?.address - const addressLine1 = address?.addressLine1 - const addressLine2 = address?.addressLine2 - const addressLine3 = address?.addressLine3 - const city = address?.city - const country = address?.country - const name = address?.name - const phoneNumber = address?.phoneNumber - const postalCode = address?.postalCode - const region = address?.region - const formattedAddressLine = [city, region, country, postalCode] - .filter(el => el) - .join(", ") - const nameAndAddressLine = [name, addressLine1, addressLine2, addressLine3] - - return ( - - - {nameAndAddressLine.length > 0 && - nameAndAddressLine.map( - (line: string, index: number) => - line && ( - - - {line} - - - ) - )} - - {formattedAddressLine} - - - {phoneNumber} - - - { - event.preventDefault() - event.stopPropagation() - - handleClickEdit(index) - }} - onKeyPress={event => { - event.preventDefault() - event.stopPropagation() - - event.key === "Enter" && handleClickEdit(index) - }} - data-test="editAddressInShipping" - > - Edit - - - ) -} - -const EditButton = styled(Text)` - &:hover { - text-decoration: underline; - } -` diff --git a/src/Apps/Order/Components/SavedAddresses.tsx b/src/Apps/Order/Components/SavedAddresses.tsx deleted file mode 100644 index c409ac267aa..00000000000 --- a/src/Apps/Order/Components/SavedAddresses.tsx +++ /dev/null @@ -1,274 +0,0 @@ -import { RadioGroup, BorderedRadio, Spacer, Clickable } from "@artsy/palette" -import { useEffect, useState } from "react" -import * as React from "react" -import { createRefetchContainer, graphql, RelayRefetchProp } from "react-relay" -import { SavedAddresses_me$data } from "__generated__/SavedAddresses_me.graphql" -import { AddressModal, ModalDetails } from "Apps/Order/Components/AddressModal" -import { CommitMutation } from "Apps/Order/Utils/commitMutation" -import createLogger from "Utils/logger" -import { SavedAddressItem } from "Apps/Order/Components/SavedAddressItem" -import { deleteUserAddress } from "Apps/Order/Mutations/DeleteUserAddress" -import { useSystemContext } from "System/Hooks/useSystemContext" -import { compact } from "lodash" -import { extractNodes } from "Utils/extractNodes" -import { UpdateUserAddressMutation$data } from "__generated__/UpdateUserAddressMutation.graphql" -import { CreateUserAddressMutation$data } from "__generated__/CreateUserAddressMutation.graphql" -import { useTracking } from "react-tracking" -import { ActionType, ContextModule, OwnerType } from "@artsy/cohesion" -import styled from "styled-components" -import { themeGet } from "@styled-system/theme-get" - -export const NEW_ADDRESS = "NEW_ADDRESS" -const PAGE_SIZE = 30 - -interface SavedAddressesProps { - onChangeAddressCount?: (active?: number) => void - me: SavedAddresses_me$data - onSelect?: (string) => void - commitMutation?: CommitMutation - relay: RelayRefetchProp - addressCount?: number - onAddressDelete?: (removedAddressId: string) => void - onAddressCreate?: ( - address: CreateUserAddressMutation$data["createUserAddress"] - ) => void - onAddressEdit?: ( - address: UpdateUserAddressMutation$data["updateUserAddress"] - ) => void - selectedAddress?: string - onShowToast?: (isShow: boolean, action: string) => void -} - -type Address = NonNullable< - NonNullable< - NonNullable< - NonNullable["edges"] - >[0] - >["node"] -> - -const defaultAddressIndex = (addressList: Address[]) => { - const items = compact(addressList) - - if (!items || items.length == 0) { - return - } - - const defaultAddressID = items.find(node => node.isDefault)?.internalID - - return defaultAddressID || items[0].internalID -} - -const SavedAddresses: React.FC = props => { - const { trackEvent } = useTracking() - const [modalDetails, setModalDetails] = useState() - const [showAddressModal, setShowAddressModal] = useState(false) - const [address, setAddress] = useState
(null) - const logger = createLogger("SavedAddresses.tsx") - const { - onSelect, - onChangeAddressCount, - me, - relay, - onAddressDelete, - onAddressCreate, - selectedAddress, - onShowToast, - onAddressEdit, - } = props - - useEffect(() => { - onChangeAddressCount && - onChangeAddressCount(me.addressConnection?.totalCount) - // FIXME: Remove this disable - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [me.addressConnection?.totalCount]) - const addressList = extractNodes(me.addressConnection) - const { relayEnvironment } = useSystemContext() - - const refetchAddresses = (refetchSuccessCallback?: () => void) => { - relay.refetch( - { - first: PAGE_SIZE, - }, - null, - error => { - if (error) { - logger.error(error) - } else { - refetchSuccessCallback && refetchSuccessCallback() - } - } - ) - } - - const onError = (message: string) => { - logger.error(message) - } - - const handleDeleteAddress = async (addressID: string) => { - let response = await deleteUserAddress( - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - relayEnvironment!, - addressID, - () => { - refetchAddresses(() => { - // Execute address delete callback after address deleted - // and list of addresses updated - onAddressDelete && onAddressDelete(addressID) - }) - }, - onError - ) - if (!response.deleteUserAddress?.userAddressOrErrors.errors) { - onShowToast && onShowToast(true, "Deleted") - } - } - - const handleEditAddress = (address: Address, index: number) => { - setShowAddressModal(true) - setModalDetails({ - addressModalTitle: "Edit address", - addressModalAction: "editUserAddress", - }) - setAddress(address) - } - - const createOrUpdateAddressSuccess = ( - address?: UpdateUserAddressMutation$data & CreateUserAddressMutation$data - ) => { - refetchAddresses(() => { - if (address?.createUserAddress) { - onAddressCreate && onAddressCreate(address.createUserAddress) - } else if (address?.updateUserAddress) { - onAddressEdit && onAddressEdit(address.updateUserAddress) - } - }) - - onShowToast && onShowToast(true, "Saved") - } - - const trackAddAddressClick = () => { - trackEvent({ - action: ActionType.clickedAddNewShippingAddress, - context_page_owner_type: OwnerType.ordersShipping, - context_module: ContextModule.ordersShipping, - }) - } - - const addAddressButton = ( - <> - {addressList.length > 0 && ( - { - trackAddAddressClick() - setShowAddressModal(true), - setModalDetails({ - addressModalTitle: "Add address", - addressModalAction: "createUserAddress", - }) - }} - > - Add a new address - - )} - setShowAddressModal(false)} - address={address || undefined} - onSuccess={createOrUpdateAddressSuccess} - onDeleteAddress={handleDeleteAddress} - onError={onError} - me={me} - /> - - ) - - const addressItems = compact(addressList).map((address, index) => { - return ( - - handleEditAddress(address, index)} - /> - - ) - }) - - return ( - <> - - {addressItems} - - {addAddressButton} - - - ) -} - -export const SavedAddressesFragmentContainer = createRefetchContainer( - SavedAddresses, - { - me: graphql` - fragment SavedAddresses_me on Me - @argumentDefinitions( - first: { type: "Int", defaultValue: 30 } - last: { type: "Int" } - after: { type: "String" } - before: { type: "String" } - ) { - id - addressConnection( - first: $first - last: $last - before: $before - after: $after - ) @connection(key: "SavedAddresses_addressConnection") { - totalCount - edges { - node { - id - internalID - addressLine1 - addressLine2 - addressLine3 - city - country - isDefault - name - phoneNumber - postalCode - region - } - } - } - } - `, - }, - graphql` - query SavedAddressesRefetchQuery { - me { - ...SavedAddresses_me - } - } - ` -) - -const AddAddressButton = styled(Clickable)` - text-decoration: underline; - &:hover { - color: ${themeGet("colors.blue100")}; - } -` diff --git a/src/Apps/Order/Components/ShippingArtaSummaryItem.tsx b/src/Apps/Order/Components/ShippingArtaSummaryItem.tsx index 19558024ddd..3b3c63bc60f 100644 --- a/src/Apps/Order/Components/ShippingArtaSummaryItem.tsx +++ b/src/Apps/Order/Components/ShippingArtaSummaryItem.tsx @@ -3,11 +3,11 @@ import { StepSummaryItem, StepSummaryItemProps, } from "Components/StepSummaryItem" -import { shippingQuoteDisplayNames } from "Apps/Order/Components/ShippingQuotes" import * as React from "react" import { createFragmentContainer, graphql } from "react-relay" import { Text } from "@artsy/palette" import { startCase } from "lodash" +import { shippingQuoteDisplayNames } from "Apps/Order/Routes/Shipping/Components/ShippingQuotes" interface ShippingArtaSummaryItemProps { order: ShippingArtaSummaryItem_order$data diff --git a/src/Apps/Order/Components/ShippingQuotes.tsx b/src/Apps/Order/Components/ShippingQuotes.tsx deleted file mode 100644 index 088d3fcb7a6..00000000000 --- a/src/Apps/Order/Components/ShippingQuotes.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import * as React from "react" -import { - BorderedRadio, - BoxProps, - Column, - Flex, - GridColumns, - RadioGroup, - Text, -} from "@artsy/palette" -import { createFragmentContainer, graphql } from "react-relay" -import { ShippingQuotes_shippingQuotes$data } from "__generated__/ShippingQuotes_shippingQuotes.graphql" - -export const shippingQuoteDescriptions = { - // Domestic shipping quotes - ground: - "Delivers to your door in 3-5 business days once packaged and shipped via a common carrier.", - second_day_air: - "Delivers to your door in 2 business days once packaged and shipped via a common carrier.", - next_day_air: - "Delivers to your door in 1 business day once packaged and shipped via a common carrier.", - select: - "Inside delivery shipped via a white glove shipping service with custom packaging. Delivery timing variable.", - premium: - "Room-of-choice delivery handled via trained technicians with specialized packaging and climate-controlled transportation. Recommended for high-value works. Delivery timing variable.", - // International shipping quotes - economy: - "Delivers to your door in 5-7 business days once packaged and shipped via a common carrier, depending on destination and prompt payment of applicable duties and taxes.", - standard: - "Delivers to your door in 3-5 business days once packaged and shipped via a common carrier, depending on destination and prompt payment of applicable duties and taxes.", - priority: - "Delivers to your door in 2-4 business days once packaged and shipped via a common carrier, depending on destination and prompt payment of applicable duties and taxes.", -} - -export const shippingQuoteDisplayNames = { - // Domestic shipping quotes - ground: "Standard", - second_day_air: "Express", - next_day_air: "Rush", - select: "Premium", - premium: "White Glove", - // International shipping quotes - economy: "Saver", - standard: "Standard", - priority: "Priority", -} - -export interface ShippingQuotesProps extends BoxProps { - onSelect: (shippingQuoteId: string) => void - shippingQuotes: ShippingQuotes_shippingQuotes$data - selectedShippingQuoteId?: string -} - -export const ShippingQuotes: React.FC = ({ - onSelect, - shippingQuotes, - selectedShippingQuoteId, - ...rest -}) => { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - const quotes = shippingQuotes?.map(quote => quote.node!) - - if (!quotes || !quotes.length) { - return null - } - - return ( - - {quotes.map(shippingQuote => { - const { id, price, typeName } = shippingQuote - const description = shippingQuoteDescriptions[typeName] - const displayName = shippingQuoteDisplayNames[typeName] - - return ( - - - - - - {displayName} - - {description} - - - - {price} - - - - - - ) - })} - - ) -} - -export const ShippingQuotesFragmentContainer = createFragmentContainer( - ShippingQuotes, - { - shippingQuotes: graphql` - fragment ShippingQuotes_shippingQuotes on CommerceShippingQuoteEdge - @relay(plural: true) { - node { - id - isSelected - price(precision: 2) - priceCents - typeName - } - } - `, - } -) diff --git a/src/Apps/Order/Components/TransactionDetailsSummaryItem.tsx b/src/Apps/Order/Components/TransactionDetailsSummaryItem.tsx index 25ae3608c23..be20877a60c 100644 --- a/src/Apps/Order/Components/TransactionDetailsSummaryItem.tsx +++ b/src/Apps/Order/Components/TransactionDetailsSummaryItem.tsx @@ -11,7 +11,7 @@ import { extractNodes } from "Utils/extractNodes" import { DownloadAppBadges } from "Components/DownloadAppBadges/DownloadAppBadges" import { ContextModule } from "@artsy/cohesion" import { appendCurrencySymbol } from "Apps/Order/Utils/currencyUtils" -import { shippingQuoteDisplayNames } from "Apps/Order/Components/ShippingQuotes" +import { shippingQuoteDisplayNames } from "Apps/Order/Routes/Shipping/Components/ShippingQuotes" import { RouterLink } from "System/Components/RouterLink" import { withSystemContext } from "System/Contexts/SystemContext" diff --git a/src/Apps/Order/Components/__tests__/AddressModal.jest.tsx b/src/Apps/Order/Components/__tests__/AddressModal.jest.tsx deleted file mode 100644 index 420755629ee..00000000000 --- a/src/Apps/Order/Components/__tests__/AddressModal.jest.tsx +++ /dev/null @@ -1,330 +0,0 @@ -import { commitMutation as _commitMutation } from "react-relay" -import { - AddressModal, - Props, - GENERIC_FAIL_MESSAGE, -} from "Apps/Order/Components/AddressModal" -import { validAddress } from "Components/__tests__/Utils/addressForm" -import { SavedAddressType } from "Apps/Order/Utils/shippingUtils" -import { useSystemContext } from "System/Hooks/useSystemContext" -import { - updateAddressFailure, - updateAddressSuccess, -} from "Apps/Order/Routes/__fixtures__/MutationResults/saveAddress" -import { mount } from "DevTools/mountWithMockBoot" - -jest.mock("System/Hooks/useSystemContext") -jest.mock("Utils/Hooks/useMatchMedia", () => ({ - __internal__useMatchMedia: () => ({}), -})) -jest.mock("Utils/user", () => ({ - ...jest.requireActual("Utils/user"), - userHasLabFeature: jest.fn(), -})) - -const errorBoxQuery = "Banner[data-test='credit-card-error']" - -// needed for modal contentAnimation -const tick = () => new Promise(resolve => setTimeout(resolve, 0)) - -const commitMutation = _commitMutation as jest.Mock - -const savedAddress: SavedAddressType = { - ...validAddress, - phoneNumber: "8475937743", - id: "id", - internalID: "internal-id", - addressLine3: null, - isDefault: false, -} - -let testAddressModalProps: Props - -function getWrapper(props: Props) { - return mount() -} - -describe("AddressModal", () => { - beforeEach(() => { - testAddressModalProps = { - show: true, - address: savedAddress, - onSuccess: jest.fn(), - onError: jest.fn(), - onDeleteAddress: jest.fn(), - modalDetails: { - addressModalTitle: "Edit address", - addressModalAction: "editUserAddress", - }, - me: { - id: "1234", - addressConnection: { - totalCount: 0, - edges: [], - }, - - " $fragmentType": "SavedAddresses_me", - }, - closeModal: jest.fn(), - } - commitMutation.mockReset() - ;(useSystemContext as jest.Mock).mockImplementation(() => { - return { - user: { lab_features: [] }, - isLoggedIn: true, - relayEnvironment: {}, - } - }) - }) - - it("renders EditModal with the title, input fields and buttons", () => { - const wrapper = getWrapper(testAddressModalProps) - - expect(wrapper.text()).toContain("Edit address") - expect(wrapper.find("input").length).toBe(7) - expect(wrapper.find("select").length).toBe(1) - - expect(wrapper.find("Checkbox[data-test='setAsDefault']").length).toBe(1) - expect(wrapper.find("Clickable[data-test='deleteButton']").length).toBe(1) - expect(wrapper.find("Button[data-test='saveButton']").length).toBe(1) - }) - - it("renders EditModal without checkbox when address is default", () => { - const wrapper = getWrapper({ - ...testAddressModalProps, - address: { - ...savedAddress, - isDefault: true, - }, - }) - expect(wrapper.text()).toContain("Edit address") - expect(wrapper.find("Checkbox[data-test='setAsDefault']").length).toBe(0) - }) - - it("renders AddModal with the title, input fields, checkbox and button", () => { - const wrapper = getWrapper({ - ...testAddressModalProps, - modalDetails: { - addressModalTitle: "Add address", - addressModalAction: "createUserAddress", - }, - }) - expect(wrapper.text()).toContain("Add address") - expect(wrapper.find("input").length).toBe(7) - expect(wrapper.find("select").length).toBe(1) - - expect(wrapper.find("Checkbox[data-test='setAsDefault']").length).toBe(1) - expect(wrapper.find("Clickable[data-test='deleteButton']").length).toBe(0) - expect(wrapper.find("Button[data-test='saveButton']").length).toBe(1) - }) - - it("clicking the delete button spawns a correct dialog", () => { - const wrapper = getWrapper(testAddressModalProps) - const deleteButton = wrapper.find("Clickable[data-test='deleteButton']") - deleteButton.simulate("click") - const dialog = wrapper.find("ModalDialog[data-test='deleteAddressDialog']") - - setTimeout(() => { - expect(dialog).toHaveLength(1) - expect(dialog.text()).toContain("Delete address?") - expect(dialog.text()).toContain( - "This will remove this address from your saved addresses" - ) - const dialogDelete = dialog.find("Button").at(1) - expect(dialogDelete.text()).toContain("Delete") - const dialogCancel = dialog.find("Button").at(0) - expect(dialogCancel.text()).toContain("Cancel") - }, 0) - }) - - it("when the dialog is confirmed, the delete action happens", () => { - const wrapper = getWrapper(testAddressModalProps) - const deleteButton = wrapper.find("Clickable[data-test='deleteButton']") - deleteButton.simulate("click") - const dialog = wrapper.find("ModalDialog[data-test='deleteAddressDialog']") - const dialogDelete = dialog.find("Button").at(1) - dialogDelete.simulate("click") - - setTimeout(() => { - expect(wrapper.find(AddressModal).props().onDeleteAddress).toBeCalled() - expect(wrapper.find(AddressModal).props().closeModal).toBeCalled() - }, 0) - }) - - it("when the dialog is cancelled, the delete action doesn't happen", () => { - const wrapper = getWrapper(testAddressModalProps) - const deleteButton = wrapper.find("Clickable[data-test='deleteButton']") - deleteButton.simulate("click") - const dialog = wrapper.find("ModalDialog[data-test='deleteAddressDialog']") - const dialogCancel = dialog.find("Button").at(0) - dialogCancel.simulate("click") - - setTimeout(() => { - expect( - wrapper.find(AddressModal).props().onDeleteAddress - ).not.toBeCalled() - expect(wrapper.find(AddressModal).props().closeModal).not.toBeCalled() - }, 0) - }) - - describe("update mode", () => { - it("creates address when form is submitted with valid values", async () => { - const wrapper = getWrapper(testAddressModalProps) - - commitMutation.mockImplementationOnce((_environment, { onCompleted }) => { - onCompleted(updateAddressSuccess) - }) - - const formik = wrapper.find("Formik").first() - // @ts-expect-error PLEASE_FIX_ME_STRICT_NULL_CHECK_MIGRATION - formik.props().onSubmit(validAddress as any) - - await wrapper.update() - - expect( - commitMutation.mock.calls[0][1].mutation.default.params.name - ).toEqual("UpdateUserAddressMutation") - - expect(commitMutation.mock.calls[0][1]).toMatchObject({ - variables: { - input: { - attributes: { - ...validAddress, - }, - }, - }, - }) - - expect(wrapper.find(AddressModal).props().onSuccess).toHaveBeenCalled() - expect(wrapper.find(AddressModal).props().closeModal).toHaveBeenCalled() - }) - - it("shows generic error when mutation fails", async () => { - let wrapper = getWrapper(testAddressModalProps) - - commitMutation.mockImplementationOnce((_, { onError }) => - onError(new TypeError("Network request failed")) - ) - - const formik = wrapper.find("Formik").first() - // @ts-expect-error PLEASE_FIX_ME_STRICT_NULL_CHECK_MIGRATION - formik.props().onSubmit(validAddress as any) - - await wrapper.update() - - expect(commitMutation.mock.calls[0][1]).toMatchObject({ - variables: { - input: { - attributes: { - ...validAddress, - }, - }, - }, - }) - - await tick() - - expect(wrapper.find(AddressModal).props().onError).toHaveBeenCalled() - - expect(wrapper.find(errorBoxQuery).text()).toContain(GENERIC_FAIL_MESSAGE) - }) - it("shows generic error when mutation returns error", async () => { - let wrapper = getWrapper(testAddressModalProps) - - commitMutation.mockImplementationOnce((_, { onCompleted }) => - onCompleted(updateAddressFailure) - ) - - const formik = wrapper.find("Formik").first() - // @ts-expect-error PLEASE_FIX_ME_STRICT_NULL_CHECK_MIGRATION - formik.props().onSubmit(validAddress as any) - - await wrapper.update() - - await tick() - - expect(wrapper.find(errorBoxQuery).text()).toContain(GENERIC_FAIL_MESSAGE) - }) - - it("sets formik error when address mutation returns phone validation error", async () => { - let wrapper = getWrapper(testAddressModalProps) - - commitMutation.mockImplementationOnce((_, { onCompleted }) => - onCompleted({ - updateUserAddress: { - userAddressOrErrors: { - errors: [ - { - message: - "Validation failed for phone: not a valid phone number", - }, - ], - }, - }, - }) - ) - - const formik = wrapper.find("Formik").first() - const setFieldError = jest.fn() - - const onSubmit = formik.props().onSubmit as any - onSubmit(validAddress as any, { - setFieldError: setFieldError, - setSubmitting: jest.fn(), - }) - - await wrapper.update() - - await tick() - - expect(setFieldError).toHaveBeenCalledWith( - "phoneNumber", - "Please enter a valid phone number" - ) - }) - }) -}) - -describe("AddressModal feature flag", () => { - beforeEach(() => { - testAddressModalProps = { - show: true, - address: savedAddress, - onSuccess: jest.fn(), - onError: jest.fn(), - onDeleteAddress: jest.fn(), - modalDetails: { - addressModalTitle: "Edit address", - addressModalAction: "editUserAddress", - }, - me: { - id: "1234", - addressConnection: { - totalCount: 0, - edges: [], - }, - - " $fragmentType": "SavedAddresses_me", - }, - closeModal: jest.fn(), - } - commitMutation.mockReset() - ;(useSystemContext as jest.Mock).mockImplementation(() => { - return { - user: { lab_features: ["Phone Number Validation"] }, - isLoggedIn: true, - relayEnvironment: {}, - } - }) - }) - - // FIXME: Palette 18.16.1 breaks this spec somehow - // https://github.com/artsy/palette/pull/1111 - // https://github.com/artsy/palette/pull/1112 - it.skip("renders dropdown phone input field when feat flag present", () => { - const wrapper = getWrapper(testAddressModalProps) - expect( - wrapper.find("Input[data-test='phoneInputWithoutValidationFlag']").length - ).toBe(0) - }) -}) diff --git a/src/Apps/Order/Components/__tests__/CheckoutAddress.jest.tsx b/src/Apps/Order/Components/__tests__/CheckoutAddress.jest.tsx deleted file mode 100644 index 9511425d82c..00000000000 --- a/src/Apps/Order/Components/__tests__/CheckoutAddress.jest.tsx +++ /dev/null @@ -1,183 +0,0 @@ -import { screen, render, fireEvent } from "@testing-library/react" -import { Formik } from "formik" -import { - CheckoutAddress, - AddressFormValues, - INITIAL_ADDRESS, -} from "Apps/Order/Components/CheckoutAddress" - -jest.mock("formik", () => ({ - ...jest.requireActual("formik"), - Form: ({ children }) => children, - Formik: jest.fn(), -})) - -const defaultFormikProps = { - errors: {}, - touched: {}, - isSubmitting: false, - isValid: false, - handleChange: e => null, - values: { - attributes: INITIAL_ADDRESS, - }, -} - -const mockOnChange = jest.fn( - (address: AddressFormValues, key: keyof AddressFormValues) => null -) - -const checkoutAddressProps = { - userCountry: "", - onChange: mockOnChange, -} - -const fireChangeEvent = (input: HTMLElement, value: string) => { - fireEvent.change(input, { - target: { value: value }, - }) -} - -describe("CheckoutAddress form", () => { - const mockFormik = Formik as jest.Mock - - beforeEach(() => { - ;(mockFormik as React.FC).displayName = "Formik" - mockFormik.mockImplementation(({ children }) => { - return children(defaultFormikProps) - }) - - render() - }) - - it("renders each form input with correct title", () => { - expect(screen.getByText("Add full name")).toBeInTheDocument() - expect(screen.getByText("Country")).toBeInTheDocument() - expect(screen.getByText("Address line 1")).toBeInTheDocument() - expect(screen.getByText("Address line 2 (optional)")).toBeInTheDocument() - expect(screen.getByText("Postal Code")).toBeInTheDocument() - expect(screen.getByText("City")).toBeInTheDocument() - expect(screen.getByText("State, Province, or Region")).toBeInTheDocument() - }) - - it("renders correct placeholders", () => { - expect(screen.queryByPlaceholderText("Enter name")).toBeInTheDocument() - expect( - screen.queryByPlaceholderText("Add street address") - ).toBeInTheDocument() - expect( - screen.queryByPlaceholderText("Add apt, floor, suite, etc.") - ).toBeInTheDocument() - expect(screen.queryByPlaceholderText("Add postal code")).toBeInTheDocument() - expect(screen.queryByPlaceholderText("Add city")).toBeInTheDocument() - expect( - screen.queryByPlaceholderText("Add state, province, or region") - ).toBeInTheDocument() - }) - - describe("change handler fired correctly", () => { - it("for name", () => { - const nameInput = screen.getByLabelText("address-name-input") - fireChangeEvent(nameInput, "John Doe") - expect(mockOnChange).toHaveBeenCalledWith( - { - name: "John Doe", - country: "", - addressLine1: "", - addressLine2: "", - city: "", - postalCode: "", - region: "", - }, - "name" - ) - }) - - it("for 1st address line", () => { - const addressLineInput = screen.getByLabelText("address-street-input") - fireChangeEvent(addressLineInput, "Weserstr. 175") - expect(mockOnChange).toHaveBeenCalledWith( - { - name: "", - country: "", - addressLine1: "Weserstr. 175", - addressLine2: "", - city: "", - postalCode: "", - region: "", - }, - "addressLine1" - ) - }) - - it("for 2nd address line", () => { - const addressLineInput2nd = screen.getByLabelText( - "address-optional-second-line-input" - ) - fireChangeEvent(addressLineInput2nd, "Hinterhaus, links") - expect(mockOnChange).toHaveBeenCalledWith( - { - name: "", - country: "", - addressLine1: "", - addressLine2: "Hinterhaus, links", - city: "", - postalCode: "", - region: "", - }, - "addressLine2" - ) - }) - - it("for postal code", () => { - const postalCodeInput = screen.getByLabelText("address-postal-code-input") - fireChangeEvent(postalCodeInput, "12045") - expect(mockOnChange).toHaveBeenCalledWith( - { - name: "", - country: "", - addressLine1: "", - addressLine2: "", - city: "", - postalCode: "12045", - region: "", - }, - "postalCode" - ) - }) - - it("for city", () => { - const cityInput = screen.getByLabelText("address-city-input") - fireChangeEvent(cityInput, "Berlin") - expect(mockOnChange).toHaveBeenCalledWith( - { - name: "", - country: "", - addressLine1: "", - addressLine2: "", - city: "Berlin", - postalCode: "", - region: "", - }, - "city" - ) - }) - - it("for region", () => { - const regionInput = screen.getByLabelText("address-state-or-region-input") - fireChangeEvent(regionInput, "Berlin") - expect(mockOnChange).toHaveBeenCalledWith( - { - name: "", - country: "", - addressLine1: "", - addressLine2: "", - city: "", - postalCode: "", - region: "Berlin", - }, - "region" - ) - }) - }) -}) diff --git a/src/Apps/Order/Components/__tests__/SavedAddresses.jest.tsx b/src/Apps/Order/Components/__tests__/SavedAddresses.jest.tsx deleted file mode 100644 index 0d7b28cc7cf..00000000000 --- a/src/Apps/Order/Components/__tests__/SavedAddresses.jest.tsx +++ /dev/null @@ -1,178 +0,0 @@ -import { graphql } from "react-relay" -import { SavedAddressesFragmentContainer } from "./../SavedAddresses" -import { setupTestWrapper } from "DevTools/setupTestWrapper" -import { AddressModal } from "Apps/Order/Components/AddressModal" -import { RootTestPage } from "DevTools/RootTestPage" -import { userAddressMutation } from "Apps/__tests__/Fixtures/Order/MutationResults" -import { SavedAddressItem } from "Apps/Order/Components/SavedAddressItem" -import { useTracking } from "react-tracking" - -jest.unmock("react-relay") -jest.mock("react-tracking") -jest.mock("Utils/Hooks/useMatchMedia", () => ({ - __internal__useMatchMedia: () => ({}), -})) - -class SavedAddressesTestPage extends RootTestPage { - async selectEdit() { - this.find(`[data-test="editAddressInShipping"]`) - .first() - .simulate("click", { preventDefault: () => {} }) - await this.update() - } -} - -describe("Saved Addresses", () => { - const trackEvent = jest.fn() - - beforeAll(() => { - ;(useTracking as jest.Mock).mockImplementation(() => ({ - trackEvent, - })) - }) - - const { getWrapper } = setupTestWrapper({ - Component: (props: any) => , - query: graphql` - query SavedAddressesMutation_Test_Query @relay_test_operation { - me { - ...SavedAddresses_me - } - } - `, - }) - - describe("Saved Addresses mutations", () => { - it("edits the saved addresses after calling edit address mutation", async () => { - const { wrapper } = getWrapper({ Me: () => userAddressMutation.me }) - const page = new SavedAddressesTestPage(wrapper) - page.selectEdit() - const addresses = page.find(SavedAddressItem).first().text() - expect(addresses).toBe( - "Test Name1 Main StMadrid, Spain, 28001555-555-5555Edit" - ) - }) - }) - - describe("Saved Addresses", () => { - it("renders modal when button is clicked", () => { - const { wrapper } = getWrapper({ - Me: () => ({ - addressConnection: mockAddressConnection, - }), - }) - const button = wrapper.find("[data-test='shippingButton']").first() - const modal = wrapper.find(AddressModal) - expect(modal.props().show).toBe(false) - button.simulate("click") - - expect(modal).toHaveLength(1) - }) - - it("add address modal with expected props", () => { - const { wrapper } = getWrapper({ - Me: () => ({ - addressConnection: mockAddressConnection, - }), - }) - const button = wrapper.find("[data-test='shippingButton']").first() - expect(wrapper.find(AddressModal).props().show).toBe(false) - button.simulate("click") - - setTimeout(() => { - expect(wrapper.find(AddressModal).props().modalDetails).toEqual({ - addressModalTitle: "Add address", - addressModalAction: "createUserAddress", - }) - }, 0) - }) - - it("render an add address button", () => { - const { wrapper } = getWrapper({ - Me: () => ({ - addressConnection: mockAddressConnection, - }), - }) - expect(wrapper.find("[data-test='shippingButton']").first()).toHaveLength( - 1 - ) - }) - - describe("when clicking on the add address button", () => { - it("tracks an analytics event", () => { - const { wrapper } = getWrapper({ - Me: () => ({ - addressConnection: mockAddressConnection, - }), - }) - - wrapper.find("[data-test='shippingButton']").first().simulate("click") - - expect(trackEvent).toHaveBeenCalled() - expect(trackEvent.mock.calls[0]).toMatchInlineSnapshot(` - [ - { - "action": "clickedAddNewShippingAddress", - "context_module": "ordersShipping", - "context_page_owner_type": "orders-shipping", - }, - ] - `) - }) - }) - - it("renders radio buttons with addresses", () => { - const { wrapper } = getWrapper({ - Me: () => ({ - addressConnection: mockAddressConnection, - }), - }) - const radios = wrapper.find("Radio") - - expect(radios.length).toBe(2) - expect(radios.map(radio => radio.props().value)).toEqual(["1", "2"]) - expect(radios.map(radio => radio.props().selected)).toEqual([false, true]) - expect(radios.map(radio => radio.text())).toEqual([ - "Test Name1 Main StMadrid, Spain, 28001555-555-5555Edit", - "Test Name401 BroadwayFloor 25New York, NY, USA, 10013422-424-4242Edit", - ]) - }) - }) -}) - -const mockAddressConnection = { - edges: [ - { - cursor: "aaaabbbb", - node: { - internalID: "1", - addressLine1: "1 Main St", - addressLine2: "", - addressLine3: "", - city: "Madrid", - country: "Spain", - isDefault: false, - name: "Test Name", - phoneNumber: "555-555-5555", - postalCode: "28001", - region: "", - }, - }, - { - cursor: "bbbbbcccc", - node: { - internalID: "2", - addressLine1: "401 Broadway", - addressLine2: "Floor 25", - addressLine3: "", - city: "New York", - country: "USA", - isDefault: true, - name: "Test Name", - phoneNumber: "422-424-4242", - postalCode: "10013", - region: "NY", - }, - }, - ], -} diff --git a/src/Apps/Order/Components/__tests__/ShippingAddress.jest.tsx b/src/Apps/Order/Components/__tests__/ShippingAddress.jest.tsx deleted file mode 100644 index 89c670f5b6b..00000000000 --- a/src/Apps/Order/Components/__tests__/ShippingAddress.jest.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import { render } from "enzyme" -import { ShippingAddress } from "../ShippingAddress" - -describe("ShippingAddress", () => { - it("shows the given shipping address", () => { - const shippingAddress = render( - - ) - - const text = shippingAddress.text() - - expect(text).toMatch("Yuki Nishijima") - expect(text).toMatch("401 Broadway, Suite 25") - expect(text).toMatch("New York, NY 10013") - expect(text).toMatch("United States") - }) - - it("ignores addressLine2if it is blank or null", () => { - const shippingAddressWithBlankAddressLine2 = render( - - ) - - expect(shippingAddressWithBlankAddressLine2.text()).toMatch("401 Broadway") - expect(shippingAddressWithBlankAddressLine2.text()).not.toMatch( - "401 Broadway, " - ) - - const shippingAddressWithoutAddressLine2 = render( - - ) - - expect(shippingAddressWithoutAddressLine2.text()).toMatch("401 Broadway") - expect(shippingAddressWithoutAddressLine2.text()).not.toMatch( - "401 Broadway, " - ) - }) -}) diff --git a/src/Apps/Order/Components/__tests__/ShippingQuotes.jest.tsx b/src/Apps/Order/Components/__tests__/ShippingQuotes.jest.tsx deleted file mode 100644 index 86ad416f4b9..00000000000 --- a/src/Apps/Order/Components/__tests__/ShippingQuotes.jest.tsx +++ /dev/null @@ -1,155 +0,0 @@ -import { BorderedRadio } from "@artsy/palette" -import { ShippingQuotes_Test_Query$data } from "__generated__/ShippingQuotes_Test_Query.graphql" -import { BuyOrderWithArtaShippingDetails } from "Apps/__tests__/Fixtures/Order" -import { renderRelayTree } from "DevTools/renderRelayTree" -import { graphql } from "react-relay" -import { - shippingQuoteDescriptions, - shippingQuoteDisplayNames, - ShippingQuotesFragmentContainer, -} from "Apps/Order/Components/ShippingQuotes" -import { cloneDeep, compact } from "lodash" -import { ReactWrapper } from "enzyme" - -jest.unmock("react-relay") - -const onSelect = jest.fn() - -const render = (extraOrderProps?: ShippingQuotes_Test_Query$data["order"]) => - renderRelayTree({ - Component: (props: ShippingQuotes_Test_Query$data) => ( - - ), - mockData: { - order: { - ...BuyOrderWithArtaShippingDetails, - ...extraOrderProps, - }, - }, - query: graphql` - query ShippingQuotes_Test_Query @raw_response_type @relay_test_operation { - order: commerceOrder { - lineItems { - edges { - node { - shippingQuoteOptions { - edges { - ...ShippingQuotes_shippingQuotes - } - } - } - } - } - } - } - `, - }) - -describe("ShippingQuotes", () => { - let page - - beforeEach(async () => { - page = await render() - }) - - it("shows correct shipping quotes lendth", async () => { - const shippingQuotes = page - .find(`[data-test="shipping-quotes"]`) - .find(BorderedRadio) - - expect(shippingQuotes).toHaveLength(5) - }) - - it("auto selects the first shipping quote", async () => { - const shippingQuotes = page - .find(`[data-test="shipping-quotes"]`) - .find(BorderedRadio) - - // The id of the lowest cost shipping option in BuyOrderWithArtaShippingDetails mocked data - expect(shippingQuotes.first().props().value).toEqual( - "4a8f8080-23d3-4c0e-9811-7a41a9df6933" - ) - }) - - it("have selected quote", async () => { - const selectedShippingQuote = page - .find(`[data-test="shipping-quotes"]`) - .find(BorderedRadio) - .filterWhere(quote => quote.props().selected == true) - - expect(selectedShippingQuote.props().value).toEqual( - "d8cfee28-8139-4391-8a8d-3010633e885b" - ) - }) - - it("each shipping quote contain name, price and description", async () => { - const shippingQuotes = page - .find(`[data-test="shipping-quotes"]`) - .find(BorderedRadio) - - BuyOrderWithArtaShippingDetails.lineItems.edges[0].node.shippingQuoteOptions.edges.forEach( - shippingQuote => { - const quote = shippingQuotes - .findWhere(shippingQuotesItem => - shippingQuotesItem - .text() - .startsWith( - shippingQuoteDisplayNames[shippingQuote.node.typeName] - ) - ) - .first() - - expect(quote).toBeTruthy() - - const text = quote.text() - - expect(text).toContain(shippingQuote.node.price) - expect(text).toContain( - shippingQuoteDescriptions[shippingQuote.node.typeName] - ) - } - ) - }) - - it("quotes are in ascending order by price", async () => { - const shippingQuotes = page - .find(`[data-test="shipping-quotes"]`) - .find(BorderedRadio) - - const ascendingPrices = ["$1.00", "$2.00", "$3.00", "$4.00", "$5.00"] - - shippingQuotes.forEach((node: ReactWrapper, index: number) => { - expect(node.find(`Text[data-test="quotePrice"]`).text()).toContain( - ascendingPrices[index] - ) - }) - }) - - it("call onSelect callback on sellected quote change", async () => { - const shippingQuotes = page - .find(`[data-test="shipping-quotes"]`) - .find(BorderedRadio) - - shippingQuotes.first().simulate("click") - - expect(onSelect).toBeCalledWith("4a8f8080-23d3-4c0e-9811-7a41a9df6933") - }) - - it("does not render component if no shhipping quotes", async () => { - let buyOrderWithoutArtaShippingDetails = cloneDeep( - BuyOrderWithArtaShippingDetails - ) as any - - buyOrderWithoutArtaShippingDetails.lineItems.edges[0].node.shippingQuoteOptions = null - - const page = await render(buyOrderWithoutArtaShippingDetails) - - expect(page.html()).toBe("") - }) -}) diff --git a/src/Apps/Order/Hooks/useOrderTracking.tsx b/src/Apps/Order/Hooks/useOrderTracking.tsx index 4ccbfa6ffbb..49667b5710c 100644 --- a/src/Apps/Order/Hooks/useOrderTracking.tsx +++ b/src/Apps/Order/Hooks/useOrderTracking.tsx @@ -11,7 +11,7 @@ import { useAnalyticsContext } from "System/Hooks/useAnalyticsContext" import { useMemo } from "react" import * as DeprecatedSchema from "@artsy/cohesion/dist/DeprecatedSchema" import { useTracking } from "react-tracking" -import { FulfillmentType } from "Apps/Order/Routes/Shipping2/Utils/shippingUtils" +import { FulfillmentType } from "Apps/Order/Routes/Shipping/Utils/shippingUtils" export const useOrderTracking = () => { const { trackEvent } = useTracking() diff --git a/src/Apps/Order/Mutations/CreateUserAddress.ts b/src/Apps/Order/Mutations/CreateUserAddress.ts deleted file mode 100644 index 5ba481a8e98..00000000000 --- a/src/Apps/Order/Mutations/CreateUserAddress.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { Environment, commitMutation, graphql } from "react-relay" -import { - CreateUserAddressMutation, - CreateUserAddressMutation$data, - UserAddressAttributes, -} from "__generated__/CreateUserAddressMutation.graphql" -import { RecordSourceSelectorProxy, ConnectionHandler } from "relay-runtime" - -const onAddressAdded = ( - me: { id: string }, - store: RecordSourceSelectorProxy, - data: CreateUserAddressMutation$data -): void => { - const response = data?.createUserAddress?.userAddressOrErrors - - if (response) { - const meStore = store.get(me.id) - if (meStore) { - const connection = ConnectionHandler.getConnection( - meStore, - "SavedAddresses_addressConnection" - ) - const mutationPayload = store.getRootField("createUserAddress") - - const createUserAddressOrError = mutationPayload.getLinkedRecord( - "userAddressOrErrors" - ) - if (connection) { - ConnectionHandler.insertEdgeAfter(connection, createUserAddressOrError) - } - } - } -} - -export const createUserAddress = async ( - environment: Environment, - address: UserAddressAttributes, - onSuccess: (address: CreateUserAddressMutation$data) => void, - onError: (message: string) => void, - me: { id: string }, - closeModal: () => void -) => { - commitMutation(environment, { - variables: { - input: { - attributes: address, - }, - }, - mutation: graphql` - mutation CreateUserAddressMutation($input: CreateUserAddressInput!) { - createUserAddress(input: $input) { - userAddressOrErrors { - ... on UserAddress { - id - internalID - addressLine1 - addressLine2 - addressLine3 - city - country - isDefault - name - phoneNumber - postalCode - region - } - ... on Errors { - errors { - message - } - } - } - } - } - `, - updater: (store, data: CreateUserAddressMutation$data) => { - onAddressAdded(me, store as RecordSourceSelectorProxy, data) - }, - onCompleted: (data, e) => { - const errors = data.createUserAddress?.userAddressOrErrors.errors - if (errors) { - onError(errors.map(error => error.message).join(", ")) - } else { - onSuccess(data) - closeModal() - } - }, - onError: e => { - onError(e.message) - }, - }) -} diff --git a/src/Apps/Order/Mutations/DeleteUserAddress.ts b/src/Apps/Order/Mutations/DeleteUserAddress.ts deleted file mode 100644 index 69aeb881a54..00000000000 --- a/src/Apps/Order/Mutations/DeleteUserAddress.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { commitMutation, Environment, graphql } from "react-relay" -import { - DeleteUserAddressMutation, - DeleteUserAddressMutation$data, -} from "__generated__/DeleteUserAddressMutation.graphql" - -export const deleteUserAddress = ( - environment: Environment, - userAddressID: string, - onSuccess: () => void, - onError: (message: string) => void -) => { - return new Promise((resolve, reject) => { - commitMutation(environment, { - variables: { - input: { - userAddressID: userAddressID, - }, - }, - mutation: graphql` - mutation DeleteUserAddressMutation($input: DeleteUserAddressInput!) { - deleteUserAddress(input: $input) { - userAddressOrErrors { - ... on UserAddress { - id - internalID - name - addressLine1 - addressLine2 - isDefault - phoneNumber - city - region - postalCode - country - } - ... on Errors { - errors { - code - message - } - } - } - } - } - `, - onError: e => { - onError(e.message) - }, - onCompleted: data => { - const errors = data.deleteUserAddress?.userAddressOrErrors.errors - if (errors) { - onError(errors.map(error => error.message).join(", ")) - reject(errors) - } else { - onSuccess() - resolve(data) - } - }, - }) - }) -} diff --git a/src/Apps/Order/Mutations/SelectShippingOption.ts b/src/Apps/Order/Mutations/SelectShippingOption.ts deleted file mode 100644 index 8ee29133dcc..00000000000 --- a/src/Apps/Order/Mutations/SelectShippingOption.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { graphql } from "react-relay" -import { CommitMutation } from "../Utils/commitMutation" -import { SelectShippingOptionMutation } from "__generated__/SelectShippingOptionMutation.graphql" - -export const selectShippingOption = ( - commitMutation: CommitMutation, - variables: SelectShippingOptionMutation["variables"] -) => { - return commitMutation({ - variables, - mutation: graphql` - mutation SelectShippingOptionMutation( - $input: CommerceSelectShippingOptionInput! - ) { - commerceSelectShippingOption(input: $input) { - orderOrError { - ... on CommerceOrderWithMutationSuccess { - __typename - order { - lineItems { - edges { - node { - shippingQuoteOptions { - edges { - ...ShippingQuotes_shippingQuotes - } - } - } - } - } - } - } - ... on CommerceOrderWithMutationFailure { - error { - type - code - data - } - } - } - } - } - `, - }) -} diff --git a/src/Apps/Order/Mutations/SetShipping.ts b/src/Apps/Order/Mutations/SetShipping.ts deleted file mode 100644 index 4056ec80565..00000000000 --- a/src/Apps/Order/Mutations/SetShipping.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { graphql } from "react-relay" -import { SetShippingMutation } from "__generated__/SetShippingMutation.graphql" -import { CommitMutation } from "Apps/Order/Utils/commitMutation" - -export const setShipping = ( - commitMutation: CommitMutation, - variables: SetShippingMutation["variables"] -) => { - return commitMutation({ - variables, - // TODO: Inputs to the mutation might have changed case of the keys! - mutation: graphql` - mutation SetShippingMutation($input: CommerceSetShippingInput!) { - commerceSetShipping(input: $input) { - orderOrError { - ... on CommerceOrderWithMutationSuccess { - __typename - order { - internalID - state - requestedFulfillment { - __typename - ... on CommerceShip { - name - addressLine1 - addressLine2 - city - region - country - postalCode - phoneNumber - } - ... on CommerceShipArta { - name - addressLine1 - addressLine2 - city - region - country - postalCode - phoneNumber - } - } - lineItems { - edges { - node { - shippingQuoteOptions { - edges { - ...ShippingQuotes_shippingQuotes - } - } - } - } - } - } - } - ... on CommerceOrderWithMutationFailure { - error { - type - code - data - } - } - } - } - } - `, - }) -} diff --git a/src/Apps/Order/Mutations/UpdateUserAddress.ts b/src/Apps/Order/Mutations/UpdateUserAddress.ts deleted file mode 100644 index cd2d7dc2e32..00000000000 --- a/src/Apps/Order/Mutations/UpdateUserAddress.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { commitMutation, Environment, graphql } from "react-relay" -import { - UpdateUserAddressMutation, - UpdateUserAddressMutation$data, - UserAddressAttributes, -} from "__generated__/UpdateUserAddressMutation.graphql" - -export const updateUserAddress = async ( - environment: Environment, - userAddressID: string, - values: UserAddressAttributes, - closeModal: () => void, - onSuccess: (address: UpdateUserAddressMutation$data) => void, - onError: (message: string) => void -) => { - commitMutation(environment, { - variables: { - input: { - userAddressID: userAddressID, - attributes: values, - }, - }, - mutation: graphql` - mutation UpdateUserAddressMutation($input: UpdateUserAddressInput!) { - updateUserAddress(input: $input) { - userAddressOrErrors { - ... on UserAddress { - id - internalID - name - addressLine1 - addressLine2 - isDefault - phoneNumber - city - region - postalCode - country - } - ... on Errors { - errors { - code - message - } - } - } - } - } - `, - onCompleted: (data, e) => { - const errors = data?.updateUserAddress?.userAddressOrErrors.errors - if (errors) { - onError(errors.map(error => error.message).join(", ")) - } else { - onSuccess(data) - closeModal() - } - }, - onError: e => { - onError(e.message) - }, - }) -} diff --git a/src/Apps/Order/Mutations/UpdateUserDefaultAddress.ts b/src/Apps/Order/Mutations/UpdateUserDefaultAddress.ts deleted file mode 100644 index f54e213136d..00000000000 --- a/src/Apps/Order/Mutations/UpdateUserDefaultAddress.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { commitMutation, Environment, graphql } from "react-relay" -import { UpdateUserDefaultAddressMutation } from "__generated__/UpdateUserDefaultAddressMutation.graphql" - -export const updateUserDefaultAddress = async ( - environment: Environment, - userAddressID: string, - onSuccess: () => void, - onError: (message: string) => void -) => { - commitMutation(environment, { - variables: { - input: { - userAddressID: userAddressID, - }, - }, - mutation: graphql` - mutation UpdateUserDefaultAddressMutation( - $input: UpdateUserDefaultAddressInput! - ) { - updateUserDefaultAddress(input: $input) { - userAddressOrErrors { - ... on UserAddress { - id - internalID - name - addressLine1 - addressLine2 - isDefault - phoneNumber - city - region - postalCode - country - } - ... on Errors { - errors { - code - message - } - } - } - } - } - `, - onError: e => { - onError(e.message) - }, - onCompleted: (data, e) => { - const errors = data.updateUserDefaultAddress?.userAddressOrErrors.errors - if (errors) { - onError(errors.map(error => error.message).join(", ")) - } else { - onSuccess() - } - }, - }) -} diff --git a/src/Apps/Order/Routes/Shipping2/Components/AddressModal2.tsx b/src/Apps/Order/Routes/Shipping/Components/AddressModal.tsx similarity index 97% rename from src/Apps/Order/Routes/Shipping2/Components/AddressModal2.tsx rename to src/Apps/Order/Routes/Shipping/Components/AddressModal.tsx index 97f4ceeb1b2..917a29c2ea5 100644 --- a/src/Apps/Order/Routes/Shipping2/Components/AddressModal2.tsx +++ b/src/Apps/Order/Routes/Shipping/Components/AddressModal.tsx @@ -19,18 +19,18 @@ import { Form, Formik, FormikHelpers, useFormikContext } from "formik" import { ADDRESS_VALIDATION_SHAPE, addressWithFallbackValues, -} from "Apps/Order/Routes/Shipping2/Utils/shippingUtils" +} from "Apps/Order/Routes/Shipping/Utils/shippingUtils" import createLogger from "Utils/logger" -import { useShippingContext } from "Apps/Order/Routes/Shipping2/Hooks/useShippingContext" -import { SavedAddressType } from "Apps/Order/Utils/shippingUtils" +import { useShippingContext } from "Apps/Order/Routes/Shipping/Hooks/useShippingContext" +import { SavedAddressType } from "Apps/Order/Routes/Shipping/Utils/shippingUtils" import { SavedAddressResult, UserAddressAction, useUserAddressUpdates, -} from "Apps/Order/Routes/Shipping2/Hooks/useUserAddressUpdates" +} from "Apps/Order/Routes/Shipping/Hooks/useUserAddressUpdates" import { CountrySelect } from "Components/CountrySelect" -const logger = createLogger("AddressModal2.tsx") +const logger = createLogger("AddressModal.tsx") /** * Modal type to be rendered. the `address` property is used @@ -66,7 +66,7 @@ export const AddressModal: FC = ({ addressModalAction, onSuccess, }) => { - const logger = createLogger("AddressModal2.tsx") + const logger = createLogger("AddressModal.tsx") const shippingContext = useShippingContext() const { executeUserAddressAction } = useUserAddressUpdates() diff --git a/src/Apps/Order/Routes/Shipping2/Components/CollapseDetails.tsx b/src/Apps/Order/Routes/Shipping/Components/CollapseDetails.tsx similarity index 86% rename from src/Apps/Order/Routes/Shipping2/Components/CollapseDetails.tsx rename to src/Apps/Order/Routes/Shipping/Components/CollapseDetails.tsx index 4b49c142854..5e15f15abfc 100644 --- a/src/Apps/Order/Routes/Shipping2/Components/CollapseDetails.tsx +++ b/src/Apps/Order/Routes/Shipping/Components/CollapseDetails.tsx @@ -1,5 +1,5 @@ import { Collapse } from "Apps/Order/Components/Collapse" -import { useShippingContext } from "Apps/Order/Routes/Shipping2/Hooks/useShippingContext" +import { useShippingContext } from "Apps/Order/Routes/Shipping/Hooks/useShippingContext" import React from "react" export const CollapseDetails: React.FC = ({ children }) => { diff --git a/src/Apps/Order/Routes/Shipping2/Components/FulfillmentDetails.tsx b/src/Apps/Order/Routes/Shipping/Components/FulfillmentDetails.tsx similarity index 96% rename from src/Apps/Order/Routes/Shipping2/Components/FulfillmentDetails.tsx rename to src/Apps/Order/Routes/Shipping/Components/FulfillmentDetails.tsx index bf8cb88c8ab..9a85bf6cb9e 100644 --- a/src/Apps/Order/Routes/Shipping2/Components/FulfillmentDetails.tsx +++ b/src/Apps/Order/Routes/Shipping/Components/FulfillmentDetails.tsx @@ -4,24 +4,24 @@ import { graphql, useFragment } from "react-relay" import { FormikHelpers } from "formik" import { extractNodes } from "Utils/extractNodes" import { useFeatureFlag } from "System/Hooks/useFeatureFlag" -import { FulfillmentDetailsForm } from "Apps/Order/Routes/Shipping2/Components/FulfillmentDetailsForm" +import { FulfillmentDetailsForm } from "Apps/Order/Routes/Shipping/Components/FulfillmentDetailsForm" import { FulfillmentType, FulfillmentValues, ShipValues, addressWithFallbackValues, getInitialShippingValues, -} from "Apps/Order/Routes/Shipping2/Utils/shippingUtils" +} from "Apps/Order/Routes/Shipping/Utils/shippingUtils" import { FulfillmentDetailsForm_me$key } from "__generated__/FulfillmentDetailsForm_me.graphql" import createLogger from "Utils/logger" -import { useShippingContext } from "Apps/Order/Routes/Shipping2/Hooks/useShippingContext" -import { ShippingContextProps } from "Apps/Order/Routes/Shipping2/ShippingContext" -import { useUserAddressUpdates } from "Apps/Order/Routes/Shipping2/Hooks/useUserAddressUpdates" +import { useShippingContext } from "Apps/Order/Routes/Shipping/Hooks/useShippingContext" +import { ShippingContextProps } from "Apps/Order/Routes/Shipping/ShippingContext" +import { useUserAddressUpdates } from "Apps/Order/Routes/Shipping/Hooks/useUserAddressUpdates" import { useRouter } from "System/Hooks/useRouter" import { useOrderTracking } from "Apps/Order/Hooks/useOrderTracking" -import { useHandleSaveFulfillmentDetails } from "Apps/Order/Routes/Shipping2/Hooks/useHandleSaveFulfillmentDetails" +import { useHandleSaveFulfillmentDetails } from "Apps/Order/Routes/Shipping/Hooks/useHandleSaveFulfillmentDetails" -const logger = createLogger("Routes/Shipping2/FulfillmentDetails.tsx") +const logger = createLogger("Routes/Shipping/FulfillmentDetails.tsx") export interface FulfillmentDetailsProps { me: FulfillmentDetailsForm_me$key diff --git a/src/Apps/Order/Routes/Shipping2/Components/FulfillmentDetailsForm.tsx b/src/Apps/Order/Routes/Shipping/Components/FulfillmentDetailsForm.tsx similarity index 98% rename from src/Apps/Order/Routes/Shipping2/Components/FulfillmentDetailsForm.tsx rename to src/Apps/Order/Routes/Shipping/Components/FulfillmentDetailsForm.tsx index b368e2b2c78..fd52adafa3f 100644 --- a/src/Apps/Order/Routes/Shipping2/Components/FulfillmentDetailsForm.tsx +++ b/src/Apps/Order/Routes/Shipping/Components/FulfillmentDetailsForm.tsx @@ -15,17 +15,18 @@ import { AddressVerificationFlowQueryRenderer, } from "Apps/Order/Components/AddressVerificationFlow" -import { SavedAddresses2 } from "Apps/Order/Routes/Shipping2/Components/SavedAddresses2" +import { SavedAddresses } from "Apps/Order/Routes/Shipping/Components/SavedAddresses" import { ADDRESS_VALIDATION_SHAPE, BASIC_PHONE_VALIDATION_SHAPE, FulfillmentType, FulfillmentValues, PickupValues, + SavedAddressType, ShipValues, addressWithFallbackValues, getInitialShippingValues, -} from "Apps/Order/Routes/Shipping2/Utils/shippingUtils" +} from "Apps/Order/Routes/Shipping/Utils/shippingUtils" import { CountrySelect } from "Components/CountrySelect" import { RouterLink } from "System/Components/RouterLink" import { @@ -45,8 +46,7 @@ import { } from "Components/Address/AddressAutocompleteInput" import { ContextModule, OwnerType } from "@artsy/cohesion" import { useAnalyticsContext } from "System/Hooks/useAnalyticsContext" -import { useShippingContext } from "Apps/Order/Routes/Shipping2/Hooks/useShippingContext" -import { SavedAddressType } from "Apps/Order/Utils/shippingUtils" +import { useShippingContext } from "Apps/Order/Routes/Shipping/Hooks/useShippingContext" import { ScrollToFieldError } from "Apps/Order/Utils/scrollToFieldError" import { useOrderTracking } from "Apps/Order/Hooks/useOrderTracking" @@ -308,7 +308,7 @@ const FulfillmentDetailsFormLayout = ( data-testid="savedAddressesCollapse" open={addressFormMode === "saved_addresses"} > - diff --git a/src/Apps/Order/Routes/Shipping2/Components/SaveAndContinueButton.tsx b/src/Apps/Order/Routes/Shipping/Components/SaveAndContinueButton.tsx similarity index 93% rename from src/Apps/Order/Routes/Shipping2/Components/SaveAndContinueButton.tsx rename to src/Apps/Order/Routes/Shipping/Components/SaveAndContinueButton.tsx index 4d9a879623e..e48928a2677 100644 --- a/src/Apps/Order/Routes/Shipping2/Components/SaveAndContinueButton.tsx +++ b/src/Apps/Order/Routes/Shipping/Components/SaveAndContinueButton.tsx @@ -1,6 +1,6 @@ import { Button, ButtonProps } from "@artsy/palette" -import { useSaveSelectedShippingQuote } from "Apps/Order/Routes/Shipping2/Hooks/useSaveSelectedShippingQuote" -import { useShippingContext } from "Apps/Order/Routes/Shipping2/Hooks/useShippingContext" +import { useSaveSelectedShippingQuote } from "Apps/Order/Routes/Shipping/Hooks/useSaveSelectedShippingQuote" +import { useShippingContext } from "Apps/Order/Routes/Shipping/Hooks/useShippingContext" import { useRouter } from "System/Hooks/useRouter" import { SaveAndContinueButton_order$key } from "__generated__/SaveAndContinueButton_order.graphql" import { graphql, useFragment } from "react-relay" diff --git a/src/Apps/Order/Routes/Shipping2/Components/SavedAddressItem2.tsx b/src/Apps/Order/Routes/Shipping/Components/SavedAddressItem.tsx similarity index 90% rename from src/Apps/Order/Routes/Shipping2/Components/SavedAddressItem2.tsx rename to src/Apps/Order/Routes/Shipping/Components/SavedAddressItem.tsx index 2e5b1a0e6b6..f86915f3820 100644 --- a/src/Apps/Order/Routes/Shipping2/Components/SavedAddressItem2.tsx +++ b/src/Apps/Order/Routes/Shipping/Components/SavedAddressItem.tsx @@ -1,18 +1,10 @@ import { Flex, Text, RadioProps, BoxProps } from "@artsy/palette" import * as React from "react" import styled from "styled-components" -import { SavedAddresses_me$data } from "__generated__/SavedAddresses_me.graphql" - -type AddressNode = NonNullable< - NonNullable< - NonNullable< - NonNullable["edges"] - >[number] - >["node"] -> +import { SavedAddressType } from "Apps/Order/Routes/Shipping/Utils/shippingUtils" interface SavedAddressItemProps extends BoxProps { - address: AddressNode + address: SavedAddressType handleClickEdit: (event: any) => void } diff --git a/src/Apps/Order/Routes/Shipping2/Components/SavedAddresses2.tsx b/src/Apps/Order/Routes/Shipping/Components/SavedAddresses.tsx similarity index 93% rename from src/Apps/Order/Routes/Shipping2/Components/SavedAddresses2.tsx rename to src/Apps/Order/Routes/Shipping/Components/SavedAddresses.tsx index 02ee014cdfd..e10bd0f345b 100644 --- a/src/Apps/Order/Routes/Shipping2/Components/SavedAddresses2.tsx +++ b/src/Apps/Order/Routes/Shipping/Components/SavedAddresses.tsx @@ -4,9 +4,9 @@ import { RadioGroup, BorderedRadio, Spacer, Clickable } from "@artsy/palette" import { AddressModal, AddressModalAction, -} from "Apps/Order/Routes/Shipping2/Components/AddressModal2" +} from "Apps/Order/Routes/Shipping/Components/AddressModal" import createLogger from "Utils/logger" -import { SavedAddressItem } from "Apps/Order/Routes/Shipping2/Components/SavedAddressItem2" +import { SavedAddressItem } from "Apps/Order/Routes/Shipping/Components/SavedAddressItem" import { themeGet } from "@styled-system/theme-get" import { @@ -14,8 +14,8 @@ import { SavedAddressType, getAddressByID, getDefaultUserAddress, -} from "Apps/Order/Routes/Shipping2/Utils/shippingUtils" -import { useShippingContext } from "Apps/Order/Routes/Shipping2/Hooks/useShippingContext" +} from "Apps/Order/Routes/Shipping/Utils/shippingUtils" +import { useShippingContext } from "Apps/Order/Routes/Shipping/Hooks/useShippingContext" import { useOrderTracking } from "Apps/Order/Hooks/useOrderTracking" import { useFormikContext } from "formik" @@ -24,7 +24,7 @@ export interface SavedAddressesProps { onSelect: (address: SavedAddressType) => void } -export const SavedAddresses2: FC = props => { +export const SavedAddresses: FC = props => { const logger = createLogger("SavedAddresses.tsx") const shippingContext = useShippingContext() diff --git a/src/Apps/Order/Routes/Shipping2/Components/ShippingQuotes2.tsx b/src/Apps/Order/Routes/Shipping/Components/ShippingQuotes.tsx similarity index 93% rename from src/Apps/Order/Routes/Shipping2/Components/ShippingQuotes2.tsx rename to src/Apps/Order/Routes/Shipping/Components/ShippingQuotes.tsx index 79961b67a7b..59cbf3d0408 100644 --- a/src/Apps/Order/Routes/Shipping2/Components/ShippingQuotes2.tsx +++ b/src/Apps/Order/Routes/Shipping/Components/ShippingQuotes.tsx @@ -9,25 +9,25 @@ import { Text, } from "@artsy/palette" import { graphql, useFragment } from "react-relay" -import { ShippingQuotes2_order$key } from "__generated__/ShippingQuotes2_order.graphql" -import { useShippingContext } from "Apps/Order/Routes/Shipping2/Hooks/useShippingContext" +import { ShippingQuotes_order$key } from "__generated__/ShippingQuotes_order.graphql" +import { useShippingContext } from "Apps/Order/Routes/Shipping/Hooks/useShippingContext" import { extractNodes } from "Utils/extractNodes" import { useOrderTracking } from "Apps/Order/Hooks/useOrderTracking" import { useEffect } from "react" -import { CollapseDetails } from "Apps/Order/Routes/Shipping2/Components/CollapseDetails" +import { CollapseDetails } from "Apps/Order/Routes/Shipping/Components/CollapseDetails" export interface ShippingQuotesProps { - order: ShippingQuotes2_order$key + order: ShippingQuotes_order$key } -export const ShippingQuotes2: React.FC = ({ order }) => { +export const ShippingQuotes: React.FC = ({ order }) => { const shippingContext = useShippingContext() const orderTracking = useOrderTracking() const { orderData } = shippingContext const data = useFragment( graphql` - fragment ShippingQuotes2_order on CommerceOrder { + fragment ShippingQuotes_order on CommerceOrder { lineItems { edges { node { diff --git a/src/Apps/Order/Routes/Shipping2/Components/__tests__/AddressModal2.jest.tsx b/src/Apps/Order/Routes/Shipping/Components/__tests__/AddressModal.jest.tsx similarity index 96% rename from src/Apps/Order/Routes/Shipping2/Components/__tests__/AddressModal2.jest.tsx rename to src/Apps/Order/Routes/Shipping/Components/__tests__/AddressModal.jest.tsx index 5a374bb3b02..a81aad75034 100644 --- a/src/Apps/Order/Routes/Shipping2/Components/__tests__/AddressModal2.jest.tsx +++ b/src/Apps/Order/Routes/Shipping/Components/__tests__/AddressModal.jest.tsx @@ -1,16 +1,16 @@ import { AddressModal, AddressModalProps, -} from "Apps/Order/Routes/Shipping2/Components/AddressModal2" +} from "Apps/Order/Routes/Shipping/Components/AddressModal" import { validAddress } from "Components/__tests__/Utils/addressForm2" import { useSystemContext } from "System/Hooks/useSystemContext" -import { SavedAddressType } from "Apps/Order/Routes/Shipping2/Utils/shippingUtils" +import { SavedAddressType } from "Apps/Order/Routes/Shipping/Utils/shippingUtils" import { createMockEnvironment } from "relay-test-utils" import { setupTestWrapper } from "DevTools/setupTestWrapper" import { graphql } from "react-relay" -import { AddressModal2TestQuery } from "__generated__/AddressModal2TestQuery.graphql" +import { AddressModalTestQuery } from "__generated__/AddressModalTestQuery.graphql" import { flushPromiseQueue } from "DevTools/flushPromiseQueue" -import { ShippingContextProps } from "Apps/Order/Routes/Shipping2/ShippingContext" +import { ShippingContextProps } from "Apps/Order/Routes/Shipping/ShippingContext" import { DeepPartial } from "Utils/typeSupport" /* @@ -47,16 +47,16 @@ let mockShippingcontext: DeepPartial = { }, } -jest.mock("Apps/Order/Routes/Shipping2/Hooks/useShippingContext", () => ({ +jest.mock("Apps/Order/Routes/Shipping/Hooks/useShippingContext", () => ({ useShippingContext: () => mockShippingcontext, })) -const { getWrapper: _getWrapper } = setupTestWrapper({ +const { getWrapper: _getWrapper } = setupTestWrapper({ Component: (props: unknown) => { return }, query: graphql` - query AddressModal2TestQuery @relay_test_operation { + query AddressModalTestQuery @relay_test_operation { _unused: artist(id: "whocare") { name } diff --git a/src/Apps/Order/Routes/Shipping2/Components/__tests__/FulfillmentDetailsForm.jest.tsx b/src/Apps/Order/Routes/Shipping/Components/__tests__/FulfillmentDetailsForm.jest.tsx similarity index 98% rename from src/Apps/Order/Routes/Shipping2/Components/__tests__/FulfillmentDetailsForm.jest.tsx rename to src/Apps/Order/Routes/Shipping/Components/__tests__/FulfillmentDetailsForm.jest.tsx index 009236ba2db..f3ac5876a82 100644 --- a/src/Apps/Order/Routes/Shipping2/Components/__tests__/FulfillmentDetailsForm.jest.tsx +++ b/src/Apps/Order/Routes/Shipping/Components/__tests__/FulfillmentDetailsForm.jest.tsx @@ -10,12 +10,12 @@ import userEvent from "@testing-library/user-event" import { FulfillmentDetailsForm, FulfillmentDetailsFormProps, -} from "Apps/Order/Routes/Shipping2/Components/FulfillmentDetailsForm" -import { ShippingContextProps } from "Apps/Order/Routes/Shipping2/ShippingContext" +} from "Apps/Order/Routes/Shipping/Components/FulfillmentDetailsForm" +import { ShippingContextProps } from "Apps/Order/Routes/Shipping/ShippingContext" import { FulfillmentType, ShipValues, -} from "Apps/Order/Routes/Shipping2/Utils/shippingUtils" +} from "Apps/Order/Routes/Shipping/Utils/shippingUtils" import { fillAddressForm } from "Components/__tests__/Utils/addressForm2" import { flushPromiseQueue } from "DevTools/flushPromiseQueue" import { useFeatureFlag } from "System/Hooks/useFeatureFlag" @@ -42,13 +42,13 @@ const mockScrollIntoView = jest.fn() let testProps: DeepPartial let mockShippingContext: ShippingContextProps -jest.mock("Apps/Order/Routes/Shipping2/Hooks/useShippingContext", () => ({ +jest.mock("Apps/Order/Routes/Shipping/Hooks/useShippingContext", () => ({ useShippingContext: () => mockShippingContext, })) // Mock relay-connected component -jest.mock("Apps/Order/Routes/Shipping2/Components/SavedAddresses2", () => ({ - SavedAddresses2: () =>
, +jest.mock("Apps/Order/Routes/Shipping/Components/SavedAddresses", () => ({ + SavedAddresses: () =>
, })) const renderTree = testProps => { diff --git a/src/Apps/Order/Routes/Shipping2/Components/__tests__/SavedAddresses2.jest.tsx b/src/Apps/Order/Routes/Shipping/Components/__tests__/SavedAddresses.jest.tsx similarity index 94% rename from src/Apps/Order/Routes/Shipping2/Components/__tests__/SavedAddresses2.jest.tsx rename to src/Apps/Order/Routes/Shipping/Components/__tests__/SavedAddresses.jest.tsx index 45c5817951b..42e1e7ebf04 100644 --- a/src/Apps/Order/Routes/Shipping2/Components/__tests__/SavedAddresses2.jest.tsx +++ b/src/Apps/Order/Routes/Shipping/Components/__tests__/SavedAddresses.jest.tsx @@ -2,22 +2,22 @@ import { useTracking } from "react-tracking" import { Analytics } from "System/Contexts/AnalyticsContext" import { fireEvent, screen, within } from "@testing-library/react" import { - SavedAddresses2, + SavedAddresses, SavedAddressesProps, -} from "Apps/Order/Routes/Shipping2/Components/SavedAddresses2" -import { ShippingContextProps } from "Apps/Order/Routes/Shipping2/ShippingContext" +} from "Apps/Order/Routes/Shipping/Components/SavedAddresses" +import { ShippingContextProps } from "Apps/Order/Routes/Shipping/ShippingContext" import { flushPromiseQueue } from "DevTools/flushPromiseQueue" import userEvent from "@testing-library/user-event" import { Formik } from "formik" import { FulfillmentType, ShipValues, -} from "Apps/Order/Routes/Shipping2/Utils/shippingUtils" +} from "Apps/Order/Routes/Shipping/Utils/shippingUtils" import { MockBoot } from "DevTools/MockBoot" import { fillAddressForm } from "Components/__tests__/Utils/addressForm2" import { setupTestWrapperTL } from "DevTools/setupTestWrapper" import { graphql } from "react-relay" -import { SavedAddresses2TestQuery } from "__generated__/SavedAddresses2TestQuery.graphql" +import { SavedAddressesTestQuery } from "__generated__/SavedAddressesTestQuery.graphql" jest.unmock("react-relay") jest.mock("react-tracking") @@ -32,13 +32,13 @@ let mockShippingContext: ShippingContextProps const mockFormikSubmit = jest.fn() const mockExecuteUserAddressAction = jest.fn() -jest.mock("Apps/Order/Routes/Shipping2/Hooks/useShippingContext", () => { +jest.mock("Apps/Order/Routes/Shipping/Hooks/useShippingContext", () => { return { useShippingContext: jest.fn(() => mockShippingContext), } }) -jest.mock("Apps/Order/Routes/Shipping2/Hooks/useUserAddressUpdates", () => { +jest.mock("Apps/Order/Routes/Shipping/Hooks/useUserAddressUpdates", () => { return { useUserAddressUpdates: () => ({ executeUserAddressAction: mockExecuteUserAddressAction, @@ -72,16 +72,16 @@ const TestWrapper = ({ children }) => ( ) -const { renderWithRelay } = setupTestWrapperTL({ +const { renderWithRelay } = setupTestWrapperTL({ Component: props => { return ( - + ) }, query: graphql` - query SavedAddresses2TestQuery { + query SavedAddressesTestQuery { me { email # need something for the wrapper to render } diff --git a/src/Apps/Order/Routes/Shipping2/Hooks/__tests__/useUserAddressUpdates.jest.ts b/src/Apps/Order/Routes/Shipping/Hooks/__tests__/useUserAddressUpdates.jest.ts similarity index 98% rename from src/Apps/Order/Routes/Shipping2/Hooks/__tests__/useUserAddressUpdates.jest.ts rename to src/Apps/Order/Routes/Shipping/Hooks/__tests__/useUserAddressUpdates.jest.ts index c28b0842bbc..c10c3f8b9c3 100644 --- a/src/Apps/Order/Routes/Shipping2/Hooks/__tests__/useUserAddressUpdates.jest.ts +++ b/src/Apps/Order/Routes/Shipping/Hooks/__tests__/useUserAddressUpdates.jest.ts @@ -7,12 +7,12 @@ import { import { UserAddressAction, useUserAddressUpdates, -} from "Apps/Order/Routes/Shipping2/Hooks/useUserAddressUpdates" +} from "Apps/Order/Routes/Shipping/Hooks/useUserAddressUpdates" import { FulfillmentType, FulfillmentValues, -} from "Apps/Order/Routes/Shipping2/Utils/shippingUtils" -import { ShippingContextProps } from "Apps/Order/Routes/Shipping2/ShippingContext" +} from "Apps/Order/Routes/Shipping/Utils/shippingUtils" +import { ShippingContextProps } from "Apps/Order/Routes/Shipping/ShippingContext" import { flushPromiseQueue } from "DevTools/flushPromiseQueue" let mockRelayEnv: MockEnvironment @@ -23,7 +23,7 @@ jest.unmock("react-relay") jest.mock("System/Hooks/useSystemContext", () => ({ useSystemContext: () => ({ relayEnvironment: mockRelayEnv }), })) -jest.mock("Apps/Order/Routes/Shipping2/Hooks/useShippingContext", () => ({ +jest.mock("Apps/Order/Routes/Shipping/Hooks/useShippingContext", () => ({ useShippingContext: () => mockShippingContext, })) diff --git a/src/Apps/Order/Routes/Shipping2/Hooks/useHandleExchangeError.tsx b/src/Apps/Order/Routes/Shipping/Hooks/useHandleExchangeError.tsx similarity index 97% rename from src/Apps/Order/Routes/Shipping2/Hooks/useHandleExchangeError.tsx rename to src/Apps/Order/Routes/Shipping/Hooks/useHandleExchangeError.tsx index 3342f132783..4e1502d50b5 100644 --- a/src/Apps/Order/Routes/Shipping2/Hooks/useHandleExchangeError.tsx +++ b/src/Apps/Order/Routes/Shipping/Hooks/useHandleExchangeError.tsx @@ -1,6 +1,6 @@ import { Dialog } from "Apps/Order/Dialogs" import { useOrderTracking } from "Apps/Order/Hooks/useOrderTracking" -import { ComputedOrderData } from "Apps/Order/Routes/Shipping2/Utils/computeOrderData" +import { ComputedOrderData } from "Apps/Order/Routes/Shipping/Utils/computeOrderData" import { ArtaErrorDialogMessage, ErrorDialogs, diff --git a/src/Apps/Order/Routes/Shipping2/Hooks/useHandleSaveFulfillmentDetails.ts b/src/Apps/Order/Routes/Shipping/Hooks/useHandleSaveFulfillmentDetails.ts similarity index 93% rename from src/Apps/Order/Routes/Shipping2/Hooks/useHandleSaveFulfillmentDetails.ts rename to src/Apps/Order/Routes/Shipping/Hooks/useHandleSaveFulfillmentDetails.ts index 34d584061dd..2e1269b5b6d 100644 --- a/src/Apps/Order/Routes/Shipping2/Hooks/useHandleSaveFulfillmentDetails.ts +++ b/src/Apps/Order/Routes/Shipping/Hooks/useHandleSaveFulfillmentDetails.ts @@ -1,15 +1,15 @@ import { useOrderTracking } from "Apps/Order/Hooks/useOrderTracking" -import { useShippingContext } from "Apps/Order/Routes/Shipping2/Hooks/useShippingContext" -import { useSaveFulfillmentDetails } from "Apps/Order/Routes/Shipping2/Mutations/useSaveFulfillmentDetails" +import { useShippingContext } from "Apps/Order/Routes/Shipping/Hooks/useShippingContext" +import { useSaveFulfillmentDetails } from "Apps/Order/Routes/Shipping/Mutations/useSaveFulfillmentDetails" import { FulfillmentType, FulfillmentValues, -} from "Apps/Order/Routes/Shipping2/Utils/shippingUtils" +} from "Apps/Order/Routes/Shipping/Utils/shippingUtils" import createLogger from "Utils/logger" import { CommerceSetShippingInput } from "__generated__/useSaveFulfillmentDetailsMutation.graphql" const logger = createLogger( - "Order/Routes/Shipping2/Hooks/useHandleSaveFulfillmentDetails" + "Order/Routes/Shipping/Hooks/useHandleSaveFulfillmentDetails" ) type ExchangeOrGravityError = diff --git a/src/Apps/Order/Routes/Shipping2/Hooks/useSaveSelectedShippingQuote.tsx b/src/Apps/Order/Routes/Shipping/Hooks/useSaveSelectedShippingQuote.tsx similarity index 91% rename from src/Apps/Order/Routes/Shipping2/Hooks/useSaveSelectedShippingQuote.tsx rename to src/Apps/Order/Routes/Shipping/Hooks/useSaveSelectedShippingQuote.tsx index d46b19cd5a5..be41ec9a473 100644 --- a/src/Apps/Order/Routes/Shipping2/Hooks/useSaveSelectedShippingQuote.tsx +++ b/src/Apps/Order/Routes/Shipping/Hooks/useSaveSelectedShippingQuote.tsx @@ -1,8 +1,8 @@ import { useOrderTracking } from "Apps/Order/Hooks/useOrderTracking" -import { useUserAddressUpdates } from "Apps/Order/Routes/Shipping2/Hooks/useUserAddressUpdates" -import { useShippingContext } from "Apps/Order/Routes/Shipping2/Hooks/useShippingContext" -import { useSelectShippingQuote } from "Apps/Order/Routes/Shipping2/Mutations/useSelectShippingQuote" -import { FulfillmentType } from "Apps/Order/Routes/Shipping2/Utils/shippingUtils" +import { useUserAddressUpdates } from "Apps/Order/Routes/Shipping/Hooks/useUserAddressUpdates" +import { useShippingContext } from "Apps/Order/Routes/Shipping/Hooks/useShippingContext" +import { useSelectShippingQuote } from "Apps/Order/Routes/Shipping/Mutations/useSelectShippingQuote" +import { FulfillmentType } from "Apps/Order/Routes/Shipping/Utils/shippingUtils" import { ArtaErrorDialogMessage } from "Apps/Order/Utils/getErrorDialogCopy" import { useRouter } from "System/Hooks/useRouter" import createLogger from "Utils/logger" diff --git a/src/Apps/Order/Routes/Shipping2/Hooks/useShippingContext.ts b/src/Apps/Order/Routes/Shipping/Hooks/useShippingContext.ts similarity index 60% rename from src/Apps/Order/Routes/Shipping2/Hooks/useShippingContext.ts rename to src/Apps/Order/Routes/Shipping/Hooks/useShippingContext.ts index 1ac5b56fd9b..6db8e0d8a80 100644 --- a/src/Apps/Order/Routes/Shipping2/Hooks/useShippingContext.ts +++ b/src/Apps/Order/Routes/Shipping/Hooks/useShippingContext.ts @@ -1,4 +1,4 @@ -import { ShippingContext } from "Apps/Order/Routes/Shipping2/ShippingContext" +import { ShippingContext } from "Apps/Order/Routes/Shipping/ShippingContext" import { useContext } from "react" export const useShippingContext = () => { diff --git a/src/Apps/Order/Routes/Shipping2/Hooks/useUserAddressUpdates.ts b/src/Apps/Order/Routes/Shipping/Hooks/useUserAddressUpdates.ts similarity index 96% rename from src/Apps/Order/Routes/Shipping2/Hooks/useUserAddressUpdates.ts rename to src/Apps/Order/Routes/Shipping/Hooks/useUserAddressUpdates.ts index 5aa5f8fc37d..2723b6c4fa9 100644 --- a/src/Apps/Order/Routes/Shipping2/Hooks/useUserAddressUpdates.ts +++ b/src/Apps/Order/Routes/Shipping/Hooks/useUserAddressUpdates.ts @@ -1,9 +1,9 @@ -import { useShippingContext } from "Apps/Order/Routes/Shipping2/Hooks/useShippingContext" -import { useCreateSavedAddress } from "Apps/Order/Routes/Shipping2/Mutations/useCreateSavedAddress" -import { useDeleteSavedAddress } from "Apps/Order/Routes/Shipping2/Mutations/useDeleteSavedAddress" -import { useUpdateSavedAddress } from "Apps/Order/Routes/Shipping2/Mutations/useUpdateSavedAddress" -import { useUpdateUserDefaultAddress } from "Apps/Order/Routes/Shipping2/Mutations/useUpdateUserDefaultAddress" -import { ShippingContextProps } from "Apps/Order/Routes/Shipping2/ShippingContext" +import { useShippingContext } from "Apps/Order/Routes/Shipping/Hooks/useShippingContext" +import { useCreateSavedAddress } from "Apps/Order/Routes/Shipping/Mutations/useCreateSavedAddress" +import { useDeleteSavedAddress } from "Apps/Order/Routes/Shipping/Mutations/useDeleteSavedAddress" +import { useUpdateSavedAddress } from "Apps/Order/Routes/Shipping/Mutations/useUpdateSavedAddress" +import { useUpdateUserDefaultAddress } from "Apps/Order/Routes/Shipping/Mutations/useUpdateUserDefaultAddress" +import { ShippingContextProps } from "Apps/Order/Routes/Shipping/ShippingContext" import { FulfillmentType, FulfillmentValues, @@ -12,7 +12,7 @@ import { addressWithFallbackValues, getAddressByID, matchAddressFields, -} from "Apps/Order/Routes/Shipping2/Utils/shippingUtils" +} from "Apps/Order/Routes/Shipping/Utils/shippingUtils" import createLogger from "Utils/logger" import { useCreateSavedAddressMutation$data } from "__generated__/useCreateSavedAddressMutation.graphql" import { useDeleteSavedAddressMutation$data } from "__generated__/useDeleteSavedAddressMutation.graphql" diff --git a/src/Apps/Order/Routes/Shipping2/Mutations/useCreateSavedAddress.ts b/src/Apps/Order/Routes/Shipping/Mutations/useCreateSavedAddress.ts similarity index 97% rename from src/Apps/Order/Routes/Shipping2/Mutations/useCreateSavedAddress.ts rename to src/Apps/Order/Routes/Shipping/Mutations/useCreateSavedAddress.ts index 3823917df89..b3c235ba2b7 100644 --- a/src/Apps/Order/Routes/Shipping2/Mutations/useCreateSavedAddress.ts +++ b/src/Apps/Order/Routes/Shipping/Mutations/useCreateSavedAddress.ts @@ -8,7 +8,7 @@ export const useCreateSavedAddress = () => { mutation useCreateSavedAddressMutation($input: CreateUserAddressInput!) { createUserAddress(input: $input) { me { - ...Shipping2_me + ...Shipping_me } userAddressOrErrors { __typename diff --git a/src/Apps/Order/Routes/Shipping2/Mutations/useDeleteSavedAddress.ts b/src/Apps/Order/Routes/Shipping/Mutations/useDeleteSavedAddress.ts similarity index 95% rename from src/Apps/Order/Routes/Shipping2/Mutations/useDeleteSavedAddress.ts rename to src/Apps/Order/Routes/Shipping/Mutations/useDeleteSavedAddress.ts index e94575c6062..54af316d16a 100644 --- a/src/Apps/Order/Routes/Shipping2/Mutations/useDeleteSavedAddress.ts +++ b/src/Apps/Order/Routes/Shipping/Mutations/useDeleteSavedAddress.ts @@ -8,7 +8,7 @@ export const useDeleteSavedAddress = () => { mutation useDeleteSavedAddressMutation($input: DeleteUserAddressInput!) { deleteUserAddress(input: $input) { me { - ...Shipping2_me + ...Shipping_me } userAddressOrErrors { __typename diff --git a/src/Apps/Order/Routes/Shipping2/Mutations/useSaveFulfillmentDetails.ts b/src/Apps/Order/Routes/Shipping/Mutations/useSaveFulfillmentDetails.ts similarity index 96% rename from src/Apps/Order/Routes/Shipping2/Mutations/useSaveFulfillmentDetails.ts rename to src/Apps/Order/Routes/Shipping/Mutations/useSaveFulfillmentDetails.ts index 9bf66aa55f5..35fe245f281 100644 --- a/src/Apps/Order/Routes/Shipping2/Mutations/useSaveFulfillmentDetails.ts +++ b/src/Apps/Order/Routes/Shipping/Mutations/useSaveFulfillmentDetails.ts @@ -16,7 +16,7 @@ export const useSaveFulfillmentDetails = () => { internalID __typename ... on CommerceOrder { - ...Shipping2_order + ...Shipping_order } } } diff --git a/src/Apps/Order/Routes/Shipping2/Mutations/useSelectShippingQuote.ts b/src/Apps/Order/Routes/Shipping/Mutations/useSelectShippingQuote.ts similarity index 96% rename from src/Apps/Order/Routes/Shipping2/Mutations/useSelectShippingQuote.ts rename to src/Apps/Order/Routes/Shipping/Mutations/useSelectShippingQuote.ts index f7840cd1c38..693dc2ec5f9 100644 --- a/src/Apps/Order/Routes/Shipping2/Mutations/useSelectShippingQuote.ts +++ b/src/Apps/Order/Routes/Shipping/Mutations/useSelectShippingQuote.ts @@ -13,7 +13,7 @@ export const useSelectShippingQuote = () => { __typename ... on CommerceOrderWithMutationSuccess { order { - ...Shipping2_order + ...Shipping_order } } ... on CommerceOrderWithMutationFailure { diff --git a/src/Apps/Order/Routes/Shipping2/Mutations/useUpdateSavedAddress.ts b/src/Apps/Order/Routes/Shipping/Mutations/useUpdateSavedAddress.ts similarity index 97% rename from src/Apps/Order/Routes/Shipping2/Mutations/useUpdateSavedAddress.ts rename to src/Apps/Order/Routes/Shipping/Mutations/useUpdateSavedAddress.ts index 3a3f30487ba..5c6d40619e5 100644 --- a/src/Apps/Order/Routes/Shipping2/Mutations/useUpdateSavedAddress.ts +++ b/src/Apps/Order/Routes/Shipping/Mutations/useUpdateSavedAddress.ts @@ -8,7 +8,7 @@ export const useUpdateSavedAddress = () => { mutation useUpdateSavedAddressMutation($input: UpdateUserAddressInput!) { updateUserAddress(input: $input) { me { - ...Shipping2_me + ...Shipping_me } userAddressOrErrors { __typename diff --git a/src/Apps/Order/Routes/Shipping2/Mutations/useUpdateUserDefaultAddress.ts b/src/Apps/Order/Routes/Shipping/Mutations/useUpdateUserDefaultAddress.ts similarity index 96% rename from src/Apps/Order/Routes/Shipping2/Mutations/useUpdateUserDefaultAddress.ts rename to src/Apps/Order/Routes/Shipping/Mutations/useUpdateUserDefaultAddress.ts index 4b2abc0b8e8..470b2e92cda 100644 --- a/src/Apps/Order/Routes/Shipping2/Mutations/useUpdateUserDefaultAddress.ts +++ b/src/Apps/Order/Routes/Shipping/Mutations/useUpdateUserDefaultAddress.ts @@ -10,7 +10,7 @@ export const useUpdateUserDefaultAddress = () => { ) { updateUserDefaultAddress(input: $input) { me { - ...Shipping2_me + ...Shipping_me } userAddressOrErrors { __typename diff --git a/src/Apps/Order/Routes/Shipping2/ShippingContext.tsx b/src/Apps/Order/Routes/Shipping/ShippingContext.tsx similarity index 98% rename from src/Apps/Order/Routes/Shipping2/ShippingContext.tsx rename to src/Apps/Order/Routes/Shipping/ShippingContext.tsx index 65533a8918e..103a194558a 100644 --- a/src/Apps/Order/Routes/Shipping2/ShippingContext.tsx +++ b/src/Apps/Order/Routes/Shipping/ShippingContext.tsx @@ -2,20 +2,20 @@ import React, { createContext, FC, useMemo, useReducer, useRef } from "react" import { ComputedOrderData, computeOrderData, -} from "Apps/Order/Routes/Shipping2/Utils/computeOrderData" +} from "Apps/Order/Routes/Shipping/Utils/computeOrderData" import { ShippingContext_order$key } from "__generated__/ShippingContext_order.graphql" import { ShippingContext_me$key } from "__generated__/ShippingContext_me.graphql" import { compact } from "lodash" import { extractNodes } from "Utils/extractNodes" -import { ShippingProps, ShippingStage } from "Apps/Order/Routes/Shipping2" +import { ShippingProps, ShippingStage } from "Apps/Order/Routes/Shipping" import { FormikProps } from "formik" import { FulfillmentValues, SavedAddressType, -} from "Apps/Order/Routes/Shipping2/Utils/shippingUtils" +} from "Apps/Order/Routes/Shipping/Utils/shippingUtils" import createLogger from "Utils/logger" import { Dialog } from "Apps/Order/Dialogs" -import { useHandleExchangeError } from "Apps/Order/Routes/Shipping2/Hooks/useHandleExchangeError" +import { useHandleExchangeError } from "Apps/Order/Routes/Shipping/Hooks/useHandleExchangeError" import { graphql, useFragment } from "react-relay" export interface State { diff --git a/src/Apps/Order/Routes/Shipping2/Utils/computeOrderData.ts b/src/Apps/Order/Routes/Shipping/Utils/computeOrderData.ts similarity index 98% rename from src/Apps/Order/Routes/Shipping2/Utils/computeOrderData.ts rename to src/Apps/Order/Routes/Shipping/Utils/computeOrderData.ts index 9291ae81e3e..64b9650e19d 100644 --- a/src/Apps/Order/Routes/Shipping2/Utils/computeOrderData.ts +++ b/src/Apps/Order/Routes/Shipping/Utils/computeOrderData.ts @@ -1,11 +1,11 @@ -import { ShippingContextProps } from "Apps/Order/Routes/Shipping2/ShippingContext" +import { ShippingContextProps } from "Apps/Order/Routes/Shipping/ShippingContext" import { FulfillmentType, PickupValues, ShippingAddressFormValues, addressWithFallbackValues, matchAddressFields, -} from "Apps/Order/Routes/Shipping2/Utils/shippingUtils" +} from "Apps/Order/Routes/Shipping/Utils/shippingUtils" import { ALL_COUNTRY_CODES, EU_COUNTRY_CODES } from "Components/CountrySelect" import { extractNodes } from "Utils/extractNodes" import { ShippingContext_order$data } from "__generated__/ShippingContext_order.graphql" diff --git a/src/Apps/Order/Routes/Shipping2/Utils/shippingUtils.ts b/src/Apps/Order/Routes/Shipping/Utils/shippingUtils.ts similarity index 100% rename from src/Apps/Order/Routes/Shipping2/Utils/shippingUtils.ts rename to src/Apps/Order/Routes/Shipping/Utils/shippingUtils.ts diff --git a/src/Apps/Order/Routes/Shipping/index.tsx b/src/Apps/Order/Routes/Shipping/index.tsx index 62b6380656d..f0342c28e4a 100644 --- a/src/Apps/Order/Routes/Shipping/index.tsx +++ b/src/Apps/Order/Routes/Shipping/index.tsx @@ -1,1116 +1,162 @@ +import { FC, useEffect } from "react" +import { graphql, useFragment } from "react-relay" +import { Box, Flex, Spacer } from "@artsy/palette" import { - BorderedRadio, - Box, - Button, - Checkbox, - Flex, - RadioGroup, - Spacer, - Text, -} from "@artsy/palette" -import { useSystemContext } from "System/Hooks/useSystemContext" -import { RouterLink } from "System/Components/RouterLink" -import { Shipping_order$data } from "__generated__/Shipping_order.graphql" + Shipping_order$data, + Shipping_order$key, +} from "__generated__/Shipping_order.graphql" import { - CommerceOrderFulfillmentTypeEnum, - CommerceSetShippingInput, -} from "__generated__/SetShippingMutation.graphql" + Shipping_me$data, + Shipping_me$key, +} from "__generated__/Shipping_me.graphql" +import { Media } from "Utils/Responsive" import { ArtworkSummaryItemFragmentContainer as ArtworkSummaryItem } from "Apps/Order/Components/ArtworkSummaryItem" -import { PartnerOfferTimerItem } from "Apps/Order/Components/PartnerOfferTimerItem" import { buyNowFlowSteps, offerFlowSteps, } from "Apps/Order/Components/OrderStepper" -import { - PhoneNumber, - PhoneNumberChangeHandler, - PhoneNumberError, - PhoneNumberForm, - PhoneNumberTouched, -} from "Apps/Order/Components/PhoneNumberForm" import { TransactionDetailsSummaryItemFragmentContainer as TransactionDetailsSummaryItem } from "Apps/Order/Components/TransactionDetailsSummaryItem" import { Dialog, injectDialog } from "Apps/Order/Dialogs" -import { - CommitMutation, - injectCommitMutation, -} from "Apps/Order/Utils/commitMutation" -import { - validateAddress, - validatePhoneNumber, -} from "Apps/Order/Utils/formValidators" -import * as DeprecatedSchema from "@artsy/cohesion/dist/DeprecatedSchema" -import { - Address, - AddressChangeHandler, - AddressErrors, - AddressForm, - AddressTouched, -} from "Components/Address/AddressForm" -import { Router } from "found" -import { FC, useState, useEffect } from "react" -import { COUNTRIES_IN_EUROPEAN_UNION } from "@artsy/commerce_helpers" -import { RelayProp, createFragmentContainer, graphql } from "react-relay" -import createLogger from "Utils/logger" -import { Media } from "Utils/Responsive" import { BuyerGuarantee } from "Apps/Order/Components/BuyerGuarantee" -import { Collapse } from "Apps/Order/Components/Collapse" -import { Shipping_me$data } from "__generated__/Shipping_me.graphql" -import { - startingPhoneNumber, - startingAddress, - MutationAddressResponse, - convertShippingAddressForExchange, - defaultShippingAddressIndex, - getDefaultShippingQuoteId, - getSelectedShippingQuoteId, - getShippingQuotes, - getShippingOption, - ShippingQuotesType, -} from "Apps/Order/Utils/shippingUtils" -import { - NEW_ADDRESS, - SavedAddressesFragmentContainer as SavedAddresses, -} from "Apps/Order/Components/SavedAddresses" -import { createUserAddress } from "Apps/Order/Mutations/CreateUserAddress" -import { setShipping } from "Apps/Order/Mutations/SetShipping" -import { ShippingQuotesFragmentContainer } from "Apps/Order/Components/ShippingQuotes" -import { compact } from "lodash" -import { selectShippingOption } from "Apps/Order/Mutations/SelectShippingOption" -import { updateUserAddress } from "Apps/Order/Mutations/UpdateUserAddress" -import { deleteUserAddress } from "Apps/Order/Mutations/DeleteUserAddress" -import { CreateUserAddressMutation$data } from "__generated__/CreateUserAddressMutation.graphql" -import { UpdateUserAddressMutation$data } from "__generated__/UpdateUserAddressMutation.graphql" -import { - ActionType, - ClickedSelectShippingOption, - ClickedShippingAddress, - ContextModule, - OwnerType, -} from "@artsy/cohesion" -import { useTracking } from "react-tracking" +import { ShippingQuotes } from "Apps/Order/Routes/Shipping/Components/ShippingQuotes" +import { ContextModule, OwnerType } from "@artsy/cohesion" import { OrderRouteContainer } from "Apps/Order/Components/OrderRouteContainer" -import { extractNodes } from "Utils/extractNodes" -import { useFeatureFlag } from "System/Hooks/useFeatureFlag" -import { - AddressVerificationFlowQueryRenderer, - AddressVerifiedBy, -} from "Apps/Order/Components/AddressVerificationFlow" import { Analytics } from "System/Contexts/AnalyticsContext" -import { - ErrorDialogs, - getErrorDialogCopy, -} from "Apps/Order/Utils/getErrorDialogCopy" -import { Jump, useJump } from "Utils/Hooks/useJump" - -const logger = createLogger("Order/Routes/Shipping/index.tsx") +import { FulfillmentDetails } from "Apps/Order/Routes/Shipping/Components/FulfillmentDetails" +import { ShippingContextProvider } from "Apps/Order/Routes/Shipping/ShippingContext" +import { useShippingContext } from "Apps/Order/Routes/Shipping/Hooks/useShippingContext" +import { SaveAndContinueButton } from "Apps/Order/Routes/Shipping/Components/SaveAndContinueButton" +import { useJump, Jump } from "Utils/Hooks/useJump" + +export type ShippingStage = + // User choosing fulfillment type + | "fulfillment_details" + // Temporary stage after address has been automatically saved + // to wait for click + | "fulfillment_details_saved" + // User choosing shipping quote + | "shipping_quotes" export interface ShippingProps { order: Shipping_order$data me: Shipping_me$data - relay?: RelayProp - router: Router dialog: Dialog - commitMutation: CommitMutation - isCommittingMutation: boolean } -export const ShippingRoute: FC = props => { - const { trackEvent } = useTracking() - const { relayEnvironment } = useSystemContext() - - const addressVerificationUSEnabled = !!useFeatureFlag( - "address_verification_us" - ) - const addressVerificationIntlEnabled = !!useFeatureFlag( - "address_verification_intl" - ) - - // true if the current address needs to be verified - // TODO: Is this necessary, or can it just use the checks above? - const [addressNeedsVerification, setAddressNeedsVerification] = useState< - boolean - >(false) - - // Presence of addressVerifiedBy indicates that the address has been verified - // via the address verification flow. - const [ - addressVerifiedBy, - setAddressVerifiedBy, - ] = useState(null) - - const [readyToSaveVerifiedAddress, setReadyToSaveVerifiedAddress] = useState( - false - ) - - const [shippingOption, setShippingOption] = useState< - CommerceOrderFulfillmentTypeEnum - >(getShippingOption(props.order.requestedFulfillment?.__typename)) - - const [shippingQuoteId, setShippingQuoteId] = useState( - getSelectedShippingQuoteId(props.order) - ) - const [shippingQuotes, setShippingQuotes] = useState( - getShippingQuotes(props.order) - ) - - const [address, setAddress] = useState
( - // @ts-expect-error PLEASE_FIX_ME_STRICT_NULL_CHECK_MIGRATION - startingAddress(props.me, props.order) - ) - const [selectedAddressID, setSelectedAddressID] = useState( - defaultShippingAddressIndex(props.me, props.order) +export const ShippingRoute: FC<{ + order: Shipping_order$key + me: Shipping_me$key + dialog: Dialog +}> = props => { + const orderData = useFragment(ORDER_FRAGMENT, props.order) + const meData = useFragment(ME_FRAGMENT, props.me) + return ( + + + + + ) - const [addressErrors, setAddressErrors] = useState({}) - const [addressTouched, setAddressTouched] = useState({}) +} - const [phoneNumber, setPhoneNumber] = useState( - startingPhoneNumber(props.me, props.order) - ) - const [phoneNumberError, setPhoneNumberError] = useState("") - const [phoneNumberTouched, setPhoneNumberTouched] = useState< - PhoneNumberTouched - >(false) - const addressList = extractNodes(props.me?.addressConnection) ?? [] +const ShippingRouteLayout: FC> = ({ + me, + order, +}) => { + const shippingContext = useShippingContext() - const [saveAddress, setSaveAddress] = useState(true) - const [deletedAddressID, setDeletedAddressID] = useState() - const [savedAddressID, setSavedAddressID] = useState( - undefined - ) + const { jumpTo } = useJump() useEffect(() => { - const isAddressRemoved = !addressList.find( - address => address.internalID === deletedAddressID - ) - - if (deletedAddressID && isAddressRemoved) { - if (!addressList || addressList.length === 0) { - setSelectedAddressID(NEW_ADDRESS) - setShippingQuotes(null) - setShippingQuoteId(undefined) - } else if (selectedAddressID == deletedAddressID) { - selectSavedAddress( - addressList.find(address => address.isDefault)?.internalID as string - ) - } - - setDeletedAddressID(undefined) + if (shippingContext.state.stage === "shipping_quotes") { + jumpTo("shippingOptionsTop", { behavior: "smooth" }) } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [addressList, deletedAddressID]) - - const touchedAddress = () => { - return { - name: true, - country: true, - postalCode: true, - addressLine1: true, - addressLine2: true, - city: true, - region: true, - phoneNumber: true, - } - } - - const handleAddressDelete = (deletedAddressID: string) => { - setDeletedAddressID(deletedAddressID) - } - - const getOrderArtwork = () => props.order.lineItems?.edges?.[0]?.node?.artwork - const isCreateNewAddress = () => selectedAddressID === NEW_ADDRESS - - const checkIfArtsyShipping = () => { - const artwork = getOrderArtwork() - const processWithArtsyShippingDomestic = !!artwork?.processWithArtsyShippingDomestic - const artsyShippingInternational = !!artwork?.artsyShippingInternational - - const shippingCountry = isCreateNewAddress() - ? address.country - : addressList && - addressList.find(address => address.internalID == selectedAddressID) - ?.country - - const isDomesticOrder = - (COUNTRIES_IN_EUROPEAN_UNION.includes(shippingCountry) && - COUNTRIES_IN_EUROPEAN_UNION.includes(artwork?.shippingCountry)) || - artwork?.shippingCountry == shippingCountry - const isInternationalOrder = !isDomesticOrder + }, [shippingContext.state.stage]) - return ( - shippingOption === "SHIP" && - ((processWithArtsyShippingDomestic && isDomesticOrder) || - (artsyShippingInternational && isInternationalOrder)) - ) - } - - const isAddressVerificationEnabled = (): boolean => { - return address.country === "US" - ? addressVerificationUSEnabled - : addressVerificationIntlEnabled - } - - // Save shipping info on the order. If it's Artsy shipping and a quote hasn't - // been selected, this renders the quotes for user to select and finalize - // again. - const finalizeFulfillment = async () => { - if (checkIfArtsyShipping() && !!shippingQuoteId) { - selectShippingQuote() - } else { - selectShipping() - } - } - - /** - * Perform basic form validation for address and phone number. - * - * @returns true if both are valid; false, otherwise - */ - const validateAddressAndPhoneNumber = () => { - const { - errors: addressErrors, - hasErrors: invalidAddress, - } = validateAddress(address) - const { - error: phoneNumberError, - hasError: invalidPhoneNumber, - } = validatePhoneNumber(phoneNumber) - - if (invalidPhoneNumber) { - setPhoneNumberError(phoneNumberError as string) - setPhoneNumberTouched(true) - !invalidAddress && jumpTo("phoneNumberTop", { behavior: "smooth" }) - } - - if (invalidAddress) { - setAddressErrors(addressErrors) - setAddressTouched(touchedAddress) - jumpTo("deliveryAddressTop", { behavior: "smooth" }) - } - - return !invalidAddress && !invalidPhoneNumber - } - - const onContinueButtonPressed = async () => { - if ( - shippingOption === "SHIP" && - isCreateNewAddress() && - !validateAddressAndPhoneNumber() - ) { - return - } - - if ( - isAddressVerificationEnabled() && - !addressVerifiedBy && - isCreateNewAddress() - ) { - /** - * Setting addressNeedsVerification to true will cause the address - * verification flow to be initiated on this render. - */ - setAddressNeedsVerification(true) - return - } - - finalizeFulfillment() - } - - const selectShipping = async (editedAddress?: MutationAddressResponse) => { - if (shippingOption === "PICKUP") { - const { error, hasError } = validatePhoneNumber(phoneNumber) - if (hasError) { - setPhoneNumberError(error as string) - setPhoneNumberTouched(true) - return - } - } - - try { - // if not creating a new address, use the saved address selection for shipping - const shipToAddress = isCreateNewAddress() - ? address - : convertShippingAddressForExchange( - editedAddress - ? editedAddress - : // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - addressList.find( - address => address.internalID == selectedAddressID - )! - ) - - const shipToPhoneNumber = - isCreateNewAddress() || shippingOption === "PICKUP" - ? phoneNumber - : addressList.find(address => address.internalID == selectedAddressID) - ?.phoneNumber - - setShippingQuotes(null) - setShippingQuoteId(undefined) - - const isArtsyShipping = checkIfArtsyShipping() - - const mutationInput: CommerceSetShippingInput = { - id: props.order.internalID, - fulfillmentType: isArtsyShipping ? "SHIP_ARTA" : shippingOption, - shipping: shipToAddress, - phoneNumber: shipToPhoneNumber, - } - if (addressVerifiedBy) { - mutationInput.addressVerifiedBy = addressVerifiedBy - } - - const orderOrError = ( - await setShipping(props.commitMutation, { - input: mutationInput, - }) - ).commerceSetShipping?.orderOrError - - if (orderOrError?.error) { - handleSubmitError(orderOrError.error) - return - } - // update address when user is entering new address AND save checkbox is selected - await updateAddress() - - if (isArtsyShipping) { - setShippingQuotes(getShippingQuotes(orderOrError?.order)) - jumpTo("shippingOptionsTop", { behavior: "smooth" }) - } else { - props.router.push(`/orders/${props.order.internalID}/payment`) - } - } catch (error) { - logger.error(error) - - trackEvent({ - action: ActionType.errorMessageViewed, - context_owner_type: OwnerType.ordersShipping, - context_owner_id: props.order.internalID, - title: "An error occurred", - message: - "Something went wrong. Please try again or contact orders@artsy.net.", - error_code: null, - flow: "user selects a shipping option", - }) - - props.dialog.showErrorDialog() - } - } - - const selectShippingQuote = async () => { - const { order } = props - - if (shippingQuoteId && order.internalID) { - try { - const orderOrError = ( - await selectShippingOption(props.commitMutation, { - input: { - id: order.internalID, - selectedShippingQuoteId: shippingQuoteId, - }, - }) - ).commerceSelectShippingOption?.orderOrError - - await updateAddress() - - if (orderOrError?.error) { - handleSubmitError(orderOrError.error) - return + return ( + + + - props.router.push(`/orders/${props.order.internalID}/payment`) - } catch (error) { - logger.error(error) - - trackEvent({ - action: ActionType.errorMessageViewed, - context_owner_type: OwnerType.ordersShipping, - context_owner_id: props.order.internalID, - title: "An error occurred", - message: - "There was a problem getting shipping quotes. Please contact orders@artsy.net.", - error_code: null, - flow: "user sets a shipping quote", - }) - - props.dialog.showErrorDialog({ - message: getArtaErrorMessage(), - }) - } - } - } - - const updateAddress = async () => { - const shouldCreateNewAddress = isCreateNewAddress() + + - if (saveAddress) { - if ( - shippingOption === "SHIP" && - shouldCreateNewAddress && - relayEnvironment - ) { - if (savedAddressID) { - updateUserAddress( - relayEnvironment, - savedAddressID, - { - ...address, - phoneNumber: phoneNumber, - }, // address - () => {}, - () => { - message => { - logger.error(message) - } - }, // onError - () => {} // onSuccess - ) - } else { - await createUserAddress( - relayEnvironment, - { - ...address, - phoneNumber: phoneNumber, - }, // address - data => { - setSavedAddressID( - data?.createUserAddress?.userAddressOrErrors.internalID - ) - }, // onSuccess - () => { - message => { - logger.error(message) - } - }, // onError - props.me, // me - () => {} - ) + + + + } - } - } else if (savedAddressID) { - deleteUserAddress( - relayEnvironment, - savedAddressID, - () => {}, - message => { - logger.error(message) - } - ) - } - } - - const handleSubmitError = (error: { - code: string - data: string | null | undefined - }) => { - logger.error(error) - const parsedData = error.data ? JSON.parse(error.data) : {} - if ( - error.code === "missing_region" || - error.code === "missing_country" || - error.code === "missing_postal_code" - ) { - trackEvent({ - action: ActionType.errorMessageViewed, - context_owner_type: OwnerType.ordersShipping, - context_owner_id: props.order.internalID, - title: "Invalid address", - message: - "There was an error processing your address. Please review and try again.", - error_code: error.code, - flow: "user submits a shipping option", - }) - - props.dialog.showErrorDialog({ - title: "Invalid address", - message: - "There was an error processing your address. Please review and try again.", - }) - } else if ( - error.code === "unsupported_shipping_location" && - parsedData.failure_code === "domestic_shipping_only" - ) { - trackEvent({ - action: ActionType.errorMessageViewed, - context_owner_type: OwnerType.ordersShipping, - context_owner_id: props.order.internalID, - title: "Can't ship to that address", - message: "This work can only be shipped domestically.", - error_code: error.code, - flow: "user submits a shipping option", - }) - - props.dialog.showErrorDialog({ - title: "Can't ship to that address", - message: "This work can only be shipped domestically.", - }) - } else if (error.code === "destination_could_not_be_geocoded") { - const { title, message, formattedMessage } = getErrorDialogCopy( - ErrorDialogs.DestinationCouldNotBeGeocoded - ) - - trackEvent({ - action: ActionType.errorMessageViewed, - context_owner_type: OwnerType.ordersShipping, - context_owner_id: props.order.internalID, - title, - message, - error_code: error.code, - flow: "user submits a shipping option", - }) + sidebar={ + + + - props.dialog.showErrorDialog({ - title, - message: formattedMessage, - }) - } else if (checkIfArtsyShipping() && shippingQuoteId) { - trackEvent({ - action: ActionType.errorMessageViewed, - context_owner_type: OwnerType.ordersShipping, - context_owner_id: props.order.internalID, - title: "An error occurred", - message: - "There was a problem getting shipping quotes. Please contact orders@artsy.net.", - error_code: null, - flow: "user submits a shipping option", - }) + + - props.dialog.showErrorDialog({ - message: getArtaErrorMessage(), - }) - } else { - trackEvent({ - action: ActionType.errorMessageViewed, - context_owner_type: OwnerType.ordersShipping, - context_owner_id: props.order.internalID, - title: "An error occurred", - message: - "Something went wrong. Please try again or contact orders@artsy.net.", - error_code: null, - flow: "user submits a shipping option", - }) + - props.dialog.showErrorDialog() - } - } + - const getArtaErrorMessage = () => ( - <> - There was a problem getting shipping quotes.
- Please contact{" "} - - orders@artsy.net - - . - + + + +
+ } + /> +
) +} - const onAddressChange: AddressChangeHandler = (newAddress, key) => { - const { errors } = validateAddress(newAddress) - setAddress(newAddress) - setAddressErrors({ - ...addressErrors, - ...errors, - }) - setAddressTouched({ - ...addressTouched, - [key]: true, - }) - - setShippingQuotes(null) - setShippingQuoteId(undefined) - - // If the address has already been verified and the user is editing the form, - // consider this a user-verified address (perform verification only once). - if (addressVerifiedBy) { - setAddressVerifiedBy(AddressVerifiedBy.USER) - } - } - - const onPhoneNumberChange: PhoneNumberChangeHandler = newPhoneNumber => { - const { error } = validatePhoneNumber(newPhoneNumber) - - setPhoneNumber(newPhoneNumber) - setPhoneNumberError(error as string) - setPhoneNumberTouched(true) - setShippingQuotes(null) - setShippingQuoteId(undefined) - } - - useEffect(() => { - if ( - addressList?.length > 0 && - checkIfArtsyShipping() && - !isCreateNewAddress() +const ORDER_FRAGMENT = graphql` + fragment Shipping_order on CommerceOrder { + ...ShippingContext_order + ...FulfillmentDetailsForm_order + ...SaveAndContinueButton_order + ...ArtworkSummaryItem_order + ...TransactionDetailsSummaryItem_order + ...OrderStepper_order + ...ShippingQuotes_order + internalID + } +` +const ME_FRAGMENT = graphql` + fragment Shipping_me on Me + @argumentDefinitions( + first: { type: "Int", defaultValue: 30 } + last: { type: "Int" } + after: { type: "String" } + before: { type: "String" } ) { - selectShipping() - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [shippingOption, selectedAddressID]) - - const onSelectShippingOption = ( - newShippingOption: CommerceOrderFulfillmentTypeEnum - ) => { - trackEvent({ - action_type: DeprecatedSchema.ActionType.Click, - subject: - newShippingOption === "SHIP" - ? DeprecatedSchema.Subject.BNMOProvideShipping - : DeprecatedSchema.Subject.BNMOArrangePickup, - flow: "buy now", - type: "button", - }) - - if (shippingOption !== newShippingOption) { - setShippingOption(newShippingOption) - } - } - - const handleShippingQuoteSelected = (newShippingQuoteId: string) => { - trackEvent({ - // analytics data missing if default shipping is already selected? - action: ActionType.clickedSelectShippingOption, - context_module: ContextModule.ordersShipping, - context_page_owner_type: "orders-shipping", - subject: newShippingQuoteId, - } as ClickedSelectShippingOption) - - setShippingQuoteId(newShippingQuoteId) - } - - const selectSavedAddressWithTracking = (value: string) => { - trackEvent({ - action: ActionType.clickedShippingAddress, - context_module: ContextModule.ordersShipping, - context_page_owner_type: "orders-shipping", - } as ClickedShippingAddress) - selectSavedAddress(value) - } - - const selectSavedAddress = (value: string) => { - if (selectedAddressID !== value) { - setSelectedAddressID(value) - setShippingQuotes(null) - setShippingQuoteId(undefined) - } - } - - const handleAddressEdit = ( - editedAddress: UpdateUserAddressMutation$data["updateUserAddress"] - ) => { - // reload shipping quotes if selected address edited - if (selectedAddressID === editedAddress?.userAddressOrErrors?.internalID) { - setShippingQuotes(null) - setShippingQuoteId(undefined) - - if (checkIfArtsyShipping()) { - selectShipping(editedAddress.userAddressOrErrors) - } - } - } - - const handleAddressCreate = ( - createdAddress: CreateUserAddressMutation$data["createUserAddress"] - ) => { - if (createdAddress?.userAddressOrErrors?.internalID) { - selectSavedAddress(createdAddress.userAddressOrErrors.internalID) - } - } - - const isSaveAndContinueAllowed = (): boolean => { - if (shippingOption === "PICKUP") { - return !phoneNumber || !!phoneNumberError - } - - return false - } - - // Automatically proceed after address verification flow is completed. - useEffect(() => { - if (readyToSaveVerifiedAddress) { - finalizeFulfillment() - } - // disabled because we only want this to run when once when readyToSaveVerifiedAddress changes to true - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [readyToSaveVerifiedAddress]) - - const renderArtaErrorMessage = () => { - return ( - - In order to provide a shipping quote, we need some more information from - you. Please contact{" "} - - orders@artsy.net - {" "} - so we can assist you. - - ) + ...FulfillmentDetailsForm_me + ...ShippingContext_me + @arguments(first: $first, last: $last, before: $before, after: $after) } +` - const renderArtsyShippingOptionText = () => { - let text - if (isOffer) { - text = - "Please note that these are estimates and may change once offer is finalized. " - } else { - text = "" - } - return `${text}All options are eligible for Artsy’s Buyer Protection policy, which protects against damage and loss.` - } - - const { order, isCommittingMutation } = props - const artwork = getOrderArtwork() - const shippingSelected = - !artwork?.pickup_available || shippingOption === "SHIP" - const showAddressForm = - shippingSelected && (isCreateNewAddress() || addressList?.length === 0) - const showSavedAddresses = - shippingSelected && addressList && addressList.length > 0 - const isArtsyShipping = checkIfArtsyShipping() - const showArtsyShipping = - isArtsyShipping && !!shippingQuotes && shippingQuotes.length > 0 - const isOffer = order.mode === "OFFER" - const useDefaultArtsyShippingQuote = - isArtsyShipping && - shippingQuotes && - shippingQuotes.length > 0 && - !shippingQuoteId - const { jumpTo } = useJump() - - // TODO: consider to move this block to a useEffect - if (useDefaultArtsyShippingQuote) { - const defaultShippingQuoteId = getDefaultShippingQuoteId(order) - shippingQuoteId !== defaultShippingQuoteId && - setShippingQuoteId(defaultShippingQuoteId) - } - - return ( - - - - {/* TODO: Make RadioGroup generic for the allowed values, - which could also ensure the children only use - allowed values. */} - {artwork?.pickup_available && ( - <> - - - Delivery method - - - - - - After your order is confirmed, a specialist will - contact you to coordinate pickup. - - - - - - - )} - - {/* SAVED ADDRESSES */} - - - Delivery address - - {isArtsyShipping && - shippingQuotes && - shippingQuotes.length === 0 && - renderArtaErrorMessage()} - - - - {/* NEW ADDRESS */} - - {isArtsyShipping && - shippingQuotes && - shippingQuotes.length === 0 && - renderArtaErrorMessage()} - - - Delivery address - - {addressNeedsVerification && ( - { - setAddressNeedsVerification(false) - setAddressVerifiedBy(AddressVerifiedBy.USER) - }} - onChosenAddress={(verifiedBy, chosenAddress) => { - setAddressNeedsVerification(false) - setAddressVerifiedBy(verifiedBy) - setAddress(address => { - return { ...address, ...chosenAddress } - }) - // trigger finalizeFulfillment() via useEffect - setReadyToSaveVerifiedAddress(true) - }} - /> - )} - - - - - setSaveAddress(selected)} - selected={saveAddress} - data-test="save-address-checkbox" - > - Save shipping address for later use - - - - - {/* PHONE NUMBER */} - - - - - - {/* SHIPPING OPTION */} - - - Artsy shipping options - - {renderArtsyShippingOptionText()} - - - - - - - - - } - sidebar={ - - - {order.source === "partner_offer" && order.mode === "BUY" && ( - <> - - - - )} - - - - - - - - - - } - /> - - - ) -} - -export const ShippingFragmentContainer = createFragmentContainer( - injectCommitMutation(injectDialog(ShippingRoute)), - { - order: graphql` - fragment Shipping_order on CommerceOrder { - internalID - mode - state - source - requestedFulfillment { - __typename - ... on CommercePickup { - phoneNumber - } - ... on CommerceShip { - name - addressLine1 - addressLine2 - city - region - country - postalCode - phoneNumber - } - ... on CommerceShipArta { - name - addressLine1 - addressLine2 - city - region - country - postalCode - phoneNumber - } - } - lineItems { - edges { - node { - artwork { - slug - processWithArtsyShippingDomestic - artsyShippingInternational - pickup_available: pickupAvailable - onlyShipsDomestically - euShippingOrigin - shippingCountry - } - shippingQuoteOptions { - edges { - ...ShippingQuotes_shippingQuotes - node { - id - isSelected - } - } - } - } - } - } - ...PartnerOfferTimerItem_order - ...ArtworkSummaryItem_order - ...TransactionDetailsSummaryItem_order - ...OrderStepper_order - } - `, - me: graphql` - fragment Shipping_me on Me - @argumentDefinitions( - first: { type: "Int", defaultValue: 30 } - last: { type: "Int" } - after: { type: "String" } - before: { type: "String" } - ) { - name - email - id - location { - country - } - ...SavedAddresses_me - addressConnection( - first: $first - last: $last - before: $before - after: $after - ) { - edges { - node { - id - internalID - addressLine1 - addressLine2 - addressLine3 - city - country - isDefault - name - phoneNumber - postalCode - region - } - } - } - } - `, - } -) +export const ShippingRouteWithDialog = injectDialog(ShippingRoute) diff --git a/src/Apps/Order/Routes/Shipping2/ShippingRoute.tsx b/src/Apps/Order/Routes/Shipping2/ShippingRoute.tsx deleted file mode 100644 index df94de1f0e2..00000000000 --- a/src/Apps/Order/Routes/Shipping2/ShippingRoute.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { ShippingFragmentContainer } from "Apps/Order/Routes/Shipping" -import { ShippingRouteWithDialog } from "Apps/Order/Routes/Shipping2" -import { useFeatureFlag } from "System/Hooks/useFeatureFlag" - -export const ShippingRoute = props => { - const newShippingRoute = useFeatureFlag("refactor-shipping-route") - - if (newShippingRoute) { - return - } - - return -} diff --git a/src/Apps/Order/Routes/Shipping2/__tests__/Shipping2.jest.tsx b/src/Apps/Order/Routes/Shipping2/__tests__/Shipping2.jest.tsx deleted file mode 100644 index 888cea6cc28..00000000000 --- a/src/Apps/Order/Routes/Shipping2/__tests__/Shipping2.jest.tsx +++ /dev/null @@ -1,2611 +0,0 @@ -/* eslint-disable jest/no-disabled-tests */ -import { cloneDeep, merge } from "lodash" -import { setupTestWrapperTL } from "DevTools/setupTestWrapper" -import { MockBoot } from "DevTools/MockBoot" -import { ShippingRouteWithDialog } from "Apps/Order/Routes/Shipping2" -import { graphql } from "react-relay" -import { - UntouchedBuyOrder, - UntouchedOfferOrder, - UntouchedBuyOrderWithArtsyShippingDomesticFromUS, - UntouchedBuyOrderWithArtsyShippingDomesticFromGermany, - UntouchedBuyOrderWithShippingQuotes, - UntouchedBuyOrderWithArtsyShippingInternationalFromUS, - UntouchedBuyOrderWithArtsyShippingInternationalFromGermany, - BuyOrderWithArtaShippingDetails, -} from "Apps/__tests__/Fixtures/Order" -import { - settingOrderShipmentSuccess, - settingOrderArtaShipmentSuccess, - selectShippingQuoteSuccess, -} from "Apps/Order/Routes/__fixtures__/MutationResults/setOrderShipping" -import { - saveAddressSuccess, - updateAddressSuccess, -} from "Apps/Order/Routes/__fixtures__/MutationResults/saveAddress" -import { - Shipping2TestQuery, - Shipping2TestQuery$rawResponse, -} from "__generated__/Shipping2TestQuery.graphql" -import { screen, waitFor } from "@testing-library/react" -import { useTracking } from "react-tracking" -import { useFeatureFlag } from "System/Hooks/useFeatureFlag" -import { - clickSaveAddress, - fillAddressForm, - validAddress, -} from "Components/__tests__/Utils/addressForm2" -import userEvent from "@testing-library/user-event" -import { flushPromiseQueue } from "DevTools/flushPromiseQueue" -import { queryByAttribute } from "@testing-library/dom" -import { ErrorDialogMessage } from "Apps/Order/Utils/getErrorDialogCopy" -import { within } from "@testing-library/dom" -import { MockEnvironment, createMockEnvironment } from "relay-test-utils" -import { useRouter } from "System/Hooks/useRouter" - -jest.setTimeout(10000) - -jest.unmock("react-relay") -jest.mock("react-tracking") -jest.mock("Utils/Hooks/useMatchMedia", () => ({ - __internal__useMatchMedia: () => ({}), -})) - -jest.mock("@artsy/palette", () => { - return { - ...jest.requireActual("@artsy/palette"), - ModalDialog: ({ title, children, onClose, footer }) => { - return ( -
- - {title} - {children} - {footer} -
- ) - }, - } -}) - -jest.mock("System/Hooks/useFeatureFlag", () => ({ - useFeatureFlag: jest.fn(), -})) - -jest.mock("System/Hooks/useRouter", () => ({ - useRouter: jest.fn().mockReturnValue({ - router: jest.fn(), - }), -})) - -const mockShowErrorDialog = jest.fn() -jest.mock("Apps/Order/Dialogs", () => ({ - ...jest.requireActual("Apps/Order/Dialogs"), - injectDialog: Component => props => ( - - ), -})) - -const order = { - ...UntouchedBuyOrder, -} - -const pageInfo = { - startCursor: "aaa", - endCursor: "bbb", - hasNextPage: false, - hasPreviousPage: false, -} - -const meWithoutAddress: Shipping2TestQuery$rawResponse["me"] = { - name: "Test Name", - email: "test@gmail.com", - id: "4321", - location: { - id: "123", - country: "United States", - }, - addressConnection: { - totalCount: 0, - edges: [], - }, -} - -const meWithAddresses: Shipping2TestQuery$rawResponse["me"] = Object.assign( - {}, - meWithoutAddress, - { - addressConnection: { - totalCount: 2, - edges: [ - { - node: { - __typename: "UserAddress", - internalID: "1", - addressLine1: "1 Main St", - addressLine2: "", - addressLine3: "", - city: "Madrid", - country: "ES", - isDefault: false, - name: "Test Name", - phoneNumber: "555-555-5555", - postalCode: "28001", - region: "", - id: "addressID1", - }, - cursor: "aaa", - }, - { - node: { - __typename: "UserAddress", - internalID: "2", - addressLine1: "401 Broadway", - addressLine2: "Floor 25", - addressLine3: "", - city: "New York", - country: "US", - isDefault: true, - name: "Test Name", - phoneNumber: "422-424-4242", - postalCode: "10013", - region: "NY", - id: "addressID2", - }, - cursor: "aaa", - }, - ], - pageInfo, - }, - } -) - -const saveAndContinue = async () => { - await waitFor(() => userEvent.click(screen.getByText("Save and Continue"))) -} - -const validAddressBeforeVerification = { - ...validAddress, - addressLine1: "401 Broadway", - addressLine2: "Suite 25", - city: "New York", - region: "NY", - postalCode: "10013", - country: "US", -} -const recommendedAddress = { - addressLine1: "401 Broadway Suite 25", - addressLine2: null, - city: "New York", - region: "NY", - postalCode: "10013", - country: "US", -} - -const verifyAddressWithSuggestions = async ( - mockResolveLastOperation, - input = validAddressBeforeVerification, - suggested = recommendedAddress -) => { - const addressLines = addr => { - return [ - addr.addressLine1, - addr.addressLine2, - `${addr.city}, ${addr.region} ${addr.postalCode}`, - addr.country, - ] - } - - const suggestedAddress = suggested - ? { ...recommendedAddress, ...suggested } - : recommendedAddress - - const { operationName, operationVariables } = await waitFor(() => { - return mockResolveLastOperation({ - VerifyAddressPayload: () => ({ - verifyAddressOrError: { - __typename: "VerifyAddressType", - verificationStatus: "VERIFIED_WITH_CHANGES", - suggestedAddresses: [ - { - lines: addressLines(suggestedAddress), - address: suggestedAddress, - }, - ], - inputAddress: { - lines: addressLines(validAddress), - address: validAddress, - }, - }, - }), - }) - }) - - expect(operationName).toBe("AddressVerificationFlowQuery") - expect(operationVariables).toEqual({ - address: { - addressLine1: input.addressLine1, - addressLine2: input.addressLine2, - city: input.city, - region: input.region, - postalCode: input.postalCode, - country: input.country, - }, - }) - - expect(await screen.findByText("Confirm your delivery address")).toBeVisible() - expect(await screen.findByText("Recommended")).toBeVisible() - expect(await screen.findByText("What you entered")).toBeVisible() -} - -const resolveSaveFulfillmentDetails = async ( - mockResolveLastOperation, - /* A mockResolver for the CommerceSetShipping payload */ - commerceSetShipping, - /* if you submitted the form with a different address than validAddress, - pass it here to override the address in the mutation response. */ - responseAddress?: any -) => { - await flushPromiseQueue() - const payload = responseAddress - ? merge({}, commerceSetShipping, { - orderOrError: { - order: { requestedFulfillment: responseAddress }, - }, - }) - : commerceSetShipping - - return await mockResolveLastOperation({ - CommerceSetShippingPayload: () => payload, - }) -} - -const getAllPendingOperationNames = (env: MockEnvironment) => { - return env.mock.getAllOperations().map(op => op.request.node.operation.name) -} - -let mockTrackEvent: jest.Mock - -// FIXME: CI Timeouts likely due to fillAddressForm() duration... -describe.skip("Shipping", () => { - const mockUseRouter = useRouter as jest.Mock - const mockPush = jest.fn() - - beforeEach(() => { - HTMLElement.prototype.scrollIntoView = jest.fn() - mockTrackEvent = jest.fn() - ;(useTracking as jest.Mock).mockImplementation(() => ({ - trackEvent: mockTrackEvent, - })) - ;(useFeatureFlag as jest.Mock).mockImplementation(() => false) - - mockUseRouter.mockReturnValue({ - router: { - push: mockPush, - }, - }) - }) - - let mockRelayEnv - // create the mock environment here so we can pass it into our MockBoot - // component - const renderWithRelay: typeof renderWithRelayRaw = ( - resolvers, - componentProps = {}, - relayEnv = createMockEnvironment() - ) => { - mockRelayEnv = relayEnv - return renderWithRelayRaw(resolvers, componentProps, relayEnv) - } - - const { renderWithRelay: renderWithRelayRaw } = setupTestWrapperTL< - Shipping2TestQuery - >({ - Component: props => { - return ( - - - - ) - }, - query: graphql` - query Shipping2TestQuery @relay_test_operation @raw_response_type { - order: commerceOrder(id: "unused") { - ...Shipping2_order - } - me { - ...Shipping2_me - } - } - `, - }) - - describe("initial load with order data", () => { - it("loads with saved shipping fulfillment and no saved addresses", async () => { - const orderWithFulfillment = { - ...order, - requestedFulfillment: { - __typename: "CommerceShip", - name: "Dr Collector", - addressLine1: "1 Main St", - addressLine2: "", - city: "Madrid", - country: "ES", - postalCode: "28001", - region: "", - phoneNumber: "555-555-5555", - }, - } - renderWithRelay({ - CommerceOrder: () => orderWithFulfillment, - Me: () => meWithoutAddress, - }) - - const renderedFullName = await screen.findByDisplayValue("Dr Collector") - expect(renderedFullName).toHaveValue("Dr Collector") - expect(screen.getByPlaceholderText("Street address")).toHaveValue( - "1 Main St" - ) - expect(screen.getByPlaceholderText("City")).toHaveValue("Madrid") - expect(screen.getByPlaceholderText("ZIP/Postal code")).toHaveValue( - "28001" - ) - expect( - screen.getByPlaceholderText("Add phone number including country code") - ).toHaveValue("555-555-5555") - }) - - it("loads with saved shipping fulfillment and matching saved addresses", async () => { - const expectedAddress = meWithAddresses.addressConnection!.edges![1]! - .node! - const unexpectedAddress = meWithAddresses.addressConnection!.edges![0]! - .node! - - const orderWithFulfillment = { - ...order, - requestedFulfillment: { - __typename: "CommerceShip", - name: expectedAddress.name, - addressLine1: expectedAddress.addressLine1, - addressLine2: expectedAddress.addressLine2, - city: expectedAddress.city, - country: expectedAddress.country, - postalCode: expectedAddress.postalCode, - region: expectedAddress.region, - phoneNumber: expectedAddress.phoneNumber, - }, - } - - renderWithRelay({ - CommerceOrder: () => orderWithFulfillment, - Me: () => meWithAddresses, - }) - - expect(expectedAddress.addressLine1).toEqual("401 Broadway") - expect(unexpectedAddress.addressLine1).toEqual("1 Main St") - - expect(screen.getByRole("radio", { name: /401 Broadway/ })).toBeChecked() - expect(screen.getByRole("radio", { name: /1 Main St/ })).not.toBeChecked() - }) - it("loads with saved pickup fulfillment", async () => { - const orderWithFulfillment = { - ...order, - requestedFulfillment: { - __typename: "CommercePickup", - fulfillmentType: "PICKUP", - phoneNumber: "555-555-5555", - }, - } - - renderWithRelay({ - CommerceOrder: () => orderWithFulfillment, - Me: () => meWithoutAddress, - }) - - await waitFor(() => { - expect( - screen.getByRole("radio", { name: /Arrange for pickup/ }) - ).toBeChecked() - }) - - expect( - screen.getByPlaceholderText("Add phone number including country code") - ).toHaveValue("555-555-5555") - }) - }) - - describe("with partner shipping", () => { - describe("with no saved address", () => { - it("shows an active offer stepper if it's an offer order", async () => { - renderWithRelay({ - CommerceOrder: () => UntouchedOfferOrder, - Me: () => meWithoutAddress, - }) - - expect(screen.getAllByRole("button", { name: "Offer" }).length).toBe(1) - }) - - it("renders fulfillment selection if artwork is available for pickup", async () => { - renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - expect(screen.getByText("Delivery method")).toBeVisible() - expect(screen.getByRole("radio", { name: "Shipping" })).toBeVisible() - expect( - screen.getByRole("radio", { name: /Arrange for pickup/ }) - ).toBeVisible() - }) - - it("does not render fulfillment selection if artwork is not available for pickup", async () => { - const shippingOnlyOrder = cloneDeep(order) as any - shippingOnlyOrder.lineItems.edges[0].node.artwork.pickupAvailable = false - - renderWithRelay({ - CommerceOrder: () => shippingOnlyOrder, - Me: () => meWithoutAddress, - }) - - expect(screen.queryByText("Delivery method")).not.toBeInTheDocument() - expect( - screen.queryByRole("radio", { name: "Shipping" }) - ).not.toBeInTheDocument() - expect( - screen.queryByRole("radio", { name: /Arrange for pickup/ }) - ).not.toBeInTheDocument() - }) - - it("sets and disables country select if artwork only ships domestically and is not in the EU", async () => { - const domesticShippingNonEUOrder = cloneDeep(order) as any - const artwork = - domesticShippingNonEUOrder.lineItems.edges[0].node.artwork - - Object.assign(artwork, { - onlyShipsDomestically: true, - euShippingOrigin: false, - shippingCountry: "US", - }) - - renderWithRelay({ - CommerceOrder: () => domesticShippingNonEUOrder, - Me: () => meWithoutAddress, - }) - - expect(screen.getByTestId("AddressForm_country")).toHaveValue("US") - expect(screen.getByTestId("AddressForm_country")).toBeDisabled() - }) - - it("sets and enables country select if artwork only ships domestically and is in the EU", async () => { - const domesticShippingEUOrder = cloneDeep(order) as any - const artwork = domesticShippingEUOrder.lineItems.edges[0].node.artwork - - Object.assign(artwork, { - onlyShipsDomestically: true, - euShippingOrigin: true, - shippingCountry: "IT", - }) - - renderWithRelay({ - CommerceOrder: () => domesticShippingEUOrder, - Me: () => meWithoutAddress, - }) - - expect(screen.getByTestId("AddressForm_country")).toHaveValue("IT") - expect(screen.getByTestId("AddressForm_country")).toBeEnabled() - }) - - it("sets shipping on order, saves address on user and advances to payment", async () => { - const { mockResolveLastOperation, env } = renderWithRelay({ - CommerceOrder: () => ({ ...order, __id: order.id }), - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - - await saveAndContinue() - - const createAddressOperation = await mockResolveLastOperation({ - CreateUserAddressPayload: () => saveAddressSuccess.createUserAddress, - Me: () => ({ - ...meWithoutAddress, - addressConnection: { - totalCount: 0, - edges: [ - { - node: { - ...saveAddressSuccess.createUserAddress - ?.userAddressOrErrors, - }, - }, - ], - }, - }), - }) - - expect(createAddressOperation.operationName).toBe( - "useCreateSavedAddressMutation" - ) - expect(createAddressOperation.operationVariables).toMatchObject({ - input: { - attributes: validAddress, - }, - }) - - await flushPromiseQueue() - - const fulfillmentRequest = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect(fulfillmentRequest.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - expect(fulfillmentRequest.operationVariables).toMatchObject({ - input: { - id: "2939023", - fulfillmentType: "SHIP", - phoneNumber: validAddress.phoneNumber, - shipping: { - ...validAddress, - phoneNumber: "", - }, - }, - }) - - await waitFor(() => { - expect(getAllPendingOperationNames(env)).toEqual([]) - expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") - }) - }) - - it("save address not checked: sets shipping on order and advances to payment without saving address", async () => { - const { env, mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await clickSaveAddress() - - await saveAndContinue() - - const fulfillmentRequest = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect(fulfillmentRequest.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - await waitFor(() => { - expect(getAllPendingOperationNames(env)).toEqual([]) - expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") - }) - expect(() => env.mock.getMostRecentOperation()).toThrow() - }) - - it("shows a loading spinner while operations are pending", async () => { - const { mockResolveLastOperation, env } = renderWithRelay({ - CommerceOrder: () => ({ ...order, __id: order.id }), - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await saveAndContinue() - - const getSpinner = () => { - const button = screen.getByRole("button", { - name: "Save and Continue", - }) - return queryByAttribute("class", button, /Spinner/) - } - - await waitFor(() => { - expect(getSpinner()).toBeInTheDocument() - }) - - await mockResolveLastOperation({ - CreateUserAddressPayload: () => saveAddressSuccess.createUserAddress, - }) - - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - await waitFor(() => { - expect(getSpinner()).not.toBeInTheDocument() - expect(getAllPendingOperationNames(env)).toEqual([]) - expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") - }) - }) - - it("shows a generic error when there is an unrecognized error code in the exchange result", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await saveAndContinue() - - await flushPromiseQueue() - - await mockResolveLastOperation({ - CreateUserAddressPayload: () => saveAddressSuccess.createUserAddress, - }) - - await flushPromiseQueue() - - await resolveSaveFulfillmentDetails(mockResolveLastOperation, { - orderOrError: { - __typename: "CommerceOrderWithMutationFailure", - error: { - type: "validation", - code: "something_new", - data: null, - }, - }, - }) - - await waitFor(() => { - expect(mockShowErrorDialog).toHaveBeenCalledWith() - }) - }) - - it("shows and tracks an error when an exchange mutation throws an error", async () => { - const { mockRejectLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await clickSaveAddress() - - await saveAndContinue() - - await waitFor(() => - mockRejectLastOperation(new Error("##TEST_ERROR## wrong number")) - ) - await waitFor(() => expect(mockShowErrorDialog).toHaveBeenCalledWith()) - - expect(mockTrackEvent).toHaveBeenLastCalledWith({ - action: "errorMessageViewed", - context_owner_id: "2939023", - context_owner_type: "orders-shipping", - error_code: undefined, - flow: "user selects a shipping option", - message: - "Something went wrong. Please try again or contact orders@artsy.net.", - title: "An error occurred", - }) - }) - - it("shows and tracks an error when there is a missing_country error from the server", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await clickSaveAddress() - - await saveAndContinue() - - await resolveSaveFulfillmentDetails(mockResolveLastOperation, { - orderOrError: { - __typename: "CommerceOrderWithMutationFailure", - error: { - type: "validation", - code: "missing_country", - data: null, - }, - }, - }) - await waitFor(() => - expect(mockShowErrorDialog).toHaveBeenCalledWith({ - title: "Invalid address", - message: - "There was an error processing your address. Please review and try again.", - }) - ) - expect(mockTrackEvent).toHaveBeenLastCalledWith({ - action: "errorMessageViewed", - context_owner_id: "2939023", - context_owner_type: "orders-shipping", - error_code: "missing_country", - flow: "user submits a shipping option", - message: - "There was an error processing your address. Please review and try again.", - title: "Invalid address", - }) - }) - - it("shows and tracks an error when there is a missing_region error from the server", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await clickSaveAddress() - - await saveAndContinue() - - await resolveSaveFulfillmentDetails(mockResolveLastOperation, { - orderOrError: { - __typename: "CommerceOrderWithMutationFailure", - error: { - type: "validation", - code: "missing_region", - data: null, - }, - }, - }) - await waitFor(() => - expect(mockShowErrorDialog).toHaveBeenCalledWith({ - title: "Invalid address", - message: - "There was an error processing your address. Please review and try again.", - }) - ) - expect(mockTrackEvent).toHaveBeenLastCalledWith({ - action: "errorMessageViewed", - context_owner_id: "2939023", - context_owner_type: "orders-shipping", - error_code: "missing_region", - flow: "user submits a shipping option", - message: - "There was an error processing your address. Please review and try again.", - title: "Invalid address", - }) - }) - - it("shows and tracks an error when there is a destination_could_not_be_geocoded error from the server", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await clickSaveAddress() - - await saveAndContinue() - - await resolveSaveFulfillmentDetails(mockResolveLastOperation, { - orderOrError: { - __typename: "CommerceOrderWithMutationFailure", - error: { - type: "arta", - code: "destination_could_not_be_geocoded", - data: - '{"status":422,"errors":{"destination":["could not be geocoded"]}}', - }, - }, - }) - expect(mockShowErrorDialog).toHaveBeenCalledWith({ - title: "Cannot calculate shipping", - message: ( - - ), - }) - expect(mockTrackEvent).toHaveBeenLastCalledWith({ - action: "errorMessageViewed", - context_owner_id: "2939023", - context_owner_type: "orders-shipping", - error_code: "destination_could_not_be_geocoded", - flow: "user submits a shipping option", - message: - "Please confirm that your address details are correct and try again. If the issue continues contact orders@artsy.net.", - title: "Cannot calculate shipping", - }) - }) - it("shows and tracks an error when there is a unsupported_shipping_location error from the server", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await clickSaveAddress() - - await saveAndContinue() - - await resolveSaveFulfillmentDetails(mockResolveLastOperation, { - orderOrError: { - __typename: "CommerceOrderWithMutationFailure", - error: { - code: "unsupported_shipping_location", - data: '{"failure_code":"domestic_shipping_only"}', - }, - }, - }) - expect(mockShowErrorDialog).toHaveBeenLastCalledWith({ - title: "Can't ship to that address", - message: "This work can only be shipped domestically.", - }) - expect(mockTrackEvent).toHaveBeenLastCalledWith({ - action: "errorMessageViewed", - context_owner_id: "2939023", - context_owner_type: "orders-shipping", - error_code: "unsupported_shipping_location", - flow: "user submits a shipping option", - message: "This work can only be shipped domestically.", - title: "Can't ship to that address", - }) - }) - it("shows and tracks an error when there is an unlisted error from the server", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await clickSaveAddress() - - await saveAndContinue() - - await resolveSaveFulfillmentDetails(mockResolveLastOperation, { - orderOrError: { - __typename: "CommerceOrderWithMutationFailure", - error: { - code: "something new", - data: "{}", - }, - }, - }) - expect(mockShowErrorDialog).toHaveBeenLastCalledWith() - expect(mockTrackEvent).toHaveBeenLastCalledWith({ - action: "errorMessageViewed", - context_owner_id: "2939023", - context_owner_type: "orders-shipping", - error_code: "something new", - flow: "user submits a shipping option", - message: - "Something went wrong. Please try again or contact orders@artsy.net.", - title: "An error occurred", - }) - }) - - it("pre-populates address form for order with already persisted shipping info", async () => { - renderWithRelay({ - CommerceOrder: () => ({ - ...order, - requestedFulfillment: { - ...validAddress, - __typename: "CommerceShip", - name: "Dr Collector", - }, - }), - Me: () => meWithoutAddress, - }) - - expect(screen.getByPlaceholderText("Full name")).toHaveValue( - "Dr Collector" - ) - }) - - describe("address verification", () => { - describe("with US enabled and international disabled", () => { - beforeEach(() => { - ;(useFeatureFlag as jest.Mock).mockImplementation( - (featureName: string) => featureName === "address_verification_us" - ) - }) - - it("triggers basic form validation before address verification", async () => { - const { env } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - expect( - screen.queryByText(/[\w\s]is required/) - ).not.toBeInTheDocument() - - await fillAddressForm({ ...validAddress, addressLine1: undefined }) - - await flushPromiseQueue() - expect( - screen.queryByText(/[\w\s]is required/) - ).not.toBeInTheDocument() - - await userEvent.click(screen.getByText("Save and Continue")) - - await waitFor(() => { - expect( - screen.getByText("Street address is required") - ).toBeVisible() - }) - expect(env.mock.getAllOperations().length).toEqual(0) - }) - - it("triggers the flow for US address after clicking continue", async () => { - const { env, mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddressBeforeVerification) - - await saveAndContinue() - - await verifyAddressWithSuggestions( - mockResolveLastOperation, - validAddressBeforeVerification, - recommendedAddress - ) - - expect(env.mock.getAllOperations().length).toEqual(0) - }) - - it("uses recommended address", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddressBeforeVerification) - - await saveAndContinue() - - await verifyAddressWithSuggestions( - mockResolveLastOperation, - validAddressBeforeVerification, - recommendedAddress - ) - - await userEvent.click(screen.getByText("Use This Address")) - - await flushPromiseQueue() - const createAddressOperation = await mockResolveLastOperation({ - CreateUserAddressPayload: () => - saveAddressSuccess.createUserAddress, - }) - - expect(createAddressOperation.operationName).toBe( - "useCreateSavedAddressMutation" - ) - - await flushPromiseQueue() - const fulfillmentOperation = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect(fulfillmentOperation.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - expect(fulfillmentOperation.operationVariables).toEqual({ - input: { - id: "2939023", - fulfillmentType: "SHIP", - addressVerifiedBy: "ARTSY", - phoneNumber: validAddress.phoneNumber, - shipping: { - ...recommendedAddress, - name: "Joelle Van Dyne", - phoneNumber: "", - }, - }, - }) - }) - - it("goes back and edits address after verification", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddressBeforeVerification) - await clickSaveAddress() - - await saveAndContinue() - - await verifyAddressWithSuggestions( - mockResolveLastOperation, - validAddressBeforeVerification, - recommendedAddress - ) - - // Clicking "Back to Edit" allows users to edit the address form - // and requires clicking "Save and Continue" to proceed. - await userEvent.click(screen.getByText("Back to Edit")) - await userEvent.paste( - screen.getByPlaceholderText("City"), - ": the big apple" - ) - - await flushPromiseQueue() - - await saveAndContinue() - - const fulfillmentOperation = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect(fulfillmentOperation.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - expect(fulfillmentOperation.operationVariables).toEqual({ - input: { - id: "2939023", - fulfillmentType: "SHIP", - addressVerifiedBy: "USER", - phoneNumber: validAddress.phoneNumber, - shipping: { - ...validAddressBeforeVerification, - city: "New York: the big apple", - - name: "Joelle Van Dyne", - phoneNumber: "", - }, - }, - }) - }) - - it("does not triggers the flow for international address after clicking continue", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await clickSaveAddress() - - await userEvent.selectOptions( - screen.getByTestId("AddressForm_country"), - ["TW"] - ) - - await saveAndContinue() - - await flushPromiseQueue() - - const operation = mockResolveLastOperation({}) - - expect(operation.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - }) - }) - }) - }) - - // e.g.: Should valid saved address be automatically saved to show shipping quotes? - describe("with saved addresses", () => { - it("does not show the new address form", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithAddresses, - }) - - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - // TODO: need a better way to check if the form is collapsed (height 0). - // Zero height is not considered invisible. - // https://github.com/testing-library/jest-dom/issues/450 - expect(screen.getByTestId("addressFormCollapse")).toHaveStyle({ - height: "0px", - }) - expect(screen.getByPlaceholderText("Street address")).toHaveAttribute( - "tabindex", - "-1" - ) - }) - - it("lists the addresses and renders the add address option", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithAddresses, - }) - - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect( - screen.getByRole("radio", { name: /401 Broadway/ }) - ).toBeVisible() - expect(screen.getByRole("radio", { name: /1 Main St/ })).toBeVisible() - expect( - screen.getByRole("button", { name: "Add a new address" }) - ).toBeVisible() - }) - - it("automatically saves the default saved address on load if valid (without tracking)", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithAddresses, - }) - - const automaticFulfillmentMutation = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect(automaticFulfillmentMutation.operationName).toEqual( - "useSaveFulfillmentDetailsMutation" - ) - expect(automaticFulfillmentMutation.operationVariables).toEqual({ - input: { - id: "2939023", - fulfillmentType: "SHIP", - phoneNumber: "422-424-4242", - shipping: { - addressLine1: "401 Broadway", - addressLine2: "Floor 25", - city: "New York", - country: "US", - name: "Test Name", - phoneNumber: "", - postalCode: "10013", - region: "NY", - }, - }, - }) - - expect(mockTrackEvent).not.toHaveBeenCalled() - }) - - it("sets shipping again when the user clicks to select address", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithAddresses, - }) - - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - await userEvent.click(screen.getByRole("radio", { name: /1 Main St/ })) - - expect(mockTrackEvent).toHaveBeenCalledWith({ - action: "clickedShippingAddress", - context_module: "ordersShipping", - context_page_owner_id: "2939023", - context_page_owner_type: "orders-shipping", - }) - - const fulfillmentMutation = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - expect(fulfillmentMutation.operationName).toEqual( - "useSaveFulfillmentDetailsMutation" - ) - expect(fulfillmentMutation.operationVariables).toEqual({ - input: { - id: "2939023", - fulfillmentType: "SHIP", - phoneNumber: "555-555-5555", - shipping: { - addressLine1: "1 Main St", - addressLine2: "", - city: "Madrid", - country: "ES", - name: "Test Name", - phoneNumber: "", - postalCode: "28001", - region: "", - }, - }, - }) - }) - - describe("address verification", () => { - describe("with address verification enabled", () => { - beforeEach(() => { - ;(useFeatureFlag as jest.Mock).mockImplementation( - (featureName: string) => featureName === "address_verification_us" - ) - }) - - it("does not trigger the flow", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithAddresses, - }) - - const automaticFulfillmentMutation = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect(automaticFulfillmentMutation.operationName).toEqual( - "useSaveFulfillmentDetailsMutation" - ) - - await userEvent.click( - screen.getByRole("radio", { name: /1 Main St/ }) - ) - - const manualFulfillmentMutation = await waitFor(() => - mockResolveLastOperation({}) - ) - expect(manualFulfillmentMutation.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - }) - }) - }) - - describe("editing address", () => { - it("opens a modal with the address prepopulated", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithAddresses, - }) - - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - const selectedAddress = screen.getAllByTestId("savedAddress")[1] - expect(selectedAddress).toHaveTextContent("401 Broadway") - - await userEvent.click(within(selectedAddress).getByText("Edit")) - - await waitFor(async () => { - const addressModal = screen.getByTestId("AddressModal") - expect(screen.getByText("Edit address")).toBeVisible() - expect( - within(addressModal).getByDisplayValue("401 Broadway") - ).toBeVisible() - expect( - within(addressModal).getByDisplayValue("Floor 25") - ).toBeVisible() - expect( - within(addressModal).getByDisplayValue("New York") - ).toBeVisible() - expect(within(addressModal).getByDisplayValue("NY")).toBeVisible() - expect( - within(addressModal).getByDisplayValue("10013") - ).toBeVisible() - }) - }) - - it("updates the address after submitting the modal form, then saves the address to the order", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithAddresses, - }) - - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - const selectedAddress = screen.getAllByTestId("savedAddress")[1] - expect(selectedAddress).toHaveTextContent("401 Broadway") - - await userEvent.click(within(selectedAddress).getByText("Edit")) - - const modalTitle = await screen.findByText("Edit address") - expect(modalTitle).toBeVisible() - - // TODO: need a better way to get a specific input field from multiple forms - await waitFor(async () => { - const addressModal = screen.getByTestId("AddressModal") - const addressLine2 = within(addressModal).getByPlaceholderText( - /Apt, floor, suite/ - ) - await userEvent.clear(addressLine2) - await userEvent.paste(addressLine2, "25th fl.") - }) - - userEvent.click(screen.getByRole("button", { name: "Save" })) - - await flushPromiseQueue() - - const updateAddressResult = { - userAddressOrErrors: { - ...saveAddressSuccess.createUserAddress!.userAddressOrErrors, - addressLine2: "25th fl.", - }, - } - const updateAddressOperation = await mockResolveLastOperation({ - UpdateUserAddressPayload: () => updateAddressResult, - }) - - expect(updateAddressOperation.operationName).toEqual( - "useUpdateSavedAddressMutation" - ) - expect(updateAddressOperation.operationVariables).toMatchObject({ - input: { - attributes: { - addressLine1: "401 Broadway", - addressLine2: "25th fl.", - city: "New York", - country: "US", - name: "Test Name", - phoneNumber: "422-424-4242", - postalCode: "10013", - region: "NY", - }, - userAddressID: "2", - }, - }) - - await flushPromiseQueue() - - const saveFulfillmentOperation = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect(saveFulfillmentOperation.operationName).toEqual( - "useSaveFulfillmentDetailsMutation" - ) - - // Fixme: Save address with correct new value - expect( - saveFulfillmentOperation.operationVariables.input.shipping - .addressLine2 - ).toEqual("25th fl.") - }) - }) - }) - }) - - describe("with Artsy shipping", () => { - describe("with no saved address", () => { - describe("address verification", () => { - describe("with US enabled and international disabled", () => { - beforeEach(() => { - ;(useFeatureFlag as jest.Mock).mockImplementation( - (featureName: string) => featureName === "address_verification_us" - ) - }) - - it("uses recommended address", async () => { - const { mockResolveLastOperation, env } = renderWithRelay({ - CommerceOrder: () => - UntouchedBuyOrderWithArtsyShippingDomesticFromUS, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await saveAndContinue() - - await verifyAddressWithSuggestions( - mockResolveLastOperation, - validAddress, - recommendedAddress - ) - - await userEvent.click(screen.getByText("Use This Address")) - - await flushPromiseQueue() - - const createAddressOperation = await mockResolveLastOperation({ - CreateUserAddressPayload: () => - merge({}, saveAddressSuccess.createUserAddress, { - userAddressOrErrors: { - ...recommendedAddress, - __typename: "UserAddress", - }, - }), - }) - expect(createAddressOperation.operationName).toBe( - "useCreateSavedAddressMutation" - ) - - await flushPromiseQueue() - - const fulfillmentOperation = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping, - recommendedAddress - ) - - expect(fulfillmentOperation.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - expect(fulfillmentOperation.operationVariables).toEqual({ - input: { - id: "2939023", - fulfillmentType: "SHIP_ARTA", - addressVerifiedBy: "ARTSY", - phoneNumber: validAddress.phoneNumber, - shipping: { - ...recommendedAddress, - name: "Joelle Van Dyne", - phoneNumber: "", - }, - }, - }) - - await flushPromiseQueue() - - await waitFor(() => userEvent.click(screen.getByText(/^Premium/))) - - await flushPromiseQueue() - - await saveAndContinue() - await flushPromiseQueue() - const selectNewShippingOptionOperation = await mockResolveLastOperation( - { - CommerceSelectShippingOptionPayload: () => - selectShippingQuoteSuccess.commerceSelectShippingOption, - } - ) - expect(selectNewShippingOptionOperation.operationName).toBe( - "useSelectShippingQuoteMutation" - ) - - await flushPromiseQueue() - expect(getAllPendingOperationNames(env)).toEqual([]) - expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") - }) - - it("goes back and edits address after verification", async () => { - const { mockResolveLastOperation, env } = renderWithRelay({ - CommerceOrder: () => - UntouchedBuyOrderWithArtsyShippingDomesticFromUS, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddressBeforeVerification) - - await saveAndContinue() - - await verifyAddressWithSuggestions( - mockResolveLastOperation, - validAddressBeforeVerification, - recommendedAddress - ) - - // Clicking "Back to Edit" allows users to edit the address form - // and requires clicking "Save and Continue" to proceed. - userEvent.click(screen.getByText("Back to Edit")) - - await saveAndContinue() - await flushPromiseQueue() - - const createAddressOperation = await mockResolveLastOperation({ - CreateUserAddressPayload: () => - saveAddressSuccess.createUserAddress, - }) - expect(createAddressOperation.operationName).toBe( - "useCreateSavedAddressMutation" - ) - - await flushPromiseQueue() - - const fulfillmentOperation = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping - ) - - expect(fulfillmentOperation.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - expect(fulfillmentOperation.operationVariables).toEqual({ - input: { - id: "2939023", - fulfillmentType: "SHIP_ARTA", - addressVerifiedBy: "USER", - phoneNumber: validAddress.phoneNumber, - shipping: { - ...validAddress, - name: "Joelle Van Dyne", - phoneNumber: "", - }, - }, - }) - - await flushPromiseQueue() - await saveAndContinue() - const selectShippingOptionOperation = await mockResolveLastOperation( - { - CommerceSelectShippingOptionPayload: () => - selectShippingQuoteSuccess.commerceSelectShippingOption, - } - ) - expect(selectShippingOptionOperation.operationName).toBe( - "useSelectShippingQuoteMutation" - ) - - await flushPromiseQueue() - expect(getAllPendingOperationNames(env)).toEqual([]) - expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") - }) - }) - }) - - it("shows an error if Arta doesn't return shipping quotes", async () => { - const settingOrderArtaShipmentSuccessWithoutQuotes = cloneDeep( - settingOrderArtaShipmentSuccess - ) as any - settingOrderArtaShipmentSuccessWithoutQuotes.commerceSetShipping.orderOrError.order.lineItems.edges[0].node.shippingQuoteOptions.edges = [] - - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromUS, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await clickSaveAddress() - - await saveAndContinue() - - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccessWithoutQuotes.commerceSetShipping - ) - - expect( - screen.queryByRole("radio", { name: /Standard/ }) - ).not.toBeInTheDocument() - expect( - screen.getByText( - /In order to provide a shipping quote, we need some more information from you./ - ) - ).toBeInTheDocument() - }) - - it("hides shipping quotes and updates shipping address plus saved address if user edits address fields", async () => { - const { mockResolveLastOperation, env } = renderWithRelay({ - CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromUS, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await saveAndContinue() - - await flushPromiseQueue() - const saveAddressOperation = await mockResolveLastOperation({ - CreateUserAddressPayload: () => saveAddressSuccess.createUserAddress, - Me: () => ({ - ...meWithoutAddress, - addressConnection: { - totalCount: 0, - edges: [ - { - node: { - ...saveAddressSuccess.createUserAddress - ?.userAddressOrErrors, - }, - }, - ], - }, - }), - }) - - expect(saveAddressOperation.operationName).toBe( - "useCreateSavedAddressMutation" - ) - - await flushPromiseQueue() - - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping - ) - - await flushPromiseQueue() - - const addressLine1 = screen.getByPlaceholderText("Street address") - const addressLine2 = screen.getByPlaceholderText( - "Apt, floor, suite, etc." - ) - await userEvent.clear(addressLine2) - await userEvent.tab() - await userEvent.paste(addressLine1, " Suite 25") - - await waitFor(() => { - const shippingBox = screen.getByTestId("ShippingQuotes_collapse") - - expect(shippingBox).toHaveStyle({ height: "0px" }) - }) - - await flushPromiseQueue() - - await saveAndContinue() - - const updatedUserAddress = { - ...updateAddressSuccess?.updateUserAddress?.userAddressOrErrors, - __typename: "UserAddress", - addressLine1: "401 Broadway Suite 25", - addressLine2: "", - } - - await flushPromiseQueue() - const updateAddressOperation = await mockResolveLastOperation({ - UpdateUserAddressPayload: () => ({ - userAddressOrErrors: updatedUserAddress, - }), - Me: () => ({ - ...meWithoutAddress, - addressConnection: { - totalCount: 1, - edges: [ - { - node: updatedUserAddress, - }, - ], - }, - }), - }) - - await flushPromiseQueue() - - expect(updateAddressOperation.operationName).toBe( - "useUpdateSavedAddressMutation" - ) - expect(updateAddressOperation.operationVariables).toEqual({ - input: { - attributes: { - name: "Joelle Van Dyne", - phoneNumber: "120938120983", - addressLine1: "401 Broadway Suite 25", - addressLine2: "", - city: "New York", - region: "NY", - country: "US", - postalCode: "10013", - }, - userAddressID: "address-id", - }, - }) - - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping, - { addressLine1: "401 Broadway Suite 25", addressLine2: "" } - ) - - await flushPromiseQueue() - - const premiumShipping = await screen.findByRole("radio", { - name: /Premium/, - }) - - await userEvent.click(premiumShipping) - - await saveAndContinue() - - await flushPromiseQueue() - - const selectShippingOptionOperation = await mockResolveLastOperation({ - CommerceSelectShippingOptionPayload: () => - selectShippingQuoteSuccess.commerceSelectShippingOption, - }) - - expect(selectShippingOptionOperation.operationName).toBe( - "useSelectShippingQuoteMutation" - ) - expect(selectShippingOptionOperation.operationVariables).toEqual({ - input: { - id: "2939023", - selectedShippingQuoteId: "1eb3ba19-643b-4101-b113-2eb4ef7e30b6", - }, - }) - await flushPromiseQueue() - expect(getAllPendingOperationNames(env)).toEqual([]) - expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") - }) - - it("saves address upon selecting shipping quote if address is checked and it wasn't saved before", async () => { - const { mockResolveLastOperation, env } = renderWithRelay({ - CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromUS, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await clickSaveAddress() - - await saveAndContinue() - - const fulfillmentOperation = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping - ) - expect(fulfillmentOperation.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - - // FIXME: `getByRole` can be slow and cause test to time out. - // https://github.com/testing-library/dom-testing-library/issues/552#issuecomment-625172052 - const premiumShipping = await screen.findByRole("radio", { - name: /Premium/, - }) - await userEvent.click(premiumShipping) - await clickSaveAddress() - - await saveAndContinue() - - await flushPromiseQueue() - const saveAddressOperation = await mockResolveLastOperation({ - CreateUserAddressPayload: () => saveAddressSuccess.createUserAddress, - }) - - expect(saveAddressOperation.operationName).toBe( - "useCreateSavedAddressMutation" - ) - expect(saveAddressOperation.operationVariables).toEqual({ - input: { - attributes: { - addressLine1: "401 Broadway", - addressLine2: "Suite 25", - city: "New York", - country: "US", - name: "Joelle Van Dyne", - phoneNumber: "120938120983", - postalCode: "10013", - region: "NY", - }, - }, - }) - - await flushPromiseQueue() - - const selectShippingOptionOperation = await mockResolveLastOperation({ - CommerceSelectShippingOptionPayload: () => - selectShippingQuoteSuccess.commerceSelectShippingOption, - }) - expect(selectShippingOptionOperation.operationName).toBe( - "useSelectShippingQuoteMutation" - ) - - await flushPromiseQueue() - - expect(getAllPendingOperationNames(env)).toEqual([]) - expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") - }) - - it("removes saved address upon selecting shipping quote if save-address is unchecked after initially saving it", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromUS, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await saveAndContinue() - - await flushPromiseQueue() - const saveAddressOperation = await mockResolveLastOperation({ - CreateUserAddressPayload: () => saveAddressSuccess.createUserAddress, - }) - - expect(saveAddressOperation.operationName).toBe( - "useCreateSavedAddressMutation" - ) - await flushPromiseQueue() - - const fulfillmentOperation = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping, - validAddress - ) - expect(fulfillmentOperation.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - - // FIXME: `getByRole` can be slow and cause test to time out. - // https://github.com/testing-library/dom-testing-library/issues/552#issuecomment-625172052 - const premiumShipping = await screen.findByRole("radio", { - name: /Premium/, - }) - await userEvent.click(premiumShipping) - - await clickSaveAddress() - await flushPromiseQueue() - - await saveAndContinue() - await flushPromiseQueue() - - const deleteAddressOperation = await mockResolveLastOperation({ - // DeleteUserAddressPayload: () => saveAddressSuccess, - }) - expect(deleteAddressOperation.operationName).toBe( - "useDeleteSavedAddressMutation" - ) - - await flushPromiseQueue() - - const selectShippingOptionOperation = await mockResolveLastOperation({ - CommerceSelectShippingOptionPayload: () => - selectShippingQuoteSuccess.commerceSelectShippingOption, - }) - expect(selectShippingOptionOperation.operationName).toBe( - "useSelectShippingQuoteMutation" - ) - - expect(deleteAddressOperation.operationVariables).toEqual({ - input: { - userAddressID: "address-id", - }, - }) - }) - it("shows dialog and tracks error if shipping quote save operation fails", async () => { - const { - mockResolveLastOperation, - mockRejectLastOperation, - } = renderWithRelay({ - CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromUS, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await saveAndContinue() - - await flushPromiseQueue() - const saveAddressOperation = await mockResolveLastOperation({ - CreateUserAddressPayload: () => saveAddressSuccess.createUserAddress, - }) - - expect(saveAddressOperation.operationName).toBe( - "useCreateSavedAddressMutation" - ) - await flushPromiseQueue() - - const fulfillmentOperation = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping, - validAddress - ) - expect(fulfillmentOperation.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - - // FIXME: `getByRole` can be slow and cause test to time out. - // https://github.com/testing-library/dom-testing-library/issues/552#issuecomment-625172052 - const premiumShipping = await screen.findByRole("radio", { - name: /Premium/, - }) - await userEvent.click(premiumShipping) - - await flushPromiseQueue() - - await saveAndContinue() - await flushPromiseQueue() - - const selectShippingOptionOperation = await mockRejectLastOperation( - new Error("##TEST_ERROR## shipping quotes failed") - ) - - expect(selectShippingOptionOperation.operationName).toBe( - "useSelectShippingQuoteMutation" - ) - - await waitFor(() => expect(mockShowErrorDialog).toHaveBeenCalledWith()) - expect(mockTrackEvent).toHaveBeenCalledWith({ - action: "errorMessageViewed", - context_owner_id: "2939023", - context_owner_type: "orders-shipping", - error_code: undefined, - flow: "user sets a shipping quote", - message: - "There was a problem getting shipping quotes. Please contact orders@artsy.net.", - title: "An error occurred", - }) - }) - }) - - describe("with saved addresses", () => { - it("re-saves an already-saved shipping address on load to refresh shipping quotes without saving address", async () => { - const { mockResolveLastOperation, env } = renderWithRelay({ - CommerceOrder: () => BuyOrderWithArtaShippingDetails, - Me: () => meWithoutAddress, - }) - - await waitFor(() => { - const shippingBox = screen.getByTestId("ShippingQuotes_collapse") - expect(shippingBox).toHaveStyle({ height: "0px" }) - }) - - const fulfillmentOperation = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping - ) - expect(fulfillmentOperation.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - expect(fulfillmentOperation.operationVariables).toEqual({ - input: { - fulfillmentType: "SHIP_ARTA", - id: "2939023", - phoneNumber: "120938120983", - shipping: { - addressLine1: "401 Broadway", - addressLine2: "Suite 25", - city: "New York", - country: "US", - name: "Joelle Van Dyne", - phoneNumber: "", - postalCode: "10013", - region: "NY", - }, - }, - }) - - await flushPromiseQueue() - expect(getAllPendingOperationNames(env)).toEqual([]) - }) - it("tracks selecting shipping quote", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => BuyOrderWithArtaShippingDetails, - Me: () => meWithoutAddress, - }) - - await waitFor(() => { - const shippingBox = screen.getByTestId("ShippingQuotes_collapse") - expect(shippingBox).toHaveStyle({ height: "0px" }) - }) - - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping - ) - - // FIXME: `getByRole` can be slow and cause test to time out. - // https://github.com/testing-library/dom-testing-library/issues/552#issuecomment-625172052 - const premiumShipping = await screen.findByRole("radio", { - name: /Premium/, - }) - await userEvent.click(premiumShipping) - - expect(mockTrackEvent).toHaveBeenLastCalledWith({ - action: "clickedSelectShippingOption", - context_module: "ordersShipping", - context_page_owner_id: "2939023", - context_page_owner_type: "orders-shipping", - subject: "1eb3ba19-643b-4101-b113-2eb4ef7e30b6", - }) - }) - - // TODO: EMI-1526 https://artsyproduct.atlassian.net/browse/EMI-1526 - describe("Artsy shipping international only", () => { - describe("with artwork located in the US", () => { - it("sets shipping on order if the collector is in the EU", async () => { - const meWithDefaultAddressInSpain = cloneDeep( - meWithAddresses - ) as any - - meWithDefaultAddressInSpain.addressConnection.edges[0].node.isDefault = true // Spain - meWithDefaultAddressInSpain.addressConnection.edges[1].node.isDefault = false // US - - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => - UntouchedBuyOrderWithArtsyShippingInternationalFromUS, - Me: () => meWithDefaultAddressInSpain, - }) - - const fulfillmentRequest = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect(fulfillmentRequest.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - expect(fulfillmentRequest.operationVariables).toEqual({ - input: { - id: "2939023", - fulfillmentType: "SHIP_ARTA", - phoneNumber: "555-555-5555", - shipping: { - addressLine1: "1 Main St", - addressLine2: "", - city: "Madrid", - country: "ES", - name: "Test Name", - phoneNumber: "", - postalCode: "28001", - region: "", - }, - }, - }) - }) - }) - - describe("with artwork located in Germany", () => { - it("does not set shipping on order automatically if the collector is in the EU", async () => { - // TODO: Why would we want this behavior? We can now set shipping on all valid saved addresses- - // no need to check whether it needs artsy shipping. - const meWithDefaultAddressInSpain = cloneDeep( - meWithAddresses - ) as any - meWithDefaultAddressInSpain.addressConnection.edges[0].node.isDefault = true // Spain - meWithDefaultAddressInSpain.addressConnection.edges[1].node.isDefault = false // US - - const { env, mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => - UntouchedBuyOrderWithArtsyShippingInternationalFromGermany, - Me: () => meWithDefaultAddressInSpain, - }) - - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect(getAllPendingOperationNames(env)).toEqual([]) - expect( - screen.queryByRole("radio", { - name: /(^Standard|^Express|^White Glove|^Rush|^Premium)/, - }) - ).not.toBeInTheDocument() - }) - - it("sets shipping on order automatically if the collector is in the US", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => - UntouchedBuyOrderWithArtsyShippingInternationalFromGermany, - Me: () => meWithAddresses, - }) - - const fulfillmentRequest = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect(fulfillmentRequest.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - expect(fulfillmentRequest.operationVariables).toEqual({ - input: { - id: "2939023", - fulfillmentType: "SHIP_ARTA", - phoneNumber: "422-424-4242", - shipping: { - addressLine1: "401 Broadway", - addressLine2: "Floor 25", - city: "New York", - country: "US", - name: "Test Name", - phoneNumber: "", - postalCode: "10013", - region: "NY", - }, - }, - }) - }) - }) - }) - - describe("Artsy shipping domestic only", () => { - describe("with artwork located in Germany", () => { - // TODO: Like the test above, these tests assume we don't want to automatically set shipping - // unless the default address would require artsy shipping. That is no longer the case- - // We can safely set the shipping. See alsoped test above (~L1957) - it("sets shipping on order if the collector is in the EU", async () => { - const meWithDefaultAddressInSpain = cloneDeep( - meWithAddresses - ) as any - meWithDefaultAddressInSpain.addressConnection.edges[0].node.isDefault = true // Spain - meWithDefaultAddressInSpain.addressConnection.edges[1].node.isDefault = false // US - - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => - UntouchedBuyOrderWithArtsyShippingDomesticFromGermany, - Me: () => meWithDefaultAddressInSpain, - }) - - const fulfillmentRequest = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect(fulfillmentRequest.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - expect(fulfillmentRequest.operationVariables).toEqual({ - input: { - id: "2939023", - fulfillmentType: "SHIP_ARTA", - phoneNumber: "555-555-5555", - shipping: { - addressLine1: "1 Main St", - addressLine2: "", - city: "Madrid", - country: "ES", - name: "Test Name", - phoneNumber: "", - postalCode: "28001", - region: "", - }, - }, - }) - }) - - it("does not set shipping on order if the collector is in the US", async () => { - const { env, mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => - UntouchedBuyOrderWithArtsyShippingDomesticFromGermany, - Me: () => meWithAddresses, - }) - - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect(getAllPendingOperationNames(env)).toEqual([]) - expect( - screen.queryByRole("radio", { - name: /(^Standard|^Express|^White Glove|^Rush|^Premium)/, - }) - ).not.toBeInTheDocument() - }) - }) - - describe("with artwork located in the US", () => { - it("does not fetch or show shipping quotes if the collector is in the EU", async () => { - const meWithDefaultAddressInSpain = cloneDeep( - meWithAddresses - ) as any - meWithDefaultAddressInSpain.addressConnection.edges[0].node.isDefault = true // Spain - meWithDefaultAddressInSpain.addressConnection.edges[1].node.isDefault = false // US - - const { env, mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => - UntouchedBuyOrderWithArtsyShippingDomesticFromUS, - Me: () => meWithDefaultAddressInSpain, - }) - - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect(getAllPendingOperationNames(env)).toEqual([]) - expect( - screen.queryByRole("radio", { - name: /(^Standard|^Express|^White Glove|^Rush|^Premium)/, - }) - ).not.toBeInTheDocument() - }) - - describe("with the collector in the US", () => { - it("sets shipping with the default address on load", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => - UntouchedBuyOrderWithArtsyShippingDomesticFromUS, - Me: () => meWithAddresses, - }) - - const fulfillmentRequest = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping - ) - - expect(fulfillmentRequest.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - expect(fulfillmentRequest.operationVariables.input).toEqual({ - id: "2939023", - fulfillmentType: "SHIP_ARTA", - phoneNumber: "422-424-4242", - shipping: { - addressLine1: "401 Broadway", - addressLine2: "Floor 25", - city: "New York", - country: "US", - name: "Test Name", - phoneNumber: "", - postalCode: "10013", - region: "NY", - }, - }) - }) - - it("shows shipping quotes for the default address on load", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => - UntouchedBuyOrderWithArtsyShippingDomesticFromUS, - Me: () => meWithAddresses, - }) - const fulfillmentRequest = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping - ) - - expect(fulfillmentRequest.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - - expect( - screen.getAllByRole("radio", { - name: /(^Standard|^Express|^White Glove|^Rush|^Premium)/, - }) - ).toHaveLength(5) - }) - - it("sets shipping on order, shows shipping quotes and saves the pre-selected quote", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - // Simulate the condition with an order with saved shipping quotes - CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, - Me: () => meWithAddresses, - }) - - const fulfillmentRequest = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping - ) - - expect(fulfillmentRequest.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - - expect(screen.getByText("Save and Continue")).toBeEnabled() - - await flushPromiseQueue() - await saveAndContinue() - - await flushPromiseQueue() - const selectShippingOptionOperation = await mockResolveLastOperation( - {} - ) - - expect(selectShippingOptionOperation.operationName).toEqual( - "useSelectShippingQuoteMutation" - ) - expect(selectShippingOptionOperation.operationVariables).toEqual({ - input: { - id: "2939023", - selectedShippingQuoteId: - "4a8f8080-23d3-4c0e-9811-7a41a9df6933", - }, - }) - }) - - it("selects a different shipping quote and saves it", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - // Simulate the condition with an order with saved shipping quotes - CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, - Me: () => meWithAddresses, - }) - const fulfillmentRequest = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping - ) - - expect(fulfillmentRequest.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - expect(fulfillmentRequest.operationVariables).toEqual({ - input: { - id: "2939023", - fulfillmentType: "SHIP_ARTA", - phoneNumber: "422-424-4242", - shipping: { - addressLine1: "401 Broadway", - addressLine2: "Floor 25", - city: "New York", - country: "US", - name: "Test Name", - phoneNumber: "", - postalCode: "10013", - region: "NY", - }, - }, - }) - - userEvent.click(screen.getByText(/^Premium/)) - expect(screen.getByText("Save and Continue")).toBeEnabled() - await saveAndContinue() - - await flushPromiseQueue() - const selectShippingOptionOperation = await mockResolveLastOperation( - {} - ) - expect(selectShippingOptionOperation.operationName).toEqual( - "useSelectShippingQuoteMutation" - ) - expect(selectShippingOptionOperation.operationVariables).toEqual({ - input: { - id: "2939023", - selectedShippingQuoteId: - "1eb3ba19-643b-4101-b113-2eb4ef7e30b6", - }, - }) - }) - - it("keeps the submit button enabled after selecting a shipping quote", async () => { - const { mockResolveLastOperation } = renderWithRelay({ - // Simulate the condition with an order with saved shipping quotes - CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, - Me: () => meWithAddresses, - }) - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping - ) - - const premiumShipping = screen.getByRole("radio", { - name: /^Premium/, - }) - expect(premiumShipping).not.toBeChecked() - - userEvent.click(premiumShipping) - await flushPromiseQueue() - - expect(premiumShipping).toBeChecked() - expect( - screen.getByRole("button", { name: "Save and Continue" }) - ).toBeEnabled() - }) - - it("routes to payment screen after saving shipping option", async () => { - const { mockResolveLastOperation, env } = renderWithRelay({ - // Simulate the condition with an order with saved shipping quotes - CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, - Me: () => meWithAddresses, - }) - const fulfillmentRequest = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping - ) - expect(fulfillmentRequest.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - await saveAndContinue() - - await flushPromiseQueue() - const selectShippingOptionOperation = await mockResolveLastOperation( - { - CommerceSelectShippingOptionPayload: () => - selectShippingQuoteSuccess.commerceSelectShippingOption, - } - ) - expect(selectShippingOptionOperation.operationName).toEqual( - "useSelectShippingQuoteMutation" - ) - - expect(getAllPendingOperationNames(env)).toEqual([]) - expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") - }) - - it("reloads shipping quotes after editing the selected address", async () => { - // const updateAddressResponse = cloneDeep( - // updateAddressSuccess - // ) as any - // // Match the edited address with the selected address to trigger refetching quotes - // updateAddressResponse.updateUserAddress.userAddressOrErrors.internalID = - // "2" - // const updateAddressSpy = jest - // .spyOn(updateUserAddress, "updateUserAddress") - // // @ts-ignore - // .mockImplementationOnce((_, __, ___, ____, onSuccess) => { - // onSuccess(updateAddressResponse) - // }) - - const { mockResolveLastOperation } = renderWithRelay({ - CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, - Me: () => meWithAddresses, - }) - - await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderArtaShipmentSuccess.commerceSetShipping - ) - - const selectedAddress = screen.getAllByTestId("savedAddress")[1] - expect(selectedAddress).toHaveTextContent("401 Broadway") - - await userEvent.click(within(selectedAddress).getByText("Edit")) - - const modalTitle = await screen.findByText("Edit address") - expect(modalTitle).toBeVisible() - - // TODO: need a better way to get a specific input field from multiple forms - await waitFor(async () => { - const addressModal = screen.getByTestId("AddressModal") - const addressLine2 = within(addressModal).getByPlaceholderText( - /Apt, floor, suite/ - ) - await userEvent.clear(addressLine2) - await userEvent.paste(addressLine2, "25th fl.") - }) - - userEvent.click(screen.getByRole("button", { name: "Save" })) - - await flushPromiseQueue() - - const updateAddressOperation = await mockResolveLastOperation({ - UpdateUserAddressPayload: () => ({ - ...saveAddressSuccess.createUserAddress, - addressLine2: "25th fl.", - }), - Me: () => ({ - ...meWithAddresses, - addressConnection: { - totalCount: 2, - edges: [ - meWithAddresses.addressConnection!.edges![0], - - { - node: { - ...meWithAddresses.addressConnection!.edges![1], - addressLine2: "25th fl.", - }, - }, - ], - }, - }), - }) - - expect(updateAddressOperation.operationName).toEqual( - "useUpdateSavedAddressMutation" - ) - expect(updateAddressOperation.operationVariables).toMatchObject({ - input: { - attributes: { - addressLine1: "401 Broadway", - addressLine2: "25th fl.", - city: "New York", - country: "US", - name: "Test Name", - phoneNumber: "422-424-4242", - postalCode: "10013", - region: "NY", - }, - userAddressID: "2", - }, - }) - - await flushPromiseQueue() - - const saveFulfillmentOperation = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - settingOrderShipmentSuccess.commerceSetShipping - ) - - expect(saveFulfillmentOperation.operationName).toEqual( - "useSaveFulfillmentDetailsMutation" - ) - - await saveAndContinue() - - await flushPromiseQueue() - const selectShippingOptionOperation = await mockResolveLastOperation( - { - CommerceSelectShippingOptionPayload: () => - selectShippingQuoteSuccess.commerceSelectShippingOption, - } - ) - - expect(selectShippingOptionOperation.operationName).toEqual( - "useSelectShippingQuoteMutation" - ) - expect(selectShippingOptionOperation.operationVariables).toEqual({ - input: { - id: "2939023", - selectedShippingQuoteId: - "4a8f8080-23d3-4c0e-9811-7a41a9df6933", - }, - }) - }) - }) - }) - }) - }) - }) - - describe("with pickup", () => { - it("shows an empty phone number input with saved addresses", async () => { - renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithAddresses, - }) - - await userEvent.click( - screen.getByRole("radio", { name: /Arrange for pickup/ }) - ) - - const phoneNumber = await screen.findByTestId( - "AddressForm_pickupPhoneNumber" - ) - // TODO: need a better way to check the input is displayed/expanded (height > 0) - expect(phoneNumber).toHaveAttribute("tabindex", "0") - expect(phoneNumber).toHaveValue("") - }) - it("tracks click to switch to pickup", async () => { - renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithAddresses, - }) - - await userEvent.click( - screen.getByRole("radio", { name: /Arrange for pickup/ }) - ) - - await screen.findByTestId("AddressForm_pickupPhoneNumber") - expect(mockTrackEvent).toHaveBeenLastCalledWith({ - action: "Click", - flow: "buy now", - subject: "arrange for pickup", - type: "button", - }) - }) - - it("sets pickup on order and advances to payment", async () => { - const { mockResolveLastOperation, env } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - await userEvent.click( - screen.getByRole("radio", { name: /Arrange for pickup/ }) - ) - - await flushPromiseQueue() - await userEvent.paste( - screen.getAllByPlaceholderText( - "Add phone number including country code" - )[0], - "2813308004" - ) - - await flushPromiseQueue() - await saveAndContinue() - - const fulfillmentRequest = await resolveSaveFulfillmentDetails( - mockResolveLastOperation, - { - orderOrError: { - __typename: "CommerceOrderWithMutationSuccess", - order: { - id: "2939023", - requestedFulfillment: { - __typename: "CommercePickup", - phoneNumber: "2813308004", - }, - }, - }, - } - ) - - expect(fulfillmentRequest.operationName).toBe( - "useSaveFulfillmentDetailsMutation" - ) - expect(fulfillmentRequest.operationVariables).toMatchObject({ - input: { - id: "2939023", - fulfillmentType: "PICKUP", - shipping: { - addressLine1: "", - addressLine2: "", - country: "", - name: "", - city: "", - postalCode: "", - region: "", - phoneNumber: "", - }, - phoneNumber: "2813308004", - }, - }) - await waitFor(() => { - expect(getAllPendingOperationNames(env)).toEqual([]) - expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") - }) - }) - - it("disables submission without a phone number", async () => { - const { env } = renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - userEvent.click(screen.getByRole("radio", { name: /Arrange for pickup/ })) - - await flushPromiseQueue() - await saveAndContinue() - - expect(screen.getByText("Phone number is required")).toBeInTheDocument() - - expect(env.mock.getAllOperations()).toHaveLength(0) - }) - }) -}) diff --git a/src/Apps/Order/Routes/Shipping2/index.tsx b/src/Apps/Order/Routes/Shipping2/index.tsx deleted file mode 100644 index cb84a1615b1..00000000000 --- a/src/Apps/Order/Routes/Shipping2/index.tsx +++ /dev/null @@ -1,162 +0,0 @@ -import { FC, useEffect } from "react" -import { graphql, useFragment } from "react-relay" -import { Box, Flex, Spacer } from "@artsy/palette" -import { - Shipping2_order$data, - Shipping2_order$key, -} from "__generated__/Shipping2_order.graphql" -import { - Shipping2_me$data, - Shipping2_me$key, -} from "__generated__/Shipping2_me.graphql" -import { Media } from "Utils/Responsive" -import { ArtworkSummaryItemFragmentContainer as ArtworkSummaryItem } from "Apps/Order/Components/ArtworkSummaryItem" -import { - buyNowFlowSteps, - offerFlowSteps, -} from "Apps/Order/Components/OrderStepper" -import { TransactionDetailsSummaryItemFragmentContainer as TransactionDetailsSummaryItem } from "Apps/Order/Components/TransactionDetailsSummaryItem" -import { Dialog, injectDialog } from "Apps/Order/Dialogs" -import { BuyerGuarantee } from "Apps/Order/Components/BuyerGuarantee" -import { ShippingQuotes2 } from "Apps/Order/Routes/Shipping2/Components/ShippingQuotes2" -import { ContextModule, OwnerType } from "@artsy/cohesion" -import { OrderRouteContainer } from "Apps/Order/Components/OrderRouteContainer" -import { Analytics } from "System/Contexts/AnalyticsContext" -import { FulfillmentDetails } from "Apps/Order/Routes/Shipping2/Components/FulfillmentDetails" -import { ShippingContextProvider } from "Apps/Order/Routes/Shipping2/ShippingContext" -import { useShippingContext } from "Apps/Order/Routes/Shipping2/Hooks/useShippingContext" -import { SaveAndContinueButton } from "Apps/Order/Routes/Shipping2/Components/SaveAndContinueButton" -import { useJump, Jump } from "Utils/Hooks/useJump" - -export type ShippingStage = - // User choosing fulfillment type - | "fulfillment_details" - // Temporary stage after address has been automatically saved - // to wait for click - | "fulfillment_details_saved" - // User choosing shipping quote - | "shipping_quotes" - -export interface ShippingProps { - order: Shipping2_order$data - me: Shipping2_me$data - dialog: Dialog -} - -export const ShippingRoute: FC<{ - order: Shipping2_order$key - me: Shipping2_me$key - dialog: Dialog -}> = props => { - const orderData = useFragment(ORDER_FRAGMENT, props.order) - const meData = useFragment(ME_FRAGMENT, props.me) - return ( - - - - - - ) -} - -const ShippingRouteLayout: FC> = ({ - me, - order, -}) => { - const shippingContext = useShippingContext() - - const { jumpTo } = useJump() - - useEffect(() => { - if (shippingContext.state.stage === "shipping_quotes") { - jumpTo("shippingOptionsTop", { behavior: "smooth" }) - } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [shippingContext.state.stage]) - - return ( - - - - - - - - - - - - } - sidebar={ - - - - - - - - - - - - - - - - } - /> - - ) -} - -const ORDER_FRAGMENT = graphql` - fragment Shipping2_order on CommerceOrder { - ...ShippingContext_order - ...FulfillmentDetailsForm_order - ...SaveAndContinueButton_order - ...ArtworkSummaryItem_order - ...TransactionDetailsSummaryItem_order - ...OrderStepper_order - ...ShippingQuotes2_order - internalID - } -` -const ME_FRAGMENT = graphql` - fragment Shipping2_me on Me - @argumentDefinitions( - first: { type: "Int", defaultValue: 30 } - last: { type: "Int" } - after: { type: "String" } - before: { type: "String" } - ) { - ...FulfillmentDetailsForm_me - ...ShippingContext_me - @arguments(first: $first, last: $last, before: $before, after: $after) - } -` - -export const ShippingRouteWithDialog = injectDialog(ShippingRoute) diff --git a/src/Apps/Order/Routes/__fixtures__/MutationResults/saveAddress.ts b/src/Apps/Order/Routes/__fixtures__/MutationResults/saveAddress.ts index fd0ad43cc63..fbfaeeadc76 100644 --- a/src/Apps/Order/Routes/__fixtures__/MutationResults/saveAddress.ts +++ b/src/Apps/Order/Routes/__fixtures__/MutationResults/saveAddress.ts @@ -1,10 +1,9 @@ -import { UpdateUserAddressMutation$data } from "__generated__/UpdateUserAddressMutation.graphql" -import { CreateUserAddressMutation$data } from "__generated__/CreateUserAddressMutation.graphql" +import { useUpdateSavedAddressMutation$data } from "__generated__/useUpdateSavedAddressMutation.graphql" +import { useCreateSavedAddressMutation$data } from "__generated__/useCreateSavedAddressMutation.graphql" -export const saveAddressSuccess: CreateUserAddressMutation$data = { +export const saveAddressSuccess: useCreateSavedAddressMutation$data = { createUserAddress: { userAddressOrErrors: { - // @ts-ignore - This is for the Shipping2 mutation result __typename: "UserAddress", internalID: "address-id", id: "graphql-id", @@ -19,19 +18,20 @@ export const saveAddressSuccess: CreateUserAddressMutation$data = { country: "US", postalCode: "11111", }, + me: {} as any, }, } -export const updateAddressSuccess: UpdateUserAddressMutation$data = { +export const updateAddressSuccess: useUpdateSavedAddressMutation$data = { updateUserAddress: { userAddressOrErrors: { - // @ts-ignore - This is for the Shipping2 mutation result __typename: "UserAddress", internalID: "address-id", id: "graphql-id", name: "Bob Ross", addressLine1: "1 Main St", addressLine2: "", + addressLine3: "", isDefault: false, phoneNumber: "718-000-0000", city: "New York", @@ -39,20 +39,6 @@ export const updateAddressSuccess: UpdateUserAddressMutation$data = { postalCode: "10012", country: "USA", }, - }, -} - -export const updateAddressFailure: UpdateUserAddressMutation$data = { - updateUserAddress: { - userAddressOrErrors: { - // @ts-ignore - This is for the Shipping2 mutation result - __typename: "Errors", - errors: [ - { - code: "100", - message: "Invalid address", - }, - ], - }, + me: {} as any, }, } diff --git a/src/Apps/Order/Routes/__tests__/Shipping.jest.tsx b/src/Apps/Order/Routes/__tests__/Shipping.jest.tsx index 426d7c18efc..cfbc63ab258 100644 --- a/src/Apps/Order/Routes/__tests__/Shipping.jest.tsx +++ b/src/Apps/Order/Routes/__tests__/Shipping.jest.tsx @@ -1,7 +1,8 @@ -import { cloneDeep } from "lodash" +/* eslint-disable jest/no-disabled-tests */ +import { cloneDeep, merge } from "lodash" import { setupTestWrapperTL } from "DevTools/setupTestWrapper" import { MockBoot } from "DevTools/MockBoot" -import { ShippingFragmentContainer } from "Apps/Order/Routes/Shipping" +import { ShippingRouteWithDialog } from "Apps/Order/Routes/Shipping" import { graphql } from "react-relay" import { UntouchedBuyOrder, @@ -11,13 +12,10 @@ import { UntouchedBuyOrderWithShippingQuotes, UntouchedBuyOrderWithArtsyShippingInternationalFromUS, UntouchedBuyOrderWithArtsyShippingInternationalFromGermany, + BuyOrderWithArtaShippingDetails, } from "Apps/__tests__/Fixtures/Order" import { settingOrderShipmentSuccess, - settingOrderShipmentFailure, - settingOrderShipmentMissingCountryFailure, - settingOrderShipmentMissingRegionFailure, - settingOrderArtaShipmentDestinationCouldNotBeGeocodedFailure, settingOrderArtaShipmentSuccess, selectShippingQuoteSuccess, } from "Apps/Order/Routes/__fixtures__/MutationResults/setOrderShipping" @@ -25,26 +23,28 @@ import { saveAddressSuccess, updateAddressSuccess, } from "Apps/Order/Routes/__fixtures__/MutationResults/saveAddress" -import { ShippingTestQuery$rawResponse } from "__generated__/ShippingTestQuery.graphql" -import { screen } from "@testing-library/react" +import { + ShippingTestQuery, + ShippingTestQuery$rawResponse, +} from "__generated__/ShippingTestQuery.graphql" +import { screen, waitFor } from "@testing-library/react" import { useTracking } from "react-tracking" import { useFeatureFlag } from "System/Hooks/useFeatureFlag" import { + clickSaveAddress, fillAddressForm, validAddress, -} from "Components/__tests__/Utils/addressForm" +} from "Components/__tests__/Utils/addressForm2" import userEvent from "@testing-library/user-event" import { flushPromiseQueue } from "DevTools/flushPromiseQueue" import { queryByAttribute } from "@testing-library/dom" import { ErrorDialogMessage } from "Apps/Order/Utils/getErrorDialogCopy" -import * as updateUserAddress from "Apps/Order/Mutations/UpdateUserAddress" import { within } from "@testing-library/dom" -import { createMockEnvironment, MockPayloadGenerator } from "relay-test-utils" +import { MockEnvironment, createMockEnvironment } from "relay-test-utils" +import { useRouter } from "System/Hooks/useRouter" -// TODO: Optimize test performance and remove long timeout setting -// Set longer timeout for each test _only_ for this file. -// https://jestjs.io/docs/jest-object#jestsettimeouttimeout jest.setTimeout(10000) + jest.unmock("react-relay") jest.mock("react-tracking") jest.mock("Utils/Hooks/useMatchMedia", () => ({ @@ -71,42 +71,22 @@ jest.mock("System/Hooks/useFeatureFlag", () => ({ useFeatureFlag: jest.fn(), })) +jest.mock("System/Hooks/useRouter", () => ({ + useRouter: jest.fn().mockReturnValue({ + router: jest.fn(), + }), +})) + const mockShowErrorDialog = jest.fn() jest.mock("Apps/Order/Dialogs", () => ({ - ...jest.requireActual("../../Dialogs"), + ...jest.requireActual("Apps/Order/Dialogs"), injectDialog: Component => props => ( ), })) -// TODO: We need to mock `commitMutation` from 3 different places due to the -// inconsistent implementation. -const mockCommitMutation = jest.fn() -jest.mock("Apps/Order/Utils/commitMutation", () => ({ - ...jest.requireActual("../../Utils/commitMutation"), - injectCommitMutation: Component => props => ( - - ), -})) -jest.mock("relay-runtime", () => ({ - ...jest.requireActual("relay-runtime"), - commitMutation: (...args) => mockCommitMutation(args), -})) -jest.mock("react-relay", () => ({ - ...jest.requireActual("react-relay"), - commitMutation: (...args) => mockCommitMutation(args), -})) - -const mockJumpTo = jest.fn() -jest.mock("Utils/Hooks/useJump", () => ({ - useJump: () => ({ jumpTo: mockJumpTo }), - Jump: () => null, -})) - -const order: ShippingTestQuery$rawResponse["order"] = { +const order = { ...UntouchedBuyOrder, - internalID: "1234", - id: "1234", } const pageInfo = { @@ -127,7 +107,6 @@ const meWithoutAddress: ShippingTestQuery$rawResponse["me"] = { addressConnection: { totalCount: 0, edges: [], - pageInfo, }, } @@ -136,7 +115,7 @@ const meWithAddresses: ShippingTestQuery$rawResponse["me"] = Object.assign( meWithoutAddress, { addressConnection: { - totalCount: 0, + totalCount: 2, edges: [ { node: { @@ -181,10 +160,18 @@ const meWithAddresses: ShippingTestQuery$rawResponse["me"] = Object.assign( ) const saveAndContinue = async () => { - await userEvent.click(screen.getByText("Save and Continue")) - await flushPromiseQueue() + await waitFor(() => userEvent.click(screen.getByText("Save and Continue"))) } +const validAddressBeforeVerification = { + ...validAddress, + addressLine1: "401 Broadway", + addressLine2: "Suite 25", + city: "New York", + region: "NY", + postalCode: "10013", + country: "US", +} const recommendedAddress = { addressLine1: "401 Broadway Suite 25", addressLine2: null, @@ -194,7 +181,11 @@ const recommendedAddress = { country: "US", } -const verifyAddressWithSuggestions = async (relayEnv, input, suggested) => { +const verifyAddressWithSuggestions = async ( + mockResolveLastOperation, + input = validAddressBeforeVerification, + suggested = recommendedAddress +) => { const addressLines = addr => { return [ addr.addressLine1, @@ -204,26 +195,33 @@ const verifyAddressWithSuggestions = async (relayEnv, input, suggested) => { ] } - const verificationResult = { - __typename: "VerifyAddressType", - verificationStatus: "VERIFIED_WITH_CHANGES", - suggestedAddresses: [ - { - lines: addressLines(recommendedAddress), - address: recommendedAddress, - }, - ], - inputAddress: { - lines: addressLines(validAddress), - address: validAddress, - }, - } + const suggestedAddress = suggested + ? { ...recommendedAddress, ...suggested } + : recommendedAddress + + const { operationName, operationVariables } = await waitFor(() => { + return mockResolveLastOperation({ + VerifyAddressPayload: () => ({ + verifyAddressOrError: { + __typename: "VerifyAddressType", + verificationStatus: "VERIFIED_WITH_CHANGES", + suggestedAddresses: [ + { + lines: addressLines(suggestedAddress), + address: suggestedAddress, + }, + ], + inputAddress: { + lines: addressLines(validAddress), + address: validAddress, + }, + }, + }), + }) + }) - const mutation = relayEnv.mock.getMostRecentOperation() - expect(mutation.request.node.operation.name).toEqual( - "AddressVerificationFlowQuery" - ) - expect(mutation.request.variables).toEqual({ + expect(operationName).toBe("AddressVerificationFlowQuery") + expect(operationVariables).toEqual({ address: { addressLine1: input.addressLine1, addressLine2: input.addressLine2, @@ -234,48 +232,83 @@ const verifyAddressWithSuggestions = async (relayEnv, input, suggested) => { }, }) - relayEnv.mock.resolveMostRecentOperation(operation => { - return MockPayloadGenerator.generate(operation, { - VerifyAddressType: () => verificationResult, - }) - }) expect(await screen.findByText("Confirm your delivery address")).toBeVisible() expect(await screen.findByText("Recommended")).toBeVisible() expect(await screen.findByText("What you entered")).toBeVisible() } -// FIXME: Times out too frequently in CI +const resolveSaveFulfillmentDetails = async ( + mockResolveLastOperation, + /* A mockResolver for the CommerceSetShipping payload */ + commerceSetShipping, + /* if you submitted the form with a different address than validAddress, + pass it here to override the address in the mutation response. */ + responseAddress?: any +) => { + await flushPromiseQueue() + const payload = responseAddress + ? merge({}, commerceSetShipping, { + orderOrError: { + order: { requestedFulfillment: responseAddress }, + }, + }) + : commerceSetShipping + + return await mockResolveLastOperation({ + CommerceSetShippingPayload: () => payload, + }) +} + +const getAllPendingOperationNames = (env: MockEnvironment) => { + return env.mock.getAllOperations().map(op => op.request.node.operation.name) +} + +let mockTrackEvent: jest.Mock + +// FIXME: CI Timeouts likely due to fillAddressForm() duration... describe.skip("Shipping", () => { - const pushMock = jest.fn() - let isCommittingMutation - let relayEnv + const mockUseRouter = useRouter as jest.Mock + const mockPush = jest.fn() beforeEach(() => { - isCommittingMutation = false + HTMLElement.prototype.scrollIntoView = jest.fn() + mockTrackEvent = jest.fn() ;(useTracking as jest.Mock).mockImplementation(() => ({ - trackEvent: jest.fn(), + trackEvent: mockTrackEvent, })) ;(useFeatureFlag as jest.Mock).mockImplementation(() => false) - }) - afterEach(() => { - jest.restoreAllMocks() + mockUseRouter.mockReturnValue({ + router: { + push: mockPush, + }, + }) }) - const { renderWithRelay } = setupTestWrapperTL({ - Component: (props: any) => ( - - - - ), + let mockRelayEnv + // create the mock environment here so we can pass it into our MockBoot + // component + const renderWithRelay: typeof renderWithRelayRaw = ( + resolvers, + componentProps = {}, + relayEnv = createMockEnvironment() + ) => { + mockRelayEnv = relayEnv + return renderWithRelayRaw(resolvers, componentProps, relayEnv) + } + + const { renderWithRelay: renderWithRelayRaw } = setupTestWrapperTL< + ShippingTestQuery + >({ + Component: props => { + return ( + + + + ) + }, query: graphql` - query ShippingTestQuery @raw_response_type @relay_test_operation { + query ShippingTestQuery @relay_test_operation @raw_response_type { order: commerceOrder(id: "unused") { ...Shipping_order } @@ -286,6 +319,100 @@ describe.skip("Shipping", () => { `, }) + describe("initial load with order data", () => { + it("loads with saved shipping fulfillment and no saved addresses", async () => { + const orderWithFulfillment = { + ...order, + requestedFulfillment: { + __typename: "CommerceShip", + name: "Dr Collector", + addressLine1: "1 Main St", + addressLine2: "", + city: "Madrid", + country: "ES", + postalCode: "28001", + region: "", + phoneNumber: "555-555-5555", + }, + } + renderWithRelay({ + CommerceOrder: () => orderWithFulfillment, + Me: () => meWithoutAddress, + }) + + const renderedFullName = await screen.findByDisplayValue("Dr Collector") + expect(renderedFullName).toHaveValue("Dr Collector") + expect(screen.getByPlaceholderText("Street address")).toHaveValue( + "1 Main St" + ) + expect(screen.getByPlaceholderText("City")).toHaveValue("Madrid") + expect(screen.getByPlaceholderText("ZIP/Postal code")).toHaveValue( + "28001" + ) + expect( + screen.getByPlaceholderText("Add phone number including country code") + ).toHaveValue("555-555-5555") + }) + + it("loads with saved shipping fulfillment and matching saved addresses", async () => { + const expectedAddress = meWithAddresses.addressConnection!.edges![1]! + .node! + const unexpectedAddress = meWithAddresses.addressConnection!.edges![0]! + .node! + + const orderWithFulfillment = { + ...order, + requestedFulfillment: { + __typename: "CommerceShip", + name: expectedAddress.name, + addressLine1: expectedAddress.addressLine1, + addressLine2: expectedAddress.addressLine2, + city: expectedAddress.city, + country: expectedAddress.country, + postalCode: expectedAddress.postalCode, + region: expectedAddress.region, + phoneNumber: expectedAddress.phoneNumber, + }, + } + + renderWithRelay({ + CommerceOrder: () => orderWithFulfillment, + Me: () => meWithAddresses, + }) + + expect(expectedAddress.addressLine1).toEqual("401 Broadway") + expect(unexpectedAddress.addressLine1).toEqual("1 Main St") + + expect(screen.getByRole("radio", { name: /401 Broadway/ })).toBeChecked() + expect(screen.getByRole("radio", { name: /1 Main St/ })).not.toBeChecked() + }) + it("loads with saved pickup fulfillment", async () => { + const orderWithFulfillment = { + ...order, + requestedFulfillment: { + __typename: "CommercePickup", + fulfillmentType: "PICKUP", + phoneNumber: "555-555-5555", + }, + } + + renderWithRelay({ + CommerceOrder: () => orderWithFulfillment, + Me: () => meWithoutAddress, + }) + + await waitFor(() => { + expect( + screen.getByRole("radio", { name: /Arrange for pickup/ }) + ).toBeChecked() + }) + + expect( + screen.getByPlaceholderText("Add phone number including country code") + ).toHaveValue("555-555-5555") + }) + }) + describe("with partner shipping", () => { describe("with no saved address", () => { it("shows an active offer stepper if it's an offer order", async () => { @@ -312,7 +439,7 @@ describe.skip("Shipping", () => { it("does not render fulfillment selection if artwork is not available for pickup", async () => { const shippingOnlyOrder = cloneDeep(order) as any - shippingOnlyOrder.lineItems.edges[0].node.artwork.pickup_available = false + shippingOnlyOrder.lineItems.edges[0].node.artwork.pickupAvailable = false renderWithRelay({ CommerceOrder: () => shippingOnlyOrder, @@ -367,67 +494,56 @@ describe.skip("Shipping", () => { expect(screen.getByTestId("AddressForm_country")).toBeEnabled() }) - it("sets shipping on order and saves address on user", async () => { - mockCommitMutation.mockResolvedValueOnce(settingOrderShipmentSuccess) - renderWithRelay({ - CommerceOrder: () => order, + it("sets shipping on order, saves address on user and advances to payment", async () => { + const { mockResolveLastOperation, env } = renderWithRelay({ + CommerceOrder: () => ({ ...order, __id: order.id }), Me: () => meWithoutAddress, }) await fillAddressForm(validAddress) - await saveAndContinue() - expect(mockCommitMutation).toHaveBeenCalledTimes(2) + await saveAndContinue() - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" - ) - expect(mutationArg.variables).toEqual({ - input: { - id: "1234", - fulfillmentType: "SHIP", - phoneNumber: validAddress.phoneNumber, - shipping: { - ...validAddress, - phoneNumber: "", + const createAddressOperation = await mockResolveLastOperation({ + CreateUserAddressPayload: () => saveAddressSuccess.createUserAddress, + Me: () => ({ + ...meWithoutAddress, + addressConnection: { + totalCount: 0, + edges: [ + { + node: { + ...saveAddressSuccess.createUserAddress + ?.userAddressOrErrors, + }, + }, + ], }, - }, + }), }) - mutationArg = mockCommitMutation.mock.calls[1][0][1] - expect(mutationArg.mutation.default.operation.name).toEqual( - "CreateUserAddressMutation" + expect(createAddressOperation.operationName).toBe( + "useCreateSavedAddressMutation" ) - expect(mutationArg.variables).toEqual({ + expect(createAddressOperation.operationVariables).toMatchObject({ input: { attributes: validAddress, }, }) - }) - it("sets shipping on order but does not save address if save address is not checked", async () => { - mockCommitMutation.mockResolvedValueOnce(settingOrderShipmentSuccess) - renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) + await flushPromiseQueue() - await fillAddressForm(validAddress) - userEvent.click( - screen.getByRole("checkbox", { name: /Save shipping address/ }) + const fulfillmentRequest = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping ) - await saveAndContinue() - - expect(mockCommitMutation).toHaveBeenCalledTimes(1) - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + expect(fulfillmentRequest.operationName).toBe( + "useSaveFulfillmentDetailsMutation" ) - expect(mutationArg.variables).toEqual({ + expect(fulfillmentRequest.operationVariables).toMatchObject({ input: { - id: "1234", + id: "2939023", fulfillmentType: "SHIP", phoneNumber: validAddress.phoneNumber, shipping: { @@ -436,36 +552,77 @@ describe.skip("Shipping", () => { }, }, }) + + await waitFor(() => { + expect(getAllPendingOperationNames(env)).toEqual([]) + expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") + }) }) - it("routes to payment screen after mutation completes", async () => { - mockCommitMutation.mockResolvedValueOnce(settingOrderShipmentSuccess) - renderWithRelay({ + it("save address not checked: sets shipping on order and advances to payment without saving address", async () => { + const { env, mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => order, Me: () => meWithoutAddress, }) await fillAddressForm(validAddress) + await clickSaveAddress() + await saveAndContinue() - expect(mockCommitMutation).toHaveBeenCalledTimes(2) - expect(pushMock).toHaveBeenCalledWith("/orders/1234/payment") + const fulfillmentRequest = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping + ) + + expect(fulfillmentRequest.operationName).toBe( + "useSaveFulfillmentDetailsMutation" + ) + await waitFor(() => { + expect(getAllPendingOperationNames(env)).toEqual([]) + expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") + }) + expect(() => env.mock.getMostRecentOperation()).toThrow() }) - it("shows the button spinner while loading the mutation", async () => { - isCommittingMutation = true - renderWithRelay({ - CommerceOrder: () => order, + it("shows a loading spinner while operations are pending", async () => { + const { mockResolveLastOperation, env } = renderWithRelay({ + CommerceOrder: () => ({ ...order, __id: order.id }), Me: () => meWithoutAddress, }) - const button = screen.getByRole("button", { name: "Save and Continue" }) - expect(queryByAttribute("class", button, /Spinner/)).toBeInTheDocument() + await fillAddressForm(validAddress) + await saveAndContinue() + + const getSpinner = () => { + const button = screen.getByRole("button", { + name: "Save and Continue", + }) + return queryByAttribute("class", button, /Spinner/) + } + + await waitFor(() => { + expect(getSpinner()).toBeInTheDocument() + }) + + await mockResolveLastOperation({ + CreateUserAddressPayload: () => saveAddressSuccess.createUserAddress, + }) + + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping + ) + + await waitFor(() => { + expect(getSpinner()).not.toBeInTheDocument() + expect(getAllPendingOperationNames(env)).toEqual([]) + expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") + }) }) - it("shows an error when there is an error from the server", async () => { - mockCommitMutation.mockResolvedValueOnce(settingOrderShipmentFailure) - renderWithRelay({ + it("shows a generic error when there is an unrecognized error code in the exchange result", async () => { + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => order, Me: () => meWithoutAddress, }) @@ -473,99 +630,245 @@ describe.skip("Shipping", () => { await fillAddressForm(validAddress) await saveAndContinue() - expect(mockShowErrorDialog).toHaveBeenCalledWith() + await flushPromiseQueue() + + await mockResolveLastOperation({ + CreateUserAddressPayload: () => saveAddressSuccess.createUserAddress, + }) + + await flushPromiseQueue() + + await resolveSaveFulfillmentDetails(mockResolveLastOperation, { + orderOrError: { + __typename: "CommerceOrderWithMutationFailure", + error: { + type: "validation", + code: "something_new", + data: null, + }, + }, + }) + + await waitFor(() => { + expect(mockShowErrorDialog).toHaveBeenCalledWith() + }) }) - it("shows an error when there is a network error", async () => { - mockCommitMutation.mockRejectedValueOnce({}) - renderWithRelay({ + it("shows and tracks an error when an exchange mutation throws an error", async () => { + const { mockRejectLastOperation } = renderWithRelay({ CommerceOrder: () => order, Me: () => meWithoutAddress, }) await fillAddressForm(validAddress) + await clickSaveAddress() + await saveAndContinue() - expect(mockShowErrorDialog).toHaveBeenCalledWith() + await waitFor(() => + mockRejectLastOperation(new Error("##TEST_ERROR## wrong number")) + ) + await waitFor(() => expect(mockShowErrorDialog).toHaveBeenCalledWith()) + + expect(mockTrackEvent).toHaveBeenLastCalledWith({ + action: "errorMessageViewed", + context_owner_id: "2939023", + context_owner_type: "orders-shipping", + error_code: undefined, + flow: "user selects a shipping option", + message: + "Something went wrong. Please try again or contact orders@artsy.net.", + title: "An error occurred", + }) }) - it("shows an error when there is a missing_country error from the server", async () => { - mockCommitMutation.mockResolvedValueOnce( - settingOrderShipmentMissingCountryFailure - ) - renderWithRelay({ + it("shows and tracks an error when there is a missing_country error from the server", async () => { + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => order, Me: () => meWithoutAddress, }) await fillAddressForm(validAddress) + await clickSaveAddress() + await saveAndContinue() - expect(mockShowErrorDialog).toHaveBeenCalledWith({ - title: "Invalid address", + await resolveSaveFulfillmentDetails(mockResolveLastOperation, { + orderOrError: { + __typename: "CommerceOrderWithMutationFailure", + error: { + type: "validation", + code: "missing_country", + data: null, + }, + }, + }) + await waitFor(() => + expect(mockShowErrorDialog).toHaveBeenCalledWith({ + title: "Invalid address", + message: + "There was an error processing your address. Please review and try again.", + }) + ) + expect(mockTrackEvent).toHaveBeenLastCalledWith({ + action: "errorMessageViewed", + context_owner_id: "2939023", + context_owner_type: "orders-shipping", + error_code: "missing_country", + flow: "user submits a shipping option", message: "There was an error processing your address. Please review and try again.", + title: "Invalid address", }) }) - it("shows an error when there is a missing_region error from the server", async () => { - mockCommitMutation.mockResolvedValueOnce( - settingOrderShipmentMissingRegionFailure - ) - renderWithRelay({ + it("shows and tracks an error when there is a missing_region error from the server", async () => { + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => order, Me: () => meWithoutAddress, }) await fillAddressForm(validAddress) + await clickSaveAddress() + await saveAndContinue() - expect(mockShowErrorDialog).toHaveBeenCalledWith({ - title: "Invalid address", + await resolveSaveFulfillmentDetails(mockResolveLastOperation, { + orderOrError: { + __typename: "CommerceOrderWithMutationFailure", + error: { + type: "validation", + code: "missing_region", + data: null, + }, + }, + }) + await waitFor(() => + expect(mockShowErrorDialog).toHaveBeenCalledWith({ + title: "Invalid address", + message: + "There was an error processing your address. Please review and try again.", + }) + ) + expect(mockTrackEvent).toHaveBeenLastCalledWith({ + action: "errorMessageViewed", + context_owner_id: "2939023", + context_owner_type: "orders-shipping", + error_code: "missing_region", + flow: "user submits a shipping option", message: "There was an error processing your address. Please review and try again.", + title: "Invalid address", }) }) - it("shows an error when there is a destination_could_not_be_geocodederror from the server", async () => { - mockCommitMutation.mockResolvedValueOnce( - settingOrderArtaShipmentDestinationCouldNotBeGeocodedFailure - ) - renderWithRelay({ + it("shows and tracks an error when there is a destination_could_not_be_geocoded error from the server", async () => { + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => order, Me: () => meWithoutAddress, }) await fillAddressForm(validAddress) + await clickSaveAddress() + await saveAndContinue() + await resolveSaveFulfillmentDetails(mockResolveLastOperation, { + orderOrError: { + __typename: "CommerceOrderWithMutationFailure", + error: { + type: "arta", + code: "destination_could_not_be_geocoded", + data: + '{"status":422,"errors":{"destination":["could not be geocoded"]}}', + }, + }, + }) expect(mockShowErrorDialog).toHaveBeenCalledWith({ title: "Cannot calculate shipping", message: ( ), }) + expect(mockTrackEvent).toHaveBeenLastCalledWith({ + action: "errorMessageViewed", + context_owner_id: "2939023", + context_owner_type: "orders-shipping", + error_code: "destination_could_not_be_geocoded", + flow: "user submits a shipping option", + message: + "Please confirm that your address details are correct and try again. If the issue continues contact orders@artsy.net.", + title: "Cannot calculate shipping", + }) }) + it("shows and tracks an error when there is a unsupported_shipping_location error from the server", async () => { + const { mockResolveLastOperation } = renderWithRelay({ + CommerceOrder: () => order, + Me: () => meWithoutAddress, + }) - it("pre-populates address form for order with already persisted shipping info", async () => { - renderWithRelay({ - CommerceOrder: () => ({ - ...order, - requestedFulfillment: { - ...validAddress, - __typename: "CommerceShip", - name: "Dr Collector", + await fillAddressForm(validAddress) + await clickSaveAddress() + + await saveAndContinue() + + await resolveSaveFulfillmentDetails(mockResolveLastOperation, { + orderOrError: { + __typename: "CommerceOrderWithMutationFailure", + error: { + code: "unsupported_shipping_location", + data: '{"failure_code":"domestic_shipping_only"}', }, - }), + }, + }) + expect(mockShowErrorDialog).toHaveBeenLastCalledWith({ + title: "Can't ship to that address", + message: "This work can only be shipped domestically.", + }) + expect(mockTrackEvent).toHaveBeenLastCalledWith({ + action: "errorMessageViewed", + context_owner_id: "2939023", + context_owner_type: "orders-shipping", + error_code: "unsupported_shipping_location", + flow: "user submits a shipping option", + message: "This work can only be shipped domestically.", + title: "Can't ship to that address", + }) + }) + it("shows and tracks an error when there is an unlisted error from the server", async () => { + const { mockResolveLastOperation } = renderWithRelay({ + CommerceOrder: () => order, Me: () => meWithoutAddress, }) - expect(screen.getByPlaceholderText("Full name")).toHaveValue( - "Dr Collector" - ) + await fillAddressForm(validAddress) + await clickSaveAddress() + + await saveAndContinue() + + await resolveSaveFulfillmentDetails(mockResolveLastOperation, { + orderOrError: { + __typename: "CommerceOrderWithMutationFailure", + error: { + code: "something new", + data: "{}", + }, + }, + }) + expect(mockShowErrorDialog).toHaveBeenLastCalledWith() + expect(mockTrackEvent).toHaveBeenLastCalledWith({ + action: "errorMessageViewed", + context_owner_id: "2939023", + context_owner_type: "orders-shipping", + error_code: "something new", + flow: "user submits a shipping option", + message: + "Something went wrong. Please try again or contact orders@artsy.net.", + title: "An error occurred", + }) }) - it("resets shipping for order with already persisted shipping info", async () => { + it("pre-populates address form for order with already persisted shipping info", async () => { renderWithRelay({ CommerceOrder: () => ({ ...order, @@ -578,237 +881,111 @@ describe.skip("Shipping", () => { Me: () => meWithoutAddress, }) - await saveAndContinue() - - expect(mockCommitMutation).toHaveBeenCalledTimes(1) - - const mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + expect(screen.getByPlaceholderText("Full name")).toHaveValue( + "Dr Collector" ) - expect(mutationArg.variables).toEqual({ - input: { - id: "1234", - fulfillmentType: "SHIP", - phoneNumber: validAddress.phoneNumber, - shipping: { - ...validAddress, - name: "Dr Collector", - }, - }, - }) }) - describe("form validations", () => { - it("does not submit an empty form", async () => { - renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, + describe("address verification", () => { + describe("with US enabled and international disabled", () => { + beforeEach(() => { + ;(useFeatureFlag as jest.Mock).mockImplementation( + (featureName: string) => featureName === "address_verification_us" + ) }) - await saveAndContinue() - expect(mockCommitMutation).not.toBeCalled() - }) + it("triggers basic form validation before address verification", async () => { + const { env } = renderWithRelay({ + CommerceOrder: () => order, + Me: () => meWithoutAddress, + }) - it("does not submit an incomplete form", async () => { - renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) + expect( + screen.queryByText(/[\w\s]is required/) + ).not.toBeInTheDocument() - userEvent.type(screen.getByPlaceholderText("Full name"), "First Last") + await fillAddressForm({ ...validAddress, addressLine1: undefined }) - await saveAndContinue() - expect(mockCommitMutation).not.toBeCalled() - }) + await flushPromiseQueue() + expect( + screen.queryByText(/[\w\s]is required/) + ).not.toBeInTheDocument() - it("requires some fields", async () => { - renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, + await userEvent.click(screen.getByText("Save and Continue")) + + await waitFor(() => { + expect( + screen.getByText("Street address is required") + ).toBeVisible() + }) + expect(env.mock.getAllOperations().length).toEqual(0) }) - await saveAndContinue() - expect( - screen.getAllByText("This field is required").length - ).toBeGreaterThanOrEqual(1) - }) + it("triggers the flow for US address after clicking continue", async () => { + const { env, mockResolveLastOperation } = renderWithRelay({ + CommerceOrder: () => order, + Me: () => meWithoutAddress, + }) - it("requires a phone number", async () => { - renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) + await fillAddressForm(validAddressBeforeVerification) - await fillAddressForm({ - name: "Erik David", - addressLine1: "401 Broadway", - addressLine2: "", - city: "New York", - region: "NY", - postalCode: "10013", - phoneNumber: "", - country: "US", - }) - await saveAndContinue() - - // TODO: form validation is triggered for collapsed form unnecessarily - expect(screen.getAllByText("This field is required")).toHaveLength(2) - expect(mockCommitMutation).not.toHaveBeenCalled() - }) - - it("allows a missing postal code and state/province if the selected country is not US or Canada", async () => { - renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - await fillAddressForm({ - name: "Erik David", - addressLine1: "401 Broadway", - addressLine2: "", - city: "New York", - region: "", - postalCode: "", - phoneNumber: "5555937743", - country: "AQ", - }) - await saveAndContinue() - - expect( - screen.queryByText("This field is required") - ).not.toBeInTheDocument() - expect(mockCommitMutation).toHaveBeenCalled() - }) - - it("only shows validation erros on touched inputs before submission", async () => { - renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - const name = screen.getByPlaceholderText("Full name") - userEvent.type(name, "First Last") - userEvent.clear(name) - - expect(screen.getByText("This field is required")).toBeInTheDocument() - }) - - it("shows all validation erros including untouched inputs after submission", async () => { - renderWithRelay({ - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }) - - const name = screen.getByPlaceholderText("Full name") - userEvent.type(name, "First Last") - userEvent.clear(name) - - await saveAndContinue() - expect( - screen.getAllByText("This field is required").length - ).toBeGreaterThan(1) - }) - }) + await saveAndContinue() - describe("address verification", () => { - describe("with US enabled and international disabled", () => { - beforeEach(() => { - ;(useFeatureFlag as jest.Mock).mockImplementation( - (featureName: string) => featureName === "address_verification_us" + await verifyAddressWithSuggestions( + mockResolveLastOperation, + validAddressBeforeVerification, + recommendedAddress ) - relayEnv = createMockEnvironment() - }) - afterEach(() => { - relayEnv = undefined + expect(env.mock.getAllOperations().length).toEqual(0) }) - it("triggers basic form validation before address verification", async () => { - const { env } = renderWithRelay( - { - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }, - undefined, - relayEnv - ) - - expect( - screen.queryByText("This field is required") - ).not.toBeInTheDocument() - - await fillAddressForm(validAddress) - userEvent.clear(screen.getByPlaceholderText("Street address")) - - await userEvent.click(screen.getByText("Save and Continue")) - - expect(screen.getByText("This field is required")).toBeVisible() - expect(env.mock.getAllOperations()).toHaveLength(0) - }) + it("uses recommended address", async () => { + const { mockResolveLastOperation } = renderWithRelay({ + CommerceOrder: () => order, + Me: () => meWithoutAddress, + }) - it("triggers the flow for US address after clicking continue", async () => { - const { env } = renderWithRelay( - { - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }, - undefined, - relayEnv - ) + await fillAddressForm(validAddressBeforeVerification) - await fillAddressForm(validAddress) - await userEvent.click(screen.getByText("Save and Continue")) + await saveAndContinue() await verifyAddressWithSuggestions( - env, - validAddress, + mockResolveLastOperation, + validAddressBeforeVerification, recommendedAddress ) - expect(mockCommitMutation).not.toHaveBeenCalled() - }) - - it("uses recommended address", async () => { - const { env } = renderWithRelay( - { - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }, - undefined, - relayEnv - ) + await userEvent.click(screen.getByText("Use This Address")) - await fillAddressForm(validAddress) - await userEvent.click(screen.getByText("Save and Continue")) + await flushPromiseQueue() + const createAddressOperation = await mockResolveLastOperation({ + CreateUserAddressPayload: () => + saveAddressSuccess.createUserAddress, + }) - await verifyAddressWithSuggestions( - env, - validAddress, - recommendedAddress + expect(createAddressOperation.operationName).toBe( + "useCreateSavedAddressMutation" ) - mockCommitMutation.mockResolvedValueOnce( - settingOrderShipmentSuccess + await flushPromiseQueue() + const fulfillmentOperation = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping ) - // Clicking "Use This Address" on verification modal automatically - // sets shipping on the order and proceeds to the next step. - userEvent.click(screen.getByText("Use This Address")) - expect(mockCommitMutation).toHaveBeenCalledTimes(1) - - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + + expect(fulfillmentOperation.operationName).toBe( + "useSaveFulfillmentDetailsMutation" ) - expect(mutationArg.variables).toEqual({ + expect(fulfillmentOperation.operationVariables).toEqual({ input: { - id: "1234", + id: "2939023", fulfillmentType: "SHIP", addressVerifiedBy: "ARTSY", phoneNumber: validAddress.phoneNumber, shipping: { ...recommendedAddress, - name: "Erik David", + name: "Joelle Van Dyne", phoneNumber: "", }, }, @@ -816,45 +993,53 @@ describe.skip("Shipping", () => { }) it("goes back and edits address after verification", async () => { - const { env } = renderWithRelay( - { - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }, - undefined, - relayEnv - ) + const { mockResolveLastOperation } = renderWithRelay({ + CommerceOrder: () => order, + Me: () => meWithoutAddress, + }) - await fillAddressForm(validAddress) - await userEvent.click(screen.getByText("Save and Continue")) + await fillAddressForm(validAddressBeforeVerification) + await clickSaveAddress() + + await saveAndContinue() await verifyAddressWithSuggestions( - env, - validAddress, + mockResolveLastOperation, + validAddressBeforeVerification, recommendedAddress ) // Clicking "Back to Edit" allows users to edit the address form // and requires clicking "Save and Continue" to proceed. - userEvent.click(screen.getByText("Back to Edit")) - await userEvent.click(screen.getByText("Save and Continue")) - mockCommitMutation.mockResolvedValueOnce( - settingOrderShipmentSuccess + await userEvent.click(screen.getByText("Back to Edit")) + await userEvent.paste( + screen.getByPlaceholderText("City"), + ": the big apple" ) - expect(mockCommitMutation).toHaveBeenCalledTimes(1) - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + await flushPromiseQueue() + + await saveAndContinue() + + const fulfillmentOperation = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping ) - expect(mutationArg.variables).toEqual({ + + expect(fulfillmentOperation.operationName).toBe( + "useSaveFulfillmentDetailsMutation" + ) + expect(fulfillmentOperation.operationVariables).toEqual({ input: { - id: "1234", + id: "2939023", fulfillmentType: "SHIP", addressVerifiedBy: "USER", phoneNumber: validAddress.phoneNumber, shipping: { - ...validAddress, + ...validAddressBeforeVerification, + city: "New York: the big apple", + + name: "Joelle Van Dyne", phoneNumber: "", }, }, @@ -862,181 +1047,51 @@ describe.skip("Shipping", () => { }) it("does not triggers the flow for international address after clicking continue", async () => { - const { env } = renderWithRelay( - { - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }, - undefined, - relayEnv - ) + const { mockResolveLastOperation } = renderWithRelay({ + CommerceOrder: () => order, + Me: () => meWithoutAddress, + }) await fillAddressForm(validAddress) - userEvent.selectOptions(screen.getByTestId("AddressForm_country"), [ - "TW", - ]) - await userEvent.click(screen.getByText("Save and Continue")) - - expect(env.mock.getAllOperations()).toHaveLength(0) - }) - }) - - describe("with US disabled and international enabled", () => { - beforeEach(() => { - ;(useFeatureFlag as jest.Mock).mockImplementation( - (featureName: string) => - featureName === "address_verification_intl" - ) - relayEnv = createMockEnvironment() - }) - - afterEach(() => { - relayEnv = undefined - }) + await clickSaveAddress() - it("does not trigger the flow for US address after clicking continue", async () => { - const { env } = renderWithRelay( - { - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }, - undefined, - relayEnv + await userEvent.selectOptions( + screen.getByTestId("AddressForm_country"), + ["TW"] ) - await fillAddressForm(validAddress) - await userEvent.click(screen.getByText("Save and Continue")) - - expect(env.mock.getAllOperations()).toHaveLength(0) - }) + await saveAndContinue() - it("triggers the flow for international address after clicking continue", async () => { - const { env } = renderWithRelay( - { - CommerceOrder: () => order, - Me: () => meWithoutAddress, - }, - undefined, - relayEnv - ) + await flushPromiseQueue() - await fillAddressForm(validAddress) - userEvent.selectOptions(screen.getByTestId("AddressForm_country"), [ - "TW", - ]) - await userEvent.click(screen.getByText("Save and Continue")) + const operation = mockResolveLastOperation({}) - const mutation = env.mock.getMostRecentOperation() - expect(mutation.request.node.operation.name).toEqual( - "AddressVerificationFlowQuery" + expect(operation.operationName).toBe( + "useSaveFulfillmentDetailsMutation" ) - expect(mutation.request.variables).toEqual({ - address: { - addressLine1: "401 Broadway", - addressLine2: "", - city: "New York", - region: "NY", - postalCode: "15601", - country: "TW", - }, - }) - }) - }) - }) - - it("scrolls to top of address form when there are address form errors", async () => { - renderWithRelay({ - CommerceOrder: () => UntouchedOfferOrder, - Me: () => meWithoutAddress, - }) - - await fillAddressForm({ - name: "Erik David", - addressLine1: "401 Broadway", - addressLine2: "", - city: "", - region: "", - postalCode: "", - phoneNumber: "8888888888", - country: "", - }) - - await saveAndContinue() - - expect(mockJumpTo).toBeCalledWith("deliveryAddressTop", { - behavior: "smooth", - }) - }) - - it("scrolls to top of phone number form when there are phone number errors", async () => { - renderWithRelay({ - CommerceOrder: () => UntouchedOfferOrder, - Me: () => meWithoutAddress, - }) - - await fillAddressForm({ - name: "Erik David", - addressLine1: "401 Broadway", - addressLine2: "", - city: "New York", - region: "NY", - postalCode: "10013", - phoneNumber: "", - country: "US", - }) - - await saveAndContinue() - - expect(mockJumpTo).toBeCalledWith("phoneNumberTop", { - behavior: "smooth", - }) - }) - - it("scrolls to top of address form when there are both address and phone number errors", async () => { - renderWithRelay({ - CommerceOrder: () => UntouchedOfferOrder, - Me: () => meWithoutAddress, - }) - - await saveAndContinue() - - expect(mockJumpTo).toBeCalledWith("deliveryAddressTop", { - behavior: "smooth", - }) - }) - - it("scrolls to top of shipping quotes when they are fetched after save and continue", async () => { - mockCommitMutation - .mockResolvedValueOnce(settingOrderArtaShipmentSuccess) - .mockImplementationOnce(relayProps => { - relayProps[1].onCompleted(saveAddressSuccess) }) - .mockResolvedValueOnce(selectShippingQuoteSuccess) - - renderWithRelay({ - CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromUS, - Me: () => meWithoutAddress, - }) - - await fillAddressForm(validAddress) - await saveAndContinue() - - expect(mockJumpTo).toBeCalledWith("shippingOptionsTop", { - behavior: "smooth", }) }) }) + // e.g.: Should valid saved address be automatically saved to show shipping quotes? describe("with saved addresses", () => { it("does not show the new address form", async () => { - renderWithRelay({ + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => order, Me: () => meWithAddresses, }) + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping + ) // TODO: need a better way to check if the form is collapsed (height 0). // Zero height is not considered invisible. // https://github.com/testing-library/jest-dom/issues/450 + expect(screen.getByTestId("addressFormCollapse")).toHaveStyle({ + height: "0px", + }) expect(screen.getByPlaceholderText("Street address")).toHaveAttribute( "tabindex", "-1" @@ -1044,11 +1099,16 @@ describe.skip("Shipping", () => { }) it("lists the addresses and renders the add address option", async () => { - renderWithRelay({ + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => order, Me: () => meWithAddresses, }) + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping + ) + expect( screen.getByRole("radio", { name: /401 Broadway/ }) ).toBeVisible() @@ -1058,23 +1118,23 @@ describe.skip("Shipping", () => { ).toBeVisible() }) - it("sets shipping with the first saved address and phone number when user submits the form directly", async () => { - renderWithRelay({ + it("automatically saves the default saved address on load if valid (without tracking)", async () => { + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => order, Me: () => meWithAddresses, }) - await saveAndContinue() - - expect(mockCommitMutation).toHaveBeenCalledTimes(1) + const automaticFulfillmentMutation = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping + ) - const mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + expect(automaticFulfillmentMutation.operationName).toEqual( + "useSaveFulfillmentDetailsMutation" ) - expect(mutationArg.variables).toEqual({ + expect(automaticFulfillmentMutation.operationVariables).toEqual({ input: { - id: "1234", + id: "2939023", fulfillmentType: "SHIP", phoneNumber: "422-424-4242", shipping: { @@ -1083,32 +1143,46 @@ describe.skip("Shipping", () => { city: "New York", country: "US", name: "Test Name", - phoneNumber: "422-424-4242", + phoneNumber: "", postalCode: "10013", region: "NY", }, }, }) + + expect(mockTrackEvent).not.toHaveBeenCalled() }) - it("sets shipping with the selected saved address and phone number", async () => { - renderWithRelay({ + it("sets shipping again when the user clicks to select address", async () => { + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => order, Me: () => meWithAddresses, }) - userEvent.click(screen.getByRole("radio", { name: /1 Main St/ })) - await saveAndContinue() + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping + ) - expect(mockCommitMutation).toHaveBeenCalledTimes(1) + await userEvent.click(screen.getByRole("radio", { name: /1 Main St/ })) - const mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + expect(mockTrackEvent).toHaveBeenCalledWith({ + action: "clickedShippingAddress", + context_module: "ordersShipping", + context_page_owner_id: "2939023", + context_page_owner_type: "orders-shipping", + }) + + const fulfillmentMutation = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping ) - expect(mutationArg.variables).toEqual({ + expect(fulfillmentMutation.operationName).toEqual( + "useSaveFulfillmentDetailsMutation" + ) + expect(fulfillmentMutation.operationVariables).toEqual({ input: { - id: "1234", + id: "2939023", fulfillmentType: "SHIP", phoneNumber: "555-555-5555", shipping: { @@ -1117,7 +1191,7 @@ describe.skip("Shipping", () => { city: "Madrid", country: "ES", name: "Test Name", - phoneNumber: "555-555-5555", + phoneNumber: "", postalCode: "28001", region: "", }, @@ -1131,34 +1205,32 @@ describe.skip("Shipping", () => { ;(useFeatureFlag as jest.Mock).mockImplementation( (featureName: string) => featureName === "address_verification_us" ) - relayEnv = createMockEnvironment() - }) - - afterEach(() => { - relayEnv = undefined }) it("does not trigger the flow", async () => { - const { env } = renderWithRelay( - { - CommerceOrder: () => order, - Me: () => meWithAddresses, - }, - undefined, - relayEnv - ) + const { mockResolveLastOperation } = renderWithRelay({ + CommerceOrder: () => order, + Me: () => meWithAddresses, + }) - await userEvent.click(screen.getByText("Save and Continue")) + const automaticFulfillmentMutation = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping + ) - // Address verification flow is not triggered. - expect(env.mock.getAllOperations()).toHaveLength(0) + expect(automaticFulfillmentMutation.operationName).toEqual( + "useSaveFulfillmentDetailsMutation" + ) - // It sets shipping on order directly. - expect(mockCommitMutation).toHaveBeenCalledTimes(1) + await userEvent.click( + screen.getByRole("radio", { name: /1 Main St/ }) + ) - const mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + const manualFulfillmentMutation = await waitFor(() => + mockResolveLastOperation({}) + ) + expect(manualFulfillmentMutation.operationName).toBe( + "useSaveFulfillmentDetailsMutation" ) }) }) @@ -1166,101 +1238,119 @@ describe.skip("Shipping", () => { describe("editing address", () => { it("opens a modal with the address prepopulated", async () => { - mockCommitMutation.mockResolvedValueOnce( - settingOrderArtaShipmentSuccess - ) - - renderWithRelay({ - CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, + const { mockResolveLastOperation } = renderWithRelay({ + CommerceOrder: () => order, Me: () => meWithAddresses, }) - await flushPromiseQueue() - // Set shipping on load for the default address - expect(mockCommitMutation).toHaveBeenCalledTimes(1) - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping ) - const selectedAddress = screen.getByRole("radio", { - name: /401 Broadway/, - checked: true, - }) + const selectedAddress = screen.getAllByTestId("savedAddress")[1] + expect(selectedAddress).toHaveTextContent("401 Broadway") + await userEvent.click(within(selectedAddress).getByText("Edit")) - await flushPromiseQueue() - expect(screen.getByText("Edit address")).toBeVisible() - expect(screen.getByDisplayValue("401 Broadway")).toBeInTheDocument() - expect(screen.getByDisplayValue("Floor 25")).toBeInTheDocument() - expect(screen.getByDisplayValue("New York")).toBeInTheDocument() - expect(screen.getByDisplayValue("NY")).toBeInTheDocument() - expect(screen.getByDisplayValue("10013")).toBeInTheDocument() + await waitFor(async () => { + const addressModal = screen.getByTestId("AddressModal") + expect(screen.getByText("Edit address")).toBeVisible() + expect( + within(addressModal).getByDisplayValue("401 Broadway") + ).toBeVisible() + expect( + within(addressModal).getByDisplayValue("Floor 25") + ).toBeVisible() + expect( + within(addressModal).getByDisplayValue("New York") + ).toBeVisible() + expect(within(addressModal).getByDisplayValue("NY")).toBeVisible() + expect( + within(addressModal).getByDisplayValue("10013") + ).toBeVisible() + }) }) - it("updates the address after submitting the modal form", async () => { - mockCommitMutation.mockResolvedValueOnce( - settingOrderArtaShipmentSuccess - ) - - const updateAddressSpy = jest - .spyOn(updateUserAddress, "updateUserAddress") - // @ts-ignore - .mockImplementationOnce((_, __, ___, ____, onSuccess) => { - onSuccess(updateAddressSuccess) - }) - - renderWithRelay({ - CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, + it("updates the address after submitting the modal form, then saves the address to the order", async () => { + const { mockResolveLastOperation } = renderWithRelay({ + CommerceOrder: () => order, Me: () => meWithAddresses, }) - await flushPromiseQueue() - // Set shipping on load for the default address - expect(mockCommitMutation).toHaveBeenCalledTimes(1) - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping ) - const selectedAddress = screen.getByRole("radio", { - name: /401 Broadway/, - checked: true, - }) + const selectedAddress = screen.getAllByTestId("savedAddress")[1] + expect(selectedAddress).toHaveTextContent("401 Broadway") + await userEvent.click(within(selectedAddress).getByText("Edit")) - const modalTitle = screen.getByText("Edit address") + const modalTitle = await screen.findByText("Edit address") expect(modalTitle).toBeVisible() // TODO: need a better way to get a specific input field from multiple forms - const addressLine2 = screen.getAllByPlaceholderText( - /Apt, floor, suite/ - )[0] - userEvent.clear(addressLine2) - userEvent.type(addressLine2, "25th fl.") + await waitFor(async () => { + const addressModal = screen.getByTestId("AddressModal") + const addressLine2 = within(addressModal).getByPlaceholderText( + /Apt, floor, suite/ + ) + await userEvent.clear(addressLine2) + await userEvent.paste(addressLine2, "25th fl.") + }) + userEvent.click(screen.getByRole("button", { name: "Save" })) + await flushPromiseQueue() - expect(updateAddressSpy).toHaveBeenCalledTimes(1) - expect(updateAddressSpy).toHaveBeenCalledWith( - expect.anything(), - "2", - { - addressLine1: "401 Broadway", + const updateAddressResult = { + userAddressOrErrors: { + ...saveAddressSuccess.createUserAddress!.userAddressOrErrors, addressLine2: "25th fl.", - addressLine3: "", - city: "New York", - country: "US", - name: "Test Name", - phoneNumber: "422-424-4242", - postalCode: "10013", - region: "NY", }, - expect.anything(), - expect.anything(), - expect.anything() + } + const updateAddressOperation = await mockResolveLastOperation({ + UpdateUserAddressPayload: () => updateAddressResult, + }) + + expect(updateAddressOperation.operationName).toEqual( + "useUpdateSavedAddressMutation" ) - }) + expect(updateAddressOperation.operationVariables).toMatchObject({ + input: { + attributes: { + addressLine1: "401 Broadway", + addressLine2: "25th fl.", + city: "New York", + country: "US", + name: "Test Name", + phoneNumber: "422-424-4242", + postalCode: "10013", + region: "NY", + }, + userAddressID: "2", + }, + }) + + await flushPromiseQueue() + + const saveFulfillmentOperation = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping + ) + + expect(saveFulfillmentOperation.operationName).toEqual( + "useSaveFulfillmentDetailsMutation" + ) + + // Fixme: Save address with correct new value + expect( + saveFulfillmentOperation.operationVariables.input.shipping + .addressLine2 + ).toEqual("25th fl.") + }) }) }) }) @@ -1273,52 +1363,53 @@ describe.skip("Shipping", () => { ;(useFeatureFlag as jest.Mock).mockImplementation( (featureName: string) => featureName === "address_verification_us" ) - relayEnv = createMockEnvironment() - }) - - afterEach(() => { - relayEnv = undefined }) it("uses recommended address", async () => { - const { env } = renderWithRelay( - { - CommerceOrder: () => - UntouchedBuyOrderWithArtsyShippingDomesticFromUS, - Me: () => meWithoutAddress, - }, - undefined, - relayEnv - ) + const { mockResolveLastOperation, env } = renderWithRelay({ + CommerceOrder: () => + UntouchedBuyOrderWithArtsyShippingDomesticFromUS, + Me: () => meWithoutAddress, + }) await fillAddressForm(validAddress) await saveAndContinue() await verifyAddressWithSuggestions( - env, + mockResolveLastOperation, validAddress, recommendedAddress ) - mockCommitMutation - .mockResolvedValueOnce(settingOrderArtaShipmentSuccess) - .mockImplementationOnce(relayProps => { - relayProps[1].onCompleted(saveAddressSuccess) - }) - .mockResolvedValueOnce(selectShippingQuoteSuccess) + await userEvent.click(screen.getByText("Use This Address")) - // Clicking "Use This Address" on verification modal automatically - // sets shipping on the order and fetching quotes. - userEvent.click(screen.getByText("Use This Address")) await flushPromiseQueue() - expect(mockCommitMutation).toHaveBeenCalledTimes(2) + const createAddressOperation = await mockResolveLastOperation({ + CreateUserAddressPayload: () => + merge({}, saveAddressSuccess.createUserAddress, { + userAddressOrErrors: { + ...recommendedAddress, + __typename: "UserAddress", + }, + }), + }) + expect(createAddressOperation.operationName).toBe( + "useCreateSavedAddressMutation" + ) + + await flushPromiseQueue() - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + const fulfillmentOperation = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping, + recommendedAddress ) - expect(mutationArg.variables).toEqual({ + + expect(fulfillmentOperation.operationName).toBe( + "useSaveFulfillmentDetailsMutation" + ) + expect(fulfillmentOperation.operationVariables).toEqual({ input: { id: "2939023", fulfillmentType: "SHIP_ARTA", @@ -1326,98 +1417,78 @@ describe.skip("Shipping", () => { phoneNumber: validAddress.phoneNumber, shipping: { ...recommendedAddress, - name: "Erik David", + name: "Joelle Van Dyne", phoneNumber: "", }, }, }) - mutationArg = mockCommitMutation.mock.calls[1][0][1] - expect(mutationArg.mutation.default.operation.name).toEqual( - "CreateUserAddressMutation" - ) - expect(mutationArg.variables).toEqual({ - input: { - attributes: { - ...recommendedAddress, - name: "Erik David", - phoneNumber: "5555937743", - }, - }, - }) + await flushPromiseQueue() - userEvent.click(screen.getByText(/^Premium/)) - await saveAndContinue() + await waitFor(() => userEvent.click(screen.getByText(/^Premium/))) - expect(mockCommitMutation).toHaveBeenCalledTimes(4) + await flushPromiseQueue() - mutationArg = mockCommitMutation.mock.calls[2][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SelectShippingOptionMutation" + await saveAndContinue() + await flushPromiseQueue() + const selectNewShippingOptionOperation = await mockResolveLastOperation( + { + CommerceSelectShippingOptionPayload: () => + selectShippingQuoteSuccess.commerceSelectShippingOption, + } ) - expect(mutationArg.variables).toEqual({ - input: { - id: "2939023", - selectedShippingQuoteId: "1eb3ba19-643b-4101-b113-2eb4ef7e30b6", - }, - }) - - mutationArg = mockCommitMutation.mock.calls[3][0][1] - expect(mutationArg.mutation.default.operation.name).toEqual( - "UpdateUserAddressMutation" + expect(selectNewShippingOptionOperation.operationName).toBe( + "useSelectShippingQuoteMutation" ) - expect(mutationArg.variables).toEqual({ - input: { - userAddressID: "address-id", - attributes: { - ...recommendedAddress, - name: "Erik David", - phoneNumber: "5555937743", - }, - }, - }) + + await flushPromiseQueue() + expect(getAllPendingOperationNames(env)).toEqual([]) + expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") }) it("goes back and edits address after verification", async () => { - const { env } = renderWithRelay( - { - CommerceOrder: () => - UntouchedBuyOrderWithArtsyShippingDomesticFromUS, - Me: () => meWithoutAddress, - }, - undefined, - relayEnv - ) + const { mockResolveLastOperation, env } = renderWithRelay({ + CommerceOrder: () => + UntouchedBuyOrderWithArtsyShippingDomesticFromUS, + Me: () => meWithoutAddress, + }) + + await fillAddressForm(validAddressBeforeVerification) - await fillAddressForm(validAddress) await saveAndContinue() await verifyAddressWithSuggestions( - env, - validAddress, + mockResolveLastOperation, + validAddressBeforeVerification, recommendedAddress ) - mockCommitMutation - .mockResolvedValueOnce(settingOrderArtaShipmentSuccess) - .mockImplementationOnce(relayProps => { - relayProps[1].onCompleted(saveAddressSuccess) - }) - .mockResolvedValueOnce(selectShippingQuoteSuccess) - // Clicking "Back to Edit" allows users to edit the address form // and requires clicking "Save and Continue" to proceed. userEvent.click(screen.getByText("Back to Edit")) - await userEvent.click(screen.getByText("Save and Continue")) + + await saveAndContinue() await flushPromiseQueue() - expect(mockCommitMutation).toHaveBeenCalledTimes(2) + const createAddressOperation = await mockResolveLastOperation({ + CreateUserAddressPayload: () => + saveAddressSuccess.createUserAddress, + }) + expect(createAddressOperation.operationName).toBe( + "useCreateSavedAddressMutation" + ) + + await flushPromiseQueue() + + const fulfillmentOperation = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping + ) - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + expect(fulfillmentOperation.operationName).toBe( + "useSaveFulfillmentDetailsMutation" ) - expect(mutationArg.variables).toEqual({ + expect(fulfillmentOperation.operationVariables).toEqual({ input: { id: "2939023", fulfillmentType: "SHIP_ARTA", @@ -1425,147 +1496,274 @@ describe.skip("Shipping", () => { phoneNumber: validAddress.phoneNumber, shipping: { ...validAddress, + name: "Joelle Van Dyne", phoneNumber: "", }, }, }) - mutationArg = mockCommitMutation.mock.calls[1][0][1] - expect(mutationArg.mutation.default.operation.name).toEqual( - "CreateUserAddressMutation" - ) - expect(mutationArg.variables).toEqual({ - input: { - attributes: { - ...validAddress, - phoneNumber: "5555937743", - }, - }, - }) - - userEvent.click(screen.getByText(/^Premium/)) + await flushPromiseQueue() await saveAndContinue() - - expect(mockCommitMutation).toHaveBeenCalledTimes(4) - - mutationArg = mockCommitMutation.mock.calls[2][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SelectShippingOptionMutation" + const selectShippingOptionOperation = await mockResolveLastOperation( + { + CommerceSelectShippingOptionPayload: () => + selectShippingQuoteSuccess.commerceSelectShippingOption, + } ) - expect(mutationArg.variables).toEqual({ - input: { - id: "2939023", - selectedShippingQuoteId: "1eb3ba19-643b-4101-b113-2eb4ef7e30b6", - }, - }) - - mutationArg = mockCommitMutation.mock.calls[3][0][1] - expect(mutationArg.mutation.default.operation.name).toEqual( - "UpdateUserAddressMutation" + expect(selectShippingOptionOperation.operationName).toBe( + "useSelectShippingQuoteMutation" ) - expect(mutationArg.variables).toEqual({ - input: { - userAddressID: "address-id", - attributes: { - ...validAddress, - phoneNumber: "5555937743", - }, - }, - }) + + await flushPromiseQueue() + expect(getAllPendingOperationNames(env)).toEqual([]) + expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") }) }) }) - it("sets shipping on order, selects shipping quote, and save address on user", async () => { - mockCommitMutation - .mockResolvedValueOnce(settingOrderArtaShipmentSuccess) - .mockImplementationOnce(relayProps => { - relayProps[1].onCompleted(saveAddressSuccess) - }) - .mockResolvedValueOnce(selectShippingQuoteSuccess) + it("shows an error if Arta doesn't return shipping quotes", async () => { + const settingOrderArtaShipmentSuccessWithoutQuotes = cloneDeep( + settingOrderArtaShipmentSuccess + ) as any + settingOrderArtaShipmentSuccessWithoutQuotes.commerceSetShipping.orderOrError.order.lineItems.edges[0].node.shippingQuoteOptions.edges = [] - renderWithRelay({ + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromUS, Me: () => meWithoutAddress, }) await fillAddressForm(validAddress) + await clickSaveAddress() + await saveAndContinue() - // FIXME: `getByRole` can be slow and cause test to time out. - // https://github.com/testing-library/dom-testing-library/issues/552#issuecomment-625172052 - // expect(screen.getByRole("radio", { name: /Standard/ })).toBeVisible() - // expect(screen.getByRole("radio", { name: /Express/ })).toBeVisible() - // expect(screen.getByRole("radio", { name: /White Glove/ })).toBeVisible() - // expect(screen.getByRole("radio", { name: /Rush/ })).toBeVisible() - // expect(screen.getByRole("radio", { name: /Premium/ })).toBeVisible() - expect(mockCommitMutation).toHaveBeenCalledTimes(2) - - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccessWithoutQuotes.commerceSetShipping ) - expect(mutationArg.variables).toEqual({ - input: { - id: "2939023", - fulfillmentType: "SHIP_ARTA", - phoneNumber: validAddress.phoneNumber, - shipping: { - ...validAddress, - phoneNumber: "", + + expect( + screen.queryByRole("radio", { name: /Standard/ }) + ).not.toBeInTheDocument() + expect( + screen.getByText( + /In order to provide a shipping quote, we need some more information from you./ + ) + ).toBeInTheDocument() + }) + + it("hides shipping quotes and updates shipping address plus saved address if user edits address fields", async () => { + const { mockResolveLastOperation, env } = renderWithRelay({ + CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromUS, + Me: () => meWithoutAddress, + }) + + await fillAddressForm(validAddress) + await saveAndContinue() + + await flushPromiseQueue() + const saveAddressOperation = await mockResolveLastOperation({ + CreateUserAddressPayload: () => saveAddressSuccess.createUserAddress, + Me: () => ({ + ...meWithoutAddress, + addressConnection: { + totalCount: 0, + edges: [ + { + node: { + ...saveAddressSuccess.createUserAddress + ?.userAddressOrErrors, + }, + }, + ], }, - }, + }), + }) + + expect(saveAddressOperation.operationName).toBe( + "useCreateSavedAddressMutation" + ) + + await flushPromiseQueue() + + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping + ) + + await flushPromiseQueue() + + const addressLine1 = screen.getByPlaceholderText("Street address") + const addressLine2 = screen.getByPlaceholderText( + "Apt, floor, suite, etc." + ) + await userEvent.clear(addressLine2) + await userEvent.tab() + await userEvent.paste(addressLine1, " Suite 25") + + await waitFor(() => { + const shippingBox = screen.getByTestId("ShippingQuotes_collapse") + + expect(shippingBox).toHaveStyle({ height: "0px" }) }) - mutationArg = mockCommitMutation.mock.calls[1][0][1] - expect(mutationArg.mutation.default.operation.name).toEqual( - "CreateUserAddressMutation" + await flushPromiseQueue() + + await saveAndContinue() + + const updatedUserAddress = { + ...updateAddressSuccess?.updateUserAddress?.userAddressOrErrors, + __typename: "UserAddress", + addressLine1: "401 Broadway Suite 25", + addressLine2: "", + } + + await flushPromiseQueue() + const updateAddressOperation = await mockResolveLastOperation({ + UpdateUserAddressPayload: () => ({ + userAddressOrErrors: updatedUserAddress, + }), + Me: () => ({ + ...meWithoutAddress, + addressConnection: { + totalCount: 1, + edges: [ + { + node: updatedUserAddress, + }, + ], + }, + }), + }) + + await flushPromiseQueue() + + expect(updateAddressOperation.operationName).toBe( + "useUpdateSavedAddressMutation" ) - expect(mutationArg.variables).toEqual({ + expect(updateAddressOperation.operationVariables).toEqual({ input: { - attributes: validAddress, + attributes: { + name: "Joelle Van Dyne", + phoneNumber: "120938120983", + addressLine1: "401 Broadway Suite 25", + addressLine2: "", + city: "New York", + region: "NY", + country: "US", + postalCode: "10013", + }, + userAddressID: "address-id", }, }) - userEvent.click(screen.getByText(/^Premium/)) + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping, + { addressLine1: "401 Broadway Suite 25", addressLine2: "" } + ) + + await flushPromiseQueue() + + const premiumShipping = await screen.findByRole("radio", { + name: /Premium/, + }) + + await userEvent.click(premiumShipping) + await saveAndContinue() - expect(mockCommitMutation).toHaveBeenCalledTimes(4) + await flushPromiseQueue() + + const selectShippingOptionOperation = await mockResolveLastOperation({ + CommerceSelectShippingOptionPayload: () => + selectShippingQuoteSuccess.commerceSelectShippingOption, + }) - mutationArg = mockCommitMutation.mock.calls[2][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SelectShippingOptionMutation" + expect(selectShippingOptionOperation.operationName).toBe( + "useSelectShippingQuoteMutation" ) - expect(mutationArg.variables).toEqual({ + expect(selectShippingOptionOperation.operationVariables).toEqual({ input: { id: "2939023", selectedShippingQuoteId: "1eb3ba19-643b-4101-b113-2eb4ef7e30b6", }, }) + await flushPromiseQueue() + expect(getAllPendingOperationNames(env)).toEqual([]) + expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") + }) - // TODO: Why do we need to update address shortly after creating it? - mutationArg = mockCommitMutation.mock.calls[3][0][1] - expect(mutationArg.mutation.default.operation.name).toEqual( - "UpdateUserAddressMutation" + it("saves address upon selecting shipping quote if address is checked and it wasn't saved before", async () => { + const { mockResolveLastOperation, env } = renderWithRelay({ + CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromUS, + Me: () => meWithoutAddress, + }) + + await fillAddressForm(validAddress) + await clickSaveAddress() + + await saveAndContinue() + + const fulfillmentOperation = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping ) - expect(mutationArg.variables).toEqual({ + expect(fulfillmentOperation.operationName).toBe( + "useSaveFulfillmentDetailsMutation" + ) + + // FIXME: `getByRole` can be slow and cause test to time out. + // https://github.com/testing-library/dom-testing-library/issues/552#issuecomment-625172052 + const premiumShipping = await screen.findByRole("radio", { + name: /Premium/, + }) + await userEvent.click(premiumShipping) + await clickSaveAddress() + + await saveAndContinue() + + await flushPromiseQueue() + const saveAddressOperation = await mockResolveLastOperation({ + CreateUserAddressPayload: () => saveAddressSuccess.createUserAddress, + }) + + expect(saveAddressOperation.operationName).toBe( + "useCreateSavedAddressMutation" + ) + expect(saveAddressOperation.operationVariables).toEqual({ input: { - userAddressID: "address-id", - attributes: validAddress, + attributes: { + addressLine1: "401 Broadway", + addressLine2: "Suite 25", + city: "New York", + country: "US", + name: "Joelle Van Dyne", + phoneNumber: "120938120983", + postalCode: "10013", + region: "NY", + }, }, }) - }) - it("shows an error if Arta doesn't return shipping quotes", async () => { - const settingOrderArtaShipmentSuccessWithoutQuotes = cloneDeep( - settingOrderArtaShipmentSuccess - ) as any - settingOrderArtaShipmentSuccessWithoutQuotes.commerceSetShipping.orderOrError.order.lineItems.edges[0].node.shippingQuoteOptions.edges = [] - mockCommitMutation.mockResolvedValueOnce( - settingOrderArtaShipmentSuccessWithoutQuotes + await flushPromiseQueue() + + const selectShippingOptionOperation = await mockResolveLastOperation({ + CommerceSelectShippingOptionPayload: () => + selectShippingQuoteSuccess.commerceSelectShippingOption, + }) + expect(selectShippingOptionOperation.operationName).toBe( + "useSelectShippingQuoteMutation" ) - renderWithRelay({ + await flushPromiseQueue() + + expect(getAllPendingOperationNames(env)).toEqual([]) + expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") + }) + + it("removes saved address upon selecting shipping quote if save-address is unchecked after initially saving it", async () => { + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromUS, Me: () => meWithoutAddress, }) @@ -1573,26 +1771,66 @@ describe.skip("Shipping", () => { await fillAddressForm(validAddress) await saveAndContinue() - expect( - screen.queryByRole("radio", { name: /Standard/ }) - ).not.toBeInTheDocument() - // TODO: Why are there 2 error messages? - expect( - screen.getAllByText( - /In order to provide a shipping quote, we need some more information from you./ - ) - ).toHaveLength(2) - }) + await flushPromiseQueue() + const saveAddressOperation = await mockResolveLastOperation({ + CreateUserAddressPayload: () => saveAddressSuccess.createUserAddress, + }) - it("removes saved address if save address is deselected after fetching shipping quotes", async () => { - mockCommitMutation - .mockResolvedValueOnce(settingOrderArtaShipmentSuccess) - .mockImplementationOnce(relayProps => { - relayProps[1].onCompleted(saveAddressSuccess) - }) - .mockResolvedValueOnce(selectShippingQuoteSuccess) + expect(saveAddressOperation.operationName).toBe( + "useCreateSavedAddressMutation" + ) + await flushPromiseQueue() - renderWithRelay({ + const fulfillmentOperation = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping, + validAddress + ) + expect(fulfillmentOperation.operationName).toBe( + "useSaveFulfillmentDetailsMutation" + ) + + // FIXME: `getByRole` can be slow and cause test to time out. + // https://github.com/testing-library/dom-testing-library/issues/552#issuecomment-625172052 + const premiumShipping = await screen.findByRole("radio", { + name: /Premium/, + }) + await userEvent.click(premiumShipping) + + await clickSaveAddress() + await flushPromiseQueue() + + await saveAndContinue() + await flushPromiseQueue() + + const deleteAddressOperation = await mockResolveLastOperation({ + // DeleteUserAddressPayload: () => saveAddressSuccess, + }) + expect(deleteAddressOperation.operationName).toBe( + "useDeleteSavedAddressMutation" + ) + + await flushPromiseQueue() + + const selectShippingOptionOperation = await mockResolveLastOperation({ + CommerceSelectShippingOptionPayload: () => + selectShippingQuoteSuccess.commerceSelectShippingOption, + }) + expect(selectShippingOptionOperation.operationName).toBe( + "useSelectShippingQuoteMutation" + ) + + expect(deleteAddressOperation.operationVariables).toEqual({ + input: { + userAddressID: "address-id", + }, + }) + }) + it("shows dialog and tracks error if shipping quote save operation fails", async () => { + const { + mockResolveLastOperation, + mockRejectLastOperation, + } = renderWithRelay({ CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromUS, Me: () => meWithoutAddress, }) @@ -1600,95 +1838,157 @@ describe.skip("Shipping", () => { await fillAddressForm(validAddress) await saveAndContinue() + await flushPromiseQueue() + const saveAddressOperation = await mockResolveLastOperation({ + CreateUserAddressPayload: () => saveAddressSuccess.createUserAddress, + }) + + expect(saveAddressOperation.operationName).toBe( + "useCreateSavedAddressMutation" + ) + await flushPromiseQueue() + + const fulfillmentOperation = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping, + validAddress + ) + expect(fulfillmentOperation.operationName).toBe( + "useSaveFulfillmentDetailsMutation" + ) + // FIXME: `getByRole` can be slow and cause test to time out. // https://github.com/testing-library/dom-testing-library/issues/552#issuecomment-625172052 - // expect(screen.getByRole("radio", { name: /Standard/ })).toBeVisible() - // expect(screen.getByRole("radio", { name: /Express/ })).toBeVisible() - // expect(screen.getByRole("radio", { name: /White Glove/ })).toBeVisible() - // expect(screen.getByRole("radio", { name: /Rush/ })).toBeVisible() - // expect(screen.getByRole("radio", { name: /Premium/ })).toBeVisible() + const premiumShipping = await screen.findByRole("radio", { + name: /Premium/, + }) + await userEvent.click(premiumShipping) - expect(mockCommitMutation).toHaveBeenCalledTimes(2) + await flushPromiseQueue() + + await saveAndContinue() + await flushPromiseQueue() - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + const selectShippingOptionOperation = await mockRejectLastOperation( + new Error("##TEST_ERROR## shipping quotes failed") ) - expect(mutationArg.variables).toEqual({ - input: { - id: "2939023", - fulfillmentType: "SHIP_ARTA", - phoneNumber: validAddress.phoneNumber, - shipping: { - ...validAddress, - phoneNumber: "", - }, - }, + + expect(selectShippingOptionOperation.operationName).toBe( + "useSelectShippingQuoteMutation" + ) + + await waitFor(() => expect(mockShowErrorDialog).toHaveBeenCalledWith()) + expect(mockTrackEvent).toHaveBeenCalledWith({ + action: "errorMessageViewed", + context_owner_id: "2939023", + context_owner_type: "orders-shipping", + error_code: undefined, + flow: "user sets a shipping quote", + message: + "There was a problem getting shipping quotes. Please contact orders@artsy.net.", + title: "An error occurred", + }) + }) + }) + + describe("with saved addresses", () => { + it("re-saves an already-saved shipping address on load to refresh shipping quotes without saving address", async () => { + const { mockResolveLastOperation, env } = renderWithRelay({ + CommerceOrder: () => BuyOrderWithArtaShippingDetails, + Me: () => meWithoutAddress, }) - mutationArg = mockCommitMutation.mock.calls[1][0][1] - expect(mutationArg.mutation.default.operation.name).toEqual( - "CreateUserAddressMutation" + await waitFor(() => { + const shippingBox = screen.getByTestId("ShippingQuotes_collapse") + expect(shippingBox).toHaveStyle({ height: "0px" }) + }) + + const fulfillmentOperation = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping ) - expect(mutationArg.variables).toEqual({ + expect(fulfillmentOperation.operationName).toBe( + "useSaveFulfillmentDetailsMutation" + ) + expect(fulfillmentOperation.operationVariables).toEqual({ input: { - attributes: validAddress, + fulfillmentType: "SHIP_ARTA", + id: "2939023", + phoneNumber: "120938120983", + shipping: { + addressLine1: "401 Broadway", + addressLine2: "Suite 25", + city: "New York", + country: "US", + name: "Joelle Van Dyne", + phoneNumber: "", + postalCode: "10013", + region: "NY", + }, }, }) - userEvent.click(screen.getByText(/^Premium/)) - userEvent.click(screen.getByText(/^Save shipping address/)) - - await saveAndContinue() + await flushPromiseQueue() + expect(getAllPendingOperationNames(env)).toEqual([]) + }) + it("tracks selecting shipping quote", async () => { + const { mockResolveLastOperation } = renderWithRelay({ + CommerceOrder: () => BuyOrderWithArtaShippingDetails, + Me: () => meWithoutAddress, + }) - expect(mockCommitMutation).toHaveBeenCalledTimes(4) + await waitFor(() => { + const shippingBox = screen.getByTestId("ShippingQuotes_collapse") + expect(shippingBox).toHaveStyle({ height: "0px" }) + }) - mutationArg = mockCommitMutation.mock.calls[2][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SelectShippingOptionMutation" + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping ) - expect(mutationArg.variables).toEqual({ - input: { - id: "2939023", - selectedShippingQuoteId: "1eb3ba19-643b-4101-b113-2eb4ef7e30b6", - }, + + // FIXME: `getByRole` can be slow and cause test to time out. + // https://github.com/testing-library/dom-testing-library/issues/552#issuecomment-625172052 + const premiumShipping = await screen.findByRole("radio", { + name: /Premium/, }) + await userEvent.click(premiumShipping) - mutationArg = mockCommitMutation.mock.calls[3][0][1] - expect(mutationArg.mutation.default.operation.name).toEqual( - "DeleteUserAddressMutation" - ) - expect(mutationArg.variables).toEqual({ - input: { - userAddressID: "address-id", - }, + expect(mockTrackEvent).toHaveBeenLastCalledWith({ + action: "clickedSelectShippingOption", + context_module: "ordersShipping", + context_page_owner_id: "2939023", + context_page_owner_type: "orders-shipping", + subject: "1eb3ba19-643b-4101-b113-2eb4ef7e30b6", }) }) - }) - describe("with saved addresses", () => { + // TODO: EMI-1526 https://artsyproduct.atlassian.net/browse/EMI-1526 describe("Artsy shipping international only", () => { describe("with artwork located in the US", () => { it("sets shipping on order if the collector is in the EU", async () => { const meWithDefaultAddressInSpain = cloneDeep( meWithAddresses ) as any + meWithDefaultAddressInSpain.addressConnection.edges[0].node.isDefault = true // Spain meWithDefaultAddressInSpain.addressConnection.edges[1].node.isDefault = false // US - renderWithRelay({ + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingInternationalFromUS, Me: () => meWithDefaultAddressInSpain, }) - await flushPromiseQueue() - expect(mockCommitMutation).toHaveBeenCalledTimes(1) - const mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + const fulfillmentRequest = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping + ) + + expect(fulfillmentRequest.operationName).toBe( + "useSaveFulfillmentDetailsMutation" ) - expect(mutationArg.variables).toEqual({ + expect(fulfillmentRequest.operationVariables).toEqual({ input: { id: "2939023", fulfillmentType: "SHIP_ARTA", @@ -1699,47 +1999,37 @@ describe.skip("Shipping", () => { city: "Madrid", country: "ES", name: "Test Name", - phoneNumber: "555-555-5555", + phoneNumber: "", postalCode: "28001", region: "", }, }, }) }) - - it("does not set shipping on order if the collector is in the US", async () => { - renderWithRelay({ - CommerceOrder: () => - UntouchedBuyOrderWithArtsyShippingInternationalFromUS, - Me: () => meWithAddresses, - }) - await flushPromiseQueue() - - expect(mockCommitMutation).not.toHaveBeenCalled() - expect( - screen.queryByRole("radio", { - name: /(^Standard|^Express|^White Glove|^Rush|^Premium)/, - }) - ).not.toBeInTheDocument() - }) }) describe("with artwork located in Germany", () => { - it("does not set shipping on order if the collector is in the EU", async () => { + it("does not set shipping on order automatically if the collector is in the EU", async () => { + // TODO: Why would we want this behavior? We can now set shipping on all valid saved addresses- + // no need to check whether it needs artsy shipping. const meWithDefaultAddressInSpain = cloneDeep( meWithAddresses ) as any meWithDefaultAddressInSpain.addressConnection.edges[0].node.isDefault = true // Spain meWithDefaultAddressInSpain.addressConnection.edges[1].node.isDefault = false // US - renderWithRelay({ + const { env, mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingInternationalFromGermany, Me: () => meWithDefaultAddressInSpain, }) - await flushPromiseQueue() - expect(mockCommitMutation).not.toHaveBeenCalled() + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping + ) + + expect(getAllPendingOperationNames(env)).toEqual([]) expect( screen.queryByRole("radio", { name: /(^Standard|^Express|^White Glove|^Rush|^Premium)/, @@ -1747,20 +2037,22 @@ describe.skip("Shipping", () => { ).not.toBeInTheDocument() }) - it("sets shipping on order if the collector is in the US", async () => { - renderWithRelay({ + it("sets shipping on order automatically if the collector is in the US", async () => { + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingInternationalFromGermany, Me: () => meWithAddresses, }) - await flushPromiseQueue() - expect(mockCommitMutation).toHaveBeenCalledTimes(1) - const mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + const fulfillmentRequest = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping + ) + + expect(fulfillmentRequest.operationName).toBe( + "useSaveFulfillmentDetailsMutation" ) - expect(mutationArg.variables).toEqual({ + expect(fulfillmentRequest.operationVariables).toEqual({ input: { id: "2939023", fulfillmentType: "SHIP_ARTA", @@ -1771,7 +2063,7 @@ describe.skip("Shipping", () => { city: "New York", country: "US", name: "Test Name", - phoneNumber: "422-424-4242", + phoneNumber: "", postalCode: "10013", region: "NY", }, @@ -1783,26 +2075,31 @@ describe.skip("Shipping", () => { describe("Artsy shipping domestic only", () => { describe("with artwork located in Germany", () => { - it("sets shipping on order if the collector is in Germany", async () => { + // TODO: Like the test above, these tests assume we don't want to automatically set shipping + // unless the default address would require artsy shipping. That is no longer the case- + // We can safely set the shipping. See alsoped test above (~L1957) + it("sets shipping on order if the collector is in the EU", async () => { const meWithDefaultAddressInSpain = cloneDeep( meWithAddresses ) as any meWithDefaultAddressInSpain.addressConnection.edges[0].node.isDefault = true // Spain meWithDefaultAddressInSpain.addressConnection.edges[1].node.isDefault = false // US - renderWithRelay({ + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromGermany, Me: () => meWithDefaultAddressInSpain, }) - await flushPromiseQueue() - expect(mockCommitMutation).toHaveBeenCalledTimes(1) - const mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + const fulfillmentRequest = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping + ) + + expect(fulfillmentRequest.operationName).toBe( + "useSaveFulfillmentDetailsMutation" ) - expect(mutationArg.variables).toEqual({ + expect(fulfillmentRequest.operationVariables).toEqual({ input: { id: "2939023", fulfillmentType: "SHIP_ARTA", @@ -1813,7 +2110,7 @@ describe.skip("Shipping", () => { city: "Madrid", country: "ES", name: "Test Name", - phoneNumber: "555-555-5555", + phoneNumber: "", postalCode: "28001", region: "", }, @@ -1822,14 +2119,18 @@ describe.skip("Shipping", () => { }) it("does not set shipping on order if the collector is in the US", async () => { - renderWithRelay({ + const { env, mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromGermany, Me: () => meWithAddresses, }) - await flushPromiseQueue() - expect(mockCommitMutation).not.toHaveBeenCalled() + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping + ) + + expect(getAllPendingOperationNames(env)).toEqual([]) expect( screen.queryByRole("radio", { name: /(^Standard|^Express|^White Glove|^Rush|^Premium)/, @@ -1846,14 +2147,18 @@ describe.skip("Shipping", () => { meWithDefaultAddressInSpain.addressConnection.edges[0].node.isDefault = true // Spain meWithDefaultAddressInSpain.addressConnection.edges[1].node.isDefault = false // US - renderWithRelay({ + const { env, mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromUS, Me: () => meWithDefaultAddressInSpain, }) - await flushPromiseQueue() - expect(mockCommitMutation).not.toHaveBeenCalled() + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping + ) + + expect(getAllPendingOperationNames(env)).toEqual([]) expect( screen.queryByRole("radio", { name: /(^Standard|^Express|^White Glove|^Rush|^Premium)/, @@ -1863,53 +2168,51 @@ describe.skip("Shipping", () => { describe("with the collector in the US", () => { it("sets shipping with the default address on load", async () => { - mockCommitMutation.mockResolvedValueOnce( - settingOrderArtaShipmentSuccess - ) - - renderWithRelay({ + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromUS, Me: () => meWithAddresses, }) - await flushPromiseQueue() - expect(mockCommitMutation).toHaveBeenCalledTimes(1) + const fulfillmentRequest = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping + ) - const mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + expect(fulfillmentRequest.operationName).toBe( + "useSaveFulfillmentDetailsMutation" ) - expect(mutationArg.variables).toEqual({ - input: { - id: "2939023", - fulfillmentType: "SHIP_ARTA", - phoneNumber: "422-424-4242", - shipping: { - addressLine1: "401 Broadway", - addressLine2: "Floor 25", - city: "New York", - country: "US", - name: "Test Name", - phoneNumber: "422-424-4242", - postalCode: "10013", - region: "NY", - }, + expect(fulfillmentRequest.operationVariables.input).toEqual({ + id: "2939023", + fulfillmentType: "SHIP_ARTA", + phoneNumber: "422-424-4242", + shipping: { + addressLine1: "401 Broadway", + addressLine2: "Floor 25", + city: "New York", + country: "US", + name: "Test Name", + phoneNumber: "", + postalCode: "10013", + region: "NY", }, }) }) it("shows shipping quotes for the default address on load", async () => { - mockCommitMutation.mockResolvedValueOnce( - settingOrderArtaShipmentSuccess - ) - - renderWithRelay({ + const { mockResolveLastOperation } = renderWithRelay({ CommerceOrder: () => UntouchedBuyOrderWithArtsyShippingDomesticFromUS, Me: () => meWithAddresses, }) - await flushPromiseQueue() + const fulfillmentRequest = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping + ) + + expect(fulfillmentRequest.operationName).toBe( + "useSaveFulfillmentDetailsMutation" + ) expect( screen.getAllByRole("radio", { @@ -1919,50 +2222,35 @@ describe.skip("Shipping", () => { }) it("sets shipping on order, shows shipping quotes and saves the pre-selected quote", async () => { - mockCommitMutation.mockResolvedValueOnce( - settingOrderArtaShipmentSuccess - ) - - renderWithRelay({ + const { mockResolveLastOperation } = renderWithRelay({ // Simulate the condition with an order with saved shipping quotes CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, Me: () => meWithAddresses, }) - await flushPromiseQueue() + const fulfillmentRequest = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping + ) + + expect(fulfillmentRequest.operationName).toBe( + "useSaveFulfillmentDetailsMutation" + ) + expect(screen.getByText("Save and Continue")).toBeEnabled() + await flushPromiseQueue() await saveAndContinue() - expect(mockCommitMutation).toHaveBeenCalledTimes(2) - - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + await flushPromiseQueue() + const selectShippingOptionOperation = await mockResolveLastOperation( + {} ) - expect(mutationArg.variables).toEqual({ - input: { - id: "2939023", - fulfillmentType: "SHIP_ARTA", - phoneNumber: "422-424-4242", - shipping: { - addressLine1: "401 Broadway", - addressLine2: "Floor 25", - city: "New York", - country: "US", - name: "Test Name", - phoneNumber: "422-424-4242", - postalCode: "10013", - region: "NY", - }, - }, - }) - mutationArg = mockCommitMutation.mock.calls[1][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SelectShippingOptionMutation" + expect(selectShippingOptionOperation.operationName).toEqual( + "useSelectShippingQuoteMutation" ) - expect(mutationArg.variables).toEqual({ + expect(selectShippingOptionOperation.operationVariables).toEqual({ input: { id: "2939023", selectedShippingQuoteId: @@ -1972,28 +2260,20 @@ describe.skip("Shipping", () => { }) it("selects a different shipping quote and saves it", async () => { - mockCommitMutation.mockResolvedValueOnce( - settingOrderArtaShipmentSuccess - ) - - renderWithRelay({ + const { mockResolveLastOperation } = renderWithRelay({ // Simulate the condition with an order with saved shipping quotes CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, Me: () => meWithAddresses, }) - await flushPromiseQueue() - - userEvent.click(screen.getByText(/^Premium/)) - expect(screen.getByText("Save and Continue")).toBeEnabled() - await saveAndContinue() - - expect(mockCommitMutation).toHaveBeenCalledTimes(2) + const fulfillmentRequest = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping + ) - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + expect(fulfillmentRequest.operationName).toBe( + "useSaveFulfillmentDetailsMutation" ) - expect(mutationArg.variables).toEqual({ + expect(fulfillmentRequest.operationVariables).toEqual({ input: { id: "2939023", fulfillmentType: "SHIP_ARTA", @@ -2004,18 +2284,25 @@ describe.skip("Shipping", () => { city: "New York", country: "US", name: "Test Name", - phoneNumber: "422-424-4242", + phoneNumber: "", postalCode: "10013", region: "NY", }, }, }) - mutationArg = mockCommitMutation.mock.calls[1][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SelectShippingOptionMutation" + userEvent.click(screen.getByText(/^Premium/)) + expect(screen.getByText("Save and Continue")).toBeEnabled() + await saveAndContinue() + + await flushPromiseQueue() + const selectShippingOptionOperation = await mockResolveLastOperation( + {} + ) + expect(selectShippingOptionOperation.operationName).toEqual( + "useSelectShippingQuoteMutation" ) - expect(mutationArg.variables).toEqual({ + expect(selectShippingOptionOperation.operationVariables).toEqual({ input: { id: "2939023", selectedShippingQuoteId: @@ -2025,15 +2312,15 @@ describe.skip("Shipping", () => { }) it("keeps the submit button enabled after selecting a shipping quote", async () => { - mockCommitMutation.mockResolvedValueOnce( - settingOrderArtaShipmentSuccess - ) - - renderWithRelay({ + const { mockResolveLastOperation } = renderWithRelay({ + // Simulate the condition with an order with saved shipping quotes CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, Me: () => meWithAddresses, }) - await flushPromiseQueue() + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping + ) const premiumShipping = screen.getByRole("radio", { name: /^Premium/, @@ -2050,269 +2337,148 @@ describe.skip("Shipping", () => { }) it("routes to payment screen after saving shipping option", async () => { - mockCommitMutation - .mockResolvedValueOnce(settingOrderArtaShipmentSuccess) - .mockResolvedValueOnce(selectShippingQuoteSuccess) - - renderWithRelay({ + const { mockResolveLastOperation, env } = renderWithRelay({ + // Simulate the condition with an order with saved shipping quotes CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, Me: () => meWithAddresses, }) - await flushPromiseQueue() + const fulfillmentRequest = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping + ) + expect(fulfillmentRequest.operationName).toBe( + "useSaveFulfillmentDetailsMutation" + ) await saveAndContinue() - expect(mockCommitMutation).toHaveBeenCalledTimes(2) - - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + await flushPromiseQueue() + const selectShippingOptionOperation = await mockResolveLastOperation( + { + CommerceSelectShippingOptionPayload: () => + selectShippingQuoteSuccess.commerceSelectShippingOption, + } ) - mutationArg = mockCommitMutation.mock.calls[1][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SelectShippingOptionMutation" + expect(selectShippingOptionOperation.operationName).toEqual( + "useSelectShippingQuoteMutation" ) - expect(pushMock).toHaveBeenCalledWith("/orders/2939023/payment") + + expect(getAllPendingOperationNames(env)).toEqual([]) + expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") }) it("reloads shipping quotes after editing the selected address", async () => { - relayEnv = createMockEnvironment() - mockCommitMutation - .mockResolvedValueOnce(settingOrderArtaShipmentSuccess) - .mockResolvedValueOnce(settingOrderArtaShipmentSuccess) - - const updateAddressResponse = cloneDeep( - updateAddressSuccess - ) as any - // Match the edited address with the selected address to trigger refetching quotes - updateAddressResponse.updateUserAddress.userAddressOrErrors.internalID = - "2" - const updateAddressSpy = jest - .spyOn(updateUserAddress, "updateUserAddress") - // @ts-ignore - .mockImplementationOnce((_, __, ___, ____, onSuccess) => { - onSuccess(updateAddressResponse) - }) + // const updateAddressResponse = cloneDeep( + // updateAddressSuccess + // ) as any + // // Match the edited address with the selected address to trigger refetching quotes + // updateAddressResponse.updateUserAddress.userAddressOrErrors.internalID = + // "2" + // const updateAddressSpy = jest + // .spyOn(updateUserAddress, "updateUserAddress") + // // @ts-ignore + // .mockImplementationOnce((_, __, ___, ____, onSuccess) => { + // onSuccess(updateAddressResponse) + // }) + + const { mockResolveLastOperation } = renderWithRelay({ + CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, + Me: () => meWithAddresses, + }) - const { env } = renderWithRelay( - { - CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, - Me: () => meWithAddresses, - }, - undefined + await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderArtaShipmentSuccess.commerceSetShipping ) - await flushPromiseQueue() - // Set shipping/fetch quotes on load for the default address - expect(mockCommitMutation).toHaveBeenCalledTimes(1) - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" - ) + const selectedAddress = screen.getAllByTestId("savedAddress")[1] + expect(selectedAddress).toHaveTextContent("401 Broadway") - // Edit the selected address - const selectedAddress = screen.getByRole("radio", { - name: /401 Broadway/, - checked: true, - }) await userEvent.click(within(selectedAddress).getByText("Edit")) - const modalTitle = screen.getByText("Edit address") + const modalTitle = await screen.findByText("Edit address") expect(modalTitle).toBeVisible() // TODO: need a better way to get a specific input field from multiple forms - const addressLine2 = screen.getAllByPlaceholderText( - /Apt, floor, suite/ - )[0] - userEvent.clear(addressLine2) - userEvent.paste(addressLine2, "25th fl.") - userEvent.click(screen.getByText("Save")) + await waitFor(async () => { + const addressModal = screen.getByTestId("AddressModal") + const addressLine2 = within(addressModal).getByPlaceholderText( + /Apt, floor, suite/ + ) + await userEvent.clear(addressLine2) + await userEvent.paste(addressLine2, "25th fl.") + }) + + userEvent.click(screen.getByRole("button", { name: "Save" })) await flushPromiseQueue() - expect(updateAddressSpy).toHaveBeenCalledTimes(1) - expect(updateAddressSpy).toHaveBeenCalledWith( - expect.anything(), - "2", - { - addressLine1: "401 Broadway", + const updateAddressOperation = await mockResolveLastOperation({ + UpdateUserAddressPayload: () => ({ + ...saveAddressSuccess.createUserAddress, addressLine2: "25th fl.", - addressLine3: "", - city: "New York", - country: "US", - name: "Test Name", - phoneNumber: "422-424-4242", - postalCode: "10013", - region: "NY", - }, - expect.anything(), - expect.anything(), - expect.anything() - ) - - // TODO: This uses relay mock environment to mock the refetch query. Is there a better way? - const mutation = env.mock.getMostRecentOperation() - expect(mutation.request.node.operation.name).toEqual( - "SavedAddressesRefetchQuery" - ) - expect(mutation.request.variables).toEqual({}) - - const updatedMe = cloneDeep(meWithAddresses) as any - updatedMe.addressConnection.edges[1].node.addressLine2 = - "25th fl." - env.mock.resolveMostRecentOperation(operation => { - return MockPayloadGenerator.generate(operation, { - CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, - Me: () => updatedMe, - }) + }), + Me: () => ({ + ...meWithAddresses, + addressConnection: { + totalCount: 2, + edges: [ + meWithAddresses.addressConnection!.edges![0], + + { + node: { + ...meWithAddresses.addressConnection!.edges![1], + addressLine2: "25th fl.", + }, + }, + ], + }, + }), }) - // Wait for the second setShipping mutation to complete before clicking save and continue - await flushPromiseQueue() - await saveAndContinue() - - expect(mockCommitMutation).toHaveBeenCalledTimes(3) - - // Set shipping/fetch quotes again for the edited address - mutationArg = mockCommitMutation.mock.calls[1][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + expect(updateAddressOperation.operationName).toEqual( + "useUpdateSavedAddressMutation" ) - expect(mutationArg.variables).toEqual({ + expect(updateAddressOperation.operationVariables).toMatchObject({ input: { - fulfillmentType: "SHIP_ARTA", - id: "2939023", - phoneNumber: "422-424-4242", - shipping: expect.objectContaining({ - addressLine1: "1 Main St", - addressLine2: "", + attributes: { + addressLine1: "401 Broadway", + addressLine2: "25th fl.", city: "New York", - country: "USA", - name: "Bob Ross", - phoneNumber: "718-000-0000", - postalCode: "10012", + country: "US", + name: "Test Name", + phoneNumber: "422-424-4242", + postalCode: "10013", region: "NY", - }), - }, - }) - - mutationArg = mockCommitMutation.mock.calls[2][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SelectShippingOptionMutation" - ) - expect(mutationArg.variables).toEqual({ - input: { - id: "2939023", - selectedShippingQuoteId: - "4a8f8080-23d3-4c0e-9811-7a41a9df6933", + }, + userAddressID: "2", }, }) - }) - - it("does not reload shipping quotes after editing a non-selected address", async () => { - relayEnv = createMockEnvironment() - mockCommitMutation - .mockResolvedValueOnce(settingOrderArtaShipmentSuccess) - .mockResolvedValueOnce(settingOrderArtaShipmentSuccess) - - const updateAddressResponse = cloneDeep( - updateAddressSuccess - ) as any - // Match the edited address with the selected address to trigger refetching quotes - updateAddressResponse.updateUserAddress.userAddressOrErrors.internalID = - "1" - const updateAddressSpy = jest - .spyOn(updateUserAddress, "updateUserAddress") - // @ts-ignore - .mockImplementationOnce((_, __, ___, ____, onSuccess) => { - onSuccess(updateAddressResponse) - }) - const { env } = renderWithRelay( - { - CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, - Me: () => meWithAddresses, - }, - undefined - ) await flushPromiseQueue() - // Set shipping/fetch quotes on load for the default address - expect(mockCommitMutation).toHaveBeenCalledTimes(1) - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + const saveFulfillmentOperation = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + settingOrderShipmentSuccess.commerceSetShipping ) - // Edit the address that's not selected - const nonSelectedAddress = screen.getByRole("radio", { - name: /1 Main St/, - checked: false, - }) - await userEvent.click( - within(nonSelectedAddress).getByText("Edit") + expect(saveFulfillmentOperation.operationName).toEqual( + "useSaveFulfillmentDetailsMutation" ) - const modalTitle = screen.getByText("Edit address") - expect(modalTitle).toBeVisible() - - // TODO: need a better way to get a specific input field from multiple forms - const addressLine2 = screen.getAllByPlaceholderText( - /Apt, floor, suite/ - )[0] - userEvent.clear(addressLine2) - userEvent.paste(addressLine2, "25th fl.") - userEvent.click(screen.getByText("Save")) + await saveAndContinue() await flushPromiseQueue() - - expect(updateAddressSpy).toHaveBeenCalledTimes(1) - expect(updateAddressSpy).toHaveBeenCalledWith( - expect.anything(), - "1", + const selectShippingOptionOperation = await mockResolveLastOperation( { - addressLine1: "1 Main St", - addressLine2: "25th fl.", - addressLine3: "", - city: "Madrid", - country: "ES", - name: "Test Name", - phoneNumber: "555-555-5555", - postalCode: "28001", - region: "", - }, - expect.anything(), - expect.anything(), - expect.anything() + CommerceSelectShippingOptionPayload: () => + selectShippingQuoteSuccess.commerceSelectShippingOption, + } ) - // TODO: This uses relay mock environment to mock the refetch query. Is there a better way? - const mutation = env.mock.getMostRecentOperation() - expect(mutation.request.node.operation.name).toEqual( - "SavedAddressesRefetchQuery" - ) - expect(mutation.request.variables).toEqual({}) - - const updatedMe = cloneDeep(meWithAddresses) as any - updatedMe.addressConnection.edges[1].node.addressLine2 = - "25th fl." - env.mock.resolveMostRecentOperation(operation => { - return MockPayloadGenerator.generate(operation, { - CommerceOrder: () => UntouchedBuyOrderWithShippingQuotes, - Me: () => updatedMe, - }) - }) - - // Wait for the second setShipping mutation to complete before clicking save and continue - await flushPromiseQueue() - await saveAndContinue() - - expect(mockCommitMutation).toHaveBeenCalledTimes(2) - - mutationArg = mockCommitMutation.mock.calls[1][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SelectShippingOptionMutation" + expect(selectShippingOptionOperation.operationName).toEqual( + "useSelectShippingQuoteMutation" ) - expect(mutationArg.variables).toEqual({ + expect(selectShippingOptionOperation.operationVariables).toEqual({ input: { id: "2939023", selectedShippingQuoteId: @@ -2333,45 +2499,84 @@ describe.skip("Shipping", () => { Me: () => meWithAddresses, }) - userEvent.click(screen.getByRole("radio", { name: /Arrange for pickup/ })) - const phoneNumber = screen.getAllByPlaceholderText( - "Add phone number including country code" - )[1] + await userEvent.click( + screen.getByRole("radio", { name: /Arrange for pickup/ }) + ) + + const phoneNumber = await screen.findByTestId( + "AddressForm_pickupPhoneNumber" + ) // TODO: need a better way to check the input is displayed/expanded (height > 0) expect(phoneNumber).toHaveAttribute("tabindex", "0") expect(phoneNumber).toHaveValue("") }) - - it("sets pickup on order", async () => { - mockCommitMutation.mockResolvedValueOnce(settingOrderShipmentSuccess) + it("tracks click to switch to pickup", async () => { renderWithRelay({ + CommerceOrder: () => order, + Me: () => meWithAddresses, + }) + + await userEvent.click( + screen.getByRole("radio", { name: /Arrange for pickup/ }) + ) + + await screen.findByTestId("AddressForm_pickupPhoneNumber") + expect(mockTrackEvent).toHaveBeenLastCalledWith({ + action: "Click", + flow: "buy now", + subject: "arrange for pickup", + type: "button", + }) + }) + + it("sets pickup on order and advances to payment", async () => { + const { mockResolveLastOperation, env } = renderWithRelay({ CommerceOrder: () => order, Me: () => meWithoutAddress, }) - userEvent.click(screen.getByRole("radio", { name: /Arrange for pickup/ })) - userEvent.type( + await userEvent.click( + screen.getByRole("radio", { name: /Arrange for pickup/ }) + ) + + await flushPromiseQueue() + await userEvent.paste( screen.getAllByPlaceholderText( "Add phone number including country code" )[0], "2813308004" ) + + await flushPromiseQueue() await saveAndContinue() - expect(mockCommitMutation).toHaveBeenCalledTimes(1) + const fulfillmentRequest = await resolveSaveFulfillmentDetails( + mockResolveLastOperation, + { + orderOrError: { + __typename: "CommerceOrderWithMutationSuccess", + order: { + id: "2939023", + requestedFulfillment: { + __typename: "CommercePickup", + phoneNumber: "2813308004", + }, + }, + }, + } + ) - let mutationArg = mockCommitMutation.mock.calls[0][0] - expect(mutationArg.mutation.default.operation.name).toEqual( - "SetShippingMutation" + expect(fulfillmentRequest.operationName).toBe( + "useSaveFulfillmentDetailsMutation" ) - expect(mutationArg.variables).toEqual({ + expect(fulfillmentRequest.operationVariables).toMatchObject({ input: { - id: "1234", + id: "2939023", fulfillmentType: "PICKUP", shipping: { addressLine1: "", addressLine2: "", - country: "US", + country: "", name: "", city: "", postalCode: "", @@ -2381,20 +2586,26 @@ describe.skip("Shipping", () => { phoneNumber: "2813308004", }, }) + await waitFor(() => { + expect(getAllPendingOperationNames(env)).toEqual([]) + expect(mockPush).toHaveBeenCalledWith("/orders/2939023/payment") + }) }) it("disables submission without a phone number", async () => { - renderWithRelay({ + const { env } = renderWithRelay({ CommerceOrder: () => order, Me: () => meWithoutAddress, }) userEvent.click(screen.getByRole("radio", { name: /Arrange for pickup/ })) - expect( - screen.getByRole("button", { - name: "Save and Continue", - }) as HTMLInputElement - ).toBeDisabled() + + await flushPromiseQueue() + await saveAndContinue() + + expect(screen.getByText("Phone number is required")).toBeInTheDocument() + + expect(env.mock.getAllOperations()).toHaveLength(0) }) }) }) diff --git a/src/Apps/Order/Utils/shippingUtils.ts b/src/Apps/Order/Utils/shippingUtils.ts deleted file mode 100644 index cf4b502ce62..00000000000 --- a/src/Apps/Order/Utils/shippingUtils.ts +++ /dev/null @@ -1,203 +0,0 @@ -import * as Yup from "yup" -import { Address, emptyAddress } from "Components/Address/AddressForm" -import { Shipping_me$data } from "__generated__/Shipping_me.graphql" -import { Shipping_order$data } from "__generated__/Shipping_order.graphql" -import { pick, omit, compact } from "lodash" -import { - UpdateUserAddressMutation$data, - UserAddressAttributes, -} from "__generated__/UpdateUserAddressMutation.graphql" -import { NEW_ADDRESS } from "Apps/Order/Components/SavedAddresses" -import { - CommerceOrderFulfillmentTypeEnum, - SetShippingMutation$data, -} from "__generated__/SetShippingMutation.graphql" -import { postalCodeValidator } from "Components/Address/utils" - -export type SavedAddressType = NonNullable< - NonNullable< - NonNullable< - NonNullable["edges"] - >[number] - >["node"] -> - -export type ShippingQuotesType = NonNullable< - NonNullable< - NonNullable< - NonNullable< - NonNullable< - NonNullable< - NonNullable< - SetShippingMutation$data["commerceSetShipping"] - >["orderOrError"]["order"] - >["lineItems"] - >["edges"] - >[number] - >["node"] - >["shippingQuoteOptions"] ->["edges"] - -export const ADDRESS_VALIDATION_SHAPE = { - addressLine1: Yup.string().required("Street address is required"), - addressLine2: Yup.string().nullable(), - city: Yup.string().required("City is required"), - postalCode: postalCodeValidator, - region: Yup.string().when("country", { - is: country => ["US", "CA"].includes(country), - then: Yup.string().required("State is required"), - otherwise: Yup.string(), - }), - country: Yup.string().required("Country is required"), -} - -export const defaultShippingAddressIndex = ( - me: Shipping_me$data, - order: Shipping_order$data -): string => { - const addressList = me.addressConnection?.edges - - if (addressList && addressList.length > 0) { - let defaultAddressID: string - - if ( - order.requestedFulfillment && - (order.requestedFulfillment.__typename === "CommerceShip" || - order.requestedFulfillment.__typename === "CommerceShipArta") - ) { - const { - addressLine1, - addressLine2, - city, - country, - name, - phoneNumber, - postalCode, - region, - } = order.requestedFulfillment - defaultAddressID = addressList?.find( - address => - address?.node?.addressLine1 == addressLine1 && - address?.node?.addressLine2 == addressLine2 && - address?.node?.city == city && - address?.node?.country == country && - address?.node?.name == name && - address?.node?.postalCode == postalCode && - address?.node?.region == region && - address?.node?.phoneNumber == phoneNumber - )?.node?.internalID! - } else { - defaultAddressID = addressList.find(address => address?.node?.isDefault) - ?.node?.internalID! - } - - return defaultAddressID - ? defaultAddressID - : addressList[0]?.node?.internalID! - } else { - return NEW_ADDRESS - } -} - -export const startingPhoneNumber = ( - me: Shipping_me$data, - order: Shipping_order$data -) => { - return order.requestedFulfillment && - (order.requestedFulfillment.__typename === "CommerceShip" || - order.requestedFulfillment.__typename === "CommerceShipArta" || - order.requestedFulfillment.__typename === "CommercePickup") - ? order.requestedFulfillment.phoneNumber! - : "" -} - -export const startingAddress = ( - me: Shipping_me$data, - order: Shipping_order$data -) => { - const initialAddress = { - ...emptyAddress, - country: order.lineItems?.edges?.[0]?.node?.artwork?.shippingCountry!, - - // We need to pull out _only_ the values specified by the Address type, - // since our state will be used for Relay variables later on. The - // easiest way to do this is with the emptyAddress. - ...pick(order.requestedFulfillment, Object.keys(emptyAddress)), - } - return initialAddress -} - -export type MutationAddressResponse = NonNullable< - UpdateUserAddressMutation$data["updateUserAddress"] ->["userAddressOrErrors"] - -// Gravity address has isDefault and addressLine3 but exchange does not -export const convertShippingAddressForExchange = ( - address: SavedAddressType | MutationAddressResponse -): Address => { - return Object.assign( - {}, - emptyAddress, - omit(address, ["id", "isDefault", "internalID", "addressLine3", "errors"]) - ) -} - -export const convertShippingAddressToMutationInput = ( - address: SavedAddressType -): UserAddressAttributes => { - return omit( - { - ...address, - name: address?.name || "", - }, - ["isDefault", "internalID", "id", "__typename"] - ) -} - -export const getShippingOption = (requestedFulfillmentType?: string) => { - let result: CommerceOrderFulfillmentTypeEnum - - switch (requestedFulfillmentType) { - case "CommercePickup": - result = "PICKUP" - break - case "CommerceShip": - default: - result = "SHIP" - break - } - - return result -} - -export const getDefaultShippingQuoteId = (order: Shipping_order$data) => { - const shippingQuotes = - order.lineItems?.edges && - order.lineItems?.edges[0]?.node?.shippingQuoteOptions - - const cleanQuotes = compact(shippingQuotes?.edges?.map(quote => quote?.node)) - - return cleanQuotes[0] ? cleanQuotes[0].id : undefined -} - -export const getSelectedShippingQuoteId = (order: Shipping_order$data) => { - const shippingQuotes = - order.lineItems?.edges && - order.lineItems?.edges[0]?.node?.shippingQuoteOptions - return shippingQuotes - ? shippingQuotes.edges?.find(quote => quote?.node?.isSelected)?.node?.id - : undefined -} - -export const getShippingQuotes = ( - order: - | Shipping_order$data - | NonNullable< - SetShippingMutation$data["commerceSetShipping"] - >["orderOrError"]["order"] -) => { - const shippingQuotes = - order?.lineItems?.edges && - order?.lineItems?.edges[0]?.node?.shippingQuoteOptions - return shippingQuotes?.edges ? compact(shippingQuotes?.edges) : null -} diff --git a/src/Apps/Order/orderRoutes.tsx b/src/Apps/Order/orderRoutes.tsx index b4b984d631f..bb5e5795841 100644 --- a/src/Apps/Order/orderRoutes.tsx +++ b/src/Apps/Order/orderRoutes.tsx @@ -21,11 +21,8 @@ const OfferRoute = loadable( ) const ShippingRoute = loadable( - () => - import( - /* webpackChunkName: "orderBundle" */ "./Routes/Shipping2/ShippingRoute" - ), - { resolveComponent: component => component.ShippingRoute } + () => import(/* webpackChunkName: "orderBundle" */ "./Routes/Shipping"), + { resolveComponent: component => component.ShippingRouteWithDialog } ) const PaymentRoute = loadable( @@ -193,11 +190,9 @@ export const orderRoutes: RouteProps[] = [ query orderRoutes_ShippingQuery($orderID: ID!) { order: commerceOrder(id: $orderID) { ...Shipping_order - ...Shipping2_order } me { ...Shipping_me - ...Shipping2_me } } `, diff --git a/src/Components/Address/AddressModalFields.tsx b/src/Components/Address/AddressModalFields.tsx deleted file mode 100644 index 82d4d587953..00000000000 --- a/src/Components/Address/AddressModalFields.tsx +++ /dev/null @@ -1,99 +0,0 @@ -import * as React from "react" -import { Column, GridColumns, Input } from "@artsy/palette" -import { useFormikContext } from "formik" -import { SavedAddressType } from "Apps/Order/Utils/shippingUtils" -import { CountrySelect } from "Components/CountrySelect" - -export const AddressModalFields: React.FC = () => { - const { - values, - touched, - handleBlur, - handleChange, - errors, - setFieldValue, - } = useFormikContext() - - return ( - - - - - - { - setFieldValue("country", countryCode) - }} - error={touched.country && errors.country ? errors.country : ""} - /> - - - - - - - - - - - - - - - - - - ) -} diff --git a/src/__generated__/AddressModal2TestQuery.graphql.ts b/src/__generated__/AddressModalTestQuery.graphql.ts similarity index 77% rename from src/__generated__/AddressModal2TestQuery.graphql.ts rename to src/__generated__/AddressModalTestQuery.graphql.ts index 56cf89e0bbd..96531a9428e 100644 --- a/src/__generated__/AddressModal2TestQuery.graphql.ts +++ b/src/__generated__/AddressModalTestQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<34fdde24b564bea3a6e4f5fb41852a34>> + * @generated SignedSource<<0e4d061aa33e6fb5f5aaa3c4026391c4>> * @lightSyntaxTransform * @nogrep */ @@ -9,15 +9,15 @@ // @ts-nocheck import { ConcreteRequest, Query } from 'relay-runtime'; -export type AddressModal2TestQuery$variables = Record; -export type AddressModal2TestQuery$data = { +export type AddressModalTestQuery$variables = Record; +export type AddressModalTestQuery$data = { readonly _unused: { readonly name: string | null | undefined; } | null | undefined; }; -export type AddressModal2TestQuery = { - response: AddressModal2TestQuery$data; - variables: AddressModal2TestQuery$variables; +export type AddressModalTestQuery = { + response: AddressModalTestQuery$data; + variables: AddressModalTestQuery$variables; }; const node: ConcreteRequest = (function(){ @@ -40,7 +40,7 @@ return { "argumentDefinitions": [], "kind": "Fragment", "metadata": null, - "name": "AddressModal2TestQuery", + "name": "AddressModalTestQuery", "selections": [ { "alias": "_unused", @@ -62,7 +62,7 @@ return { "operation": { "argumentDefinitions": [], "kind": "Operation", - "name": "AddressModal2TestQuery", + "name": "AddressModalTestQuery", "selections": [ { "alias": "_unused", @@ -86,7 +86,7 @@ return { ] }, "params": { - "cacheID": "183979d8a78785afa924dd92b817d07c", + "cacheID": "eac7d336c233bb012cfa500991bb3ed7", "id": null, "metadata": { "relayTestingSelectionTypeInfo": { @@ -110,13 +110,13 @@ return { } } }, - "name": "AddressModal2TestQuery", + "name": "AddressModalTestQuery", "operationKind": "query", - "text": "query AddressModal2TestQuery {\n _unused: artist(id: \"whocare\") {\n name\n id\n }\n}\n" + "text": "query AddressModalTestQuery {\n _unused: artist(id: \"whocare\") {\n name\n id\n }\n}\n" } }; })(); -(node as any).hash = "b982ae8ea6d38ee099b7e60f49ce3b87"; +(node as any).hash = "f324dfe97aaee9357b4cb6c344df9ca7"; export default node; diff --git a/src/__generated__/CreateUserAddressMutation.graphql.ts b/src/__generated__/CreateUserAddressMutation.graphql.ts deleted file mode 100644 index bad71063c10..00000000000 --- a/src/__generated__/CreateUserAddressMutation.graphql.ts +++ /dev/null @@ -1,275 +0,0 @@ -/** - * @generated SignedSource<<1705c6157f9262cf448bd55ed4bc4088>> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { ConcreteRequest, Mutation } from 'relay-runtime'; -export type CreateUserAddressInput = { - attributes: UserAddressAttributes; - clientMutationId?: string | null | undefined; -}; -export type UserAddressAttributes = { - addressLine1: string; - addressLine2?: string | null | undefined; - addressLine3?: string | null | undefined; - city: string; - country: string; - name: string; - phoneNumber?: string | null | undefined; - phoneNumberCountryCode?: string | null | undefined; - postalCode?: string | null | undefined; - region?: string | null | undefined; -}; -export type CreateUserAddressMutation$variables = { - input: CreateUserAddressInput; -}; -export type CreateUserAddressMutation$data = { - readonly createUserAddress: { - readonly userAddressOrErrors: { - readonly addressLine1?: string; - readonly addressLine2?: string | null | undefined; - readonly addressLine3?: string | null | undefined; - readonly city?: string; - readonly country?: string; - readonly errors?: ReadonlyArray<{ - readonly message: string; - }>; - readonly id?: string; - readonly internalID?: string; - readonly isDefault?: boolean; - readonly name?: string | null | undefined; - readonly phoneNumber?: string | null | undefined; - readonly postalCode?: string | null | undefined; - readonly region?: string | null | undefined; - }; - } | null | undefined; -}; -export type CreateUserAddressMutation = { - response: CreateUserAddressMutation$data; - variables: CreateUserAddressMutation$variables; -}; - -const node: ConcreteRequest = (function(){ -var v0 = [ - { - "defaultValue": null, - "kind": "LocalArgument", - "name": "input" - } -], -v1 = [ - { - "kind": "Variable", - "name": "input", - "variableName": "input" - } -], -v2 = { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "internalID", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine1", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine2", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine3", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "city", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "country", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isDefault", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "phoneNumber", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "postalCode", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "region", - "storageKey": null - } - ], - "type": "UserAddress", - "abstractKey": null -}, -v3 = { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "Error", - "kind": "LinkedField", - "name": "errors", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "message", - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "Errors", - "abstractKey": null -}; -return { - "fragment": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Fragment", - "metadata": null, - "name": "CreateUserAddressMutation", - "selections": [ - { - "alias": null, - "args": (v1/*: any*/), - "concreteType": "CreateUserAddressPayload", - "kind": "LinkedField", - "name": "createUserAddress", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "userAddressOrErrors", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "Mutation", - "abstractKey": null - }, - "kind": "Request", - "operation": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Operation", - "name": "CreateUserAddressMutation", - "selections": [ - { - "alias": null, - "args": (v1/*: any*/), - "concreteType": "CreateUserAddressPayload", - "kind": "LinkedField", - "name": "createUserAddress", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "userAddressOrErrors", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null - }, - (v2/*: any*/), - (v3/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ] - }, - "params": { - "cacheID": "0d9b217798cc13e1c197e32452f62677", - "id": null, - "metadata": {}, - "name": "CreateUserAddressMutation", - "operationKind": "mutation", - "text": "mutation CreateUserAddressMutation(\n $input: CreateUserAddressInput!\n) {\n createUserAddress(input: $input) {\n userAddressOrErrors {\n __typename\n ... on UserAddress {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n ... on Errors {\n errors {\n message\n }\n }\n }\n }\n}\n" - } -}; -})(); - -(node as any).hash = "28b6758809d33bd8ca1ebefa73b51d49"; - -export default node; diff --git a/src/__generated__/DeleteUserAddressMutation.graphql.ts b/src/__generated__/DeleteUserAddressMutation.graphql.ts deleted file mode 100644 index 6e5dd0479ff..00000000000 --- a/src/__generated__/DeleteUserAddressMutation.graphql.ts +++ /dev/null @@ -1,263 +0,0 @@ -/** - * @generated SignedSource<> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { ConcreteRequest, Mutation } from 'relay-runtime'; -export type DeleteUserAddressInput = { - clientMutationId?: string | null | undefined; - userAddressID: string; -}; -export type DeleteUserAddressMutation$variables = { - input: DeleteUserAddressInput; -}; -export type DeleteUserAddressMutation$data = { - readonly deleteUserAddress: { - readonly userAddressOrErrors: { - readonly addressLine1?: string; - readonly addressLine2?: string | null | undefined; - readonly city?: string; - readonly country?: string; - readonly errors?: ReadonlyArray<{ - readonly code: string; - readonly message: string; - }>; - readonly id?: string; - readonly internalID?: string; - readonly isDefault?: boolean; - readonly name?: string | null | undefined; - readonly phoneNumber?: string | null | undefined; - readonly postalCode?: string | null | undefined; - readonly region?: string | null | undefined; - }; - } | null | undefined; -}; -export type DeleteUserAddressMutation = { - response: DeleteUserAddressMutation$data; - variables: DeleteUserAddressMutation$variables; -}; - -const node: ConcreteRequest = (function(){ -var v0 = [ - { - "defaultValue": null, - "kind": "LocalArgument", - "name": "input" - } -], -v1 = [ - { - "kind": "Variable", - "name": "input", - "variableName": "input" - } -], -v2 = { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "internalID", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine1", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine2", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isDefault", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "phoneNumber", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "city", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "region", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "postalCode", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "country", - "storageKey": null - } - ], - "type": "UserAddress", - "abstractKey": null -}, -v3 = { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "Error", - "kind": "LinkedField", - "name": "errors", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "code", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "message", - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "Errors", - "abstractKey": null -}; -return { - "fragment": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Fragment", - "metadata": null, - "name": "DeleteUserAddressMutation", - "selections": [ - { - "alias": null, - "args": (v1/*: any*/), - "concreteType": "DeleteUserAddressPayload", - "kind": "LinkedField", - "name": "deleteUserAddress", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "userAddressOrErrors", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "Mutation", - "abstractKey": null - }, - "kind": "Request", - "operation": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Operation", - "name": "DeleteUserAddressMutation", - "selections": [ - { - "alias": null, - "args": (v1/*: any*/), - "concreteType": "DeleteUserAddressPayload", - "kind": "LinkedField", - "name": "deleteUserAddress", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "userAddressOrErrors", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null - }, - (v2/*: any*/), - (v3/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ] - }, - "params": { - "cacheID": "fb2fb91ba360096694ec247ccfd214d1", - "id": null, - "metadata": {}, - "name": "DeleteUserAddressMutation", - "operationKind": "mutation", - "text": "mutation DeleteUserAddressMutation(\n $input: DeleteUserAddressInput!\n) {\n deleteUserAddress(input: $input) {\n userAddressOrErrors {\n __typename\n ... on UserAddress {\n id\n internalID\n name\n addressLine1\n addressLine2\n isDefault\n phoneNumber\n city\n region\n postalCode\n country\n }\n ... on Errors {\n errors {\n code\n message\n }\n }\n }\n }\n}\n" - } -}; -})(); - -(node as any).hash = "45a8df457122ee6ddb24c927e5997d24"; - -export default node; diff --git a/src/__generated__/SavedAddressesMutation_Test_Query.graphql.ts b/src/__generated__/SavedAddressesMutation_Test_Query.graphql.ts deleted file mode 100644 index ed6767b81d6..00000000000 --- a/src/__generated__/SavedAddressesMutation_Test_Query.graphql.ts +++ /dev/null @@ -1,361 +0,0 @@ -/** - * @generated SignedSource<<6182200ea32ad268e21b45d08611a7ea>> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { ConcreteRequest, Query } from 'relay-runtime'; -import { FragmentRefs } from "relay-runtime"; -export type SavedAddressesMutation_Test_Query$variables = Record; -export type SavedAddressesMutation_Test_Query$data = { - readonly me: { - readonly " $fragmentSpreads": FragmentRefs<"SavedAddresses_me">; - } | null | undefined; -}; -export type SavedAddressesMutation_Test_Query = { - response: SavedAddressesMutation_Test_Query$data; - variables: SavedAddressesMutation_Test_Query$variables; -}; - -const node: ConcreteRequest = (function(){ -var v0 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null -}, -v1 = [ - { - "kind": "Literal", - "name": "first", - "value": 30 - } -], -v2 = { - "enumValues": null, - "nullable": false, - "plural": false, - "type": "String" -}, -v3 = { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "String" -}, -v4 = { - "enumValues": null, - "nullable": false, - "plural": false, - "type": "ID" -}, -v5 = { - "enumValues": null, - "nullable": false, - "plural": false, - "type": "Boolean" -}; -return { - "fragment": { - "argumentDefinitions": [], - "kind": "Fragment", - "metadata": null, - "name": "SavedAddressesMutation_Test_Query", - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "Me", - "kind": "LinkedField", - "name": "me", - "plural": false, - "selections": [ - { - "args": null, - "kind": "FragmentSpread", - "name": "SavedAddresses_me" - } - ], - "storageKey": null - } - ], - "type": "Query", - "abstractKey": null - }, - "kind": "Request", - "operation": { - "argumentDefinitions": [], - "kind": "Operation", - "name": "SavedAddressesMutation_Test_Query", - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "Me", - "kind": "LinkedField", - "name": "me", - "plural": false, - "selections": [ - (v0/*: any*/), - { - "alias": null, - "args": (v1/*: any*/), - "concreteType": "UserAddressConnection", - "kind": "LinkedField", - "name": "addressConnection", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "totalCount", - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "UserAddressEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "UserAddress", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v0/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "internalID", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine1", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine2", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine3", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "city", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "country", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isDefault", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "phoneNumber", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "postalCode", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "region", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "cursor", - "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "PageInfo", - "kind": "LinkedField", - "name": "pageInfo", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "endCursor", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasNextPage", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasPreviousPage", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "startCursor", - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": "addressConnection(first:30)" - }, - { - "alias": null, - "args": (v1/*: any*/), - "filters": null, - "handle": "connection", - "key": "SavedAddresses_addressConnection", - "kind": "LinkedHandle", - "name": "addressConnection" - } - ], - "storageKey": null - } - ] - }, - "params": { - "cacheID": "e57f8261a6a58598bb2402b1a885f396", - "id": null, - "metadata": { - "relayTestingSelectionTypeInfo": { - "me": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "Me" - }, - "me.addressConnection": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "UserAddressConnection" - }, - "me.addressConnection.edges": { - "enumValues": null, - "nullable": true, - "plural": true, - "type": "UserAddressEdge" - }, - "me.addressConnection.edges.cursor": (v2/*: any*/), - "me.addressConnection.edges.node": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "UserAddress" - }, - "me.addressConnection.edges.node.__typename": (v2/*: any*/), - "me.addressConnection.edges.node.addressLine1": (v2/*: any*/), - "me.addressConnection.edges.node.addressLine2": (v3/*: any*/), - "me.addressConnection.edges.node.addressLine3": (v3/*: any*/), - "me.addressConnection.edges.node.city": (v2/*: any*/), - "me.addressConnection.edges.node.country": (v2/*: any*/), - "me.addressConnection.edges.node.id": (v4/*: any*/), - "me.addressConnection.edges.node.internalID": (v4/*: any*/), - "me.addressConnection.edges.node.isDefault": (v5/*: any*/), - "me.addressConnection.edges.node.name": (v3/*: any*/), - "me.addressConnection.edges.node.phoneNumber": (v3/*: any*/), - "me.addressConnection.edges.node.postalCode": (v3/*: any*/), - "me.addressConnection.edges.node.region": (v3/*: any*/), - "me.addressConnection.pageInfo": { - "enumValues": null, - "nullable": false, - "plural": false, - "type": "PageInfo" - }, - "me.addressConnection.pageInfo.endCursor": (v3/*: any*/), - "me.addressConnection.pageInfo.hasNextPage": (v5/*: any*/), - "me.addressConnection.pageInfo.hasPreviousPage": (v5/*: any*/), - "me.addressConnection.pageInfo.startCursor": (v3/*: any*/), - "me.addressConnection.totalCount": { - "enumValues": null, - "nullable": false, - "plural": false, - "type": "Int" - }, - "me.id": (v4/*: any*/) - } - }, - "name": "SavedAddressesMutation_Test_Query", - "operationKind": "query", - "text": "query SavedAddressesMutation_Test_Query {\n me {\n ...SavedAddresses_me\n id\n }\n}\n\nfragment SavedAddresses_me on Me {\n id\n addressConnection(first: 30) {\n totalCount\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n}\n" - } -}; -})(); - -(node as any).hash = "c6f79486cca76dfa5ede1061cda32ff9"; - -export default node; diff --git a/src/__generated__/SavedAddressesRefetchQuery.graphql.ts b/src/__generated__/SavedAddressesRefetchQuery.graphql.ts deleted file mode 100644 index 068bda388af..00000000000 --- a/src/__generated__/SavedAddressesRefetchQuery.graphql.ts +++ /dev/null @@ -1,279 +0,0 @@ -/** - * @generated SignedSource<<0b9750531db893e58fdf077e11301a4b>> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { ConcreteRequest, Query } from 'relay-runtime'; -import { FragmentRefs } from "relay-runtime"; -export type SavedAddressesRefetchQuery$variables = Record; -export type SavedAddressesRefetchQuery$data = { - readonly me: { - readonly " $fragmentSpreads": FragmentRefs<"SavedAddresses_me">; - } | null | undefined; -}; -export type SavedAddressesRefetchQuery = { - response: SavedAddressesRefetchQuery$data; - variables: SavedAddressesRefetchQuery$variables; -}; - -const node: ConcreteRequest = (function(){ -var v0 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null -}, -v1 = [ - { - "kind": "Literal", - "name": "first", - "value": 30 - } -]; -return { - "fragment": { - "argumentDefinitions": [], - "kind": "Fragment", - "metadata": null, - "name": "SavedAddressesRefetchQuery", - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "Me", - "kind": "LinkedField", - "name": "me", - "plural": false, - "selections": [ - { - "args": null, - "kind": "FragmentSpread", - "name": "SavedAddresses_me" - } - ], - "storageKey": null - } - ], - "type": "Query", - "abstractKey": null - }, - "kind": "Request", - "operation": { - "argumentDefinitions": [], - "kind": "Operation", - "name": "SavedAddressesRefetchQuery", - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "Me", - "kind": "LinkedField", - "name": "me", - "plural": false, - "selections": [ - (v0/*: any*/), - { - "alias": null, - "args": (v1/*: any*/), - "concreteType": "UserAddressConnection", - "kind": "LinkedField", - "name": "addressConnection", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "totalCount", - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "UserAddressEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "UserAddress", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v0/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "internalID", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine1", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine2", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine3", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "city", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "country", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isDefault", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "phoneNumber", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "postalCode", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "region", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "cursor", - "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "PageInfo", - "kind": "LinkedField", - "name": "pageInfo", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "endCursor", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasNextPage", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasPreviousPage", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "startCursor", - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": "addressConnection(first:30)" - }, - { - "alias": null, - "args": (v1/*: any*/), - "filters": null, - "handle": "connection", - "key": "SavedAddresses_addressConnection", - "kind": "LinkedHandle", - "name": "addressConnection" - } - ], - "storageKey": null - } - ] - }, - "params": { - "cacheID": "3ced6617eadc1a3be5c059d8ca46475d", - "id": null, - "metadata": {}, - "name": "SavedAddressesRefetchQuery", - "operationKind": "query", - "text": "query SavedAddressesRefetchQuery {\n me {\n ...SavedAddresses_me\n id\n }\n}\n\nfragment SavedAddresses_me on Me {\n id\n addressConnection(first: 30) {\n totalCount\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n}\n" - } -}; -})(); - -(node as any).hash = "e164d0b484f2f5634549c612711904c8"; - -export default node; diff --git a/src/__generated__/SavedAddresses2TestQuery.graphql.ts b/src/__generated__/SavedAddressesTestQuery.graphql.ts similarity index 70% rename from src/__generated__/SavedAddresses2TestQuery.graphql.ts rename to src/__generated__/SavedAddressesTestQuery.graphql.ts index 43768a930b5..9948f0af7f8 100644 --- a/src/__generated__/SavedAddresses2TestQuery.graphql.ts +++ b/src/__generated__/SavedAddressesTestQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<3cf17b2b6f6661e2c54c350ffec876f6>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -9,15 +9,15 @@ // @ts-nocheck import { ConcreteRequest, Query } from 'relay-runtime'; -export type SavedAddresses2TestQuery$variables = Record; -export type SavedAddresses2TestQuery$data = { +export type SavedAddressesTestQuery$variables = Record; +export type SavedAddressesTestQuery$data = { readonly me: { readonly email: string | null | undefined; } | null | undefined; }; -export type SavedAddresses2TestQuery = { - response: SavedAddresses2TestQuery$data; - variables: SavedAddresses2TestQuery$variables; +export type SavedAddressesTestQuery = { + response: SavedAddressesTestQuery$data; + variables: SavedAddressesTestQuery$variables; }; const node: ConcreteRequest = (function(){ @@ -33,7 +33,7 @@ return { "argumentDefinitions": [], "kind": "Fragment", "metadata": null, - "name": "SavedAddresses2TestQuery", + "name": "SavedAddressesTestQuery", "selections": [ { "alias": null, @@ -55,7 +55,7 @@ return { "operation": { "argumentDefinitions": [], "kind": "Operation", - "name": "SavedAddresses2TestQuery", + "name": "SavedAddressesTestQuery", "selections": [ { "alias": null, @@ -79,16 +79,16 @@ return { ] }, "params": { - "cacheID": "1e1737887acbe95487e9e6ed4ad5a72c", + "cacheID": "d40af8102a19f44dea2bd6699a1a52ed", "id": null, "metadata": {}, - "name": "SavedAddresses2TestQuery", + "name": "SavedAddressesTestQuery", "operationKind": "query", - "text": "query SavedAddresses2TestQuery {\n me {\n email\n id\n }\n}\n" + "text": "query SavedAddressesTestQuery {\n me {\n email\n id\n }\n}\n" } }; })(); -(node as any).hash = "e2d5609866e74bb1c1c13043e7933472"; +(node as any).hash = "1a6c0ba8fe55459138403740bd174de0"; export default node; diff --git a/src/__generated__/SavedAddresses_me.graphql.ts b/src/__generated__/SavedAddresses_me.graphql.ts deleted file mode 100644 index 09315578a3d..00000000000 --- a/src/__generated__/SavedAddresses_me.graphql.ts +++ /dev/null @@ -1,267 +0,0 @@ -/** - * @generated SignedSource<<295f8cf4dceaed91768e8da9d5d6aeb4>> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { Fragment, ReaderFragment } from 'relay-runtime'; -import { FragmentRefs } from "relay-runtime"; -export type SavedAddresses_me$data = { - readonly addressConnection: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly addressLine1: string; - readonly addressLine2: string | null | undefined; - readonly addressLine3: string | null | undefined; - readonly city: string; - readonly country: string; - readonly id: string; - readonly internalID: string; - readonly isDefault: boolean; - readonly name: string | null | undefined; - readonly phoneNumber: string | null | undefined; - readonly postalCode: string | null | undefined; - readonly region: string | null | undefined; - } | null | undefined; - } | null | undefined> | null | undefined; - readonly totalCount: number; - } | null | undefined; - readonly id: string; - readonly " $fragmentType": "SavedAddresses_me"; -}; -export type SavedAddresses_me$key = { - readonly " $data"?: SavedAddresses_me$data; - readonly " $fragmentSpreads": FragmentRefs<"SavedAddresses_me">; -}; - -const node: ReaderFragment = (function(){ -var v0 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null -}; -return { - "argumentDefinitions": [ - { - "defaultValue": null, - "kind": "LocalArgument", - "name": "after" - }, - { - "defaultValue": null, - "kind": "LocalArgument", - "name": "before" - }, - { - "defaultValue": 30, - "kind": "LocalArgument", - "name": "first" - }, - { - "defaultValue": null, - "kind": "LocalArgument", - "name": "last" - } - ], - "kind": "Fragment", - "metadata": { - "connection": [ - { - "count": null, - "cursor": null, - "direction": "bidirectional", - "path": [ - "addressConnection" - ] - } - ] - }, - "name": "SavedAddresses_me", - "selections": [ - (v0/*: any*/), - { - "alias": "addressConnection", - "args": null, - "concreteType": "UserAddressConnection", - "kind": "LinkedField", - "name": "__SavedAddresses_addressConnection_connection", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "totalCount", - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "UserAddressEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "UserAddress", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v0/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "internalID", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine1", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine2", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine3", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "city", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "country", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isDefault", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "phoneNumber", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "postalCode", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "region", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "cursor", - "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "PageInfo", - "kind": "LinkedField", - "name": "pageInfo", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "endCursor", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasNextPage", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasPreviousPage", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "startCursor", - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "Me", - "abstractKey": null -}; -})(); - -(node as any).hash = "81a45053db6c6122c064c0735e6b84f0"; - -export default node; diff --git a/src/__generated__/SelectShippingOptionMutation.graphql.ts b/src/__generated__/SelectShippingOptionMutation.graphql.ts deleted file mode 100644 index 2cb9f95d26e..00000000000 --- a/src/__generated__/SelectShippingOptionMutation.graphql.ts +++ /dev/null @@ -1,399 +0,0 @@ -/** - * @generated SignedSource<<68fdb8d3ca3bf9e1d81663353178b10b>> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { ConcreteRequest, Mutation } from 'relay-runtime'; -import { FragmentRefs } from "relay-runtime"; -export type CommerceSelectShippingOptionInput = { - clientMutationId?: string | null | undefined; - id: string; - selectedShippingQuoteId: string; -}; -export type SelectShippingOptionMutation$variables = { - input: CommerceSelectShippingOptionInput; -}; -export type SelectShippingOptionMutation$data = { - readonly commerceSelectShippingOption: { - readonly orderOrError: { - readonly __typename: "CommerceOrderWithMutationSuccess"; - readonly error?: { - readonly code: string; - readonly data: string | null | undefined; - readonly type: string; - }; - readonly order?: { - readonly lineItems: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly shippingQuoteOptions: { - readonly edges: ReadonlyArray<{ - readonly " $fragmentSpreads": FragmentRefs<"ShippingQuotes_shippingQuotes">; - } | null | undefined> | null | undefined; - } | null | undefined; - } | null | undefined; - } | null | undefined> | null | undefined; - } | null | undefined; - }; - }; - } | null | undefined; -}; -export type SelectShippingOptionMutation = { - response: SelectShippingOptionMutation$data; - variables: SelectShippingOptionMutation$variables; -}; - -const node: ConcreteRequest = (function(){ -var v0 = [ - { - "defaultValue": null, - "kind": "LocalArgument", - "name": "input" - } -], -v1 = [ - { - "kind": "Variable", - "name": "input", - "variableName": "input" - } -], -v2 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null -}, -v3 = { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceApplicationError", - "kind": "LinkedField", - "name": "error", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "type", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "code", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "data", - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "CommerceOrderWithMutationFailure", - "abstractKey": null -}, -v4 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null -}; -return { - "fragment": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Fragment", - "metadata": null, - "name": "SelectShippingOptionMutation", - "selections": [ - { - "alias": null, - "args": (v1/*: any*/), - "concreteType": "CommerceSelectShippingOptionPayload", - "kind": "LinkedField", - "name": "commerceSelectShippingOption", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "orderOrError", - "plural": false, - "selections": [ - { - "kind": "InlineFragment", - "selections": [ - (v2/*: any*/), - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "order", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemConnection", - "kind": "LinkedField", - "name": "lineItems", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItem", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteConnection", - "kind": "LinkedField", - "name": "shippingQuoteOptions", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "args": null, - "kind": "FragmentSpread", - "name": "ShippingQuotes_shippingQuotes" - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "CommerceOrderWithMutationSuccess", - "abstractKey": null - }, - (v3/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "Mutation", - "abstractKey": null - }, - "kind": "Request", - "operation": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Operation", - "name": "SelectShippingOptionMutation", - "selections": [ - { - "alias": null, - "args": (v1/*: any*/), - "concreteType": "CommerceSelectShippingOptionPayload", - "kind": "LinkedField", - "name": "commerceSelectShippingOption", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "orderOrError", - "plural": false, - "selections": [ - (v2/*: any*/), - { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "order", - "plural": false, - "selections": [ - (v2/*: any*/), - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemConnection", - "kind": "LinkedField", - "name": "lineItems", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItem", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteConnection", - "kind": "LinkedField", - "name": "shippingQuoteOptions", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuote", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v4/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isSelected", - "storageKey": null - }, - { - "alias": null, - "args": [ - { - "kind": "Literal", - "name": "precision", - "value": 2 - } - ], - "kind": "ScalarField", - "name": "price", - "storageKey": "price(precision:2)" - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "priceCents", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "typeName", - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - }, - (v4/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - }, - (v4/*: any*/) - ], - "storageKey": null - } - ], - "type": "CommerceOrderWithMutationSuccess", - "abstractKey": null - }, - (v3/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ] - }, - "params": { - "cacheID": "97d818315ee194efff0c3a65371eaa94", - "id": null, - "metadata": {}, - "name": "SelectShippingOptionMutation", - "operationKind": "mutation", - "text": "mutation SelectShippingOptionMutation(\n $input: CommerceSelectShippingOptionInput!\n) {\n commerceSelectShippingOption(input: $input) {\n orderOrError {\n __typename\n ... on CommerceOrderWithMutationSuccess {\n __typename\n order {\n __typename\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n ...ShippingQuotes_shippingQuotes\n }\n }\n id\n }\n }\n }\n id\n }\n }\n ... on CommerceOrderWithMutationFailure {\n error {\n type\n code\n data\n }\n }\n }\n }\n}\n\nfragment ShippingQuotes_shippingQuotes on CommerceShippingQuoteEdge {\n node {\n id\n isSelected\n price(precision: 2)\n priceCents\n typeName\n }\n}\n" - } -}; -})(); - -(node as any).hash = "b71546b77d6db4f5be7777383c540e4b"; - -export default node; diff --git a/src/__generated__/SetShippingMutation.graphql.ts b/src/__generated__/SetShippingMutation.graphql.ts deleted file mode 100644 index 97ac08c5cba..00000000000 --- a/src/__generated__/SetShippingMutation.graphql.ts +++ /dev/null @@ -1,545 +0,0 @@ -/** - * @generated SignedSource<<5e19618c201ee84bd5929101aa8c39dc>> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { ConcreteRequest, Mutation } from 'relay-runtime'; -import { FragmentRefs } from "relay-runtime"; -export type CommerceOrderFulfillmentTypeEnum = "PICKUP" | "SHIP" | "SHIP_ARTA" | "%future added value"; -export type CommerceOrderStateEnum = "ABANDONED" | "APPROVED" | "CANCELED" | "FULFILLED" | "IN_REVIEW" | "PENDING" | "PROCESSING_APPROVAL" | "REFUNDED" | "SUBMITTED" | "%future added value"; -export type CommerceShippingAddressVerifiedByEnum = "ARTSY" | "USER" | "%future added value"; -export type CommerceSetShippingInput = { - addressVerifiedBy?: CommerceShippingAddressVerifiedByEnum | null | undefined; - clientMutationId?: string | null | undefined; - fulfillmentType: CommerceOrderFulfillmentTypeEnum; - id: string; - phoneNumber?: string | null | undefined; - phoneNumberCountryCode?: string | null | undefined; - shipping?: CommerceShippingAttributes | null | undefined; -}; -export type CommerceShippingAttributes = { - addressLine1?: string | null | undefined; - addressLine2?: string | null | undefined; - city?: string | null | undefined; - country?: string | null | undefined; - name?: string | null | undefined; - phoneNumber?: string | null | undefined; - postalCode?: string | null | undefined; - region?: string | null | undefined; -}; -export type SetShippingMutation$variables = { - input: CommerceSetShippingInput; -}; -export type SetShippingMutation$data = { - readonly commerceSetShipping: { - readonly orderOrError: { - readonly __typename: "CommerceOrderWithMutationSuccess"; - readonly error?: { - readonly code: string; - readonly data: string | null | undefined; - readonly type: string; - }; - readonly order?: { - readonly internalID: string; - readonly lineItems: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly shippingQuoteOptions: { - readonly edges: ReadonlyArray<{ - readonly " $fragmentSpreads": FragmentRefs<"ShippingQuotes_shippingQuotes">; - } | null | undefined> | null | undefined; - } | null | undefined; - } | null | undefined; - } | null | undefined> | null | undefined; - } | null | undefined; - readonly requestedFulfillment: { - readonly __typename: "CommerceShip"; - readonly addressLine1: string | null | undefined; - readonly addressLine2: string | null | undefined; - readonly city: string | null | undefined; - readonly country: string | null | undefined; - readonly name: string | null | undefined; - readonly phoneNumber: string | null | undefined; - readonly postalCode: string | null | undefined; - readonly region: string | null | undefined; - } | { - readonly __typename: "CommerceShipArta"; - readonly addressLine1: string | null | undefined; - readonly addressLine2: string | null | undefined; - readonly city: string | null | undefined; - readonly country: string | null | undefined; - readonly name: string | null | undefined; - readonly phoneNumber: string | null | undefined; - readonly postalCode: string | null | undefined; - readonly region: string | null | undefined; - } | { - // This will never be '%other', but we need some - // value in case none of the concrete values match. - readonly __typename: "%other"; - } | null | undefined; - readonly state: CommerceOrderStateEnum; - }; - }; - } | null | undefined; -}; -export type SetShippingMutation = { - response: SetShippingMutation$data; - variables: SetShippingMutation$variables; -}; - -const node: ConcreteRequest = (function(){ -var v0 = [ - { - "defaultValue": null, - "kind": "LocalArgument", - "name": "input" - } -], -v1 = [ - { - "kind": "Variable", - "name": "input", - "variableName": "input" - } -], -v2 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null -}, -v3 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "internalID", - "storageKey": null -}, -v4 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "state", - "storageKey": null -}, -v5 = [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine1", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine2", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "city", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "region", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "country", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "postalCode", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "phoneNumber", - "storageKey": null - } -], -v6 = { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "requestedFulfillment", - "plural": false, - "selections": [ - (v2/*: any*/), - { - "kind": "InlineFragment", - "selections": (v5/*: any*/), - "type": "CommerceShip", - "abstractKey": null - }, - { - "kind": "InlineFragment", - "selections": (v5/*: any*/), - "type": "CommerceShipArta", - "abstractKey": null - } - ], - "storageKey": null -}, -v7 = { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceApplicationError", - "kind": "LinkedField", - "name": "error", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "type", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "code", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "data", - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "CommerceOrderWithMutationFailure", - "abstractKey": null -}, -v8 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null -}; -return { - "fragment": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Fragment", - "metadata": null, - "name": "SetShippingMutation", - "selections": [ - { - "alias": null, - "args": (v1/*: any*/), - "concreteType": "CommerceSetShippingPayload", - "kind": "LinkedField", - "name": "commerceSetShipping", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "orderOrError", - "plural": false, - "selections": [ - { - "kind": "InlineFragment", - "selections": [ - (v2/*: any*/), - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "order", - "plural": false, - "selections": [ - (v3/*: any*/), - (v4/*: any*/), - (v6/*: any*/), - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemConnection", - "kind": "LinkedField", - "name": "lineItems", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItem", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteConnection", - "kind": "LinkedField", - "name": "shippingQuoteOptions", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "args": null, - "kind": "FragmentSpread", - "name": "ShippingQuotes_shippingQuotes" - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "CommerceOrderWithMutationSuccess", - "abstractKey": null - }, - (v7/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "Mutation", - "abstractKey": null - }, - "kind": "Request", - "operation": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Operation", - "name": "SetShippingMutation", - "selections": [ - { - "alias": null, - "args": (v1/*: any*/), - "concreteType": "CommerceSetShippingPayload", - "kind": "LinkedField", - "name": "commerceSetShipping", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "orderOrError", - "plural": false, - "selections": [ - (v2/*: any*/), - { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "order", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/), - (v4/*: any*/), - (v6/*: any*/), - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemConnection", - "kind": "LinkedField", - "name": "lineItems", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItem", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteConnection", - "kind": "LinkedField", - "name": "shippingQuoteOptions", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuote", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v8/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isSelected", - "storageKey": null - }, - { - "alias": null, - "args": [ - { - "kind": "Literal", - "name": "precision", - "value": 2 - } - ], - "kind": "ScalarField", - "name": "price", - "storageKey": "price(precision:2)" - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "priceCents", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "typeName", - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - }, - (v8/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - }, - (v8/*: any*/) - ], - "storageKey": null - } - ], - "type": "CommerceOrderWithMutationSuccess", - "abstractKey": null - }, - (v7/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ] - }, - "params": { - "cacheID": "62a32d99e6cab8f40c665305a1f4d041", - "id": null, - "metadata": {}, - "name": "SetShippingMutation", - "operationKind": "mutation", - "text": "mutation SetShippingMutation(\n $input: CommerceSetShippingInput!\n) {\n commerceSetShipping(input: $input) {\n orderOrError {\n __typename\n ... on CommerceOrderWithMutationSuccess {\n __typename\n order {\n __typename\n internalID\n state\n requestedFulfillment {\n __typename\n ... on CommerceShip {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n ... on CommerceShipArta {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n }\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n ...ShippingQuotes_shippingQuotes\n }\n }\n id\n }\n }\n }\n id\n }\n }\n ... on CommerceOrderWithMutationFailure {\n error {\n type\n code\n data\n }\n }\n }\n }\n}\n\nfragment ShippingQuotes_shippingQuotes on CommerceShippingQuoteEdge {\n node {\n id\n isSelected\n price(precision: 2)\n priceCents\n typeName\n }\n}\n" - } -}; -})(); - -(node as any).hash = "7278954f3f024afafd026b74cb1fa65e"; - -export default node; diff --git a/src/__generated__/Shipping2TestQuery.graphql.ts b/src/__generated__/Shipping2TestQuery.graphql.ts deleted file mode 100644 index 72d2e246971..00000000000 --- a/src/__generated__/Shipping2TestQuery.graphql.ts +++ /dev/null @@ -1,1488 +0,0 @@ -/** - * @generated SignedSource<> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { ConcreteRequest, Query } from 'relay-runtime'; -import { FragmentRefs } from "relay-runtime"; -export type CommerceOrderDisplayStateEnum = "ABANDONED" | "APPROVED" | "CANCELED" | "FULFILLED" | "IN_TRANSIT" | "PAYMENT_FAILED" | "PENDING" | "PROCESSING" | "PROCESSING_APPROVAL" | "REFUNDED" | "SUBMITTED" | "%future added value"; -export type CommerceOrderModeEnum = "BUY" | "OFFER" | "%future added value"; -export type CommerceOrderParticipantEnum = "BUYER" | "SELLER" | "%future added value"; -export type CommerceOrderSourceEnum = "artwork_page" | "inquiry" | "partner_offer" | "private_sale" | "%future added value"; -export type Shipping2TestQuery$variables = Record; -export type Shipping2TestQuery$data = { - readonly me: { - readonly " $fragmentSpreads": FragmentRefs<"Shipping2_me">; - } | null | undefined; - readonly order: { - readonly " $fragmentSpreads": FragmentRefs<"Shipping2_order">; - } | null | undefined; -}; -export type Shipping2TestQuery$rawResponse = { - readonly me: { - readonly addressConnection: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly addressLine1: string; - readonly addressLine2: string | null | undefined; - readonly addressLine3: string | null | undefined; - readonly city: string; - readonly country: string; - readonly id: string; - readonly internalID: string; - readonly isDefault: boolean; - readonly name: string | null | undefined; - readonly phoneNumber: string | null | undefined; - readonly postalCode: string | null | undefined; - readonly region: string | null | undefined; - } | null | undefined; - } | null | undefined> | null | undefined; - readonly totalCount: number; - } | null | undefined; - readonly email: string | null | undefined; - readonly id: string; - readonly location: { - readonly country: string | null | undefined; - readonly id: string; - } | null | undefined; - readonly name: string | null | undefined; - } | null | undefined; - readonly order: { - readonly __typename: "CommerceOfferOrder"; - readonly __isCommerceOrder: "CommerceOfferOrder"; - readonly buyerTotal: string | null | undefined; - readonly code: string; - readonly currencyCode: string; - readonly displayState: CommerceOrderDisplayStateEnum; - readonly id: string; - readonly internalID: string; - readonly itemsTotal: string | null | undefined; - readonly lastOffer: { - readonly amount: string | null | undefined; - readonly amountCents: number; - readonly buyerTotal: string | null | undefined; - readonly buyerTotalCents: number | null | undefined; - readonly fromParticipant: CommerceOrderParticipantEnum | null | undefined; - readonly id: string; - readonly internalID: string; - readonly note: string | null | undefined; - readonly shippingTotal: string | null | undefined; - readonly shippingTotalCents: number | null | undefined; - readonly taxTotal: string | null | undefined; - readonly taxTotalCents: number | null | undefined; - } | null | undefined; - readonly lineItems: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly artwork: { - readonly artsyShippingInternational: boolean | null | undefined; - readonly euShippingOrigin: boolean | null | undefined; - readonly id: string; - readonly isUnlisted: boolean; - readonly onlyShipsDomestically: boolean | null | undefined; - readonly pickupAvailable: boolean | null | undefined; - readonly processWithArtsyShippingDomestic: boolean | null | undefined; - readonly shippingCountry: string | null | undefined; - readonly shippingOrigin: string | null | undefined; - readonly slug: string; - } | null | undefined; - readonly artworkOrEditionSet: { - readonly __typename: "Artwork"; - readonly __isNode: "Artwork"; - readonly id: string; - readonly price: string | null | undefined; - } | { - readonly __typename: "EditionSet"; - readonly __isNode: "EditionSet"; - readonly id: string; - readonly price: string | null | undefined; - } | { - readonly __typename: string; - readonly __isNode: string; - readonly id: string; - } | null | undefined; - readonly artworkVersion: { - readonly artistNames: string | null | undefined; - readonly date: string | null | undefined; - readonly id: string; - readonly image: { - readonly resized_ArtworkSummaryItem: { - readonly url: string; - } | null | undefined; - } | null | undefined; - readonly title: string | null | undefined; - } | null | undefined; - readonly id: string; - readonly selectedShippingQuote: { - readonly id: string; - readonly typeName: string; - } | null | undefined; - readonly shippingQuoteOptions: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly id: string; - readonly isSelected: boolean; - readonly price: string | null | undefined; - readonly priceCents: number; - readonly typeName: string; - } | null | undefined; - } | null | undefined> | null | undefined; - } | null | undefined; - } | null | undefined; - } | null | undefined> | null | undefined; - } | null | undefined; - readonly mode: CommerceOrderModeEnum | null | undefined; - readonly myLastOffer: { - readonly amount: string | null | undefined; - readonly amountCents: number; - readonly buyerTotal: string | null | undefined; - readonly buyerTotalCents: number | null | undefined; - readonly fromParticipant: CommerceOrderParticipantEnum | null | undefined; - readonly id: string; - readonly internalID: string; - readonly note: string | null | undefined; - readonly shippingTotal: string | null | undefined; - readonly shippingTotalCents: number | null | undefined; - readonly taxTotal: string | null | undefined; - readonly taxTotalCents: number | null | undefined; - } | null | undefined; - readonly paymentMethodDetails: { - readonly __typename: "BankAccount"; - readonly id: string; - } | { - readonly __typename: "CreditCard"; - readonly id: string; - } | { - readonly __typename: "WireTransfer"; - readonly isManualPayment: boolean; - } | { - readonly __typename: string; - } | null | undefined; - readonly requestedFulfillment: { - readonly __typename: "CommercePickup"; - readonly phoneNumber: string | null | undefined; - } | { - readonly __typename: "CommerceShip"; - readonly addressLine1: string | null | undefined; - readonly addressLine2: string | null | undefined; - readonly city: string | null | undefined; - readonly country: string | null | undefined; - readonly name: string | null | undefined; - readonly phoneNumber: string | null | undefined; - readonly postalCode: string | null | undefined; - readonly region: string | null | undefined; - } | { - readonly __typename: "CommerceShipArta"; - readonly addressLine1: string | null | undefined; - readonly addressLine2: string | null | undefined; - readonly city: string | null | undefined; - readonly country: string | null | undefined; - readonly name: string | null | undefined; - readonly phoneNumber: string | null | undefined; - readonly postalCode: string | null | undefined; - readonly region: string | null | undefined; - } | { - readonly __typename: string; - } | null | undefined; - readonly sellerDetails: { - readonly __typename: "Partner"; - readonly __isNode: "Partner"; - readonly id: string; - readonly name: string | null | undefined; - } | { - readonly __typename: string; - readonly __isNode: string; - readonly id: string; - } | null | undefined; - readonly shippingTotal: string | null | undefined; - readonly shippingTotalCents: number | null | undefined; - readonly source: CommerceOrderSourceEnum; - readonly taxTotal: string | null | undefined; - readonly taxTotalCents: number | null | undefined; - } | { - readonly __typename: string; - readonly __isCommerceOrder: string; - readonly buyerTotal: string | null | undefined; - readonly code: string; - readonly currencyCode: string; - readonly displayState: CommerceOrderDisplayStateEnum; - readonly id: string; - readonly internalID: string; - readonly itemsTotal: string | null | undefined; - readonly lineItems: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly artwork: { - readonly artsyShippingInternational: boolean | null | undefined; - readonly euShippingOrigin: boolean | null | undefined; - readonly id: string; - readonly isUnlisted: boolean; - readonly onlyShipsDomestically: boolean | null | undefined; - readonly pickupAvailable: boolean | null | undefined; - readonly processWithArtsyShippingDomestic: boolean | null | undefined; - readonly shippingCountry: string | null | undefined; - readonly shippingOrigin: string | null | undefined; - readonly slug: string; - } | null | undefined; - readonly artworkOrEditionSet: { - readonly __typename: "Artwork"; - readonly __isNode: "Artwork"; - readonly id: string; - readonly price: string | null | undefined; - } | { - readonly __typename: "EditionSet"; - readonly __isNode: "EditionSet"; - readonly id: string; - readonly price: string | null | undefined; - } | { - readonly __typename: string; - readonly __isNode: string; - readonly id: string; - } | null | undefined; - readonly artworkVersion: { - readonly artistNames: string | null | undefined; - readonly date: string | null | undefined; - readonly id: string; - readonly image: { - readonly resized_ArtworkSummaryItem: { - readonly url: string; - } | null | undefined; - } | null | undefined; - readonly title: string | null | undefined; - } | null | undefined; - readonly id: string; - readonly selectedShippingQuote: { - readonly id: string; - readonly typeName: string; - } | null | undefined; - readonly shippingQuoteOptions: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly id: string; - readonly isSelected: boolean; - readonly price: string | null | undefined; - readonly priceCents: number; - readonly typeName: string; - } | null | undefined; - } | null | undefined> | null | undefined; - } | null | undefined; - } | null | undefined; - } | null | undefined> | null | undefined; - } | null | undefined; - readonly mode: CommerceOrderModeEnum | null | undefined; - readonly paymentMethodDetails: { - readonly __typename: "BankAccount"; - readonly id: string; - } | { - readonly __typename: "CreditCard"; - readonly id: string; - } | { - readonly __typename: "WireTransfer"; - readonly isManualPayment: boolean; - } | { - readonly __typename: string; - } | null | undefined; - readonly requestedFulfillment: { - readonly __typename: "CommercePickup"; - readonly phoneNumber: string | null | undefined; - } | { - readonly __typename: "CommerceShip"; - readonly addressLine1: string | null | undefined; - readonly addressLine2: string | null | undefined; - readonly city: string | null | undefined; - readonly country: string | null | undefined; - readonly name: string | null | undefined; - readonly phoneNumber: string | null | undefined; - readonly postalCode: string | null | undefined; - readonly region: string | null | undefined; - } | { - readonly __typename: "CommerceShipArta"; - readonly addressLine1: string | null | undefined; - readonly addressLine2: string | null | undefined; - readonly city: string | null | undefined; - readonly country: string | null | undefined; - readonly name: string | null | undefined; - readonly phoneNumber: string | null | undefined; - readonly postalCode: string | null | undefined; - readonly region: string | null | undefined; - } | { - readonly __typename: string; - } | null | undefined; - readonly sellerDetails: { - readonly __typename: "Partner"; - readonly __isNode: "Partner"; - readonly id: string; - readonly name: string | null | undefined; - } | { - readonly __typename: string; - readonly __isNode: string; - readonly id: string; - } | null | undefined; - readonly shippingTotal: string | null | undefined; - readonly shippingTotalCents: number | null | undefined; - readonly source: CommerceOrderSourceEnum; - readonly taxTotal: string | null | undefined; - readonly taxTotalCents: number | null | undefined; - } | null | undefined; -}; -export type Shipping2TestQuery = { - rawResponse: Shipping2TestQuery$rawResponse; - response: Shipping2TestQuery$data; - variables: Shipping2TestQuery$variables; -}; - -const node: ConcreteRequest = (function(){ -var v0 = [ - { - "kind": "Literal", - "name": "id", - "value": "unused" - } -], -v1 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null -}, -v2 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "internalID", - "storageKey": null -}, -v3 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "phoneNumber", - "storageKey": null -}, -v4 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null -}, -v5 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine1", - "storageKey": null -}, -v6 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine2", - "storageKey": null -}, -v7 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "city", - "storageKey": null -}, -v8 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "region", - "storageKey": null -}, -v9 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "country", - "storageKey": null -}, -v10 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "postalCode", - "storageKey": null -}, -v11 = [ - (v4/*: any*/), - (v5/*: any*/), - (v6/*: any*/), - (v7/*: any*/), - (v8/*: any*/), - (v9/*: any*/), - (v10/*: any*/), - (v3/*: any*/) -], -v12 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null -}, -v13 = [ - { - "kind": "Literal", - "name": "precision", - "value": 2 - } -], -v14 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "typeName", - "storageKey": null -}, -v15 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "price", - "storageKey": null -}, -v16 = [ - (v12/*: any*/) -], -v17 = { - "kind": "InlineFragment", - "selections": (v16/*: any*/), - "type": "Node", - "abstractKey": "__isNode" -}, -v18 = { - "alias": null, - "args": (v13/*: any*/), - "kind": "ScalarField", - "name": "shippingTotal", - "storageKey": "shippingTotal(precision:2)" -}, -v19 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "shippingTotalCents", - "storageKey": null -}, -v20 = { - "alias": null, - "args": (v13/*: any*/), - "kind": "ScalarField", - "name": "taxTotal", - "storageKey": "taxTotal(precision:2)" -}, -v21 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "taxTotalCents", - "storageKey": null -}, -v22 = { - "alias": null, - "args": (v13/*: any*/), - "kind": "ScalarField", - "name": "buyerTotal", - "storageKey": "buyerTotal(precision:2)" -}, -v23 = [ - (v2/*: any*/), - { - "alias": null, - "args": (v13/*: any*/), - "kind": "ScalarField", - "name": "amount", - "storageKey": "amount(precision:2)" - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "amountCents", - "storageKey": null - }, - (v18/*: any*/), - (v19/*: any*/), - (v20/*: any*/), - (v21/*: any*/), - (v22/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "buyerTotalCents", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "fromParticipant", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "note", - "storageKey": null - }, - (v12/*: any*/) -], -v24 = { - "enumValues": null, - "nullable": false, - "plural": false, - "type": "String" -}, -v25 = { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "String" -}, -v26 = { - "enumValues": null, - "nullable": false, - "plural": false, - "type": "ID" -}, -v27 = { - "enumValues": null, - "nullable": false, - "plural": false, - "type": "Boolean" -}, -v28 = { - "enumValues": null, - "nullable": false, - "plural": false, - "type": "Int" -}, -v29 = { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "CommerceOffer" -}, -v30 = { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "Int" -}, -v31 = { - "enumValues": [ - "BUYER", - "SELLER" - ], - "nullable": true, - "plural": false, - "type": "CommerceOrderParticipantEnum" -}, -v32 = { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "Boolean" -}, -v33 = { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "CommerceShippingQuote" -}; -return { - "fragment": { - "argumentDefinitions": [], - "kind": "Fragment", - "metadata": null, - "name": "Shipping2TestQuery", - "selections": [ - { - "alias": "order", - "args": (v0/*: any*/), - "concreteType": null, - "kind": "LinkedField", - "name": "commerceOrder", - "plural": false, - "selections": [ - { - "args": null, - "kind": "FragmentSpread", - "name": "Shipping2_order" - } - ], - "storageKey": "commerceOrder(id:\"unused\")" - }, - { - "alias": null, - "args": null, - "concreteType": "Me", - "kind": "LinkedField", - "name": "me", - "plural": false, - "selections": [ - { - "args": null, - "kind": "FragmentSpread", - "name": "Shipping2_me" - } - ], - "storageKey": null - } - ], - "type": "Query", - "abstractKey": null - }, - "kind": "Request", - "operation": { - "argumentDefinitions": [], - "kind": "Operation", - "name": "Shipping2TestQuery", - "selections": [ - { - "alias": "order", - "args": (v0/*: any*/), - "concreteType": null, - "kind": "LinkedField", - "name": "commerceOrder", - "plural": false, - "selections": [ - (v1/*: any*/), - { - "kind": "TypeDiscriminator", - "abstractKey": "__isCommerceOrder" - }, - (v2/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "mode", - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "requestedFulfillment", - "plural": false, - "selections": [ - (v1/*: any*/), - { - "kind": "InlineFragment", - "selections": [ - (v3/*: any*/) - ], - "type": "CommercePickup", - "abstractKey": null - }, - { - "kind": "InlineFragment", - "selections": (v11/*: any*/), - "type": "CommerceShip", - "abstractKey": null - }, - { - "kind": "InlineFragment", - "selections": (v11/*: any*/), - "type": "CommerceShipArta", - "abstractKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemConnection", - "kind": "LinkedField", - "name": "lineItems", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItem", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteConnection", - "kind": "LinkedField", - "name": "shippingQuoteOptions", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuote", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v12/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isSelected", - "storageKey": null - }, - { - "alias": null, - "args": (v13/*: any*/), - "kind": "ScalarField", - "name": "price", - "storageKey": "price(precision:2)" - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "priceCents", - "storageKey": null - }, - (v14/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "Artwork", - "kind": "LinkedField", - "name": "artwork", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "processWithArtsyShippingDomestic", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "artsyShippingInternational", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "onlyShipsDomestically", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "euShippingOrigin", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "shippingCountry", - "storageKey": null - }, - (v12/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "pickupAvailable", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "slug", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "shippingOrigin", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isUnlisted", - "storageKey": null - } - ], - "storageKey": null - }, - (v12/*: any*/), - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "artworkOrEditionSet", - "plural": false, - "selections": [ - (v1/*: any*/), - { - "kind": "InlineFragment", - "selections": [ - (v15/*: any*/) - ], - "type": "Artwork", - "abstractKey": null - }, - { - "kind": "InlineFragment", - "selections": [ - (v15/*: any*/), - (v12/*: any*/) - ], - "type": "EditionSet", - "abstractKey": null - }, - (v17/*: any*/) - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "ArtworkVersion", - "kind": "LinkedField", - "name": "artworkVersion", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "date", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "artistNames", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "title", - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "Image", - "kind": "LinkedField", - "name": "image", - "plural": false, - "selections": [ - { - "alias": "resized_ArtworkSummaryItem", - "args": [ - { - "kind": "Literal", - "name": "width", - "value": 55 - } - ], - "concreteType": "ResizedImageUrl", - "kind": "LinkedField", - "name": "resized", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "url", - "storageKey": null - } - ], - "storageKey": "resized(width:55)" - } - ], - "storageKey": null - }, - (v12/*: any*/) - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuote", - "kind": "LinkedField", - "name": "selectedShippingQuote", - "plural": false, - "selections": [ - (v14/*: any*/), - (v12/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "sellerDetails", - "plural": false, - "selections": [ - (v1/*: any*/), - { - "kind": "InlineFragment", - "selections": [ - (v4/*: any*/) - ], - "type": "Partner", - "abstractKey": null - }, - (v17/*: any*/) - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "currencyCode", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "source", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "code", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "displayState", - "storageKey": null - }, - (v18/*: any*/), - (v19/*: any*/), - (v20/*: any*/), - (v21/*: any*/), - { - "alias": null, - "args": (v13/*: any*/), - "kind": "ScalarField", - "name": "itemsTotal", - "storageKey": "itemsTotal(precision:2)" - }, - (v22/*: any*/), - { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceOffer", - "kind": "LinkedField", - "name": "lastOffer", - "plural": false, - "selections": (v23/*: any*/), - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "CommerceOffer", - "kind": "LinkedField", - "name": "myLastOffer", - "plural": false, - "selections": (v23/*: any*/), - "storageKey": null - } - ], - "type": "CommerceOfferOrder", - "abstractKey": null - }, - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "paymentMethodDetails", - "plural": false, - "selections": [ - (v1/*: any*/), - { - "kind": "InlineFragment", - "selections": (v16/*: any*/), - "type": "CreditCard", - "abstractKey": null - }, - { - "kind": "InlineFragment", - "selections": (v16/*: any*/), - "type": "BankAccount", - "abstractKey": null - }, - { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isManualPayment", - "storageKey": null - } - ], - "type": "WireTransfer", - "abstractKey": null - } - ], - "storageKey": null - }, - (v12/*: any*/) - ], - "storageKey": "commerceOrder(id:\"unused\")" - }, - { - "alias": null, - "args": null, - "concreteType": "Me", - "kind": "LinkedField", - "name": "me", - "plural": false, - "selections": [ - (v4/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "email", - "storageKey": null - }, - (v12/*: any*/), - { - "alias": null, - "args": null, - "concreteType": "MyLocation", - "kind": "LinkedField", - "name": "location", - "plural": false, - "selections": [ - (v9/*: any*/), - (v12/*: any*/) - ], - "storageKey": null - }, - { - "alias": null, - "args": [ - { - "kind": "Literal", - "name": "first", - "value": 30 - } - ], - "concreteType": "UserAddressConnection", - "kind": "LinkedField", - "name": "addressConnection", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "totalCount", - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "UserAddressEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "UserAddress", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v12/*: any*/), - (v2/*: any*/), - (v5/*: any*/), - (v6/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine3", - "storageKey": null - }, - (v7/*: any*/), - (v9/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isDefault", - "storageKey": null - }, - (v4/*: any*/), - (v3/*: any*/), - (v10/*: any*/), - (v8/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": "addressConnection(first:30)" - } - ], - "storageKey": null - } - ] - }, - "params": { - "cacheID": "49b1c142eb59c0b6a8b69477d5bf531c", - "id": null, - "metadata": { - "relayTestingSelectionTypeInfo": { - "me": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "Me" - }, - "me.addressConnection": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "UserAddressConnection" - }, - "me.addressConnection.edges": { - "enumValues": null, - "nullable": true, - "plural": true, - "type": "UserAddressEdge" - }, - "me.addressConnection.edges.node": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "UserAddress" - }, - "me.addressConnection.edges.node.addressLine1": (v24/*: any*/), - "me.addressConnection.edges.node.addressLine2": (v25/*: any*/), - "me.addressConnection.edges.node.addressLine3": (v25/*: any*/), - "me.addressConnection.edges.node.city": (v24/*: any*/), - "me.addressConnection.edges.node.country": (v24/*: any*/), - "me.addressConnection.edges.node.id": (v26/*: any*/), - "me.addressConnection.edges.node.internalID": (v26/*: any*/), - "me.addressConnection.edges.node.isDefault": (v27/*: any*/), - "me.addressConnection.edges.node.name": (v25/*: any*/), - "me.addressConnection.edges.node.phoneNumber": (v25/*: any*/), - "me.addressConnection.edges.node.postalCode": (v25/*: any*/), - "me.addressConnection.edges.node.region": (v25/*: any*/), - "me.addressConnection.totalCount": (v28/*: any*/), - "me.email": (v25/*: any*/), - "me.id": (v26/*: any*/), - "me.location": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "MyLocation" - }, - "me.location.country": (v25/*: any*/), - "me.location.id": (v26/*: any*/), - "me.name": (v25/*: any*/), - "order": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "CommerceOrder" - }, - "order.__isCommerceOrder": (v24/*: any*/), - "order.__typename": (v24/*: any*/), - "order.buyerTotal": (v25/*: any*/), - "order.code": (v24/*: any*/), - "order.currencyCode": (v24/*: any*/), - "order.displayState": { - "enumValues": [ - "ABANDONED", - "APPROVED", - "CANCELED", - "FULFILLED", - "IN_TRANSIT", - "PAYMENT_FAILED", - "PENDING", - "PROCESSING", - "PROCESSING_APPROVAL", - "REFUNDED", - "SUBMITTED" - ], - "nullable": false, - "plural": false, - "type": "CommerceOrderDisplayStateEnum" - }, - "order.id": (v26/*: any*/), - "order.internalID": (v26/*: any*/), - "order.itemsTotal": (v25/*: any*/), - "order.lastOffer": (v29/*: any*/), - "order.lastOffer.amount": (v25/*: any*/), - "order.lastOffer.amountCents": (v28/*: any*/), - "order.lastOffer.buyerTotal": (v25/*: any*/), - "order.lastOffer.buyerTotalCents": (v30/*: any*/), - "order.lastOffer.fromParticipant": (v31/*: any*/), - "order.lastOffer.id": (v26/*: any*/), - "order.lastOffer.internalID": (v26/*: any*/), - "order.lastOffer.note": (v25/*: any*/), - "order.lastOffer.shippingTotal": (v25/*: any*/), - "order.lastOffer.shippingTotalCents": (v30/*: any*/), - "order.lastOffer.taxTotal": (v25/*: any*/), - "order.lastOffer.taxTotalCents": (v30/*: any*/), - "order.lineItems": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "CommerceLineItemConnection" - }, - "order.lineItems.edges": { - "enumValues": null, - "nullable": true, - "plural": true, - "type": "CommerceLineItemEdge" - }, - "order.lineItems.edges.node": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "CommerceLineItem" - }, - "order.lineItems.edges.node.artwork": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "Artwork" - }, - "order.lineItems.edges.node.artwork.artsyShippingInternational": (v32/*: any*/), - "order.lineItems.edges.node.artwork.euShippingOrigin": (v32/*: any*/), - "order.lineItems.edges.node.artwork.id": (v26/*: any*/), - "order.lineItems.edges.node.artwork.isUnlisted": (v27/*: any*/), - "order.lineItems.edges.node.artwork.onlyShipsDomestically": (v32/*: any*/), - "order.lineItems.edges.node.artwork.pickupAvailable": (v32/*: any*/), - "order.lineItems.edges.node.artwork.processWithArtsyShippingDomestic": (v32/*: any*/), - "order.lineItems.edges.node.artwork.shippingCountry": (v25/*: any*/), - "order.lineItems.edges.node.artwork.shippingOrigin": (v25/*: any*/), - "order.lineItems.edges.node.artwork.slug": (v26/*: any*/), - "order.lineItems.edges.node.artworkOrEditionSet": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "ArtworkOrEditionSetType" - }, - "order.lineItems.edges.node.artworkOrEditionSet.__isNode": (v24/*: any*/), - "order.lineItems.edges.node.artworkOrEditionSet.__typename": (v24/*: any*/), - "order.lineItems.edges.node.artworkOrEditionSet.id": (v26/*: any*/), - "order.lineItems.edges.node.artworkOrEditionSet.price": (v25/*: any*/), - "order.lineItems.edges.node.artworkVersion": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "ArtworkVersion" - }, - "order.lineItems.edges.node.artworkVersion.artistNames": (v25/*: any*/), - "order.lineItems.edges.node.artworkVersion.date": (v25/*: any*/), - "order.lineItems.edges.node.artworkVersion.id": (v26/*: any*/), - "order.lineItems.edges.node.artworkVersion.image": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "Image" - }, - "order.lineItems.edges.node.artworkVersion.image.resized_ArtworkSummaryItem": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "ResizedImageUrl" - }, - "order.lineItems.edges.node.artworkVersion.image.resized_ArtworkSummaryItem.url": (v24/*: any*/), - "order.lineItems.edges.node.artworkVersion.title": (v25/*: any*/), - "order.lineItems.edges.node.id": (v26/*: any*/), - "order.lineItems.edges.node.selectedShippingQuote": (v33/*: any*/), - "order.lineItems.edges.node.selectedShippingQuote.id": (v26/*: any*/), - "order.lineItems.edges.node.selectedShippingQuote.typeName": (v24/*: any*/), - "order.lineItems.edges.node.shippingQuoteOptions": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "CommerceShippingQuoteConnection" - }, - "order.lineItems.edges.node.shippingQuoteOptions.edges": { - "enumValues": null, - "nullable": true, - "plural": true, - "type": "CommerceShippingQuoteEdge" - }, - "order.lineItems.edges.node.shippingQuoteOptions.edges.node": (v33/*: any*/), - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.id": (v26/*: any*/), - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.isSelected": (v27/*: any*/), - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.price": (v25/*: any*/), - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.priceCents": (v28/*: any*/), - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.typeName": (v24/*: any*/), - "order.mode": { - "enumValues": [ - "BUY", - "OFFER" - ], - "nullable": true, - "plural": false, - "type": "CommerceOrderModeEnum" - }, - "order.myLastOffer": (v29/*: any*/), - "order.myLastOffer.amount": (v25/*: any*/), - "order.myLastOffer.amountCents": (v28/*: any*/), - "order.myLastOffer.buyerTotal": (v25/*: any*/), - "order.myLastOffer.buyerTotalCents": (v30/*: any*/), - "order.myLastOffer.fromParticipant": (v31/*: any*/), - "order.myLastOffer.id": (v26/*: any*/), - "order.myLastOffer.internalID": (v26/*: any*/), - "order.myLastOffer.note": (v25/*: any*/), - "order.myLastOffer.shippingTotal": (v25/*: any*/), - "order.myLastOffer.shippingTotalCents": (v30/*: any*/), - "order.myLastOffer.taxTotal": (v25/*: any*/), - "order.myLastOffer.taxTotalCents": (v30/*: any*/), - "order.paymentMethodDetails": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "PaymentMethodUnion" - }, - "order.paymentMethodDetails.__typename": (v24/*: any*/), - "order.paymentMethodDetails.id": (v26/*: any*/), - "order.paymentMethodDetails.isManualPayment": (v27/*: any*/), - "order.requestedFulfillment": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "CommerceRequestedFulfillmentUnion" - }, - "order.requestedFulfillment.__typename": (v24/*: any*/), - "order.requestedFulfillment.addressLine1": (v25/*: any*/), - "order.requestedFulfillment.addressLine2": (v25/*: any*/), - "order.requestedFulfillment.city": (v25/*: any*/), - "order.requestedFulfillment.country": (v25/*: any*/), - "order.requestedFulfillment.name": (v25/*: any*/), - "order.requestedFulfillment.phoneNumber": (v25/*: any*/), - "order.requestedFulfillment.postalCode": (v25/*: any*/), - "order.requestedFulfillment.region": (v25/*: any*/), - "order.sellerDetails": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "OrderParty" - }, - "order.sellerDetails.__isNode": (v24/*: any*/), - "order.sellerDetails.__typename": (v24/*: any*/), - "order.sellerDetails.id": (v26/*: any*/), - "order.sellerDetails.name": (v25/*: any*/), - "order.shippingTotal": (v25/*: any*/), - "order.shippingTotalCents": (v30/*: any*/), - "order.source": { - "enumValues": [ - "artwork_page", - "inquiry", - "partner_offer", - "private_sale" - ], - "nullable": false, - "plural": false, - "type": "CommerceOrderSourceEnum" - }, - "order.taxTotal": (v25/*: any*/), - "order.taxTotalCents": (v30/*: any*/) - } - }, - "name": "Shipping2TestQuery", - "operationKind": "query", - "text": "query Shipping2TestQuery {\n order: commerceOrder(id: \"unused\") {\n __typename\n ...Shipping2_order\n id\n }\n me {\n ...Shipping2_me\n id\n }\n}\n\nfragment ArtworkSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n sellerDetails {\n __typename\n ... on Partner {\n name\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n currencyCode\n mode\n source\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n artwork {\n slug\n shippingOrigin\n isUnlisted\n id\n }\n artworkVersion {\n date\n artistNames\n title\n image {\n resized_ArtworkSummaryItem: resized(width: 55) {\n url\n }\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_me on Me {\n name\n email\n id\n location {\n country\n id\n }\n addressConnection(first: 30) {\n totalCount\n }\n}\n\nfragment FulfillmentDetailsForm_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n lineItems {\n edges {\n node {\n artwork {\n pickupAvailable\n id\n }\n id\n }\n }\n }\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n}\n\nfragment OrderStepper_order on CommerceOrder {\n __isCommerceOrder: __typename\n mode\n requestedFulfillment {\n __typename\n }\n paymentMethodDetails {\n __typename\n ... on CreditCard {\n id\n }\n ... on BankAccount {\n id\n }\n ... on WireTransfer {\n isManualPayment\n }\n }\n lineItems {\n edges {\n node {\n artwork {\n slug\n id\n }\n shippingQuoteOptions {\n edges {\n node {\n isSelected\n id\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment SaveAndContinueButton_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n}\n\nfragment Shipping2_me on Me {\n ...FulfillmentDetailsForm_me\n ...ShippingContext_me_dXEtb\n}\n\nfragment Shipping2_order on CommerceOrder {\n __isCommerceOrder: __typename\n ...ShippingContext_order\n ...FulfillmentDetailsForm_order\n ...SaveAndContinueButton_order\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n ...ShippingQuotes2_order\n internalID\n}\n\nfragment ShippingContext_me_dXEtb on Me {\n addressConnection(first: 30) {\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n\nfragment ShippingContext_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n mode\n requestedFulfillment {\n __typename\n ... on CommercePickup {\n phoneNumber\n }\n ... on CommerceShip {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n ... on CommerceShipArta {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n }\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n }\n }\n }\n artwork {\n processWithArtsyShippingDomestic\n artsyShippingInternational\n onlyShipsDomestically\n euShippingOrigin\n shippingCountry\n id\n }\n id\n }\n }\n }\n}\n\nfragment ShippingQuotes2_order on CommerceOrder {\n __isCommerceOrder: __typename\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n price(precision: 2)\n priceCents\n typeName\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment TransactionDetailsSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n __typename\n requestedFulfillment {\n __typename\n }\n code\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n selectedShippingQuote {\n typeName\n id\n }\n id\n }\n }\n }\n mode\n source\n displayState\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n itemsTotal(precision: 2)\n buyerTotal(precision: 2)\n currencyCode\n ... on CommerceOfferOrder {\n lastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n myLastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n }\n}\n" - } -}; -})(); - -(node as any).hash = "a133155038ad3cbf6aa5caf791cc38bd"; - -export default node; diff --git a/src/__generated__/Shipping2_me.graphql.ts b/src/__generated__/Shipping2_me.graphql.ts deleted file mode 100644 index 761d34430d8..00000000000 --- a/src/__generated__/Shipping2_me.graphql.ts +++ /dev/null @@ -1,87 +0,0 @@ -/** - * @generated SignedSource<> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { Fragment, ReaderFragment } from 'relay-runtime'; -import { FragmentRefs } from "relay-runtime"; -export type Shipping2_me$data = { - readonly " $fragmentSpreads": FragmentRefs<"FulfillmentDetailsForm_me" | "ShippingContext_me">; - readonly " $fragmentType": "Shipping2_me"; -}; -export type Shipping2_me$key = { - readonly " $data"?: Shipping2_me$data; - readonly " $fragmentSpreads": FragmentRefs<"Shipping2_me">; -}; - -const node: ReaderFragment = { - "argumentDefinitions": [ - { - "defaultValue": null, - "kind": "LocalArgument", - "name": "after" - }, - { - "defaultValue": null, - "kind": "LocalArgument", - "name": "before" - }, - { - "defaultValue": 30, - "kind": "LocalArgument", - "name": "first" - }, - { - "defaultValue": null, - "kind": "LocalArgument", - "name": "last" - } - ], - "kind": "Fragment", - "metadata": null, - "name": "Shipping2_me", - "selections": [ - { - "args": null, - "kind": "FragmentSpread", - "name": "FulfillmentDetailsForm_me" - }, - { - "args": [ - { - "kind": "Variable", - "name": "after", - "variableName": "after" - }, - { - "kind": "Variable", - "name": "before", - "variableName": "before" - }, - { - "kind": "Variable", - "name": "first", - "variableName": "first" - }, - { - "kind": "Variable", - "name": "last", - "variableName": "last" - } - ], - "kind": "FragmentSpread", - "name": "ShippingContext_me" - } - ], - "type": "Me", - "abstractKey": null -}; - -(node as any).hash = "12530dc34ac63c879b4c56bda3518dcb"; - -export default node; diff --git a/src/__generated__/Shipping2_order.graphql.ts b/src/__generated__/Shipping2_order.graphql.ts deleted file mode 100644 index 7dc6b8b31c2..00000000000 --- a/src/__generated__/Shipping2_order.graphql.ts +++ /dev/null @@ -1,78 +0,0 @@ -/** - * @generated SignedSource<> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { Fragment, ReaderFragment } from 'relay-runtime'; -import { FragmentRefs } from "relay-runtime"; -export type Shipping2_order$data = { - readonly internalID: string; - readonly " $fragmentSpreads": FragmentRefs<"ArtworkSummaryItem_order" | "FulfillmentDetailsForm_order" | "OrderStepper_order" | "SaveAndContinueButton_order" | "ShippingContext_order" | "ShippingQuotes2_order" | "TransactionDetailsSummaryItem_order">; - readonly " $fragmentType": "Shipping2_order"; -}; -export type Shipping2_order$key = { - readonly " $data"?: Shipping2_order$data; - readonly " $fragmentSpreads": FragmentRefs<"Shipping2_order">; -}; - -const node: ReaderFragment = { - "argumentDefinitions": [], - "kind": "Fragment", - "metadata": null, - "name": "Shipping2_order", - "selections": [ - { - "args": null, - "kind": "FragmentSpread", - "name": "ShippingContext_order" - }, - { - "args": null, - "kind": "FragmentSpread", - "name": "FulfillmentDetailsForm_order" - }, - { - "args": null, - "kind": "FragmentSpread", - "name": "SaveAndContinueButton_order" - }, - { - "args": null, - "kind": "FragmentSpread", - "name": "ArtworkSummaryItem_order" - }, - { - "args": null, - "kind": "FragmentSpread", - "name": "TransactionDetailsSummaryItem_order" - }, - { - "args": null, - "kind": "FragmentSpread", - "name": "OrderStepper_order" - }, - { - "args": null, - "kind": "FragmentSpread", - "name": "ShippingQuotes2_order" - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "internalID", - "storageKey": null - } - ], - "type": "CommerceOrder", - "abstractKey": "__isCommerceOrder" -}; - -(node as any).hash = "f9ea17ecfed164b2896c3a2a795005d9"; - -export default node; diff --git a/src/__generated__/ShippingQuotes_Test_Query.graphql.ts b/src/__generated__/ShippingQuotes_Test_Query.graphql.ts deleted file mode 100644 index dcf2435b9ae..00000000000 --- a/src/__generated__/ShippingQuotes_Test_Query.graphql.ts +++ /dev/null @@ -1,371 +0,0 @@ -/** - * @generated SignedSource<> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { ConcreteRequest, Query } from 'relay-runtime'; -import { FragmentRefs } from "relay-runtime"; -export type ShippingQuotes_Test_Query$variables = Record; -export type ShippingQuotes_Test_Query$data = { - readonly order: { - readonly lineItems: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly shippingQuoteOptions: { - readonly edges: ReadonlyArray<{ - readonly " $fragmentSpreads": FragmentRefs<"ShippingQuotes_shippingQuotes">; - } | null | undefined> | null | undefined; - } | null | undefined; - } | null | undefined; - } | null | undefined> | null | undefined; - } | null | undefined; - } | null | undefined; -}; -export type ShippingQuotes_Test_Query$rawResponse = { - readonly order: { - readonly __typename: string; - readonly id: string; - readonly lineItems: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly id: string; - readonly shippingQuoteOptions: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly id: string; - readonly isSelected: boolean; - readonly price: string | null | undefined; - readonly priceCents: number; - readonly typeName: string; - } | null | undefined; - } | null | undefined> | null | undefined; - } | null | undefined; - } | null | undefined; - } | null | undefined> | null | undefined; - } | null | undefined; - } | null | undefined; -}; -export type ShippingQuotes_Test_Query = { - rawResponse: ShippingQuotes_Test_Query$rawResponse; - response: ShippingQuotes_Test_Query$data; - variables: ShippingQuotes_Test_Query$variables; -}; - -const node: ConcreteRequest = (function(){ -var v0 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null -}, -v1 = { - "enumValues": null, - "nullable": false, - "plural": false, - "type": "String" -}, -v2 = { - "enumValues": null, - "nullable": false, - "plural": false, - "type": "ID" -}; -return { - "fragment": { - "argumentDefinitions": [], - "kind": "Fragment", - "metadata": null, - "name": "ShippingQuotes_Test_Query", - "selections": [ - { - "alias": "order", - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "commerceOrder", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemConnection", - "kind": "LinkedField", - "name": "lineItems", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItem", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteConnection", - "kind": "LinkedField", - "name": "shippingQuoteOptions", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "args": null, - "kind": "FragmentSpread", - "name": "ShippingQuotes_shippingQuotes" - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "Query", - "abstractKey": null - }, - "kind": "Request", - "operation": { - "argumentDefinitions": [], - "kind": "Operation", - "name": "ShippingQuotes_Test_Query", - "selections": [ - { - "alias": "order", - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "commerceOrder", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemConnection", - "kind": "LinkedField", - "name": "lineItems", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItem", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteConnection", - "kind": "LinkedField", - "name": "shippingQuoteOptions", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuote", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v0/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isSelected", - "storageKey": null - }, - { - "alias": null, - "args": [ - { - "kind": "Literal", - "name": "precision", - "value": 2 - } - ], - "kind": "ScalarField", - "name": "price", - "storageKey": "price(precision:2)" - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "priceCents", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "typeName", - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - }, - (v0/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - }, - (v0/*: any*/) - ], - "storageKey": null - } - ] - }, - "params": { - "cacheID": "11f4c5965408203677e3dddbb41efd80", - "id": null, - "metadata": { - "relayTestingSelectionTypeInfo": { - "order": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "CommerceOrder" - }, - "order.__typename": (v1/*: any*/), - "order.id": (v2/*: any*/), - "order.lineItems": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "CommerceLineItemConnection" - }, - "order.lineItems.edges": { - "enumValues": null, - "nullable": true, - "plural": true, - "type": "CommerceLineItemEdge" - }, - "order.lineItems.edges.node": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "CommerceLineItem" - }, - "order.lineItems.edges.node.id": (v2/*: any*/), - "order.lineItems.edges.node.shippingQuoteOptions": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "CommerceShippingQuoteConnection" - }, - "order.lineItems.edges.node.shippingQuoteOptions.edges": { - "enumValues": null, - "nullable": true, - "plural": true, - "type": "CommerceShippingQuoteEdge" - }, - "order.lineItems.edges.node.shippingQuoteOptions.edges.node": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "CommerceShippingQuote" - }, - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.id": (v2/*: any*/), - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.isSelected": { - "enumValues": null, - "nullable": false, - "plural": false, - "type": "Boolean" - }, - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.price": { - "enumValues": null, - "nullable": true, - "plural": false, - "type": "String" - }, - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.priceCents": { - "enumValues": null, - "nullable": false, - "plural": false, - "type": "Int" - }, - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.typeName": (v1/*: any*/) - } - }, - "name": "ShippingQuotes_Test_Query", - "operationKind": "query", - "text": "query ShippingQuotes_Test_Query {\n order: commerceOrder {\n __typename\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n ...ShippingQuotes_shippingQuotes\n }\n }\n id\n }\n }\n }\n id\n }\n}\n\nfragment ShippingQuotes_shippingQuotes on CommerceShippingQuoteEdge {\n node {\n id\n isSelected\n price(precision: 2)\n priceCents\n typeName\n }\n}\n" - } -}; -})(); - -(node as any).hash = "188340a940545057b5b1dcd13a548121"; - -export default node; diff --git a/src/__generated__/ShippingQuotes2_order.graphql.ts b/src/__generated__/ShippingQuotes_order.graphql.ts similarity index 92% rename from src/__generated__/ShippingQuotes2_order.graphql.ts rename to src/__generated__/ShippingQuotes_order.graphql.ts index 13fade781fb..18ea2bce47c 100644 --- a/src/__generated__/ShippingQuotes2_order.graphql.ts +++ b/src/__generated__/ShippingQuotes_order.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<57e350f701551bebebe503023a4ff735>> * @lightSyntaxTransform * @nogrep */ @@ -10,7 +10,7 @@ import { Fragment, ReaderFragment } from 'relay-runtime'; import { FragmentRefs } from "relay-runtime"; -export type ShippingQuotes2_order$data = { +export type ShippingQuotes_order$data = { readonly lineItems: { readonly edges: ReadonlyArray<{ readonly node: { @@ -28,18 +28,18 @@ export type ShippingQuotes2_order$data = { } | null | undefined; } | null | undefined> | null | undefined; } | null | undefined; - readonly " $fragmentType": "ShippingQuotes2_order"; + readonly " $fragmentType": "ShippingQuotes_order"; }; -export type ShippingQuotes2_order$key = { - readonly " $data"?: ShippingQuotes2_order$data; - readonly " $fragmentSpreads": FragmentRefs<"ShippingQuotes2_order">; +export type ShippingQuotes_order$key = { + readonly " $data"?: ShippingQuotes_order$data; + readonly " $fragmentSpreads": FragmentRefs<"ShippingQuotes_order">; }; const node: ReaderFragment = { "argumentDefinitions": [], "kind": "Fragment", "metadata": null, - "name": "ShippingQuotes2_order", + "name": "ShippingQuotes_order", "selections": [ { "alias": null, @@ -153,6 +153,6 @@ const node: ReaderFragment = { "abstractKey": "__isCommerceOrder" }; -(node as any).hash = "39e80542a59a287f60af6948136b1dcc"; +(node as any).hash = "8d3e004bc9d835484aeec105ee1b5be5"; export default node; diff --git a/src/__generated__/ShippingQuotes_shippingQuotes.graphql.ts b/src/__generated__/ShippingQuotes_shippingQuotes.graphql.ts deleted file mode 100644 index eed46180098..00000000000 --- a/src/__generated__/ShippingQuotes_shippingQuotes.graphql.ts +++ /dev/null @@ -1,95 +0,0 @@ -/** - * @generated SignedSource<> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { Fragment, ReaderFragment } from 'relay-runtime'; -import { FragmentRefs } from "relay-runtime"; -export type ShippingQuotes_shippingQuotes$data = ReadonlyArray<{ - readonly node: { - readonly id: string; - readonly isSelected: boolean; - readonly price: string | null | undefined; - readonly priceCents: number; - readonly typeName: string; - } | null | undefined; - readonly " $fragmentType": "ShippingQuotes_shippingQuotes"; -}>; -export type ShippingQuotes_shippingQuotes$key = ReadonlyArray<{ - readonly " $data"?: ShippingQuotes_shippingQuotes$data; - readonly " $fragmentSpreads": FragmentRefs<"ShippingQuotes_shippingQuotes">; -}>; - -const node: ReaderFragment = { - "argumentDefinitions": [], - "kind": "Fragment", - "metadata": { - "plural": true - }, - "name": "ShippingQuotes_shippingQuotes", - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuote", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isSelected", - "storageKey": null - }, - { - "alias": null, - "args": [ - { - "kind": "Literal", - "name": "precision", - "value": 2 - } - ], - "kind": "ScalarField", - "name": "price", - "storageKey": "price(precision:2)" - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "priceCents", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "typeName", - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "CommerceShippingQuoteEdge", - "abstractKey": null -}; - -(node as any).hash = "c15399ea645f153cad7c5409ad44fa49"; - -export default node; diff --git a/src/__generated__/ShippingTestQuery.graphql.ts b/src/__generated__/ShippingTestQuery.graphql.ts index b6f0db89c4e..828fb1c960c 100644 --- a/src/__generated__/ShippingTestQuery.graphql.ts +++ b/src/__generated__/ShippingTestQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -14,7 +14,6 @@ export type CommerceOrderDisplayStateEnum = "ABANDONED" | "APPROVED" | "CANCELED export type CommerceOrderModeEnum = "BUY" | "OFFER" | "%future added value"; export type CommerceOrderParticipantEnum = "BUYER" | "SELLER" | "%future added value"; export type CommerceOrderSourceEnum = "artwork_page" | "inquiry" | "partner_offer" | "private_sale" | "%future added value"; -export type CommerceOrderStateEnum = "ABANDONED" | "APPROVED" | "CANCELED" | "FULFILLED" | "IN_REVIEW" | "PENDING" | "PROCESSING_APPROVAL" | "REFUNDED" | "SUBMITTED" | "%future added value"; export type ShippingTestQuery$variables = Record; export type ShippingTestQuery$data = { readonly me: { @@ -28,9 +27,7 @@ export type ShippingTestQuery$rawResponse = { readonly me: { readonly addressConnection: { readonly edges: ReadonlyArray<{ - readonly cursor: string; readonly node: { - readonly __typename: "UserAddress"; readonly addressLine1: string; readonly addressLine2: string | null | undefined; readonly addressLine3: string | null | undefined; @@ -45,12 +42,6 @@ export type ShippingTestQuery$rawResponse = { readonly region: string | null | undefined; } | null | undefined; } | null | undefined> | null | undefined; - readonly pageInfo: { - readonly endCursor: string | null | undefined; - readonly hasNextPage: boolean; - readonly hasPreviousPage: boolean; - readonly startCursor: string | null | undefined; - }; readonly totalCount: number; } | null | undefined; readonly email: string | null | undefined; @@ -94,7 +85,7 @@ export type ShippingTestQuery$rawResponse = { readonly id: string; readonly isUnlisted: boolean; readonly onlyShipsDomestically: boolean | null | undefined; - readonly pickup_available: boolean | null | undefined; + readonly pickupAvailable: boolean | null | undefined; readonly processWithArtsyShippingDomestic: boolean | null | undefined; readonly shippingCountry: string | null | undefined; readonly shippingOrigin: string | null | undefined; @@ -211,8 +202,6 @@ export type ShippingTestQuery$rawResponse = { readonly shippingTotal: string | null | undefined; readonly shippingTotalCents: number | null | undefined; readonly source: CommerceOrderSourceEnum; - readonly state: CommerceOrderStateEnum; - readonly stateExpiresAt: string | null | undefined; readonly taxTotal: string | null | undefined; readonly taxTotalCents: number | null | undefined; } | { @@ -234,7 +223,7 @@ export type ShippingTestQuery$rawResponse = { readonly id: string; readonly isUnlisted: boolean; readonly onlyShipsDomestically: boolean | null | undefined; - readonly pickup_available: boolean | null | undefined; + readonly pickupAvailable: boolean | null | undefined; readonly processWithArtsyShippingDomestic: boolean | null | undefined; readonly shippingCountry: string | null | undefined; readonly shippingOrigin: string | null | undefined; @@ -337,8 +326,6 @@ export type ShippingTestQuery$rawResponse = { readonly shippingTotal: string | null | undefined; readonly shippingTotalCents: number | null | undefined; readonly source: CommerceOrderSourceEnum; - readonly state: CommerceOrderStateEnum; - readonly stateExpiresAt: string | null | undefined; readonly taxTotal: string | null | undefined; readonly taxTotalCents: number | null | undefined; } | null | undefined; @@ -553,56 +540,49 @@ v23 = [ }, (v12/*: any*/) ], -v24 = [ - { - "kind": "Literal", - "name": "first", - "value": 30 - } -], -v25 = { +v24 = { "enumValues": null, "nullable": false, "plural": false, "type": "String" }, -v26 = { +v25 = { "enumValues": null, "nullable": true, "plural": false, "type": "String" }, -v27 = { +v26 = { "enumValues": null, "nullable": false, "plural": false, "type": "ID" }, -v28 = { +v27 = { "enumValues": null, "nullable": false, "plural": false, "type": "Boolean" }, -v29 = { +v28 = { "enumValues": null, "nullable": false, "plural": false, "type": "Int" }, -v30 = { +v29 = { "enumValues": null, "nullable": true, "plural": false, "type": "CommerceOffer" }, -v31 = { +v30 = { "enumValues": null, "nullable": true, "plural": false, "type": "Int" }, -v32 = { +v31 = { "enumValues": [ "BUYER", "SELLER" @@ -611,13 +591,13 @@ v32 = { "plural": false, "type": "CommerceOrderParticipantEnum" }, -v33 = { +v32 = { "enumValues": null, "nullable": true, "plural": false, "type": "Boolean" }, -v34 = { +v33 = { "enumValues": null, "nullable": true, "plural": false, @@ -693,20 +673,6 @@ return { "name": "mode", "storageKey": null }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "state", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "source", - "storageKey": null - }, { "alias": null, "args": null, @@ -766,18 +732,67 @@ return { { "alias": null, "args": null, - "concreteType": "Artwork", + "concreteType": "CommerceShippingQuoteConnection", "kind": "LinkedField", - "name": "artwork", + "name": "shippingQuoteOptions", "plural": false, "selections": [ { "alias": null, "args": null, - "kind": "ScalarField", - "name": "slug", + "concreteType": "CommerceShippingQuoteEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "CommerceShippingQuote", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v12/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "isSelected", + "storageKey": null + }, + { + "alias": null, + "args": (v13/*: any*/), + "kind": "ScalarField", + "name": "price", + "storageKey": "price(precision:2)" + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "priceCents", + "storageKey": null + }, + (v14/*: any*/) + ], + "storageKey": null + } + ], "storageKey": null - }, + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "Artwork", + "kind": "LinkedField", + "name": "artwork", + "plural": false, + "selections": [ { "alias": null, "args": null, @@ -793,102 +808,53 @@ return { "storageKey": null }, { - "alias": "pickup_available", + "alias": null, "args": null, "kind": "ScalarField", - "name": "pickupAvailable", + "name": "onlyShipsDomestically", "storageKey": null }, { "alias": null, "args": null, "kind": "ScalarField", - "name": "onlyShipsDomestically", + "name": "euShippingOrigin", "storageKey": null }, { "alias": null, "args": null, "kind": "ScalarField", - "name": "euShippingOrigin", + "name": "shippingCountry", "storageKey": null }, + (v12/*: any*/), { "alias": null, "args": null, "kind": "ScalarField", - "name": "shippingCountry", + "name": "pickupAvailable", "storageKey": null }, - (v12/*: any*/), { "alias": null, "args": null, "kind": "ScalarField", - "name": "shippingOrigin", + "name": "slug", "storageKey": null }, { "alias": null, "args": null, "kind": "ScalarField", - "name": "isUnlisted", + "name": "shippingOrigin", "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteConnection", - "kind": "LinkedField", - "name": "shippingQuoteOptions", - "plural": false, - "selections": [ + }, { "alias": null, "args": null, - "concreteType": "CommerceShippingQuoteEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuote", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v12/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isSelected", - "storageKey": null - }, - { - "alias": null, - "args": (v13/*: any*/), - "kind": "ScalarField", - "name": "price", - "storageKey": "price(precision:2)" - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "priceCents", - "storageKey": null - }, - (v14/*: any*/) - ], - "storageKey": null - } - ], + "kind": "ScalarField", + "name": "isUnlisted", "storageKey": null } ], @@ -1015,20 +981,6 @@ return { ], "storageKey": null }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "displayState", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "stateExpiresAt", - "storageKey": null - }, { "alias": null, "args": null, @@ -1057,6 +1009,13 @@ return { "name": "currencyCode", "storageKey": null }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "source", + "storageKey": null + }, { "alias": null, "args": null, @@ -1064,6 +1023,13 @@ return { "name": "code", "storageKey": null }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "displayState", + "storageKey": null + }, (v18/*: any*/), (v19/*: any*/), (v20/*: any*/), @@ -1177,7 +1143,13 @@ return { }, { "alias": null, - "args": (v24/*: any*/), + "args": [ + { + "kind": "Literal", + "name": "first", + "value": 30 + } + ], "concreteType": "UserAddressConnection", "kind": "LinkedField", "name": "addressConnection", @@ -1229,71 +1201,15 @@ return { (v4/*: any*/), (v3/*: any*/), (v10/*: any*/), - (v8/*: any*/), - (v1/*: any*/) + (v8/*: any*/) ], "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "cursor", - "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "PageInfo", - "kind": "LinkedField", - "name": "pageInfo", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "endCursor", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasNextPage", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasPreviousPage", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "startCursor", - "storageKey": null } ], "storageKey": null } ], "storageKey": "addressConnection(first:30)" - }, - { - "alias": null, - "args": (v24/*: any*/), - "filters": null, - "handle": "connection", - "key": "SavedAddresses_addressConnection", - "kind": "LinkedHandle", - "name": "addressConnection" } ], "storageKey": null @@ -1301,7 +1217,7 @@ return { ] }, "params": { - "cacheID": "3310bb8be6014e7f34ce3789113ed118", + "cacheID": "e8785d49b0fa9df4fdf69f5bf2223870", "id": null, "metadata": { "relayTestingSelectionTypeInfo": { @@ -1323,59 +1239,47 @@ return { "plural": true, "type": "UserAddressEdge" }, - "me.addressConnection.edges.cursor": (v25/*: any*/), "me.addressConnection.edges.node": { "enumValues": null, "nullable": true, "plural": false, "type": "UserAddress" }, - "me.addressConnection.edges.node.__typename": (v25/*: any*/), - "me.addressConnection.edges.node.addressLine1": (v25/*: any*/), - "me.addressConnection.edges.node.addressLine2": (v26/*: any*/), - "me.addressConnection.edges.node.addressLine3": (v26/*: any*/), - "me.addressConnection.edges.node.city": (v25/*: any*/), - "me.addressConnection.edges.node.country": (v25/*: any*/), - "me.addressConnection.edges.node.id": (v27/*: any*/), - "me.addressConnection.edges.node.internalID": (v27/*: any*/), - "me.addressConnection.edges.node.isDefault": (v28/*: any*/), - "me.addressConnection.edges.node.name": (v26/*: any*/), - "me.addressConnection.edges.node.phoneNumber": (v26/*: any*/), - "me.addressConnection.edges.node.postalCode": (v26/*: any*/), - "me.addressConnection.edges.node.region": (v26/*: any*/), - "me.addressConnection.pageInfo": { - "enumValues": null, - "nullable": false, - "plural": false, - "type": "PageInfo" - }, - "me.addressConnection.pageInfo.endCursor": (v26/*: any*/), - "me.addressConnection.pageInfo.hasNextPage": (v28/*: any*/), - "me.addressConnection.pageInfo.hasPreviousPage": (v28/*: any*/), - "me.addressConnection.pageInfo.startCursor": (v26/*: any*/), - "me.addressConnection.totalCount": (v29/*: any*/), - "me.email": (v26/*: any*/), - "me.id": (v27/*: any*/), + "me.addressConnection.edges.node.addressLine1": (v24/*: any*/), + "me.addressConnection.edges.node.addressLine2": (v25/*: any*/), + "me.addressConnection.edges.node.addressLine3": (v25/*: any*/), + "me.addressConnection.edges.node.city": (v24/*: any*/), + "me.addressConnection.edges.node.country": (v24/*: any*/), + "me.addressConnection.edges.node.id": (v26/*: any*/), + "me.addressConnection.edges.node.internalID": (v26/*: any*/), + "me.addressConnection.edges.node.isDefault": (v27/*: any*/), + "me.addressConnection.edges.node.name": (v25/*: any*/), + "me.addressConnection.edges.node.phoneNumber": (v25/*: any*/), + "me.addressConnection.edges.node.postalCode": (v25/*: any*/), + "me.addressConnection.edges.node.region": (v25/*: any*/), + "me.addressConnection.totalCount": (v28/*: any*/), + "me.email": (v25/*: any*/), + "me.id": (v26/*: any*/), "me.location": { "enumValues": null, "nullable": true, "plural": false, "type": "MyLocation" }, - "me.location.country": (v26/*: any*/), - "me.location.id": (v27/*: any*/), - "me.name": (v26/*: any*/), + "me.location.country": (v25/*: any*/), + "me.location.id": (v26/*: any*/), + "me.name": (v25/*: any*/), "order": { "enumValues": null, "nullable": true, "plural": false, "type": "CommerceOrder" }, - "order.__isCommerceOrder": (v25/*: any*/), - "order.__typename": (v25/*: any*/), - "order.buyerTotal": (v26/*: any*/), - "order.code": (v25/*: any*/), - "order.currencyCode": (v25/*: any*/), + "order.__isCommerceOrder": (v24/*: any*/), + "order.__typename": (v24/*: any*/), + "order.buyerTotal": (v25/*: any*/), + "order.code": (v24/*: any*/), + "order.currencyCode": (v24/*: any*/), "order.displayState": { "enumValues": [ "ABANDONED", @@ -1394,22 +1298,22 @@ return { "plural": false, "type": "CommerceOrderDisplayStateEnum" }, - "order.id": (v27/*: any*/), - "order.internalID": (v27/*: any*/), - "order.itemsTotal": (v26/*: any*/), - "order.lastOffer": (v30/*: any*/), - "order.lastOffer.amount": (v26/*: any*/), - "order.lastOffer.amountCents": (v29/*: any*/), - "order.lastOffer.buyerTotal": (v26/*: any*/), - "order.lastOffer.buyerTotalCents": (v31/*: any*/), - "order.lastOffer.fromParticipant": (v32/*: any*/), - "order.lastOffer.id": (v27/*: any*/), - "order.lastOffer.internalID": (v27/*: any*/), - "order.lastOffer.note": (v26/*: any*/), - "order.lastOffer.shippingTotal": (v26/*: any*/), - "order.lastOffer.shippingTotalCents": (v31/*: any*/), - "order.lastOffer.taxTotal": (v26/*: any*/), - "order.lastOffer.taxTotalCents": (v31/*: any*/), + "order.id": (v26/*: any*/), + "order.internalID": (v26/*: any*/), + "order.itemsTotal": (v25/*: any*/), + "order.lastOffer": (v29/*: any*/), + "order.lastOffer.amount": (v25/*: any*/), + "order.lastOffer.amountCents": (v28/*: any*/), + "order.lastOffer.buyerTotal": (v25/*: any*/), + "order.lastOffer.buyerTotalCents": (v30/*: any*/), + "order.lastOffer.fromParticipant": (v31/*: any*/), + "order.lastOffer.id": (v26/*: any*/), + "order.lastOffer.internalID": (v26/*: any*/), + "order.lastOffer.note": (v25/*: any*/), + "order.lastOffer.shippingTotal": (v25/*: any*/), + "order.lastOffer.shippingTotalCents": (v30/*: any*/), + "order.lastOffer.taxTotal": (v25/*: any*/), + "order.lastOffer.taxTotalCents": (v30/*: any*/), "order.lineItems": { "enumValues": null, "nullable": true, @@ -1434,35 +1338,35 @@ return { "plural": false, "type": "Artwork" }, - "order.lineItems.edges.node.artwork.artsyShippingInternational": (v33/*: any*/), - "order.lineItems.edges.node.artwork.euShippingOrigin": (v33/*: any*/), - "order.lineItems.edges.node.artwork.id": (v27/*: any*/), - "order.lineItems.edges.node.artwork.isUnlisted": (v28/*: any*/), - "order.lineItems.edges.node.artwork.onlyShipsDomestically": (v33/*: any*/), - "order.lineItems.edges.node.artwork.pickup_available": (v33/*: any*/), - "order.lineItems.edges.node.artwork.processWithArtsyShippingDomestic": (v33/*: any*/), - "order.lineItems.edges.node.artwork.shippingCountry": (v26/*: any*/), - "order.lineItems.edges.node.artwork.shippingOrigin": (v26/*: any*/), - "order.lineItems.edges.node.artwork.slug": (v27/*: any*/), + "order.lineItems.edges.node.artwork.artsyShippingInternational": (v32/*: any*/), + "order.lineItems.edges.node.artwork.euShippingOrigin": (v32/*: any*/), + "order.lineItems.edges.node.artwork.id": (v26/*: any*/), + "order.lineItems.edges.node.artwork.isUnlisted": (v27/*: any*/), + "order.lineItems.edges.node.artwork.onlyShipsDomestically": (v32/*: any*/), + "order.lineItems.edges.node.artwork.pickupAvailable": (v32/*: any*/), + "order.lineItems.edges.node.artwork.processWithArtsyShippingDomestic": (v32/*: any*/), + "order.lineItems.edges.node.artwork.shippingCountry": (v25/*: any*/), + "order.lineItems.edges.node.artwork.shippingOrigin": (v25/*: any*/), + "order.lineItems.edges.node.artwork.slug": (v26/*: any*/), "order.lineItems.edges.node.artworkOrEditionSet": { "enumValues": null, "nullable": true, "plural": false, "type": "ArtworkOrEditionSetType" }, - "order.lineItems.edges.node.artworkOrEditionSet.__isNode": (v25/*: any*/), - "order.lineItems.edges.node.artworkOrEditionSet.__typename": (v25/*: any*/), - "order.lineItems.edges.node.artworkOrEditionSet.id": (v27/*: any*/), - "order.lineItems.edges.node.artworkOrEditionSet.price": (v26/*: any*/), + "order.lineItems.edges.node.artworkOrEditionSet.__isNode": (v24/*: any*/), + "order.lineItems.edges.node.artworkOrEditionSet.__typename": (v24/*: any*/), + "order.lineItems.edges.node.artworkOrEditionSet.id": (v26/*: any*/), + "order.lineItems.edges.node.artworkOrEditionSet.price": (v25/*: any*/), "order.lineItems.edges.node.artworkVersion": { "enumValues": null, "nullable": true, "plural": false, "type": "ArtworkVersion" }, - "order.lineItems.edges.node.artworkVersion.artistNames": (v26/*: any*/), - "order.lineItems.edges.node.artworkVersion.date": (v26/*: any*/), - "order.lineItems.edges.node.artworkVersion.id": (v27/*: any*/), + "order.lineItems.edges.node.artworkVersion.artistNames": (v25/*: any*/), + "order.lineItems.edges.node.artworkVersion.date": (v25/*: any*/), + "order.lineItems.edges.node.artworkVersion.id": (v26/*: any*/), "order.lineItems.edges.node.artworkVersion.image": { "enumValues": null, "nullable": true, @@ -1475,12 +1379,12 @@ return { "plural": false, "type": "ResizedImageUrl" }, - "order.lineItems.edges.node.artworkVersion.image.resized_ArtworkSummaryItem.url": (v25/*: any*/), - "order.lineItems.edges.node.artworkVersion.title": (v26/*: any*/), - "order.lineItems.edges.node.id": (v27/*: any*/), - "order.lineItems.edges.node.selectedShippingQuote": (v34/*: any*/), - "order.lineItems.edges.node.selectedShippingQuote.id": (v27/*: any*/), - "order.lineItems.edges.node.selectedShippingQuote.typeName": (v25/*: any*/), + "order.lineItems.edges.node.artworkVersion.image.resized_ArtworkSummaryItem.url": (v24/*: any*/), + "order.lineItems.edges.node.artworkVersion.title": (v25/*: any*/), + "order.lineItems.edges.node.id": (v26/*: any*/), + "order.lineItems.edges.node.selectedShippingQuote": (v33/*: any*/), + "order.lineItems.edges.node.selectedShippingQuote.id": (v26/*: any*/), + "order.lineItems.edges.node.selectedShippingQuote.typeName": (v24/*: any*/), "order.lineItems.edges.node.shippingQuoteOptions": { "enumValues": null, "nullable": true, @@ -1493,12 +1397,12 @@ return { "plural": true, "type": "CommerceShippingQuoteEdge" }, - "order.lineItems.edges.node.shippingQuoteOptions.edges.node": (v34/*: any*/), - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.id": (v27/*: any*/), - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.isSelected": (v28/*: any*/), - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.price": (v26/*: any*/), - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.priceCents": (v29/*: any*/), - "order.lineItems.edges.node.shippingQuoteOptions.edges.node.typeName": (v25/*: any*/), + "order.lineItems.edges.node.shippingQuoteOptions.edges.node": (v33/*: any*/), + "order.lineItems.edges.node.shippingQuoteOptions.edges.node.id": (v26/*: any*/), + "order.lineItems.edges.node.shippingQuoteOptions.edges.node.isSelected": (v27/*: any*/), + "order.lineItems.edges.node.shippingQuoteOptions.edges.node.price": (v25/*: any*/), + "order.lineItems.edges.node.shippingQuoteOptions.edges.node.priceCents": (v28/*: any*/), + "order.lineItems.edges.node.shippingQuoteOptions.edges.node.typeName": (v24/*: any*/), "order.mode": { "enumValues": [ "BUY", @@ -1508,55 +1412,55 @@ return { "plural": false, "type": "CommerceOrderModeEnum" }, - "order.myLastOffer": (v30/*: any*/), - "order.myLastOffer.amount": (v26/*: any*/), - "order.myLastOffer.amountCents": (v29/*: any*/), - "order.myLastOffer.buyerTotal": (v26/*: any*/), - "order.myLastOffer.buyerTotalCents": (v31/*: any*/), - "order.myLastOffer.fromParticipant": (v32/*: any*/), - "order.myLastOffer.id": (v27/*: any*/), - "order.myLastOffer.internalID": (v27/*: any*/), - "order.myLastOffer.note": (v26/*: any*/), - "order.myLastOffer.shippingTotal": (v26/*: any*/), - "order.myLastOffer.shippingTotalCents": (v31/*: any*/), - "order.myLastOffer.taxTotal": (v26/*: any*/), - "order.myLastOffer.taxTotalCents": (v31/*: any*/), + "order.myLastOffer": (v29/*: any*/), + "order.myLastOffer.amount": (v25/*: any*/), + "order.myLastOffer.amountCents": (v28/*: any*/), + "order.myLastOffer.buyerTotal": (v25/*: any*/), + "order.myLastOffer.buyerTotalCents": (v30/*: any*/), + "order.myLastOffer.fromParticipant": (v31/*: any*/), + "order.myLastOffer.id": (v26/*: any*/), + "order.myLastOffer.internalID": (v26/*: any*/), + "order.myLastOffer.note": (v25/*: any*/), + "order.myLastOffer.shippingTotal": (v25/*: any*/), + "order.myLastOffer.shippingTotalCents": (v30/*: any*/), + "order.myLastOffer.taxTotal": (v25/*: any*/), + "order.myLastOffer.taxTotalCents": (v30/*: any*/), "order.paymentMethodDetails": { "enumValues": null, "nullable": true, "plural": false, "type": "PaymentMethodUnion" }, - "order.paymentMethodDetails.__typename": (v25/*: any*/), - "order.paymentMethodDetails.id": (v27/*: any*/), - "order.paymentMethodDetails.isManualPayment": (v28/*: any*/), + "order.paymentMethodDetails.__typename": (v24/*: any*/), + "order.paymentMethodDetails.id": (v26/*: any*/), + "order.paymentMethodDetails.isManualPayment": (v27/*: any*/), "order.requestedFulfillment": { "enumValues": null, "nullable": true, "plural": false, "type": "CommerceRequestedFulfillmentUnion" }, - "order.requestedFulfillment.__typename": (v25/*: any*/), - "order.requestedFulfillment.addressLine1": (v26/*: any*/), - "order.requestedFulfillment.addressLine2": (v26/*: any*/), - "order.requestedFulfillment.city": (v26/*: any*/), - "order.requestedFulfillment.country": (v26/*: any*/), - "order.requestedFulfillment.name": (v26/*: any*/), - "order.requestedFulfillment.phoneNumber": (v26/*: any*/), - "order.requestedFulfillment.postalCode": (v26/*: any*/), - "order.requestedFulfillment.region": (v26/*: any*/), + "order.requestedFulfillment.__typename": (v24/*: any*/), + "order.requestedFulfillment.addressLine1": (v25/*: any*/), + "order.requestedFulfillment.addressLine2": (v25/*: any*/), + "order.requestedFulfillment.city": (v25/*: any*/), + "order.requestedFulfillment.country": (v25/*: any*/), + "order.requestedFulfillment.name": (v25/*: any*/), + "order.requestedFulfillment.phoneNumber": (v25/*: any*/), + "order.requestedFulfillment.postalCode": (v25/*: any*/), + "order.requestedFulfillment.region": (v25/*: any*/), "order.sellerDetails": { "enumValues": null, "nullable": true, "plural": false, "type": "OrderParty" }, - "order.sellerDetails.__isNode": (v25/*: any*/), - "order.sellerDetails.__typename": (v25/*: any*/), - "order.sellerDetails.id": (v27/*: any*/), - "order.sellerDetails.name": (v26/*: any*/), - "order.shippingTotal": (v26/*: any*/), - "order.shippingTotalCents": (v31/*: any*/), + "order.sellerDetails.__isNode": (v24/*: any*/), + "order.sellerDetails.__typename": (v24/*: any*/), + "order.sellerDetails.id": (v26/*: any*/), + "order.sellerDetails.name": (v25/*: any*/), + "order.shippingTotal": (v25/*: any*/), + "order.shippingTotalCents": (v30/*: any*/), "order.source": { "enumValues": [ "artwork_page", @@ -1568,34 +1472,17 @@ return { "plural": false, "type": "CommerceOrderSourceEnum" }, - "order.state": { - "enumValues": [ - "ABANDONED", - "APPROVED", - "CANCELED", - "FULFILLED", - "IN_REVIEW", - "PENDING", - "PROCESSING_APPROVAL", - "REFUNDED", - "SUBMITTED" - ], - "nullable": false, - "plural": false, - "type": "CommerceOrderStateEnum" - }, - "order.stateExpiresAt": (v26/*: any*/), - "order.taxTotal": (v26/*: any*/), - "order.taxTotalCents": (v31/*: any*/) + "order.taxTotal": (v25/*: any*/), + "order.taxTotalCents": (v30/*: any*/) } }, "name": "ShippingTestQuery", "operationKind": "query", - "text": "query ShippingTestQuery {\n order: commerceOrder(id: \"unused\") {\n __typename\n ...Shipping_order\n id\n }\n me {\n ...Shipping_me\n id\n }\n}\n\nfragment ArtworkSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n sellerDetails {\n __typename\n ... on Partner {\n name\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n currencyCode\n mode\n source\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n artwork {\n slug\n shippingOrigin\n isUnlisted\n id\n }\n artworkVersion {\n date\n artistNames\n title\n image {\n resized_ArtworkSummaryItem: resized(width: 55) {\n url\n }\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment OrderStepper_order on CommerceOrder {\n __isCommerceOrder: __typename\n mode\n requestedFulfillment {\n __typename\n }\n paymentMethodDetails {\n __typename\n ... on CreditCard {\n id\n }\n ... on BankAccount {\n id\n }\n ... on WireTransfer {\n isManualPayment\n }\n }\n lineItems {\n edges {\n node {\n artwork {\n slug\n id\n }\n shippingQuoteOptions {\n edges {\n node {\n isSelected\n id\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment PartnerOfferTimerItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n displayState\n stateExpiresAt\n}\n\nfragment SavedAddresses_me on Me {\n id\n addressConnection(first: 30) {\n totalCount\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n}\n\nfragment ShippingQuotes_shippingQuotes on CommerceShippingQuoteEdge {\n node {\n id\n isSelected\n price(precision: 2)\n priceCents\n typeName\n }\n}\n\nfragment Shipping_me on Me {\n name\n email\n id\n location {\n country\n id\n }\n ...SavedAddresses_me\n addressConnection(first: 30) {\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n\nfragment Shipping_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n mode\n state\n source\n requestedFulfillment {\n __typename\n ... on CommercePickup {\n phoneNumber\n }\n ... on CommerceShip {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n ... on CommerceShipArta {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n }\n lineItems {\n edges {\n node {\n artwork {\n slug\n processWithArtsyShippingDomestic\n artsyShippingInternational\n pickup_available: pickupAvailable\n onlyShipsDomestically\n euShippingOrigin\n shippingCountry\n id\n }\n shippingQuoteOptions {\n edges {\n ...ShippingQuotes_shippingQuotes\n node {\n id\n isSelected\n }\n }\n }\n id\n }\n }\n }\n ...PartnerOfferTimerItem_order\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n}\n\nfragment TransactionDetailsSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n __typename\n requestedFulfillment {\n __typename\n }\n code\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n selectedShippingQuote {\n typeName\n id\n }\n id\n }\n }\n }\n mode\n source\n displayState\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n itemsTotal(precision: 2)\n buyerTotal(precision: 2)\n currencyCode\n ... on CommerceOfferOrder {\n lastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n myLastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n }\n}\n" + "text": "query ShippingTestQuery {\n order: commerceOrder(id: \"unused\") {\n __typename\n ...Shipping_order\n id\n }\n me {\n ...Shipping_me\n id\n }\n}\n\nfragment ArtworkSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n sellerDetails {\n __typename\n ... on Partner {\n name\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n currencyCode\n mode\n source\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n artwork {\n slug\n shippingOrigin\n isUnlisted\n id\n }\n artworkVersion {\n date\n artistNames\n title\n image {\n resized_ArtworkSummaryItem: resized(width: 55) {\n url\n }\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_me on Me {\n name\n email\n id\n location {\n country\n id\n }\n addressConnection(first: 30) {\n totalCount\n }\n}\n\nfragment FulfillmentDetailsForm_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n lineItems {\n edges {\n node {\n artwork {\n pickupAvailable\n id\n }\n id\n }\n }\n }\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n}\n\nfragment OrderStepper_order on CommerceOrder {\n __isCommerceOrder: __typename\n mode\n requestedFulfillment {\n __typename\n }\n paymentMethodDetails {\n __typename\n ... on CreditCard {\n id\n }\n ... on BankAccount {\n id\n }\n ... on WireTransfer {\n isManualPayment\n }\n }\n lineItems {\n edges {\n node {\n artwork {\n slug\n id\n }\n shippingQuoteOptions {\n edges {\n node {\n isSelected\n id\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment SaveAndContinueButton_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n}\n\nfragment ShippingContext_me_dXEtb on Me {\n addressConnection(first: 30) {\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n\nfragment ShippingContext_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n mode\n requestedFulfillment {\n __typename\n ... on CommercePickup {\n phoneNumber\n }\n ... on CommerceShip {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n ... on CommerceShipArta {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n }\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n }\n }\n }\n artwork {\n processWithArtsyShippingDomestic\n artsyShippingInternational\n onlyShipsDomestically\n euShippingOrigin\n shippingCountry\n id\n }\n id\n }\n }\n }\n}\n\nfragment ShippingQuotes_order on CommerceOrder {\n __isCommerceOrder: __typename\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n price(precision: 2)\n priceCents\n typeName\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment Shipping_me on Me {\n ...FulfillmentDetailsForm_me\n ...ShippingContext_me_dXEtb\n}\n\nfragment Shipping_order on CommerceOrder {\n __isCommerceOrder: __typename\n ...ShippingContext_order\n ...FulfillmentDetailsForm_order\n ...SaveAndContinueButton_order\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n ...ShippingQuotes_order\n internalID\n}\n\nfragment TransactionDetailsSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n __typename\n requestedFulfillment {\n __typename\n }\n code\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n selectedShippingQuote {\n typeName\n id\n }\n id\n }\n }\n }\n mode\n source\n displayState\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n itemsTotal(precision: 2)\n buyerTotal(precision: 2)\n currencyCode\n ... on CommerceOfferOrder {\n lastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n myLastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n }\n}\n" } }; })(); -(node as any).hash = "cc8cc8d2e2ba983cb4feafe5a93c21eb"; +(node as any).hash = "3537e667bd8f220d28966e5e72eba0bc"; export default node; diff --git a/src/__generated__/Shipping_me.graphql.ts b/src/__generated__/Shipping_me.graphql.ts index 90515a16d11..ff97f19dc8b 100644 --- a/src/__generated__/Shipping_me.graphql.ts +++ b/src/__generated__/Shipping_me.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<0e8b7f5f13ad6f14e875f227e6987433>> * @lightSyntaxTransform * @nogrep */ @@ -11,31 +11,7 @@ import { Fragment, ReaderFragment } from 'relay-runtime'; import { FragmentRefs } from "relay-runtime"; export type Shipping_me$data = { - readonly addressConnection: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly addressLine1: string; - readonly addressLine2: string | null | undefined; - readonly addressLine3: string | null | undefined; - readonly city: string; - readonly country: string; - readonly id: string; - readonly internalID: string; - readonly isDefault: boolean; - readonly name: string | null | undefined; - readonly phoneNumber: string | null | undefined; - readonly postalCode: string | null | undefined; - readonly region: string | null | undefined; - } | null | undefined; - } | null | undefined> | null | undefined; - } | null | undefined; - readonly email: string | null | undefined; - readonly id: string; - readonly location: { - readonly country: string | null | undefined; - } | null | undefined; - readonly name: string | null | undefined; - readonly " $fragmentSpreads": FragmentRefs<"SavedAddresses_me">; + readonly " $fragmentSpreads": FragmentRefs<"FulfillmentDetailsForm_me" | "ShippingContext_me">; readonly " $fragmentType": "Shipping_me"; }; export type Shipping_me$key = { @@ -43,29 +19,7 @@ export type Shipping_me$key = { readonly " $fragmentSpreads": FragmentRefs<"Shipping_me">; }; -const node: ReaderFragment = (function(){ -var v0 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null -}, -v1 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null -}, -v2 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "country", - "storageKey": null -}; -return { +const node: ReaderFragment = { "argumentDefinitions": [ { "defaultValue": null, @@ -92,34 +46,12 @@ return { "metadata": null, "name": "Shipping_me", "selections": [ - (v0/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "email", - "storageKey": null - }, - (v1/*: any*/), - { - "alias": null, - "args": null, - "concreteType": "MyLocation", - "kind": "LinkedField", - "name": "location", - "plural": false, - "selections": [ - (v2/*: any*/) - ], - "storageKey": null - }, { "args": null, "kind": "FragmentSpread", - "name": "SavedAddresses_me" + "name": "FulfillmentDetailsForm_me" }, { - "alias": null, "args": [ { "kind": "Variable", @@ -142,108 +74,14 @@ return { "variableName": "last" } ], - "concreteType": "UserAddressConnection", - "kind": "LinkedField", - "name": "addressConnection", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "UserAddressEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "UserAddress", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v1/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "internalID", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine1", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine2", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine3", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "city", - "storageKey": null - }, - (v2/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isDefault", - "storageKey": null - }, - (v0/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "phoneNumber", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "postalCode", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "region", - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null + "kind": "FragmentSpread", + "name": "ShippingContext_me" } ], "type": "Me", "abstractKey": null }; -})(); -(node as any).hash = "e31c45b18a2f038be369d1101419baaa"; +(node as any).hash = "333ca775bab381e61be0a76ce53046c1"; export default node; diff --git a/src/__generated__/Shipping_order.graphql.ts b/src/__generated__/Shipping_order.graphql.ts index 84456a0de15..b82d4a4f51d 100644 --- a/src/__generated__/Shipping_order.graphql.ts +++ b/src/__generated__/Shipping_order.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<24a6ee24fd5f36f74094df35c2b49d50>> + * @generated SignedSource<<7209f7bdbcf6b64bfa4e7e134549d256>> * @lightSyntaxTransform * @nogrep */ @@ -9,68 +9,10 @@ // @ts-nocheck import { Fragment, ReaderFragment } from 'relay-runtime'; -export type CommerceOrderModeEnum = "BUY" | "OFFER" | "%future added value"; -export type CommerceOrderSourceEnum = "artwork_page" | "inquiry" | "partner_offer" | "private_sale" | "%future added value"; -export type CommerceOrderStateEnum = "ABANDONED" | "APPROVED" | "CANCELED" | "FULFILLED" | "IN_REVIEW" | "PENDING" | "PROCESSING_APPROVAL" | "REFUNDED" | "SUBMITTED" | "%future added value"; import { FragmentRefs } from "relay-runtime"; export type Shipping_order$data = { readonly internalID: string; - readonly lineItems: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly artwork: { - readonly artsyShippingInternational: boolean | null | undefined; - readonly euShippingOrigin: boolean | null | undefined; - readonly onlyShipsDomestically: boolean | null | undefined; - readonly pickup_available: boolean | null | undefined; - readonly processWithArtsyShippingDomestic: boolean | null | undefined; - readonly shippingCountry: string | null | undefined; - readonly slug: string; - } | null | undefined; - readonly shippingQuoteOptions: { - readonly edges: ReadonlyArray<{ - readonly node: { - readonly id: string; - readonly isSelected: boolean; - } | null | undefined; - readonly " $fragmentSpreads": FragmentRefs<"ShippingQuotes_shippingQuotes">; - } | null | undefined> | null | undefined; - } | null | undefined; - } | null | undefined; - } | null | undefined> | null | undefined; - } | null | undefined; - readonly mode: CommerceOrderModeEnum | null | undefined; - readonly requestedFulfillment: { - readonly __typename: "CommercePickup"; - readonly phoneNumber: string | null | undefined; - } | { - readonly __typename: "CommerceShip"; - readonly addressLine1: string | null | undefined; - readonly addressLine2: string | null | undefined; - readonly city: string | null | undefined; - readonly country: string | null | undefined; - readonly name: string | null | undefined; - readonly phoneNumber: string | null | undefined; - readonly postalCode: string | null | undefined; - readonly region: string | null | undefined; - } | { - readonly __typename: "CommerceShipArta"; - readonly addressLine1: string | null | undefined; - readonly addressLine2: string | null | undefined; - readonly city: string | null | undefined; - readonly country: string | null | undefined; - readonly name: string | null | undefined; - readonly phoneNumber: string | null | undefined; - readonly postalCode: string | null | undefined; - readonly region: string | null | undefined; - } | { - // This will never be '%other', but we need some - // value in case none of the concrete values match. - readonly __typename: "%other"; - } | null | undefined; - readonly source: CommerceOrderSourceEnum; - readonly state: CommerceOrderStateEnum; - readonly " $fragmentSpreads": FragmentRefs<"ArtworkSummaryItem_order" | "OrderStepper_order" | "PartnerOfferTimerItem_order" | "TransactionDetailsSummaryItem_order">; + readonly " $fragmentSpreads": FragmentRefs<"ArtworkSummaryItem_order" | "FulfillmentDetailsForm_order" | "OrderStepper_order" | "SaveAndContinueButton_order" | "ShippingContext_order" | "ShippingQuotes_order" | "TransactionDetailsSummaryItem_order">; readonly " $fragmentType": "Shipping_order"; }; export type Shipping_order$key = { @@ -78,309 +20,59 @@ export type Shipping_order$key = { readonly " $fragmentSpreads": FragmentRefs<"Shipping_order">; }; -const node: ReaderFragment = (function(){ -var v0 = { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "phoneNumber", - "storageKey": null -}, -v1 = [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine1", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine2", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "city", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "region", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "country", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "postalCode", - "storageKey": null - }, - (v0/*: any*/) -]; -return { +const node: ReaderFragment = { "argumentDefinitions": [], "kind": "Fragment", "metadata": null, "name": "Shipping_order", "selections": [ { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "internalID", - "storageKey": null - }, - { - "alias": null, "args": null, - "kind": "ScalarField", - "name": "mode", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "state", - "storageKey": null + "kind": "FragmentSpread", + "name": "ShippingContext_order" }, { - "alias": null, "args": null, - "kind": "ScalarField", - "name": "source", - "storageKey": null + "kind": "FragmentSpread", + "name": "FulfillmentDetailsForm_order" }, { - "alias": null, "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "requestedFulfillment", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null - }, - { - "kind": "InlineFragment", - "selections": [ - (v0/*: any*/) - ], - "type": "CommercePickup", - "abstractKey": null - }, - { - "kind": "InlineFragment", - "selections": (v1/*: any*/), - "type": "CommerceShip", - "abstractKey": null - }, - { - "kind": "InlineFragment", - "selections": (v1/*: any*/), - "type": "CommerceShipArta", - "abstractKey": null - } - ], - "storageKey": null + "kind": "FragmentSpread", + "name": "SaveAndContinueButton_order" }, { - "alias": null, "args": null, - "concreteType": "CommerceLineItemConnection", - "kind": "LinkedField", - "name": "lineItems", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItemEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceLineItem", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "Artwork", - "kind": "LinkedField", - "name": "artwork", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "slug", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "processWithArtsyShippingDomestic", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "artsyShippingInternational", - "storageKey": null - }, - { - "alias": "pickup_available", - "args": null, - "kind": "ScalarField", - "name": "pickupAvailable", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "onlyShipsDomestically", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "euShippingOrigin", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "shippingCountry", - "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteConnection", - "kind": "LinkedField", - "name": "shippingQuoteOptions", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "args": null, - "kind": "FragmentSpread", - "name": "ShippingQuotes_shippingQuotes" - }, - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuote", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isSelected", - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "storageKey": null + "kind": "FragmentSpread", + "name": "ArtworkSummaryItem_order" }, { "args": null, "kind": "FragmentSpread", - "name": "PartnerOfferTimerItem_order" + "name": "TransactionDetailsSummaryItem_order" }, { "args": null, "kind": "FragmentSpread", - "name": "ArtworkSummaryItem_order" + "name": "OrderStepper_order" }, { "args": null, "kind": "FragmentSpread", - "name": "TransactionDetailsSummaryItem_order" + "name": "ShippingQuotes_order" }, { + "alias": null, "args": null, - "kind": "FragmentSpread", - "name": "OrderStepper_order" + "kind": "ScalarField", + "name": "internalID", + "storageKey": null } ], "type": "CommerceOrder", "abstractKey": "__isCommerceOrder" }; -})(); -(node as any).hash = "be65a788c0766823a09bf75b37e2c742"; +(node as any).hash = "7cb307555b00ab6c4a9474586a1c3943"; export default node; diff --git a/src/__generated__/UpdateUserAddressMutation.graphql.ts b/src/__generated__/UpdateUserAddressMutation.graphql.ts deleted file mode 100644 index 98addc8c7af..00000000000 --- a/src/__generated__/UpdateUserAddressMutation.graphql.ts +++ /dev/null @@ -1,276 +0,0 @@ -/** - * @generated SignedSource<<8eb577337a9c2691c884a0c491df2c87>> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { ConcreteRequest, Mutation } from 'relay-runtime'; -export type UpdateUserAddressInput = { - attributes: UserAddressAttributes; - clientMutationId?: string | null | undefined; - userAddressID: string; -}; -export type UserAddressAttributes = { - addressLine1: string; - addressLine2?: string | null | undefined; - addressLine3?: string | null | undefined; - city: string; - country: string; - name: string; - phoneNumber?: string | null | undefined; - phoneNumberCountryCode?: string | null | undefined; - postalCode?: string | null | undefined; - region?: string | null | undefined; -}; -export type UpdateUserAddressMutation$variables = { - input: UpdateUserAddressInput; -}; -export type UpdateUserAddressMutation$data = { - readonly updateUserAddress: { - readonly userAddressOrErrors: { - readonly addressLine1?: string; - readonly addressLine2?: string | null | undefined; - readonly city?: string; - readonly country?: string; - readonly errors?: ReadonlyArray<{ - readonly code: string; - readonly message: string; - }>; - readonly id?: string; - readonly internalID?: string; - readonly isDefault?: boolean; - readonly name?: string | null | undefined; - readonly phoneNumber?: string | null | undefined; - readonly postalCode?: string | null | undefined; - readonly region?: string | null | undefined; - }; - } | null | undefined; -}; -export type UpdateUserAddressMutation = { - response: UpdateUserAddressMutation$data; - variables: UpdateUserAddressMutation$variables; -}; - -const node: ConcreteRequest = (function(){ -var v0 = [ - { - "defaultValue": null, - "kind": "LocalArgument", - "name": "input" - } -], -v1 = [ - { - "kind": "Variable", - "name": "input", - "variableName": "input" - } -], -v2 = { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "internalID", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine1", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine2", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isDefault", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "phoneNumber", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "city", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "region", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "postalCode", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "country", - "storageKey": null - } - ], - "type": "UserAddress", - "abstractKey": null -}, -v3 = { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "Error", - "kind": "LinkedField", - "name": "errors", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "code", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "message", - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "Errors", - "abstractKey": null -}; -return { - "fragment": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Fragment", - "metadata": null, - "name": "UpdateUserAddressMutation", - "selections": [ - { - "alias": null, - "args": (v1/*: any*/), - "concreteType": "UpdateUserAddressPayload", - "kind": "LinkedField", - "name": "updateUserAddress", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "userAddressOrErrors", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "Mutation", - "abstractKey": null - }, - "kind": "Request", - "operation": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Operation", - "name": "UpdateUserAddressMutation", - "selections": [ - { - "alias": null, - "args": (v1/*: any*/), - "concreteType": "UpdateUserAddressPayload", - "kind": "LinkedField", - "name": "updateUserAddress", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "userAddressOrErrors", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null - }, - (v2/*: any*/), - (v3/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ] - }, - "params": { - "cacheID": "2948f4a87297f060d1e28b1bf12be160", - "id": null, - "metadata": {}, - "name": "UpdateUserAddressMutation", - "operationKind": "mutation", - "text": "mutation UpdateUserAddressMutation(\n $input: UpdateUserAddressInput!\n) {\n updateUserAddress(input: $input) {\n userAddressOrErrors {\n __typename\n ... on UserAddress {\n id\n internalID\n name\n addressLine1\n addressLine2\n isDefault\n phoneNumber\n city\n region\n postalCode\n country\n }\n ... on Errors {\n errors {\n code\n message\n }\n }\n }\n }\n}\n" - } -}; -})(); - -(node as any).hash = "c0b17f3129542653a592f68b76865ace"; - -export default node; diff --git a/src/__generated__/UpdateUserDefaultAddressMutation.graphql.ts b/src/__generated__/UpdateUserDefaultAddressMutation.graphql.ts deleted file mode 100644 index 74a498d1e10..00000000000 --- a/src/__generated__/UpdateUserDefaultAddressMutation.graphql.ts +++ /dev/null @@ -1,263 +0,0 @@ -/** - * @generated SignedSource<> - * @lightSyntaxTransform - * @nogrep - */ - -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck - -import { ConcreteRequest, Mutation } from 'relay-runtime'; -export type UpdateUserDefaultAddressInput = { - clientMutationId?: string | null | undefined; - userAddressID: string; -}; -export type UpdateUserDefaultAddressMutation$variables = { - input: UpdateUserDefaultAddressInput; -}; -export type UpdateUserDefaultAddressMutation$data = { - readonly updateUserDefaultAddress: { - readonly userAddressOrErrors: { - readonly addressLine1?: string; - readonly addressLine2?: string | null | undefined; - readonly city?: string; - readonly country?: string; - readonly errors?: ReadonlyArray<{ - readonly code: string; - readonly message: string; - }>; - readonly id?: string; - readonly internalID?: string; - readonly isDefault?: boolean; - readonly name?: string | null | undefined; - readonly phoneNumber?: string | null | undefined; - readonly postalCode?: string | null | undefined; - readonly region?: string | null | undefined; - }; - } | null | undefined; -}; -export type UpdateUserDefaultAddressMutation = { - response: UpdateUserDefaultAddressMutation$data; - variables: UpdateUserDefaultAddressMutation$variables; -}; - -const node: ConcreteRequest = (function(){ -var v0 = [ - { - "defaultValue": null, - "kind": "LocalArgument", - "name": "input" - } -], -v1 = [ - { - "kind": "Variable", - "name": "input", - "variableName": "input" - } -], -v2 = { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "id", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "internalID", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "name", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine1", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "addressLine2", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isDefault", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "phoneNumber", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "city", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "region", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "postalCode", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "country", - "storageKey": null - } - ], - "type": "UserAddress", - "abstractKey": null -}, -v3 = { - "kind": "InlineFragment", - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "Error", - "kind": "LinkedField", - "name": "errors", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "code", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "message", - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "Errors", - "abstractKey": null -}; -return { - "fragment": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Fragment", - "metadata": null, - "name": "UpdateUserDefaultAddressMutation", - "selections": [ - { - "alias": null, - "args": (v1/*: any*/), - "concreteType": "UpdateUserDefaultAddressPayload", - "kind": "LinkedField", - "name": "updateUserDefaultAddress", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "userAddressOrErrors", - "plural": false, - "selections": [ - (v2/*: any*/), - (v3/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ], - "type": "Mutation", - "abstractKey": null - }, - "kind": "Request", - "operation": { - "argumentDefinitions": (v0/*: any*/), - "kind": "Operation", - "name": "UpdateUserDefaultAddressMutation", - "selections": [ - { - "alias": null, - "args": (v1/*: any*/), - "concreteType": "UpdateUserDefaultAddressPayload", - "kind": "LinkedField", - "name": "updateUserDefaultAddress", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": null, - "kind": "LinkedField", - "name": "userAddressOrErrors", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "__typename", - "storageKey": null - }, - (v2/*: any*/), - (v3/*: any*/) - ], - "storageKey": null - } - ], - "storageKey": null - } - ] - }, - "params": { - "cacheID": "5e9e5162f7c6f605d088c7bffb35311e", - "id": null, - "metadata": {}, - "name": "UpdateUserDefaultAddressMutation", - "operationKind": "mutation", - "text": "mutation UpdateUserDefaultAddressMutation(\n $input: UpdateUserDefaultAddressInput!\n) {\n updateUserDefaultAddress(input: $input) {\n userAddressOrErrors {\n __typename\n ... on UserAddress {\n id\n internalID\n name\n addressLine1\n addressLine2\n isDefault\n phoneNumber\n city\n region\n postalCode\n country\n }\n ... on Errors {\n errors {\n code\n message\n }\n }\n }\n }\n}\n" - } -}; -})(); - -(node as any).hash = "a91243f6ed1da1e43502af686ebf3823"; - -export default node; diff --git a/src/__generated__/orderRoutes_ShippingQuery.graphql.ts b/src/__generated__/orderRoutes_ShippingQuery.graphql.ts index b95c381714e..6b62a588cd2 100644 --- a/src/__generated__/orderRoutes_ShippingQuery.graphql.ts +++ b/src/__generated__/orderRoutes_ShippingQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<76cfbf65f882951be9595dcaec06acb8>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -15,10 +15,10 @@ export type orderRoutes_ShippingQuery$variables = { }; export type orderRoutes_ShippingQuery$data = { readonly me: { - readonly " $fragmentSpreads": FragmentRefs<"Shipping2_me" | "Shipping_me">; + readonly " $fragmentSpreads": FragmentRefs<"Shipping_me">; } | null | undefined; readonly order: { - readonly " $fragmentSpreads": FragmentRefs<"Shipping2_order" | "Shipping_order">; + readonly " $fragmentSpreads": FragmentRefs<"Shipping_order">; } | null | undefined; }; export type orderRoutes_ShippingQuery = { @@ -236,13 +236,6 @@ v24 = [ "storageKey": null }, (v13/*: any*/) -], -v25 = [ - { - "kind": "Literal", - "name": "first", - "value": 30 - } ]; return { "fragment": { @@ -263,11 +256,6 @@ return { "args": null, "kind": "FragmentSpread", "name": "Shipping_order" - }, - { - "args": null, - "kind": "FragmentSpread", - "name": "Shipping2_order" } ], "storageKey": null @@ -284,11 +272,6 @@ return { "args": null, "kind": "FragmentSpread", "name": "Shipping_me" - }, - { - "args": null, - "kind": "FragmentSpread", - "name": "Shipping2_me" } ], "storageKey": null @@ -324,20 +307,6 @@ return { "name": "mode", "storageKey": null }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "state", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "source", - "storageKey": null - }, { "alias": null, "args": null, @@ -397,18 +366,67 @@ return { { "alias": null, "args": null, - "concreteType": "Artwork", + "concreteType": "CommerceShippingQuoteConnection", "kind": "LinkedField", - "name": "artwork", + "name": "shippingQuoteOptions", "plural": false, "selections": [ { "alias": null, "args": null, - "kind": "ScalarField", - "name": "slug", + "concreteType": "CommerceShippingQuoteEdge", + "kind": "LinkedField", + "name": "edges", + "plural": true, + "selections": [ + { + "alias": null, + "args": null, + "concreteType": "CommerceShippingQuote", + "kind": "LinkedField", + "name": "node", + "plural": false, + "selections": [ + (v13/*: any*/), + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "isSelected", + "storageKey": null + }, + { + "alias": null, + "args": (v14/*: any*/), + "kind": "ScalarField", + "name": "price", + "storageKey": "price(precision:2)" + }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "priceCents", + "storageKey": null + }, + (v15/*: any*/) + ], + "storageKey": null + } + ], "storageKey": null - }, + } + ], + "storageKey": null + }, + { + "alias": null, + "args": null, + "concreteType": "Artwork", + "kind": "LinkedField", + "name": "artwork", + "plural": false, + "selections": [ { "alias": null, "args": null, @@ -423,13 +441,6 @@ return { "name": "artsyShippingInternational", "storageKey": null }, - { - "alias": "pickup_available", - "args": null, - "kind": "ScalarField", - "name": "pickupAvailable", - "storageKey": null - }, { "alias": null, "args": null, @@ -456,77 +467,28 @@ return { "alias": null, "args": null, "kind": "ScalarField", - "name": "shippingOrigin", + "name": "pickupAvailable", "storageKey": null }, { "alias": null, "args": null, "kind": "ScalarField", - "name": "isUnlisted", + "name": "slug", "storageKey": null }, { "alias": null, "args": null, "kind": "ScalarField", - "name": "pickupAvailable", + "name": "shippingOrigin", "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuoteConnection", - "kind": "LinkedField", - "name": "shippingQuoteOptions", - "plural": false, - "selections": [ + }, { "alias": null, "args": null, - "concreteType": "CommerceShippingQuoteEdge", - "kind": "LinkedField", - "name": "edges", - "plural": true, - "selections": [ - { - "alias": null, - "args": null, - "concreteType": "CommerceShippingQuote", - "kind": "LinkedField", - "name": "node", - "plural": false, - "selections": [ - (v13/*: any*/), - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "isSelected", - "storageKey": null - }, - { - "alias": null, - "args": (v14/*: any*/), - "kind": "ScalarField", - "name": "price", - "storageKey": "price(precision:2)" - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "priceCents", - "storageKey": null - }, - (v15/*: any*/) - ], - "storageKey": null - } - ], + "kind": "ScalarField", + "name": "isUnlisted", "storageKey": null } ], @@ -653,20 +615,6 @@ return { ], "storageKey": null }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "displayState", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "stateExpiresAt", - "storageKey": null - }, { "alias": null, "args": null, @@ -695,6 +643,13 @@ return { "name": "currencyCode", "storageKey": null }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "source", + "storageKey": null + }, { "alias": null, "args": null, @@ -702,6 +657,13 @@ return { "name": "code", "storageKey": null }, + { + "alias": null, + "args": null, + "kind": "ScalarField", + "name": "displayState", + "storageKey": null + }, (v19/*: any*/), (v20/*: any*/), (v21/*: any*/), @@ -815,7 +777,13 @@ return { }, { "alias": null, - "args": (v25/*: any*/), + "args": [ + { + "kind": "Literal", + "name": "first", + "value": 30 + } + ], "concreteType": "UserAddressConnection", "kind": "LinkedField", "name": "addressConnection", @@ -867,71 +835,15 @@ return { (v5/*: any*/), (v4/*: any*/), (v11/*: any*/), - (v9/*: any*/), - (v2/*: any*/) + (v9/*: any*/) ], "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "cursor", - "storageKey": null - } - ], - "storageKey": null - }, - { - "alias": null, - "args": null, - "concreteType": "PageInfo", - "kind": "LinkedField", - "name": "pageInfo", - "plural": false, - "selections": [ - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "endCursor", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasNextPage", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "hasPreviousPage", - "storageKey": null - }, - { - "alias": null, - "args": null, - "kind": "ScalarField", - "name": "startCursor", - "storageKey": null } ], "storageKey": null } ], "storageKey": "addressConnection(first:30)" - }, - { - "alias": null, - "args": (v25/*: any*/), - "filters": null, - "handle": "connection", - "key": "SavedAddresses_addressConnection", - "kind": "LinkedHandle", - "name": "addressConnection" } ], "storageKey": null @@ -939,16 +851,16 @@ return { ] }, "params": { - "cacheID": "1762a079757e888385ade2e69a600114", + "cacheID": "5af452938bbf229a735ef41029207ac0", "id": null, "metadata": {}, "name": "orderRoutes_ShippingQuery", "operationKind": "query", - "text": "query orderRoutes_ShippingQuery(\n $orderID: ID!\n) {\n order: commerceOrder(id: $orderID) {\n __typename\n ...Shipping_order\n ...Shipping2_order\n id\n }\n me {\n ...Shipping_me\n ...Shipping2_me\n id\n }\n}\n\nfragment ArtworkSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n sellerDetails {\n __typename\n ... on Partner {\n name\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n currencyCode\n mode\n source\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n artwork {\n slug\n shippingOrigin\n isUnlisted\n id\n }\n artworkVersion {\n date\n artistNames\n title\n image {\n resized_ArtworkSummaryItem: resized(width: 55) {\n url\n }\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_me on Me {\n name\n email\n id\n location {\n country\n id\n }\n addressConnection(first: 30) {\n totalCount\n }\n}\n\nfragment FulfillmentDetailsForm_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n lineItems {\n edges {\n node {\n artwork {\n pickupAvailable\n id\n }\n id\n }\n }\n }\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n}\n\nfragment OrderStepper_order on CommerceOrder {\n __isCommerceOrder: __typename\n mode\n requestedFulfillment {\n __typename\n }\n paymentMethodDetails {\n __typename\n ... on CreditCard {\n id\n }\n ... on BankAccount {\n id\n }\n ... on WireTransfer {\n isManualPayment\n }\n }\n lineItems {\n edges {\n node {\n artwork {\n slug\n id\n }\n shippingQuoteOptions {\n edges {\n node {\n isSelected\n id\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment PartnerOfferTimerItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n displayState\n stateExpiresAt\n}\n\nfragment SaveAndContinueButton_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n}\n\nfragment SavedAddresses_me on Me {\n id\n addressConnection(first: 30) {\n totalCount\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n hasPreviousPage\n startCursor\n }\n }\n}\n\nfragment Shipping2_me on Me {\n ...FulfillmentDetailsForm_me\n ...ShippingContext_me_dXEtb\n}\n\nfragment Shipping2_order on CommerceOrder {\n __isCommerceOrder: __typename\n ...ShippingContext_order\n ...FulfillmentDetailsForm_order\n ...SaveAndContinueButton_order\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n ...ShippingQuotes2_order\n internalID\n}\n\nfragment ShippingContext_me_dXEtb on Me {\n addressConnection(first: 30) {\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n\nfragment ShippingContext_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n mode\n requestedFulfillment {\n __typename\n ... on CommercePickup {\n phoneNumber\n }\n ... on CommerceShip {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n ... on CommerceShipArta {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n }\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n }\n }\n }\n artwork {\n processWithArtsyShippingDomestic\n artsyShippingInternational\n onlyShipsDomestically\n euShippingOrigin\n shippingCountry\n id\n }\n id\n }\n }\n }\n}\n\nfragment ShippingQuotes2_order on CommerceOrder {\n __isCommerceOrder: __typename\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n price(precision: 2)\n priceCents\n typeName\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment ShippingQuotes_shippingQuotes on CommerceShippingQuoteEdge {\n node {\n id\n isSelected\n price(precision: 2)\n priceCents\n typeName\n }\n}\n\nfragment Shipping_me on Me {\n name\n email\n id\n location {\n country\n id\n }\n ...SavedAddresses_me\n addressConnection(first: 30) {\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n\nfragment Shipping_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n mode\n state\n source\n requestedFulfillment {\n __typename\n ... on CommercePickup {\n phoneNumber\n }\n ... on CommerceShip {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n ... on CommerceShipArta {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n }\n lineItems {\n edges {\n node {\n artwork {\n slug\n processWithArtsyShippingDomestic\n artsyShippingInternational\n pickup_available: pickupAvailable\n onlyShipsDomestically\n euShippingOrigin\n shippingCountry\n id\n }\n shippingQuoteOptions {\n edges {\n ...ShippingQuotes_shippingQuotes\n node {\n id\n isSelected\n }\n }\n }\n id\n }\n }\n }\n ...PartnerOfferTimerItem_order\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n}\n\nfragment TransactionDetailsSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n __typename\n requestedFulfillment {\n __typename\n }\n code\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n selectedShippingQuote {\n typeName\n id\n }\n id\n }\n }\n }\n mode\n source\n displayState\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n itemsTotal(precision: 2)\n buyerTotal(precision: 2)\n currencyCode\n ... on CommerceOfferOrder {\n lastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n myLastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n }\n}\n" + "text": "query orderRoutes_ShippingQuery(\n $orderID: ID!\n) {\n order: commerceOrder(id: $orderID) {\n __typename\n ...Shipping_order\n id\n }\n me {\n ...Shipping_me\n id\n }\n}\n\nfragment ArtworkSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n sellerDetails {\n __typename\n ... on Partner {\n name\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n currencyCode\n mode\n source\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n artwork {\n slug\n shippingOrigin\n isUnlisted\n id\n }\n artworkVersion {\n date\n artistNames\n title\n image {\n resized_ArtworkSummaryItem: resized(width: 55) {\n url\n }\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_me on Me {\n name\n email\n id\n location {\n country\n id\n }\n addressConnection(first: 30) {\n totalCount\n }\n}\n\nfragment FulfillmentDetailsForm_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n lineItems {\n edges {\n node {\n artwork {\n pickupAvailable\n id\n }\n id\n }\n }\n }\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n}\n\nfragment OrderStepper_order on CommerceOrder {\n __isCommerceOrder: __typename\n mode\n requestedFulfillment {\n __typename\n }\n paymentMethodDetails {\n __typename\n ... on CreditCard {\n id\n }\n ... on BankAccount {\n id\n }\n ... on WireTransfer {\n isManualPayment\n }\n }\n lineItems {\n edges {\n node {\n artwork {\n slug\n id\n }\n shippingQuoteOptions {\n edges {\n node {\n isSelected\n id\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment SaveAndContinueButton_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n}\n\nfragment ShippingContext_me_dXEtb on Me {\n addressConnection(first: 30) {\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n\nfragment ShippingContext_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n mode\n requestedFulfillment {\n __typename\n ... on CommercePickup {\n phoneNumber\n }\n ... on CommerceShip {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n ... on CommerceShipArta {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n }\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n }\n }\n }\n artwork {\n processWithArtsyShippingDomestic\n artsyShippingInternational\n onlyShipsDomestically\n euShippingOrigin\n shippingCountry\n id\n }\n id\n }\n }\n }\n}\n\nfragment ShippingQuotes_order on CommerceOrder {\n __isCommerceOrder: __typename\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n price(precision: 2)\n priceCents\n typeName\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment Shipping_me on Me {\n ...FulfillmentDetailsForm_me\n ...ShippingContext_me_dXEtb\n}\n\nfragment Shipping_order on CommerceOrder {\n __isCommerceOrder: __typename\n ...ShippingContext_order\n ...FulfillmentDetailsForm_order\n ...SaveAndContinueButton_order\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n ...ShippingQuotes_order\n internalID\n}\n\nfragment TransactionDetailsSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n __typename\n requestedFulfillment {\n __typename\n }\n code\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n selectedShippingQuote {\n typeName\n id\n }\n id\n }\n }\n }\n mode\n source\n displayState\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n itemsTotal(precision: 2)\n buyerTotal(precision: 2)\n currencyCode\n ... on CommerceOfferOrder {\n lastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n myLastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n }\n}\n" } }; })(); -(node as any).hash = "0456228df3e118603b9a057a023f62de"; +(node as any).hash = "c938c2056100bf9dd0e4a25132b4e347"; export default node; diff --git a/src/__generated__/useCreateSavedAddressMutation.graphql.ts b/src/__generated__/useCreateSavedAddressMutation.graphql.ts index 9edf827ff8c..051a32e895a 100644 --- a/src/__generated__/useCreateSavedAddressMutation.graphql.ts +++ b/src/__generated__/useCreateSavedAddressMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<<9f6f6f6a0ffca733c33aedb70b0d7434>> * @lightSyntaxTransform * @nogrep */ @@ -32,7 +32,7 @@ export type useCreateSavedAddressMutation$variables = { export type useCreateSavedAddressMutation$data = { readonly createUserAddress: { readonly me: { - readonly " $fragmentSpreads": FragmentRefs<"Shipping2_me">; + readonly " $fragmentSpreads": FragmentRefs<"Shipping_me">; } | null | undefined; readonly userAddressOrErrors: { readonly __typename: "Errors"; @@ -244,7 +244,7 @@ return { { "args": null, "kind": "FragmentSpread", - "name": "Shipping2_me" + "name": "Shipping_me" } ], "storageKey": null @@ -356,16 +356,16 @@ return { ] }, "params": { - "cacheID": "4364fe0cf331213e570c7b77c001fb2a", + "cacheID": "6761d16c1031ab281fe7a63df92f45b8", "id": null, "metadata": {}, "name": "useCreateSavedAddressMutation", "operationKind": "mutation", - "text": "mutation useCreateSavedAddressMutation(\n $input: CreateUserAddressInput!\n) {\n createUserAddress(input: $input) {\n me {\n ...Shipping2_me\n id\n }\n userAddressOrErrors {\n __typename\n ... on Errors {\n errors {\n message\n }\n }\n ... on UserAddress {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_me on Me {\n name\n email\n id\n location {\n country\n id\n }\n addressConnection(first: 30) {\n totalCount\n }\n}\n\nfragment Shipping2_me on Me {\n ...FulfillmentDetailsForm_me\n ...ShippingContext_me_dXEtb\n}\n\nfragment ShippingContext_me_dXEtb on Me {\n addressConnection(first: 30) {\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n" + "text": "mutation useCreateSavedAddressMutation(\n $input: CreateUserAddressInput!\n) {\n createUserAddress(input: $input) {\n me {\n ...Shipping_me\n id\n }\n userAddressOrErrors {\n __typename\n ... on Errors {\n errors {\n message\n }\n }\n ... on UserAddress {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_me on Me {\n name\n email\n id\n location {\n country\n id\n }\n addressConnection(first: 30) {\n totalCount\n }\n}\n\nfragment ShippingContext_me_dXEtb on Me {\n addressConnection(first: 30) {\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n\nfragment Shipping_me on Me {\n ...FulfillmentDetailsForm_me\n ...ShippingContext_me_dXEtb\n}\n" } }; })(); -(node as any).hash = "fb7c8760ea3300b57f3b56327f5fee10"; +(node as any).hash = "e3bafa4b4d0a8105a235ea1c0d0cacd0"; export default node; diff --git a/src/__generated__/useDeleteSavedAddressMutation.graphql.ts b/src/__generated__/useDeleteSavedAddressMutation.graphql.ts index 9054cdeb971..5693ab1590f 100644 --- a/src/__generated__/useDeleteSavedAddressMutation.graphql.ts +++ b/src/__generated__/useDeleteSavedAddressMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<44d1aa87f806086f6ec742e2aeb7ba52>> + * @generated SignedSource<<64f06cd9d0b3abb4da5f1a0224ad3d24>> * @lightSyntaxTransform * @nogrep */ @@ -20,7 +20,7 @@ export type useDeleteSavedAddressMutation$variables = { export type useDeleteSavedAddressMutation$data = { readonly deleteUserAddress: { readonly me: { - readonly " $fragmentSpreads": FragmentRefs<"Shipping2_me">; + readonly " $fragmentSpreads": FragmentRefs<"Shipping_me">; } | null | undefined; readonly userAddressOrErrors: { readonly __typename: "Errors"; @@ -133,7 +133,7 @@ return { { "args": null, "kind": "FragmentSpread", - "name": "Shipping2_me" + "name": "Shipping_me" } ], "storageKey": null @@ -344,16 +344,16 @@ return { ] }, "params": { - "cacheID": "66a61c75722fc390807657bd39249e63", + "cacheID": "e1d9d1f6f18b00b8b55be6dc9e929009", "id": null, "metadata": {}, "name": "useDeleteSavedAddressMutation", "operationKind": "mutation", - "text": "mutation useDeleteSavedAddressMutation(\n $input: DeleteUserAddressInput!\n) {\n deleteUserAddress(input: $input) {\n me {\n ...Shipping2_me\n id\n }\n userAddressOrErrors {\n __typename\n ... on Errors {\n errors {\n message\n }\n }\n ... on UserAddress {\n id\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_me on Me {\n name\n email\n id\n location {\n country\n id\n }\n addressConnection(first: 30) {\n totalCount\n }\n}\n\nfragment Shipping2_me on Me {\n ...FulfillmentDetailsForm_me\n ...ShippingContext_me_dXEtb\n}\n\nfragment ShippingContext_me_dXEtb on Me {\n addressConnection(first: 30) {\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n" + "text": "mutation useDeleteSavedAddressMutation(\n $input: DeleteUserAddressInput!\n) {\n deleteUserAddress(input: $input) {\n me {\n ...Shipping_me\n id\n }\n userAddressOrErrors {\n __typename\n ... on Errors {\n errors {\n message\n }\n }\n ... on UserAddress {\n id\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_me on Me {\n name\n email\n id\n location {\n country\n id\n }\n addressConnection(first: 30) {\n totalCount\n }\n}\n\nfragment ShippingContext_me_dXEtb on Me {\n addressConnection(first: 30) {\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n\nfragment Shipping_me on Me {\n ...FulfillmentDetailsForm_me\n ...ShippingContext_me_dXEtb\n}\n" } }; })(); -(node as any).hash = "bb9ee165ba7ff2e2090f6461f8ba4850"; +(node as any).hash = "67225886a5fd2f0ac747726fe99c2aec"; export default node; diff --git a/src/__generated__/useSaveFulfillmentDetailsMutation.graphql.ts b/src/__generated__/useSaveFulfillmentDetailsMutation.graphql.ts index f356e2aecee..c846e29e3a4 100644 --- a/src/__generated__/useSaveFulfillmentDetailsMutation.graphql.ts +++ b/src/__generated__/useSaveFulfillmentDetailsMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<40dba4ea63b8a1173d74a2563a83aec0>> + * @generated SignedSource<<85db78f100bbb90c4d3ab0e2706ccce0>> * @lightSyntaxTransform * @nogrep */ @@ -51,7 +51,7 @@ export type useSaveFulfillmentDetailsMutation$data = { readonly order: { readonly __typename: string; readonly internalID: string; - readonly " $fragmentSpreads": FragmentRefs<"Shipping2_order">; + readonly " $fragmentSpreads": FragmentRefs<"Shipping_order">; }; } | { // This will never be '%other', but we need some @@ -350,7 +350,7 @@ return { { "args": null, "kind": "FragmentSpread", - "name": "Shipping2_order" + "name": "Shipping_order" } ], "storageKey": null @@ -863,16 +863,16 @@ return { ] }, "params": { - "cacheID": "bc6f8f4c59750565d7427330012a2828", + "cacheID": "4e93bcbf1b252391448789fda42a560b", "id": null, "metadata": {}, "name": "useSaveFulfillmentDetailsMutation", "operationKind": "mutation", - "text": "mutation useSaveFulfillmentDetailsMutation(\n $input: CommerceSetShippingInput!\n) {\n commerceSetShipping(input: $input) {\n orderOrError {\n __typename\n ... on CommerceOrderWithMutationSuccess {\n order {\n internalID\n __typename\n __isCommerceOrder: __typename\n ...Shipping2_order\n id\n }\n }\n ... on CommerceOrderWithMutationFailure {\n error {\n type\n code\n data\n }\n }\n ... on CommerceOrderRequiresAction {\n __typename\n }\n }\n }\n}\n\nfragment ArtworkSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n sellerDetails {\n __typename\n ... on Partner {\n name\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n currencyCode\n mode\n source\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n artwork {\n slug\n shippingOrigin\n isUnlisted\n id\n }\n artworkVersion {\n date\n artistNames\n title\n image {\n resized_ArtworkSummaryItem: resized(width: 55) {\n url\n }\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n lineItems {\n edges {\n node {\n artwork {\n pickupAvailable\n id\n }\n id\n }\n }\n }\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n}\n\nfragment OrderStepper_order on CommerceOrder {\n __isCommerceOrder: __typename\n mode\n requestedFulfillment {\n __typename\n }\n paymentMethodDetails {\n __typename\n ... on CreditCard {\n id\n }\n ... on BankAccount {\n id\n }\n ... on WireTransfer {\n isManualPayment\n }\n }\n lineItems {\n edges {\n node {\n artwork {\n slug\n id\n }\n shippingQuoteOptions {\n edges {\n node {\n isSelected\n id\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment SaveAndContinueButton_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n}\n\nfragment Shipping2_order on CommerceOrder {\n __isCommerceOrder: __typename\n ...ShippingContext_order\n ...FulfillmentDetailsForm_order\n ...SaveAndContinueButton_order\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n ...ShippingQuotes2_order\n internalID\n}\n\nfragment ShippingContext_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n mode\n requestedFulfillment {\n __typename\n ... on CommercePickup {\n phoneNumber\n }\n ... on CommerceShip {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n ... on CommerceShipArta {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n }\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n }\n }\n }\n artwork {\n processWithArtsyShippingDomestic\n artsyShippingInternational\n onlyShipsDomestically\n euShippingOrigin\n shippingCountry\n id\n }\n id\n }\n }\n }\n}\n\nfragment ShippingQuotes2_order on CommerceOrder {\n __isCommerceOrder: __typename\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n price(precision: 2)\n priceCents\n typeName\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment TransactionDetailsSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n __typename\n requestedFulfillment {\n __typename\n }\n code\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n selectedShippingQuote {\n typeName\n id\n }\n id\n }\n }\n }\n mode\n source\n displayState\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n itemsTotal(precision: 2)\n buyerTotal(precision: 2)\n currencyCode\n ... on CommerceOfferOrder {\n lastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n myLastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n }\n}\n" + "text": "mutation useSaveFulfillmentDetailsMutation(\n $input: CommerceSetShippingInput!\n) {\n commerceSetShipping(input: $input) {\n orderOrError {\n __typename\n ... on CommerceOrderWithMutationSuccess {\n order {\n internalID\n __typename\n __isCommerceOrder: __typename\n ...Shipping_order\n id\n }\n }\n ... on CommerceOrderWithMutationFailure {\n error {\n type\n code\n data\n }\n }\n ... on CommerceOrderRequiresAction {\n __typename\n }\n }\n }\n}\n\nfragment ArtworkSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n sellerDetails {\n __typename\n ... on Partner {\n name\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n currencyCode\n mode\n source\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n artwork {\n slug\n shippingOrigin\n isUnlisted\n id\n }\n artworkVersion {\n date\n artistNames\n title\n image {\n resized_ArtworkSummaryItem: resized(width: 55) {\n url\n }\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n lineItems {\n edges {\n node {\n artwork {\n pickupAvailable\n id\n }\n id\n }\n }\n }\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n}\n\nfragment OrderStepper_order on CommerceOrder {\n __isCommerceOrder: __typename\n mode\n requestedFulfillment {\n __typename\n }\n paymentMethodDetails {\n __typename\n ... on CreditCard {\n id\n }\n ... on BankAccount {\n id\n }\n ... on WireTransfer {\n isManualPayment\n }\n }\n lineItems {\n edges {\n node {\n artwork {\n slug\n id\n }\n shippingQuoteOptions {\n edges {\n node {\n isSelected\n id\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment SaveAndContinueButton_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n}\n\nfragment ShippingContext_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n mode\n requestedFulfillment {\n __typename\n ... on CommercePickup {\n phoneNumber\n }\n ... on CommerceShip {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n ... on CommerceShipArta {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n }\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n }\n }\n }\n artwork {\n processWithArtsyShippingDomestic\n artsyShippingInternational\n onlyShipsDomestically\n euShippingOrigin\n shippingCountry\n id\n }\n id\n }\n }\n }\n}\n\nfragment ShippingQuotes_order on CommerceOrder {\n __isCommerceOrder: __typename\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n price(precision: 2)\n priceCents\n typeName\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment Shipping_order on CommerceOrder {\n __isCommerceOrder: __typename\n ...ShippingContext_order\n ...FulfillmentDetailsForm_order\n ...SaveAndContinueButton_order\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n ...ShippingQuotes_order\n internalID\n}\n\nfragment TransactionDetailsSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n __typename\n requestedFulfillment {\n __typename\n }\n code\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n selectedShippingQuote {\n typeName\n id\n }\n id\n }\n }\n }\n mode\n source\n displayState\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n itemsTotal(precision: 2)\n buyerTotal(precision: 2)\n currencyCode\n ... on CommerceOfferOrder {\n lastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n myLastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n }\n}\n" } }; })(); -(node as any).hash = "8a9c7cc9adea112800df1b8170e814c5"; +(node as any).hash = "e6db2f49a7b1d53b984d3460a425b787"; export default node; diff --git a/src/__generated__/useSelectShippingQuoteMutation.graphql.ts b/src/__generated__/useSelectShippingQuoteMutation.graphql.ts index 5b295451fdb..7e547f1897e 100644 --- a/src/__generated__/useSelectShippingQuoteMutation.graphql.ts +++ b/src/__generated__/useSelectShippingQuoteMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<94edf7eda388f805cb14a27b99913a41>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -30,7 +30,7 @@ export type useSelectShippingQuoteMutation$data = { } | { readonly __typename: "CommerceOrderWithMutationSuccess"; readonly order: { - readonly " $fragmentSpreads": FragmentRefs<"Shipping2_order">; + readonly " $fragmentSpreads": FragmentRefs<"Shipping_order">; }; } | { // This will never be '%other', but we need some @@ -327,7 +327,7 @@ return { { "args": null, "kind": "FragmentSpread", - "name": "Shipping2_order" + "name": "Shipping_order" } ], "storageKey": null @@ -840,16 +840,16 @@ return { ] }, "params": { - "cacheID": "332e06ad30af4e3dfcbeeca4a45180a1", + "cacheID": "bb22a8c1436110927c54750721f2d364", "id": null, "metadata": {}, "name": "useSelectShippingQuoteMutation", "operationKind": "mutation", - "text": "mutation useSelectShippingQuoteMutation(\n $input: CommerceSelectShippingOptionInput!\n) {\n commerceSelectShippingOption(input: $input) {\n orderOrError {\n __typename\n ... on CommerceOrderWithMutationSuccess {\n order {\n __typename\n ...Shipping2_order\n id\n }\n }\n ... on CommerceOrderWithMutationFailure {\n error {\n type\n code\n data\n }\n }\n }\n }\n}\n\nfragment ArtworkSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n sellerDetails {\n __typename\n ... on Partner {\n name\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n currencyCode\n mode\n source\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n artwork {\n slug\n shippingOrigin\n isUnlisted\n id\n }\n artworkVersion {\n date\n artistNames\n title\n image {\n resized_ArtworkSummaryItem: resized(width: 55) {\n url\n }\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n lineItems {\n edges {\n node {\n artwork {\n pickupAvailable\n id\n }\n id\n }\n }\n }\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n}\n\nfragment OrderStepper_order on CommerceOrder {\n __isCommerceOrder: __typename\n mode\n requestedFulfillment {\n __typename\n }\n paymentMethodDetails {\n __typename\n ... on CreditCard {\n id\n }\n ... on BankAccount {\n id\n }\n ... on WireTransfer {\n isManualPayment\n }\n }\n lineItems {\n edges {\n node {\n artwork {\n slug\n id\n }\n shippingQuoteOptions {\n edges {\n node {\n isSelected\n id\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment SaveAndContinueButton_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n}\n\nfragment Shipping2_order on CommerceOrder {\n __isCommerceOrder: __typename\n ...ShippingContext_order\n ...FulfillmentDetailsForm_order\n ...SaveAndContinueButton_order\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n ...ShippingQuotes2_order\n internalID\n}\n\nfragment ShippingContext_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n mode\n requestedFulfillment {\n __typename\n ... on CommercePickup {\n phoneNumber\n }\n ... on CommerceShip {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n ... on CommerceShipArta {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n }\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n }\n }\n }\n artwork {\n processWithArtsyShippingDomestic\n artsyShippingInternational\n onlyShipsDomestically\n euShippingOrigin\n shippingCountry\n id\n }\n id\n }\n }\n }\n}\n\nfragment ShippingQuotes2_order on CommerceOrder {\n __isCommerceOrder: __typename\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n price(precision: 2)\n priceCents\n typeName\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment TransactionDetailsSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n __typename\n requestedFulfillment {\n __typename\n }\n code\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n selectedShippingQuote {\n typeName\n id\n }\n id\n }\n }\n }\n mode\n source\n displayState\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n itemsTotal(precision: 2)\n buyerTotal(precision: 2)\n currencyCode\n ... on CommerceOfferOrder {\n lastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n myLastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n }\n}\n" + "text": "mutation useSelectShippingQuoteMutation(\n $input: CommerceSelectShippingOptionInput!\n) {\n commerceSelectShippingOption(input: $input) {\n orderOrError {\n __typename\n ... on CommerceOrderWithMutationSuccess {\n order {\n __typename\n ...Shipping_order\n id\n }\n }\n ... on CommerceOrderWithMutationFailure {\n error {\n type\n code\n data\n }\n }\n }\n }\n}\n\nfragment ArtworkSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n sellerDetails {\n __typename\n ... on Partner {\n name\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n currencyCode\n mode\n source\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n artwork {\n slug\n shippingOrigin\n isUnlisted\n id\n }\n artworkVersion {\n date\n artistNames\n title\n image {\n resized_ArtworkSummaryItem: resized(width: 55) {\n url\n }\n }\n id\n }\n id\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n lineItems {\n edges {\n node {\n artwork {\n pickupAvailable\n id\n }\n id\n }\n }\n }\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n}\n\nfragment OrderStepper_order on CommerceOrder {\n __isCommerceOrder: __typename\n mode\n requestedFulfillment {\n __typename\n }\n paymentMethodDetails {\n __typename\n ... on CreditCard {\n id\n }\n ... on BankAccount {\n id\n }\n ... on WireTransfer {\n isManualPayment\n }\n }\n lineItems {\n edges {\n node {\n artwork {\n slug\n id\n }\n shippingQuoteOptions {\n edges {\n node {\n isSelected\n id\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment SaveAndContinueButton_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n}\n\nfragment ShippingContext_order on CommerceOrder {\n __isCommerceOrder: __typename\n internalID\n mode\n requestedFulfillment {\n __typename\n ... on CommercePickup {\n phoneNumber\n }\n ... on CommerceShip {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n ... on CommerceShipArta {\n name\n addressLine1\n addressLine2\n city\n region\n country\n postalCode\n phoneNumber\n }\n }\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n }\n }\n }\n artwork {\n processWithArtsyShippingDomestic\n artsyShippingInternational\n onlyShipsDomestically\n euShippingOrigin\n shippingCountry\n id\n }\n id\n }\n }\n }\n}\n\nfragment ShippingQuotes_order on CommerceOrder {\n __isCommerceOrder: __typename\n lineItems {\n edges {\n node {\n shippingQuoteOptions {\n edges {\n node {\n id\n isSelected\n price(precision: 2)\n priceCents\n typeName\n }\n }\n }\n id\n }\n }\n }\n}\n\nfragment Shipping_order on CommerceOrder {\n __isCommerceOrder: __typename\n ...ShippingContext_order\n ...FulfillmentDetailsForm_order\n ...SaveAndContinueButton_order\n ...ArtworkSummaryItem_order\n ...TransactionDetailsSummaryItem_order\n ...OrderStepper_order\n ...ShippingQuotes_order\n internalID\n}\n\nfragment TransactionDetailsSummaryItem_order on CommerceOrder {\n __isCommerceOrder: __typename\n __typename\n requestedFulfillment {\n __typename\n }\n code\n lineItems {\n edges {\n node {\n artworkOrEditionSet {\n __typename\n ... on Artwork {\n price\n }\n ... on EditionSet {\n price\n id\n }\n ... on Node {\n __isNode: __typename\n id\n }\n }\n selectedShippingQuote {\n typeName\n id\n }\n id\n }\n }\n }\n mode\n source\n displayState\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n itemsTotal(precision: 2)\n buyerTotal(precision: 2)\n currencyCode\n ... on CommerceOfferOrder {\n lastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n myLastOffer {\n internalID\n amount(precision: 2)\n amountCents\n shippingTotal(precision: 2)\n shippingTotalCents\n taxTotal(precision: 2)\n taxTotalCents\n buyerTotal(precision: 2)\n buyerTotalCents\n fromParticipant\n note\n id\n }\n }\n}\n" } }; })(); -(node as any).hash = "a3a3105021f8bd71fe224fdc4d94659c"; +(node as any).hash = "3e348ca6f819d7c8cc1313fca1f13a77"; export default node; diff --git a/src/__generated__/useUpdateSavedAddressMutation.graphql.ts b/src/__generated__/useUpdateSavedAddressMutation.graphql.ts index bb9e6bd7162..525070faeca 100644 --- a/src/__generated__/useUpdateSavedAddressMutation.graphql.ts +++ b/src/__generated__/useUpdateSavedAddressMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<5cf230107de014f630f4542bb34555ad>> + * @generated SignedSource<> * @lightSyntaxTransform * @nogrep */ @@ -33,7 +33,7 @@ export type useUpdateSavedAddressMutation$variables = { export type useUpdateSavedAddressMutation$data = { readonly updateUserAddress: { readonly me: { - readonly " $fragmentSpreads": FragmentRefs<"Shipping2_me">; + readonly " $fragmentSpreads": FragmentRefs<"Shipping_me">; } | null | undefined; readonly userAddressOrErrors: { readonly __typename: "Errors"; @@ -245,7 +245,7 @@ return { { "args": null, "kind": "FragmentSpread", - "name": "Shipping2_me" + "name": "Shipping_me" } ], "storageKey": null @@ -357,16 +357,16 @@ return { ] }, "params": { - "cacheID": "a3b8d8d0b4b3c04522f43ea13842afab", + "cacheID": "bd0762595bbb34e2914c9805b73753c9", "id": null, "metadata": {}, "name": "useUpdateSavedAddressMutation", "operationKind": "mutation", - "text": "mutation useUpdateSavedAddressMutation(\n $input: UpdateUserAddressInput!\n) {\n updateUserAddress(input: $input) {\n me {\n ...Shipping2_me\n id\n }\n userAddressOrErrors {\n __typename\n ... on Errors {\n errors {\n message\n }\n }\n ... on UserAddress {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_me on Me {\n name\n email\n id\n location {\n country\n id\n }\n addressConnection(first: 30) {\n totalCount\n }\n}\n\nfragment Shipping2_me on Me {\n ...FulfillmentDetailsForm_me\n ...ShippingContext_me_dXEtb\n}\n\nfragment ShippingContext_me_dXEtb on Me {\n addressConnection(first: 30) {\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n" + "text": "mutation useUpdateSavedAddressMutation(\n $input: UpdateUserAddressInput!\n) {\n updateUserAddress(input: $input) {\n me {\n ...Shipping_me\n id\n }\n userAddressOrErrors {\n __typename\n ... on Errors {\n errors {\n message\n }\n }\n ... on UserAddress {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_me on Me {\n name\n email\n id\n location {\n country\n id\n }\n addressConnection(first: 30) {\n totalCount\n }\n}\n\nfragment ShippingContext_me_dXEtb on Me {\n addressConnection(first: 30) {\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n\nfragment Shipping_me on Me {\n ...FulfillmentDetailsForm_me\n ...ShippingContext_me_dXEtb\n}\n" } }; })(); -(node as any).hash = "5acf946cf48c509fa220a0624f9363d5"; +(node as any).hash = "865c24ef4592509c9aa6534557d751a8"; export default node; diff --git a/src/__generated__/useUpdateUserDefaultAddressMutation.graphql.ts b/src/__generated__/useUpdateUserDefaultAddressMutation.graphql.ts index c61617a22a1..b9254f55439 100644 --- a/src/__generated__/useUpdateUserDefaultAddressMutation.graphql.ts +++ b/src/__generated__/useUpdateUserDefaultAddressMutation.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<6ac29bccd79890bed2042f7673086ec1>> + * @generated SignedSource<<27be3f25fec5b6e4b54abc1b86a5db56>> * @lightSyntaxTransform * @nogrep */ @@ -20,7 +20,7 @@ export type useUpdateUserDefaultAddressMutation$variables = { export type useUpdateUserDefaultAddressMutation$data = { readonly updateUserDefaultAddress: { readonly me: { - readonly " $fragmentSpreads": FragmentRefs<"Shipping2_me">; + readonly " $fragmentSpreads": FragmentRefs<"Shipping_me">; } | null | undefined; readonly userAddressOrErrors: { readonly __typename: "Errors"; @@ -133,7 +133,7 @@ return { { "args": null, "kind": "FragmentSpread", - "name": "Shipping2_me" + "name": "Shipping_me" } ], "storageKey": null @@ -344,16 +344,16 @@ return { ] }, "params": { - "cacheID": "45359d646baa9528e78c3673b8c3070a", + "cacheID": "60b8198c4a9f8c150051b32e72f5f303", "id": null, "metadata": {}, "name": "useUpdateUserDefaultAddressMutation", "operationKind": "mutation", - "text": "mutation useUpdateUserDefaultAddressMutation(\n $input: UpdateUserDefaultAddressInput!\n) {\n updateUserDefaultAddress(input: $input) {\n me {\n ...Shipping2_me\n id\n }\n userAddressOrErrors {\n __typename\n ... on Errors {\n errors {\n message\n }\n }\n ... on UserAddress {\n id\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_me on Me {\n name\n email\n id\n location {\n country\n id\n }\n addressConnection(first: 30) {\n totalCount\n }\n}\n\nfragment Shipping2_me on Me {\n ...FulfillmentDetailsForm_me\n ...ShippingContext_me_dXEtb\n}\n\nfragment ShippingContext_me_dXEtb on Me {\n addressConnection(first: 30) {\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n" + "text": "mutation useUpdateUserDefaultAddressMutation(\n $input: UpdateUserDefaultAddressInput!\n) {\n updateUserDefaultAddress(input: $input) {\n me {\n ...Shipping_me\n id\n }\n userAddressOrErrors {\n __typename\n ... on Errors {\n errors {\n message\n }\n }\n ... on UserAddress {\n id\n }\n }\n }\n}\n\nfragment FulfillmentDetailsForm_me on Me {\n name\n email\n id\n location {\n country\n id\n }\n addressConnection(first: 30) {\n totalCount\n }\n}\n\nfragment ShippingContext_me_dXEtb on Me {\n addressConnection(first: 30) {\n edges {\n node {\n id\n internalID\n addressLine1\n addressLine2\n addressLine3\n city\n country\n isDefault\n name\n phoneNumber\n postalCode\n region\n }\n }\n }\n}\n\nfragment Shipping_me on Me {\n ...FulfillmentDetailsForm_me\n ...ShippingContext_me_dXEtb\n}\n" } }; })(); -(node as any).hash = "cbee14ca2d44f82cdfb497dfe9331808"; +(node as any).hash = "d30ff76c2e6fc9415b3af2165fcf1def"; export default node;