@teamnovu/kit-shopware-composables 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/helpers/checkout/index.d.ts +1 -1
  2. package/dist/helpers/checkout/{useAddresses.d.ts → useCheckoutAddresses.d.ts} +6 -16
  3. package/dist/helpers/checkout/useOrderDetails.d.ts +7 -163
  4. package/dist/helpers/checkout/useOrderPayment.d.ts +4 -37
  5. package/dist/helpers/checkout/usePaymentMethods.d.ts +7 -19
  6. package/dist/helpers/checkout/useShippingMethods.d.ts +7 -19
  7. package/dist/helpers/types/schema.d.ts +5 -0
  8. package/dist/index.mjs +681 -574
  9. package/dist/query/address/useCreateCustomerAddressMutation.d.ts +1 -162
  10. package/dist/query/address/useUpdateCustomerAddressMutation.d.ts +1 -162
  11. package/dist/query/cart/useAddLineItemMutation.d.ts +1 -122
  12. package/dist/query/cart/useRemoveLineItemMutation.d.ts +5 -126
  13. package/dist/query/cart/useUpdateLineItemMutation.d.ts +1 -122
  14. package/dist/query/checkout/index.d.ts +0 -1
  15. package/dist/query/checkout/useCreateOrderMutation.d.ts +2 -278
  16. package/dist/query/context/useUpdateContextMutation.d.ts +5 -15
  17. package/dist/query/customer/index.d.ts +7 -0
  18. package/dist/query/customer/useChangeEmailMutation.d.ts +1 -11
  19. package/dist/query/customer/useChangePasswordMutation.d.ts +6 -0
  20. package/dist/query/customer/useChangeProfileMutation.d.ts +1 -11
  21. package/dist/query/customer/useDefaultBillingAddressMutation.d.ts +6 -0
  22. package/dist/query/customer/useDefaultShippingAddressMutation.d.ts +6 -0
  23. package/dist/query/customer/useDeleteCustomerMutation.d.ts +6 -0
  24. package/dist/query/customer/useLoginCustomerMutation.d.ts +5 -15
  25. package/dist/query/customer/useLogoutCustomerMutation.d.ts +1 -11
  26. package/dist/query/customer/useRecoveryPasswordMutation.d.ts +6 -0
  27. package/dist/query/customer/useRegisterConfirmMutation.d.ts +21 -0
  28. package/dist/query/customer/useRegisterCustomerMutation.d.ts +1 -262
  29. package/dist/query/customer/useSendRecoveryMailMutation.d.ts +6 -0
  30. package/dist/query/payment/useHandlePaymentMutation.d.ts +1 -11
  31. package/dist/query/payment/useOrderSetPaymentMutation.d.ts +1 -11
  32. package/dist/query/types/query.d.ts +2 -2
  33. package/dist/util/index.d.ts +1 -0
  34. package/dist/util/isAsynchronous.d.ts +3 -0
  35. package/docs/index.md +3 -3
  36. package/package.json +2 -2
  37. package/src/helpers/checkout/index.ts +1 -1
  38. package/src/helpers/checkout/{useAddresses.ts → useCheckoutAddresses.ts} +1 -1
  39. package/src/helpers/checkout/useOrderDetails.ts +8 -8
  40. package/src/helpers/checkout/useOrderPayment.ts +6 -10
  41. package/src/helpers/types/schema.ts +11 -0
  42. package/src/query/checkout/index.ts +0 -1
  43. package/src/query/checkout/useCreateOrderMutation.ts +2 -2
  44. package/src/query/customer/index.ts +7 -0
  45. package/src/query/customer/useChangeEmailMutation.ts +2 -1
  46. package/src/query/customer/useChangePasswordMutation.ts +28 -0
  47. package/src/query/customer/useChangeProfileMutation.ts +5 -2
  48. package/src/query/customer/useDefaultBillingAddressMutation.ts +35 -0
  49. package/src/query/customer/useDefaultShippingAddressMutation.ts +35 -0
  50. package/src/query/customer/useDeleteCustomerMutation.ts +36 -0
  51. package/src/query/customer/useRecoveryPasswordMutation.ts +28 -0
  52. package/src/query/customer/useRegisterConfirmMutation.ts +37 -0
  53. package/src/query/customer/useSendRecoveryMailMutation.ts +28 -0
  54. package/src/query/types/operations.ts +0 -1
  55. package/src/query/types/query.ts +2 -2
  56. package/src/util/index.ts +1 -0
  57. package/src/util/isAsynchronous.ts +8 -0
  58. package/dist/query/checkout/useCheckout.d.ts +0 -1
  59. package/src/query/checkout/useCheckout.ts +0 -2
@@ -0,0 +1,21 @@
1
+ import { UseMutationOptions, UseMutationReturnType, MutationObserverIdleResult, MutationObserverLoadingResult, MutationObserverErrorResult, MutationObserverSuccessResult } from '@tanstack/vue-query';
2
+ import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client';
3
+ import { OperationBody, OperationResponse } from '../types/query';
4
+ declare const registerConfirmOperation = "registerConfirm post /account/register-confirm";
5
+ export declare function useRegisterConfirmMutation(mutationOptions?: UseMutationOptions<OperationResponse<typeof registerConfirmOperation>, ShopwareApiError | Error, OperationBody<typeof registerConfirmOperation>>): UseMutationReturnType<never, Error | ShopwareApiError, {
6
+ em: string;
7
+ hash: string;
8
+ }, unknown, Omit< MutationObserverIdleResult<never, Error | ShopwareApiError, {
9
+ em: string;
10
+ hash: string;
11
+ }, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<never, Error | ShopwareApiError, {
12
+ em: string;
13
+ hash: string;
14
+ }, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<never, Error | ShopwareApiError, {
15
+ em: string;
16
+ hash: string;
17
+ }, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<never, Error | ShopwareApiError, {
18
+ em: string;
19
+ hash: string;
20
+ }, unknown>, "mutate" | "reset">>;
21
+ export {};
@@ -1,267 +1,6 @@
1
1
  import { UseMutationOptions, UseMutationReturnType, MutationObserverIdleResult, MutationObserverLoadingResult, MutationObserverErrorResult, MutationObserverSuccessResult } from '@tanstack/vue-query';
2
2
  import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client';
3
3
  import { OperationOptions, OperationResponse } from '../types/query';
4
- import { components, GenericRecord } from '../../../api-types/storeApiTypes';
5
4
  declare const registerOperation = "register post /account/register";
6
- export declare function useRegisterCustomerMutation(mutationOptions?: UseMutationOptions<OperationResponse<typeof registerOperation>, ShopwareApiError | Error, OperationOptions<typeof registerOperation>>): UseMutationReturnType<{
7
- active?: boolean;
8
- activeBillingAddress: components["schemas"]["CustomerAddress"];
9
- activeShippingAddress: components["schemas"]["CustomerAddress"];
10
- addresses?: components["schemas"]["CustomerAddress"][];
11
- affiliateCode?: string;
12
- apiAlias: "customer";
13
- birthday?: string;
14
- campaignCode?: string;
15
- readonly createdAt?: string;
16
- createdById?: string;
17
- customerNumber: string;
18
- customFields?: GenericRecord;
19
- defaultBillingAddress?: components["schemas"]["CustomerAddress"];
20
- defaultBillingAddressId: string;
21
- defaultShippingAddress?: components["schemas"]["CustomerAddress"];
22
- defaultShippingAddressId: string;
23
- doubleOptInConfirmDate?: string;
24
- doubleOptInEmailSentDate?: string;
25
- doubleOptInRegistration?: boolean;
26
- email: string;
27
- firstLogin?: string;
28
- firstName: string;
29
- group?: components["schemas"]["CustomerGroup"];
30
- groupId: string;
31
- guest?: boolean;
32
- hash?: string;
33
- id: string;
34
- language?: components["schemas"]["Language"];
35
- languageId: string;
36
- lastLogin?: string;
37
- lastName: string;
38
- readonly lastOrderDate?: string;
39
- lastPaymentMethod?: components["schemas"]["PaymentMethod"];
40
- lastPaymentMethodId?: string;
41
- readonly orderCount?: number;
42
- readonly orderTotalAmount?: number;
43
- readonly reviewCount?: number;
44
- salesChannelId: string;
45
- salutation?: components["schemas"]["Salutation"];
46
- salutationId?: string;
47
- readonly tagIds?: string[];
48
- tags?: components["schemas"]["Tag"][];
49
- title?: string;
50
- readonly updatedAt?: string;
51
- updatedById?: string;
52
- } & ({
53
- accountType: "private";
54
- } | {
55
- accountType: "business";
56
- company: string;
57
- vatIds: [string, ...string[]];
58
- }), Error | ShopwareApiError, OperationOptions<"register post /account/register">, unknown, Omit< MutationObserverIdleResult<{
59
- active?: boolean;
60
- activeBillingAddress: components["schemas"]["CustomerAddress"];
61
- activeShippingAddress: components["schemas"]["CustomerAddress"];
62
- addresses?: components["schemas"]["CustomerAddress"][];
63
- affiliateCode?: string;
64
- apiAlias: "customer";
65
- birthday?: string;
66
- campaignCode?: string;
67
- readonly createdAt?: string;
68
- createdById?: string;
69
- customerNumber: string;
70
- customFields?: GenericRecord;
71
- defaultBillingAddress?: components["schemas"]["CustomerAddress"];
72
- defaultBillingAddressId: string;
73
- defaultShippingAddress?: components["schemas"]["CustomerAddress"];
74
- defaultShippingAddressId: string;
75
- doubleOptInConfirmDate?: string;
76
- doubleOptInEmailSentDate?: string;
77
- doubleOptInRegistration?: boolean;
78
- email: string;
79
- firstLogin?: string;
80
- firstName: string;
81
- group?: components["schemas"]["CustomerGroup"];
82
- groupId: string;
83
- guest?: boolean;
84
- hash?: string;
85
- id: string;
86
- language?: components["schemas"]["Language"];
87
- languageId: string;
88
- lastLogin?: string;
89
- lastName: string;
90
- readonly lastOrderDate?: string;
91
- lastPaymentMethod?: components["schemas"]["PaymentMethod"];
92
- lastPaymentMethodId?: string;
93
- readonly orderCount?: number;
94
- readonly orderTotalAmount?: number;
95
- readonly reviewCount?: number;
96
- salesChannelId: string;
97
- salutation?: components["schemas"]["Salutation"];
98
- salutationId?: string;
99
- readonly tagIds?: string[];
100
- tags?: components["schemas"]["Tag"][];
101
- title?: string;
102
- readonly updatedAt?: string;
103
- updatedById?: string;
104
- } & ({
105
- accountType: "private";
106
- } | {
107
- accountType: "business";
108
- company: string;
109
- vatIds: [string, ...string[]];
110
- }), Error | ShopwareApiError, OperationOptions<"register post /account/register">, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<{
111
- active?: boolean;
112
- activeBillingAddress: components["schemas"]["CustomerAddress"];
113
- activeShippingAddress: components["schemas"]["CustomerAddress"];
114
- addresses?: components["schemas"]["CustomerAddress"][];
115
- affiliateCode?: string;
116
- apiAlias: "customer";
117
- birthday?: string;
118
- campaignCode?: string;
119
- readonly createdAt?: string;
120
- createdById?: string;
121
- customerNumber: string;
122
- customFields?: GenericRecord;
123
- defaultBillingAddress?: components["schemas"]["CustomerAddress"];
124
- defaultBillingAddressId: string;
125
- defaultShippingAddress?: components["schemas"]["CustomerAddress"];
126
- defaultShippingAddressId: string;
127
- doubleOptInConfirmDate?: string;
128
- doubleOptInEmailSentDate?: string;
129
- doubleOptInRegistration?: boolean;
130
- email: string;
131
- firstLogin?: string;
132
- firstName: string;
133
- group?: components["schemas"]["CustomerGroup"];
134
- groupId: string;
135
- guest?: boolean;
136
- hash?: string;
137
- id: string;
138
- language?: components["schemas"]["Language"];
139
- languageId: string;
140
- lastLogin?: string;
141
- lastName: string;
142
- readonly lastOrderDate?: string;
143
- lastPaymentMethod?: components["schemas"]["PaymentMethod"];
144
- lastPaymentMethodId?: string;
145
- readonly orderCount?: number;
146
- readonly orderTotalAmount?: number;
147
- readonly reviewCount?: number;
148
- salesChannelId: string;
149
- salutation?: components["schemas"]["Salutation"];
150
- salutationId?: string;
151
- readonly tagIds?: string[];
152
- tags?: components["schemas"]["Tag"][];
153
- title?: string;
154
- readonly updatedAt?: string;
155
- updatedById?: string;
156
- } & ({
157
- accountType: "private";
158
- } | {
159
- accountType: "business";
160
- company: string;
161
- vatIds: [string, ...string[]];
162
- }), Error | ShopwareApiError, OperationOptions<"register post /account/register">, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<{
163
- active?: boolean;
164
- activeBillingAddress: components["schemas"]["CustomerAddress"];
165
- activeShippingAddress: components["schemas"]["CustomerAddress"];
166
- addresses?: components["schemas"]["CustomerAddress"][];
167
- affiliateCode?: string;
168
- apiAlias: "customer";
169
- birthday?: string;
170
- campaignCode?: string;
171
- readonly createdAt?: string;
172
- createdById?: string;
173
- customerNumber: string;
174
- customFields?: GenericRecord;
175
- defaultBillingAddress?: components["schemas"]["CustomerAddress"];
176
- defaultBillingAddressId: string;
177
- defaultShippingAddress?: components["schemas"]["CustomerAddress"];
178
- defaultShippingAddressId: string;
179
- doubleOptInConfirmDate?: string;
180
- doubleOptInEmailSentDate?: string;
181
- doubleOptInRegistration?: boolean;
182
- email: string;
183
- firstLogin?: string;
184
- firstName: string;
185
- group?: components["schemas"]["CustomerGroup"];
186
- groupId: string;
187
- guest?: boolean;
188
- hash?: string;
189
- id: string;
190
- language?: components["schemas"]["Language"];
191
- languageId: string;
192
- lastLogin?: string;
193
- lastName: string;
194
- readonly lastOrderDate?: string;
195
- lastPaymentMethod?: components["schemas"]["PaymentMethod"];
196
- lastPaymentMethodId?: string;
197
- readonly orderCount?: number;
198
- readonly orderTotalAmount?: number;
199
- readonly reviewCount?: number;
200
- salesChannelId: string;
201
- salutation?: components["schemas"]["Salutation"];
202
- salutationId?: string;
203
- readonly tagIds?: string[];
204
- tags?: components["schemas"]["Tag"][];
205
- title?: string;
206
- readonly updatedAt?: string;
207
- updatedById?: string;
208
- } & ({
209
- accountType: "private";
210
- } | {
211
- accountType: "business";
212
- company: string;
213
- vatIds: [string, ...string[]];
214
- }), Error | ShopwareApiError, OperationOptions<"register post /account/register">, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<{
215
- active?: boolean;
216
- activeBillingAddress: components["schemas"]["CustomerAddress"];
217
- activeShippingAddress: components["schemas"]["CustomerAddress"];
218
- addresses?: components["schemas"]["CustomerAddress"][];
219
- affiliateCode?: string;
220
- apiAlias: "customer";
221
- birthday?: string;
222
- campaignCode?: string;
223
- readonly createdAt?: string;
224
- createdById?: string;
225
- customerNumber: string;
226
- customFields?: GenericRecord;
227
- defaultBillingAddress?: components["schemas"]["CustomerAddress"];
228
- defaultBillingAddressId: string;
229
- defaultShippingAddress?: components["schemas"]["CustomerAddress"];
230
- defaultShippingAddressId: string;
231
- doubleOptInConfirmDate?: string;
232
- doubleOptInEmailSentDate?: string;
233
- doubleOptInRegistration?: boolean;
234
- email: string;
235
- firstLogin?: string;
236
- firstName: string;
237
- group?: components["schemas"]["CustomerGroup"];
238
- groupId: string;
239
- guest?: boolean;
240
- hash?: string;
241
- id: string;
242
- language?: components["schemas"]["Language"];
243
- languageId: string;
244
- lastLogin?: string;
245
- lastName: string;
246
- readonly lastOrderDate?: string;
247
- lastPaymentMethod?: components["schemas"]["PaymentMethod"];
248
- lastPaymentMethodId?: string;
249
- readonly orderCount?: number;
250
- readonly orderTotalAmount?: number;
251
- readonly reviewCount?: number;
252
- salesChannelId: string;
253
- salutation?: components["schemas"]["Salutation"];
254
- salutationId?: string;
255
- readonly tagIds?: string[];
256
- tags?: components["schemas"]["Tag"][];
257
- title?: string;
258
- readonly updatedAt?: string;
259
- updatedById?: string;
260
- } & ({
261
- accountType: "private";
262
- } | {
263
- accountType: "business";
264
- company: string;
265
- vatIds: [string, ...string[]];
266
- }), Error | ShopwareApiError, OperationOptions<"register post /account/register">, unknown>, "mutate" | "reset">>;
5
+ export declare function useRegisterCustomerMutation(mutationOptions?: UseMutationOptions<OperationResponse<typeof registerOperation>, ShopwareApiError | Error, OperationOptions<typeof registerOperation>>): UseMutationReturnType<OperationResponse<"register post /account/register">, Error | ShopwareApiError, OperationOptions<"register post /account/register">, unknown, Omit< MutationObserverIdleResult<OperationResponse<"register post /account/register">, Error | ShopwareApiError, OperationOptions<"register post /account/register">, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<OperationResponse<"register post /account/register">, Error | ShopwareApiError, OperationOptions<"register post /account/register">, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<OperationResponse<"register post /account/register">, Error | ShopwareApiError, OperationOptions<"register post /account/register">, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<OperationResponse<"register post /account/register">, Error | ShopwareApiError, OperationOptions<"register post /account/register">, unknown>, "mutate" | "reset">>;
267
6
  export {};
@@ -0,0 +1,6 @@
1
+ import { UseMutationOptions, UseMutationReturnType, MutationObserverIdleResult, MutationObserverLoadingResult, MutationObserverErrorResult, MutationObserverSuccessResult } from '@tanstack/vue-query';
2
+ import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client';
3
+ import { OperationOptions, OperationResponse } from '../types/query';
4
+ declare const sendRecoveryMailOperation = "sendRecoveryMail post /account/recovery-password";
5
+ export declare function useSendRecoveryMailMutation(mutationOptions?: UseMutationOptions<OperationResponse<typeof sendRecoveryMailOperation>, ShopwareApiError | Error, OperationOptions<typeof sendRecoveryMailOperation>>): UseMutationReturnType<OperationResponse<"sendRecoveryMail post /account/recovery-password">, Error | ShopwareApiError, OperationOptions<"sendRecoveryMail post /account/recovery-password">, unknown, Omit< MutationObserverIdleResult<OperationResponse<"sendRecoveryMail post /account/recovery-password">, Error | ShopwareApiError, OperationOptions<"sendRecoveryMail post /account/recovery-password">, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<OperationResponse<"sendRecoveryMail post /account/recovery-password">, Error | ShopwareApiError, OperationOptions<"sendRecoveryMail post /account/recovery-password">, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<OperationResponse<"sendRecoveryMail post /account/recovery-password">, Error | ShopwareApiError, OperationOptions<"sendRecoveryMail post /account/recovery-password">, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<OperationResponse<"sendRecoveryMail post /account/recovery-password">, Error | ShopwareApiError, OperationOptions<"sendRecoveryMail post /account/recovery-password">, unknown>, "mutate" | "reset">>;
6
+ export {};
@@ -2,15 +2,5 @@ import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client';
2
2
  import { UseMutationOptions, UseMutationReturnType, MutationObserverIdleResult, MutationObserverLoadingResult, MutationObserverErrorResult, MutationObserverSuccessResult } from '@tanstack/vue-query';
3
3
  import { OperationOptions, OperationResponse } from '../types/query';
4
4
  declare const handlePaymentOperation = "handlePaymentMethod post /handle-payment";
5
- export declare function useHandlePaymentMutation(mutationOptions?: UseMutationOptions<OperationResponse<typeof handlePaymentOperation>, ShopwareApiError | Error, OperationOptions<typeof handlePaymentOperation>>): UseMutationReturnType<{
6
- redirectUrl: string;
7
- }, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown, Omit< MutationObserverIdleResult<{
8
- redirectUrl: string;
9
- }, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<{
10
- redirectUrl: string;
11
- }, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<{
12
- redirectUrl: string;
13
- }, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<{
14
- redirectUrl: string;
15
- }, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset">>;
5
+ export declare function useHandlePaymentMutation(mutationOptions?: UseMutationOptions<OperationResponse<typeof handlePaymentOperation>, ShopwareApiError | Error, OperationOptions<typeof handlePaymentOperation>>): UseMutationReturnType<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown, Omit< MutationObserverIdleResult<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<OperationResponse<"handlePaymentMethod post /handle-payment">, Error | ShopwareApiError, OperationOptions<"handlePaymentMethod post /handle-payment">, unknown>, "mutate" | "reset">>;
16
6
  export {};
@@ -2,15 +2,5 @@ import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client';
2
2
  import { UseMutationOptions, UseMutationReturnType, MutationObserverIdleResult, MutationObserverLoadingResult, MutationObserverErrorResult, MutationObserverSuccessResult } from '@tanstack/vue-query';
3
3
  import { OperationOptions, OperationResponse } from '../types/query';
4
4
  declare const orderSetPaymentOperation = "orderSetPayment post /order/payment";
5
- export declare function useOrderSetPaymentMutation(mutationOptions?: UseMutationOptions<OperationResponse<typeof orderSetPaymentOperation>, ShopwareApiError | Error, OperationOptions<typeof orderSetPaymentOperation>>): UseMutationReturnType<{
6
- success?: boolean;
7
- }, Error | ShopwareApiError, OperationOptions<"orderSetPayment post /order/payment">, unknown, Omit< MutationObserverIdleResult<{
8
- success?: boolean;
9
- }, Error | ShopwareApiError, OperationOptions<"orderSetPayment post /order/payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<{
10
- success?: boolean;
11
- }, Error | ShopwareApiError, OperationOptions<"orderSetPayment post /order/payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<{
12
- success?: boolean;
13
- }, Error | ShopwareApiError, OperationOptions<"orderSetPayment post /order/payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<{
14
- success?: boolean;
15
- }, Error | ShopwareApiError, OperationOptions<"orderSetPayment post /order/payment">, unknown>, "mutate" | "reset">>;
5
+ export declare function useOrderSetPaymentMutation(mutationOptions?: UseMutationOptions<OperationResponse<typeof orderSetPaymentOperation>, ShopwareApiError | Error, OperationOptions<typeof orderSetPaymentOperation>>): UseMutationReturnType<OperationResponse<"orderSetPayment post /order/payment">, Error | ShopwareApiError, OperationOptions<"orderSetPayment post /order/payment">, unknown, Omit< MutationObserverIdleResult<OperationResponse<"orderSetPayment post /order/payment">, Error | ShopwareApiError, OperationOptions<"orderSetPayment post /order/payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverLoadingResult<OperationResponse<"orderSetPayment post /order/payment">, Error | ShopwareApiError, OperationOptions<"orderSetPayment post /order/payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverErrorResult<OperationResponse<"orderSetPayment post /order/payment">, Error | ShopwareApiError, OperationOptions<"orderSetPayment post /order/payment">, unknown>, "mutate" | "reset"> | Omit< MutationObserverSuccessResult<OperationResponse<"orderSetPayment post /order/payment">, Error | ShopwareApiError, OperationOptions<"orderSetPayment post /order/payment">, unknown>, "mutate" | "reset">>;
16
6
  export {};
@@ -1,5 +1,5 @@
1
1
  import { QueryKey, UseQueryOptions } from '@tanstack/vue-query';
2
- import { OperationProp, OperationOptions as RawOperationOptions } from '@teamnovu/kit-shopware-api-client';
2
+ import { BrandedResponse, OperationProp, OperationOptions as RawOperationOptions } from '@teamnovu/kit-shopware-api-client';
3
3
  import { MaybeRef, UnwrapRef } from 'vue';
4
4
  import { Operations } from './operations';
5
5
  import { PartialProps } from './util';
@@ -11,6 +11,6 @@ export type ShallowUnwrapRefs<T> = {
11
11
  };
12
12
  export type OperationKey = keyof Operations;
13
13
  export type OperationBody<K extends OperationKey> = OperationProp<Operations, K, 'body'>;
14
- export type OperationResponse<K extends OperationKey> = OperationProp<Operations, K, 'response'>;
14
+ export type OperationResponse<K extends OperationKey> = BrandedResponse<Operations, K>;
15
15
  export type OperationOptions<K extends OperationKey, OmitKeys extends keyof RawOperationOptions<Operations, K> = never> = MaybeRef<ShallowMaybeRefs<PartialProps<RawOperationOptions<Operations, K>, OmitKeys>>>;
16
16
  export type Options<K extends OperationKey, QK extends QueryKey = QueryKey> = UseQueryOptions<OperationResponse<K>, Error, OperationResponse<K>, OperationResponse<K>, QK>;
@@ -1,3 +1,4 @@
1
1
  export * from './unrefOptions';
2
2
  export * from './url';
3
3
  export * from './useOptimistic';
4
+ export * from './isAsynchronous';
@@ -0,0 +1,3 @@
1
+ import { MaybeRef } from 'vue';
2
+ import { Schemas } from '../query/types/operations';
3
+ export declare const isAsynchronousOrder: (order: MaybeRef<Schemas["Order"] | null | undefined>) => any;
package/docs/index.md CHANGED
@@ -244,7 +244,7 @@ const {
244
244
  } = useShippingMethods()
245
245
  ```
246
246
 
247
- #### useAddresses
247
+ #### useCheckoutAddresses
248
248
  Manage customer addresses:
249
249
 
250
250
  ```typescript
@@ -255,7 +255,7 @@ const {
255
255
  setBillingAddress,
256
256
  setShippingAddress,
257
257
  isSaving
258
- } = useAddresses()
258
+ } = useCheckoutAddresses()
259
259
  ```
260
260
 
261
261
  ### Product Helpers
@@ -454,4 +454,4 @@ const handleCheckout = async () => {
454
454
  }
455
455
  }
456
456
  </script>
457
- ```
457
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamnovu/kit-shopware-composables",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "A collection of composables for the Shopware API",
5
5
  "main": "dist/index.mjs",
6
6
  "module": "dist/index.mjs",
@@ -17,7 +17,7 @@
17
17
  "peerDependencies": {
18
18
  "@tanstack/vue-query": "^5.75.5",
19
19
  "vue": "^3.0.0",
20
- "@teamnovu/kit-shopware-api-client": "0.0.4"
20
+ "@teamnovu/kit-shopware-api-client": "0.0.6"
21
21
  },
22
22
  "repository": {
23
23
  "type": "git",
@@ -1,4 +1,4 @@
1
- export * from './useAddresses'
1
+ export * from './useCheckoutAddresses'
2
2
  export * from './useOrderDetails'
3
3
  export * from './useOrderPayment'
4
4
  export * from './usePaymentMethods'
@@ -39,7 +39,7 @@ export function useCheckoutAddresses() {
39
39
 
40
40
  const inactiveShippingAddresses = computed(() =>
41
41
  addressListQuery.data.value?.elements.filter(
42
- address => address.id !== activeBillingAddress.value?.id,
42
+ address => address.id !== activeShippingAddress.value?.id,
43
43
  ) ?? [])
44
44
 
45
45
  return {
@@ -1,11 +1,11 @@
1
1
  import type { MaybeRef } from 'vue'
2
2
  import { computed, unref } from 'vue'
3
3
  import { useReadOrderQuery } from '../../query/order'
4
- import type { Schemas } from '../../query/types'
4
+ import type { BrandedSchema } from '../types/schema'
5
5
 
6
6
  export function useOrderDetails(
7
7
  orderId: MaybeRef<string>,
8
- criteria?: Schemas['Criteria'],
8
+ criteria?: BrandedSchema<'Criteria'>,
9
9
  ) {
10
10
  // Create reactive order query options
11
11
  const orderQueryOptions = computed(() => {
@@ -23,7 +23,7 @@ export function useOrderDetails(
23
23
  ],
24
24
  ...criteria,
25
25
  checkPromotion: true,
26
- } as Schemas['Criteria'],
26
+ } as BrandedSchema<'Criteria'>,
27
27
  }
28
28
  })
29
29
 
@@ -31,7 +31,7 @@ export function useOrderDetails(
31
31
  const orderQuery = useReadOrderQuery(orderQueryOptions.value)
32
32
 
33
33
  // Computed properties based on order data
34
- const order = computed(() => orderQuery.data?.value?.orders?.elements?.[0])
34
+ const order = computed(() => orderQuery.data?.value?.orders?.elements?.[0] as BrandedSchema<'Order'> | undefined)
35
35
 
36
36
  const paymentChangeableList = computed(() => {
37
37
  return orderQuery.data?.value?.paymentChangeable || {}
@@ -52,22 +52,22 @@ export function useOrderDetails(
52
52
  const billingAddress = computed(() =>
53
53
  order.value?.addresses?.find(
54
54
  ({ id }: { id: string }) => id === order.value?.billingAddressId,
55
- ))
55
+ ) as BrandedSchema<'OrderAddress'> | undefined)
56
56
 
57
57
  const shippingAddress = computed(
58
- () => order.value?.deliveries?.[0]?.shippingOrderAddress,
58
+ () => order.value?.deliveries?.[0]?.shippingOrderAddress as BrandedSchema<'OrderAddress'> | undefined,
59
59
  )
60
60
 
61
61
  const paymentMethod = computed(() => {
62
62
  const transactions = order.value?.transactions
63
63
  if (!transactions?.length) return undefined
64
- return transactions.at(-1)?.paymentMethod
64
+ return transactions.at(-1)?.paymentMethod as BrandedSchema<'PaymentMethod'> | undefined
65
65
  })
66
66
 
67
67
  const shippingMethod = computed(() => {
68
68
  const deliveries = order.value?.deliveries
69
69
  if (!deliveries?.length) return undefined
70
- return deliveries.at(-1)?.shippingMethod
70
+ return deliveries.at(-1)?.shippingMethod as BrandedSchema<'ShippingMethod'> | undefined
71
71
  })
72
72
 
73
73
  const paymentChangeable = computed(() => {
@@ -1,6 +1,8 @@
1
1
  import type { MaybeRef } from 'vue'
2
2
  import { computed, unref } from 'vue'
3
- import type { Schemas } from '../../query/types'
3
+ import type { Schemas } from '../../query/types/operations'
4
+ import type { BrandedSchema } from '../types/schema'
5
+ import { isAsynchronousOrder } from '../../util'
4
6
 
5
7
  export function useOrderPayment(
6
8
  order: MaybeRef<Schemas['Order'] | null | undefined>,
@@ -8,15 +10,10 @@ export function useOrderPayment(
8
10
  const activeTransaction = computed(() =>
9
11
  unref(order)?.transactions?.find(t => t.paymentMethod?.active === true))
10
12
 
11
- const paymentMethod = computed(() => activeTransaction.value?.paymentMethod)
12
- const state = computed(() => activeTransaction.value?.stateMachineState)
13
+ const paymentMethod = computed(() => activeTransaction.value?.paymentMethod as BrandedSchema<'PaymentMethod'> | undefined)
14
+ const state = computed(() => activeTransaction.value?.stateMachineState as BrandedSchema<'StateMachineState'> | undefined)
13
15
 
14
- const isAsynchronous = computed(
15
- () =>
16
- // @ts-expect-error - This property does not seem to be declared in the typescript types
17
- activeTransaction.value?.paymentMethod?.asynchronous
18
- && activeTransaction.value?.paymentMethod?.afterOrderEnabled,
19
- )
16
+ const isAsynchronous = computed(() => isAsynchronousOrder(order))
20
17
 
21
18
  return {
22
19
  isAsynchronous,
@@ -25,4 +22,3 @@ export function useOrderPayment(
25
22
  paymentMethod,
26
23
  }
27
24
  }
28
-
@@ -0,0 +1,11 @@
1
+ // This **Must** stay an interface and the response **must** be branded.
2
+ // This is to ensure that the response type is not already resolved when the
3
+
4
+ import type { Schemas } from '../../query/types/operations'
5
+
6
+ // library is built so we can still use module augmentation to override operations.
7
+ export interface SchemaType<TKey> {
8
+ __key?: TKey
9
+ }
10
+
11
+ export type BrandedSchema<SchemaKey extends (keyof Schemas) & string> = Schemas[SchemaKey] & SchemaType<SchemaKey>
@@ -1,2 +1 @@
1
- export * from './useCheckout'
2
1
  export * from './useCreateOrderMutation'
@@ -1,10 +1,10 @@
1
+ import { useMutation, useQueryClient, type UseMutationOptions } from '@tanstack/vue-query'
1
2
  import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client'
2
- import { useMutation, type UseMutationOptions, useQueryClient } from '@tanstack/vue-query'
3
3
  import { unref } from 'vue'
4
- import type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
5
4
  import { useShopwareQueryClient } from '../../inject'
6
5
  import { cartKeys, orderKeys } from '../../keys'
7
6
  import { unrefOptions } from '../../util/unrefOptions'
7
+ import type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
8
8
 
9
9
  const createOrderOperation = 'createOrder post /checkout/order' satisfies OperationKey
10
10
 
@@ -4,3 +4,10 @@ export * from './useLoginCustomerMutation'
4
4
  export * from './useLogoutCustomerMutation'
5
5
  export * from './useReadCustomerQuery'
6
6
  export * from './useRegisterCustomerMutation'
7
+ export * from './useDefaultBillingAddressMutation'
8
+ export * from './useDefaultShippingAddressMutation'
9
+ export * from './useDeleteCustomerMutation'
10
+ export * from './useRegisterConfirmMutation'
11
+ export * from './useSendRecoveryMailMutation'
12
+ export * from './useChangePasswordMutation'
13
+ export * from './useRecoveryPasswordMutation'
@@ -2,7 +2,7 @@ import { useMutation, type UseMutationOptions, useQueryClient } from '@tanstack/
2
2
  import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client'
3
3
  import { unref } from 'vue'
4
4
  import { useShopwareQueryClient } from '../../inject'
5
- import { customerKeys } from '../../keys'
5
+ import { contextKeys, customerKeys } from '../../keys'
6
6
  import { unrefOptions } from '../../util/unrefOptions'
7
7
  import type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
8
8
 
@@ -25,6 +25,7 @@ export function useChangeEmailMutation(
25
25
  },
26
26
  onSuccess: async (data, variables, context) => {
27
27
  await queryClient.invalidateQueries({ queryKey: customerKeys.all() })
28
+ await queryClient.invalidateQueries({ queryKey: contextKeys.all() })
28
29
 
29
30
  await unref(unref(mutationOptions)?.onSuccess)?.(data, variables, context)
30
31
  },
@@ -0,0 +1,28 @@
1
+ import { useMutation, type UseMutationOptions } from '@tanstack/vue-query'
2
+ import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client'
3
+ import { unref } from 'vue'
4
+ import { useShopwareQueryClient } from '../../inject'
5
+ import { unrefOptions } from '../../util/unrefOptions'
6
+ import type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
7
+
8
+ const changePasswordOperation = 'changePassword post /account/change-password' satisfies OperationKey
9
+
10
+ export function useChangePasswordMutation(
11
+ mutationOptions?: UseMutationOptions<
12
+ OperationResponse<typeof changePasswordOperation>,
13
+ ShopwareApiError | Error,
14
+ OperationOptions<typeof changePasswordOperation>
15
+ >,
16
+ ) {
17
+ const client = useShopwareQueryClient()
18
+
19
+ return useMutation({
20
+ ...mutationOptions,
21
+ mutationFn: async (options: OperationOptions<typeof changePasswordOperation>) => {
22
+ return client.query(changePasswordOperation, unrefOptions(options))
23
+ },
24
+ onSuccess: async (data, variables, context) => {
25
+ await unref(unref(mutationOptions)?.onSuccess)?.(data, variables, context)
26
+ },
27
+ })
28
+ }
@@ -2,7 +2,7 @@ import { useMutation, type UseMutationOptions, useQueryClient } from '@tanstack/
2
2
  import { ShopwareApiError } from '@teamnovu/kit-shopware-api-client'
3
3
  import { unref } from 'vue'
4
4
  import { useShopwareQueryClient } from '../../inject'
5
- import { customerKeys } from '../../keys'
5
+ import { contextKeys, customerKeys } from '../../keys'
6
6
  import { unrefOptions } from '../../util/unrefOptions'
7
7
  import type { OperationKey, OperationOptions, OperationResponse } from '../types/query'
8
8
 
@@ -24,7 +24,10 @@ export function useChangeProfileMutation(
24
24
  return client.query(changeProfileOperation, unrefOptions(options))
25
25
  },
26
26
  onSuccess: async (data, variables, context) => {
27
- await queryClient.invalidateQueries({ queryKey: customerKeys.all() })
27
+ await Promise.all([
28
+ queryClient.invalidateQueries({ queryKey: customerKeys.all() }),
29
+ queryClient.invalidateQueries({ queryKey: contextKeys.all() }),
30
+ ])
28
31
 
29
32
  await unref(unref(mutationOptions)?.onSuccess)?.(data, variables, context)
30
33
  },