@back23/promptly-sdk 2.8.0 → 2.11.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/dist/index.d.mts +201 -4
- package/dist/index.d.ts +201 -4
- package/dist/index.js +123 -3
- package/dist/index.mjs +123 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -216,8 +216,12 @@ interface BlogPost {
|
|
|
216
216
|
slug: string;
|
|
217
217
|
excerpt: string;
|
|
218
218
|
featured_image: string | null;
|
|
219
|
+
category: string | null;
|
|
220
|
+
tags: string[];
|
|
219
221
|
author: string;
|
|
222
|
+
views: number;
|
|
220
223
|
status: string;
|
|
224
|
+
published_at: string | null;
|
|
221
225
|
created_at: string;
|
|
222
226
|
content?: string;
|
|
223
227
|
updated_at?: string;
|
|
@@ -583,6 +587,73 @@ interface PaymentCancelData {
|
|
|
583
587
|
cancel_reason: string;
|
|
584
588
|
cancel_amount?: number;
|
|
585
589
|
}
|
|
590
|
+
interface TossPaymentReadyData {
|
|
591
|
+
order_number: string;
|
|
592
|
+
success_url: string;
|
|
593
|
+
fail_url: string;
|
|
594
|
+
}
|
|
595
|
+
interface TossPaymentReadyResponse {
|
|
596
|
+
success: boolean;
|
|
597
|
+
payment_id: number;
|
|
598
|
+
order_id: string;
|
|
599
|
+
order_name: string;
|
|
600
|
+
amount: number;
|
|
601
|
+
customer_name: string;
|
|
602
|
+
customer_email: string;
|
|
603
|
+
success_url: string;
|
|
604
|
+
fail_url: string;
|
|
605
|
+
client_key: string;
|
|
606
|
+
}
|
|
607
|
+
interface TossPaymentConfirmData {
|
|
608
|
+
payment_key: string;
|
|
609
|
+
order_id: string;
|
|
610
|
+
amount: number;
|
|
611
|
+
}
|
|
612
|
+
interface TossPaymentConfirmResponse {
|
|
613
|
+
order_number: string;
|
|
614
|
+
status: string;
|
|
615
|
+
status_label: string;
|
|
616
|
+
payment_status: string;
|
|
617
|
+
payment?: {
|
|
618
|
+
method: string;
|
|
619
|
+
method_label: string;
|
|
620
|
+
method_detail?: string;
|
|
621
|
+
receipt_url?: string;
|
|
622
|
+
approved_at?: string;
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
interface StripeCheckoutData {
|
|
626
|
+
order_number: string;
|
|
627
|
+
success_url: string;
|
|
628
|
+
cancel_url: string;
|
|
629
|
+
}
|
|
630
|
+
interface StripeCheckoutResponse {
|
|
631
|
+
success: boolean;
|
|
632
|
+
session_id: string;
|
|
633
|
+
checkout_url: string;
|
|
634
|
+
}
|
|
635
|
+
interface StripeVerifyData {
|
|
636
|
+
session_id: string;
|
|
637
|
+
}
|
|
638
|
+
interface StripeVerifyResponse {
|
|
639
|
+
order_number: string;
|
|
640
|
+
status: string;
|
|
641
|
+
status_label: string;
|
|
642
|
+
payment_status: string;
|
|
643
|
+
payment?: {
|
|
644
|
+
method: string;
|
|
645
|
+
approved_at?: string;
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
interface PaymentStatusResponse {
|
|
649
|
+
toss: {
|
|
650
|
+
available: boolean;
|
|
651
|
+
};
|
|
652
|
+
stripe: {
|
|
653
|
+
available: boolean;
|
|
654
|
+
publishable_key?: string;
|
|
655
|
+
};
|
|
656
|
+
}
|
|
586
657
|
type CouponType = 'fixed' | 'percent';
|
|
587
658
|
interface Coupon {
|
|
588
659
|
id: number;
|
|
@@ -611,6 +682,62 @@ interface CouponValidation {
|
|
|
611
682
|
discount_amount?: number;
|
|
612
683
|
coupon?: Coupon;
|
|
613
684
|
}
|
|
685
|
+
interface ProductReviewAuthor {
|
|
686
|
+
id: number;
|
|
687
|
+
name: string;
|
|
688
|
+
}
|
|
689
|
+
interface ProductReview {
|
|
690
|
+
id: number;
|
|
691
|
+
rating: number;
|
|
692
|
+
title?: string;
|
|
693
|
+
content: string;
|
|
694
|
+
images?: string[];
|
|
695
|
+
is_verified_purchase: boolean;
|
|
696
|
+
is_featured: boolean;
|
|
697
|
+
helpful_count: number;
|
|
698
|
+
author?: ProductReviewAuthor;
|
|
699
|
+
admin_reply?: string;
|
|
700
|
+
admin_replied_at?: string;
|
|
701
|
+
product?: {
|
|
702
|
+
id: number;
|
|
703
|
+
name: string;
|
|
704
|
+
slug: string;
|
|
705
|
+
thumbnail?: string;
|
|
706
|
+
};
|
|
707
|
+
created_at: string;
|
|
708
|
+
updated_at: string;
|
|
709
|
+
}
|
|
710
|
+
interface ProductReviewStats {
|
|
711
|
+
average_rating: number;
|
|
712
|
+
total_count: number;
|
|
713
|
+
rating_counts: {
|
|
714
|
+
5: number;
|
|
715
|
+
4: number;
|
|
716
|
+
3: number;
|
|
717
|
+
2: number;
|
|
718
|
+
1: number;
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
interface ProductReviewListParams extends ListParams {
|
|
722
|
+
rating?: number;
|
|
723
|
+
sort?: 'newest' | 'oldest' | 'highest' | 'lowest' | 'helpful';
|
|
724
|
+
}
|
|
725
|
+
interface CreateProductReviewData {
|
|
726
|
+
rating: number;
|
|
727
|
+
title?: string;
|
|
728
|
+
content: string;
|
|
729
|
+
images?: string[];
|
|
730
|
+
}
|
|
731
|
+
interface UpdateProductReviewData {
|
|
732
|
+
rating?: number;
|
|
733
|
+
title?: string;
|
|
734
|
+
content?: string;
|
|
735
|
+
images?: string[];
|
|
736
|
+
}
|
|
737
|
+
interface CanReviewResponse {
|
|
738
|
+
can_review: boolean;
|
|
739
|
+
reason?: 'not_logged_in' | 'already_reviewed' | 'not_purchased';
|
|
740
|
+
}
|
|
614
741
|
|
|
615
742
|
/**
|
|
616
743
|
* Custom Entity types for Promptly SDK
|
|
@@ -1225,18 +1352,46 @@ declare class ShopResource {
|
|
|
1225
1352
|
*/
|
|
1226
1353
|
getPayment(orderId: number): Promise<Payment>;
|
|
1227
1354
|
/**
|
|
1228
|
-
*
|
|
1355
|
+
* Get payment status (available payment methods)
|
|
1356
|
+
*/
|
|
1357
|
+
getPaymentStatus(): Promise<PaymentStatusResponse>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Prepare Toss payment (get client key and payment info)
|
|
1360
|
+
*/
|
|
1361
|
+
tossPaymentReady(data: TossPaymentReadyData): Promise<TossPaymentReadyResponse>;
|
|
1362
|
+
/**
|
|
1363
|
+
* Confirm Toss payment (after redirect)
|
|
1364
|
+
*/
|
|
1365
|
+
tossPaymentConfirm(data: TossPaymentConfirmData): Promise<TossPaymentConfirmResponse>;
|
|
1366
|
+
/**
|
|
1367
|
+
* Cancel Toss payment
|
|
1368
|
+
*/
|
|
1369
|
+
tossPaymentCancel(orderNumber: string, cancelReason: string, cancelAmount?: number): Promise<void>;
|
|
1370
|
+
/**
|
|
1371
|
+
* Create Stripe Checkout Session
|
|
1372
|
+
*/
|
|
1373
|
+
stripeCheckout(data: StripeCheckoutData): Promise<StripeCheckoutResponse>;
|
|
1374
|
+
/**
|
|
1375
|
+
* Verify Stripe payment (after redirect)
|
|
1376
|
+
*/
|
|
1377
|
+
stripeVerify(data: StripeVerifyData): Promise<StripeVerifyResponse>;
|
|
1378
|
+
/**
|
|
1379
|
+
* Refund Stripe payment
|
|
1380
|
+
*/
|
|
1381
|
+
stripeRefund(orderNumber: string, reason?: string, amount?: number): Promise<void>;
|
|
1382
|
+
/**
|
|
1383
|
+
* @deprecated Use tossPaymentReady instead
|
|
1229
1384
|
*/
|
|
1230
1385
|
preparePayment(data: PaymentReadyData): Promise<{
|
|
1231
1386
|
paymentKey: string;
|
|
1232
1387
|
orderId: string;
|
|
1233
1388
|
}>;
|
|
1234
1389
|
/**
|
|
1235
|
-
*
|
|
1390
|
+
* @deprecated Use tossPaymentConfirm instead
|
|
1236
1391
|
*/
|
|
1237
1392
|
confirmPayment(data: PaymentConfirmData): Promise<Payment>;
|
|
1238
1393
|
/**
|
|
1239
|
-
*
|
|
1394
|
+
* @deprecated Use tossPaymentCancel instead
|
|
1240
1395
|
*/
|
|
1241
1396
|
cancelPayment(paymentId: number, data: PaymentCancelData): Promise<Payment>;
|
|
1242
1397
|
/**
|
|
@@ -1248,6 +1403,48 @@ declare class ShopResource {
|
|
|
1248
1403
|
* @returns Array of coupons (always an array)
|
|
1249
1404
|
*/
|
|
1250
1405
|
myCoupons(): Promise<Coupon[]>;
|
|
1406
|
+
/**
|
|
1407
|
+
* Get reviews for a product
|
|
1408
|
+
* @param productSlug - Product slug
|
|
1409
|
+
* @param params - Optional list params (rating, sort, per_page)
|
|
1410
|
+
* @returns Reviews with stats
|
|
1411
|
+
*/
|
|
1412
|
+
getProductReviews(productSlug: string, params?: ProductReviewListParams): Promise<{
|
|
1413
|
+
data: ProductReview[];
|
|
1414
|
+
meta: any;
|
|
1415
|
+
stats: ProductReviewStats;
|
|
1416
|
+
}>;
|
|
1417
|
+
/**
|
|
1418
|
+
* Check if current user can review a product
|
|
1419
|
+
* Requires: logged in + purchased the product + not already reviewed
|
|
1420
|
+
*/
|
|
1421
|
+
canReviewProduct(productSlug: string): Promise<CanReviewResponse>;
|
|
1422
|
+
/**
|
|
1423
|
+
* Create a product review (requires purchase)
|
|
1424
|
+
*/
|
|
1425
|
+
createReview(productSlug: string, data: CreateProductReviewData): Promise<ProductReview>;
|
|
1426
|
+
/**
|
|
1427
|
+
* Update your own review
|
|
1428
|
+
*/
|
|
1429
|
+
updateReview(reviewId: number, data: UpdateProductReviewData): Promise<ProductReview>;
|
|
1430
|
+
/**
|
|
1431
|
+
* Delete your own review
|
|
1432
|
+
*/
|
|
1433
|
+
deleteReview(reviewId: number): Promise<void>;
|
|
1434
|
+
/**
|
|
1435
|
+
* Mark a review as helpful
|
|
1436
|
+
*/
|
|
1437
|
+
markReviewHelpful(reviewId: number): Promise<{
|
|
1438
|
+
helpful_count: number;
|
|
1439
|
+
}>;
|
|
1440
|
+
/**
|
|
1441
|
+
* Get my reviews
|
|
1442
|
+
* @returns Array of reviews written by the current user
|
|
1443
|
+
*/
|
|
1444
|
+
myReviews(params?: {
|
|
1445
|
+
per_page?: number;
|
|
1446
|
+
page?: number;
|
|
1447
|
+
}): Promise<ListResponse<ProductReview>>;
|
|
1251
1448
|
}
|
|
1252
1449
|
|
|
1253
1450
|
/**
|
|
@@ -1632,4 +1829,4 @@ declare class Promptly {
|
|
|
1632
1829
|
getApiKey(): string | null;
|
|
1633
1830
|
}
|
|
1634
1831
|
|
|
1635
|
-
export { type AddToCartData, type ApiError, type ApiResponse, type ApplyCouponData, type AuthResponse, type AvailableDatesParams, type AvailableSlotsParams, type BlogListParams, type BlogPost, type Board, type BoardComment, type BoardListParams, type BoardPost, type Cart, type CartItem, type CartShippingInfo, type Comment, type CommentCreateData, type CommentDeleteData, type CommentListParams, type CommentListResponse, type CommentUpdateData, type Coupon, type CouponType, type CouponValidation, type CreateCommentData, type CreateEntityData, type CreateEntityRecordData, type CreateOrderData, type CreatePostData, type CreateReservationData, type CreateReservationResult, type CustomEntity, type EntityField, type EntityListParams, type EntityRecord, type EntitySchema, type ForgotPasswordData, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormListParams, type FormSettings, type FormSubmission, type ListParams, type ListResponse, type LoginCredentials, type Media, type Member, type Order, type OrderItem, type OrderListParams, type OrderOrderer, type OrderShipping, type OrderStatus, type PaginatedResponse, type PaginationMeta, type Payment, type PaymentCancelData, type PaymentConfirmData, type PaymentMethod, type PaymentReadyData, type PaymentStatus, type PostListParams, type Product, type ProductCategory, type ProductListParams, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductVariant, Promptly, type PromptlyConfig, PromptlyError, type RegisterData, type Reservation, type ReservationListParams, type ReservationService, type ReservationSettings, type ReservationSlot, type ReservationStaff, type ReservationStaffSummary, type ResetPasswordData, type SocialAuthUrl, type SocialProvider, type SubmissionListParams, type SubmitFormData, type UpdateCartItemData, type UpdateCommentData, type UpdateEntityData, type UpdateEntityRecordData, type UpdatePostData, type UpdateProfileData, Promptly as default };
|
|
1832
|
+
export { type AddToCartData, type ApiError, type ApiResponse, type ApplyCouponData, type AuthResponse, type AvailableDatesParams, type AvailableSlotsParams, type BlogListParams, type BlogPost, type Board, type BoardComment, type BoardListParams, type BoardPost, type CanReviewResponse, type Cart, type CartItem, type CartShippingInfo, type Comment, type CommentCreateData, type CommentDeleteData, type CommentListParams, type CommentListResponse, type CommentUpdateData, type Coupon, type CouponType, type CouponValidation, type CreateCommentData, type CreateEntityData, type CreateEntityRecordData, type CreateOrderData, type CreatePostData, type CreateProductReviewData, type CreateReservationData, type CreateReservationResult, type CustomEntity, type EntityField, type EntityListParams, type EntityRecord, type EntitySchema, type ForgotPasswordData, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormListParams, type FormSettings, type FormSubmission, type ListParams, type ListResponse, type LoginCredentials, type Media, type Member, type Order, type OrderItem, type OrderListParams, type OrderOrderer, type OrderShipping, type OrderStatus, type PaginatedResponse, type PaginationMeta, type Payment, type PaymentCancelData, type PaymentConfirmData, type PaymentMethod, type PaymentReadyData, type PaymentStatus, type PaymentStatusResponse, type PostListParams, type Product, type ProductCategory, type ProductListParams, type ProductOption, type ProductOptionValue, type ProductReview, type ProductReviewAuthor, type ProductReviewListParams, type ProductReviewStats, type ProductStatus, type ProductVariant, Promptly, type PromptlyConfig, PromptlyError, type RegisterData, type Reservation, type ReservationListParams, type ReservationService, type ReservationSettings, type ReservationSlot, type ReservationStaff, type ReservationStaffSummary, type ResetPasswordData, type SocialAuthUrl, type SocialProvider, type StripeCheckoutData, type StripeCheckoutResponse, type StripeVerifyData, type StripeVerifyResponse, type SubmissionListParams, type SubmitFormData, type TossPaymentConfirmData, type TossPaymentConfirmResponse, type TossPaymentReadyData, type TossPaymentReadyResponse, type UpdateCartItemData, type UpdateCommentData, type UpdateEntityData, type UpdateEntityRecordData, type UpdatePostData, type UpdateProductReviewData, type UpdateProfileData, Promptly as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -216,8 +216,12 @@ interface BlogPost {
|
|
|
216
216
|
slug: string;
|
|
217
217
|
excerpt: string;
|
|
218
218
|
featured_image: string | null;
|
|
219
|
+
category: string | null;
|
|
220
|
+
tags: string[];
|
|
219
221
|
author: string;
|
|
222
|
+
views: number;
|
|
220
223
|
status: string;
|
|
224
|
+
published_at: string | null;
|
|
221
225
|
created_at: string;
|
|
222
226
|
content?: string;
|
|
223
227
|
updated_at?: string;
|
|
@@ -583,6 +587,73 @@ interface PaymentCancelData {
|
|
|
583
587
|
cancel_reason: string;
|
|
584
588
|
cancel_amount?: number;
|
|
585
589
|
}
|
|
590
|
+
interface TossPaymentReadyData {
|
|
591
|
+
order_number: string;
|
|
592
|
+
success_url: string;
|
|
593
|
+
fail_url: string;
|
|
594
|
+
}
|
|
595
|
+
interface TossPaymentReadyResponse {
|
|
596
|
+
success: boolean;
|
|
597
|
+
payment_id: number;
|
|
598
|
+
order_id: string;
|
|
599
|
+
order_name: string;
|
|
600
|
+
amount: number;
|
|
601
|
+
customer_name: string;
|
|
602
|
+
customer_email: string;
|
|
603
|
+
success_url: string;
|
|
604
|
+
fail_url: string;
|
|
605
|
+
client_key: string;
|
|
606
|
+
}
|
|
607
|
+
interface TossPaymentConfirmData {
|
|
608
|
+
payment_key: string;
|
|
609
|
+
order_id: string;
|
|
610
|
+
amount: number;
|
|
611
|
+
}
|
|
612
|
+
interface TossPaymentConfirmResponse {
|
|
613
|
+
order_number: string;
|
|
614
|
+
status: string;
|
|
615
|
+
status_label: string;
|
|
616
|
+
payment_status: string;
|
|
617
|
+
payment?: {
|
|
618
|
+
method: string;
|
|
619
|
+
method_label: string;
|
|
620
|
+
method_detail?: string;
|
|
621
|
+
receipt_url?: string;
|
|
622
|
+
approved_at?: string;
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
interface StripeCheckoutData {
|
|
626
|
+
order_number: string;
|
|
627
|
+
success_url: string;
|
|
628
|
+
cancel_url: string;
|
|
629
|
+
}
|
|
630
|
+
interface StripeCheckoutResponse {
|
|
631
|
+
success: boolean;
|
|
632
|
+
session_id: string;
|
|
633
|
+
checkout_url: string;
|
|
634
|
+
}
|
|
635
|
+
interface StripeVerifyData {
|
|
636
|
+
session_id: string;
|
|
637
|
+
}
|
|
638
|
+
interface StripeVerifyResponse {
|
|
639
|
+
order_number: string;
|
|
640
|
+
status: string;
|
|
641
|
+
status_label: string;
|
|
642
|
+
payment_status: string;
|
|
643
|
+
payment?: {
|
|
644
|
+
method: string;
|
|
645
|
+
approved_at?: string;
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
interface PaymentStatusResponse {
|
|
649
|
+
toss: {
|
|
650
|
+
available: boolean;
|
|
651
|
+
};
|
|
652
|
+
stripe: {
|
|
653
|
+
available: boolean;
|
|
654
|
+
publishable_key?: string;
|
|
655
|
+
};
|
|
656
|
+
}
|
|
586
657
|
type CouponType = 'fixed' | 'percent';
|
|
587
658
|
interface Coupon {
|
|
588
659
|
id: number;
|
|
@@ -611,6 +682,62 @@ interface CouponValidation {
|
|
|
611
682
|
discount_amount?: number;
|
|
612
683
|
coupon?: Coupon;
|
|
613
684
|
}
|
|
685
|
+
interface ProductReviewAuthor {
|
|
686
|
+
id: number;
|
|
687
|
+
name: string;
|
|
688
|
+
}
|
|
689
|
+
interface ProductReview {
|
|
690
|
+
id: number;
|
|
691
|
+
rating: number;
|
|
692
|
+
title?: string;
|
|
693
|
+
content: string;
|
|
694
|
+
images?: string[];
|
|
695
|
+
is_verified_purchase: boolean;
|
|
696
|
+
is_featured: boolean;
|
|
697
|
+
helpful_count: number;
|
|
698
|
+
author?: ProductReviewAuthor;
|
|
699
|
+
admin_reply?: string;
|
|
700
|
+
admin_replied_at?: string;
|
|
701
|
+
product?: {
|
|
702
|
+
id: number;
|
|
703
|
+
name: string;
|
|
704
|
+
slug: string;
|
|
705
|
+
thumbnail?: string;
|
|
706
|
+
};
|
|
707
|
+
created_at: string;
|
|
708
|
+
updated_at: string;
|
|
709
|
+
}
|
|
710
|
+
interface ProductReviewStats {
|
|
711
|
+
average_rating: number;
|
|
712
|
+
total_count: number;
|
|
713
|
+
rating_counts: {
|
|
714
|
+
5: number;
|
|
715
|
+
4: number;
|
|
716
|
+
3: number;
|
|
717
|
+
2: number;
|
|
718
|
+
1: number;
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
interface ProductReviewListParams extends ListParams {
|
|
722
|
+
rating?: number;
|
|
723
|
+
sort?: 'newest' | 'oldest' | 'highest' | 'lowest' | 'helpful';
|
|
724
|
+
}
|
|
725
|
+
interface CreateProductReviewData {
|
|
726
|
+
rating: number;
|
|
727
|
+
title?: string;
|
|
728
|
+
content: string;
|
|
729
|
+
images?: string[];
|
|
730
|
+
}
|
|
731
|
+
interface UpdateProductReviewData {
|
|
732
|
+
rating?: number;
|
|
733
|
+
title?: string;
|
|
734
|
+
content?: string;
|
|
735
|
+
images?: string[];
|
|
736
|
+
}
|
|
737
|
+
interface CanReviewResponse {
|
|
738
|
+
can_review: boolean;
|
|
739
|
+
reason?: 'not_logged_in' | 'already_reviewed' | 'not_purchased';
|
|
740
|
+
}
|
|
614
741
|
|
|
615
742
|
/**
|
|
616
743
|
* Custom Entity types for Promptly SDK
|
|
@@ -1225,18 +1352,46 @@ declare class ShopResource {
|
|
|
1225
1352
|
*/
|
|
1226
1353
|
getPayment(orderId: number): Promise<Payment>;
|
|
1227
1354
|
/**
|
|
1228
|
-
*
|
|
1355
|
+
* Get payment status (available payment methods)
|
|
1356
|
+
*/
|
|
1357
|
+
getPaymentStatus(): Promise<PaymentStatusResponse>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Prepare Toss payment (get client key and payment info)
|
|
1360
|
+
*/
|
|
1361
|
+
tossPaymentReady(data: TossPaymentReadyData): Promise<TossPaymentReadyResponse>;
|
|
1362
|
+
/**
|
|
1363
|
+
* Confirm Toss payment (after redirect)
|
|
1364
|
+
*/
|
|
1365
|
+
tossPaymentConfirm(data: TossPaymentConfirmData): Promise<TossPaymentConfirmResponse>;
|
|
1366
|
+
/**
|
|
1367
|
+
* Cancel Toss payment
|
|
1368
|
+
*/
|
|
1369
|
+
tossPaymentCancel(orderNumber: string, cancelReason: string, cancelAmount?: number): Promise<void>;
|
|
1370
|
+
/**
|
|
1371
|
+
* Create Stripe Checkout Session
|
|
1372
|
+
*/
|
|
1373
|
+
stripeCheckout(data: StripeCheckoutData): Promise<StripeCheckoutResponse>;
|
|
1374
|
+
/**
|
|
1375
|
+
* Verify Stripe payment (after redirect)
|
|
1376
|
+
*/
|
|
1377
|
+
stripeVerify(data: StripeVerifyData): Promise<StripeVerifyResponse>;
|
|
1378
|
+
/**
|
|
1379
|
+
* Refund Stripe payment
|
|
1380
|
+
*/
|
|
1381
|
+
stripeRefund(orderNumber: string, reason?: string, amount?: number): Promise<void>;
|
|
1382
|
+
/**
|
|
1383
|
+
* @deprecated Use tossPaymentReady instead
|
|
1229
1384
|
*/
|
|
1230
1385
|
preparePayment(data: PaymentReadyData): Promise<{
|
|
1231
1386
|
paymentKey: string;
|
|
1232
1387
|
orderId: string;
|
|
1233
1388
|
}>;
|
|
1234
1389
|
/**
|
|
1235
|
-
*
|
|
1390
|
+
* @deprecated Use tossPaymentConfirm instead
|
|
1236
1391
|
*/
|
|
1237
1392
|
confirmPayment(data: PaymentConfirmData): Promise<Payment>;
|
|
1238
1393
|
/**
|
|
1239
|
-
*
|
|
1394
|
+
* @deprecated Use tossPaymentCancel instead
|
|
1240
1395
|
*/
|
|
1241
1396
|
cancelPayment(paymentId: number, data: PaymentCancelData): Promise<Payment>;
|
|
1242
1397
|
/**
|
|
@@ -1248,6 +1403,48 @@ declare class ShopResource {
|
|
|
1248
1403
|
* @returns Array of coupons (always an array)
|
|
1249
1404
|
*/
|
|
1250
1405
|
myCoupons(): Promise<Coupon[]>;
|
|
1406
|
+
/**
|
|
1407
|
+
* Get reviews for a product
|
|
1408
|
+
* @param productSlug - Product slug
|
|
1409
|
+
* @param params - Optional list params (rating, sort, per_page)
|
|
1410
|
+
* @returns Reviews with stats
|
|
1411
|
+
*/
|
|
1412
|
+
getProductReviews(productSlug: string, params?: ProductReviewListParams): Promise<{
|
|
1413
|
+
data: ProductReview[];
|
|
1414
|
+
meta: any;
|
|
1415
|
+
stats: ProductReviewStats;
|
|
1416
|
+
}>;
|
|
1417
|
+
/**
|
|
1418
|
+
* Check if current user can review a product
|
|
1419
|
+
* Requires: logged in + purchased the product + not already reviewed
|
|
1420
|
+
*/
|
|
1421
|
+
canReviewProduct(productSlug: string): Promise<CanReviewResponse>;
|
|
1422
|
+
/**
|
|
1423
|
+
* Create a product review (requires purchase)
|
|
1424
|
+
*/
|
|
1425
|
+
createReview(productSlug: string, data: CreateProductReviewData): Promise<ProductReview>;
|
|
1426
|
+
/**
|
|
1427
|
+
* Update your own review
|
|
1428
|
+
*/
|
|
1429
|
+
updateReview(reviewId: number, data: UpdateProductReviewData): Promise<ProductReview>;
|
|
1430
|
+
/**
|
|
1431
|
+
* Delete your own review
|
|
1432
|
+
*/
|
|
1433
|
+
deleteReview(reviewId: number): Promise<void>;
|
|
1434
|
+
/**
|
|
1435
|
+
* Mark a review as helpful
|
|
1436
|
+
*/
|
|
1437
|
+
markReviewHelpful(reviewId: number): Promise<{
|
|
1438
|
+
helpful_count: number;
|
|
1439
|
+
}>;
|
|
1440
|
+
/**
|
|
1441
|
+
* Get my reviews
|
|
1442
|
+
* @returns Array of reviews written by the current user
|
|
1443
|
+
*/
|
|
1444
|
+
myReviews(params?: {
|
|
1445
|
+
per_page?: number;
|
|
1446
|
+
page?: number;
|
|
1447
|
+
}): Promise<ListResponse<ProductReview>>;
|
|
1251
1448
|
}
|
|
1252
1449
|
|
|
1253
1450
|
/**
|
|
@@ -1632,4 +1829,4 @@ declare class Promptly {
|
|
|
1632
1829
|
getApiKey(): string | null;
|
|
1633
1830
|
}
|
|
1634
1831
|
|
|
1635
|
-
export { type AddToCartData, type ApiError, type ApiResponse, type ApplyCouponData, type AuthResponse, type AvailableDatesParams, type AvailableSlotsParams, type BlogListParams, type BlogPost, type Board, type BoardComment, type BoardListParams, type BoardPost, type Cart, type CartItem, type CartShippingInfo, type Comment, type CommentCreateData, type CommentDeleteData, type CommentListParams, type CommentListResponse, type CommentUpdateData, type Coupon, type CouponType, type CouponValidation, type CreateCommentData, type CreateEntityData, type CreateEntityRecordData, type CreateOrderData, type CreatePostData, type CreateReservationData, type CreateReservationResult, type CustomEntity, type EntityField, type EntityListParams, type EntityRecord, type EntitySchema, type ForgotPasswordData, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormListParams, type FormSettings, type FormSubmission, type ListParams, type ListResponse, type LoginCredentials, type Media, type Member, type Order, type OrderItem, type OrderListParams, type OrderOrderer, type OrderShipping, type OrderStatus, type PaginatedResponse, type PaginationMeta, type Payment, type PaymentCancelData, type PaymentConfirmData, type PaymentMethod, type PaymentReadyData, type PaymentStatus, type PostListParams, type Product, type ProductCategory, type ProductListParams, type ProductOption, type ProductOptionValue, type ProductStatus, type ProductVariant, Promptly, type PromptlyConfig, PromptlyError, type RegisterData, type Reservation, type ReservationListParams, type ReservationService, type ReservationSettings, type ReservationSlot, type ReservationStaff, type ReservationStaffSummary, type ResetPasswordData, type SocialAuthUrl, type SocialProvider, type SubmissionListParams, type SubmitFormData, type UpdateCartItemData, type UpdateCommentData, type UpdateEntityData, type UpdateEntityRecordData, type UpdatePostData, type UpdateProfileData, Promptly as default };
|
|
1832
|
+
export { type AddToCartData, type ApiError, type ApiResponse, type ApplyCouponData, type AuthResponse, type AvailableDatesParams, type AvailableSlotsParams, type BlogListParams, type BlogPost, type Board, type BoardComment, type BoardListParams, type BoardPost, type CanReviewResponse, type Cart, type CartItem, type CartShippingInfo, type Comment, type CommentCreateData, type CommentDeleteData, type CommentListParams, type CommentListResponse, type CommentUpdateData, type Coupon, type CouponType, type CouponValidation, type CreateCommentData, type CreateEntityData, type CreateEntityRecordData, type CreateOrderData, type CreatePostData, type CreateProductReviewData, type CreateReservationData, type CreateReservationResult, type CustomEntity, type EntityField, type EntityListParams, type EntityRecord, type EntitySchema, type ForgotPasswordData, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormListParams, type FormSettings, type FormSubmission, type ListParams, type ListResponse, type LoginCredentials, type Media, type Member, type Order, type OrderItem, type OrderListParams, type OrderOrderer, type OrderShipping, type OrderStatus, type PaginatedResponse, type PaginationMeta, type Payment, type PaymentCancelData, type PaymentConfirmData, type PaymentMethod, type PaymentReadyData, type PaymentStatus, type PaymentStatusResponse, type PostListParams, type Product, type ProductCategory, type ProductListParams, type ProductOption, type ProductOptionValue, type ProductReview, type ProductReviewAuthor, type ProductReviewListParams, type ProductReviewStats, type ProductStatus, type ProductVariant, Promptly, type PromptlyConfig, PromptlyError, type RegisterData, type Reservation, type ReservationListParams, type ReservationService, type ReservationSettings, type ReservationSlot, type ReservationStaff, type ReservationStaffSummary, type ResetPasswordData, type SocialAuthUrl, type SocialProvider, type StripeCheckoutData, type StripeCheckoutResponse, type StripeVerifyData, type StripeVerifyResponse, type SubmissionListParams, type SubmitFormData, type TossPaymentConfirmData, type TossPaymentConfirmResponse, type TossPaymentReadyData, type TossPaymentReadyResponse, type UpdateCartItemData, type UpdateCommentData, type UpdateEntityData, type UpdateEntityRecordData, type UpdatePostData, type UpdateProductReviewData, type UpdateProfileData, Promptly as default };
|
package/dist/index.js
CHANGED
|
@@ -820,19 +820,78 @@ var ShopResource = class {
|
|
|
820
820
|
return this.http.get(`/orders/${orderId}/payment`);
|
|
821
821
|
}
|
|
822
822
|
/**
|
|
823
|
-
*
|
|
823
|
+
* Get payment status (available payment methods)
|
|
824
|
+
*/
|
|
825
|
+
async getPaymentStatus() {
|
|
826
|
+
return this.http.get("/payments/status");
|
|
827
|
+
}
|
|
828
|
+
// ============================================
|
|
829
|
+
// Toss Payments
|
|
830
|
+
// ============================================
|
|
831
|
+
/**
|
|
832
|
+
* Prepare Toss payment (get client key and payment info)
|
|
833
|
+
*/
|
|
834
|
+
async tossPaymentReady(data) {
|
|
835
|
+
return this.http.post("/payments/toss/ready", data);
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Confirm Toss payment (after redirect)
|
|
839
|
+
*/
|
|
840
|
+
async tossPaymentConfirm(data) {
|
|
841
|
+
return this.http.post("/payments/toss/confirm", data);
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
844
|
+
* Cancel Toss payment
|
|
845
|
+
*/
|
|
846
|
+
async tossPaymentCancel(orderNumber, cancelReason, cancelAmount) {
|
|
847
|
+
await this.http.post("/payments/toss/cancel", {
|
|
848
|
+
order_number: orderNumber,
|
|
849
|
+
cancel_reason: cancelReason,
|
|
850
|
+
cancel_amount: cancelAmount
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
// ============================================
|
|
854
|
+
// Stripe Payments
|
|
855
|
+
// ============================================
|
|
856
|
+
/**
|
|
857
|
+
* Create Stripe Checkout Session
|
|
858
|
+
*/
|
|
859
|
+
async stripeCheckout(data) {
|
|
860
|
+
return this.http.post("/payments/stripe/checkout", data);
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Verify Stripe payment (after redirect)
|
|
864
|
+
*/
|
|
865
|
+
async stripeVerify(data) {
|
|
866
|
+
return this.http.post("/payments/stripe/verify", data);
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* Refund Stripe payment
|
|
870
|
+
*/
|
|
871
|
+
async stripeRefund(orderNumber, reason, amount) {
|
|
872
|
+
await this.http.post("/payments/stripe/refund", {
|
|
873
|
+
order_number: orderNumber,
|
|
874
|
+
reason,
|
|
875
|
+
amount
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
// ============================================
|
|
879
|
+
// Legacy Payment Methods (deprecated)
|
|
880
|
+
// ============================================
|
|
881
|
+
/**
|
|
882
|
+
* @deprecated Use tossPaymentReady instead
|
|
824
883
|
*/
|
|
825
884
|
async preparePayment(data) {
|
|
826
885
|
return this.http.post(`/payments/ready`, data);
|
|
827
886
|
}
|
|
828
887
|
/**
|
|
829
|
-
*
|
|
888
|
+
* @deprecated Use tossPaymentConfirm instead
|
|
830
889
|
*/
|
|
831
890
|
async confirmPayment(data) {
|
|
832
891
|
return this.http.post("/payments/confirm", data);
|
|
833
892
|
}
|
|
834
893
|
/**
|
|
835
|
-
*
|
|
894
|
+
* @deprecated Use tossPaymentCancel instead
|
|
836
895
|
*/
|
|
837
896
|
async cancelPayment(paymentId, data) {
|
|
838
897
|
return this.http.post(`/payments/${paymentId}/cancel`, data);
|
|
@@ -857,6 +916,67 @@ var ShopResource = class {
|
|
|
857
916
|
const response = await this.http.getList("/coupons");
|
|
858
917
|
return response.data;
|
|
859
918
|
}
|
|
919
|
+
// ============================================
|
|
920
|
+
// Product Reviews
|
|
921
|
+
// ============================================
|
|
922
|
+
/**
|
|
923
|
+
* Get reviews for a product
|
|
924
|
+
* @param productSlug - Product slug
|
|
925
|
+
* @param params - Optional list params (rating, sort, per_page)
|
|
926
|
+
* @returns Reviews with stats
|
|
927
|
+
*/
|
|
928
|
+
async getProductReviews(productSlug, params) {
|
|
929
|
+
return this.http.get(`/products/${productSlug}/reviews`, params);
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Check if current user can review a product
|
|
933
|
+
* Requires: logged in + purchased the product + not already reviewed
|
|
934
|
+
*/
|
|
935
|
+
async canReviewProduct(productSlug) {
|
|
936
|
+
const response = await this.http.get(
|
|
937
|
+
`/products/${productSlug}/reviews/can-review`
|
|
938
|
+
);
|
|
939
|
+
return response;
|
|
940
|
+
}
|
|
941
|
+
/**
|
|
942
|
+
* Create a product review (requires purchase)
|
|
943
|
+
*/
|
|
944
|
+
async createReview(productSlug, data) {
|
|
945
|
+
const response = await this.http.post(
|
|
946
|
+
`/products/${productSlug}/reviews`,
|
|
947
|
+
data
|
|
948
|
+
);
|
|
949
|
+
return response.data;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Update your own review
|
|
953
|
+
*/
|
|
954
|
+
async updateReview(reviewId, data) {
|
|
955
|
+
const response = await this.http.put(
|
|
956
|
+
`/reviews/${reviewId}`,
|
|
957
|
+
data
|
|
958
|
+
);
|
|
959
|
+
return response.data;
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Delete your own review
|
|
963
|
+
*/
|
|
964
|
+
async deleteReview(reviewId) {
|
|
965
|
+
await this.http.delete(`/reviews/${reviewId}`);
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Mark a review as helpful
|
|
969
|
+
*/
|
|
970
|
+
async markReviewHelpful(reviewId) {
|
|
971
|
+
return this.http.post(`/reviews/${reviewId}/helpful`);
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* Get my reviews
|
|
975
|
+
* @returns Array of reviews written by the current user
|
|
976
|
+
*/
|
|
977
|
+
async myReviews(params) {
|
|
978
|
+
return this.http.getList("/my/reviews", params);
|
|
979
|
+
}
|
|
860
980
|
};
|
|
861
981
|
|
|
862
982
|
// src/resources/media.ts
|
package/dist/index.mjs
CHANGED
|
@@ -792,19 +792,78 @@ var ShopResource = class {
|
|
|
792
792
|
return this.http.get(`/orders/${orderId}/payment`);
|
|
793
793
|
}
|
|
794
794
|
/**
|
|
795
|
-
*
|
|
795
|
+
* Get payment status (available payment methods)
|
|
796
|
+
*/
|
|
797
|
+
async getPaymentStatus() {
|
|
798
|
+
return this.http.get("/payments/status");
|
|
799
|
+
}
|
|
800
|
+
// ============================================
|
|
801
|
+
// Toss Payments
|
|
802
|
+
// ============================================
|
|
803
|
+
/**
|
|
804
|
+
* Prepare Toss payment (get client key and payment info)
|
|
805
|
+
*/
|
|
806
|
+
async tossPaymentReady(data) {
|
|
807
|
+
return this.http.post("/payments/toss/ready", data);
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Confirm Toss payment (after redirect)
|
|
811
|
+
*/
|
|
812
|
+
async tossPaymentConfirm(data) {
|
|
813
|
+
return this.http.post("/payments/toss/confirm", data);
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Cancel Toss payment
|
|
817
|
+
*/
|
|
818
|
+
async tossPaymentCancel(orderNumber, cancelReason, cancelAmount) {
|
|
819
|
+
await this.http.post("/payments/toss/cancel", {
|
|
820
|
+
order_number: orderNumber,
|
|
821
|
+
cancel_reason: cancelReason,
|
|
822
|
+
cancel_amount: cancelAmount
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
// ============================================
|
|
826
|
+
// Stripe Payments
|
|
827
|
+
// ============================================
|
|
828
|
+
/**
|
|
829
|
+
* Create Stripe Checkout Session
|
|
830
|
+
*/
|
|
831
|
+
async stripeCheckout(data) {
|
|
832
|
+
return this.http.post("/payments/stripe/checkout", data);
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Verify Stripe payment (after redirect)
|
|
836
|
+
*/
|
|
837
|
+
async stripeVerify(data) {
|
|
838
|
+
return this.http.post("/payments/stripe/verify", data);
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Refund Stripe payment
|
|
842
|
+
*/
|
|
843
|
+
async stripeRefund(orderNumber, reason, amount) {
|
|
844
|
+
await this.http.post("/payments/stripe/refund", {
|
|
845
|
+
order_number: orderNumber,
|
|
846
|
+
reason,
|
|
847
|
+
amount
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
// ============================================
|
|
851
|
+
// Legacy Payment Methods (deprecated)
|
|
852
|
+
// ============================================
|
|
853
|
+
/**
|
|
854
|
+
* @deprecated Use tossPaymentReady instead
|
|
796
855
|
*/
|
|
797
856
|
async preparePayment(data) {
|
|
798
857
|
return this.http.post(`/payments/ready`, data);
|
|
799
858
|
}
|
|
800
859
|
/**
|
|
801
|
-
*
|
|
860
|
+
* @deprecated Use tossPaymentConfirm instead
|
|
802
861
|
*/
|
|
803
862
|
async confirmPayment(data) {
|
|
804
863
|
return this.http.post("/payments/confirm", data);
|
|
805
864
|
}
|
|
806
865
|
/**
|
|
807
|
-
*
|
|
866
|
+
* @deprecated Use tossPaymentCancel instead
|
|
808
867
|
*/
|
|
809
868
|
async cancelPayment(paymentId, data) {
|
|
810
869
|
return this.http.post(`/payments/${paymentId}/cancel`, data);
|
|
@@ -829,6 +888,67 @@ var ShopResource = class {
|
|
|
829
888
|
const response = await this.http.getList("/coupons");
|
|
830
889
|
return response.data;
|
|
831
890
|
}
|
|
891
|
+
// ============================================
|
|
892
|
+
// Product Reviews
|
|
893
|
+
// ============================================
|
|
894
|
+
/**
|
|
895
|
+
* Get reviews for a product
|
|
896
|
+
* @param productSlug - Product slug
|
|
897
|
+
* @param params - Optional list params (rating, sort, per_page)
|
|
898
|
+
* @returns Reviews with stats
|
|
899
|
+
*/
|
|
900
|
+
async getProductReviews(productSlug, params) {
|
|
901
|
+
return this.http.get(`/products/${productSlug}/reviews`, params);
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* Check if current user can review a product
|
|
905
|
+
* Requires: logged in + purchased the product + not already reviewed
|
|
906
|
+
*/
|
|
907
|
+
async canReviewProduct(productSlug) {
|
|
908
|
+
const response = await this.http.get(
|
|
909
|
+
`/products/${productSlug}/reviews/can-review`
|
|
910
|
+
);
|
|
911
|
+
return response;
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Create a product review (requires purchase)
|
|
915
|
+
*/
|
|
916
|
+
async createReview(productSlug, data) {
|
|
917
|
+
const response = await this.http.post(
|
|
918
|
+
`/products/${productSlug}/reviews`,
|
|
919
|
+
data
|
|
920
|
+
);
|
|
921
|
+
return response.data;
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* Update your own review
|
|
925
|
+
*/
|
|
926
|
+
async updateReview(reviewId, data) {
|
|
927
|
+
const response = await this.http.put(
|
|
928
|
+
`/reviews/${reviewId}`,
|
|
929
|
+
data
|
|
930
|
+
);
|
|
931
|
+
return response.data;
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* Delete your own review
|
|
935
|
+
*/
|
|
936
|
+
async deleteReview(reviewId) {
|
|
937
|
+
await this.http.delete(`/reviews/${reviewId}`);
|
|
938
|
+
}
|
|
939
|
+
/**
|
|
940
|
+
* Mark a review as helpful
|
|
941
|
+
*/
|
|
942
|
+
async markReviewHelpful(reviewId) {
|
|
943
|
+
return this.http.post(`/reviews/${reviewId}/helpful`);
|
|
944
|
+
}
|
|
945
|
+
/**
|
|
946
|
+
* Get my reviews
|
|
947
|
+
* @returns Array of reviews written by the current user
|
|
948
|
+
*/
|
|
949
|
+
async myReviews(params) {
|
|
950
|
+
return this.http.getList("/my/reviews", params);
|
|
951
|
+
}
|
|
832
952
|
};
|
|
833
953
|
|
|
834
954
|
// src/resources/media.ts
|