@meaple-com/react-query 1.1.0 → 1.1.2
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.
- package/README.md +22 -25
- package/dist/index.cjs +0 -14
- package/dist/index.d.cts +4 -6
- package/dist/index.d.ts +4 -6
- package/dist/index.js +0 -13
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -14,10 +14,10 @@ bun add @meaple-com/react-query @meaple-com/core @meaple-com/types
|
|
|
14
14
|
|
|
15
15
|
**Peer dependencies:**
|
|
16
16
|
|
|
17
|
-
- `react` ^19.0.0
|
|
18
|
-
- `@tanstack/react-query` ^5.90.7
|
|
19
|
-
- `axios` ^1.12.2
|
|
20
|
-
- `date-fns` ^4.0.0
|
|
17
|
+
- `react` ^19.0.0
|
|
18
|
+
- `@tanstack/react-query` ^5.90.7
|
|
19
|
+
- `axios` ^1.12.2
|
|
20
|
+
- `date-fns` ^4.0.0
|
|
21
21
|
|
|
22
22
|
Install them if not already in your project.
|
|
23
23
|
|
|
@@ -39,9 +39,7 @@ const sdk = new MeapleSDK({
|
|
|
39
39
|
function App() {
|
|
40
40
|
return (
|
|
41
41
|
<QueryClientProvider client={queryClient}>
|
|
42
|
-
<MeapleSDKProvider sdk={sdk}>
|
|
43
|
-
{/* Your app */}
|
|
44
|
-
</MeapleSDKProvider>
|
|
42
|
+
<MeapleSDKProvider sdk={sdk}>{/* Your app */}</MeapleSDKProvider>
|
|
45
43
|
</QueryClientProvider>
|
|
46
44
|
);
|
|
47
45
|
}
|
|
@@ -59,41 +57,40 @@ All hooks use the SDK from `MeapleSDKProvider` and return standard TanStack Quer
|
|
|
59
57
|
|
|
60
58
|
### Events
|
|
61
59
|
|
|
62
|
-
- **`useEvents(params?, options?)`** – List events
|
|
63
|
-
- **`useEvent(eventId, slug, options?)`** – Single event
|
|
64
|
-
- **`useEventTickets(eventId, slug, options?)`** – Event tickets
|
|
65
|
-
- **`useEventProducts(eventId, slug, options?)`** – Event products
|
|
60
|
+
- **`useEvents(params?, options?)`** – List events
|
|
61
|
+
- **`useEvent(eventId, slug, options?)`** – Single event
|
|
62
|
+
- **`useEventTickets(eventId, slug, options?)`** – Event tickets
|
|
63
|
+
- **`useEventProducts(eventId, slug, options?)`** – Event products
|
|
66
64
|
|
|
67
65
|
### Categories
|
|
68
66
|
|
|
69
|
-
- **`useCategories(options?)`** – List categories
|
|
67
|
+
- **`useCategories(options?)`** – List categories
|
|
70
68
|
|
|
71
69
|
### Coupon
|
|
72
70
|
|
|
73
|
-
- **`useCheckCoupon()`** – Mutation to validate a coupon (code + eventId)
|
|
71
|
+
- **`useCheckCoupon()`** – Mutation to validate a coupon (code + eventId)
|
|
74
72
|
|
|
75
73
|
### Orders
|
|
76
74
|
|
|
77
|
-
- **`useOrder(orderId, options?)`** – Single order
|
|
78
|
-
- **`useUserOrders(params?, options?)`** – Current user orders
|
|
79
|
-
- **`useCreateOrder()`** – Mutation to create an order
|
|
75
|
+
- **`useOrder(orderId, options?)`** – Single order
|
|
76
|
+
- **`useUserOrders(params?, options?)`** – Current user orders
|
|
77
|
+
- **`useCreateOrder()`** – Mutation to create an order
|
|
80
78
|
|
|
81
79
|
### Payments
|
|
82
80
|
|
|
83
|
-
- **`usePlatformFee(eventId, amount?, options?)`** – Platform fee for an amount
|
|
81
|
+
- **`usePlatformFee(eventId, amount?, options?)`** – Platform fee for an amount
|
|
84
82
|
|
|
85
83
|
### Tickets (user)
|
|
86
84
|
|
|
87
|
-
- **`useUserEvents(params?, options?)`** – Current user events
|
|
88
|
-
- **`useUserEventTickets(eventId, options?)`** – Current user tickets for an event
|
|
89
|
-
- **`useTransferTicket()`** – Mutation to transfer a ticket
|
|
90
|
-
- **`useEditUserTicket()`** – Mutation to edit user ticket
|
|
91
|
-
- **`useCreateTicketFile()`** – Mutation to create ticket file
|
|
92
|
-
- **`useRefundUserOrder()`** – Mutation to refund user order
|
|
85
|
+
- **`useUserEvents(params?, options?)`** – Current user events
|
|
86
|
+
- **`useUserEventTickets(eventId, options?)`** – Current user tickets for an event
|
|
87
|
+
- **`useTransferTicket()`** – Mutation to transfer a ticket
|
|
88
|
+
- **`useEditUserTicket()`** – Mutation to edit user ticket
|
|
89
|
+
- **`useCreateTicketFile()`** – Mutation to create ticket file
|
|
93
90
|
|
|
94
91
|
### Context
|
|
95
92
|
|
|
96
|
-
- **`useMeapleSDK()`** – Access the Meaple SDK instance (throws if used outside `MeapleSDKProvider`)
|
|
93
|
+
- **`useMeapleSDK()`** – Access the Meaple SDK instance (throws if used outside `MeapleSDKProvider`)
|
|
97
94
|
|
|
98
95
|
## Example
|
|
99
96
|
|
|
@@ -108,7 +105,7 @@ function EventList() {
|
|
|
108
105
|
|
|
109
106
|
return (
|
|
110
107
|
<ul>
|
|
111
|
-
{data?.events.map(
|
|
108
|
+
{data?.events.map(event => (
|
|
112
109
|
<li key={event.id}>{event.name}</li>
|
|
113
110
|
))}
|
|
114
111
|
</ul>
|
package/dist/index.cjs
CHANGED
|
@@ -33,7 +33,6 @@ __export(index_exports, {
|
|
|
33
33
|
useMeapleSDK: () => useMeapleSDK,
|
|
34
34
|
useOrder: () => useOrder,
|
|
35
35
|
usePlatformFee: () => usePlatformFee,
|
|
36
|
-
useRefundUserOrder: () => useRefundUserOrder,
|
|
37
36
|
useTransferTicket: () => useTransferTicket,
|
|
38
37
|
useUserEventTickets: () => useUserEventTickets,
|
|
39
38
|
useUserEvents: () => useUserEvents,
|
|
@@ -272,18 +271,6 @@ var useUserEvents = (data, options) => {
|
|
|
272
271
|
}
|
|
273
272
|
});
|
|
274
273
|
};
|
|
275
|
-
|
|
276
|
-
// src/hooks/user/useRefundUserOrder.ts
|
|
277
|
-
var import_react_query16 = require("@tanstack/react-query");
|
|
278
|
-
var useRefundUserOrder = (options) => {
|
|
279
|
-
const { sdk } = useMeapleSDK();
|
|
280
|
-
return (0, import_react_query16.useMutation)({
|
|
281
|
-
...options,
|
|
282
|
-
mutationFn: async (orderId) => {
|
|
283
|
-
await sdk.users.refundOrder(orderId);
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
};
|
|
287
274
|
// Annotate the CommonJS export names for ESM import in node:
|
|
288
275
|
0 && (module.exports = {
|
|
289
276
|
MeapleSDKProvider,
|
|
@@ -299,7 +286,6 @@ var useRefundUserOrder = (options) => {
|
|
|
299
286
|
useMeapleSDK,
|
|
300
287
|
useOrder,
|
|
301
288
|
usePlatformFee,
|
|
302
|
-
useRefundUserOrder,
|
|
303
289
|
useTransferTicket,
|
|
304
290
|
useUserEventTickets,
|
|
305
291
|
useUserEvents,
|
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
import { MeapleSDK } from '@meaple-com/core';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
5
|
import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
6
|
-
import { CategoryProps, CouponProps, CheckCouponProps, EventProps, GetEventProductsResponseProps, FindEventsParams, FindEventsResponseProps, GetEventTicketsResponseProps, UserTicketProps, CreatedOrderResponseProps, CreateOrderParams, GetOrderResponseProps,
|
|
6
|
+
import { CategoryProps, CouponProps, CheckCouponProps, EventProps, GetEventProductsResponseProps, FindEventsParams, FindEventsResponseProps, GetEventTicketsResponseProps, UserTicketProps, CreatedOrderResponseProps, CreateOrderParams, GetOrderResponseProps, GetUserOrderProps, PlatformFeeProps, UpdateUserTicketProps, TransferTicketProps as TransferTicketProps$1, CreateTicketFileProps as CreateTicketFileProps$1, GetUserEventProps } from '@meaple-com/types';
|
|
7
7
|
import { AxiosError } from 'axios';
|
|
8
8
|
|
|
9
9
|
interface MeapleSDKContextValue {
|
|
@@ -42,7 +42,7 @@ type FindUserOrdersProps = {
|
|
|
42
42
|
status: SectionStatus;
|
|
43
43
|
eventId?: string;
|
|
44
44
|
};
|
|
45
|
-
declare const useUserOrders: (data: FindUserOrdersProps, options?: Omit<UseQueryOptions<
|
|
45
|
+
declare const useUserOrders: (data: FindUserOrdersProps, options?: Omit<UseQueryOptions<GetUserOrderProps[], Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<GetUserOrderProps[], Error>;
|
|
46
46
|
|
|
47
47
|
declare const usePlatformFee: (eventId?: string, options?: Omit<UseQueryOptions<PlatformFeeProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<PlatformFeeProps, Error>;
|
|
48
48
|
|
|
@@ -65,8 +65,6 @@ type SectionType = 'coming_soon' | 'past' | 'awards';
|
|
|
65
65
|
type FindUserEventsProps = {
|
|
66
66
|
type: SectionType;
|
|
67
67
|
};
|
|
68
|
-
declare const useUserEvents: (data?: FindUserEventsProps, options?: Omit<UseQueryOptions<
|
|
68
|
+
declare const useUserEvents: (data?: FindUserEventsProps, options?: Omit<UseQueryOptions<GetUserEventProps[], Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<GetUserEventProps[], Error>;
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export { type CreateTicketFileProps, type MeapleSDKContextValue, MeapleSDKProvider, useCategories, useCheckCoupon, useCreateOrder, useCreateTicketFile, useEditUserTicket, useEvent, useEventProducts, useEventTickets, useEvents, useMeapleSDK, useOrder, usePlatformFee, useRefundUserOrder, useTransferTicket, useUserEventTickets, useUserEvents, useUserOrders };
|
|
70
|
+
export { type CreateTicketFileProps, type MeapleSDKContextValue, MeapleSDKProvider, useCategories, useCheckCoupon, useCreateOrder, useCreateTicketFile, useEditUserTicket, useEvent, useEventProducts, useEventTickets, useEvents, useMeapleSDK, useOrder, usePlatformFee, useTransferTicket, useUserEventTickets, useUserEvents, useUserOrders };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
import { MeapleSDK } from '@meaple-com/core';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
5
|
import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
6
|
-
import { CategoryProps, CouponProps, CheckCouponProps, EventProps, GetEventProductsResponseProps, FindEventsParams, FindEventsResponseProps, GetEventTicketsResponseProps, UserTicketProps, CreatedOrderResponseProps, CreateOrderParams, GetOrderResponseProps,
|
|
6
|
+
import { CategoryProps, CouponProps, CheckCouponProps, EventProps, GetEventProductsResponseProps, FindEventsParams, FindEventsResponseProps, GetEventTicketsResponseProps, UserTicketProps, CreatedOrderResponseProps, CreateOrderParams, GetOrderResponseProps, GetUserOrderProps, PlatformFeeProps, UpdateUserTicketProps, TransferTicketProps as TransferTicketProps$1, CreateTicketFileProps as CreateTicketFileProps$1, GetUserEventProps } from '@meaple-com/types';
|
|
7
7
|
import { AxiosError } from 'axios';
|
|
8
8
|
|
|
9
9
|
interface MeapleSDKContextValue {
|
|
@@ -42,7 +42,7 @@ type FindUserOrdersProps = {
|
|
|
42
42
|
status: SectionStatus;
|
|
43
43
|
eventId?: string;
|
|
44
44
|
};
|
|
45
|
-
declare const useUserOrders: (data: FindUserOrdersProps, options?: Omit<UseQueryOptions<
|
|
45
|
+
declare const useUserOrders: (data: FindUserOrdersProps, options?: Omit<UseQueryOptions<GetUserOrderProps[], Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<GetUserOrderProps[], Error>;
|
|
46
46
|
|
|
47
47
|
declare const usePlatformFee: (eventId?: string, options?: Omit<UseQueryOptions<PlatformFeeProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<PlatformFeeProps, Error>;
|
|
48
48
|
|
|
@@ -65,8 +65,6 @@ type SectionType = 'coming_soon' | 'past' | 'awards';
|
|
|
65
65
|
type FindUserEventsProps = {
|
|
66
66
|
type: SectionType;
|
|
67
67
|
};
|
|
68
|
-
declare const useUserEvents: (data?: FindUserEventsProps, options?: Omit<UseQueryOptions<
|
|
68
|
+
declare const useUserEvents: (data?: FindUserEventsProps, options?: Omit<UseQueryOptions<GetUserEventProps[], Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<GetUserEventProps[], Error>;
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
export { type CreateTicketFileProps, type MeapleSDKContextValue, MeapleSDKProvider, useCategories, useCheckCoupon, useCreateOrder, useCreateTicketFile, useEditUserTicket, useEvent, useEventProducts, useEventTickets, useEvents, useMeapleSDK, useOrder, usePlatformFee, useRefundUserOrder, useTransferTicket, useUserEventTickets, useUserEvents, useUserOrders };
|
|
70
|
+
export { type CreateTicketFileProps, type MeapleSDKContextValue, MeapleSDKProvider, useCategories, useCheckCoupon, useCreateOrder, useCreateTicketFile, useEditUserTicket, useEvent, useEventProducts, useEventTickets, useEvents, useMeapleSDK, useOrder, usePlatformFee, useTransferTicket, useUserEventTickets, useUserEvents, useUserOrders };
|
package/dist/index.js
CHANGED
|
@@ -235,18 +235,6 @@ var useUserEvents = (data, options) => {
|
|
|
235
235
|
}
|
|
236
236
|
});
|
|
237
237
|
};
|
|
238
|
-
|
|
239
|
-
// src/hooks/user/useRefundUserOrder.ts
|
|
240
|
-
import { useMutation as useMutation6 } from "@tanstack/react-query";
|
|
241
|
-
var useRefundUserOrder = (options) => {
|
|
242
|
-
const { sdk } = useMeapleSDK();
|
|
243
|
-
return useMutation6({
|
|
244
|
-
...options,
|
|
245
|
-
mutationFn: async (orderId) => {
|
|
246
|
-
await sdk.users.refundOrder(orderId);
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
};
|
|
250
238
|
export {
|
|
251
239
|
MeapleSDKProvider,
|
|
252
240
|
useCategories,
|
|
@@ -261,7 +249,6 @@ export {
|
|
|
261
249
|
useMeapleSDK,
|
|
262
250
|
useOrder,
|
|
263
251
|
usePlatformFee,
|
|
264
|
-
useRefundUserOrder,
|
|
265
252
|
useTransferTicket,
|
|
266
253
|
useUserEventTickets,
|
|
267
254
|
useUserEvents,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meaple-com/react-query",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "React Query hooks for Meaple SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,13 +28,12 @@
|
|
|
28
28
|
"clean": "rimraf dist"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@meaple-com/core": "^1.1.
|
|
32
|
-
"@meaple-com/types": "^
|
|
31
|
+
"@meaple-com/core": "^1.1.3",
|
|
32
|
+
"@meaple-com/types": "^4.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@eslint/js": "^9.36.0",
|
|
36
36
|
"@tanstack/eslint-plugin-query": "^5.91.2",
|
|
37
|
-
"@tanstack/react-query": "^5.90.7",
|
|
38
37
|
"@types/node": "^24.10.0",
|
|
39
38
|
"@types/react": "^19.0.0",
|
|
40
39
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
|
@@ -52,7 +51,7 @@
|
|
|
52
51
|
"@tanstack/react-query": "^5.90.7",
|
|
53
52
|
"axios": "^1.12.2",
|
|
54
53
|
"date-fns": "^4.0.0",
|
|
55
|
-
"react": "^19.
|
|
54
|
+
"react": "^19.2.4"
|
|
56
55
|
},
|
|
57
56
|
"files": [
|
|
58
57
|
"dist"
|