|
| 1 | +interface BaseFieldFragment { |
| 2 | + value: number; |
| 3 | +} |
| 4 | + |
| 5 | +export interface HeadlessLineItem { |
| 6 | + name: string; |
| 7 | + entityId: string; |
| 8 | + quantity: number; |
| 9 | + productEntityId: number; |
| 10 | + brand: string; |
| 11 | + // parentEntityId: number; |
| 12 | + couponAmount: { |
| 13 | + value: number; |
| 14 | + }; |
| 15 | + discountedAmount: { |
| 16 | + value: number; |
| 17 | + }; |
| 18 | + discounts: Array<{ |
| 19 | + discountedAmount: { |
| 20 | + value: number; |
| 21 | + }; |
| 22 | + entityId: string; |
| 23 | + }>; |
| 24 | + extendedListPrice: { |
| 25 | + value: number; |
| 26 | + }; |
| 27 | + extendedSalePrice: { |
| 28 | + value: number; |
| 29 | + }; |
| 30 | + imageUrl: string; |
| 31 | + isTaxable: boolean; |
| 32 | + listPrice: { |
| 33 | + value: number; |
| 34 | + }; |
| 35 | + originalPrice: { |
| 36 | + value: number; |
| 37 | + }; |
| 38 | + salePrice: { |
| 39 | + value: number; |
| 40 | + }; |
| 41 | + sku: string; |
| 42 | + url: string; |
| 43 | + variantEntityId: number; |
| 44 | + selectedOptions: Array<{ |
| 45 | + __typename: string; |
| 46 | + value: string; |
| 47 | + valueEntityId: number; |
| 48 | + entityId: number; |
| 49 | + name: string; |
| 50 | + }>; |
| 51 | +} |
| 52 | + |
| 53 | +interface HeadlessPhysicalItem extends HeadlessLineItem { |
| 54 | + isShippingRequired: boolean; |
| 55 | + giftWrapping?: { |
| 56 | + amount: { |
| 57 | + value: number; |
| 58 | + }; |
| 59 | + message: string; |
| 60 | + name: string; |
| 61 | + } | null; |
| 62 | +} |
| 63 | + |
| 64 | +interface HeadlessDigitalItem extends HeadlessLineItem { |
| 65 | + // these fields can be optional because I did not see them in response |
| 66 | + downloadFileUrls: string[]; |
| 67 | + downloadPageUrl: string; |
| 68 | + downloadSize: string; |
| 69 | +} |
| 70 | + |
| 71 | +export interface HeadlessCustomItem { |
| 72 | + entityId: string; |
| 73 | + listPrice: BaseFieldFragment; |
| 74 | + extendedListPrice: BaseFieldFragment; |
| 75 | + name: string; |
| 76 | + quantity: number; |
| 77 | + sku: string; |
| 78 | +} |
| 79 | + |
| 80 | +export interface HeadlessGiftCertificates { |
| 81 | + amount: BaseFieldFragment; |
| 82 | + name: string; |
| 83 | + theme: string; |
| 84 | + entityId: string | number; |
| 85 | + isTaxable: boolean; |
| 86 | + message: string; |
| 87 | + sender: { |
| 88 | + email: string; |
| 89 | + name: string; |
| 90 | + }; |
| 91 | + recipient: { |
| 92 | + email: string; |
| 93 | + name: string; |
| 94 | + }; |
| 95 | +} |
| 96 | + |
| 97 | +export interface HeadlessLineItems { |
| 98 | + physicalItems: HeadlessPhysicalItem[]; |
| 99 | + digitalItems: HeadlessDigitalItem[]; |
| 100 | + customItems: HeadlessCustomItem[]; |
| 101 | + giftCertificates?: HeadlessGiftCertificates[]; |
| 102 | +} |
| 103 | + |
| 104 | +export default interface HeadlessCartResponse { |
| 105 | + cart: { |
| 106 | + amount: BaseFieldFragment; // cart amount; |
| 107 | + baseAmount: BaseFieldFragment; |
| 108 | + entityId: string; |
| 109 | + id: string; |
| 110 | + createdAt: { |
| 111 | + utc: string; |
| 112 | + }; |
| 113 | + updatedAt: { |
| 114 | + utc: string; |
| 115 | + }; |
| 116 | + discounts: Array<{ |
| 117 | + discountedAmount: BaseFieldFragment; |
| 118 | + entityId: string; |
| 119 | + }>; |
| 120 | + discountedAmount: BaseFieldFragment; |
| 121 | + isTaxIncluded: boolean; |
| 122 | + currencyCode: string; |
| 123 | + lineItems: HeadlessLineItems; |
| 124 | + }; |
| 125 | + checkout: { |
| 126 | + coupons: Array<{ |
| 127 | + entityId: string; |
| 128 | + code: string; |
| 129 | + couponType: string; |
| 130 | + discountedAmount: { |
| 131 | + value: number; |
| 132 | + }; |
| 133 | + }>; |
| 134 | + }; |
| 135 | +} |
0 commit comments