@sayren/storefront-sdk 0.20.8 → 0.20.10
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/auth/index.mjs +1 -1
- package/dist/{client-S_gOAeBM.mjs → client-DJjcGd_M.mjs} +83 -6
- package/dist/{index-Bv49jTFH.d.mts → index-BVJvoppI.d.mts} +699 -120
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/payments/index.d.mts +1 -1
- package/package.json +1 -1
- package/src/client.ts +39 -0
- package/src/schemas/commerce-flow.ts +95 -1
- package/src/schemas/order.ts +17 -1
package/dist/auth/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ht as ApiError, t as createStorefrontClient } from "../client-DJjcGd_M.mjs";
|
|
2
2
|
//#region src/auth/index.ts
|
|
3
3
|
/** 소셜 로그인 실패 — 구매자가 취소했거나(`access_denied`) state가 맞지 않는다 */
|
|
4
4
|
var IdpCallbackError = class extends Error {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as ANALYTICS_VISITOR_HEADER, r as ANALYTICS_SESSION_HEADER } from "./analytics-CgD70OqH.mjs";
|
|
2
|
-
import { $ as customInputViewSchema, A as retryPaymentRequestSchema, F as applicableCouponSchema, I as checkoutPricingRequestSchema, J as addonGroupViewSchema, K as storefrontCouponSchema, L as checkoutPricingSchema, M as startPaymentRequestSchema, T as paymentStatusSchema, U as myCouponSchema, d as checkoutSessionSchema, dt as pickupLocationViewSchema, et as lineSelectionRequestShape, f as createCheckoutRequestSchema, ft as productCardFulfillmentSchema, h as easyPayProviderResponseSchema, k as responsePaymentMethodSchema, lt as lineFulfillmentSchema, m as deliveryQuoteSchema, ot as calendarDayViewSchema, p as deliveryQuoteRequestSchema, pt as productFulfillmentViewSchema, tt as lineSelectionResponseShape, ut as myOrderItemFulfillmentSnapshotSchema, w as paymentStartSchema } from "./checkout-BjJ4Efbn.mjs";
|
|
2
|
+
import { $ as customInputViewSchema, A as retryPaymentRequestSchema, F as applicableCouponSchema, I as checkoutPricingRequestSchema, J as addonGroupViewSchema, K as storefrontCouponSchema, L as checkoutPricingSchema, M as startPaymentRequestSchema, T as paymentStatusSchema, U as myCouponSchema, d as checkoutSessionSchema, dt as pickupLocationViewSchema, et as lineSelectionRequestShape, f as createCheckoutRequestSchema, ft as productCardFulfillmentSchema, h as easyPayProviderResponseSchema, it as orderInputUploadRequestSchema, k as responsePaymentMethodSchema, lt as lineFulfillmentSchema, m as deliveryQuoteSchema, ot as calendarDayViewSchema, p as deliveryQuoteRequestSchema, pt as productFulfillmentViewSchema, tt as lineSelectionResponseShape, ut as myOrderItemFulfillmentSnapshotSchema, w as paymentStartSchema } from "./checkout-BjJ4Efbn.mjs";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
//#region src/http.ts
|
|
5
5
|
/** 표준 엔벨로프의 $.error 상세 */
|
|
@@ -525,9 +525,10 @@ const myClaimSchema = z.object({
|
|
|
525
525
|
*/
|
|
526
526
|
const flowInputFieldSchema = z.object({
|
|
527
527
|
key: z.string(),
|
|
528
|
-
type: z.string().describe("text · number · select · date · datetime · image (늘어날 수 있다)"),
|
|
528
|
+
type: z.string().describe("text · textarea · number · select · radio · checkbox · boolean · date · datetime · image (늘어날 수 있다). 값: checkbox는 고른 선택지 배열, boolean은 참거짓(필수면 true), date는 `YYYY-MM-DD`, datetime은 오프셋 있는 ISO 8601, image는 https 주소 배열"),
|
|
529
529
|
required: z.boolean(),
|
|
530
530
|
label: z.string(),
|
|
531
|
+
placeholder: z.string().optional().describe("입력 안내"),
|
|
531
532
|
maxLength: z.number().int().optional(),
|
|
532
533
|
maxFiles: z.number().int().optional(),
|
|
533
534
|
options: z.array(z.union([z.string(), z.number()])).optional()
|
|
@@ -566,9 +567,51 @@ const flowStateSchema = z.object({
|
|
|
566
567
|
enteredAt: z.string(),
|
|
567
568
|
deadlineAt: z.string().optional().describe("가장 가까운 기한(ISO 8601)"),
|
|
568
569
|
attachments: z.array(z.string()).optional().describe("가장 최근 행동이 붙인 첨부 주소(시안 등, #115). 없으면 생략"),
|
|
570
|
+
inputs: z.object({
|
|
571
|
+
by: z.string().describe("적은 사람 — seller · buyer"),
|
|
572
|
+
values: z.array(z.object({
|
|
573
|
+
key: z.string(),
|
|
574
|
+
label: z.string(),
|
|
575
|
+
type: z.string(),
|
|
576
|
+
value: z.union([
|
|
577
|
+
z.string(),
|
|
578
|
+
z.number(),
|
|
579
|
+
z.boolean(),
|
|
580
|
+
z.array(z.string())
|
|
581
|
+
])
|
|
582
|
+
}))
|
|
583
|
+
}).optional().describe("이 상태로 오게 한 행동의 입력값(수정 내용 등, #115). 없으면 생략"),
|
|
569
584
|
progress: z.boolean().optional(),
|
|
570
585
|
fields: z.record(z.string(), flowFieldValueSchema).describe("구매자 공개 범위의 커스텀 필드")
|
|
571
586
|
});
|
|
587
|
+
/**
|
|
588
|
+
* 주문상품의 지금 단계(#115) — 구매자 화면이 흐름 구조를 몰라도 그릴 수 있게 서버가 정리한 값이다. `type`으로 화면 모양을 고르고,
|
|
589
|
+
* `actions`(입력 칸 포함)로 버튼·폼을 그린다. 판정은 서버다.
|
|
590
|
+
*/
|
|
591
|
+
const ORDER_STEP_TYPES = [
|
|
592
|
+
"BUYER_ACTION",
|
|
593
|
+
"SELLER_PROCESSING",
|
|
594
|
+
"IN_DELIVERY",
|
|
595
|
+
"DELIVERED",
|
|
596
|
+
"COMPLETED",
|
|
597
|
+
"CANCELED",
|
|
598
|
+
"CLAIM_IN_PROGRESS"
|
|
599
|
+
];
|
|
600
|
+
const orderStepSchema = z.object({
|
|
601
|
+
type: z.string().describe("BUYER_ACTION 구매자 확인·입력 필요 · SELLER_PROCESSING 판매자 처리 중 · IN_DELIVERY 배송 중 · DELIVERED 배송·제공 완료 · COMPLETED 구매확정 · CANCELED 취소 · CLAIM_IN_PROGRESS 취소·반품·교환 처리 중. 값이 늘어날 수 있다(모르는 값은 SELLER_PROCESSING처럼 보인다)"),
|
|
602
|
+
label: z.string().describe("지금 상태 이름(구매자용)"),
|
|
603
|
+
message: z.string().optional().describe("판매자가 둔 안내문"),
|
|
604
|
+
deadlineAt: z.string().optional().describe("가장 가까운 기한(ISO 8601)"),
|
|
605
|
+
attachments: z.array(z.string()).optional().describe("판매자가 올린 자료(시안 등)"),
|
|
606
|
+
inputs: flowStateSchema.shape.inputs,
|
|
607
|
+
actions: z.array(flowActionSchema).describe("이 단계에서 구매자가 할 행동(입력 칸 포함). `BUYER_ACTION`이면 하나 이상이다. 취소·반품 요청·구매확정은 `actions`(주문상품)에 있다"),
|
|
608
|
+
data: z.object({ delivery: z.object({
|
|
609
|
+
carrierName: z.string().nullable(),
|
|
610
|
+
trackingNumber: z.string().nullable(),
|
|
611
|
+
trackingUrl: z.string().nullable(),
|
|
612
|
+
dispatchedAt: z.string()
|
|
613
|
+
}).optional().describe("`IN_DELIVERY` — 발송 정보") }).optional().describe("단계별 부가 정보. 없으면 생략")
|
|
614
|
+
});
|
|
572
615
|
const flowActionRequestSchema = z.object({ input: z.record(z.string(), z.unknown()).optional() });
|
|
573
616
|
/** 비회원 행동 — 비회원 주문 조회와 같은 확인(연락처·주문 조회 비밀번호)을 함께 보낸다 */
|
|
574
617
|
const guestFlowActionRequestSchema = flowActionRequestSchema.extend({
|
|
@@ -585,6 +628,24 @@ const flowActionResultSchema = z.object({
|
|
|
585
628
|
claimNo: z.string().nullable()
|
|
586
629
|
}).optional().describe("취소·반품·교환 행동(하위 플로우 `core.claim.*`)이 접수한 클레임(#115). 클레임 API(`POST /me/order-items/{id}/claims`)와 같은 접수다. 다른 행동은 생략")
|
|
587
630
|
});
|
|
631
|
+
/**
|
|
632
|
+
* 주문 전체 행동 결과(#115) — 같은 행동을 주문의 주문상품마다 실행한다. 한 주문상품의 실패가 다른 주문상품을 되돌리지 않는다(부분 실행).
|
|
633
|
+
* 묶음 진행이면 한 번 실행이 묶음의 주문상품을 함께 움직인다(COMPLETED로 함께 나온다). 그 행동이 없는 주문상품은 SKIPPED다
|
|
634
|
+
*/
|
|
635
|
+
const orderFlowActionResultSchema = z.object({
|
|
636
|
+
orderId: z.string(),
|
|
637
|
+
key: z.string(),
|
|
638
|
+
results: z.array(z.object({
|
|
639
|
+
orderItemId: z.string(),
|
|
640
|
+
status: z.enum([
|
|
641
|
+
"COMPLETED",
|
|
642
|
+
"SKIPPED",
|
|
643
|
+
"FAILED"
|
|
644
|
+
]).describe("COMPLETED 실행 · SKIPPED 이 주문상품에는 그 행동이 없다 · FAILED 실행하다 거절됐다"),
|
|
645
|
+
reason: z.string().optional().describe("SKIPPED·FAILED의 이유 — 꺼진 이유(EXPIRED·CONDITION·NOT_IN_STATE) 또는 오류 코드"),
|
|
646
|
+
message: z.string().optional()
|
|
647
|
+
}))
|
|
648
|
+
});
|
|
588
649
|
//#endregion
|
|
589
650
|
//#region src/schemas/consent.ts
|
|
590
651
|
/**
|
|
@@ -783,7 +844,9 @@ const myOrderItemSchema = z.object({
|
|
|
783
844
|
reviewWritten: z.boolean(),
|
|
784
845
|
autoDecisionDate: z.string().nullable(),
|
|
785
846
|
flowState: flowStateSchema.optional().describe("주문 플로우의 지금 상태(이슈 #115). 플로우가 없는 주문상품은 없다"),
|
|
786
|
-
actions: z.array(flowActionSchema).optional().describe("지금 할 수 있는 행동. 화면은 이 목록으로 버튼을 그린다(상태 이름으로 분기하지 않는다)")
|
|
847
|
+
actions: z.array(flowActionSchema).optional().describe("지금 할 수 있는 행동. 화면은 이 목록으로 버튼을 그린다(상태 이름으로 분기하지 않는다)"),
|
|
848
|
+
flowBranches: z.array(flowStateSchema).optional().describe("진행 위치가 둘 이상(병렬 진행·하위 흐름)이면 각 위치의 상태. `flowState`는 그 가운데 가장 앞 단계다"),
|
|
849
|
+
step: orderStepSchema.optional().describe("지금 단계 요약(#115) — `type`으로 화면을 고르고 `actions`의 입력 칸으로 폼을 그린다. 플로우가 없는 주문상품은 없다")
|
|
787
850
|
});
|
|
788
851
|
/**
|
|
789
852
|
* 주문 응답의 배송지 — 결제 요청 시 저장된 스냅샷. 요청 스키마(`shippingAddressInputSchema`)와 분리한 응답 스키마라
|
|
@@ -800,6 +863,7 @@ const orderShippingAddressSchema = z.object({
|
|
|
800
863
|
});
|
|
801
864
|
const myOrderSchema = z.object({
|
|
802
865
|
orderId: z.string(),
|
|
866
|
+
progressStatus: orderItemStatusSchema.optional().describe("진행 중 주문상품 가운데 가장 앞 단계(취소 제외, 모두 취소면 CANCELED, #115). 섞인 주문에서 아직 기다리는 단계다. 서버는 항상 싣는다"),
|
|
803
867
|
orderNo: commerceNumberField("주문번호(이슈 #107) — 숫자 14자리, 생성 후 바뀌지 않습니다. 구매자 화면에는 `formatOrderNo`(4자리 하이픈)로 표시하십시오. 비회원 주문 조회 경로에도 쓸 수 있습니다"),
|
|
804
868
|
orderedAt: z.string(),
|
|
805
869
|
items: z.array(myOrderItemSchema),
|
|
@@ -1147,7 +1211,13 @@ get: () => http.request("GET", "/store", storefrontStoreSchema) },
|
|
|
1147
1211
|
get: () => http.request("GET", "/cart", cartSchema),
|
|
1148
1212
|
addItem: (body) => http.request("POST", "/cart/items", cartSchema, { body: addCartItemRequestSchema.parse(body) }),
|
|
1149
1213
|
updateItem: (cartItemId, body) => http.request("PATCH", path`/cart/items/${cartItemId}`, cartSchema, { body: updateCartItemRequestSchema.parse(body) }),
|
|
1150
|
-
removeItem: (cartItemId) => http.requestVoid("DELETE", path`/cart/items/${cartItemId}`)
|
|
1214
|
+
removeItem: (cartItemId) => http.requestVoid("DELETE", path`/cart/items/${cartItemId}`),
|
|
1215
|
+
/**
|
|
1216
|
+
* 직접 입력 이미지(`type: "image"`) 업로드 자리 — 응답 `uploadUrl`에 파일을 PUT한 뒤 `url`을 담기·바로 구매의
|
|
1217
|
+
* `customInputs` 값에 넣는다(여러 장이면 줄바꿈으로 잇는다). 비회원도 부를 수 있다.
|
|
1218
|
+
* 형식·크기가 맞지 않으면 400 `UNSUPPORTED_FILE_TYPE`·413 `FILE_TOO_LARGE`, 연타하면 429 `TOO_MANY_REQUESTS`다
|
|
1219
|
+
*/
|
|
1220
|
+
createInputImageUpload: (body) => http.request("POST", "/uploads/order-inputs", uploadTicketSchema, { body: orderInputUploadRequestSchema.parse(body) })
|
|
1151
1221
|
},
|
|
1152
1222
|
checkout: {
|
|
1153
1223
|
create: (body) => http.request("POST", "/checkout", checkoutSessionSchema, { body: createCheckoutRequestSchema.parse(body) }),
|
|
@@ -1220,7 +1290,14 @@ get: () => http.request("GET", "/store", storefrontStoreSchema) },
|
|
|
1220
1290
|
*/
|
|
1221
1291
|
act: (orderItemId, key, input = {}) => http.request("POST", path`/me/order-items/${orderItemId}/actions/${key}`, flowActionResultSchema, { body: flowActionRequestSchema.parse({ input }) }),
|
|
1222
1292
|
/** 비회원 행동 — 비회원 주문 조회와 같은 연락처·비밀번호 확인과 시도 한도를 지난다 */
|
|
1223
|
-
guestAct: (orderId, orderItemId, key, body) => http.request("POST", path`/guest/orders/${orderId}/items/${orderItemId}/actions/${key}`, flowActionResultSchema, { body: guestFlowActionRequestSchema.parse(body) })
|
|
1293
|
+
guestAct: (orderId, orderItemId, key, body) => http.request("POST", path`/guest/orders/${orderId}/items/${orderItemId}/actions/${key}`, flowActionResultSchema, { body: guestFlowActionRequestSchema.parse(body) }),
|
|
1294
|
+
/**
|
|
1295
|
+
* `POST /me/orders/{id}/actions/{key}` — 주문 전체 행동(#115, 예: 주문 전체 취소). 그 행동이 켜진 주문상품마다 실행하고 결과를
|
|
1296
|
+
* 주문상품별로 준다(부분 실행). 켜진 주문상품이 하나도 없으면 409 `ACTION_NOT_AVAILABLE`
|
|
1297
|
+
*/
|
|
1298
|
+
actOnOrder: (orderId, key, input = {}) => http.request("POST", path`/me/orders/${orderId}/actions/${key}`, orderFlowActionResultSchema, { body: flowActionRequestSchema.parse({ input }) }),
|
|
1299
|
+
/** 비회원 주문 전체 행동 — 비회원 주문 조회와 같은 확인·시도 한도 */
|
|
1300
|
+
guestActOnOrder: (orderId, key, body) => http.request("POST", path`/guest/orders/${orderId}/actions/${key}`, orderFlowActionResultSchema, { body: guestFlowActionRequestSchema.parse(body) })
|
|
1224
1301
|
},
|
|
1225
1302
|
myClaims: {
|
|
1226
1303
|
create: (orderItemId, body) => http.request("POST", path`/me/order-items/${orderItemId}/claims`, createClaimResultSchema, { body: createClaimRequestSchema.parse(body) }),
|
|
@@ -1280,4 +1357,4 @@ get: () => http.request("GET", "/store", storefrontStoreSchema) },
|
|
|
1280
1357
|
};
|
|
1281
1358
|
}
|
|
1282
1359
|
//#endregion
|
|
1283
|
-
export {
|
|
1360
|
+
export { orderStepSchema as $, wishlistAddResultSchema as A, idpAgreementsSchema as At, consentSourceSchema as B, withdrawRequestSchema as Bt, orderShippingAddressSchema as C, pageInfoSchema as Ct, memberAddressSchema as D, cartSchema as Dt, memberAddressRequestSchema as E, cartItemSchema as Et, createCustomerInquiryRequestSchema as F, loginRequestSchema as Ft, flowActionRequestSchema as G, unwrapData as Gt, consentUpdateRequestSchema as H, ApiError as Ht, customerInquiryCategorySchema as I, memberIdentitiesSchema as It, flowFieldValueSchema as J, flowActionResultSchema as K, customerInquirySchema as L, signupRequestSchema as Lt, createInquiryResultSchema as M, idpAuthorizeResponseSchema as Mt, productInquiryCategorySchema as N, idpTokenRequestSchema as Nt, memberSchema as O, updateCartItemRequestSchema as Ot, publicInquirySchema as P, linkIdentityRequestSchema as Pt, orderFlowActionResultSchema as Q, consentActionSchema as R, socialProviderSchema as Rt, myOrderSchema as S, orderItemStatusSchema as St, trackingStageResponseSchema as T, addCartItemRequestSchema as Tt, memberConsentsSchema as U, buildQuery as Ut, consentStateSchema as V, withdrawalBlockedDetailsSchema as Vt, ORDER_STEP_TYPES as W, toApiError as Wt, flowStateSchema as X, flowInputFieldSchema as Y, guestFlowActionRequestSchema as Z, memberPointEntrySchema as _, productSortSchema as _t, myReviewSchema as a, myClaimSchema as at, deliveryTrackingSchema as b, storefrontCollectionSchema as bt, publicReviewSchema as c, parseOrderNo as ct, reviewSummarySchema as d, collectionProductQuerySchema as dt, claimReasonSchema as et, updateReviewRequestSchema as f, collectionProductSortSchema as ft, memberPointEntryPageSchema as g, productPageSchema as gt, writableReviewSchema as h, productFacetsSchema as ht, createReviewResultSchema as i, createClaimResultSchema as it, createInquiryRequestSchema as j, idpAuthorizeRequestSchema as jt, updateProfileRequestSchema as k, anonymousSessionSchema as kt, reviewImageUploadRequestSchema as l, categoryNodeSchema as lt, uploadTicketSchema as m, productDetailSchema as mt, storefrontStoreSchema as n, claimTypeSchema as nt, productReviewQuerySchema as o, commerceNumberField as ot, updateReviewResultSchema as p, productCardSchema as pt, flowActionSchema as q, createReviewRequestSchema as r, createClaimRequestSchema as rt, productReviewSortSchema as s, formatOrderNo as st, createStorefrontClient as t, claimReturnAddressSchema as tt, reviewPageSchema as u, collectionProductPageSchema as ut, memberPointsSchema as v, storefrontCollectionDetailSchema as vt, purchaseDecisionResultSchema as w, pageSchema as wt, myOrderItemSchema as x, claimStatusSchema as xt, storefrontPointPolicySchema as y, storefrontCollectionListQuerySchema as yt, consentKindSchema as z, tokenPairSchema as zt };
|