Skip to content

Commit 27dc6d7

Browse files
authored
chore(dashboard): fix type and lint errors (3/n) (#15211)
1 parent f47621a commit 27dc6d7

13 files changed

Lines changed: 94 additions & 84 deletions

packages/admin/dashboard/src/hooks/api/claims.tsx

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export const useUpdateClaimInboundItem = (
234234
id: string,
235235
orderId: string,
236236
options?: UseMutationOptions<
237-
HttpTypes.AdminClaimResponse,
237+
HttpTypes.AdminClaimReturnPreviewResponse,
238238
FetchError,
239239
HttpTypes.AdminUpdateClaimInboundItem & { actionId: string }
240240
>
@@ -264,7 +264,11 @@ export const useUpdateClaimInboundItem = (
264264
export const useRemoveClaimInboundItem = (
265265
id: string,
266266
orderId: string,
267-
options?: UseMutationOptions<HttpTypes.AdminClaimResponse, FetchError, string>
267+
options?: UseMutationOptions<
268+
HttpTypes.AdminClaimReturnPreviewResponse,
269+
FetchError,
270+
string
271+
>
268272
) => {
269273
return useMutation({
270274
mutationFn: (actionId: string) =>
@@ -292,7 +296,7 @@ export const useAddClaimInboundShipping = (
292296
id: string,
293297
orderId: string,
294298
options?: UseMutationOptions<
295-
HttpTypes.AdminClaimResponse,
299+
HttpTypes.AdminClaimReturnPreviewResponse,
296300
FetchError,
297301
HttpTypes.AdminClaimAddInboundShipping
298302
>
@@ -319,9 +323,9 @@ export const useUpdateClaimInboundShipping = (
319323
id: string,
320324
orderId: string,
321325
options?: UseMutationOptions<
322-
HttpTypes.AdminClaimResponse,
326+
HttpTypes.AdminClaimPreviewResponse,
323327
FetchError,
324-
HttpTypes.AdminClaimUpdateInboundShipping
328+
HttpTypes.AdminClaimUpdateInboundShipping & { actionId: string }
325329
>
326330
) => {
327331
return useMutation({
@@ -348,7 +352,11 @@ export const useUpdateClaimInboundShipping = (
348352
export const useDeleteClaimInboundShipping = (
349353
id: string,
350354
orderId: string,
351-
options?: UseMutationOptions<HttpTypes.AdminClaimResponse, FetchError, string>
355+
options?: UseMutationOptions<
356+
HttpTypes.AdminClaimReturnPreviewResponse,
357+
FetchError,
358+
string
359+
>
352360
) => {
353361
return useMutation({
354362
mutationFn: (actionId: string) =>
@@ -480,9 +488,9 @@ export const useUpdateClaimOutboundShipping = (
480488
id: string,
481489
orderId: string,
482490
options?: UseMutationOptions<
483-
HttpTypes.AdminClaimResponse,
491+
HttpTypes.AdminClaimPreviewResponse,
484492
FetchError,
485-
HttpTypes.AdminClaimUpdateOutboundShipping
493+
HttpTypes.AdminClaimUpdateOutboundShipping & { actionId: string }
486494
>
487495
) => {
488496
return useMutation({
@@ -567,7 +575,7 @@ export const useClaimConfirmRequest = (
567575
export const useCancelClaimRequest = (
568576
id: string,
569577
orderId: string,
570-
options?: UseMutationOptions<HttpTypes.AdminClaimResponse, FetchError>
578+
options?: UseMutationOptions<HttpTypes.AdminClaimDeleteResponse, FetchError>
571579
) => {
572580
return useMutation({
573581
mutationFn: () => sdk.admin.claim.cancelRequest(id),

packages/admin/dashboard/src/hooks/api/customers.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,16 +226,15 @@ export const useDeleteCustomerAddress = (
226226

227227
export const useListCustomerAddresses = (
228228
id: string,
229-
query?: Record<string, any>,
230229
options?: UseQueryOptions<
231-
HttpTypes.AdminCustomerResponse,
230+
HttpTypes.AdminCustomerAddressListResponse,
232231
FetchError,
233-
HttpTypes.AdminCustomerResponse,
232+
HttpTypes.AdminCustomerAddressListResponse,
234233
QueryKey
235234
>
236235
) => {
237236
const { data, ...rest } = useQuery({
238-
queryFn: () => sdk.admin.customer.listAddresses(id, query),
237+
queryFn: () => sdk.admin.customer.listAddresses(id),
239238
queryKey: customerAddressesQueryKeys.list(id),
240239
...options,
241240
})

packages/admin/dashboard/src/hooks/api/exchanges.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export const useAddExchangeInboundItems = (
122122
id: string,
123123
orderId: string,
124124
options?: UseMutationOptions<
125-
HttpTypes.AdminExchangeResponse,
125+
HttpTypes.AdminExchangeReturnResponse,
126126
FetchError,
127127
HttpTypes.AdminAddExchangeInboundItems
128128
>
@@ -144,7 +144,7 @@ export const useUpdateExchangeInboundItem = (
144144
id: string,
145145
orderId: string,
146146
options?: UseMutationOptions<
147-
HttpTypes.AdminExchangeResponse,
147+
HttpTypes.AdminExchangeReturnResponse,
148148
FetchError,
149149
HttpTypes.AdminUpdateExchangeInboundItem & { actionId: string }
150150
>
@@ -170,7 +170,7 @@ export const useRemoveExchangeInboundItem = (
170170
id: string,
171171
orderId: string,
172172
options?: UseMutationOptions<
173-
HttpTypes.AdminExchangeResponse,
173+
HttpTypes.AdminExchangeReturnResponse,
174174
FetchError,
175175
string
176176
>
@@ -201,7 +201,7 @@ export const useAddExchangeInboundShipping = (
201201
id: string,
202202
orderId: string,
203203
options?: UseMutationOptions<
204-
HttpTypes.AdminExchangeResponse,
204+
HttpTypes.AdminExchangeReturnResponse,
205205
FetchError,
206206
HttpTypes.AdminExchangeAddInboundShipping
207207
>
@@ -223,9 +223,9 @@ export const useUpdateExchangeInboundShipping = (
223223
id: string,
224224
orderId: string,
225225
options?: UseMutationOptions<
226-
HttpTypes.AdminExchangeResponse,
226+
HttpTypes.AdminExchangeReturnResponse,
227227
FetchError,
228-
HttpTypes.AdminExchangeUpdateInboundShipping
228+
HttpTypes.AdminExchangeUpdateInboundShipping & { actionId: string }
229229
>
230230
) => {
231231
return useMutation({
@@ -248,7 +248,7 @@ export const useDeleteExchangeInboundShipping = (
248248
id: string,
249249
orderId: string,
250250
options?: UseMutationOptions<
251-
HttpTypes.AdminExchangeResponse,
251+
HttpTypes.AdminExchangeReturnResponse,
252252
FetchError,
253253
string
254254
>
@@ -368,9 +368,9 @@ export const useUpdateExchangeOutboundShipping = (
368368
id: string,
369369
orderId: string,
370370
options?: UseMutationOptions<
371-
HttpTypes.AdminExchangeResponse,
371+
HttpTypes.AdminExchangePreviewResponse,
372372
FetchError,
373-
HttpTypes.AdminExchangeUpdateOutboundShipping
373+
HttpTypes.AdminExchangeUpdateOutboundShipping & { actionId: string }
374374
>
375375
) => {
376376
return useMutation({
@@ -449,7 +449,10 @@ export const useExchangeConfirmRequest = (
449449
export const useCancelExchangeRequest = (
450450
id: string,
451451
orderId: string,
452-
options?: UseMutationOptions<HttpTypes.AdminExchangeResponse, FetchError>
452+
options?: UseMutationOptions<
453+
HttpTypes.AdminExchangeDeleteResponse,
454+
FetchError
455+
>
453456
) => {
454457
return useMutation({
455458
mutationFn: () => sdk.admin.exchange.cancelRequest(id),

packages/admin/dashboard/src/hooks/api/feature-flags.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ export const useFeatureFlags = () => {
2121
return response.feature_flags
2222
},
2323
staleTime: 5 * 60 * 1000, // Cache for 5 minutes
24-
cacheTime: 10 * 60 * 1000, // Keep in cache for 10 minutes
24+
gcTime: 10 * 60 * 1000, // Keep in cache for 10 minutes
2525
})
2626
}

packages/admin/dashboard/src/hooks/api/fulfillment-providers.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const fulfillmentProviderOptionsQueryKeys = queryKeysFactory(
1616
)
1717

1818
export const useFulfillmentProviders = (
19-
query?: HttpTypes.AdminFulfillmentProviderListParams,
19+
query?: HttpTypes.AdminGetFulfillmentProvidersParams,
2020
options?: Omit<
2121
UseQueryOptions<
2222
HttpTypes.AdminFulfillmentProviderListResponse,

packages/admin/dashboard/src/hooks/api/inventory.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const inventoryItemLevelsQueryKeys = queryKeysFactory(
2424
)
2525

2626
export const useInventoryItems = (
27-
query?: HttpTypes.AdminInventoryItemParams,
27+
query?: HttpTypes.AdminInventoryItemsParams,
2828
options?: Omit<
2929
UseQueryOptions<
3030
HttpTypes.AdminInventoryItemListResponse,

packages/admin/dashboard/src/hooks/api/order-edits.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { inventoryItemsQueryKeys } from "./inventory.tsx"
1212
export const useCreateOrderEdit = (
1313
orderId: string,
1414
options?: UseMutationOptions<
15-
HttpTypes.AdminOrderEditPreviewResponse,
15+
HttpTypes.AdminOrderEditResponse,
1616
FetchError,
1717
HttpTypes.AdminInitiateOrderEditRequest
1818
>

packages/admin/dashboard/src/hooks/api/orders.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@ export const useOrder = (
4545
id: string,
4646
query?: Record<string, any>,
4747
options?: Omit<
48-
UseQueryOptions<any, FetchError, any, QueryKey>,
48+
UseQueryOptions<
49+
HttpTypes.AdminOrderResponse,
50+
FetchError,
51+
HttpTypes.AdminOrderResponse,
52+
QueryKey
53+
>,
4954
"queryFn" | "queryKey"
5055
>
5156
) => {

packages/admin/dashboard/src/hooks/api/price-preferences.tsx

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const pricePreferencesQueryKeys = queryKeysFactory(
1818

1919
export const usePricePreference = (
2020
id: string,
21-
query?: HttpTypes.AdminPricePreferenceParams,
21+
query?: HttpTypes.AdminGetPricePreferenceParams,
2222
options?: Omit<
2323
UseQueryOptions<
2424
HttpTypes.AdminPricePreferenceResponse,
@@ -31,7 +31,7 @@ export const usePricePreference = (
3131
) => {
3232
const { data, ...rest } = useQuery({
3333
queryFn: () => sdk.admin.pricePreference.retrieve(id, query),
34-
queryKey: pricePreferencesQueryKeys.detail(),
34+
queryKey: pricePreferencesQueryKeys.detail(id),
3535
...options,
3636
})
3737

@@ -61,7 +61,7 @@ export const usePricePreferences = (
6161

6262
export const useUpsertPricePreference = (
6363
id?: string | undefined,
64-
query?: HttpTypes.AdminPricePreferenceParams,
64+
query?: HttpTypes.AdminGetPricePreferenceParams,
6565
options?: UseMutationOptions<
6666
HttpTypes.AdminPricePreferenceResponse,
6767
FetchError,
@@ -71,9 +71,16 @@ export const useUpsertPricePreference = (
7171
return useMutation({
7272
mutationFn: (payload) => {
7373
if (id) {
74-
return sdk.admin.pricePreference.update(id, payload, query)
74+
return sdk.admin.pricePreference.update(
75+
id,
76+
payload as HttpTypes.AdminUpdatePricePreference,
77+
query
78+
)
7579
}
76-
return sdk.admin.pricePreference.create(payload, query)
80+
return sdk.admin.pricePreference.create(
81+
payload as HttpTypes.AdminCreatePricePreference,
82+
query
83+
)
7784
},
7885
onSuccess: (data, variables, context) => {
7986
queryClient.invalidateQueries({

packages/admin/dashboard/src/hooks/api/promotions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export const usePromotionRules = (
6565
query?: HttpTypes.AdminGetPromotionRuleParams,
6666
options?: Omit<
6767
UseQueryOptions<
68-
HttpTypes.AdminGetPromotionRuleParams,
68+
HttpTypes.AdminPromotionRuleListResponse,
6969
FetchError,
7070
HttpTypes.AdminPromotionRuleListResponse,
7171
QueryKey

0 commit comments

Comments
 (0)