@diffsome/react 1.1.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 +353 -0
- package/dist/index.d.mts +546 -0
- package/dist/index.d.ts +546 -0
- package/dist/index.js +2340 -0
- package/dist/index.mjs +2255 -0
- package/package.json +50 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { Diffsome, DiffsomeConfig, Member, LoginCredentials, AuthResponse, RegisterData, UpdateProfileData, ResetPasswordData, SocialProvider, Cart, CartItem, WishlistItem, WishlistToggleResult, WishlistMoveToCartResult, BundlePricing, ProductCategory, Product, PaginationMeta, ProductListParams, ProductType, CreateOrderData, Order, OrderListParams, PaymentStatusResponse, StripeCheckoutResponse, StripeVerifyResponse, TossPaymentReadyResponse, TossPaymentConfirmResponse, Coupon, CouponValidation, MemberSubscription, DigitalDownloadLink, CanReviewResponse, CreateProductReviewData, ProductReview, UpdateProductReviewData, ProductReviewStats, ProductReviewListParams, BlogCategory, BlogListParams, BlogPost, BoardPost, Board, CreateBoardPostData, BoardPostListParams, BoardListParams, Comment, CreateCommentData, Form, FormSubmissionData, FormSubmission, ReservationSlot, CreateReservationData, Reservation, ReservationService, ReservationSettings, ReservationStaff, ReservationListParams, Media, CustomEntity, EntityRecord, EntityListParams } from '@diffsome/sdk';
|
|
5
|
+
export { AddToCartData, AuthResponse, BlogCategory, BlogListParams, BlogPost, Board, BoardListParams, BoardPost, BoardPostListParams, CanReviewResponse, Cart, CartItem, Comment, Coupon, CouponType, CouponValidation, CreateBoardPostData, CreateCommentData, CreateOrderData, CreateProductReviewData, CreateReservationData, CustomEntity, DiffsomeConfig, DigitalDownloadLink, DigitalFile, EntityField, EntityListParams, EntityRecord, EntitySchema, Form, FormSubmission, FormSubmissionData, ListResponse, LoginCredentials, Media, Member, MemberSubscription, Order, OrderItem, OrderListParams, OrderStatus, PaginatedResponse, PaginationMeta, Payment, PaymentMethod, PaymentStatus, PaymentStatusResponse, Product, ProductCategory, ProductListParams, ProductReview, ProductReviewStats, ProductType, ProductVariant, RegisterData, Reservation, ReservationService, ReservationSettings, ReservationSlot, ReservationStaff, ResetPasswordData, SocialAuthUrl, SocialProvider, StripeCheckoutResponse, StripeVerifyResponse, SubscriptionInterval, SubscriptionPlan, SubscriptionStatus, TossPaymentConfirmResponse, TossPaymentReadyResponse, UpdateProfileData, WishlistItem, WishlistMoveToCartResult, WishlistToggleResult } from '@diffsome/sdk';
|
|
6
|
+
|
|
7
|
+
interface DiffsomeContextValue {
|
|
8
|
+
client: Diffsome;
|
|
9
|
+
isReady: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const DiffsomeContext: react.Context<DiffsomeContextValue | null>;
|
|
12
|
+
interface DiffsomeProviderProps {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
config: DiffsomeConfig;
|
|
15
|
+
}
|
|
16
|
+
declare function DiffsomeProvider({ children, config }: DiffsomeProviderProps): react_jsx_runtime.JSX.Element;
|
|
17
|
+
declare function useDiffsome(): DiffsomeContextValue;
|
|
18
|
+
declare function useClient(): Diffsome;
|
|
19
|
+
|
|
20
|
+
interface UseAuthReturn {
|
|
21
|
+
user: Member | null;
|
|
22
|
+
isAuthenticated: boolean;
|
|
23
|
+
loading: boolean;
|
|
24
|
+
error: Error | null;
|
|
25
|
+
login: (credentials: LoginCredentials) => Promise<AuthResponse>;
|
|
26
|
+
register: (data: RegisterData) => Promise<AuthResponse>;
|
|
27
|
+
logout: () => Promise<void>;
|
|
28
|
+
getProfile: () => Promise<Member>;
|
|
29
|
+
updateProfile: (data: UpdateProfileData) => Promise<Member>;
|
|
30
|
+
forgotPassword: (email: string) => Promise<{
|
|
31
|
+
message: string;
|
|
32
|
+
}>;
|
|
33
|
+
resetPassword: (data: ResetPasswordData) => Promise<{
|
|
34
|
+
message: string;
|
|
35
|
+
}>;
|
|
36
|
+
refresh: () => Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
declare function useAuth(): UseAuthReturn;
|
|
39
|
+
|
|
40
|
+
interface UseSocialAuthReturn {
|
|
41
|
+
providers: SocialProvider[];
|
|
42
|
+
loading: boolean;
|
|
43
|
+
error: Error | null;
|
|
44
|
+
getAuthUrl: (provider: string) => Promise<string>;
|
|
45
|
+
handleCallback: (provider: string, code: string) => Promise<AuthResponse>;
|
|
46
|
+
refresh: () => Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
declare function useSocialAuth(): UseSocialAuthReturn;
|
|
49
|
+
|
|
50
|
+
interface UseCartReturn {
|
|
51
|
+
cart: Cart | null;
|
|
52
|
+
items: CartItem[];
|
|
53
|
+
itemCount: number;
|
|
54
|
+
totalQuantity: number;
|
|
55
|
+
subtotal: number;
|
|
56
|
+
shippingFee: number;
|
|
57
|
+
total: number;
|
|
58
|
+
loading: boolean;
|
|
59
|
+
error: Error | null;
|
|
60
|
+
addToCart: (productId: number, quantity?: number, variantId?: number, options?: Record<string, string>) => Promise<Cart>;
|
|
61
|
+
updateItem: (itemId: number, quantity: number) => Promise<Cart>;
|
|
62
|
+
removeItem: (itemId: number) => Promise<Cart>;
|
|
63
|
+
clearCart: () => Promise<void>;
|
|
64
|
+
refresh: () => Promise<void>;
|
|
65
|
+
isInCart: (productId: number, variantId?: number) => boolean;
|
|
66
|
+
getItemQuantity: (productId: number, variantId?: number) => number;
|
|
67
|
+
}
|
|
68
|
+
declare function useCart(): UseCartReturn;
|
|
69
|
+
|
|
70
|
+
interface UseWishlistReturn {
|
|
71
|
+
items: WishlistItem[];
|
|
72
|
+
count: number;
|
|
73
|
+
loading: boolean;
|
|
74
|
+
error: Error | null;
|
|
75
|
+
isInWishlist: (productId: number, variantId?: number) => boolean;
|
|
76
|
+
toggleWishlist: (productId: number, variantId?: number) => Promise<WishlistToggleResult>;
|
|
77
|
+
addToWishlist: (productId: number, variantId?: number, note?: string) => Promise<WishlistItem>;
|
|
78
|
+
removeFromWishlist: (wishlistId: number) => Promise<void>;
|
|
79
|
+
moveToCart: (wishlistIds?: number[]) => Promise<WishlistMoveToCartResult>;
|
|
80
|
+
updateNote: (wishlistId: number, note: string) => Promise<WishlistItem>;
|
|
81
|
+
getProductWishlistCount: (productSlug: string) => Promise<number>;
|
|
82
|
+
refresh: () => Promise<void>;
|
|
83
|
+
}
|
|
84
|
+
declare function useWishlist(): UseWishlistReturn;
|
|
85
|
+
|
|
86
|
+
interface UseProductsReturn {
|
|
87
|
+
products: Product[];
|
|
88
|
+
meta: PaginationMeta | null;
|
|
89
|
+
loading: boolean;
|
|
90
|
+
error: Error | null;
|
|
91
|
+
hasMore: boolean;
|
|
92
|
+
loadMore: () => Promise<void>;
|
|
93
|
+
refresh: () => Promise<void>;
|
|
94
|
+
search: (query: string) => Promise<void>;
|
|
95
|
+
}
|
|
96
|
+
interface UseProductsOptions extends ProductListParams {
|
|
97
|
+
autoFetch?: boolean;
|
|
98
|
+
}
|
|
99
|
+
declare function useProducts(options?: UseProductsOptions): UseProductsReturn;
|
|
100
|
+
interface UseProductReturn {
|
|
101
|
+
product: Product | null;
|
|
102
|
+
loading: boolean;
|
|
103
|
+
error: Error | null;
|
|
104
|
+
refresh: () => Promise<void>;
|
|
105
|
+
}
|
|
106
|
+
declare function useProduct(idOrSlug: number | string): UseProductReturn;
|
|
107
|
+
interface UseCategoriesReturn {
|
|
108
|
+
categories: ProductCategory[];
|
|
109
|
+
loading: boolean;
|
|
110
|
+
error: Error | null;
|
|
111
|
+
refresh: () => Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
declare function useCategories(): UseCategoriesReturn;
|
|
114
|
+
interface UseFeaturedProductsReturn {
|
|
115
|
+
products: Product[];
|
|
116
|
+
loading: boolean;
|
|
117
|
+
error: Error | null;
|
|
118
|
+
refresh: () => Promise<void>;
|
|
119
|
+
}
|
|
120
|
+
declare function useFeaturedProducts(limit?: number): UseFeaturedProductsReturn;
|
|
121
|
+
interface UseProductsByTypeReturn {
|
|
122
|
+
products: Product[];
|
|
123
|
+
meta: PaginationMeta | null;
|
|
124
|
+
loading: boolean;
|
|
125
|
+
error: Error | null;
|
|
126
|
+
refresh: () => Promise<void>;
|
|
127
|
+
}
|
|
128
|
+
declare function useProductsByType(type: ProductType, params?: ProductListParams): UseProductsByTypeReturn;
|
|
129
|
+
declare function useDigitalProducts(params?: ProductListParams): UseProductsByTypeReturn;
|
|
130
|
+
declare function useSubscriptionProducts(params?: ProductListParams): UseProductsByTypeReturn;
|
|
131
|
+
declare function useBundleProducts(params?: ProductListParams): UseProductsByTypeReturn;
|
|
132
|
+
interface UseBundleItemsReturn {
|
|
133
|
+
bundle: BundlePricing | null;
|
|
134
|
+
loading: boolean;
|
|
135
|
+
error: Error | null;
|
|
136
|
+
refresh: () => Promise<void>;
|
|
137
|
+
}
|
|
138
|
+
declare function useBundleItems(productSlug: string): UseBundleItemsReturn;
|
|
139
|
+
|
|
140
|
+
interface UseOrdersReturn {
|
|
141
|
+
orders: Order[];
|
|
142
|
+
meta: PaginationMeta | null;
|
|
143
|
+
loading: boolean;
|
|
144
|
+
error: Error | null;
|
|
145
|
+
hasMore: boolean;
|
|
146
|
+
loadMore: () => Promise<void>;
|
|
147
|
+
refresh: () => Promise<void>;
|
|
148
|
+
}
|
|
149
|
+
declare function useOrders(params?: OrderListParams): UseOrdersReturn;
|
|
150
|
+
interface UseOrderReturn {
|
|
151
|
+
order: Order | null;
|
|
152
|
+
loading: boolean;
|
|
153
|
+
error: Error | null;
|
|
154
|
+
cancel: () => Promise<Order>;
|
|
155
|
+
refresh: () => Promise<void>;
|
|
156
|
+
}
|
|
157
|
+
declare function useOrder(idOrNumber: number | string): UseOrderReturn;
|
|
158
|
+
interface UseCreateOrderReturn {
|
|
159
|
+
createOrder: (data: CreateOrderData) => Promise<Order>;
|
|
160
|
+
loading: boolean;
|
|
161
|
+
error: Error | null;
|
|
162
|
+
}
|
|
163
|
+
declare function useCreateOrder(): UseCreateOrderReturn;
|
|
164
|
+
|
|
165
|
+
interface UsePaymentStatusReturn {
|
|
166
|
+
status: PaymentStatusResponse | null;
|
|
167
|
+
loading: boolean;
|
|
168
|
+
error: Error | null;
|
|
169
|
+
refresh: () => Promise<void>;
|
|
170
|
+
isTossAvailable: boolean;
|
|
171
|
+
isStripeAvailable: boolean;
|
|
172
|
+
stripePublishableKey: string | null;
|
|
173
|
+
}
|
|
174
|
+
declare function usePaymentStatus(): UsePaymentStatusReturn;
|
|
175
|
+
interface UseTossPaymentReturn {
|
|
176
|
+
preparePayment: (orderNumber: string, successUrl: string, failUrl: string) => Promise<TossPaymentReadyResponse>;
|
|
177
|
+
confirmPayment: (paymentKey: string, orderId: string, amount: number) => Promise<TossPaymentConfirmResponse>;
|
|
178
|
+
cancelPayment: (orderNumber: string, reason: string, amount?: number) => Promise<void>;
|
|
179
|
+
loading: boolean;
|
|
180
|
+
error: Error | null;
|
|
181
|
+
}
|
|
182
|
+
declare function useTossPayment(): UseTossPaymentReturn;
|
|
183
|
+
interface UseStripePaymentReturn {
|
|
184
|
+
createCheckout: (orderNumber: string, successUrl: string, cancelUrl: string) => Promise<StripeCheckoutResponse>;
|
|
185
|
+
verifyPayment: (sessionId: string) => Promise<StripeVerifyResponse>;
|
|
186
|
+
refund: (orderNumber: string, reason?: string, amount?: number) => Promise<void>;
|
|
187
|
+
loading: boolean;
|
|
188
|
+
error: Error | null;
|
|
189
|
+
}
|
|
190
|
+
declare function useStripePayment(): UseStripePaymentReturn;
|
|
191
|
+
|
|
192
|
+
interface UseCouponsReturn {
|
|
193
|
+
coupons: Coupon[];
|
|
194
|
+
loading: boolean;
|
|
195
|
+
error: Error | null;
|
|
196
|
+
refresh: () => Promise<void>;
|
|
197
|
+
}
|
|
198
|
+
declare function useCoupons(): UseCouponsReturn;
|
|
199
|
+
interface UseValidateCouponReturn {
|
|
200
|
+
validate: (code: string, orderAmount: number) => Promise<CouponValidation>;
|
|
201
|
+
validation: CouponValidation | null;
|
|
202
|
+
loading: boolean;
|
|
203
|
+
error: Error | null;
|
|
204
|
+
reset: () => void;
|
|
205
|
+
}
|
|
206
|
+
declare function useValidateCoupon(): UseValidateCouponReturn;
|
|
207
|
+
|
|
208
|
+
interface UseSubscriptionsReturn {
|
|
209
|
+
subscriptions: MemberSubscription[];
|
|
210
|
+
loading: boolean;
|
|
211
|
+
error: Error | null;
|
|
212
|
+
activeSubscription: MemberSubscription | null;
|
|
213
|
+
hasActiveSubscription: boolean;
|
|
214
|
+
refresh: () => Promise<void>;
|
|
215
|
+
}
|
|
216
|
+
declare function useSubscriptions(): UseSubscriptionsReturn;
|
|
217
|
+
interface UseSubscriptionReturn {
|
|
218
|
+
subscription: MemberSubscription | null;
|
|
219
|
+
loading: boolean;
|
|
220
|
+
error: Error | null;
|
|
221
|
+
cancel: (immediately?: boolean) => Promise<MemberSubscription>;
|
|
222
|
+
pause: () => Promise<MemberSubscription>;
|
|
223
|
+
resume: () => Promise<MemberSubscription>;
|
|
224
|
+
refresh: () => Promise<void>;
|
|
225
|
+
}
|
|
226
|
+
declare function useSubscription(id: number): UseSubscriptionReturn;
|
|
227
|
+
interface UseCreateSubscriptionReturn {
|
|
228
|
+
createCheckout: (planId: number, successUrl: string, cancelUrl: string) => Promise<{
|
|
229
|
+
url: string;
|
|
230
|
+
session_id: string;
|
|
231
|
+
}>;
|
|
232
|
+
verifyCheckout: (sessionId: string) => Promise<MemberSubscription>;
|
|
233
|
+
createSetupIntent: () => Promise<string>;
|
|
234
|
+
loading: boolean;
|
|
235
|
+
error: Error | null;
|
|
236
|
+
}
|
|
237
|
+
declare function useCreateSubscription(): UseCreateSubscriptionReturn;
|
|
238
|
+
|
|
239
|
+
interface UseDownloadsReturn {
|
|
240
|
+
downloads: DigitalDownloadLink[];
|
|
241
|
+
loading: boolean;
|
|
242
|
+
error: Error | null;
|
|
243
|
+
getDownloadUrl: (token: string) => string;
|
|
244
|
+
getDownloadInfo: (token: string) => Promise<DigitalDownloadLink>;
|
|
245
|
+
refresh: () => Promise<void>;
|
|
246
|
+
}
|
|
247
|
+
declare function useDownloads(): UseDownloadsReturn;
|
|
248
|
+
interface UseOrderDownloadsReturn {
|
|
249
|
+
downloads: DigitalDownloadLink[];
|
|
250
|
+
loading: boolean;
|
|
251
|
+
error: Error | null;
|
|
252
|
+
getDownloadUrl: (token: string) => string;
|
|
253
|
+
getDownloadInfo: (token: string) => Promise<DigitalDownloadLink>;
|
|
254
|
+
refresh: () => Promise<void>;
|
|
255
|
+
}
|
|
256
|
+
declare function useOrderDownloads(orderNumber: string): UseOrderDownloadsReturn;
|
|
257
|
+
|
|
258
|
+
interface UseProductReviewsReturn {
|
|
259
|
+
reviews: ProductReview[];
|
|
260
|
+
stats: ProductReviewStats | null;
|
|
261
|
+
meta: PaginationMeta | null;
|
|
262
|
+
loading: boolean;
|
|
263
|
+
error: Error | null;
|
|
264
|
+
refresh: () => Promise<void>;
|
|
265
|
+
}
|
|
266
|
+
declare function useProductReviews(productSlug: string, params?: ProductReviewListParams): UseProductReviewsReturn;
|
|
267
|
+
interface UseCanReviewReturn {
|
|
268
|
+
canReview: boolean;
|
|
269
|
+
reason: string | null;
|
|
270
|
+
loading: boolean;
|
|
271
|
+
error: Error | null;
|
|
272
|
+
check: () => Promise<CanReviewResponse>;
|
|
273
|
+
}
|
|
274
|
+
declare function useCanReview(productSlug: string): UseCanReviewReturn;
|
|
275
|
+
interface UseCreateReviewReturn {
|
|
276
|
+
createReview: (productSlug: string, data: CreateProductReviewData) => Promise<ProductReview>;
|
|
277
|
+
loading: boolean;
|
|
278
|
+
error: Error | null;
|
|
279
|
+
}
|
|
280
|
+
declare function useCreateReview(): UseCreateReviewReturn;
|
|
281
|
+
interface UseMyReviewsReturn {
|
|
282
|
+
reviews: ProductReview[];
|
|
283
|
+
meta: PaginationMeta | null;
|
|
284
|
+
loading: boolean;
|
|
285
|
+
error: Error | null;
|
|
286
|
+
refresh: () => Promise<void>;
|
|
287
|
+
deleteReview: (reviewId: number) => Promise<void>;
|
|
288
|
+
updateReview: (reviewId: number, data: UpdateProductReviewData) => Promise<ProductReview>;
|
|
289
|
+
}
|
|
290
|
+
declare function useMyReviews(params?: {
|
|
291
|
+
per_page?: number;
|
|
292
|
+
page?: number;
|
|
293
|
+
}): UseMyReviewsReturn;
|
|
294
|
+
|
|
295
|
+
interface UseBlogReturn {
|
|
296
|
+
posts: BlogPost[];
|
|
297
|
+
meta: PaginationMeta | null;
|
|
298
|
+
loading: boolean;
|
|
299
|
+
error: Error | null;
|
|
300
|
+
hasMore: boolean;
|
|
301
|
+
loadMore: () => Promise<void>;
|
|
302
|
+
refresh: () => Promise<void>;
|
|
303
|
+
}
|
|
304
|
+
interface UseBlogOptions extends BlogListParams {
|
|
305
|
+
autoFetch?: boolean;
|
|
306
|
+
}
|
|
307
|
+
declare function useBlog(options?: UseBlogOptions): UseBlogReturn;
|
|
308
|
+
interface UseBlogPostReturn {
|
|
309
|
+
post: BlogPost | null;
|
|
310
|
+
loading: boolean;
|
|
311
|
+
error: Error | null;
|
|
312
|
+
refresh: () => Promise<void>;
|
|
313
|
+
}
|
|
314
|
+
declare function useBlogPost(slug: string): UseBlogPostReturn;
|
|
315
|
+
interface UseBlogCategoriesReturn {
|
|
316
|
+
categories: BlogCategory[];
|
|
317
|
+
loading: boolean;
|
|
318
|
+
error: Error | null;
|
|
319
|
+
refresh: () => Promise<void>;
|
|
320
|
+
}
|
|
321
|
+
declare function useBlogCategories(): UseBlogCategoriesReturn;
|
|
322
|
+
interface UseBlogTagsReturn {
|
|
323
|
+
tags: string[];
|
|
324
|
+
loading: boolean;
|
|
325
|
+
error: Error | null;
|
|
326
|
+
refresh: () => Promise<void>;
|
|
327
|
+
}
|
|
328
|
+
declare function useBlogTags(): UseBlogTagsReturn;
|
|
329
|
+
interface UseFeaturedBlogReturn {
|
|
330
|
+
posts: BlogPost[];
|
|
331
|
+
loading: boolean;
|
|
332
|
+
error: Error | null;
|
|
333
|
+
refresh: () => Promise<void>;
|
|
334
|
+
}
|
|
335
|
+
declare function useFeaturedBlog(limit?: number): UseFeaturedBlogReturn;
|
|
336
|
+
interface UseBlogSearchReturn {
|
|
337
|
+
posts: BlogPost[];
|
|
338
|
+
meta: PaginationMeta | null;
|
|
339
|
+
loading: boolean;
|
|
340
|
+
error: Error | null;
|
|
341
|
+
search: (query: string) => Promise<void>;
|
|
342
|
+
}
|
|
343
|
+
declare function useBlogSearch(): UseBlogSearchReturn;
|
|
344
|
+
|
|
345
|
+
interface UseBoardsReturn {
|
|
346
|
+
boards: Board[];
|
|
347
|
+
loading: boolean;
|
|
348
|
+
error: Error | null;
|
|
349
|
+
refresh: () => Promise<void>;
|
|
350
|
+
}
|
|
351
|
+
declare function useBoards(params?: BoardListParams): UseBoardsReturn;
|
|
352
|
+
interface UseBoardReturn {
|
|
353
|
+
board: Board | null;
|
|
354
|
+
loading: boolean;
|
|
355
|
+
error: Error | null;
|
|
356
|
+
refresh: () => Promise<void>;
|
|
357
|
+
}
|
|
358
|
+
declare function useBoard(slug: string): UseBoardReturn;
|
|
359
|
+
interface UseBoardPostsReturn {
|
|
360
|
+
posts: BoardPost[];
|
|
361
|
+
meta: PaginationMeta | null;
|
|
362
|
+
loading: boolean;
|
|
363
|
+
error: Error | null;
|
|
364
|
+
hasMore: boolean;
|
|
365
|
+
loadMore: () => Promise<void>;
|
|
366
|
+
refresh: () => Promise<void>;
|
|
367
|
+
}
|
|
368
|
+
declare function useBoardPosts(boardSlug: string, params?: BoardPostListParams): UseBoardPostsReturn;
|
|
369
|
+
interface UseBoardPostReturn {
|
|
370
|
+
post: BoardPost | null;
|
|
371
|
+
loading: boolean;
|
|
372
|
+
error: Error | null;
|
|
373
|
+
refresh: () => Promise<void>;
|
|
374
|
+
}
|
|
375
|
+
declare function useBoardPost(postId: number): UseBoardPostReturn;
|
|
376
|
+
interface UseCreateBoardPostReturn {
|
|
377
|
+
createPost: (data: CreateBoardPostData) => Promise<BoardPost>;
|
|
378
|
+
loading: boolean;
|
|
379
|
+
error: Error | null;
|
|
380
|
+
}
|
|
381
|
+
declare function useCreateBoardPost(): UseCreateBoardPostReturn;
|
|
382
|
+
|
|
383
|
+
interface UseCommentsReturn {
|
|
384
|
+
comments: Comment[];
|
|
385
|
+
meta: PaginationMeta | null;
|
|
386
|
+
loading: boolean;
|
|
387
|
+
error: Error | null;
|
|
388
|
+
createComment: (data: CreateCommentData) => Promise<Comment>;
|
|
389
|
+
updateComment: (commentId: number, content: string) => Promise<Comment>;
|
|
390
|
+
deleteComment: (commentId: number, password?: string) => Promise<void>;
|
|
391
|
+
likeComment: (commentId: number) => Promise<number>;
|
|
392
|
+
refresh: () => Promise<void>;
|
|
393
|
+
}
|
|
394
|
+
type CommentType = 'board' | 'blog' | 'standalone';
|
|
395
|
+
interface UseCommentsOptions {
|
|
396
|
+
type: CommentType;
|
|
397
|
+
/** Post ID for board comments, slug for blog/standalone */
|
|
398
|
+
target: number | string;
|
|
399
|
+
page?: number;
|
|
400
|
+
per_page?: number;
|
|
401
|
+
}
|
|
402
|
+
declare function useComments(options: UseCommentsOptions): UseCommentsReturn;
|
|
403
|
+
|
|
404
|
+
interface UseFormReturn {
|
|
405
|
+
form: Form | null;
|
|
406
|
+
loading: boolean;
|
|
407
|
+
error: Error | null;
|
|
408
|
+
submit: (data: FormSubmissionData) => Promise<FormSubmission>;
|
|
409
|
+
submitting: boolean;
|
|
410
|
+
submitted: boolean;
|
|
411
|
+
reset: () => void;
|
|
412
|
+
}
|
|
413
|
+
declare function useForm(formSlug: string): UseFormReturn;
|
|
414
|
+
|
|
415
|
+
interface UseReservationServicesReturn {
|
|
416
|
+
services: ReservationService[];
|
|
417
|
+
loading: boolean;
|
|
418
|
+
error: Error | null;
|
|
419
|
+
refresh: () => Promise<void>;
|
|
420
|
+
}
|
|
421
|
+
declare function useReservationServices(): UseReservationServicesReturn;
|
|
422
|
+
interface UseReservationStaffsReturn {
|
|
423
|
+
staffs: ReservationStaff[];
|
|
424
|
+
loading: boolean;
|
|
425
|
+
error: Error | null;
|
|
426
|
+
refresh: () => Promise<void>;
|
|
427
|
+
}
|
|
428
|
+
declare function useReservationStaffs(): UseReservationStaffsReturn;
|
|
429
|
+
interface UseAvailableSlotsReturn {
|
|
430
|
+
slots: ReservationSlot[];
|
|
431
|
+
loading: boolean;
|
|
432
|
+
error: Error | null;
|
|
433
|
+
refresh: () => Promise<void>;
|
|
434
|
+
}
|
|
435
|
+
declare function useAvailableSlots(serviceId: number, date: string, staffId?: number): UseAvailableSlotsReturn;
|
|
436
|
+
interface UseMyReservationsReturn {
|
|
437
|
+
reservations: Reservation[];
|
|
438
|
+
meta: PaginationMeta | null;
|
|
439
|
+
loading: boolean;
|
|
440
|
+
error: Error | null;
|
|
441
|
+
refresh: () => Promise<void>;
|
|
442
|
+
}
|
|
443
|
+
declare function useMyReservations(params?: ReservationListParams): UseMyReservationsReturn;
|
|
444
|
+
interface UseCreateReservationReturn {
|
|
445
|
+
createReservation: (data: CreateReservationData) => Promise<Reservation>;
|
|
446
|
+
loading: boolean;
|
|
447
|
+
error: Error | null;
|
|
448
|
+
}
|
|
449
|
+
declare function useCreateReservation(): UseCreateReservationReturn;
|
|
450
|
+
interface UseReservationSettingsReturn {
|
|
451
|
+
settings: ReservationSettings | null;
|
|
452
|
+
loading: boolean;
|
|
453
|
+
error: Error | null;
|
|
454
|
+
refresh: () => Promise<void>;
|
|
455
|
+
}
|
|
456
|
+
declare function useReservationSettings(): UseReservationSettingsReturn;
|
|
457
|
+
|
|
458
|
+
interface UseMediaReturn {
|
|
459
|
+
files: Media[];
|
|
460
|
+
meta: PaginationMeta | null;
|
|
461
|
+
loading: boolean;
|
|
462
|
+
error: Error | null;
|
|
463
|
+
upload: (file: File | Blob) => Promise<Media>;
|
|
464
|
+
uploadMultiple: (files: (File | Blob)[]) => Promise<Media[]>;
|
|
465
|
+
deleteFile: (mediaId: number) => Promise<void>;
|
|
466
|
+
refresh: () => Promise<void>;
|
|
467
|
+
uploading: boolean;
|
|
468
|
+
uploadProgress: number;
|
|
469
|
+
}
|
|
470
|
+
interface UseMediaOptions {
|
|
471
|
+
type?: string;
|
|
472
|
+
page?: number;
|
|
473
|
+
per_page?: number;
|
|
474
|
+
autoFetch?: boolean;
|
|
475
|
+
}
|
|
476
|
+
declare function useMedia(options?: UseMediaOptions): UseMediaReturn;
|
|
477
|
+
|
|
478
|
+
interface UseEntitiesReturn {
|
|
479
|
+
entities: CustomEntity[];
|
|
480
|
+
loading: boolean;
|
|
481
|
+
error: Error | null;
|
|
482
|
+
refresh: () => Promise<void>;
|
|
483
|
+
}
|
|
484
|
+
declare function useEntities(): UseEntitiesReturn;
|
|
485
|
+
interface UseEntityReturn {
|
|
486
|
+
entity: CustomEntity | null;
|
|
487
|
+
loading: boolean;
|
|
488
|
+
error: Error | null;
|
|
489
|
+
refresh: () => Promise<void>;
|
|
490
|
+
}
|
|
491
|
+
declare function useEntity(slug: string): UseEntityReturn;
|
|
492
|
+
interface UseEntityRecordsReturn {
|
|
493
|
+
records: EntityRecord[];
|
|
494
|
+
meta: PaginationMeta | null;
|
|
495
|
+
loading: boolean;
|
|
496
|
+
error: Error | null;
|
|
497
|
+
hasMore: boolean;
|
|
498
|
+
loadMore: () => Promise<void>;
|
|
499
|
+
createRecord: (data: Record<string, any>) => Promise<EntityRecord>;
|
|
500
|
+
updateRecord: (id: number, data: Record<string, any>) => Promise<EntityRecord>;
|
|
501
|
+
deleteRecord: (id: number) => Promise<void>;
|
|
502
|
+
refresh: () => Promise<void>;
|
|
503
|
+
}
|
|
504
|
+
declare function useEntityRecords(slug: string, params?: EntityListParams): UseEntityRecordsReturn;
|
|
505
|
+
interface UseEntityRecordReturn {
|
|
506
|
+
record: EntityRecord | null;
|
|
507
|
+
loading: boolean;
|
|
508
|
+
error: Error | null;
|
|
509
|
+
update: (data: Record<string, any>) => Promise<EntityRecord>;
|
|
510
|
+
refresh: () => Promise<void>;
|
|
511
|
+
}
|
|
512
|
+
declare function useEntityRecord(slug: string, id: number): UseEntityRecordReturn;
|
|
513
|
+
declare function useTypedEntity<T extends Record<string, any>>(slug: string): {
|
|
514
|
+
useRecords: (params?: EntityListParams) => {
|
|
515
|
+
records: Array<Omit<EntityRecord, "data"> & {
|
|
516
|
+
data: T;
|
|
517
|
+
}>;
|
|
518
|
+
meta: PaginationMeta | null;
|
|
519
|
+
loading: boolean;
|
|
520
|
+
error: Error | null;
|
|
521
|
+
hasMore: boolean;
|
|
522
|
+
loadMore: () => Promise<void>;
|
|
523
|
+
createRecord: (data: Record<string, any>) => Promise<EntityRecord>;
|
|
524
|
+
updateRecord: (id: number, data: Record<string, any>) => Promise<EntityRecord>;
|
|
525
|
+
deleteRecord: (id: number) => Promise<void>;
|
|
526
|
+
refresh: () => Promise<void>;
|
|
527
|
+
};
|
|
528
|
+
useRecord: (id: number) => {
|
|
529
|
+
record: (Omit<EntityRecord, "data"> & {
|
|
530
|
+
data: T;
|
|
531
|
+
}) | null;
|
|
532
|
+
loading: boolean;
|
|
533
|
+
error: Error | null;
|
|
534
|
+
update: (data: Record<string, any>) => Promise<EntityRecord>;
|
|
535
|
+
refresh: () => Promise<void>;
|
|
536
|
+
};
|
|
537
|
+
create: (data: T) => Promise<Omit<EntityRecord, "data"> & {
|
|
538
|
+
data: T;
|
|
539
|
+
}>;
|
|
540
|
+
update: (id: number, data: Partial<T>) => Promise<Omit<EntityRecord, "data"> & {
|
|
541
|
+
data: T;
|
|
542
|
+
}>;
|
|
543
|
+
delete: (id: number) => Promise<void>;
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
export { type CommentType, DiffsomeContext, type DiffsomeContextValue, DiffsomeProvider, type DiffsomeProviderProps, type UseAuthReturn, type UseAvailableSlotsReturn, type UseBlogCategoriesReturn, type UseBlogOptions, type UseBlogPostReturn, type UseBlogReturn, type UseBlogSearchReturn, type UseBlogTagsReturn, type UseBoardPostReturn, type UseBoardPostsReturn, type UseBoardReturn, type UseBoardsReturn, type UseBundleItemsReturn, type UseCanReviewReturn, type UseCartReturn, type UseCategoriesReturn, type UseCommentsOptions, type UseCommentsReturn, type UseCouponsReturn, type UseCreateBoardPostReturn, type UseCreateOrderReturn, type UseCreateReservationReturn, type UseCreateReviewReturn, type UseCreateSubscriptionReturn, type UseDownloadsReturn, type UseEntitiesReturn, type UseEntityRecordReturn, type UseEntityRecordsReturn, type UseEntityReturn, type UseFeaturedBlogReturn, type UseFeaturedProductsReturn, type UseFormReturn, type UseMediaOptions, type UseMediaReturn, type UseMyReservationsReturn, type UseMyReviewsReturn, type UseOrderDownloadsReturn, type UseOrderReturn, type UseOrdersReturn, type UsePaymentStatusReturn, type UseProductReturn, type UseProductReviewsReturn, type UseProductsByTypeReturn, type UseProductsOptions, type UseProductsReturn, type UseReservationServicesReturn, type UseReservationSettingsReturn, type UseReservationStaffsReturn, type UseSocialAuthReturn, type UseStripePaymentReturn, type UseSubscriptionReturn, type UseSubscriptionsReturn, type UseTossPaymentReturn, type UseValidateCouponReturn, type UseWishlistReturn, useAuth, useAvailableSlots, useBlog, useBlogCategories, useBlogPost, useBlogSearch, useBlogTags, useBoard, useBoardPost, useBoardPosts, useBoards, useBundleItems, useBundleProducts, useCanReview, useCart, useCategories, useClient, useComments, useCoupons, useCreateBoardPost, useCreateOrder, useCreateReservation, useCreateReview, useCreateSubscription, useDiffsome, useDigitalProducts, useDownloads, useEntities, useEntity, useEntityRecord, useEntityRecords, useFeaturedBlog, useFeaturedProducts, useForm, useMedia, useMyReservations, useMyReviews, useOrder, useOrderDownloads, useOrders, usePaymentStatus, useProduct, useProductReviews, useProducts, useProductsByType, useReservationServices, useReservationSettings, useReservationStaffs, useSocialAuth, useStripePayment, useSubscription, useSubscriptionProducts, useSubscriptions, useTossPayment, useTypedEntity, useValidateCoupon, useWishlist };
|