diff --git a/src/interfaces/Account.ts b/src/interfaces/Account.ts index 97e3fd9d..8a114f23 100644 --- a/src/interfaces/Account.ts +++ b/src/interfaces/Account.ts @@ -1,6 +1,5 @@ import type { IAddress } from './attributes/Address' import type { JsonApiDocument, JsonApiListResponse, JsonApiSingleResponse } from './JsonApi' -import type { IQuery } from './Query' import type { IRelationships } from './Relationships' import type { ResultResponse } from './ResultResponse' import type { WithCommonOptions } from './WithCommonOptions' @@ -25,40 +24,6 @@ export interface IAccount extends JsonApiSingleResponse { export interface IAccountResult extends ResultResponse {} -export interface IAccountConfirmation { - data: { - state: string - } -} - -export interface IAccountConfirmationResult extends ResultResponse {} - -/** - * @deprecated Use {@link ForgotPasswordOptions} instead. - */ -export interface ForgotPasswordParams extends IQuery { - user: { - email: string - } -} - -/** - * @deprecated Use {@link ResetPasswordOptions} instead. - */ -export interface ResetPasswordParams extends IQuery { - user: { - password: string - password_confirmation: string - } -} - -/** - * @deprecated Use {@link CreateAddressOptions} instead. - */ -export interface AccountAddressParams extends IQuery { - address: IAddress -} - export interface AccountAddressAttr extends JsonApiDocument { attributes: IAddress } @@ -118,12 +83,6 @@ export type CreateOptions = WithCommonOptions< } > -export type ConfirmOptions = WithCommonOptions - -export type ForgotPasswordOptions = WithCommonOptions - -export type ResetPasswordOptions = WithCommonOptions - export type UpdateOptions = WithCommonOptions< { suggestToken: true; onlyAccountToken: true }, { @@ -148,12 +107,12 @@ export type ShowAddressOptions = WithCommonOptions< export type CreateAddressOptions = WithCommonOptions< { suggestToken: true; onlyAccountToken: true; suggestQuery: true }, - AccountAddressParams + { address: IAddress } > export type RemoveAddressOptions = WithCommonOptions<{ suggestToken: true; onlyAccountToken: true }, { id: string }> export type UpdateAddressOptions = WithCommonOptions< { suggestToken: true; onlyAccountToken: true }, - AccountAddressParams & { id: string } + { address: IAddress } > diff --git a/src/interfaces/Cart.ts b/src/interfaces/Cart.ts index 966005be..a35cbf2f 100644 --- a/src/interfaces/Cart.ts +++ b/src/interfaces/Cart.ts @@ -1,9 +1,5 @@ import type { WithCommonOptions } from './WithCommonOptions' -import type * as RestCheckoutTypes from './endpoints/CartClass' - -export * from './endpoints/CartClass' - export type ShowOptions = WithCommonOptions<{ suggestToken: true; suggestQuery: true }> export type CreateOptions = WithCommonOptions<{ @@ -18,7 +14,13 @@ export type AddItemOptions = WithCommonOptions< suggestToken: true suggestQuery: true }, - RestCheckoutTypes.AddItem + { + variant_id: string + quantity: number + options?: { + [key: string]: string + } + } > export type RemoveItemOptions = WithCommonOptions<{ suggestToken: true; suggestQuery: true }, { id: string }> @@ -29,12 +31,15 @@ export type RemoveOptions = WithCommonOptions<{ suggestToken: true }> export type SetQuantityOptions = WithCommonOptions< { suggestToken: true; suggestQuery: true }, - RestCheckoutTypes.SetQuantity + { + line_item_id: string + quantity: number + } > export type ApplyCouponCodeOptions = WithCommonOptions< { suggestToken: true; suggestQuery: true }, - RestCheckoutTypes.CouponCode + { coupon_code: string } > export type RemoveCouponCodeOptions = WithCommonOptions<{ suggestToken: true; suggestQuery: true }, { code?: string }> @@ -43,15 +48,15 @@ export type RemoveAllCouponsOptions = WithCommonOptions<{ suggestToken: true; su export type EstimateShippingRatesOptions = WithCommonOptions< { suggestToken: true; suggestQuery: true }, - RestCheckoutTypes.EstimateShippingRates + { country_iso: string } > export type AssociateGuestCartOptions = WithCommonOptions< { suggestToken: true; suggestQuery: true }, - RestCheckoutTypes.AssociateCart + { guest_order_token: string } > export type ChangeCurrencyOptions = WithCommonOptions< { suggestToken: true; suggestQuery: true }, - RestCheckoutTypes.ChangeCurrency + { new_currency: string } > diff --git a/src/interfaces/Checkout.ts b/src/interfaces/Checkout.ts index 8b14f035..478e73e1 100644 --- a/src/interfaces/Checkout.ts +++ b/src/interfaces/Checkout.ts @@ -1,8 +1,7 @@ import type { WithCommonOptions } from './WithCommonOptions' -import type * as RestCheckoutTypes from './endpoints/CheckoutClass' - -export * from './endpoints/CheckoutClass' +import { IAddress } from './attributes/Address' +import { IShipment } from './attributes/Shipment' export type CreateStripeSessionOptions = WithCommonOptions< { suggestToken: true }, @@ -14,7 +13,17 @@ export type CreateStripeSessionOptions = WithCommonOptions< export type AddPaymentOptions = WithCommonOptions< { suggestToken: true; suggestQuery: true }, - RestCheckoutTypes.AddFullPayment & { + { + payment_method_id: string + source_attributes?: { + gateway_payment_profile_id: string + cc_type?: string + last_digits?: string + month?: string + year?: string + name: string + } + } & { source_id?: string amount?: number } @@ -47,7 +56,27 @@ export type AdvanceOptions = WithCommonOptions<{ suggestToken: true; suggestQuer export type OrderUpdateOptions = WithCommonOptions< { suggestToken: true; suggestQuery: true }, - RestCheckoutTypes.OrderUpdate + { order?: { + email?: string + special_instructions?: string + bill_address_attributes?: IAddress + ship_address_attributes?: IAddress + payments_attributes?: AddFullPayment[] + shipments_attributes?: IShipment[] + } + } > export type OrderNextOptions = WithCommonOptions<{ suggestToken: true; suggestQuery: true }> + +export interface AddFullPayment { + payment_method_id: string + source_attributes?: { + gateway_payment_profile_id: string + cc_type?: string + last_digits?: string + month?: string + year?: string + name: string + } +} diff --git a/src/interfaces/Menu.ts b/src/interfaces/Menu.ts index 5cbc282a..dcde424b 100644 --- a/src/interfaces/Menu.ts +++ b/src/interfaces/Menu.ts @@ -27,16 +27,6 @@ export interface MenuResult extends ResultResponse {} export interface MenusResult extends ResultResponse {} -/** - * @deprecated Use {@link ListOptions} instead. - */ -export interface MenusList extends IQuery { - locale?: string - filter?: IQuery['filter'] & { - location?: string - } -} - -export type ListOptions = WithCommonOptions<{ suggestQuery: true }, MenusList> +export type ListOptions = WithCommonOptions<{ suggestQuery: true }, { locale?: string; filter?: IQuery['filter'] & { location?: string } }> export type ShowOptions = WithCommonOptions<{ suggestQuery: true }, { id: string }> diff --git a/src/interfaces/ShippingMethod.ts b/src/interfaces/ShippingMethod.ts index da8c4170..a54e837e 100644 --- a/src/interfaces/ShippingMethod.ts +++ b/src/interfaces/ShippingMethod.ts @@ -2,36 +2,6 @@ import { JsonApiDocument, JsonApiListResponse } from './JsonApi' import { IRelationships } from './Relationships' import { ResultResponse } from './ResultResponse' -/** - * @deprecated Use {@link ShippingRateAttr} instead. - */ -export interface ShippingMethodAttr extends JsonApiDocument { - type: string - id: string - attributes: { - number: string - free: boolean - final_price: string - display_final_price: string - tracking_url: string - state: string - shipped_at: Date - } - relationships: IRelationships -} - -/** - * @deprecated Use {@link ShippingRates} instead. - */ -export interface IShippingMethods extends JsonApiListResponse { - data: ShippingMethodAttr[] -} - -/** - * @deprecated Use {@link ShippingRatesResult} instead. - */ -export interface IShippingMethodsResult extends ResultResponse {} - export interface ShippingRateAttr extends JsonApiDocument { type: string id: string diff --git a/src/interfaces/WishedItem.ts b/src/interfaces/WishedItem.ts index bff5356a..740ad880 100644 --- a/src/interfaces/WishedItem.ts +++ b/src/interfaces/WishedItem.ts @@ -1,5 +1,4 @@ import type { JsonApiDocument, JsonApiSingleResponse } from './JsonApi' -import type { IQuery } from './Query' import type { IRelationships } from './Relationships' import type { ResultResponse } from './ResultResponse' import type { WithCommonOptions } from './WithCommonOptions' @@ -20,29 +19,14 @@ export interface WishedItem extends JsonApiSingleResponse { export interface WishedItemResult extends ResultResponse {} -/** - * @deprecated Use {@link AddWishedItemOptions} instead. - */ -export interface WishlistsAddWishedItem extends IQuery { - variant_id: string - quantity: number -} - -/** - * @deprecated Use {@link UpdateWishedItemOptions} instead. - */ -export interface WishlistsUpdateWishedItem extends IQuery { - quantity: number -} - export type AddWishedItemOptions = WithCommonOptions< { suggestToken: true; suggestQuery: true }, - { wishlist_token: string } & WishlistsAddWishedItem + { wishlist_token: string } & { variant_id: string; quantity: number } > export type UpdateWishedItemOptions = WithCommonOptions< { suggestToken: true; suggestQuery: true }, - { wishlist_token: string; id: string } & WishlistsUpdateWishedItem + { wishlist_token: string; id: string } & { quantity: number } > export type RemoveWishedItemOptions = WithCommonOptions<{ suggestToken: true }, { wishlist_token: string; id: string }> diff --git a/src/interfaces/Wishlist.ts b/src/interfaces/Wishlist.ts index 708f5aec..229644ea 100644 --- a/src/interfaces/Wishlist.ts +++ b/src/interfaces/Wishlist.ts @@ -1,5 +1,4 @@ import { JsonApiDocument, JsonApiListResponse, JsonApiSingleResponse } from './JsonApi' -import { IQuery } from './Query' import { IRelationships } from './Relationships' import { ResultResponse } from './ResultResponse' import { WithCommonOptions } from './WithCommonOptions' @@ -29,59 +28,20 @@ export interface WishlistResult extends ResultResponse {} export interface WishlistsResult extends ResultResponse {} -/** - * @deprecated Use {@link ListOptions} instead. - */ -export interface WishlistsList extends IQuery { - is_variant_included?: string -} - -/** - * @deprecated Use {@link ShowOptions} instead. - */ -export interface WishlistsShow extends IQuery { - is_variant_included?: string -} - -/** - * @deprecated Use {@link DefaultOptions} instead. - */ -export interface WishlistsDefault extends IQuery { - is_variant_included?: string -} - -/** - * @deprecated Use {@link CreateOptions} instead. - */ -export interface WishlistsCreate extends IQuery { - name: string - is_private?: boolean - is_default?: boolean -} - -/** - * @deprecated Use {@link UpdateOptions} instead. - */ -export interface WishlistsUpdate extends IQuery { - name: string - is_private?: boolean - is_default?: boolean -} - -export type ListOptions = WithCommonOptions<{ suggestToken: true; suggestQuery: true }, WishlistsList> +export type ListOptions = WithCommonOptions<{ suggestToken: true; suggestQuery: true }, { is_variant_included?: string }> export type ShowOptions = WithCommonOptions< { suggestToken: true; suggestQuery: true }, - { wishlist_token: string } & WishlistsShow + { wishlist_token: string } & { is_variant_included?: string } > -export type DefaultOptions = WithCommonOptions<{ suggestToken: true; suggestQuery: true }, WishlistsDefault> +export type DefaultOptions = WithCommonOptions<{ suggestToken: true; suggestQuery: true }, { is_variant_included?: string }> -export type CreateOptions = WithCommonOptions<{ suggestToken: true; suggestQuery: true }, WishlistsCreate> +export type CreateOptions = WithCommonOptions<{ suggestToken: true; suggestQuery: true }, { name: string; is_private?: boolean; is_default?: boolean}> export type UpdateOptions = WithCommonOptions< { suggestToken: true; suggestQuery: true }, - { wishlist_token: string } & WishlistsUpdate + { wishlist_token: string } & { name: string; is_private?: boolean; is_default?: boolean} > export type RemoveOptions = WithCommonOptions<{ suggestToken: true }, { wishlist_token: string }> diff --git a/src/interfaces/endpoints/CartClass.ts b/src/interfaces/endpoints/CartClass.ts deleted file mode 100644 index 5cc13a23..00000000 --- a/src/interfaces/endpoints/CartClass.ts +++ /dev/null @@ -1,58 +0,0 @@ -// IMPORTANT: Place all new checkout types inside src/interfaces/Cart instead of this file. -// TODO: Transfer all existing types inside this file to src/interfaces/Cart. - -import { IQuery } from '../Query' - -/** - * @deprecated Use {@link AddItemOptions} instead. - */ -export interface AddItem extends IQuery { - variant_id: string - quantity: number - options?: { - [key: string]: string - } -} - -/** - * @deprecated Use {@link SetQuantityOptions} instead. - */ -export interface SetQuantity extends IQuery { - line_item_id: string - quantity: number -} - -/** - * @deprecated Use {@link ApplyCouponCodeOptions} instead. - */ -export interface CouponCode extends IQuery { - coupon_code: string -} - -/** - * @deprecated Use {@link EstimateShippingRates} instead. - */ -export interface EstimateShippingMethods extends IQuery { - country_iso: string -} - -/** - * @deprecated Use {@link EstimateShippingRatesOptions} instead. - */ -export interface EstimateShippingRates extends IQuery { - country_iso: string -} - -/** - * @deprecated Use {@link AssociateGuestCartOptions} instead. - */ -export interface AssociateCart extends IQuery { - guest_order_token: string -} - -/** - * @deprecated Use {@link ChangeCurrencyOptions} instead. - */ -export interface ChangeCurrency extends IQuery { - new_currency: string -} diff --git a/src/interfaces/endpoints/CheckoutClass.ts b/src/interfaces/endpoints/CheckoutClass.ts deleted file mode 100644 index 14d9dd09..00000000 --- a/src/interfaces/endpoints/CheckoutClass.ts +++ /dev/null @@ -1,72 +0,0 @@ -// IMPORTANT: Place all new checkout types inside src/interfaces/Checkout instead of this file. -// TODO: Transfer all existing types inside this file to src/interfaces/Checkout. - -import { IAddress } from '../attributes/Address' -import { IPayment } from '../attributes/Payment' -import { IPaymentSource } from '../attributes/PaymentSource' -import { IShipment } from '../attributes/Shipment' -import { IQuery } from '../Query' - -/** - * @deprecated Use {@link AddStoreCreditOptions} instead. - */ -export interface AddStoreCredit extends IQuery { - amount: number -} - -/** - * @deprecated Use {@link OrderUpdateOptions} instead. - */ -export interface OrderUpdate extends IQuery { - order?: { - email?: string - special_instructions?: string - bill_address_attributes?: IAddress - ship_address_attributes?: IAddress - payments_attributes?: AddFullPayment[] - shipments_attributes?: IShipment[] - } -} - -/** - * @deprecated This type is no longer used - */ -export interface NestedAttributes extends IQuery { - order?: { - email?: string - special_instructions?: string - bill_address_attributes?: IAddress - ship_address_attributes?: IAddress - payments_attributes?: IPayment[] - shipments_attributes?: IShipment[] - } - payment_source?: IPaymentSource -} - -export interface AddFullPayment { - payment_method_id: string - source_attributes?: { - gateway_payment_profile_id: string - cc_type?: string - last_digits?: string - month?: string - year?: string - name: string - } -} - -/** - * @deprecated Use {@link SelectShippingMethodOptions} instead. - */ -export interface SelectShippingMethod extends IQuery { - shipping_method_id: string - shipment_id?: string -} - -/** - * @deprecated Use {@link AddPaymentOptions} instead. - */ -export interface AddPayment extends AddFullPayment, IQuery { - source_id?: string - amount?: number -}