@meaple-com/react-query 1.2.0 → 2.0.0
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 +11 -5
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +6 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ import { MeapleSDK } from '@meaple-com/core';
|
|
|
32
32
|
|
|
33
33
|
const queryClient = new QueryClient();
|
|
34
34
|
const sdk = new MeapleSDK({
|
|
35
|
-
|
|
35
|
+
clientId: 'YOUR_CLIENT_ID',
|
|
36
36
|
baseURL: 'https://api.meaple.com',
|
|
37
37
|
});
|
|
38
38
|
|
|
@@ -58,7 +58,7 @@ All hooks use the SDK from `MeapleSDKProvider` and return standard TanStack Quer
|
|
|
58
58
|
### Events
|
|
59
59
|
|
|
60
60
|
- **`useEvents(params?, options?)`** – List events
|
|
61
|
-
- **`useEvent(
|
|
61
|
+
- **`useEvent({ eventSlug, channelSlug }, options?)`** – Single event
|
|
62
62
|
- **`useEventTickets(eventId, slug, options?)`** – Event tickets
|
|
63
63
|
- **`useEventProducts(eventId, slug, options?)`** – Event products
|
|
64
64
|
|
|
@@ -78,7 +78,7 @@ All hooks use the SDK from `MeapleSDKProvider` and return standard TanStack Quer
|
|
|
78
78
|
|
|
79
79
|
### Payments
|
|
80
80
|
|
|
81
|
-
- **`usePlatformFee(eventId,
|
|
81
|
+
- **`usePlatformFee({ eventId, channelId }, options?)`** – Platform fee of an event
|
|
82
82
|
|
|
83
83
|
### Tickets (user)
|
|
84
84
|
|
|
@@ -112,8 +112,14 @@ function EventList() {
|
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
function EventDetail({
|
|
116
|
-
|
|
115
|
+
function EventDetail({
|
|
116
|
+
eventSlug,
|
|
117
|
+
channelSlug,
|
|
118
|
+
}: {
|
|
119
|
+
eventSlug: string;
|
|
120
|
+
channelSlug: string;
|
|
121
|
+
}) {
|
|
122
|
+
const { data: event } = useEvent({ eventSlug, channelSlug });
|
|
117
123
|
// ...
|
|
118
124
|
}
|
|
119
125
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -92,12 +92,12 @@ var useCheckCoupon = (options) => {
|
|
|
92
92
|
|
|
93
93
|
// src/hooks/event/useEvent.ts
|
|
94
94
|
var import_react_query3 = require("@tanstack/react-query");
|
|
95
|
-
var useEvent = ({ eventSlug }, options) => {
|
|
95
|
+
var useEvent = ({ eventSlug, channelSlug }, options) => {
|
|
96
96
|
const { sdk } = useMeapleSDK();
|
|
97
97
|
return (0, import_react_query3.useQuery)({
|
|
98
98
|
...options,
|
|
99
|
-
queryKey: ["events", eventSlug],
|
|
100
|
-
queryFn: () => sdk.events.getBySlug(eventSlug)
|
|
99
|
+
queryKey: ["events", channelSlug, eventSlug],
|
|
100
|
+
queryFn: () => sdk.events.getBySlug({ eventSlug, channelSlug })
|
|
101
101
|
});
|
|
102
102
|
};
|
|
103
103
|
|
|
@@ -219,12 +219,12 @@ var useUserOrders = (data, options) => {
|
|
|
219
219
|
|
|
220
220
|
// src/hooks/payment/usePlatformFee.ts
|
|
221
221
|
var import_react_query12 = require("@tanstack/react-query");
|
|
222
|
-
var usePlatformFee = (eventId, options) => {
|
|
222
|
+
var usePlatformFee = ({ eventId, channelId }, options) => {
|
|
223
223
|
const { sdk } = useMeapleSDK();
|
|
224
224
|
return (0, import_react_query12.useQuery)({
|
|
225
225
|
...options,
|
|
226
|
-
queryKey: ["payments", "fee", eventId],
|
|
227
|
-
queryFn: () => sdk.payments.getFee(eventId)
|
|
226
|
+
queryKey: ["payments", "fee", channelId, eventId],
|
|
227
|
+
queryFn: () => sdk.payments.getFee({ eventId, channelId })
|
|
228
228
|
});
|
|
229
229
|
};
|
|
230
230
|
|
package/dist/index.d.cts
CHANGED
|
@@ -22,8 +22,9 @@ declare const useCheckCoupon: (options?: Omit<UseMutationOptions<CouponProps, Er
|
|
|
22
22
|
|
|
23
23
|
type UseEventProps = {
|
|
24
24
|
eventSlug: string;
|
|
25
|
+
channelSlug: string;
|
|
25
26
|
};
|
|
26
|
-
declare const useEvent: ({ eventSlug }: UseEventProps, options?: Omit<UseQueryOptions<EventProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<EventProps, Error>;
|
|
27
|
+
declare const useEvent: ({ eventSlug, channelSlug }: UseEventProps, options?: Omit<UseQueryOptions<EventProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<EventProps, Error>;
|
|
27
28
|
|
|
28
29
|
declare const useEventCities: (options?: Omit<UseQueryOptions<EventCityProps[], Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<EventCityProps[], Error>;
|
|
29
30
|
|
|
@@ -46,7 +47,11 @@ type FindUserOrdersProps = {
|
|
|
46
47
|
};
|
|
47
48
|
declare const useUserOrders: (data: FindUserOrdersProps, options?: Omit<UseQueryOptions<GetUserOrderProps[], Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<GetUserOrderProps[], Error>;
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
type UsePlatformFeeProps = {
|
|
51
|
+
eventId: string;
|
|
52
|
+
channelId: string;
|
|
53
|
+
};
|
|
54
|
+
declare const usePlatformFee: ({ eventId, channelId }: UsePlatformFeeProps, options?: Omit<UseQueryOptions<PlatformFeeProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<PlatformFeeProps, Error>;
|
|
50
55
|
|
|
51
56
|
type EditUserTicketProps = UpdateUserTicketProps & {
|
|
52
57
|
userTicketId: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -22,8 +22,9 @@ declare const useCheckCoupon: (options?: Omit<UseMutationOptions<CouponProps, Er
|
|
|
22
22
|
|
|
23
23
|
type UseEventProps = {
|
|
24
24
|
eventSlug: string;
|
|
25
|
+
channelSlug: string;
|
|
25
26
|
};
|
|
26
|
-
declare const useEvent: ({ eventSlug }: UseEventProps, options?: Omit<UseQueryOptions<EventProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<EventProps, Error>;
|
|
27
|
+
declare const useEvent: ({ eventSlug, channelSlug }: UseEventProps, options?: Omit<UseQueryOptions<EventProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<EventProps, Error>;
|
|
27
28
|
|
|
28
29
|
declare const useEventCities: (options?: Omit<UseQueryOptions<EventCityProps[], Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<EventCityProps[], Error>;
|
|
29
30
|
|
|
@@ -46,7 +47,11 @@ type FindUserOrdersProps = {
|
|
|
46
47
|
};
|
|
47
48
|
declare const useUserOrders: (data: FindUserOrdersProps, options?: Omit<UseQueryOptions<GetUserOrderProps[], Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<GetUserOrderProps[], Error>;
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
type UsePlatformFeeProps = {
|
|
51
|
+
eventId: string;
|
|
52
|
+
channelId: string;
|
|
53
|
+
};
|
|
54
|
+
declare const usePlatformFee: ({ eventId, channelId }: UsePlatformFeeProps, options?: Omit<UseQueryOptions<PlatformFeeProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<PlatformFeeProps, Error>;
|
|
50
55
|
|
|
51
56
|
type EditUserTicketProps = UpdateUserTicketProps & {
|
|
52
57
|
userTicketId: string;
|
package/dist/index.js
CHANGED
|
@@ -49,12 +49,12 @@ var useCheckCoupon = (options) => {
|
|
|
49
49
|
|
|
50
50
|
// src/hooks/event/useEvent.ts
|
|
51
51
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
52
|
-
var useEvent = ({ eventSlug }, options) => {
|
|
52
|
+
var useEvent = ({ eventSlug, channelSlug }, options) => {
|
|
53
53
|
const { sdk } = useMeapleSDK();
|
|
54
54
|
return useQuery2({
|
|
55
55
|
...options,
|
|
56
|
-
queryKey: ["events", eventSlug],
|
|
57
|
-
queryFn: () => sdk.events.getBySlug(eventSlug)
|
|
56
|
+
queryKey: ["events", channelSlug, eventSlug],
|
|
57
|
+
queryFn: () => sdk.events.getBySlug({ eventSlug, channelSlug })
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
60
|
|
|
@@ -176,12 +176,12 @@ var useUserOrders = (data, options) => {
|
|
|
176
176
|
|
|
177
177
|
// src/hooks/payment/usePlatformFee.ts
|
|
178
178
|
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
179
|
-
var usePlatformFee = (eventId, options) => {
|
|
179
|
+
var usePlatformFee = ({ eventId, channelId }, options) => {
|
|
180
180
|
const { sdk } = useMeapleSDK();
|
|
181
181
|
return useQuery10({
|
|
182
182
|
...options,
|
|
183
|
-
queryKey: ["payments", "fee", eventId],
|
|
184
|
-
queryFn: () => sdk.payments.getFee(eventId)
|
|
183
|
+
queryKey: ["payments", "fee", channelId, eventId],
|
|
184
|
+
queryFn: () => sdk.payments.getFee({ eventId, channelId })
|
|
185
185
|
});
|
|
186
186
|
};
|
|
187
187
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meaple-com/react-query",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "React Query hooks for Meaple SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"clean": "rimraf dist"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@meaple-com/core": "^
|
|
31
|
+
"@meaple-com/core": "^2.0.0",
|
|
32
32
|
"@meaple-com/types": "^4.1.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|