diff --git a/.changeset/unlucky-dogs-help.md b/.changeset/unlucky-dogs-help.md new file mode 100644 index 000000000..579bdb4a1 --- /dev/null +++ b/.changeset/unlucky-dogs-help.md @@ -0,0 +1,5 @@ +--- +"@shopware-pwa/composables-next": patch +--- + +`useCustomerOrders` - added checkPromotions flag for loading orders diff --git a/packages/composables/src/useCustomerOrders/useCustomerOrders.ts b/packages/composables/src/useCustomerOrders/useCustomerOrders.ts index c59ae4386..661913524 100644 --- a/packages/composables/src/useCustomerOrders/useCustomerOrders.ts +++ b/packages/composables/src/useCustomerOrders/useCustomerOrders.ts @@ -1,7 +1,7 @@ import { ref, computed } from "vue"; import type { Ref, ComputedRef } from "vue"; import { useShopwareContext } from "#imports"; -import type { Schemas } from "#shopware"; +import type { Schemas, operations } from "#shopware"; export type UseCustomerOrdersReturn = { /** @@ -17,7 +17,9 @@ export type UseCustomerOrdersReturn = { /** * Fetches the orders list and assigns the result to the `orders` property */ - loadOrders(parameters?: Schemas["Criteria"]): Promise; + loadOrders( + parameters?: operations["readOrder post /order"]["body"], + ): Promise; /** * Current page number */ @@ -50,7 +52,7 @@ export function useCustomerOrders(): UseCustomerOrdersReturn { const currentParams = ref({}); const loadOrders = async ( - parameters: Schemas["Criteria"] = {}, + parameters: operations["readOrder post /order"]["body"] = {}, ): Promise => { const params = { ...parameters, diff --git a/packages/composables/src/useDefaultOrderAssociations/useDefaultOrderAssociations.test.ts b/packages/composables/src/useDefaultOrderAssociations/useDefaultOrderAssociations.test.ts index b79f87e73..c8e6e1f1a 100644 --- a/packages/composables/src/useDefaultOrderAssociations/useDefaultOrderAssociations.test.ts +++ b/packages/composables/src/useDefaultOrderAssociations/useDefaultOrderAssociations.test.ts @@ -35,7 +35,6 @@ describe("useDefaultOrderAssociations", () => { }, }, }, - "checkPromotion": true, } `); }); diff --git a/packages/composables/src/useDefaultOrderAssociations/useDefaultOrderAssociations.ts b/packages/composables/src/useDefaultOrderAssociations/useDefaultOrderAssociations.ts index 039f952d8..fc91e42e7 100644 --- a/packages/composables/src/useDefaultOrderAssociations/useDefaultOrderAssociations.ts +++ b/packages/composables/src/useDefaultOrderAssociations/useDefaultOrderAssociations.ts @@ -39,7 +39,6 @@ export function useDefaultOrderAssociations(): UseDefaultOrderAssociationsReturn }, }, }, - checkPromotion: true, }; return orderAssociations; diff --git a/packages/composables/src/useOrderDetails/useOrderDetails.ts b/packages/composables/src/useOrderDetails/useOrderDetails.ts index c6ff12f97..6db9c23ae 100644 --- a/packages/composables/src/useOrderDetails/useOrderDetails.ts +++ b/packages/composables/src/useOrderDetails/useOrderDetails.ts @@ -185,6 +185,7 @@ export function useOrderDetails( }, ], associations: mergedAssociations.associations, + checkPromotion: true, } as Schemas["Criteria"]; const orderDetailsResponse = await apiClient.invoke( diff --git a/templates/vue-demo-store/pages/account/order.vue b/templates/vue-demo-store/pages/account/order.vue index 8be1d9e27..19556e5b2 100644 --- a/templates/vue-demo-store/pages/account/order.vue +++ b/templates/vue-demo-store/pages/account/order.vue @@ -85,6 +85,7 @@ await useAsyncData("getOrders", () => { return loadOrders({ limit: limit.value, page: route.query.p ? Number(route.query.p) : defaultPage, + checkPromotion: true, // determines whether "paymentChangeable" list is available in the response associations: { stateMachineState: {}, },