@meaple-com/react-query 1.0.2 → 1.0.3
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/dist/index.cjs +21 -21
- package/dist/index.d.cts +8 -12
- package/dist/index.d.ts +8 -12
- package/dist/index.js +23 -23
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -22,14 +22,14 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
MeapleSDKProvider: () => MeapleSDKProvider,
|
|
24
24
|
useCategories: () => useCategories,
|
|
25
|
-
useChannelEvent: () => useChannelEvent,
|
|
26
|
-
useChannelEvents: () => useChannelEvents,
|
|
27
25
|
useCheckCoupon: () => useCheckCoupon,
|
|
28
26
|
useCreateOrder: () => useCreateOrder,
|
|
29
27
|
useCreateTicketFile: () => useCreateTicketFile,
|
|
30
28
|
useEditUserTicket: () => useEditUserTicket,
|
|
29
|
+
useEvent: () => useEvent,
|
|
31
30
|
useEventProducts: () => useEventProducts,
|
|
32
31
|
useEventTickets: () => useEventTickets,
|
|
32
|
+
useEvents: () => useEvents,
|
|
33
33
|
useMeapleSDK: () => useMeapleSDK,
|
|
34
34
|
useOrder: () => useOrder,
|
|
35
35
|
usePlatformFee: () => usePlatformFee,
|
|
@@ -80,46 +80,46 @@ var useCategories = (options) => {
|
|
|
80
80
|
});
|
|
81
81
|
};
|
|
82
82
|
|
|
83
|
-
// src/hooks/
|
|
83
|
+
// src/hooks/coupon/useCheckCoupon.ts
|
|
84
84
|
var import_react_query2 = require("@tanstack/react-query");
|
|
85
|
-
var
|
|
85
|
+
var useCheckCoupon = (options) => {
|
|
86
86
|
const { sdk } = useMeapleSDK();
|
|
87
|
-
return (0, import_react_query2.
|
|
87
|
+
return (0, import_react_query2.useMutation)({
|
|
88
88
|
...options,
|
|
89
|
-
|
|
90
|
-
queryFn: () => sdk.channels.getEvent(channelSlug, eventSlug)
|
|
89
|
+
mutationFn: ({ couponCode, eventId }) => sdk.coupon.check({ eventId, couponCode })
|
|
91
90
|
});
|
|
92
91
|
};
|
|
93
92
|
|
|
94
|
-
// src/hooks/
|
|
93
|
+
// src/hooks/event/useEvent.ts
|
|
95
94
|
var import_react_query3 = require("@tanstack/react-query");
|
|
96
|
-
var
|
|
95
|
+
var useEvent = ({ eventSlug }, options) => {
|
|
97
96
|
const { sdk } = useMeapleSDK();
|
|
98
97
|
return (0, import_react_query3.useQuery)({
|
|
99
98
|
...options,
|
|
100
|
-
queryKey: ["
|
|
101
|
-
queryFn: () => sdk.
|
|
99
|
+
queryKey: ["events", eventSlug],
|
|
100
|
+
queryFn: () => sdk.events.getBySlug(eventSlug)
|
|
102
101
|
});
|
|
103
102
|
};
|
|
104
103
|
|
|
105
|
-
// src/hooks/
|
|
104
|
+
// src/hooks/event/useEventProducts.ts
|
|
106
105
|
var import_react_query4 = require("@tanstack/react-query");
|
|
107
|
-
var
|
|
106
|
+
var useEventProducts = (eventId, privateToken, options) => {
|
|
108
107
|
const { sdk } = useMeapleSDK();
|
|
109
|
-
return (0, import_react_query4.
|
|
108
|
+
return (0, import_react_query4.useQuery)({
|
|
110
109
|
...options,
|
|
111
|
-
|
|
110
|
+
queryKey: [`event`, eventId, `products`, privateToken],
|
|
111
|
+
queryFn: () => sdk.events.getProducts(eventId, privateToken)
|
|
112
112
|
});
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
-
// src/hooks/event/
|
|
115
|
+
// src/hooks/event/useEvents.ts
|
|
116
116
|
var import_react_query5 = require("@tanstack/react-query");
|
|
117
|
-
var
|
|
117
|
+
var useEvents = (params, options) => {
|
|
118
118
|
const { sdk } = useMeapleSDK();
|
|
119
119
|
return (0, import_react_query5.useQuery)({
|
|
120
120
|
...options,
|
|
121
|
-
queryKey: [
|
|
122
|
-
queryFn: () => sdk.events.
|
|
121
|
+
queryKey: ["events", params],
|
|
122
|
+
queryFn: () => sdk.events.find(params)
|
|
123
123
|
});
|
|
124
124
|
};
|
|
125
125
|
|
|
@@ -288,14 +288,14 @@ var useRefundUserOrder = (options) => {
|
|
|
288
288
|
0 && (module.exports = {
|
|
289
289
|
MeapleSDKProvider,
|
|
290
290
|
useCategories,
|
|
291
|
-
useChannelEvent,
|
|
292
|
-
useChannelEvents,
|
|
293
291
|
useCheckCoupon,
|
|
294
292
|
useCreateOrder,
|
|
295
293
|
useCreateTicketFile,
|
|
296
294
|
useEditUserTicket,
|
|
295
|
+
useEvent,
|
|
297
296
|
useEventProducts,
|
|
298
297
|
useEventTickets,
|
|
298
|
+
useEvents,
|
|
299
299
|
useMeapleSDK,
|
|
300
300
|
useOrder,
|
|
301
301
|
usePlatformFee,
|
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,
|
|
6
|
+
import { CategoryProps, CouponProps, CheckCouponProps, EventProps, FindEventProductsProps, FindEventsParams, FindEventsProps, FindEventTicketsProps, FindUserEventTicketsProps, CreatedOrderProps, CreateOrderProps, GetOrderProps, UserOrderProps, GetPlatformFeeProps, PlatformFeeProps, UpdateUserTicketProps, TransferTicketProps as TransferTicketProps$1, CreateTicketFileProps as CreateTicketFileProps$1 } from '@meaple-com/types';
|
|
7
7
|
import { AxiosError } from 'axios';
|
|
8
8
|
|
|
9
9
|
interface MeapleSDKContextValue {
|
|
@@ -18,21 +18,17 @@ declare const useMeapleSDK: () => MeapleSDKContextValue;
|
|
|
18
18
|
|
|
19
19
|
declare const useCategories: (options?: Omit<UseQueryOptions<CategoryProps[], Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<CategoryProps[], Error>;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
eventSlug: string;
|
|
23
|
-
channelSlug: string;
|
|
24
|
-
};
|
|
25
|
-
declare const useChannelEvent: ({ channelSlug, eventSlug }: UseChannelEventProps, options?: Omit<UseQueryOptions<EventProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<EventProps, Error>;
|
|
21
|
+
declare const useCheckCoupon: (options?: Omit<UseMutationOptions<CouponProps, Error, CheckCouponProps, unknown>, "mutationFn">) => _tanstack_react_query.UseMutationResult<CouponProps, Error, CheckCouponProps, unknown>;
|
|
26
22
|
|
|
27
|
-
type
|
|
28
|
-
|
|
23
|
+
type UseEventProps = {
|
|
24
|
+
eventSlug: string;
|
|
29
25
|
};
|
|
30
|
-
declare const
|
|
31
|
-
|
|
32
|
-
declare const useCheckCoupon: (options?: Omit<UseMutationOptions<CouponProps, Error, CheckCouponProps, unknown>, "mutationFn">) => _tanstack_react_query.UseMutationResult<CouponProps, Error, CheckCouponProps, unknown>;
|
|
26
|
+
declare const useEvent: ({ eventSlug }: UseEventProps, options?: Omit<UseQueryOptions<EventProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<EventProps, Error>;
|
|
33
27
|
|
|
34
28
|
declare const useEventProducts: (eventId: string, privateToken?: string | null, options?: Omit<UseQueryOptions<FindEventProductsProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<FindEventProductsProps, Error>;
|
|
35
29
|
|
|
30
|
+
declare const useEvents: (params?: FindEventsParams, options?: Omit<UseQueryOptions<FindEventsProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<FindEventsProps, Error>;
|
|
31
|
+
|
|
36
32
|
declare const useEventTickets: (eventId: string, privateToken?: string | null, predecessorIds?: string[], options?: Omit<UseQueryOptions<FindEventTicketsProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<FindEventTicketsProps, Error>;
|
|
37
33
|
|
|
38
34
|
declare const useUserEventTickets: (eventId: string, userId?: string, options?: Omit<UseQueryOptions<FindUserEventTicketsProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<FindUserEventTicketsProps, Error>;
|
|
@@ -73,4 +69,4 @@ declare const useUserEvents: (data?: FindUserEventsProps, options?: Omit<UseQuer
|
|
|
73
69
|
|
|
74
70
|
declare const useRefundUserOrder: (options?: Omit<UseMutationOptions<void, unknown, string, unknown>, "mutationFn">) => _tanstack_react_query.UseMutationResult<void, unknown, string, unknown>;
|
|
75
71
|
|
|
76
|
-
export { type CreateTicketFileProps, type MeapleSDKContextValue, MeapleSDKProvider, useCategories,
|
|
72
|
+
export { type CreateTicketFileProps, type MeapleSDKContextValue, MeapleSDKProvider, useCategories, useCheckCoupon, useCreateOrder, useCreateTicketFile, useEditUserTicket, useEvent, useEventProducts, useEventTickets, useEvents, useMeapleSDK, useOrder, usePlatformFee, useRefundUserOrder, 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,
|
|
6
|
+
import { CategoryProps, CouponProps, CheckCouponProps, EventProps, FindEventProductsProps, FindEventsParams, FindEventsProps, FindEventTicketsProps, FindUserEventTicketsProps, CreatedOrderProps, CreateOrderProps, GetOrderProps, UserOrderProps, GetPlatformFeeProps, PlatformFeeProps, UpdateUserTicketProps, TransferTicketProps as TransferTicketProps$1, CreateTicketFileProps as CreateTicketFileProps$1 } from '@meaple-com/types';
|
|
7
7
|
import { AxiosError } from 'axios';
|
|
8
8
|
|
|
9
9
|
interface MeapleSDKContextValue {
|
|
@@ -18,21 +18,17 @@ declare const useMeapleSDK: () => MeapleSDKContextValue;
|
|
|
18
18
|
|
|
19
19
|
declare const useCategories: (options?: Omit<UseQueryOptions<CategoryProps[], Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<CategoryProps[], Error>;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
eventSlug: string;
|
|
23
|
-
channelSlug: string;
|
|
24
|
-
};
|
|
25
|
-
declare const useChannelEvent: ({ channelSlug, eventSlug }: UseChannelEventProps, options?: Omit<UseQueryOptions<EventProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<EventProps, Error>;
|
|
21
|
+
declare const useCheckCoupon: (options?: Omit<UseMutationOptions<CouponProps, Error, CheckCouponProps, unknown>, "mutationFn">) => _tanstack_react_query.UseMutationResult<CouponProps, Error, CheckCouponProps, unknown>;
|
|
26
22
|
|
|
27
|
-
type
|
|
28
|
-
|
|
23
|
+
type UseEventProps = {
|
|
24
|
+
eventSlug: string;
|
|
29
25
|
};
|
|
30
|
-
declare const
|
|
31
|
-
|
|
32
|
-
declare const useCheckCoupon: (options?: Omit<UseMutationOptions<CouponProps, Error, CheckCouponProps, unknown>, "mutationFn">) => _tanstack_react_query.UseMutationResult<CouponProps, Error, CheckCouponProps, unknown>;
|
|
26
|
+
declare const useEvent: ({ eventSlug }: UseEventProps, options?: Omit<UseQueryOptions<EventProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<EventProps, Error>;
|
|
33
27
|
|
|
34
28
|
declare const useEventProducts: (eventId: string, privateToken?: string | null, options?: Omit<UseQueryOptions<FindEventProductsProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<FindEventProductsProps, Error>;
|
|
35
29
|
|
|
30
|
+
declare const useEvents: (params?: FindEventsParams, options?: Omit<UseQueryOptions<FindEventsProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<FindEventsProps, Error>;
|
|
31
|
+
|
|
36
32
|
declare const useEventTickets: (eventId: string, privateToken?: string | null, predecessorIds?: string[], options?: Omit<UseQueryOptions<FindEventTicketsProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<FindEventTicketsProps, Error>;
|
|
37
33
|
|
|
38
34
|
declare const useUserEventTickets: (eventId: string, userId?: string, options?: Omit<UseQueryOptions<FindUserEventTicketsProps, Error>, "queryKey" | "queryFn">) => _tanstack_react_query.UseQueryResult<FindUserEventTicketsProps, Error>;
|
|
@@ -73,4 +69,4 @@ declare const useUserEvents: (data?: FindUserEventsProps, options?: Omit<UseQuer
|
|
|
73
69
|
|
|
74
70
|
declare const useRefundUserOrder: (options?: Omit<UseMutationOptions<void, unknown, string, unknown>, "mutationFn">) => _tanstack_react_query.UseMutationResult<void, unknown, string, unknown>;
|
|
75
71
|
|
|
76
|
-
export { type CreateTicketFileProps, type MeapleSDKContextValue, MeapleSDKProvider, useCategories,
|
|
72
|
+
export { type CreateTicketFileProps, type MeapleSDKContextValue, MeapleSDKProvider, useCategories, useCheckCoupon, useCreateOrder, useCreateTicketFile, useEditUserTicket, useEvent, useEventProducts, useEventTickets, useEvents, useMeapleSDK, useOrder, usePlatformFee, useRefundUserOrder, useTransferTicket, useUserEventTickets, useUserEvents, useUserOrders };
|
package/dist/index.js
CHANGED
|
@@ -37,46 +37,46 @@ var useCategories = (options) => {
|
|
|
37
37
|
});
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
// src/hooks/
|
|
41
|
-
import {
|
|
42
|
-
var
|
|
40
|
+
// src/hooks/coupon/useCheckCoupon.ts
|
|
41
|
+
import { useMutation } from "@tanstack/react-query";
|
|
42
|
+
var useCheckCoupon = (options) => {
|
|
43
43
|
const { sdk } = useMeapleSDK();
|
|
44
|
-
return
|
|
44
|
+
return useMutation({
|
|
45
45
|
...options,
|
|
46
|
-
|
|
47
|
-
queryFn: () => sdk.channels.getEvent(channelSlug, eventSlug)
|
|
46
|
+
mutationFn: ({ couponCode, eventId }) => sdk.coupon.check({ eventId, couponCode })
|
|
48
47
|
});
|
|
49
48
|
};
|
|
50
49
|
|
|
51
|
-
// src/hooks/
|
|
52
|
-
import { useQuery as
|
|
53
|
-
var
|
|
50
|
+
// src/hooks/event/useEvent.ts
|
|
51
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
52
|
+
var useEvent = ({ eventSlug }, options) => {
|
|
54
53
|
const { sdk } = useMeapleSDK();
|
|
55
|
-
return
|
|
54
|
+
return useQuery2({
|
|
56
55
|
...options,
|
|
57
|
-
queryKey: ["
|
|
58
|
-
queryFn: () => sdk.
|
|
56
|
+
queryKey: ["events", eventSlug],
|
|
57
|
+
queryFn: () => sdk.events.getBySlug(eventSlug)
|
|
59
58
|
});
|
|
60
59
|
};
|
|
61
60
|
|
|
62
|
-
// src/hooks/
|
|
63
|
-
import {
|
|
64
|
-
var
|
|
61
|
+
// src/hooks/event/useEventProducts.ts
|
|
62
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
63
|
+
var useEventProducts = (eventId, privateToken, options) => {
|
|
65
64
|
const { sdk } = useMeapleSDK();
|
|
66
|
-
return
|
|
65
|
+
return useQuery3({
|
|
67
66
|
...options,
|
|
68
|
-
|
|
67
|
+
queryKey: [`event`, eventId, `products`, privateToken],
|
|
68
|
+
queryFn: () => sdk.events.getProducts(eventId, privateToken)
|
|
69
69
|
});
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
// src/hooks/event/
|
|
72
|
+
// src/hooks/event/useEvents.ts
|
|
73
73
|
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
74
|
-
var
|
|
74
|
+
var useEvents = (params, options) => {
|
|
75
75
|
const { sdk } = useMeapleSDK();
|
|
76
76
|
return useQuery4({
|
|
77
77
|
...options,
|
|
78
|
-
queryKey: [
|
|
79
|
-
queryFn: () => sdk.events.
|
|
78
|
+
queryKey: ["events", params],
|
|
79
|
+
queryFn: () => sdk.events.find(params)
|
|
80
80
|
});
|
|
81
81
|
};
|
|
82
82
|
|
|
@@ -250,14 +250,14 @@ var useRefundUserOrder = (options) => {
|
|
|
250
250
|
export {
|
|
251
251
|
MeapleSDKProvider,
|
|
252
252
|
useCategories,
|
|
253
|
-
useChannelEvent,
|
|
254
|
-
useChannelEvents,
|
|
255
253
|
useCheckCoupon,
|
|
256
254
|
useCreateOrder,
|
|
257
255
|
useCreateTicketFile,
|
|
258
256
|
useEditUserTicket,
|
|
257
|
+
useEvent,
|
|
259
258
|
useEventProducts,
|
|
260
259
|
useEventTickets,
|
|
260
|
+
useEvents,
|
|
261
261
|
useMeapleSDK,
|
|
262
262
|
useOrder,
|
|
263
263
|
usePlatformFee,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meaple-com/react-query",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "React Query hooks for Meaple SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"clean": "rimraf dist"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@meaple-com/core": "^1.0.
|
|
32
|
-
"@meaple-com/types": "^1.0.
|
|
31
|
+
"@meaple-com/core": "^1.0.3",
|
|
32
|
+
"@meaple-com/types": "^1.0.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@eslint/js": "^9.36.0",
|