@back23/promptly-sdk 2.7.0 → 2.10.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 +216 -16
- package/dist/index.d.ts +216 -16
- package/dist/index.js +123 -3
- package/dist/index.mjs +123 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -477,6 +477,21 @@ interface OrderItem {
|
|
|
477
477
|
total: number;
|
|
478
478
|
options?: Record<string, string>;
|
|
479
479
|
}
|
|
480
|
+
interface OrderShipping {
|
|
481
|
+
name: string;
|
|
482
|
+
phone: string;
|
|
483
|
+
zipcode?: string;
|
|
484
|
+
address: string;
|
|
485
|
+
address_detail?: string;
|
|
486
|
+
memo?: string;
|
|
487
|
+
company?: string;
|
|
488
|
+
tracking_number?: string;
|
|
489
|
+
}
|
|
490
|
+
interface OrderOrderer {
|
|
491
|
+
name: string;
|
|
492
|
+
email: string;
|
|
493
|
+
phone: string;
|
|
494
|
+
}
|
|
480
495
|
interface Order {
|
|
481
496
|
id: number;
|
|
482
497
|
member_id?: number;
|
|
@@ -493,23 +508,15 @@ interface Order {
|
|
|
493
508
|
payment_status: PaymentStatus;
|
|
494
509
|
payment_status_label?: string;
|
|
495
510
|
paid_at?: string;
|
|
496
|
-
shipping_name: string;
|
|
497
|
-
shipping_phone: string;
|
|
498
|
-
shipping_zipcode: string;
|
|
499
|
-
shipping_address: string;
|
|
500
|
-
shipping_address_detail?: string;
|
|
501
|
-
shipping_memo?: string;
|
|
502
|
-
shipping_company?: string;
|
|
503
|
-
tracking_number?: string;
|
|
504
511
|
shipped_at?: string;
|
|
505
512
|
delivered_at?: string;
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
513
|
+
can_cancel?: boolean;
|
|
514
|
+
shipping?: OrderShipping;
|
|
515
|
+
orderer?: OrderOrderer;
|
|
509
516
|
items?: OrderItem[];
|
|
510
517
|
payment?: Payment;
|
|
511
518
|
created_at: string;
|
|
512
|
-
updated_at
|
|
519
|
+
updated_at?: string;
|
|
513
520
|
}
|
|
514
521
|
interface CreateOrderData {
|
|
515
522
|
orderer_name: string;
|
|
@@ -576,6 +583,73 @@ interface PaymentCancelData {
|
|
|
576
583
|
cancel_reason: string;
|
|
577
584
|
cancel_amount?: number;
|
|
578
585
|
}
|
|
586
|
+
interface TossPaymentReadyData {
|
|
587
|
+
order_number: string;
|
|
588
|
+
success_url: string;
|
|
589
|
+
fail_url: string;
|
|
590
|
+
}
|
|
591
|
+
interface TossPaymentReadyResponse {
|
|
592
|
+
success: boolean;
|
|
593
|
+
payment_id: number;
|
|
594
|
+
order_id: string;
|
|
595
|
+
order_name: string;
|
|
596
|
+
amount: number;
|
|
597
|
+
customer_name: string;
|
|
598
|
+
customer_email: string;
|
|
599
|
+
success_url: string;
|
|
600
|
+
fail_url: string;
|
|
601
|
+
client_key: string;
|
|
602
|
+
}
|
|
603
|
+
interface TossPaymentConfirmData {
|
|
604
|
+
payment_key: string;
|
|
605
|
+
order_id: string;
|
|
606
|
+
amount: number;
|
|
607
|
+
}
|
|
608
|
+
interface TossPaymentConfirmResponse {
|
|
609
|
+
order_number: string;
|
|
610
|
+
status: string;
|
|
611
|
+
status_label: string;
|
|
612
|
+
payment_status: string;
|
|
613
|
+
payment?: {
|
|
614
|
+
method: string;
|
|
615
|
+
method_label: string;
|
|
616
|
+
method_detail?: string;
|
|
617
|
+
receipt_url?: string;
|
|
618
|
+
approved_at?: string;
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
interface StripeCheckoutData {
|
|
622
|
+
order_number: string;
|
|
623
|
+
success_url: string;
|
|
624
|
+
cancel_url: string;
|
|
625
|
+
}
|
|
626
|
+
interface StripeCheckoutResponse {
|
|
627
|
+
success: boolean;
|
|
628
|
+
session_id: string;
|
|
629
|
+
checkout_url: string;
|
|
630
|
+
}
|
|
631
|
+
interface StripeVerifyData {
|
|
632
|
+
session_id: string;
|
|
633
|
+
}
|
|
634
|
+
interface StripeVerifyResponse {
|
|
635
|
+
order_number: string;
|
|
636
|
+
status: string;
|
|
637
|
+
status_label: string;
|
|
638
|
+
payment_status: string;
|
|
639
|
+
payment?: {
|
|
640
|
+
method: string;
|
|
641
|
+
approved_at?: string;
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
interface PaymentStatusResponse {
|
|
645
|
+
toss: {
|
|
646
|
+
available: boolean;
|
|
647
|
+
};
|
|
648
|
+
stripe: {
|
|
649
|
+
available: boolean;
|
|
650
|
+
publishable_key?: string;
|
|
651
|
+
};
|
|
652
|
+
}
|
|
579
653
|
type CouponType = 'fixed' | 'percent';
|
|
580
654
|
interface Coupon {
|
|
581
655
|
id: number;
|
|
@@ -604,6 +678,62 @@ interface CouponValidation {
|
|
|
604
678
|
discount_amount?: number;
|
|
605
679
|
coupon?: Coupon;
|
|
606
680
|
}
|
|
681
|
+
interface ProductReviewAuthor {
|
|
682
|
+
id: number;
|
|
683
|
+
name: string;
|
|
684
|
+
}
|
|
685
|
+
interface ProductReview {
|
|
686
|
+
id: number;
|
|
687
|
+
rating: number;
|
|
688
|
+
title?: string;
|
|
689
|
+
content: string;
|
|
690
|
+
images?: string[];
|
|
691
|
+
is_verified_purchase: boolean;
|
|
692
|
+
is_featured: boolean;
|
|
693
|
+
helpful_count: number;
|
|
694
|
+
author?: ProductReviewAuthor;
|
|
695
|
+
admin_reply?: string;
|
|
696
|
+
admin_replied_at?: string;
|
|
697
|
+
product?: {
|
|
698
|
+
id: number;
|
|
699
|
+
name: string;
|
|
700
|
+
slug: string;
|
|
701
|
+
thumbnail?: string;
|
|
702
|
+
};
|
|
703
|
+
created_at: string;
|
|
704
|
+
updated_at: string;
|
|
705
|
+
}
|
|
706
|
+
interface ProductReviewStats {
|
|
707
|
+
average_rating: number;
|
|
708
|
+
total_count: number;
|
|
709
|
+
rating_counts: {
|
|
710
|
+
5: number;
|
|
711
|
+
4: number;
|
|
712
|
+
3: number;
|
|
713
|
+
2: number;
|
|
714
|
+
1: number;
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
interface ProductReviewListParams extends ListParams {
|
|
718
|
+
rating?: number;
|
|
719
|
+
sort?: 'newest' | 'oldest' | 'highest' | 'lowest' | 'helpful';
|
|
720
|
+
}
|
|
721
|
+
interface CreateProductReviewData {
|
|
722
|
+
rating: number;
|
|
723
|
+
title?: string;
|
|
724
|
+
content: string;
|
|
725
|
+
images?: string[];
|
|
726
|
+
}
|
|
727
|
+
interface UpdateProductReviewData {
|
|
728
|
+
rating?: number;
|
|
729
|
+
title?: string;
|
|
730
|
+
content?: string;
|
|
731
|
+
images?: string[];
|
|
732
|
+
}
|
|
733
|
+
interface CanReviewResponse {
|
|
734
|
+
can_review: boolean;
|
|
735
|
+
reason?: 'not_logged_in' | 'already_reviewed' | 'not_purchased';
|
|
736
|
+
}
|
|
607
737
|
|
|
608
738
|
/**
|
|
609
739
|
* Custom Entity types for Promptly SDK
|
|
@@ -1218,18 +1348,46 @@ declare class ShopResource {
|
|
|
1218
1348
|
*/
|
|
1219
1349
|
getPayment(orderId: number): Promise<Payment>;
|
|
1220
1350
|
/**
|
|
1221
|
-
*
|
|
1351
|
+
* Get payment status (available payment methods)
|
|
1352
|
+
*/
|
|
1353
|
+
getPaymentStatus(): Promise<PaymentStatusResponse>;
|
|
1354
|
+
/**
|
|
1355
|
+
* Prepare Toss payment (get client key and payment info)
|
|
1356
|
+
*/
|
|
1357
|
+
tossPaymentReady(data: TossPaymentReadyData): Promise<TossPaymentReadyResponse>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Confirm Toss payment (after redirect)
|
|
1360
|
+
*/
|
|
1361
|
+
tossPaymentConfirm(data: TossPaymentConfirmData): Promise<TossPaymentConfirmResponse>;
|
|
1362
|
+
/**
|
|
1363
|
+
* Cancel Toss payment
|
|
1364
|
+
*/
|
|
1365
|
+
tossPaymentCancel(orderNumber: string, cancelReason: string, cancelAmount?: number): Promise<void>;
|
|
1366
|
+
/**
|
|
1367
|
+
* Create Stripe Checkout Session
|
|
1368
|
+
*/
|
|
1369
|
+
stripeCheckout(data: StripeCheckoutData): Promise<StripeCheckoutResponse>;
|
|
1370
|
+
/**
|
|
1371
|
+
* Verify Stripe payment (after redirect)
|
|
1372
|
+
*/
|
|
1373
|
+
stripeVerify(data: StripeVerifyData): Promise<StripeVerifyResponse>;
|
|
1374
|
+
/**
|
|
1375
|
+
* Refund Stripe payment
|
|
1376
|
+
*/
|
|
1377
|
+
stripeRefund(orderNumber: string, reason?: string, amount?: number): Promise<void>;
|
|
1378
|
+
/**
|
|
1379
|
+
* @deprecated Use tossPaymentReady instead
|
|
1222
1380
|
*/
|
|
1223
1381
|
preparePayment(data: PaymentReadyData): Promise<{
|
|
1224
1382
|
paymentKey: string;
|
|
1225
1383
|
orderId: string;
|
|
1226
1384
|
}>;
|
|
1227
1385
|
/**
|
|
1228
|
-
*
|
|
1386
|
+
* @deprecated Use tossPaymentConfirm instead
|
|
1229
1387
|
*/
|
|
1230
1388
|
confirmPayment(data: PaymentConfirmData): Promise<Payment>;
|
|
1231
1389
|
/**
|
|
1232
|
-
*
|
|
1390
|
+
* @deprecated Use tossPaymentCancel instead
|
|
1233
1391
|
*/
|
|
1234
1392
|
cancelPayment(paymentId: number, data: PaymentCancelData): Promise<Payment>;
|
|
1235
1393
|
/**
|
|
@@ -1241,6 +1399,48 @@ declare class ShopResource {
|
|
|
1241
1399
|
* @returns Array of coupons (always an array)
|
|
1242
1400
|
*/
|
|
1243
1401
|
myCoupons(): Promise<Coupon[]>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Get reviews for a product
|
|
1404
|
+
* @param productSlug - Product slug
|
|
1405
|
+
* @param params - Optional list params (rating, sort, per_page)
|
|
1406
|
+
* @returns Reviews with stats
|
|
1407
|
+
*/
|
|
1408
|
+
getProductReviews(productSlug: string, params?: ProductReviewListParams): Promise<{
|
|
1409
|
+
data: ProductReview[];
|
|
1410
|
+
meta: any;
|
|
1411
|
+
stats: ProductReviewStats;
|
|
1412
|
+
}>;
|
|
1413
|
+
/**
|
|
1414
|
+
* Check if current user can review a product
|
|
1415
|
+
* Requires: logged in + purchased the product + not already reviewed
|
|
1416
|
+
*/
|
|
1417
|
+
canReviewProduct(productSlug: string): Promise<CanReviewResponse>;
|
|
1418
|
+
/**
|
|
1419
|
+
* Create a product review (requires purchase)
|
|
1420
|
+
*/
|
|
1421
|
+
createReview(productSlug: string, data: CreateProductReviewData): Promise<ProductReview>;
|
|
1422
|
+
/**
|
|
1423
|
+
* Update your own review
|
|
1424
|
+
*/
|
|
1425
|
+
updateReview(reviewId: number, data: UpdateProductReviewData): Promise<ProductReview>;
|
|
1426
|
+
/**
|
|
1427
|
+
* Delete your own review
|
|
1428
|
+
*/
|
|
1429
|
+
deleteReview(reviewId: number): Promise<void>;
|
|
1430
|
+
/**
|
|
1431
|
+
* Mark a review as helpful
|
|
1432
|
+
*/
|
|
1433
|
+
markReviewHelpful(reviewId: number): Promise<{
|
|
1434
|
+
helpful_count: number;
|
|
1435
|
+
}>;
|
|
1436
|
+
/**
|
|
1437
|
+
* Get my reviews
|
|
1438
|
+
* @returns Array of reviews written by the current user
|
|
1439
|
+
*/
|
|
1440
|
+
myReviews(params?: {
|
|
1441
|
+
per_page?: number;
|
|
1442
|
+
page?: number;
|
|
1443
|
+
}): Promise<ListResponse<ProductReview>>;
|
|
1244
1444
|
}
|
|
1245
1445
|
|
|
1246
1446
|
/**
|
|
@@ -1625,4 +1825,4 @@ declare class Promptly {
|
|
|
1625
1825
|
getApiKey(): string | null;
|
|
1626
1826
|
}
|
|
1627
1827
|
|
|
1628
|
-
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 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 };
|
|
1828
|
+
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
|
@@ -477,6 +477,21 @@ interface OrderItem {
|
|
|
477
477
|
total: number;
|
|
478
478
|
options?: Record<string, string>;
|
|
479
479
|
}
|
|
480
|
+
interface OrderShipping {
|
|
481
|
+
name: string;
|
|
482
|
+
phone: string;
|
|
483
|
+
zipcode?: string;
|
|
484
|
+
address: string;
|
|
485
|
+
address_detail?: string;
|
|
486
|
+
memo?: string;
|
|
487
|
+
company?: string;
|
|
488
|
+
tracking_number?: string;
|
|
489
|
+
}
|
|
490
|
+
interface OrderOrderer {
|
|
491
|
+
name: string;
|
|
492
|
+
email: string;
|
|
493
|
+
phone: string;
|
|
494
|
+
}
|
|
480
495
|
interface Order {
|
|
481
496
|
id: number;
|
|
482
497
|
member_id?: number;
|
|
@@ -493,23 +508,15 @@ interface Order {
|
|
|
493
508
|
payment_status: PaymentStatus;
|
|
494
509
|
payment_status_label?: string;
|
|
495
510
|
paid_at?: string;
|
|
496
|
-
shipping_name: string;
|
|
497
|
-
shipping_phone: string;
|
|
498
|
-
shipping_zipcode: string;
|
|
499
|
-
shipping_address: string;
|
|
500
|
-
shipping_address_detail?: string;
|
|
501
|
-
shipping_memo?: string;
|
|
502
|
-
shipping_company?: string;
|
|
503
|
-
tracking_number?: string;
|
|
504
511
|
shipped_at?: string;
|
|
505
512
|
delivered_at?: string;
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
513
|
+
can_cancel?: boolean;
|
|
514
|
+
shipping?: OrderShipping;
|
|
515
|
+
orderer?: OrderOrderer;
|
|
509
516
|
items?: OrderItem[];
|
|
510
517
|
payment?: Payment;
|
|
511
518
|
created_at: string;
|
|
512
|
-
updated_at
|
|
519
|
+
updated_at?: string;
|
|
513
520
|
}
|
|
514
521
|
interface CreateOrderData {
|
|
515
522
|
orderer_name: string;
|
|
@@ -576,6 +583,73 @@ interface PaymentCancelData {
|
|
|
576
583
|
cancel_reason: string;
|
|
577
584
|
cancel_amount?: number;
|
|
578
585
|
}
|
|
586
|
+
interface TossPaymentReadyData {
|
|
587
|
+
order_number: string;
|
|
588
|
+
success_url: string;
|
|
589
|
+
fail_url: string;
|
|
590
|
+
}
|
|
591
|
+
interface TossPaymentReadyResponse {
|
|
592
|
+
success: boolean;
|
|
593
|
+
payment_id: number;
|
|
594
|
+
order_id: string;
|
|
595
|
+
order_name: string;
|
|
596
|
+
amount: number;
|
|
597
|
+
customer_name: string;
|
|
598
|
+
customer_email: string;
|
|
599
|
+
success_url: string;
|
|
600
|
+
fail_url: string;
|
|
601
|
+
client_key: string;
|
|
602
|
+
}
|
|
603
|
+
interface TossPaymentConfirmData {
|
|
604
|
+
payment_key: string;
|
|
605
|
+
order_id: string;
|
|
606
|
+
amount: number;
|
|
607
|
+
}
|
|
608
|
+
interface TossPaymentConfirmResponse {
|
|
609
|
+
order_number: string;
|
|
610
|
+
status: string;
|
|
611
|
+
status_label: string;
|
|
612
|
+
payment_status: string;
|
|
613
|
+
payment?: {
|
|
614
|
+
method: string;
|
|
615
|
+
method_label: string;
|
|
616
|
+
method_detail?: string;
|
|
617
|
+
receipt_url?: string;
|
|
618
|
+
approved_at?: string;
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
interface StripeCheckoutData {
|
|
622
|
+
order_number: string;
|
|
623
|
+
success_url: string;
|
|
624
|
+
cancel_url: string;
|
|
625
|
+
}
|
|
626
|
+
interface StripeCheckoutResponse {
|
|
627
|
+
success: boolean;
|
|
628
|
+
session_id: string;
|
|
629
|
+
checkout_url: string;
|
|
630
|
+
}
|
|
631
|
+
interface StripeVerifyData {
|
|
632
|
+
session_id: string;
|
|
633
|
+
}
|
|
634
|
+
interface StripeVerifyResponse {
|
|
635
|
+
order_number: string;
|
|
636
|
+
status: string;
|
|
637
|
+
status_label: string;
|
|
638
|
+
payment_status: string;
|
|
639
|
+
payment?: {
|
|
640
|
+
method: string;
|
|
641
|
+
approved_at?: string;
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
interface PaymentStatusResponse {
|
|
645
|
+
toss: {
|
|
646
|
+
available: boolean;
|
|
647
|
+
};
|
|
648
|
+
stripe: {
|
|
649
|
+
available: boolean;
|
|
650
|
+
publishable_key?: string;
|
|
651
|
+
};
|
|
652
|
+
}
|
|
579
653
|
type CouponType = 'fixed' | 'percent';
|
|
580
654
|
interface Coupon {
|
|
581
655
|
id: number;
|
|
@@ -604,6 +678,62 @@ interface CouponValidation {
|
|
|
604
678
|
discount_amount?: number;
|
|
605
679
|
coupon?: Coupon;
|
|
606
680
|
}
|
|
681
|
+
interface ProductReviewAuthor {
|
|
682
|
+
id: number;
|
|
683
|
+
name: string;
|
|
684
|
+
}
|
|
685
|
+
interface ProductReview {
|
|
686
|
+
id: number;
|
|
687
|
+
rating: number;
|
|
688
|
+
title?: string;
|
|
689
|
+
content: string;
|
|
690
|
+
images?: string[];
|
|
691
|
+
is_verified_purchase: boolean;
|
|
692
|
+
is_featured: boolean;
|
|
693
|
+
helpful_count: number;
|
|
694
|
+
author?: ProductReviewAuthor;
|
|
695
|
+
admin_reply?: string;
|
|
696
|
+
admin_replied_at?: string;
|
|
697
|
+
product?: {
|
|
698
|
+
id: number;
|
|
699
|
+
name: string;
|
|
700
|
+
slug: string;
|
|
701
|
+
thumbnail?: string;
|
|
702
|
+
};
|
|
703
|
+
created_at: string;
|
|
704
|
+
updated_at: string;
|
|
705
|
+
}
|
|
706
|
+
interface ProductReviewStats {
|
|
707
|
+
average_rating: number;
|
|
708
|
+
total_count: number;
|
|
709
|
+
rating_counts: {
|
|
710
|
+
5: number;
|
|
711
|
+
4: number;
|
|
712
|
+
3: number;
|
|
713
|
+
2: number;
|
|
714
|
+
1: number;
|
|
715
|
+
};
|
|
716
|
+
}
|
|
717
|
+
interface ProductReviewListParams extends ListParams {
|
|
718
|
+
rating?: number;
|
|
719
|
+
sort?: 'newest' | 'oldest' | 'highest' | 'lowest' | 'helpful';
|
|
720
|
+
}
|
|
721
|
+
interface CreateProductReviewData {
|
|
722
|
+
rating: number;
|
|
723
|
+
title?: string;
|
|
724
|
+
content: string;
|
|
725
|
+
images?: string[];
|
|
726
|
+
}
|
|
727
|
+
interface UpdateProductReviewData {
|
|
728
|
+
rating?: number;
|
|
729
|
+
title?: string;
|
|
730
|
+
content?: string;
|
|
731
|
+
images?: string[];
|
|
732
|
+
}
|
|
733
|
+
interface CanReviewResponse {
|
|
734
|
+
can_review: boolean;
|
|
735
|
+
reason?: 'not_logged_in' | 'already_reviewed' | 'not_purchased';
|
|
736
|
+
}
|
|
607
737
|
|
|
608
738
|
/**
|
|
609
739
|
* Custom Entity types for Promptly SDK
|
|
@@ -1218,18 +1348,46 @@ declare class ShopResource {
|
|
|
1218
1348
|
*/
|
|
1219
1349
|
getPayment(orderId: number): Promise<Payment>;
|
|
1220
1350
|
/**
|
|
1221
|
-
*
|
|
1351
|
+
* Get payment status (available payment methods)
|
|
1352
|
+
*/
|
|
1353
|
+
getPaymentStatus(): Promise<PaymentStatusResponse>;
|
|
1354
|
+
/**
|
|
1355
|
+
* Prepare Toss payment (get client key and payment info)
|
|
1356
|
+
*/
|
|
1357
|
+
tossPaymentReady(data: TossPaymentReadyData): Promise<TossPaymentReadyResponse>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Confirm Toss payment (after redirect)
|
|
1360
|
+
*/
|
|
1361
|
+
tossPaymentConfirm(data: TossPaymentConfirmData): Promise<TossPaymentConfirmResponse>;
|
|
1362
|
+
/**
|
|
1363
|
+
* Cancel Toss payment
|
|
1364
|
+
*/
|
|
1365
|
+
tossPaymentCancel(orderNumber: string, cancelReason: string, cancelAmount?: number): Promise<void>;
|
|
1366
|
+
/**
|
|
1367
|
+
* Create Stripe Checkout Session
|
|
1368
|
+
*/
|
|
1369
|
+
stripeCheckout(data: StripeCheckoutData): Promise<StripeCheckoutResponse>;
|
|
1370
|
+
/**
|
|
1371
|
+
* Verify Stripe payment (after redirect)
|
|
1372
|
+
*/
|
|
1373
|
+
stripeVerify(data: StripeVerifyData): Promise<StripeVerifyResponse>;
|
|
1374
|
+
/**
|
|
1375
|
+
* Refund Stripe payment
|
|
1376
|
+
*/
|
|
1377
|
+
stripeRefund(orderNumber: string, reason?: string, amount?: number): Promise<void>;
|
|
1378
|
+
/**
|
|
1379
|
+
* @deprecated Use tossPaymentReady instead
|
|
1222
1380
|
*/
|
|
1223
1381
|
preparePayment(data: PaymentReadyData): Promise<{
|
|
1224
1382
|
paymentKey: string;
|
|
1225
1383
|
orderId: string;
|
|
1226
1384
|
}>;
|
|
1227
1385
|
/**
|
|
1228
|
-
*
|
|
1386
|
+
* @deprecated Use tossPaymentConfirm instead
|
|
1229
1387
|
*/
|
|
1230
1388
|
confirmPayment(data: PaymentConfirmData): Promise<Payment>;
|
|
1231
1389
|
/**
|
|
1232
|
-
*
|
|
1390
|
+
* @deprecated Use tossPaymentCancel instead
|
|
1233
1391
|
*/
|
|
1234
1392
|
cancelPayment(paymentId: number, data: PaymentCancelData): Promise<Payment>;
|
|
1235
1393
|
/**
|
|
@@ -1241,6 +1399,48 @@ declare class ShopResource {
|
|
|
1241
1399
|
* @returns Array of coupons (always an array)
|
|
1242
1400
|
*/
|
|
1243
1401
|
myCoupons(): Promise<Coupon[]>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Get reviews for a product
|
|
1404
|
+
* @param productSlug - Product slug
|
|
1405
|
+
* @param params - Optional list params (rating, sort, per_page)
|
|
1406
|
+
* @returns Reviews with stats
|
|
1407
|
+
*/
|
|
1408
|
+
getProductReviews(productSlug: string, params?: ProductReviewListParams): Promise<{
|
|
1409
|
+
data: ProductReview[];
|
|
1410
|
+
meta: any;
|
|
1411
|
+
stats: ProductReviewStats;
|
|
1412
|
+
}>;
|
|
1413
|
+
/**
|
|
1414
|
+
* Check if current user can review a product
|
|
1415
|
+
* Requires: logged in + purchased the product + not already reviewed
|
|
1416
|
+
*/
|
|
1417
|
+
canReviewProduct(productSlug: string): Promise<CanReviewResponse>;
|
|
1418
|
+
/**
|
|
1419
|
+
* Create a product review (requires purchase)
|
|
1420
|
+
*/
|
|
1421
|
+
createReview(productSlug: string, data: CreateProductReviewData): Promise<ProductReview>;
|
|
1422
|
+
/**
|
|
1423
|
+
* Update your own review
|
|
1424
|
+
*/
|
|
1425
|
+
updateReview(reviewId: number, data: UpdateProductReviewData): Promise<ProductReview>;
|
|
1426
|
+
/**
|
|
1427
|
+
* Delete your own review
|
|
1428
|
+
*/
|
|
1429
|
+
deleteReview(reviewId: number): Promise<void>;
|
|
1430
|
+
/**
|
|
1431
|
+
* Mark a review as helpful
|
|
1432
|
+
*/
|
|
1433
|
+
markReviewHelpful(reviewId: number): Promise<{
|
|
1434
|
+
helpful_count: number;
|
|
1435
|
+
}>;
|
|
1436
|
+
/**
|
|
1437
|
+
* Get my reviews
|
|
1438
|
+
* @returns Array of reviews written by the current user
|
|
1439
|
+
*/
|
|
1440
|
+
myReviews(params?: {
|
|
1441
|
+
per_page?: number;
|
|
1442
|
+
page?: number;
|
|
1443
|
+
}): Promise<ListResponse<ProductReview>>;
|
|
1244
1444
|
}
|
|
1245
1445
|
|
|
1246
1446
|
/**
|
|
@@ -1625,4 +1825,4 @@ declare class Promptly {
|
|
|
1625
1825
|
getApiKey(): string | null;
|
|
1626
1826
|
}
|
|
1627
1827
|
|
|
1628
|
-
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 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 };
|
|
1828
|
+
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
|