@sayren/storefront-sdk 0.20.9 → 0.20.11
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-vjq513VD.mjs → client-TokSE7D9.mjs} +69 -6
- package/dist/{index-BLjQQj49.d.mts → index-ilVVBQUs.d.mts} +705 -128
- 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 +13 -0
- package/src/schemas/commerce-flow.ts +92 -2
- package/src/schemas/order.ts +6 -1
package/dist/auth/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ht as ApiError, t as createStorefrontClient } from "../client-TokSE7D9.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,12 +525,24 @@ 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
|
-
options: z.array(z.union([
|
|
534
|
+
options: z.array(z.union([
|
|
535
|
+
z.string(),
|
|
536
|
+
z.number(),
|
|
537
|
+
z.object({
|
|
538
|
+
value: z.string(),
|
|
539
|
+
label: z.string()
|
|
540
|
+
}).describe("값과 보여 줄 이름")
|
|
541
|
+
])).optional().describe("고르는 형식의 선택지. 값만 있거나 값·이름 쌍이다(보낼 때는 값)"),
|
|
542
|
+
when: z.object({
|
|
543
|
+
key: z.string(),
|
|
544
|
+
in: z.array(z.string())
|
|
545
|
+
}).optional().describe("다른 칸(`key`)의 값이 `in` 중 하나일 때만 보이고 받는 칸. 없으면 늘 받는다")
|
|
534
546
|
});
|
|
535
547
|
const flowActionSchema = z.object({
|
|
536
548
|
key: z.string(),
|
|
@@ -566,9 +578,53 @@ const flowStateSchema = z.object({
|
|
|
566
578
|
enteredAt: z.string(),
|
|
567
579
|
deadlineAt: z.string().optional().describe("가장 가까운 기한(ISO 8601)"),
|
|
568
580
|
attachments: z.array(z.string()).optional().describe("가장 최근 행동이 붙인 첨부 주소(시안 등, #115). 없으면 생략"),
|
|
581
|
+
earlierAttachments: z.array(z.string()).optional().describe("앞 상태에서 붙인 첨부(수정 요청 뒤의 이전 시안 등). 다음 첨부가 오면 바뀐다. 없으면 생략"),
|
|
582
|
+
inputs: z.object({
|
|
583
|
+
by: z.string().describe("적은 사람 — seller · buyer"),
|
|
584
|
+
values: z.array(z.object({
|
|
585
|
+
key: z.string(),
|
|
586
|
+
label: z.string(),
|
|
587
|
+
type: z.string(),
|
|
588
|
+
value: z.union([
|
|
589
|
+
z.string(),
|
|
590
|
+
z.number(),
|
|
591
|
+
z.boolean(),
|
|
592
|
+
z.array(z.string())
|
|
593
|
+
])
|
|
594
|
+
}))
|
|
595
|
+
}).optional().describe("이 상태로 오게 한 행동의 입력값(수정 내용 등, #115). 없으면 생략"),
|
|
569
596
|
progress: z.boolean().optional(),
|
|
570
597
|
fields: z.record(z.string(), flowFieldValueSchema).describe("구매자 공개 범위의 커스텀 필드")
|
|
571
598
|
});
|
|
599
|
+
/**
|
|
600
|
+
* 주문상품의 지금 단계(#115) — 구매자 화면이 흐름 구조를 몰라도 그릴 수 있게 서버가 정리한 값이다. `type`으로 화면 모양을 고르고,
|
|
601
|
+
* `actions`(입력 칸 포함)로 버튼·폼을 그린다. 판정은 서버다.
|
|
602
|
+
*/
|
|
603
|
+
const ORDER_STEP_TYPES = [
|
|
604
|
+
"BUYER_ACTION",
|
|
605
|
+
"SELLER_PROCESSING",
|
|
606
|
+
"IN_DELIVERY",
|
|
607
|
+
"DELIVERED",
|
|
608
|
+
"COMPLETED",
|
|
609
|
+
"CANCELED",
|
|
610
|
+
"CLAIM_IN_PROGRESS"
|
|
611
|
+
];
|
|
612
|
+
const orderStepSchema = z.object({
|
|
613
|
+
type: z.string().describe("BUYER_ACTION 구매자 확인·입력 필요 · SELLER_PROCESSING 판매자 처리 중 · IN_DELIVERY 배송 중 · DELIVERED 배송·제공 완료 · COMPLETED 구매확정 · CANCELED 취소 · CLAIM_IN_PROGRESS 취소·반품·교환 처리 중. 값이 늘어날 수 있다(모르는 값은 SELLER_PROCESSING처럼 보인다)"),
|
|
614
|
+
label: z.string().describe("지금 상태 이름(구매자용)"),
|
|
615
|
+
message: z.string().optional().describe("판매자가 둔 안내문"),
|
|
616
|
+
deadlineAt: z.string().optional().describe("가장 가까운 기한(ISO 8601)"),
|
|
617
|
+
attachments: z.array(z.string()).optional().describe("판매자가 올린 자료(시안 등)"),
|
|
618
|
+
earlierAttachments: z.array(z.string()).optional().describe("앞 단계에서 올린 자료(수정 요청 뒤의 이전 시안 등)"),
|
|
619
|
+
inputs: flowStateSchema.shape.inputs,
|
|
620
|
+
actions: z.array(flowActionSchema).describe("이 단계에서 구매자가 할 행동(입력 칸 포함). `BUYER_ACTION`이면 하나 이상이다. 취소·반품 요청·구매확정은 `actions`(주문상품)에 있다"),
|
|
621
|
+
data: z.object({ delivery: z.object({
|
|
622
|
+
carrierName: z.string().nullable(),
|
|
623
|
+
trackingNumber: z.string().nullable(),
|
|
624
|
+
trackingUrl: z.string().nullable(),
|
|
625
|
+
dispatchedAt: z.string()
|
|
626
|
+
}).optional().describe("`IN_DELIVERY` — 발송 정보") }).optional().describe("단계별 부가 정보. 없으면 생략")
|
|
627
|
+
});
|
|
572
628
|
const flowActionRequestSchema = z.object({ input: z.record(z.string(), z.unknown()).optional() });
|
|
573
629
|
/** 비회원 행동 — 비회원 주문 조회와 같은 확인(연락처·주문 조회 비밀번호)을 함께 보낸다 */
|
|
574
630
|
const guestFlowActionRequestSchema = flowActionRequestSchema.extend({
|
|
@@ -802,7 +858,8 @@ const myOrderItemSchema = z.object({
|
|
|
802
858
|
autoDecisionDate: z.string().nullable(),
|
|
803
859
|
flowState: flowStateSchema.optional().describe("주문 플로우의 지금 상태(이슈 #115). 플로우가 없는 주문상품은 없다"),
|
|
804
860
|
actions: z.array(flowActionSchema).optional().describe("지금 할 수 있는 행동. 화면은 이 목록으로 버튼을 그린다(상태 이름으로 분기하지 않는다)"),
|
|
805
|
-
flowBranches: z.array(flowStateSchema).optional().describe("진행 위치가 둘 이상(병렬 진행·하위 흐름)이면 각 위치의 상태. `flowState`는 그 가운데 가장 앞 단계다")
|
|
861
|
+
flowBranches: z.array(flowStateSchema).optional().describe("진행 위치가 둘 이상(병렬 진행·하위 흐름)이면 각 위치의 상태. `flowState`는 그 가운데 가장 앞 단계다"),
|
|
862
|
+
step: orderStepSchema.optional().describe("지금 단계 요약(#115) — `type`으로 화면을 고르고 `actions`의 입력 칸으로 폼을 그린다. 플로우가 없는 주문상품은 없다")
|
|
806
863
|
});
|
|
807
864
|
/**
|
|
808
865
|
* 주문 응답의 배송지 — 결제 요청 시 저장된 스냅샷. 요청 스키마(`shippingAddressInputSchema`)와 분리한 응답 스키마라
|
|
@@ -1167,7 +1224,13 @@ get: () => http.request("GET", "/store", storefrontStoreSchema) },
|
|
|
1167
1224
|
get: () => http.request("GET", "/cart", cartSchema),
|
|
1168
1225
|
addItem: (body) => http.request("POST", "/cart/items", cartSchema, { body: addCartItemRequestSchema.parse(body) }),
|
|
1169
1226
|
updateItem: (cartItemId, body) => http.request("PATCH", path`/cart/items/${cartItemId}`, cartSchema, { body: updateCartItemRequestSchema.parse(body) }),
|
|
1170
|
-
removeItem: (cartItemId) => http.requestVoid("DELETE", path`/cart/items/${cartItemId}`)
|
|
1227
|
+
removeItem: (cartItemId) => http.requestVoid("DELETE", path`/cart/items/${cartItemId}`),
|
|
1228
|
+
/**
|
|
1229
|
+
* 직접 입력 이미지(`type: "image"`) 업로드 자리 — 응답 `uploadUrl`에 파일을 PUT한 뒤 `url`을 담기·바로 구매의
|
|
1230
|
+
* `customInputs` 값에 넣는다(여러 장이면 줄바꿈으로 잇는다). 비회원도 부를 수 있다.
|
|
1231
|
+
* 형식·크기가 맞지 않으면 400 `UNSUPPORTED_FILE_TYPE`·413 `FILE_TOO_LARGE`, 연타하면 429 `TOO_MANY_REQUESTS`다
|
|
1232
|
+
*/
|
|
1233
|
+
createInputImageUpload: (body) => http.request("POST", "/uploads/order-inputs", uploadTicketSchema, { body: orderInputUploadRequestSchema.parse(body) })
|
|
1171
1234
|
},
|
|
1172
1235
|
checkout: {
|
|
1173
1236
|
create: (body) => http.request("POST", "/checkout", checkoutSessionSchema, { body: createCheckoutRequestSchema.parse(body) }),
|
|
@@ -1307,4 +1370,4 @@ get: () => http.request("GET", "/store", storefrontStoreSchema) },
|
|
|
1307
1370
|
};
|
|
1308
1371
|
}
|
|
1309
1372
|
//#endregion
|
|
1310
|
-
export {
|
|
1373
|
+
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 };
|