@sayren/storefront-sdk 0.17.0 → 0.18.1
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/analytics/index.d.mts +1 -1
- package/dist/auth/index.d.mts +2 -2
- package/dist/auth/index.mjs +2 -2
- package/dist/{checkout-C25liqdW.mjs → checkout-PJk8g5DY.mjs} +6 -6
- package/dist/{client-CBAgQuTc.mjs → client-C91Y801B.mjs} +26 -14
- package/dist/{index-BsHuMzBD.d.mts → index-DJYqxHSY.d.mts} +25 -13
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/payments/index.d.mts +2 -2
- package/dist/payments/index.mjs +1 -1
- package/package.json +1 -1
- package/src/analytics/index.ts +1 -1
- package/src/auth/index.ts +2 -2
- package/src/client.ts +6 -6
- package/src/payments/index.ts +1 -1
- package/src/schemas/checkout.ts +5 -5
- package/src/schemas/claim.ts +2 -2
- package/src/schemas/consent.ts +3 -3
- package/src/schemas/member.ts +1 -1
- package/src/schemas/product-options.ts +1 -1
- package/src/schemas/store.ts +33 -1
- package/src/session.ts +1 -1
|
@@ -14,7 +14,7 @@ export type AnalyticsConsent = "granted" | "denied" | "pending";
|
|
|
14
14
|
export interface AnalyticsOptions {
|
|
15
15
|
/** 스토어프론트 API 베이스 — 예: `https://api.sayren.app/storefront/v1` */
|
|
16
16
|
baseUrl: string;
|
|
17
|
-
/** 테넌트
|
|
17
|
+
/** 테넌트 상점 코드 */
|
|
18
18
|
storeCode: string;
|
|
19
19
|
/** 동의 상태. 기본 `pending` — 셀러의 동의 배너가 `setConsent`로 바꾼다 */
|
|
20
20
|
consent?: AnalyticsConsent;
|
package/dist/auth/index.d.mts
CHANGED
|
@@ -26,7 +26,7 @@ export declare class IdpCallbackError extends Error {
|
|
|
26
26
|
export interface StorefrontAuthOptions {
|
|
27
27
|
/** 예: https://api.sayren.app/storefront/v1 */
|
|
28
28
|
baseUrl: string;
|
|
29
|
-
/** 테넌트
|
|
29
|
+
/** 테넌트 상점 코드 — `X-Store-Code` 헤더로 보낸다 */
|
|
30
30
|
storeCode: string;
|
|
31
31
|
fetch?: typeof globalThis.fetch;
|
|
32
32
|
}
|
|
@@ -104,7 +104,7 @@ export declare function createStorefrontAuth(options: StorefrontAuthOptions): {
|
|
|
104
104
|
signOut(accessToken: string): Promise<void>;
|
|
105
105
|
/**
|
|
106
106
|
* 구매자 탈퇴 — 계정·배송지·위시리스트·장바구니·적립금을 지우고 토큰을 모두 무효로 만든다. 되돌릴 수 없다.
|
|
107
|
-
* 주문·리뷰·문의 기록은
|
|
107
|
+
* 주문·리뷰·문의 기록은 상점이 보관한다. 진행 중인 주문이나 처리 중인 클레임이 있으면
|
|
108
108
|
* 409 `WITHDRAWAL_BLOCKED`(`error.details`: `WithdrawalBlockedDetails`)다. 앱은 성공 후 보관한 토큰을 지운다.
|
|
109
109
|
*/
|
|
110
110
|
withdraw(accessToken: string, body: WithdrawRequest): Promise<void>;
|
package/dist/auth/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { pt as ApiError, t as createStorefrontClient } from "../client-
|
|
1
|
+
import { pt as ApiError, t as createStorefrontClient } from "../client-C91Y801B.mjs";
|
|
2
2
|
//#region src/auth/index.ts
|
|
3
3
|
/** 소셜 로그인 실패 — 구매자가 취소했거나(`access_denied`) state가 맞지 않는다 */
|
|
4
4
|
var IdpCallbackError = class extends Error {
|
|
@@ -156,7 +156,7 @@ function createStorefrontAuth(options) {
|
|
|
156
156
|
},
|
|
157
157
|
/**
|
|
158
158
|
* 구매자 탈퇴 — 계정·배송지·위시리스트·장바구니·적립금을 지우고 토큰을 모두 무효로 만든다. 되돌릴 수 없다.
|
|
159
|
-
* 주문·리뷰·문의 기록은
|
|
159
|
+
* 주문·리뷰·문의 기록은 상점이 보관한다. 진행 중인 주문이나 처리 중인 클레임이 있으면
|
|
160
160
|
* 409 `WITHDRAWAL_BLOCKED`(`error.details`: `WithdrawalBlockedDetails`)다. 앱은 성공 후 보관한 토큰을 지운다.
|
|
161
161
|
*/
|
|
162
162
|
withdraw(accessToken, body) {
|
|
@@ -95,7 +95,7 @@ function normalizeCustomInputValue(value) {
|
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* 직접 입력값의 글자 수 — 정규화한 값의 **코드 포인트 수**다(이모지 하나가 1자). 서버의 최대 글자 수 판정(`CUSTOM_INPUT_TOO_LONG`)과
|
|
98
|
-
*
|
|
98
|
+
* 스토어프론트·상점 플랫폼의 글자 수 표시가 이 함수 하나를 쓴다. `String.length`(UTF-16)로 세면 이모지가 2자로 세어 판정이 갈린다.
|
|
99
99
|
*/
|
|
100
100
|
function customInputLength(value) {
|
|
101
101
|
return [...normalizeCustomInputValue(value)].length;
|
|
@@ -264,7 +264,7 @@ const checkoutDeliverySchema = z.object({
|
|
|
264
264
|
remoteArea: remoteAreaSchema.describe("배송지 지역 구분. 배송지를 모르면 NONE"),
|
|
265
265
|
remoteAreaLabel: z.string().nullable().describe("지역 안내 이름(예: 제주특별자치도). 추가 배송비 지역이 아니면 null"),
|
|
266
266
|
bundleCount: z.number().int().describe("배송 묶음 수 — 배송비를 부과한 횟수다"),
|
|
267
|
-
freeByThreshold: z.boolean().describe("
|
|
267
|
+
freeByThreshold: z.boolean().describe("상점 전체 무료배송 기준액을 넘겨 기본 배송비를 면제했는가"),
|
|
268
268
|
zipCode: z.string().nullable().describe("이 금액에 반영한 배송지 우편번호. null이면 배송지 미반영(추가 배송비 0)이다")
|
|
269
269
|
});
|
|
270
270
|
const checkoutSessionSchema = z.object({
|
|
@@ -297,7 +297,7 @@ const checkoutSessionSchema = z.object({
|
|
|
297
297
|
}).optional().describe("**Deprecated** — 항상 `{ required: false, notice: null }`이다. 청약철회 제한 고지를 없앴고(이슈 #48) storefront-sdk 0.15 이하 호환으로만 싣는다. 게시된 스토어프론트가 0.16 이상으로 넘어간 뒤 다음 릴리스에서 뺀다"),
|
|
298
298
|
expiresAt: z.string(),
|
|
299
299
|
paymentOptions: z.lazy(() => paymentOptionListSchema).describe("이 주문서에서 고를 수 있는 결제 옵션, PG 우선순위순. 셀러가 켠 PG·결제수단·간편결제만 담긴다. 비어 있으면 지금 결제할 수 없다"),
|
|
300
|
-
testPayment: z.boolean().describe("지금 결제하면 테스트 결제(샌드박스)인가. true면 실제로 돈이 나가지 않습니다 — 주문서에 테스트 결제 안내를 표시합니다. 결제 요청 시점에
|
|
300
|
+
testPayment: z.boolean().describe("지금 결제하면 테스트 결제(샌드박스)인가. true면 실제로 돈이 나가지 않습니다 — 주문서에 테스트 결제 안내를 표시합니다. 결제 요청 시점에 상점 결제 설정으로 다시 정해지니 최종 값은 결제 요청 응답의 `testPayment`입니다")
|
|
301
301
|
});
|
|
302
302
|
/**
|
|
303
303
|
* 배송비 미리보기 요청 — 배송지 우편번호로 배송비를 다시 계산한다. 주문서를 바꾸지 않는다(읽기 계산이다).
|
|
@@ -317,7 +317,7 @@ const paymentMethodSchema = z.enum([
|
|
|
317
317
|
"MOBILE",
|
|
318
318
|
"EASY_PAY"
|
|
319
319
|
]);
|
|
320
|
-
/** 결제를 처리하는 PG. 셀러가 직접 계약하고
|
|
320
|
+
/** 결제를 처리하는 PG. 셀러가 직접 계약하고 상점 플랫폼 설정 › 결제에서 연결한다 */
|
|
321
321
|
const pgProviderSchema = z.enum(["tosspayments", "portone"]);
|
|
322
322
|
/** 간편결제사. 토스페이먼츠·포트원 모두 같은 코드를 쓴다 */
|
|
323
323
|
const easyPayProviderSchema = z.enum([
|
|
@@ -471,11 +471,11 @@ const cashReceiptField = cashReceiptRequestSchema.optional().describe("현금영
|
|
|
471
471
|
/**
|
|
472
472
|
* 결제 시작 — 배송지를 확정하고 고른 결제 옵션으로 결제 시도를 연다. 응답의 `payUrl`(결제 서비스)을 팝업(`mode=popup`)이나
|
|
473
473
|
* 전체 페이지로 열면 결제 서비스가 PG 결제창을 띄우고 승인까지 한다. 리다이렉트 결제가 끝나면 구매자는 `returnUrl`로 돌아온다.
|
|
474
|
-
* `returnUrl`의 도메인은
|
|
474
|
+
* `returnUrl`의 도메인은 상점 결제 도메인(상점 플랫폼 설정 › 결제)에 등록돼 있어야 한다(테스트 결제는 localhost 허용).
|
|
475
475
|
*/
|
|
476
476
|
const startPaymentRequestSchema = z.object({
|
|
477
477
|
option: paymentOptionSchema,
|
|
478
|
-
returnUrl: z.url().max(2048).describe("결제를 마치면 돌아올 스토어프론트 주소.
|
|
478
|
+
returnUrl: z.url().max(2048).describe("결제를 마치면 돌아올 스토어프론트 주소. 상점 결제 도메인에 등록된 도메인이어야 한다"),
|
|
479
479
|
shippingAddress: shippingAddressInputSchema.optional().describe("배송지. 주문서의 `requiresShipping`이 true면 필수이고 없으면 400 `SHIPPING_ADDRESS_REQUIRED`다. 배송이 필요 없는 주문(배송 없는 상품만)은 보내지 않아도 된다. 보내면 형식을 검사한 뒤 버린다"),
|
|
480
480
|
guest: guestInfoSchema.optional(),
|
|
481
481
|
cashReceipt: cashReceiptField,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as ANALYTICS_VISITOR_HEADER, r as ANALYTICS_SESSION_HEADER } from "./analytics-CgD70OqH.mjs";
|
|
2
|
-
import { $ as lineFulfillmentSchema, A as startPaymentRequestSchema, C as paymentStartSchema, F as checkoutPricingSchema, J as customInputViewSchema, N as applicableCouponSchema, O as retryPaymentRequestSchema, P as checkoutPricingRequestSchema, U as addonGroupViewSchema, V as myCouponSchema, X as lineSelectionResponseShape, Y as lineSelectionRequestShape, d as createCheckoutRequestSchema, et as myOrderItemFulfillmentSnapshotSchema, f as deliveryQuoteRequestSchema, m as easyPayProviderResponseSchema, nt as productFulfillmentViewSchema, p as deliveryQuoteSchema, tt as productCardFulfillmentSchema, u as checkoutSessionSchema, w as paymentStatusSchema, y as paymentMethodSchema } from "./checkout-
|
|
2
|
+
import { $ as lineFulfillmentSchema, A as startPaymentRequestSchema, C as paymentStartSchema, F as checkoutPricingSchema, J as customInputViewSchema, N as applicableCouponSchema, O as retryPaymentRequestSchema, P as checkoutPricingRequestSchema, U as addonGroupViewSchema, V as myCouponSchema, X as lineSelectionResponseShape, Y as lineSelectionRequestShape, d as createCheckoutRequestSchema, et as myOrderItemFulfillmentSnapshotSchema, f as deliveryQuoteRequestSchema, m as easyPayProviderResponseSchema, nt as productFulfillmentViewSchema, p as deliveryQuoteSchema, tt as productCardFulfillmentSchema, u as checkoutSessionSchema, w as paymentStatusSchema, y as paymentMethodSchema } from "./checkout-PJk8g5DY.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/http.ts
|
|
5
5
|
/** 표준 엔벨로프의 $.error 상세 */
|
|
@@ -415,10 +415,10 @@ const createClaimResultSchema = z.object({
|
|
|
415
415
|
couponChargeRefundAmount: z.number().int().optional().default(0).describe("되돌릴 쿠폰 차감 예상액 — 앞선 취소·반품에서 뺀 쿠폰 조건 미달 차감 중 이번에 돌려받을 몫이다. 예상 환불액에 이미 반영돼 있다. 서버는 항상 싣는다")
|
|
416
416
|
});
|
|
417
417
|
/**
|
|
418
|
-
* 반품지 (이슈 #30) — 반품·교환 수거가 안내하는 주소다.
|
|
418
|
+
* 반품지 (이슈 #30) — 반품·교환 수거가 안내하는 주소다. 상점 주소록의 기본 반품지이거나,
|
|
419
419
|
* 상품이 반품지를 따로 지정했으면 그 주소다.
|
|
420
420
|
*
|
|
421
|
-
* 취소 클레임은 보낼 물건이 없어 null이고, 반품지를 등록하지 않은
|
|
421
|
+
* 취소 클레임은 보낼 물건이 없어 null이고, 반품지를 등록하지 않은 상점도 null이다.
|
|
422
422
|
* 구매자가 직접 보내는 수거(`BUYER_SEND`)에 이 주소가 필요하다.
|
|
423
423
|
*/
|
|
424
424
|
const claimReturnAddressSchema = z.object({
|
|
@@ -476,11 +476,11 @@ const consentStateSchema = z.object({
|
|
|
476
476
|
agreed: z.boolean(),
|
|
477
477
|
/** 동의한 약관 버전. 마케팅은 버전이 없어 null이고, 동의 이력이 없으면 null이다 */
|
|
478
478
|
agreedVersion: z.string().nullable(),
|
|
479
|
-
/**
|
|
479
|
+
/** 상점의 현재 약관 버전. 마케팅은 null */
|
|
480
480
|
currentVersion: z.string().nullable(),
|
|
481
481
|
/**
|
|
482
|
-
*
|
|
483
|
-
*
|
|
482
|
+
* 상점이 정한 현재 약관 문서 주소. 재동의 화면에서 이 주소를 보여 준다.
|
|
483
|
+
* 상점이 정하지 않았거나 마케팅이면 null이다(동의한 시점의 주소는 셀러가 보는 이력에 남는다).
|
|
484
484
|
*/
|
|
485
485
|
currentDocumentUrl: z.string().nullable(),
|
|
486
486
|
/** 마지막으로 동의·철회한 시각. 이력이 없으면 null */
|
|
@@ -568,7 +568,7 @@ const memberSchema = z.object({
|
|
|
568
568
|
point: z.number().int(),
|
|
569
569
|
marketingAgreed: z.boolean(),
|
|
570
570
|
joinedAt: z.string(),
|
|
571
|
-
reconsentRequired: z.boolean().describe("약관이 개정돼 필수 동의를 다시 받아야 하는가. true면 `GET /me/consents`로 어떤 항목인지 확인하고 `POST /me/consents`로 받는다. 받기 전에도
|
|
571
|
+
reconsentRequired: z.boolean().describe("약관이 개정돼 필수 동의를 다시 받아야 하는가. true면 `GET /me/consents`로 어떤 항목인지 확인하고 `POST /me/consents`로 받는다. 받기 전에도 상점 이용은 막히지 않는다")
|
|
572
572
|
});
|
|
573
573
|
const updateProfileRequestSchema = z.object({
|
|
574
574
|
name: z.string().max(50).optional(),
|
|
@@ -741,7 +741,7 @@ const updateReviewResultSchema = z.object({
|
|
|
741
741
|
//#endregion
|
|
742
742
|
//#region src/schemas/store.ts
|
|
743
743
|
/**
|
|
744
|
-
*
|
|
744
|
+
* 상점 공개 설정 — `GET /store`. 스토어프론트가 화면을 그릴 때 읽는 값만 담는다.
|
|
745
745
|
*/
|
|
746
746
|
const storefrontStoreSchema = z.object({
|
|
747
747
|
storeCode: z.string(),
|
|
@@ -762,7 +762,19 @@ const storefrontStoreSchema = z.object({
|
|
|
762
762
|
"kakao",
|
|
763
763
|
"naver",
|
|
764
764
|
"google"
|
|
765
|
-
]))
|
|
765
|
+
])),
|
|
766
|
+
/**
|
|
767
|
+
* 지금 주문(결제)을 받을 수 있는가(이슈 #70). false면 결제 요청(`POST /checkout/{checkoutId}/payment`)이 409
|
|
768
|
+
* `PAYMENT_NOT_CONFIGURED`다. 장바구니·주문 버튼을 숨기거나 문의 안내로 바꾸면 된다. 장바구니 담기·주문서 생성은 막지 않는다
|
|
769
|
+
*/
|
|
770
|
+
checkoutAvailable: z.boolean().optional().default(true).describe("지금 주문(결제)을 받을 수 있는가. false면 결제 요청이 409 `PAYMENT_NOT_CONFIGURED`이므로 장바구니·주문 버튼을 숨기거나 문의 안내로 바꾸면 된다. 서버는 항상 싣는다"),
|
|
771
|
+
/** 주문을 받을 때의 결제 환경 — `TEST`면 테스트 결제(돈이 오가지 않는다)다. 주문을 받지 않으면 null */
|
|
772
|
+
checkoutMode: z.enum(["LIVE", "TEST"]).nullable().optional().default(null).describe("주문을 받을 때의 결제 환경. `TEST`면 테스트 결제라 돈이 오가지 않는다. 주문을 받지 않으면 null. 서버는 항상 싣는다"),
|
|
773
|
+
/**
|
|
774
|
+
* 주문을 받지 않는 사유 — `PAYMENT_NOT_CONFIGURED`(사용 중인 결제 수단 없음), `PAYMENT_NOT_LIVE`(공개한 쇼핑몰인데 실결제가
|
|
775
|
+
* 아직 열리지 않음). 주문을 받으면 null
|
|
776
|
+
*/
|
|
777
|
+
checkoutUnavailableReason: z.enum(["PAYMENT_NOT_CONFIGURED", "PAYMENT_NOT_LIVE"]).nullable().optional().default(null).describe("주문을 받지 않는 사유. `PAYMENT_NOT_CONFIGURED`는 사용 중인 결제 수단이 없음, `PAYMENT_NOT_LIVE`는 공개한 쇼핑몰인데 실결제가 아직 열리지 않음이다. 주문을 받으면 null. 서버는 항상 싣는다")
|
|
766
778
|
});
|
|
767
779
|
//#endregion
|
|
768
780
|
//#region src/client.ts
|
|
@@ -832,7 +844,7 @@ function createStorefrontClient(options) {
|
|
|
832
844
|
unlinkIdentity: (provider) => http.request("DELETE", path`/me/identities/${provider}`, memberIdentitiesSchema)
|
|
833
845
|
},
|
|
834
846
|
store: {
|
|
835
|
-
/**
|
|
847
|
+
/** 상점 공개 설정 — 이름·고객센터·비회원 주문 허용 여부 */
|
|
836
848
|
get: () => http.request("GET", "/store", storefrontStoreSchema) },
|
|
837
849
|
catalog: {
|
|
838
850
|
listCategories: () => http.request("GET", "/categories", z.array(categoryNodeSchema)),
|
|
@@ -866,10 +878,10 @@ get: () => http.request("GET", "/store", storefrontStoreSchema) },
|
|
|
866
878
|
* `@sayren/storefront-sdk/payments`의 `createPayments().start()`다 — 이 메서드는 값만 받는다.
|
|
867
879
|
*
|
|
868
880
|
* 에러(`ApiError.code`):
|
|
869
|
-
* - 409 `PAYMENT_OPTION_UNAVAILABLE`: 이
|
|
881
|
+
* - 409 `PAYMENT_OPTION_UNAVAILABLE`: 이 상점에서 쓸 수 없는 옵션. `details.paymentOptions`에 지금 목록
|
|
870
882
|
* - 409 `PAYMENT_NOT_CONFIGURED`: 사용 중인 PG가 없다
|
|
871
883
|
* - 400 `RETURN_URL_NOT_ALLOWED`: `returnUrl`이 https가 아니거나(테스트 결제의 localhost는 예외),
|
|
872
|
-
*
|
|
884
|
+
* 상점이 결제 도메인을 등록했는데 그 안이 아니다. 등록하지 않았으면 https 주소는 모두 받는다
|
|
873
885
|
* - 503 `PAYMENT_PROVIDER_UNAVAILABLE`: 고른 PG의 결제창을 준비하지 못했다(다른 옵션으로 다시 시도)
|
|
874
886
|
*/
|
|
875
887
|
startPayment: (checkoutId, body) => http.request("POST", path`/checkout/${checkoutId}/payment`, paymentStartSchema, { body: startPaymentRequestSchema.parse(body) }),
|
|
@@ -889,7 +901,7 @@ get: () => http.request("GET", "/store", storefrontStoreSchema) },
|
|
|
889
901
|
* `expiresAt`까지 폴링한다. `completed`면 `orderId`로 완료 화면, `failed`·`expired`면 실패 안내다.
|
|
890
902
|
* TTL이 지난 `pending`은 `expired`로 보고된다. `testPayment`는 완료면 주문 플래그, 아니면 세션 환경이다.
|
|
891
903
|
*
|
|
892
|
-
* 에러: 404 `PAYMENT_NOT_FOUND`(없음·다른
|
|
904
|
+
* 에러: 404 `PAYMENT_NOT_FOUND`(없음·다른 상점) · 410 `STORE_CLOSED` · 503 `STORE_SUSPENDED`
|
|
893
905
|
*/
|
|
894
906
|
getStatus: (paymentId) => http.request("GET", path`/payments/${paymentId}`, paymentStatusSchema),
|
|
895
907
|
/**
|
|
@@ -906,7 +918,7 @@ get: () => http.request("GET", "/store", storefrontStoreSchema) },
|
|
|
906
918
|
*
|
|
907
919
|
* 에러: 404 `ORDER_NOT_FOUND`(주문이 없거나 연락처·비밀번호가 다름 — 둘을 구분하지 않는다) ·
|
|
908
920
|
* 429 `TOO_MANY_REQUESTS`(주문번호마다 10분에 5번까지 확인하고, 5번째가 틀리면 30분 잠금.
|
|
909
|
-
* 주문번호마다 하루 15번,
|
|
921
|
+
* 주문번호마다 하루 15번, 상점 전체 분당 한도도 있다. 남은 시간은 `ApiError.details.retryAfterSeconds`).
|
|
910
922
|
* 맞게 조회하면 주문번호의 횟수가 초기화된다. 본문 형식은 `guestInfoSchema`의 `phone`·`orderPassword`와 같다.
|
|
911
923
|
* 429는 연락처·비밀번호가 맞아도 난다 — 「잠시 후 다시 시도」로 안내한다.
|
|
912
924
|
*/
|
|
@@ -576,7 +576,7 @@ declare const paymentMethodSchema: z.ZodEnum<{
|
|
|
576
576
|
MOBILE: "MOBILE";
|
|
577
577
|
}>;
|
|
578
578
|
type PaymentMethod = z.infer<typeof paymentMethodSchema>;
|
|
579
|
-
/** 결제를 처리하는 PG. 셀러가 직접 계약하고
|
|
579
|
+
/** 결제를 처리하는 PG. 셀러가 직접 계약하고 상점 플랫폼 설정 › 결제에서 연결한다 */
|
|
580
580
|
declare const pgProviderSchema: z.ZodEnum<{
|
|
581
581
|
tosspayments: "tosspayments";
|
|
582
582
|
portone: "portone";
|
|
@@ -804,7 +804,7 @@ type CashReceiptRequest = z.infer<typeof cashReceiptRequestSchema>;
|
|
|
804
804
|
/**
|
|
805
805
|
* 결제 시작 — 배송지를 확정하고 고른 결제 옵션으로 결제 시도를 연다. 응답의 `payUrl`(결제 서비스)을 팝업(`mode=popup`)이나
|
|
806
806
|
* 전체 페이지로 열면 결제 서비스가 PG 결제창을 띄우고 승인까지 한다. 리다이렉트 결제가 끝나면 구매자는 `returnUrl`로 돌아온다.
|
|
807
|
-
* `returnUrl`의 도메인은
|
|
807
|
+
* `returnUrl`의 도메인은 상점 결제 도메인(상점 플랫폼 설정 › 결제)에 등록돼 있어야 한다(테스트 결제는 localhost 허용).
|
|
808
808
|
*/
|
|
809
809
|
declare const startPaymentRequestSchema: z.ZodObject<{
|
|
810
810
|
option: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -1085,10 +1085,10 @@ declare const createClaimResultSchema: z.ZodObject<{
|
|
|
1085
1085
|
}, z.core.$strip>;
|
|
1086
1086
|
type CreateClaimResult = z.infer<typeof createClaimResultSchema>;
|
|
1087
1087
|
/**
|
|
1088
|
-
* 반품지 (이슈 #30) — 반품·교환 수거가 안내하는 주소다.
|
|
1088
|
+
* 반품지 (이슈 #30) — 반품·교환 수거가 안내하는 주소다. 상점 주소록의 기본 반품지이거나,
|
|
1089
1089
|
* 상품이 반품지를 따로 지정했으면 그 주소다.
|
|
1090
1090
|
*
|
|
1091
|
-
* 취소 클레임은 보낼 물건이 없어 null이고, 반품지를 등록하지 않은
|
|
1091
|
+
* 취소 클레임은 보낼 물건이 없어 null이고, 반품지를 등록하지 않은 상점도 null이다.
|
|
1092
1092
|
* 구매자가 직접 보내는 수거(`BUYER_SEND`)에 이 주소가 필요하다.
|
|
1093
1093
|
*/
|
|
1094
1094
|
declare const claimReturnAddressSchema: z.ZodObject<{
|
|
@@ -1609,7 +1609,7 @@ declare const STOREFRONT_SESSION_KEYS: {
|
|
|
1609
1609
|
interface StorefrontSessionOptions {
|
|
1610
1610
|
/** 예: https://shop.api.example.com/storefront/v1 */
|
|
1611
1611
|
baseUrl: string;
|
|
1612
|
-
/** 테넌트
|
|
1612
|
+
/** 테넌트 상점 코드 — X-Store-Code 헤더로 전송한다 */
|
|
1613
1613
|
storeCode?: string;
|
|
1614
1614
|
/** 저장 매체 어댑터 (앱 소유) */
|
|
1615
1615
|
storage: SessionStorage;
|
|
@@ -1646,7 +1646,7 @@ interface StorefrontClientOptions {
|
|
|
1646
1646
|
/** 예: https://demo.store.example.com/api/v1 */
|
|
1647
1647
|
baseUrl: string;
|
|
1648
1648
|
/**
|
|
1649
|
-
* 테넌트
|
|
1649
|
+
* 테넌트 상점 코드 — `X-Store-Code` 헤더로 전송한다. 공유 API 호스트로 접근할 때
|
|
1650
1650
|
* 서버가 Host 서브도메인을 추측하는 대신 명시적으로 테넌트를 지정한다(멀티테넌트 격리).
|
|
1651
1651
|
* 함수로 전달하면 매 요청마다 재평가.
|
|
1652
1652
|
*/
|
|
@@ -1764,7 +1764,7 @@ declare function createStorefrontClient(options: StorefrontClientOptions): {
|
|
|
1764
1764
|
}>;
|
|
1765
1765
|
};
|
|
1766
1766
|
store: {
|
|
1767
|
-
/**
|
|
1767
|
+
/** 상점 공개 설정 — 이름·고객센터·비회원 주문 허용 여부 */
|
|
1768
1768
|
get: () => Promise<{
|
|
1769
1769
|
storeCode: string;
|
|
1770
1770
|
name: string;
|
|
@@ -1773,6 +1773,9 @@ declare function createStorefrontClient(options: StorefrontClientOptions): {
|
|
|
1773
1773
|
businessHours: string | null;
|
|
1774
1774
|
guestCheckout: boolean;
|
|
1775
1775
|
loginMethods: ("password" | "kakao" | "naver" | "google")[];
|
|
1776
|
+
checkoutAvailable: boolean;
|
|
1777
|
+
checkoutMode: "LIVE" | "TEST" | null;
|
|
1778
|
+
checkoutUnavailableReason: "PAYMENT_NOT_CONFIGURED" | "PAYMENT_NOT_LIVE" | null;
|
|
1776
1779
|
}>;
|
|
1777
1780
|
};
|
|
1778
1781
|
catalog: {
|
|
@@ -2140,10 +2143,10 @@ declare function createStorefrontClient(options: StorefrontClientOptions): {
|
|
|
2140
2143
|
* `@sayren/storefront-sdk/payments`의 `createPayments().start()`다 — 이 메서드는 값만 받는다.
|
|
2141
2144
|
*
|
|
2142
2145
|
* 에러(`ApiError.code`):
|
|
2143
|
-
* - 409 `PAYMENT_OPTION_UNAVAILABLE`: 이
|
|
2146
|
+
* - 409 `PAYMENT_OPTION_UNAVAILABLE`: 이 상점에서 쓸 수 없는 옵션. `details.paymentOptions`에 지금 목록
|
|
2144
2147
|
* - 409 `PAYMENT_NOT_CONFIGURED`: 사용 중인 PG가 없다
|
|
2145
2148
|
* - 400 `RETURN_URL_NOT_ALLOWED`: `returnUrl`이 https가 아니거나(테스트 결제의 localhost는 예외),
|
|
2146
|
-
*
|
|
2149
|
+
* 상점이 결제 도메인을 등록했는데 그 안이 아니다. 등록하지 않았으면 https 주소는 모두 받는다
|
|
2147
2150
|
* - 503 `PAYMENT_PROVIDER_UNAVAILABLE`: 고른 PG의 결제창을 준비하지 못했다(다른 옵션으로 다시 시도)
|
|
2148
2151
|
*/
|
|
2149
2152
|
startPayment: (checkoutId: string, body: StartPaymentRequest) => Promise<{
|
|
@@ -2249,7 +2252,7 @@ declare function createStorefrontClient(options: StorefrontClientOptions): {
|
|
|
2249
2252
|
* `expiresAt`까지 폴링한다. `completed`면 `orderId`로 완료 화면, `failed`·`expired`면 실패 안내다.
|
|
2250
2253
|
* TTL이 지난 `pending`은 `expired`로 보고된다. `testPayment`는 완료면 주문 플래그, 아니면 세션 환경이다.
|
|
2251
2254
|
*
|
|
2252
|
-
* 에러: 404 `PAYMENT_NOT_FOUND`(없음·다른
|
|
2255
|
+
* 에러: 404 `PAYMENT_NOT_FOUND`(없음·다른 상점) · 410 `STORE_CLOSED` · 503 `STORE_SUSPENDED`
|
|
2253
2256
|
*/
|
|
2254
2257
|
getStatus: (paymentId: string) => Promise<{
|
|
2255
2258
|
paymentId: string;
|
|
@@ -2461,7 +2464,7 @@ declare function createStorefrontClient(options: StorefrontClientOptions): {
|
|
|
2461
2464
|
*
|
|
2462
2465
|
* 에러: 404 `ORDER_NOT_FOUND`(주문이 없거나 연락처·비밀번호가 다름 — 둘을 구분하지 않는다) ·
|
|
2463
2466
|
* 429 `TOO_MANY_REQUESTS`(주문번호마다 10분에 5번까지 확인하고, 5번째가 틀리면 30분 잠금.
|
|
2464
|
-
* 주문번호마다 하루 15번,
|
|
2467
|
+
* 주문번호마다 하루 15번, 상점 전체 분당 한도도 있다. 남은 시간은 `ApiError.details.retryAfterSeconds`).
|
|
2465
2468
|
* 맞게 조회하면 주문번호의 횟수가 초기화된다. 본문 형식은 `guestInfoSchema`의 `phone`·`orderPassword`와 같다.
|
|
2466
2469
|
* 429는 연락처·비밀번호가 맞아도 난다 — 「잠시 후 다시 시도」로 안내한다.
|
|
2467
2470
|
*/
|
|
@@ -3165,7 +3168,7 @@ type CustomInputView = z.infer<typeof customInputViewSchema>;
|
|
|
3165
3168
|
declare function normalizeCustomInputValue(value: string): string;
|
|
3166
3169
|
/**
|
|
3167
3170
|
* 직접 입력값의 글자 수 — 정규화한 값의 **코드 포인트 수**다(이모지 하나가 1자). 서버의 최대 글자 수 판정(`CUSTOM_INPUT_TOO_LONG`)과
|
|
3168
|
-
*
|
|
3171
|
+
* 스토어프론트·상점 플랫폼의 글자 수 표시가 이 함수 하나를 쓴다. `String.length`(UTF-16)로 세면 이모지가 2자로 세어 판정이 갈린다.
|
|
3169
3172
|
*/
|
|
3170
3173
|
declare function customInputLength(value: string): number;
|
|
3171
3174
|
/** 담기·바로 구매 요청의 직접 입력값 한 칸. 앞뒤 공백을 지우고, 빈 값은 입력하지 않은 것으로 본다 */
|
|
@@ -3220,7 +3223,7 @@ declare const lineSelectionResponseShape: {
|
|
|
3220
3223
|
//#endregion
|
|
3221
3224
|
//#region src/schemas/store.d.ts
|
|
3222
3225
|
/**
|
|
3223
|
-
*
|
|
3226
|
+
* 상점 공개 설정 — `GET /store`. 스토어프론트가 화면을 그릴 때 읽는 값만 담는다.
|
|
3224
3227
|
*/
|
|
3225
3228
|
declare const storefrontStoreSchema: z.ZodObject<{
|
|
3226
3229
|
storeCode: z.ZodString;
|
|
@@ -3235,6 +3238,15 @@ declare const storefrontStoreSchema: z.ZodObject<{
|
|
|
3235
3238
|
naver: "naver";
|
|
3236
3239
|
google: "google";
|
|
3237
3240
|
}>>;
|
|
3241
|
+
checkoutAvailable: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
3242
|
+
checkoutMode: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
3243
|
+
LIVE: "LIVE";
|
|
3244
|
+
TEST: "TEST";
|
|
3245
|
+
}>>>>;
|
|
3246
|
+
checkoutUnavailableReason: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
3247
|
+
PAYMENT_NOT_CONFIGURED: "PAYMENT_NOT_CONFIGURED";
|
|
3248
|
+
PAYMENT_NOT_LIVE: "PAYMENT_NOT_LIVE";
|
|
3249
|
+
}>>>>;
|
|
3238
3250
|
}, z.core.$strip>;
|
|
3239
3251
|
type StorefrontStore = z.infer<typeof storefrontStoreSchema>;
|
|
3240
3252
|
//#endregion
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { C as loginRequestSchema, D as tokenPairSchema, E as socialProviderSchema, O as withdrawRequestSchema, S as linkIdentityRequestSchema, T as signupRequestSchema, _ as anonymousSessionSchema, a as AnonymousSession, b as idpAuthorizeResponseSchema, c as IdpTokenRequest, d as MemberIdentities, f as SignupRequest, g as WithdrawalBlockedDetails, h as WithdrawRequest, i as buildQuery, k as withdrawalBlockedDetailsSchema, l as LinkIdentityRequest, m as TokenPair, n as Query, o as IdpAgreements, p as SocialProvider, r as TokenSource, s as IdpAuthorizeRequest, t as ApiError, u as LoginRequest, v as idpAgreementsSchema, w as memberIdentitiesSchema, x as idpTokenRequestSchema, y as idpAuthorizeRequestSchema } from "./http-1ab7tP4-.mjs";
|
|
2
|
-
import { $ as CreateReviewRequest, $n as cashReceiptAvailable, $r as productCardFulfillmentSchema, $t as myCouponSchema, A as ANALYTICS_MAX_BATCH_BYTES, An as CheckoutDelivery, Ar as ProductSearchParams, At as publicInquirySchema, B as analyticsBatchSchema, Bn as PAYMENT_STATUS_VALUES, Br as PageInfo, Bt as CouponApplication, C as PurchaseDecisionResult, Cn as createClaimResultSchema, Cr as shippingAddressInputSchema, Ct as updateProfileRequestSchema, D as orderShippingAddressSchema, Dn as CashReceiptIdentityType, Dr as ProductDetail, Dt as PublicInquiry, E as myOrderSchema, En as CASH_RECEIPT_METHODS, Er as ProductCard, Et as CreateInquiryResult, F as AnalyticsBatch, Fn as EasyPayProvider, Fr as productFacetsSchema, Ft as customerInquiryCategorySchema, G as StorefrontClient, Gn as PaymentStart, Gr as pageSchema, Gt as applicableCouponSchema, H as analyticsClientEventSchema, Hn as PaymentMessage, Hr as claimStatusSchema, Ht as MAX_COUPONS_PER_CHECKOUT, I as AnalyticsClientEvent, In as GuestInfo, Ir as productPageSchema, It as customerInquirySchema, J as STOREFRONT_SESSION_KEYS, Jn as RemoteArea, Jr as ProductCardFulfillment, Jt as couponApplicationListSchema, K as StorefrontClientOptions, Kn as PaymentStatus, Kr as LineFulfillment, Kt as checkoutPricingRequestSchema, L as AnalyticsClientEventName, Ln as KnownPaymentResult, Lr as productSortSchema, Lt as ApplicableCoupon, M as ANALYTICS_SESSION_HEADER, Mn as CreateCheckoutRequest, Mr as categoryNodeSchema, Mt as CustomerInquiry, N as ANALYTICS_VISITOR_COOKIE, Nn as DeliveryQuoteRequest, Nr as productCardSchema, Nt as CustomerInquiryCategory, O as purchaseDecisionResultSchema, On as CashReceiptRequest, Or as ProductFacets, Ot as createInquiryRequestSchema, P as ANALYTICS_VISITOR_HEADER, Pn as DeliveryQuoteResult, Pr as productDetailSchema, Pt as createCustomerInquiryRequestSchema, Q as createStorefrontSession, Qn as availablePaymentOptionSchema, Qr as myOrderItemFulfillmentSnapshotSchema, Qt as myCouponListQuerySchema, R as AnalyticsEventName, Rn as KnownPaymentStatus, Rr as ClaimStatus, Rt as CheckoutPricing, S as OrderShippingAddress, Sn as createClaimRequestSchema, Sr as retryPaymentRequestSchema, St as memberSchema, T as myOrderItemSchema, Tn as AvailablePaymentOption, Tr as CategoryNode, Tt as CreateInquiryRequest, U as analyticsIdSchema, Un as PaymentMethod, Ur as orderItemStatusSchema, Ut as MIN_PAYMENT_AMOUNT, V as analyticsClientEventNameSchema, Vn as PaymentFailureCategory, Vr as PageParams, Vt as CouponResult, W as analyticsServerEventNameSchema, Wn as PaymentOption, Wr as pageInfoSchema, Wt as MyCoupon, X as StorefrontSession, Xn as ShippingAddressInput, Xr as UnknownFulfillmentView, Xt as couponBenefitViewSchema, Y as SessionStorage, Yn as RetryPaymentRequest, Yr as ProductFulfillmentView, Yt as couponApplicationSchema, Z as StorefrontSessionOptions, Zn as StartPaymentRequest, Zr as lineFulfillmentSchema, Zt as couponResultSchema, _ as normalizeCustomInputValue, _n as CreateClaimResult, _r as paymentStartSchema, _t as MemberAddressRequest, a as CustomInputEntry, ai as addCartItemRequestSchema, an as ConsentUpdateRequest, ar as createCheckoutRequestSchema, at as UpdateReviewResult, b as MyOrder, bn as claimReturnAddressSchema, br as remoteAreaSchema, bt as memberAddressRequestSchema, c as OptionSelectionView, ci as updateCartItemRequestSchema, cn as consentKindSchema, cr as easyPayProviderResponseSchema, ct as createReviewResultSchema, d as customInputEntrySchema, dn as consentUpdateRequestSchema, dr as paymentFailureCategorySchema, dt as reviewSummarySchema, ei as productFulfillmentViewSchema, en as pricingAmountsSchema, er as cashReceiptIdentityTypeOf, et as CreateReviewResult, f as customInputLength, fn as memberConsentsSchema, fr as paymentMessageSchema, ft as updateReviewRequestSchema, g as lineSelectionResponseShape, gn as CreateClaimRequest, gr as paymentOptionSchema, gt as MemberAddress, h as lineSelectionRequestShape, hn as ClaimType, hr as paymentOptionListSchema, ht as Member, i as AddonSelection, ii as UpdateCartItemRequest, in as ConsentState, ir as checkoutSessionSchema, it as UpdateReviewRequest, j as ANALYTICS_SESSION_COOKIE, jn as CheckoutSession, jr as ProductSort, jt as CreateCustomerInquiryRequest, k as trackingStageResponseSchema, kn as CashReceiptType, kr as ProductPage, kt as createInquiryResultSchema, l as addonGroupViewSchema, li as analyticsIdsFromCookie, ln as consentSourceSchema, lr as easyPayProviderSchema, lt as publicReviewSchema, m as customInputViewSchema, mn as ClaimReturnAddress, mr as paymentOptionKey, mt as writableReviewSchema, n as storefrontStoreSchema, ni as Cart, nn as ConsentKind, nr as cashReceiptTypeSchema, nt as ReviewPage, o as CustomInputValueView, oi as cartItemSchema, on as MemberConsents, or as deliveryQuoteRequestSchema, ot as WritableReview, p as customInputValueViewSchema, pn as ClaimReason, pr as paymentMethodSchema, pt as updateReviewResultSchema, q as createStorefrontClient, qn as PgProvider, qr as MyOrderItemFulfillmentSnapshot, qt as checkoutPricingSchema, r as AddonGroupView, ri as CartItem, rn as ConsentSource, rr as checkoutDeliverySchema, rt as ReviewSummary, s as CustomInputView, si as cartSchema, sn as consentActionSchema, sr as deliveryQuoteSchema, st as createReviewRequestSchema, t as StorefrontStore, ti as AddCartItemRequest, tn as ConsentAction, tr as cashReceiptRequestSchema, tt as PublicReview, u as addonSelectionSchema, un as consentStateSchema, ur as guestInfoSchema, ut as reviewPageSchema, v as optionSelectionViewSchema, vn as MyClaim, vr as paymentStatusSchema, vt as UpdateProfileRequest, w as deliveryTrackingSchema, wn as myClaimSchema, wr as startPaymentRequestSchema, wt as wishlistAddResultSchema, x as MyOrderItem, xn as claimTypeSchema, xr as residentNumberLike, xt as memberAddressSchema, y as DeliveryTracking, yn as claimReasonSchema, yr as pgProviderSchema, yt as WishlistAddResult, z as AnalyticsServerEventName, zn as PAYMENT_RESULT_VALUES, zr as OrderItemStatus, zt as CheckoutPricingRequest } from "./index-
|
|
2
|
+
import { $ as CreateReviewRequest, $n as cashReceiptAvailable, $r as productCardFulfillmentSchema, $t as myCouponSchema, A as ANALYTICS_MAX_BATCH_BYTES, An as CheckoutDelivery, Ar as ProductSearchParams, At as publicInquirySchema, B as analyticsBatchSchema, Bn as PAYMENT_STATUS_VALUES, Br as PageInfo, Bt as CouponApplication, C as PurchaseDecisionResult, Cn as createClaimResultSchema, Cr as shippingAddressInputSchema, Ct as updateProfileRequestSchema, D as orderShippingAddressSchema, Dn as CashReceiptIdentityType, Dr as ProductDetail, Dt as PublicInquiry, E as myOrderSchema, En as CASH_RECEIPT_METHODS, Er as ProductCard, Et as CreateInquiryResult, F as AnalyticsBatch, Fn as EasyPayProvider, Fr as productFacetsSchema, Ft as customerInquiryCategorySchema, G as StorefrontClient, Gn as PaymentStart, Gr as pageSchema, Gt as applicableCouponSchema, H as analyticsClientEventSchema, Hn as PaymentMessage, Hr as claimStatusSchema, Ht as MAX_COUPONS_PER_CHECKOUT, I as AnalyticsClientEvent, In as GuestInfo, Ir as productPageSchema, It as customerInquirySchema, J as STOREFRONT_SESSION_KEYS, Jn as RemoteArea, Jr as ProductCardFulfillment, Jt as couponApplicationListSchema, K as StorefrontClientOptions, Kn as PaymentStatus, Kr as LineFulfillment, Kt as checkoutPricingRequestSchema, L as AnalyticsClientEventName, Ln as KnownPaymentResult, Lr as productSortSchema, Lt as ApplicableCoupon, M as ANALYTICS_SESSION_HEADER, Mn as CreateCheckoutRequest, Mr as categoryNodeSchema, Mt as CustomerInquiry, N as ANALYTICS_VISITOR_COOKIE, Nn as DeliveryQuoteRequest, Nr as productCardSchema, Nt as CustomerInquiryCategory, O as purchaseDecisionResultSchema, On as CashReceiptRequest, Or as ProductFacets, Ot as createInquiryRequestSchema, P as ANALYTICS_VISITOR_HEADER, Pn as DeliveryQuoteResult, Pr as productDetailSchema, Pt as createCustomerInquiryRequestSchema, Q as createStorefrontSession, Qn as availablePaymentOptionSchema, Qr as myOrderItemFulfillmentSnapshotSchema, Qt as myCouponListQuerySchema, R as AnalyticsEventName, Rn as KnownPaymentStatus, Rr as ClaimStatus, Rt as CheckoutPricing, S as OrderShippingAddress, Sn as createClaimRequestSchema, Sr as retryPaymentRequestSchema, St as memberSchema, T as myOrderItemSchema, Tn as AvailablePaymentOption, Tr as CategoryNode, Tt as CreateInquiryRequest, U as analyticsIdSchema, Un as PaymentMethod, Ur as orderItemStatusSchema, Ut as MIN_PAYMENT_AMOUNT, V as analyticsClientEventNameSchema, Vn as PaymentFailureCategory, Vr as PageParams, Vt as CouponResult, W as analyticsServerEventNameSchema, Wn as PaymentOption, Wr as pageInfoSchema, Wt as MyCoupon, X as StorefrontSession, Xn as ShippingAddressInput, Xr as UnknownFulfillmentView, Xt as couponBenefitViewSchema, Y as SessionStorage, Yn as RetryPaymentRequest, Yr as ProductFulfillmentView, Yt as couponApplicationSchema, Z as StorefrontSessionOptions, Zn as StartPaymentRequest, Zr as lineFulfillmentSchema, Zt as couponResultSchema, _ as normalizeCustomInputValue, _n as CreateClaimResult, _r as paymentStartSchema, _t as MemberAddressRequest, a as CustomInputEntry, ai as addCartItemRequestSchema, an as ConsentUpdateRequest, ar as createCheckoutRequestSchema, at as UpdateReviewResult, b as MyOrder, bn as claimReturnAddressSchema, br as remoteAreaSchema, bt as memberAddressRequestSchema, c as OptionSelectionView, ci as updateCartItemRequestSchema, cn as consentKindSchema, cr as easyPayProviderResponseSchema, ct as createReviewResultSchema, d as customInputEntrySchema, dn as consentUpdateRequestSchema, dr as paymentFailureCategorySchema, dt as reviewSummarySchema, ei as productFulfillmentViewSchema, en as pricingAmountsSchema, er as cashReceiptIdentityTypeOf, et as CreateReviewResult, f as customInputLength, fn as memberConsentsSchema, fr as paymentMessageSchema, ft as updateReviewRequestSchema, g as lineSelectionResponseShape, gn as CreateClaimRequest, gr as paymentOptionSchema, gt as MemberAddress, h as lineSelectionRequestShape, hn as ClaimType, hr as paymentOptionListSchema, ht as Member, i as AddonSelection, ii as UpdateCartItemRequest, in as ConsentState, ir as checkoutSessionSchema, it as UpdateReviewRequest, j as ANALYTICS_SESSION_COOKIE, jn as CheckoutSession, jr as ProductSort, jt as CreateCustomerInquiryRequest, k as trackingStageResponseSchema, kn as CashReceiptType, kr as ProductPage, kt as createInquiryResultSchema, l as addonGroupViewSchema, li as analyticsIdsFromCookie, ln as consentSourceSchema, lr as easyPayProviderSchema, lt as publicReviewSchema, m as customInputViewSchema, mn as ClaimReturnAddress, mr as paymentOptionKey, mt as writableReviewSchema, n as storefrontStoreSchema, ni as Cart, nn as ConsentKind, nr as cashReceiptTypeSchema, nt as ReviewPage, o as CustomInputValueView, oi as cartItemSchema, on as MemberConsents, or as deliveryQuoteRequestSchema, ot as WritableReview, p as customInputValueViewSchema, pn as ClaimReason, pr as paymentMethodSchema, pt as updateReviewResultSchema, q as createStorefrontClient, qn as PgProvider, qr as MyOrderItemFulfillmentSnapshot, qt as checkoutPricingSchema, r as AddonGroupView, ri as CartItem, rn as ConsentSource, rr as checkoutDeliverySchema, rt as ReviewSummary, s as CustomInputView, si as cartSchema, sn as consentActionSchema, sr as deliveryQuoteSchema, st as createReviewRequestSchema, t as StorefrontStore, ti as AddCartItemRequest, tn as ConsentAction, tr as cashReceiptRequestSchema, tt as PublicReview, u as addonSelectionSchema, un as consentStateSchema, ur as guestInfoSchema, ut as reviewPageSchema, v as optionSelectionViewSchema, vn as MyClaim, vr as paymentStatusSchema, vt as UpdateProfileRequest, w as deliveryTrackingSchema, wn as myClaimSchema, wr as startPaymentRequestSchema, wt as wishlistAddResultSchema, x as MyOrderItem, xn as claimTypeSchema, xr as residentNumberLike, xt as memberAddressSchema, y as DeliveryTracking, yn as claimReasonSchema, yr as pgProviderSchema, yt as WishlistAddResult, z as AnalyticsServerEventName, zn as PAYMENT_RESULT_VALUES, zr as OrderItemStatus, zt as CheckoutPricingRequest } from "./index-DJYqxHSY.mjs";
|
|
3
3
|
export { ANALYTICS_MAX_BATCH_BYTES, ANALYTICS_SESSION_COOKIE, ANALYTICS_SESSION_HEADER, ANALYTICS_VISITOR_COOKIE, ANALYTICS_VISITOR_HEADER, AddCartItemRequest, AddonGroupView, AddonSelection, AnalyticsBatch, AnalyticsClientEvent, AnalyticsClientEventName, AnalyticsEventName, AnalyticsServerEventName, AnonymousSession, ApiError, ApplicableCoupon, AvailablePaymentOption, CASH_RECEIPT_METHODS, Cart, CartItem, CashReceiptIdentityType, CashReceiptRequest, CashReceiptType, CategoryNode, CheckoutDelivery, CheckoutPricing, CheckoutPricingRequest, CheckoutSession, ClaimReason, ClaimReturnAddress, ClaimStatus, ClaimType, ConsentAction, ConsentKind, ConsentSource, ConsentState, ConsentUpdateRequest, CouponApplication, CouponResult, CreateCheckoutRequest, CreateClaimRequest, CreateClaimResult, CreateCustomerInquiryRequest, CreateInquiryRequest, CreateInquiryResult, CreateReviewRequest, CreateReviewResult, CustomInputEntry, CustomInputValueView, CustomInputView, CustomerInquiry, CustomerInquiryCategory, DeliveryQuoteRequest, DeliveryQuoteResult, DeliveryTracking, EasyPayProvider, GuestInfo, IdpAgreements, IdpAuthorizeRequest, IdpTokenRequest, KnownPaymentResult, KnownPaymentStatus, LineFulfillment, LinkIdentityRequest, LoginRequest, MAX_COUPONS_PER_CHECKOUT, MIN_PAYMENT_AMOUNT, Member, MemberAddress, MemberAddressRequest, MemberConsents, MemberIdentities, MyClaim, MyCoupon, MyOrder, MyOrderItem, MyOrderItemFulfillmentSnapshot, OptionSelectionView, OrderItemStatus, OrderShippingAddress, PAYMENT_RESULT_VALUES, PAYMENT_STATUS_VALUES, PageInfo, PageParams, PaymentFailureCategory, PaymentMessage, PaymentMethod, PaymentOption, PaymentStart, PaymentStatus, PgProvider, ProductCard, ProductCardFulfillment, ProductDetail, ProductFacets, ProductFulfillmentView, ProductPage, ProductSearchParams, ProductSort, PublicInquiry, PublicReview, PurchaseDecisionResult, type Query, RemoteArea, RetryPaymentRequest, ReviewPage, ReviewSummary, STOREFRONT_SESSION_KEYS, type SessionStorage, ShippingAddressInput, SignupRequest, SocialProvider, StartPaymentRequest, type StorefrontClient, type StorefrontClientOptions, type StorefrontSession, type StorefrontSessionOptions, StorefrontStore, TokenPair, type TokenSource, UnknownFulfillmentView, UpdateCartItemRequest, UpdateProfileRequest, UpdateReviewRequest, UpdateReviewResult, WishlistAddResult, WithdrawRequest, WithdrawalBlockedDetails, WritableReview, addCartItemRequestSchema, addonGroupViewSchema, addonSelectionSchema, analyticsBatchSchema, analyticsClientEventNameSchema, analyticsClientEventSchema, analyticsIdSchema, analyticsIdsFromCookie, analyticsServerEventNameSchema, anonymousSessionSchema, applicableCouponSchema, availablePaymentOptionSchema, buildQuery, cartItemSchema, cartSchema, cashReceiptAvailable, cashReceiptIdentityTypeOf, cashReceiptRequestSchema, cashReceiptTypeSchema, categoryNodeSchema, checkoutDeliverySchema, checkoutPricingRequestSchema, checkoutPricingSchema, checkoutSessionSchema, claimReasonSchema, claimReturnAddressSchema, claimStatusSchema, claimTypeSchema, consentActionSchema, consentKindSchema, consentSourceSchema, consentStateSchema, consentUpdateRequestSchema, couponApplicationListSchema, couponApplicationSchema, couponBenefitViewSchema, couponResultSchema, createCheckoutRequestSchema, createClaimRequestSchema, createClaimResultSchema, createCustomerInquiryRequestSchema, createInquiryRequestSchema, createInquiryResultSchema, createReviewRequestSchema, createReviewResultSchema, createStorefrontClient, createStorefrontSession, customInputEntrySchema, customInputLength, customInputValueViewSchema, customInputViewSchema, customerInquiryCategorySchema, customerInquirySchema, deliveryQuoteRequestSchema, deliveryQuoteSchema, deliveryTrackingSchema, easyPayProviderResponseSchema, easyPayProviderSchema, guestInfoSchema, idpAgreementsSchema, idpAuthorizeRequestSchema, idpAuthorizeResponseSchema, idpTokenRequestSchema, lineFulfillmentSchema, lineSelectionRequestShape, lineSelectionResponseShape, linkIdentityRequestSchema, loginRequestSchema, memberAddressRequestSchema, memberAddressSchema, memberConsentsSchema, memberIdentitiesSchema, memberSchema, myClaimSchema, myCouponListQuerySchema, myCouponSchema, myOrderItemFulfillmentSnapshotSchema, myOrderItemSchema, myOrderSchema, normalizeCustomInputValue, optionSelectionViewSchema, orderItemStatusSchema, orderShippingAddressSchema, pageInfoSchema, pageSchema, paymentFailureCategorySchema, paymentMessageSchema, paymentMethodSchema, paymentOptionKey, paymentOptionListSchema, paymentOptionSchema, paymentStartSchema, paymentStatusSchema, pgProviderSchema, pricingAmountsSchema, productCardFulfillmentSchema, productCardSchema, productDetailSchema, productFacetsSchema, productFulfillmentViewSchema, productPageSchema, productSortSchema, publicInquirySchema, publicReviewSchema, purchaseDecisionResultSchema, remoteAreaSchema, residentNumberLike, retryPaymentRequestSchema, reviewPageSchema, reviewSummarySchema, shippingAddressInputSchema, signupRequestSchema, socialProviderSchema, startPaymentRequestSchema, storefrontStoreSchema, tokenPairSchema, trackingStageResponseSchema, updateCartItemRequestSchema, updateProfileRequestSchema, updateReviewRequestSchema, updateReviewResultSchema, wishlistAddResultSchema, withdrawRequestSchema, withdrawalBlockedDetailsSchema, writableReviewSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as ANALYTICS_VISITOR_HEADER, c as analyticsClientEventSchema, i as ANALYTICS_VISITOR_COOKIE, l as analyticsIdSchema, n as ANALYTICS_SESSION_COOKIE, o as analyticsBatchSchema, r as ANALYTICS_SESSION_HEADER, s as analyticsClientEventNameSchema, t as ANALYTICS_MAX_BATCH_BYTES, u as analyticsServerEventNameSchema } from "./analytics-CgD70OqH.mjs";
|
|
2
2
|
import { t as analyticsIdsFromCookie } from "./analytics-ids-COElZiI3.mjs";
|
|
3
|
-
import { $ as updateCartItemRequestSchema, A as consentSourceSchema, B as categoryNodeSchema, C as createInquiryResultSchema, D as customerInquirySchema, E as customerInquiryCategorySchema, F as claimReturnAddressSchema, G as productSortSchema, H as productDetailSchema, I as claimTypeSchema, J as pageInfoSchema, K as claimStatusSchema, L as createClaimRequestSchema, M as consentUpdateRequestSchema, N as memberConsentsSchema, O as consentActionSchema, P as claimReasonSchema, Q as cartSchema, R as createClaimResultSchema, S as createInquiryRequestSchema, T as createCustomerInquiryRequestSchema, U as productFacetsSchema, V as productCardSchema, W as productPageSchema, X as addCartItemRequestSchema, Y as pageSchema, Z as cartItemSchema, _ as memberAddressRequestSchema, a as publicReviewSchema, at as linkIdentityRequestSchema, b as updateProfileRequestSchema, c as updateReviewRequestSchema, ct as signupRequestSchema, d as deliveryTrackingSchema, dt as withdrawRequestSchema, et as anonymousSessionSchema, f as myOrderItemSchema, ft as withdrawalBlockedDetailsSchema, g as trackingStageResponseSchema, gt as unwrapData, h as purchaseDecisionResultSchema, ht as toApiError, i as createReviewResultSchema, it as idpTokenRequestSchema, j as consentStateSchema, k as consentKindSchema, l as updateReviewResultSchema, lt as socialProviderSchema, m as orderShippingAddressSchema, mt as buildQuery, n as storefrontStoreSchema, nt as idpAuthorizeRequestSchema, o as reviewPageSchema, ot as loginRequestSchema, p as myOrderSchema, pt as ApiError, q as orderItemStatusSchema, r as createReviewRequestSchema, rt as idpAuthorizeResponseSchema, s as reviewSummarySchema, st as memberIdentitiesSchema, t as createStorefrontClient, tt as idpAgreementsSchema, u as writableReviewSchema, ut as tokenPairSchema, v as memberAddressSchema, w as publicInquirySchema, x as wishlistAddResultSchema, y as memberSchema, z as myClaimSchema } from "./client-
|
|
4
|
-
import { $ as lineFulfillmentSchema, A as startPaymentRequestSchema, B as myCouponListQuerySchema, C as paymentStartSchema, D as residentNumberLike, E as remoteAreaSchema, F as checkoutPricingSchema, G as customInputEntrySchema, H as pricingAmountsSchema, I as couponApplicationListSchema, J as customInputViewSchema, K as customInputLength, L as couponApplicationSchema, M as MIN_PAYMENT_AMOUNT, N as applicableCouponSchema, O as retryPaymentRequestSchema, P as checkoutPricingRequestSchema, Q as optionSelectionViewSchema, R as couponBenefitViewSchema, S as paymentOptionSchema, T as pgProviderSchema, U as addonGroupViewSchema, V as myCouponSchema, W as addonSelectionSchema, X as lineSelectionResponseShape, Y as lineSelectionRequestShape, Z as normalizeCustomInputValue, _ as paymentFailureCategorySchema, a as cashReceiptAvailable, b as paymentOptionKey, c as cashReceiptTypeSchema, d as createCheckoutRequestSchema, et as myOrderItemFulfillmentSnapshotSchema, f as deliveryQuoteRequestSchema, g as guestInfoSchema, h as easyPayProviderSchema, i as availablePaymentOptionSchema, j as MAX_COUPONS_PER_CHECKOUT, k as shippingAddressInputSchema, l as checkoutDeliverySchema, m as easyPayProviderResponseSchema, n as PAYMENT_RESULT_VALUES, nt as productFulfillmentViewSchema, o as cashReceiptIdentityTypeOf, p as deliveryQuoteSchema, q as customInputValueViewSchema, r as PAYMENT_STATUS_VALUES, s as cashReceiptRequestSchema, t as CASH_RECEIPT_METHODS, tt as productCardFulfillmentSchema, u as checkoutSessionSchema, v as paymentMessageSchema, w as paymentStatusSchema, x as paymentOptionListSchema, y as paymentMethodSchema, z as couponResultSchema } from "./checkout-
|
|
3
|
+
import { $ as updateCartItemRequestSchema, A as consentSourceSchema, B as categoryNodeSchema, C as createInquiryResultSchema, D as customerInquirySchema, E as customerInquiryCategorySchema, F as claimReturnAddressSchema, G as productSortSchema, H as productDetailSchema, I as claimTypeSchema, J as pageInfoSchema, K as claimStatusSchema, L as createClaimRequestSchema, M as consentUpdateRequestSchema, N as memberConsentsSchema, O as consentActionSchema, P as claimReasonSchema, Q as cartSchema, R as createClaimResultSchema, S as createInquiryRequestSchema, T as createCustomerInquiryRequestSchema, U as productFacetsSchema, V as productCardSchema, W as productPageSchema, X as addCartItemRequestSchema, Y as pageSchema, Z as cartItemSchema, _ as memberAddressRequestSchema, a as publicReviewSchema, at as linkIdentityRequestSchema, b as updateProfileRequestSchema, c as updateReviewRequestSchema, ct as signupRequestSchema, d as deliveryTrackingSchema, dt as withdrawRequestSchema, et as anonymousSessionSchema, f as myOrderItemSchema, ft as withdrawalBlockedDetailsSchema, g as trackingStageResponseSchema, gt as unwrapData, h as purchaseDecisionResultSchema, ht as toApiError, i as createReviewResultSchema, it as idpTokenRequestSchema, j as consentStateSchema, k as consentKindSchema, l as updateReviewResultSchema, lt as socialProviderSchema, m as orderShippingAddressSchema, mt as buildQuery, n as storefrontStoreSchema, nt as idpAuthorizeRequestSchema, o as reviewPageSchema, ot as loginRequestSchema, p as myOrderSchema, pt as ApiError, q as orderItemStatusSchema, r as createReviewRequestSchema, rt as idpAuthorizeResponseSchema, s as reviewSummarySchema, st as memberIdentitiesSchema, t as createStorefrontClient, tt as idpAgreementsSchema, u as writableReviewSchema, ut as tokenPairSchema, v as memberAddressSchema, w as publicInquirySchema, x as wishlistAddResultSchema, y as memberSchema, z as myClaimSchema } from "./client-C91Y801B.mjs";
|
|
4
|
+
import { $ as lineFulfillmentSchema, A as startPaymentRequestSchema, B as myCouponListQuerySchema, C as paymentStartSchema, D as residentNumberLike, E as remoteAreaSchema, F as checkoutPricingSchema, G as customInputEntrySchema, H as pricingAmountsSchema, I as couponApplicationListSchema, J as customInputViewSchema, K as customInputLength, L as couponApplicationSchema, M as MIN_PAYMENT_AMOUNT, N as applicableCouponSchema, O as retryPaymentRequestSchema, P as checkoutPricingRequestSchema, Q as optionSelectionViewSchema, R as couponBenefitViewSchema, S as paymentOptionSchema, T as pgProviderSchema, U as addonGroupViewSchema, V as myCouponSchema, W as addonSelectionSchema, X as lineSelectionResponseShape, Y as lineSelectionRequestShape, Z as normalizeCustomInputValue, _ as paymentFailureCategorySchema, a as cashReceiptAvailable, b as paymentOptionKey, c as cashReceiptTypeSchema, d as createCheckoutRequestSchema, et as myOrderItemFulfillmentSnapshotSchema, f as deliveryQuoteRequestSchema, g as guestInfoSchema, h as easyPayProviderSchema, i as availablePaymentOptionSchema, j as MAX_COUPONS_PER_CHECKOUT, k as shippingAddressInputSchema, l as checkoutDeliverySchema, m as easyPayProviderResponseSchema, n as PAYMENT_RESULT_VALUES, nt as productFulfillmentViewSchema, o as cashReceiptIdentityTypeOf, p as deliveryQuoteSchema, q as customInputValueViewSchema, r as PAYMENT_STATUS_VALUES, s as cashReceiptRequestSchema, t as CASH_RECEIPT_METHODS, tt as productCardFulfillmentSchema, u as checkoutSessionSchema, v as paymentMessageSchema, w as paymentStatusSchema, x as paymentOptionListSchema, y as paymentMethodSchema, z as couponResultSchema } from "./checkout-PJk8g5DY.mjs";
|
|
5
5
|
//#region src/session.ts
|
|
6
6
|
/** 세션 키 상수 — SDK가 소유한다. store-sdk와 겹치지 않는 별도 네임스페이스. */
|
|
7
7
|
const STOREFRONT_SESSION_KEYS = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Gn as PaymentStart, In as GuestInfo, Kn as PaymentStatus, On as CashReceiptRequest, Wn as PaymentOption, Xn as ShippingAddressInput, Zn as StartPaymentRequest, q as createStorefrontClient } from "../index-
|
|
1
|
+
import { Gn as PaymentStart, In as GuestInfo, Kn as PaymentStatus, On as CashReceiptRequest, Wn as PaymentOption, Xn as ShippingAddressInput, Zn as StartPaymentRequest, q as createStorefrontClient } from "../index-DJYqxHSY.mjs";
|
|
2
2
|
//#region src/payments/index.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* 스토어프론트 결제 — 브라우저 전용(`@sayren/storefront-sdk/payments`).
|
|
@@ -101,7 +101,7 @@ export declare function paymentResultOf(status: PaymentStatus, options?: {
|
|
|
101
101
|
}): PaymentResult;
|
|
102
102
|
export interface PaymentsOptions {
|
|
103
103
|
client: StorefrontClient;
|
|
104
|
-
/** 결제를 마치면 돌아올 주소(
|
|
104
|
+
/** 결제를 마치면 돌아올 주소(상점 결제 도메인 안). `start`·`retry`에서 바꿀 수 있다 */
|
|
105
105
|
returnUrl?: string;
|
|
106
106
|
env?: PaymentsEnv;
|
|
107
107
|
}
|
package/dist/payments/index.mjs
CHANGED
package/package.json
CHANGED
package/src/analytics/index.ts
CHANGED
|
@@ -23,7 +23,7 @@ export type AnalyticsConsent = "granted" | "denied" | "pending";
|
|
|
23
23
|
export interface AnalyticsOptions {
|
|
24
24
|
/** 스토어프론트 API 베이스 — 예: `https://api.sayren.app/storefront/v1` */
|
|
25
25
|
baseUrl: string;
|
|
26
|
-
/** 테넌트
|
|
26
|
+
/** 테넌트 상점 코드 */
|
|
27
27
|
storeCode: string;
|
|
28
28
|
/** 동의 상태. 기본 `pending` — 셀러의 동의 배너가 `setConsent`로 바꾼다 */
|
|
29
29
|
consent?: AnalyticsConsent;
|
package/src/auth/index.ts
CHANGED
|
@@ -74,7 +74,7 @@ async function s256(verifier: string): Promise<string> {
|
|
|
74
74
|
export interface StorefrontAuthOptions {
|
|
75
75
|
/** 예: https://api.sayren.app/storefront/v1 */
|
|
76
76
|
baseUrl: string;
|
|
77
|
-
/** 테넌트
|
|
77
|
+
/** 테넌트 상점 코드 — `X-Store-Code` 헤더로 보낸다 */
|
|
78
78
|
storeCode: string;
|
|
79
79
|
fetch?: typeof globalThis.fetch;
|
|
80
80
|
}
|
|
@@ -226,7 +226,7 @@ export function createStorefrontAuth(options: StorefrontAuthOptions) {
|
|
|
226
226
|
},
|
|
227
227
|
/**
|
|
228
228
|
* 구매자 탈퇴 — 계정·배송지·위시리스트·장바구니·적립금을 지우고 토큰을 모두 무효로 만든다. 되돌릴 수 없다.
|
|
229
|
-
* 주문·리뷰·문의 기록은
|
|
229
|
+
* 주문·리뷰·문의 기록은 상점이 보관한다. 진행 중인 주문이나 처리 중인 클레임이 있으면
|
|
230
230
|
* 409 `WITHDRAWAL_BLOCKED`(`error.details`: `WithdrawalBlockedDetails`)다. 앱은 성공 후 보관한 토큰을 지운다.
|
|
231
231
|
*/
|
|
232
232
|
withdraw(accessToken: string, body: WithdrawRequest): Promise<void> {
|
package/src/client.ts
CHANGED
|
@@ -103,7 +103,7 @@ export interface StorefrontClientOptions {
|
|
|
103
103
|
/** 예: https://demo.store.example.com/api/v1 */
|
|
104
104
|
baseUrl: string;
|
|
105
105
|
/**
|
|
106
|
-
* 테넌트
|
|
106
|
+
* 테넌트 상점 코드 — `X-Store-Code` 헤더로 전송한다. 공유 API 호스트로 접근할 때
|
|
107
107
|
* 서버가 Host 서브도메인을 추측하는 대신 명시적으로 테넌트를 지정한다(멀티테넌트 격리).
|
|
108
108
|
* 함수로 전달하면 매 요청마다 재평가.
|
|
109
109
|
*/
|
|
@@ -233,7 +233,7 @@ export function createStorefrontClient(options: StorefrontClientOptions) {
|
|
|
233
233
|
},
|
|
234
234
|
|
|
235
235
|
store: {
|
|
236
|
-
/**
|
|
236
|
+
/** 상점 공개 설정 — 이름·고객센터·비회원 주문 허용 여부 */
|
|
237
237
|
get: () => http.request("GET", "/store", storefrontStoreSchema),
|
|
238
238
|
},
|
|
239
239
|
|
|
@@ -305,10 +305,10 @@ export function createStorefrontClient(options: StorefrontClientOptions) {
|
|
|
305
305
|
* `@sayren/storefront-sdk/payments`의 `createPayments().start()`다 — 이 메서드는 값만 받는다.
|
|
306
306
|
*
|
|
307
307
|
* 에러(`ApiError.code`):
|
|
308
|
-
* - 409 `PAYMENT_OPTION_UNAVAILABLE`: 이
|
|
308
|
+
* - 409 `PAYMENT_OPTION_UNAVAILABLE`: 이 상점에서 쓸 수 없는 옵션. `details.paymentOptions`에 지금 목록
|
|
309
309
|
* - 409 `PAYMENT_NOT_CONFIGURED`: 사용 중인 PG가 없다
|
|
310
310
|
* - 400 `RETURN_URL_NOT_ALLOWED`: `returnUrl`이 https가 아니거나(테스트 결제의 localhost는 예외),
|
|
311
|
-
*
|
|
311
|
+
* 상점이 결제 도메인을 등록했는데 그 안이 아니다. 등록하지 않았으면 https 주소는 모두 받는다
|
|
312
312
|
* - 503 `PAYMENT_PROVIDER_UNAVAILABLE`: 고른 PG의 결제창을 준비하지 못했다(다른 옵션으로 다시 시도)
|
|
313
313
|
*/
|
|
314
314
|
startPayment: (checkoutId: string, body: StartPaymentRequest) =>
|
|
@@ -336,7 +336,7 @@ export function createStorefrontClient(options: StorefrontClientOptions) {
|
|
|
336
336
|
* `expiresAt`까지 폴링한다. `completed`면 `orderId`로 완료 화면, `failed`·`expired`면 실패 안내다.
|
|
337
337
|
* TTL이 지난 `pending`은 `expired`로 보고된다. `testPayment`는 완료면 주문 플래그, 아니면 세션 환경이다.
|
|
338
338
|
*
|
|
339
|
-
* 에러: 404 `PAYMENT_NOT_FOUND`(없음·다른
|
|
339
|
+
* 에러: 404 `PAYMENT_NOT_FOUND`(없음·다른 상점) · 410 `STORE_CLOSED` · 503 `STORE_SUSPENDED`
|
|
340
340
|
*/
|
|
341
341
|
getStatus: (paymentId: string) =>
|
|
342
342
|
http.request("GET", path`/payments/${paymentId}`, paymentStatusSchema),
|
|
@@ -359,7 +359,7 @@ export function createStorefrontClient(options: StorefrontClientOptions) {
|
|
|
359
359
|
*
|
|
360
360
|
* 에러: 404 `ORDER_NOT_FOUND`(주문이 없거나 연락처·비밀번호가 다름 — 둘을 구분하지 않는다) ·
|
|
361
361
|
* 429 `TOO_MANY_REQUESTS`(주문번호마다 10분에 5번까지 확인하고, 5번째가 틀리면 30분 잠금.
|
|
362
|
-
* 주문번호마다 하루 15번,
|
|
362
|
+
* 주문번호마다 하루 15번, 상점 전체 분당 한도도 있다. 남은 시간은 `ApiError.details.retryAfterSeconds`).
|
|
363
363
|
* 맞게 조회하면 주문번호의 횟수가 초기화된다. 본문 형식은 `guestInfoSchema`의 `phone`·`orderPassword`와 같다.
|
|
364
364
|
* 429는 연락처·비밀번호가 맞아도 난다 — 「잠시 후 다시 시도」로 안내한다.
|
|
365
365
|
*/
|
package/src/payments/index.ts
CHANGED
|
@@ -229,7 +229,7 @@ function browserEnv(): PaymentsEnv {
|
|
|
229
229
|
|
|
230
230
|
export interface PaymentsOptions {
|
|
231
231
|
client: StorefrontClient;
|
|
232
|
-
/** 결제를 마치면 돌아올 주소(
|
|
232
|
+
/** 결제를 마치면 돌아올 주소(상점 결제 도메인 안). `start`·`retry`에서 바꿀 수 있다 */
|
|
233
233
|
returnUrl?: string;
|
|
234
234
|
env?: PaymentsEnv;
|
|
235
235
|
}
|
package/src/schemas/checkout.ts
CHANGED
|
@@ -50,7 +50,7 @@ export const checkoutDeliverySchema = z.object({
|
|
|
50
50
|
bundleCount: z.number().int().describe("배송 묶음 수 — 배송비를 부과한 횟수다"),
|
|
51
51
|
freeByThreshold: z
|
|
52
52
|
.boolean()
|
|
53
|
-
.describe("
|
|
53
|
+
.describe("상점 전체 무료배송 기준액을 넘겨 기본 배송비를 면제했는가"),
|
|
54
54
|
zipCode: z
|
|
55
55
|
.string()
|
|
56
56
|
.nullable()
|
|
@@ -127,7 +127,7 @@ export const checkoutSessionSchema = z.object({
|
|
|
127
127
|
testPayment: z
|
|
128
128
|
.boolean()
|
|
129
129
|
.describe(
|
|
130
|
-
"지금 결제하면 테스트 결제(샌드박스)인가. true면 실제로 돈이 나가지 않습니다 — 주문서에 테스트 결제 안내를 표시합니다. 결제 요청 시점에
|
|
130
|
+
"지금 결제하면 테스트 결제(샌드박스)인가. true면 실제로 돈이 나가지 않습니다 — 주문서에 테스트 결제 안내를 표시합니다. 결제 요청 시점에 상점 결제 설정으로 다시 정해지니 최종 값은 결제 요청 응답의 `testPayment`입니다",
|
|
131
131
|
),
|
|
132
132
|
});
|
|
133
133
|
|
|
@@ -165,7 +165,7 @@ export const paymentMethodSchema = z.enum([
|
|
|
165
165
|
|
|
166
166
|
export type PaymentMethod = z.infer<typeof paymentMethodSchema>;
|
|
167
167
|
|
|
168
|
-
/** 결제를 처리하는 PG. 셀러가 직접 계약하고
|
|
168
|
+
/** 결제를 처리하는 PG. 셀러가 직접 계약하고 상점 플랫폼 설정 › 결제에서 연결한다 */
|
|
169
169
|
export const pgProviderSchema = z.enum(["tosspayments", "portone"]);
|
|
170
170
|
export type PgProvider = z.infer<typeof pgProviderSchema>;
|
|
171
171
|
|
|
@@ -373,7 +373,7 @@ const cashReceiptField = cashReceiptRequestSchema
|
|
|
373
373
|
/**
|
|
374
374
|
* 결제 시작 — 배송지를 확정하고 고른 결제 옵션으로 결제 시도를 연다. 응답의 `payUrl`(결제 서비스)을 팝업(`mode=popup`)이나
|
|
375
375
|
* 전체 페이지로 열면 결제 서비스가 PG 결제창을 띄우고 승인까지 한다. 리다이렉트 결제가 끝나면 구매자는 `returnUrl`로 돌아온다.
|
|
376
|
-
* `returnUrl`의 도메인은
|
|
376
|
+
* `returnUrl`의 도메인은 상점 결제 도메인(상점 플랫폼 설정 › 결제)에 등록돼 있어야 한다(테스트 결제는 localhost 허용).
|
|
377
377
|
*/
|
|
378
378
|
export const startPaymentRequestSchema = z.object({
|
|
379
379
|
option: paymentOptionSchema,
|
|
@@ -381,7 +381,7 @@ export const startPaymentRequestSchema = z.object({
|
|
|
381
381
|
.url()
|
|
382
382
|
.max(2048)
|
|
383
383
|
.describe(
|
|
384
|
-
"결제를 마치면 돌아올 스토어프론트 주소.
|
|
384
|
+
"결제를 마치면 돌아올 스토어프론트 주소. 상점 결제 도메인에 등록된 도메인이어야 한다",
|
|
385
385
|
),
|
|
386
386
|
shippingAddress: shippingAddressInputSchema
|
|
387
387
|
.optional()
|
package/src/schemas/claim.ts
CHANGED
|
@@ -76,10 +76,10 @@ export const createClaimResultSchema = z.object({
|
|
|
76
76
|
export type CreateClaimResult = z.infer<typeof createClaimResultSchema>;
|
|
77
77
|
|
|
78
78
|
/**
|
|
79
|
-
* 반품지 (이슈 #30) — 반품·교환 수거가 안내하는 주소다.
|
|
79
|
+
* 반품지 (이슈 #30) — 반품·교환 수거가 안내하는 주소다. 상점 주소록의 기본 반품지이거나,
|
|
80
80
|
* 상품이 반품지를 따로 지정했으면 그 주소다.
|
|
81
81
|
*
|
|
82
|
-
* 취소 클레임은 보낼 물건이 없어 null이고, 반품지를 등록하지 않은
|
|
82
|
+
* 취소 클레임은 보낼 물건이 없어 null이고, 반품지를 등록하지 않은 상점도 null이다.
|
|
83
83
|
* 구매자가 직접 보내는 수거(`BUYER_SEND`)에 이 주소가 필요하다.
|
|
84
84
|
*/
|
|
85
85
|
export const claimReturnAddressSchema = z.object({
|
package/src/schemas/consent.ts
CHANGED
|
@@ -32,11 +32,11 @@ export const consentStateSchema = z.object({
|
|
|
32
32
|
agreed: z.boolean(),
|
|
33
33
|
/** 동의한 약관 버전. 마케팅은 버전이 없어 null이고, 동의 이력이 없으면 null이다 */
|
|
34
34
|
agreedVersion: z.string().nullable(),
|
|
35
|
-
/**
|
|
35
|
+
/** 상점의 현재 약관 버전. 마케팅은 null */
|
|
36
36
|
currentVersion: z.string().nullable(),
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* 상점이 정한 현재 약관 문서 주소. 재동의 화면에서 이 주소를 보여 준다.
|
|
39
|
+
* 상점이 정하지 않았거나 마케팅이면 null이다(동의한 시점의 주소는 셀러가 보는 이력에 남는다).
|
|
40
40
|
*/
|
|
41
41
|
currentDocumentUrl: z.string().nullable(),
|
|
42
42
|
/** 마지막으로 동의·철회한 시각. 이력이 없으면 null */
|
package/src/schemas/member.ts
CHANGED
|
@@ -13,7 +13,7 @@ export const memberSchema = z.object({
|
|
|
13
13
|
.boolean()
|
|
14
14
|
.describe(
|
|
15
15
|
"약관이 개정돼 필수 동의를 다시 받아야 하는가. true면 `GET /me/consents`로 어떤 항목인지 확인하고 " +
|
|
16
|
-
"`POST /me/consents`로 받는다. 받기 전에도
|
|
16
|
+
"`POST /me/consents`로 받는다. 받기 전에도 상점 이용은 막히지 않는다",
|
|
17
17
|
),
|
|
18
18
|
});
|
|
19
19
|
|
|
@@ -52,7 +52,7 @@ export function normalizeCustomInputValue(value: string): string {
|
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* 직접 입력값의 글자 수 — 정규화한 값의 **코드 포인트 수**다(이모지 하나가 1자). 서버의 최대 글자 수 판정(`CUSTOM_INPUT_TOO_LONG`)과
|
|
55
|
-
*
|
|
55
|
+
* 스토어프론트·상점 플랫폼의 글자 수 표시가 이 함수 하나를 쓴다. `String.length`(UTF-16)로 세면 이모지가 2자로 세어 판정이 갈린다.
|
|
56
56
|
*/
|
|
57
57
|
export function customInputLength(value: string): number {
|
|
58
58
|
return [...normalizeCustomInputValue(value)].length;
|
package/src/schemas/store.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* 상점 공개 설정 — `GET /store`. 스토어프론트가 화면을 그릴 때 읽는 값만 담는다.
|
|
5
5
|
*/
|
|
6
6
|
export const storefrontStoreSchema = z.object({
|
|
7
7
|
storeCode: z.string(),
|
|
@@ -18,6 +18,38 @@ export const storefrontStoreSchema = z.object({
|
|
|
18
18
|
* 켜진 로그인 방법 — 화면에 이 순서대로 버튼을 그리면 된다. `password`가 없으면 이메일·비밀번호 가입·로그인이 꺼져 있다
|
|
19
19
|
*/
|
|
20
20
|
loginMethods: z.array(z.enum(["password", "kakao", "naver", "google"])),
|
|
21
|
+
/**
|
|
22
|
+
* 지금 주문(결제)을 받을 수 있는가(이슈 #70). false면 결제 요청(`POST /checkout/{checkoutId}/payment`)이 409
|
|
23
|
+
* `PAYMENT_NOT_CONFIGURED`다. 장바구니·주문 버튼을 숨기거나 문의 안내로 바꾸면 된다. 장바구니 담기·주문서 생성은 막지 않는다
|
|
24
|
+
*/
|
|
25
|
+
checkoutAvailable: z
|
|
26
|
+
.boolean()
|
|
27
|
+
.optional()
|
|
28
|
+
.default(true)
|
|
29
|
+
.describe(
|
|
30
|
+
"지금 주문(결제)을 받을 수 있는가. false면 결제 요청이 409 `PAYMENT_NOT_CONFIGURED`이므로 장바구니·주문 버튼을 숨기거나 문의 안내로 바꾸면 된다. 서버는 항상 싣는다",
|
|
31
|
+
),
|
|
32
|
+
/** 주문을 받을 때의 결제 환경 — `TEST`면 테스트 결제(돈이 오가지 않는다)다. 주문을 받지 않으면 null */
|
|
33
|
+
checkoutMode: z
|
|
34
|
+
.enum(["LIVE", "TEST"])
|
|
35
|
+
.nullable()
|
|
36
|
+
.optional()
|
|
37
|
+
.default(null)
|
|
38
|
+
.describe(
|
|
39
|
+
"주문을 받을 때의 결제 환경. `TEST`면 테스트 결제라 돈이 오가지 않는다. 주문을 받지 않으면 null. 서버는 항상 싣는다",
|
|
40
|
+
),
|
|
41
|
+
/**
|
|
42
|
+
* 주문을 받지 않는 사유 — `PAYMENT_NOT_CONFIGURED`(사용 중인 결제 수단 없음), `PAYMENT_NOT_LIVE`(공개한 쇼핑몰인데 실결제가
|
|
43
|
+
* 아직 열리지 않음). 주문을 받으면 null
|
|
44
|
+
*/
|
|
45
|
+
checkoutUnavailableReason: z
|
|
46
|
+
.enum(["PAYMENT_NOT_CONFIGURED", "PAYMENT_NOT_LIVE"])
|
|
47
|
+
.nullable()
|
|
48
|
+
.optional()
|
|
49
|
+
.default(null)
|
|
50
|
+
.describe(
|
|
51
|
+
"주문을 받지 않는 사유. `PAYMENT_NOT_CONFIGURED`는 사용 중인 결제 수단이 없음, `PAYMENT_NOT_LIVE`는 공개한 쇼핑몰인데 실결제가 아직 열리지 않음이다. 주문을 받으면 null. 서버는 항상 싣는다",
|
|
52
|
+
),
|
|
21
53
|
});
|
|
22
54
|
|
|
23
55
|
export type StorefrontStore = z.infer<typeof storefrontStoreSchema>;
|
package/src/session.ts
CHANGED
|
@@ -30,7 +30,7 @@ const REFRESH_LOCK = STOREFRONT_SESSION_KEYS.refreshToken;
|
|
|
30
30
|
export interface StorefrontSessionOptions {
|
|
31
31
|
/** 예: https://shop.api.example.com/storefront/v1 */
|
|
32
32
|
baseUrl: string;
|
|
33
|
-
/** 테넌트
|
|
33
|
+
/** 테넌트 상점 코드 — X-Store-Code 헤더로 전송한다 */
|
|
34
34
|
storeCode?: string;
|
|
35
35
|
/** 저장 매체 어댑터 (앱 소유) */
|
|
36
36
|
storage: SessionStorage;
|