|
12 | 12 | - [*SearchProductTitleUsingL2Similarity*](#searchproducttitleusingl2similarity) |
13 | 13 | - [*SearchProductReviewContentUsingL2Similarity*](#searchproductreviewcontentusingl2similarity) |
14 | 14 | - [*GetOrdersByCustomerId*](#getordersbycustomerid) |
| 15 | +<<<<<<< HEAD |
| 16 | +======= |
| 17 | + - [*GetCurrentCustomerOrders*](#getcurrentcustomerorders) |
| 18 | +>>>>>>> 5d0afe2 (feature: Next.js e-commerce template (#292)) |
15 | 19 | - [*GetOrderById*](#getorderbyid) |
16 | 20 | - [**Mutations**](#mutations) |
17 | 21 | - [*UpsertCustomer*](#upsertcustomer) |
@@ -987,6 +991,7 @@ Recall that executing the `GetOrdersByCustomerId` query returns a `QueryPromise` |
987 | 991 | The `data` property is an object of type `GetOrdersByCustomerIdData`, which is defined in [default-connector/index.d.ts](./index.d.ts). It has the following fields: |
988 | 992 | ```javascript |
989 | 993 | export interface GetOrdersByCustomerIdData { |
| 994 | +<<<<<<< HEAD |
990 | 995 | orders?: { |
991 | 996 | orders_on_customer: ({ |
992 | 997 | id: UUIDString; |
@@ -1017,6 +1022,36 @@ export interface GetOrdersByCustomerIdData { |
1017 | 1022 | } & OrderItem_Key)[]; |
1018 | 1023 | } & Order_Key)[]; |
1019 | 1024 | }; |
| 1025 | +======= |
| 1026 | + orders: ({ |
| 1027 | + id: UUIDString; |
| 1028 | + customerId: string; |
| 1029 | + processedAt: DateString; |
| 1030 | + chargeId?: string | null; |
| 1031 | + paymentIntentId?: string | null; |
| 1032 | + receiptUrl?: string | null; |
| 1033 | + subtotalPrice: number; |
| 1034 | + totalPrice: number; |
| 1035 | + financialStatus: string; |
| 1036 | + fulfillmentStatus: string; |
| 1037 | + orderItems_on_order: ({ |
| 1038 | + id: UUIDString; |
| 1039 | + quantity: number; |
| 1040 | + price: number; |
| 1041 | + product: { |
| 1042 | + id: UUIDString; |
| 1043 | + title: string; |
| 1044 | + handle: string; |
| 1045 | + productImages_on_product: ({ |
| 1046 | + url: string; |
| 1047 | + altText?: string | null; |
| 1048 | + width: number; |
| 1049 | + height: number; |
| 1050 | + })[]; |
| 1051 | + } & Product_Key; |
| 1052 | + } & OrderItem_Key)[]; |
| 1053 | + } & Order_Key)[]; |
| 1054 | +>>>>>>> 5d0afe2 (feature: Next.js e-commerce template (#292)) |
1020 | 1055 | } |
1021 | 1056 | ``` |
1022 | 1057 | ### Using `GetOrdersByCustomerId`'s action shortcut function |
@@ -1082,6 +1117,113 @@ executeQuery(ref).then((response) => { |
1082 | 1117 | }); |
1083 | 1118 | ``` |
1084 | 1119 |
|
| 1120 | +<<<<<<< HEAD |
| 1121 | +======= |
| 1122 | +## GetCurrentCustomerOrders |
| 1123 | +You can execute the `GetCurrentCustomerOrders` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [default-connector/index.d.ts](./index.d.ts): |
| 1124 | +```javascript |
| 1125 | +getCurrentCustomerOrders(): QueryPromise<GetCurrentCustomerOrdersData, undefined>; |
| 1126 | + |
| 1127 | +getCurrentCustomerOrdersRef(): QueryRef<GetCurrentCustomerOrdersData, undefined>; |
| 1128 | +``` |
| 1129 | +You can also pass in a `DataConnect` instance to the action shortcut function or `QueryRef` function. |
| 1130 | +```javascript |
| 1131 | +getCurrentCustomerOrders(dc: DataConnect): QueryPromise<GetCurrentCustomerOrdersData, undefined>; |
| 1132 | + |
| 1133 | +getCurrentCustomerOrdersRef(dc: DataConnect): QueryRef<GetCurrentCustomerOrdersData, undefined>; |
| 1134 | +``` |
| 1135 | + |
| 1136 | +### Variables |
| 1137 | +The `GetCurrentCustomerOrders` query has no variables. |
| 1138 | +### Return Type |
| 1139 | +Recall that executing the `GetCurrentCustomerOrders` query returns a `QueryPromise` that resolves to an object with a `data` property. |
| 1140 | + |
| 1141 | +The `data` property is an object of type `GetCurrentCustomerOrdersData`, which is defined in [default-connector/index.d.ts](./index.d.ts). It has the following fields: |
| 1142 | +```javascript |
| 1143 | +export interface GetCurrentCustomerOrdersData { |
| 1144 | + orders?: { |
| 1145 | + orders_on_customer: ({ |
| 1146 | + id: UUIDString; |
| 1147 | + processedAt: DateString; |
| 1148 | + chargeId?: string | null; |
| 1149 | + paymentIntentId?: string | null; |
| 1150 | + receiptUrl?: string | null; |
| 1151 | + subtotalPrice: number; |
| 1152 | + totalPrice: number; |
| 1153 | + financialStatus: string; |
| 1154 | + fulfillmentStatus: string; |
| 1155 | + orderItems_on_order: ({ |
| 1156 | + id: UUIDString; |
| 1157 | + quantity: number; |
| 1158 | + price: number; |
| 1159 | + product: { |
| 1160 | + id: UUIDString; |
| 1161 | + title: string; |
| 1162 | + handle: string; |
| 1163 | + productImages_on_product: ({ |
| 1164 | + url: string; |
| 1165 | + altText?: string | null; |
| 1166 | + width: number; |
| 1167 | + height: number; |
| 1168 | + })[]; |
| 1169 | + } & Product_Key; |
| 1170 | + } & OrderItem_Key)[]; |
| 1171 | + } & Order_Key)[]; |
| 1172 | + }; |
| 1173 | +} |
| 1174 | +``` |
| 1175 | +### Using `GetCurrentCustomerOrders`'s action shortcut function |
| 1176 | + |
| 1177 | +```javascript |
| 1178 | +import { getDataConnect, DataConnect } from 'firebase/data-connect'; |
| 1179 | +import { connectorConfig, getCurrentCustomerOrders } from '@firebasegen/default-connector'; |
| 1180 | + |
| 1181 | + |
| 1182 | +// Call the `getCurrentCustomerOrders()` function to execute the query. |
| 1183 | +// You can use the `await` keyword to wait for the promise to resolve. |
| 1184 | +const { data } = await getCurrentCustomerOrders(); |
| 1185 | + |
| 1186 | +// You can also pass in a `DataConnect` instance to the action shortcut function. |
| 1187 | +const dataConnect = getDataConnect(connectorConfig); |
| 1188 | +const { data } = await getCurrentCustomerOrders(dataConnect); |
| 1189 | + |
| 1190 | +console.log(data.orders); |
| 1191 | + |
| 1192 | +// Or, you can use the `Promise` API. |
| 1193 | +getCurrentCustomerOrders().then((response) => { |
| 1194 | + const data = response.data; |
| 1195 | + console.log(data.orders); |
| 1196 | +}); |
| 1197 | +``` |
| 1198 | + |
| 1199 | +### Using `GetCurrentCustomerOrders`'s `QueryRef` function |
| 1200 | + |
| 1201 | +```javascript |
| 1202 | +import { getDataConnect, DataConnect, executeQuery } from 'firebase/data-connect'; |
| 1203 | +import { connectorConfig, getCurrentCustomerOrdersRef } from '@firebasegen/default-connector'; |
| 1204 | + |
| 1205 | + |
| 1206 | +// Call the `getCurrentCustomerOrdersRef()` function to get a reference to the query. |
| 1207 | +const ref = getCurrentCustomerOrdersRef(); |
| 1208 | + |
| 1209 | +// You can also pass in a `DataConnect` instance to the `QueryRef` function. |
| 1210 | +const dataConnect = getDataConnect(connectorConfig); |
| 1211 | +const ref = getCurrentCustomerOrdersRef(dataConnect); |
| 1212 | + |
| 1213 | +// Call `executeQuery()` on the reference to execute the query. |
| 1214 | +// You can use the `await` keyword to wait for the promise to resolve. |
| 1215 | +const { data } = await executeQuery(ref); |
| 1216 | + |
| 1217 | +console.log(data.orders); |
| 1218 | + |
| 1219 | +// Or, you can use the `Promise` API. |
| 1220 | +executeQuery(ref).then((response) => { |
| 1221 | + const data = response.data; |
| 1222 | + console.log(data.orders); |
| 1223 | +}); |
| 1224 | +``` |
| 1225 | + |
| 1226 | +>>>>>>> 5d0afe2 (feature: Next.js e-commerce template (#292)) |
1085 | 1227 | ## GetOrderById |
1086 | 1228 | You can execute the `GetOrderById` query using the following action shortcut function, or by calling `executeQuery()` after calling the following `QueryRef` function, both of which are defined in [default-connector/index.d.ts](./index.d.ts): |
1087 | 1229 | ```javascript |
|
0 commit comments