@sellosh/commerce 0.2.0 → 0.3.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/client.d.ts +3 -1
- package/dist/client.js +1 -0
- package/dist/types.d.ts +6 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AuthProviders, AuthResult, AuthUser, CartItemInput, ConfirmTossInput, ConfirmTossResult, CouponPreview, MetaConfig, Order, OrderWithItems, PaymentConfig, ProductDetailResult, ProductListResult, ProfileInput, ReviewListParams, ReviewListResult } from "./types";
|
|
1
|
+
import type { AuthProviders, AuthResult, AuthUser, CartItemInput, ConfirmTossInput, ConfirmTossResult, CouponPreview, MetaConfig, Order, OrderWithItems, PaymentConfig, ShippingConfig, ProductDetailResult, ProductListResult, ProfileInput, ReviewListParams, ReviewListResult } from "./types";
|
|
2
2
|
export interface SelloClientConfig {
|
|
3
3
|
/** API 베이스 URL. "" = 동일 출처(프록시/리라이트). 예: "https://www.sello.sh" */
|
|
4
4
|
apiBase?: string;
|
|
@@ -24,6 +24,8 @@ export interface SelloClient {
|
|
|
24
24
|
listProducts(slug?: string): Promise<ProductListResult>;
|
|
25
25
|
getProduct(id: number, slug?: string): Promise<ProductDetailResult>;
|
|
26
26
|
getPaymentConfig(slug?: string): Promise<PaymentConfig>;
|
|
27
|
+
/** 배송 설정 조회 (배송비 + 무료배송 기준). 최종 결제액은 서버가 재검증. */
|
|
28
|
+
getShippingConfig(slug?: string): Promise<ShippingConfig>;
|
|
27
29
|
confirmTossPayment(input: ConfirmTossInput): Promise<ConfirmTossResult>;
|
|
28
30
|
listOrders(): Promise<{
|
|
29
31
|
orders: Order[];
|
package/dist/client.js
CHANGED
|
@@ -34,6 +34,7 @@ export function createSelloClient(config = {}) {
|
|
|
34
34
|
listProducts: (slug) => req(`/api/frontend/products?business=${q(requireSlug(slug))}`),
|
|
35
35
|
getProduct: (id, slug) => req(`/api/frontend/products/${id}?business=${q(requireSlug(slug))}`),
|
|
36
36
|
getPaymentConfig: (slug) => req(`/api/frontend/payments/config?business=${q(requireSlug(slug))}`),
|
|
37
|
+
getShippingConfig: (slug) => req(`/api/frontend/shipping/config?business=${q(requireSlug(slug))}`),
|
|
37
38
|
confirmTossPayment: (input) => req(`/api/frontend/payments/toss/confirm`, { method: "POST", body: JSON.stringify(input) }, true),
|
|
38
39
|
listOrders: () => req(`/api/frontend/orders`, {}, true),
|
|
39
40
|
getOrder: (id, opts) => req(`/api/frontend/orders/${id}${opts?.guestToken ? `?guestToken=${q(opts.guestToken)}` : ""}`, {}, true),
|
package/dist/types.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ export interface Order {
|
|
|
63
63
|
total: number;
|
|
64
64
|
discount_amount?: number;
|
|
65
65
|
coupon_code?: string | null;
|
|
66
|
+
shipping_fee?: number;
|
|
66
67
|
customer_name?: string;
|
|
67
68
|
phone?: string;
|
|
68
69
|
address?: string;
|
|
@@ -107,6 +108,11 @@ export interface PaymentConfig {
|
|
|
107
108
|
provider: string;
|
|
108
109
|
tossClientKey: string;
|
|
109
110
|
}
|
|
111
|
+
/** 공개 배송 설정 — 스토어가 결제 전 배송비를 표시·합산. 최종액은 서버가 재검증. */
|
|
112
|
+
export interface ShippingConfig {
|
|
113
|
+
shippingFee: number;
|
|
114
|
+
freeShippingThreshold: number | null;
|
|
115
|
+
}
|
|
110
116
|
/** 토스 결제 승인 입력 — 서버가 buildOrder 로 가격·재고 재검증 후 (할인 적용)finalTotal === amount 확인. */
|
|
111
117
|
export interface ConfirmTossInput {
|
|
112
118
|
paymentKey: string;
|