@sayren/storefront-sdk 0.14.0 → 0.16.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/auth/index.mjs +1 -1
- package/dist/{checkout-wrCpR-P1.mjs → checkout-DTfoCsMF.mjs} +65 -57
- package/dist/{client-CUF2xGu8.mjs → client-BrDY5HO3.mjs} +45 -99
- package/dist/{index-dIZNg-hO.d.mts → index-BeQwCRc8.d.mts} +365 -425
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/payments/index.d.mts +1 -3
- package/dist/payments/index.mjs +1 -2
- package/package.json +1 -1
- package/src/client.ts +1 -57
- package/src/index.ts +1 -0
- package/src/payments/index.ts +0 -5
- package/src/schemas/cart.ts +7 -5
- package/src/schemas/catalog.ts +8 -17
- package/src/schemas/checkout.ts +13 -26
- package/src/schemas/common.ts +0 -30
- package/src/schemas/fulfillment.ts +119 -0
- package/src/schemas/order.ts +14 -111
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
|
|
3
|
-
export { ANALYTICS_MAX_BATCH_BYTES, ANALYTICS_SESSION_COOKIE, ANALYTICS_SESSION_HEADER, ANALYTICS_VISITOR_COOKIE, ANALYTICS_VISITOR_HEADER, AddCartItemRequest, 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, CustomerInquiry, CustomerInquiryCategory, DeliveryQuoteRequest, DeliveryQuoteResult, DeliveryTracking,
|
|
2
|
+
import { $ as Member, $n as paymentOptionListSchema, $t as ClaimType, A as StorefrontClientOptions, An as PaymentStatus, Ar as LineFulfillment, At as checkoutPricingRequestSchema, B as ReviewPage, Bn as cashReceiptTypeSchema, Br as Cart, Bt as ConsentKind, C as AnalyticsServerEventName, Cn as PAYMENT_RESULT_VALUES, Cr as OrderItemStatus, Ct as CheckoutPricingRequest, D as analyticsIdSchema, Dn as PaymentMethod, Dr as orderItemStatusSchema, Dt as MIN_PAYMENT_AMOUNT, E as analyticsClientEventSchema, En as PaymentMessage, Er as claimStatusSchema, Et as MAX_COUPONS_PER_CHECKOUT, F as StorefrontSessionOptions, Fn as StartPaymentRequest, Fr as lineFulfillmentSchema, Ft as couponResultSchema, G as createReviewRequestSchema, Gn as deliveryQuoteSchema, Gr as cartSchema, Gt as consentActionSchema, H as UpdateReviewRequest, Hn as checkoutSessionSchema, Hr as UpdateCartItemRequest, Ht as ConsentState, I as createStorefrontSession, In as availablePaymentOptionSchema, Ir as myOrderItemFulfillmentSnapshotSchema, It as myCouponListQuerySchema, J as reviewPageSchema, Jn as guestInfoSchema, Jt as consentStateSchema, K as createReviewResultSchema, Kn as easyPayProviderResponseSchema, Kr as updateCartItemRequestSchema, Kt as consentKindSchema, L as CreateReviewRequest, Ln as cashReceiptAvailable, Lr as productCardFulfillmentSchema, Lt as myCouponSchema, M as STOREFRONT_SESSION_KEYS, Mn as RemoteArea, Mr as ProductCardFulfillment, Mt as couponApplicationListSchema, N as SessionStorage, Nn as RetryPaymentRequest, Nr as ProductFulfillmentView, Nt as couponApplicationSchema, O as analyticsServerEventNameSchema, On as PaymentOption, Or as pageInfoSchema, Ot as MyCoupon, P as StorefrontSession, Pn as ShippingAddressInput, Pr as UnknownFulfillmentView, Pt as couponBenefitViewSchema, Q as writableReviewSchema, Qn as paymentOptionKey, Qt as ClaimReturnAddress, R as CreateReviewResult, Rn as cashReceiptIdentityTypeOf, Rr as productFulfillmentViewSchema, Rt as pricingAmountsSchema, S as AnalyticsEventName, Sn as KnownPaymentStatus, Sr as ClaimStatus, St as CheckoutPricing, T as analyticsClientEventNameSchema, Tn as PaymentFailureCategory, Tr as PageParams, Tt as CouponResult, U as UpdateReviewResult, Un as createCheckoutRequestSchema, Ur as addCartItemRequestSchema, Ut as ConsentUpdateRequest, V as ReviewSummary, Vn as checkoutDeliverySchema, Vr as CartItem, Vt as ConsentSource, W as WritableReview, Wn as deliveryQuoteRequestSchema, Wr as cartItemSchema, Wt as MemberConsents, X as updateReviewRequestSchema, Xn as paymentMessageSchema, Xt as memberConsentsSchema, Y as reviewSummarySchema, Yn as paymentFailureCategorySchema, Yt as consentUpdateRequestSchema, Z as updateReviewResultSchema, Zn as paymentMethodSchema, Zt as ClaimReason, _ as ANALYTICS_VISITOR_COOKIE, _n as DeliveryQuoteRequest, _r as productCardSchema, _t as CustomerInquiryCategory, a as MyOrderItem, an as claimTypeSchema, ar as residentNumberLike, at as memberAddressSchema, b as AnalyticsClientEvent, bn as GuestInfo, br as productPageSchema, bt as customerInquirySchema, c as deliveryTrackingSchema, cn as myClaimSchema, cr as startPaymentRequestSchema, ct as wishlistAddResultSchema, d as orderShippingAddressSchema, dn as CashReceiptIdentityType, dr as ProductDetail, dt as PublicInquiry, en as CreateClaimRequest, er as paymentOptionSchema, et as MemberAddress, f as purchaseDecisionResultSchema, fn as CashReceiptRequest, fr as ProductFacets, ft as createInquiryRequestSchema, g as ANALYTICS_SESSION_HEADER, gn as CreateCheckoutRequest, gr as categoryNodeSchema, gt as CustomerInquiry, h as ANALYTICS_SESSION_COOKIE, hn as CheckoutSession, hr as ProductSort, ht as CreateCustomerInquiryRequest, i as MyOrder, in as claimReturnAddressSchema, ir as remoteAreaSchema, it as memberAddressRequestSchema, j as createStorefrontClient, jn as PgProvider, jr as MyOrderItemFulfillmentSnapshot, jt as checkoutPricingSchema, k as StorefrontClient, kn as PaymentStart, kr as pageSchema, kt as applicableCouponSchema, l as myOrderItemSchema, ln as AvailablePaymentOption, lr as CategoryNode, lt as CreateInquiryRequest, m as ANALYTICS_MAX_BATCH_BYTES, mn as CheckoutDelivery, mr as ProductSearchParams, mt as publicInquirySchema, n as storefrontStoreSchema, nn as MyClaim, nr as paymentStatusSchema, nt as UpdateProfileRequest, o as OrderShippingAddress, on as createClaimRequestSchema, or as retryPaymentRequestSchema, ot as memberSchema, p as trackingStageResponseSchema, pn as CashReceiptType, pr as ProductPage, pt as createInquiryResultSchema, q as publicReviewSchema, qn as easyPayProviderSchema, qr as analyticsIdsFromCookie, qt as consentSourceSchema, r as DeliveryTracking, rn as claimReasonSchema, rr as pgProviderSchema, rt as WishlistAddResult, s as PurchaseDecisionResult, sn as createClaimResultSchema, sr as shippingAddressInputSchema, st as updateProfileRequestSchema, t as StorefrontStore, tn as CreateClaimResult, tr as paymentStartSchema, tt as MemberAddressRequest, u as myOrderSchema, un as CASH_RECEIPT_METHODS, ur as ProductCard, ut as CreateInquiryResult, v as ANALYTICS_VISITOR_HEADER, vn as DeliveryQuoteResult, vr as productDetailSchema, vt as createCustomerInquiryRequestSchema, w as analyticsBatchSchema, wn as PAYMENT_STATUS_VALUES, wr as PageInfo, wt as CouponApplication, x as AnalyticsClientEventName, xn as KnownPaymentResult, xr as productSortSchema, xt as ApplicableCoupon, y as AnalyticsBatch, yn as EasyPayProvider, yr as productFacetsSchema, yt as customerInquiryCategorySchema, z as PublicReview, zn as cashReceiptRequestSchema, zr as AddCartItemRequest, zt as ConsentAction } from "./index-BeQwCRc8.mjs";
|
|
3
|
+
export { ANALYTICS_MAX_BATCH_BYTES, ANALYTICS_SESSION_COOKIE, ANALYTICS_SESSION_HEADER, ANALYTICS_VISITOR_COOKIE, ANALYTICS_VISITOR_HEADER, AddCartItemRequest, 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, 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, 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, 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, customerInquiryCategorySchema, customerInquirySchema, deliveryQuoteRequestSchema, deliveryQuoteSchema, deliveryTrackingSchema, easyPayProviderResponseSchema, easyPayProviderSchema, guestInfoSchema, idpAgreementsSchema, idpAuthorizeRequestSchema, idpAuthorizeResponseSchema, idpTokenRequestSchema, lineFulfillmentSchema, linkIdentityRequestSchema, loginRequestSchema, memberAddressRequestSchema, memberAddressSchema, memberConsentsSchema, memberIdentitiesSchema, memberSchema, myClaimSchema, myCouponListQuerySchema, myCouponSchema, myOrderItemFulfillmentSnapshotSchema, myOrderItemSchema, myOrderSchema, 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
|
|
4
|
-
import { A as startPaymentRequestSchema, B as myCouponListQuerySchema, C as paymentStartSchema, D as residentNumberLike, E as remoteAreaSchema, F as checkoutPricingSchema, G as
|
|
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-BrDY5HO3.mjs";
|
|
4
|
+
import { A as startPaymentRequestSchema, B as myCouponListQuerySchema, C as paymentStartSchema, D as residentNumberLike, E as remoteAreaSchema, F as checkoutPricingSchema, G as productCardFulfillmentSchema, H as pricingAmountsSchema, I as couponApplicationListSchema, K as productFulfillmentViewSchema, L as couponApplicationSchema, M as MIN_PAYMENT_AMOUNT, N as applicableCouponSchema, O as retryPaymentRequestSchema, P as checkoutPricingRequestSchema, R as couponBenefitViewSchema, S as paymentOptionSchema, T as pgProviderSchema, U as lineFulfillmentSchema, V as myCouponSchema, W as myOrderItemFulfillmentSnapshotSchema, _ as paymentFailureCategorySchema, a as cashReceiptAvailable, b as paymentOptionKey, c as cashReceiptTypeSchema, d as createCheckoutRequestSchema, 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, o as cashReceiptIdentityTypeOf, p as deliveryQuoteSchema, r as PAYMENT_STATUS_VALUES, s as cashReceiptRequestSchema, t as CASH_RECEIPT_METHODS, u as checkoutSessionSchema, v as paymentMessageSchema, w as paymentStatusSchema, x as paymentOptionListSchema, y as paymentMethodSchema, z as couponResultSchema } from "./checkout-DTfoCsMF.mjs";
|
|
5
5
|
//#region src/session.ts
|
|
6
6
|
/** 세션 키 상수 — SDK가 소유한다. store-sdk와 겹치지 않는 별도 네임스페이스. */
|
|
7
7
|
const STOREFRONT_SESSION_KEYS = {
|
|
@@ -125,4 +125,4 @@ function createStorefrontSession(options) {
|
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
//#endregion
|
|
128
|
-
export { ANALYTICS_MAX_BATCH_BYTES, ANALYTICS_SESSION_COOKIE, ANALYTICS_SESSION_HEADER, ANALYTICS_VISITOR_COOKIE, ANALYTICS_VISITOR_HEADER, ApiError, CASH_RECEIPT_METHODS, MAX_COUPONS_PER_CHECKOUT, MIN_PAYMENT_AMOUNT, PAYMENT_RESULT_VALUES, PAYMENT_STATUS_VALUES, STOREFRONT_SESSION_KEYS, addCartItemRequestSchema, 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, customerInquiryCategorySchema, customerInquirySchema, deliveryQuoteRequestSchema, deliveryQuoteSchema, deliveryTrackingSchema,
|
|
128
|
+
export { ANALYTICS_MAX_BATCH_BYTES, ANALYTICS_SESSION_COOKIE, ANALYTICS_SESSION_HEADER, ANALYTICS_VISITOR_COOKIE, ANALYTICS_VISITOR_HEADER, ApiError, CASH_RECEIPT_METHODS, MAX_COUPONS_PER_CHECKOUT, MIN_PAYMENT_AMOUNT, PAYMENT_RESULT_VALUES, PAYMENT_STATUS_VALUES, STOREFRONT_SESSION_KEYS, addCartItemRequestSchema, 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, customerInquiryCategorySchema, customerInquirySchema, deliveryQuoteRequestSchema, deliveryQuoteSchema, deliveryTrackingSchema, easyPayProviderResponseSchema, easyPayProviderSchema, guestInfoSchema, idpAgreementsSchema, idpAuthorizeRequestSchema, idpAuthorizeResponseSchema, idpTokenRequestSchema, lineFulfillmentSchema, linkIdentityRequestSchema, loginRequestSchema, memberAddressRequestSchema, memberAddressSchema, memberConsentsSchema, memberIdentitiesSchema, memberSchema, myClaimSchema, myCouponListQuerySchema, myCouponSchema, myOrderItemFulfillmentSnapshotSchema, myOrderItemSchema, myOrderSchema, 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 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { An as PaymentStatus, Fn as StartPaymentRequest, On as PaymentOption, Pn as ShippingAddressInput, bn as GuestInfo, fn as CashReceiptRequest, j as createStorefrontClient, kn as PaymentStart } from "../index-BeQwCRc8.mjs";
|
|
2
2
|
//#region src/payments/index.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* 스토어프론트 결제 — 브라우저 전용(`@sayren/storefront-sdk/payments`).
|
|
@@ -114,8 +114,6 @@ export interface StartOptions {
|
|
|
114
114
|
cashReceipt?: CashReceiptRequest;
|
|
115
115
|
/** 적용할 쿠폰 — 결제 시작이 예약하고 할인한 금액으로 결제한다 */
|
|
116
116
|
coupons?: StartPaymentRequest["coupons"];
|
|
117
|
-
/** 청약철회 제한 동의 — 주문서의 `withdrawal.required`가 true면 true로 보낸다 */
|
|
118
|
-
withdrawalAgreement?: boolean;
|
|
119
117
|
returnUrl?: string;
|
|
120
118
|
mode?: PaymentMode;
|
|
121
119
|
/** 클릭 시점에 {@link Payments.prepareWindow}로 미리 연 창. 폼 검증이 비동기라 클릭 태스크를 넘길 때 쓴다 */
|
package/dist/payments/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as paymentMessageSchema } from "../checkout-
|
|
1
|
+
import { v as paymentMessageSchema } from "../checkout-DTfoCsMF.mjs";
|
|
2
2
|
//#region src/payments/index.ts
|
|
3
3
|
/** 복귀 주소에 결제 서비스가 붙이는 쿼리 */
|
|
4
4
|
const RETURN_PAYMENT_ID = "sayrenPaymentId";
|
|
@@ -290,7 +290,6 @@ function createPayments(options) {
|
|
|
290
290
|
guest: startOptions.guest,
|
|
291
291
|
...startOptions.cashReceipt ? { cashReceipt: startOptions.cashReceipt } : {},
|
|
292
292
|
...startOptions.coupons ? { coupons: startOptions.coupons } : {},
|
|
293
|
-
...startOptions.withdrawalAgreement !== void 0 ? { withdrawalAgreement: startOptions.withdrawalAgreement } : {},
|
|
294
293
|
returnUrl
|
|
295
294
|
}));
|
|
296
295
|
},
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -86,14 +86,7 @@ import {
|
|
|
86
86
|
type UpdateProfileRequest,
|
|
87
87
|
updateProfileRequestSchema,
|
|
88
88
|
} from "./schemas/member";
|
|
89
|
-
import {
|
|
90
|
-
type DownloadRequest,
|
|
91
|
-
deliveryTrackingSchema,
|
|
92
|
-
downloadLinkSchema,
|
|
93
|
-
downloadRequestSchema,
|
|
94
|
-
fulfillmentRevealSchema,
|
|
95
|
-
myOrderSchema,
|
|
96
|
-
} from "./schemas/order";
|
|
89
|
+
import { deliveryTrackingSchema, myOrderSchema } from "./schemas/order";
|
|
97
90
|
import {
|
|
98
91
|
type CreateReviewRequest,
|
|
99
92
|
createReviewRequestSchema,
|
|
@@ -374,55 +367,6 @@ export function createStorefrontClient(options: StorefrontClientOptions) {
|
|
|
374
367
|
http.request("POST", path`/guest/orders/${orderId}`, myOrderSchema, { body }),
|
|
375
368
|
getDelivery: (orderItemId: string) =>
|
|
376
369
|
http.request("GET", path`/me/order-items/${orderItemId}/delivery`, deliveryTrackingSchema),
|
|
377
|
-
/**
|
|
378
|
-
* 코드 열람 (이슈 #48) — 코드 발급 상품의 평문 코드. 처음 열람한 시각이 제공 개시 증거로 남는다.
|
|
379
|
-
*
|
|
380
|
-
* 에러: 404 `ORDER_ITEM_NOT_FOUND`(없거나 남의 주문상품) · 404 `FULFILLMENT_NOT_FOUND`(제공 전·회수됨·코드 상품 아님) ·
|
|
381
|
-
* 429 `TOO_MANY_REQUESTS`
|
|
382
|
-
*/
|
|
383
|
-
revealCode: (orderItemId: string) =>
|
|
384
|
-
http.request(
|
|
385
|
-
"POST",
|
|
386
|
-
path`/me/order-items/${orderItemId}/fulfillment/reveal`,
|
|
387
|
-
fulfillmentRevealSchema,
|
|
388
|
-
),
|
|
389
|
-
/**
|
|
390
|
-
* 파일 다운로드 (이슈 #48) — 수명 300초의 서명 주소를 받는다. 받을 때마다 남은 횟수가 준다.
|
|
391
|
-
*
|
|
392
|
-
* 에러: 404 `FULFILLMENT_NOT_FOUND`(제공 전·회수됨·파일 상품 아님) · 409 `DOWNLOAD_LIMIT_REACHED`(횟수 소진) ·
|
|
393
|
-
* 409 `DOWNLOAD_EXPIRED`(기한 지남) · 400 `ASSET_REQUIRED`(파일이 여러 개인데 `assetId` 없음)
|
|
394
|
-
*/
|
|
395
|
-
createDownload: (orderItemId: string, body: DownloadRequest = {}) =>
|
|
396
|
-
http.request("POST", path`/me/order-items/${orderItemId}/downloads`, downloadLinkSchema, {
|
|
397
|
-
body: downloadRequestSchema.parse(body),
|
|
398
|
-
}),
|
|
399
|
-
/** 비회원 다운로드 — 비회원 주문 조회와 같은 연락처·주문 조회 비밀번호로 확인한다 */
|
|
400
|
-
createGuestDownload: (
|
|
401
|
-
orderId: string,
|
|
402
|
-
orderItemId: string,
|
|
403
|
-
body: { phone: string; orderPassword: string; assetId?: string },
|
|
404
|
-
) =>
|
|
405
|
-
http.request(
|
|
406
|
-
"POST",
|
|
407
|
-
path`/guest/orders/${orderId}/order-items/${orderItemId}/downloads`,
|
|
408
|
-
downloadLinkSchema,
|
|
409
|
-
{ body },
|
|
410
|
-
),
|
|
411
|
-
/**
|
|
412
|
-
* 비회원 코드 열람 — 비회원 주문 조회와 같은 연락처·주문 조회 비밀번호로 확인하고 같은 시도 한도를 쓴다.
|
|
413
|
-
* 틀리면 구분 없이 404 `ORDER_NOT_FOUND`다.
|
|
414
|
-
*/
|
|
415
|
-
revealGuestCode: (
|
|
416
|
-
orderId: string,
|
|
417
|
-
orderItemId: string,
|
|
418
|
-
body: { phone: string; orderPassword: string },
|
|
419
|
-
) =>
|
|
420
|
-
http.request(
|
|
421
|
-
"POST",
|
|
422
|
-
path`/guest/orders/${orderId}/order-items/${orderItemId}/fulfillment/reveal`,
|
|
423
|
-
fulfillmentRevealSchema,
|
|
424
|
-
{ body },
|
|
425
|
-
),
|
|
426
370
|
decidePurchase: (orderItemId: string) =>
|
|
427
371
|
http.requestVoid("POST", path`/me/order-items/${orderItemId}/purchase-decision`),
|
|
428
372
|
},
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./schemas/common";
|
|
|
13
13
|
export * from "./schemas/consent";
|
|
14
14
|
export * from "./schemas/coupon";
|
|
15
15
|
export * from "./schemas/customer-inquiry";
|
|
16
|
+
export * from "./schemas/fulfillment";
|
|
16
17
|
export * from "./schemas/inquiry";
|
|
17
18
|
export * from "./schemas/member";
|
|
18
19
|
export * from "./schemas/order";
|
package/src/payments/index.ts
CHANGED
|
@@ -243,8 +243,6 @@ export interface StartOptions {
|
|
|
243
243
|
cashReceipt?: CashReceiptRequest;
|
|
244
244
|
/** 적용할 쿠폰 — 결제 시작이 예약하고 할인한 금액으로 결제한다 */
|
|
245
245
|
coupons?: StartPaymentRequest["coupons"];
|
|
246
|
-
/** 청약철회 제한 동의 — 주문서의 `withdrawal.required`가 true면 true로 보낸다 */
|
|
247
|
-
withdrawalAgreement?: boolean;
|
|
248
246
|
returnUrl?: string;
|
|
249
247
|
mode?: PaymentMode;
|
|
250
248
|
/** 클릭 시점에 {@link Payments.prepareWindow}로 미리 연 창. 폼 검증이 비동기라 클릭 태스크를 넘길 때 쓴다 */
|
|
@@ -534,9 +532,6 @@ export function createPayments(options: PaymentsOptions): Payments {
|
|
|
534
532
|
guest: startOptions.guest,
|
|
535
533
|
...(startOptions.cashReceipt ? { cashReceipt: startOptions.cashReceipt } : {}),
|
|
536
534
|
...(startOptions.coupons ? { coupons: startOptions.coupons } : {}),
|
|
537
|
-
...(startOptions.withdrawalAgreement !== undefined
|
|
538
|
-
? { withdrawalAgreement: startOptions.withdrawalAgreement }
|
|
539
|
-
: {}),
|
|
540
535
|
returnUrl,
|
|
541
536
|
}),
|
|
542
537
|
);
|
package/src/schemas/cart.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { lineFulfillmentSchema } from "./fulfillment";
|
|
3
3
|
|
|
4
4
|
export const cartItemSchema = z.object({
|
|
5
5
|
cartItemId: z.string(),
|
|
@@ -11,7 +11,7 @@ export const cartItemSchema = z.object({
|
|
|
11
11
|
quantity: z.number().int(),
|
|
12
12
|
unitPrice: z.number().int(),
|
|
13
13
|
totalPrice: z.number().int(),
|
|
14
|
-
|
|
14
|
+
fulfillment: lineFulfillmentSchema,
|
|
15
15
|
purchasable: z.boolean(),
|
|
16
16
|
unpurchasableReason: z.enum(["SOLD_OUT", "SUSPENDED", "CLOSED"]).nullable(),
|
|
17
17
|
});
|
|
@@ -24,9 +24,11 @@ export const cartSchema = z.object({
|
|
|
24
24
|
productAmount: z.number().int(),
|
|
25
25
|
deliveryFee: z.number().int(),
|
|
26
26
|
totalAmount: z.number().int(),
|
|
27
|
-
requiresShipping:
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
requiresShipping: z
|
|
28
|
+
.boolean()
|
|
29
|
+
.describe(
|
|
30
|
+
"구매 가능한 항목 중 택배 배송이 필요한 상품이 있는가. false면 배송비가 0이고 주문서가 배송지를 받지 않는다",
|
|
31
|
+
),
|
|
30
32
|
}),
|
|
31
33
|
});
|
|
32
34
|
|
package/src/schemas/catalog.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { type PageParams, pageSchema } from "./common";
|
|
3
|
+
import { productCardFulfillmentSchema, productFulfillmentViewSchema } from "./fulfillment";
|
|
3
4
|
|
|
4
5
|
export interface CategoryNode {
|
|
5
6
|
categoryId: string;
|
|
@@ -28,11 +29,10 @@ export const productCardSchema = z.object({
|
|
|
28
29
|
.nullable()
|
|
29
30
|
.describe("즉시 할인 적용가. 원 단위. 할인이 없으면 null"),
|
|
30
31
|
discountRate: z.number().int().nullable().describe("할인율(%). 할인이 없으면 null"),
|
|
31
|
-
freeShipping: z
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
),
|
|
32
|
+
freeShipping: z
|
|
33
|
+
.boolean()
|
|
34
|
+
.describe("무료배송 배지. 배송 상품이고 배송비가 무료일 때만 true다(배송이 없는 상품은 false)"),
|
|
35
|
+
fulfillment: productCardFulfillmentSchema,
|
|
36
36
|
averageRating: z.number(),
|
|
37
37
|
reviewCount: z.number().int(),
|
|
38
38
|
soldOut: z.boolean(),
|
|
@@ -63,17 +63,8 @@ export const productDetailSchema = productCardSchema.extend({
|
|
|
63
63
|
soldOut: z.boolean(),
|
|
64
64
|
}),
|
|
65
65
|
),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
fee: z.number().int(),
|
|
69
|
-
conditionalFreeAmount: z.number().int().nullable(),
|
|
70
|
-
estimatedDays: z.string(),
|
|
71
|
-
}),
|
|
72
|
-
returnPolicy: z.object({
|
|
73
|
-
returnFee: z.number().int(),
|
|
74
|
-
exchangeFee: z.number().int(),
|
|
75
|
-
periodDays: z.number().int(),
|
|
76
|
-
}),
|
|
66
|
+
fulfillment: productFulfillmentViewSchema,
|
|
67
|
+
returnPeriodDays: z.number().int().describe("반품·교환을 받는 기간(수령·제공일부터 일수)"),
|
|
77
68
|
categoryPath: z.array(z.object({ categoryId: z.string(), name: z.string() })),
|
|
78
69
|
});
|
|
79
70
|
|
package/src/schemas/checkout.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { requiresShippingField } from "./common";
|
|
3
2
|
import { couponApplicationListSchema } from "./coupon";
|
|
3
|
+
import { lineFulfillmentSchema } from "./fulfillment";
|
|
4
4
|
|
|
5
5
|
export const createCheckoutRequestSchema = z
|
|
6
6
|
.object({
|
|
@@ -69,6 +69,7 @@ export const checkoutSessionSchema = z.object({
|
|
|
69
69
|
quantity: z.number().int(),
|
|
70
70
|
unitPrice: z.number().int(),
|
|
71
71
|
totalPrice: z.number().int(),
|
|
72
|
+
fulfillment: lineFulfillmentSchema.describe("주문서 시점 상품 이행"),
|
|
72
73
|
}),
|
|
73
74
|
),
|
|
74
75
|
amounts: z.object({
|
|
@@ -93,25 +94,18 @@ export const checkoutSessionSchema = z.object({
|
|
|
93
94
|
delivery: checkoutDeliverySchema.describe(
|
|
94
95
|
"배송비 내역. 배송지를 입력하면 금액이 바뀔 수 있다 — 최종 금액은 결제 시작 응답의 `amounts`다",
|
|
95
96
|
),
|
|
96
|
-
requiresShipping:
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
requiresShipping: z
|
|
98
|
+
.boolean()
|
|
99
|
+
.describe(
|
|
100
|
+
"택배 배송이 필요한 상품이 있는가. false면 배송지를 받지 않는다 — 결제 시작에 `shippingAddress`를 보내지 않아도 된다",
|
|
101
|
+
),
|
|
99
102
|
withdrawal: z
|
|
100
|
-
.object({
|
|
101
|
-
required: z
|
|
102
|
-
.boolean()
|
|
103
|
-
.describe(
|
|
104
|
-
"청약철회 제한 상품(제공이 시작되면 취소·반품할 수 없는 파일·코드·이용권)이 있는가. true면 `notice`를 결제 전에 보여 주고 " +
|
|
105
|
-
"동의를 받아 결제 시작에 `withdrawalAgreement: true`를 보낸다",
|
|
106
|
-
),
|
|
107
|
-
notice: z
|
|
108
|
-
.string()
|
|
109
|
-
.nullable()
|
|
110
|
-
.describe("구매자에게 보여 줄 고지 문구. `required`가 false면 null"),
|
|
111
|
-
})
|
|
103
|
+
.object({ required: z.boolean(), notice: z.string().nullable() })
|
|
112
104
|
.optional()
|
|
113
|
-
.
|
|
114
|
-
|
|
105
|
+
.describe(
|
|
106
|
+
"**Deprecated** — 항상 `{ required: false, notice: null }`이다. 청약철회 제한 고지를 없앴고(이슈 #48) storefront-sdk 0.15 이하 " +
|
|
107
|
+
"호환으로만 싣는다. 게시된 스토어프론트가 0.16 이상으로 넘어간 뒤 다음 릴리스에서 뺀다",
|
|
108
|
+
),
|
|
115
109
|
expiresAt: z.string(),
|
|
116
110
|
paymentOptions: z
|
|
117
111
|
.lazy(() => paymentOptionListSchema)
|
|
@@ -381,16 +375,9 @@ export const startPaymentRequestSchema = z.object({
|
|
|
381
375
|
.optional()
|
|
382
376
|
.describe(
|
|
383
377
|
"배송지. 주문서의 `requiresShipping`이 true면 필수이고 없으면 400 `SHIPPING_ADDRESS_REQUIRED`다. " +
|
|
384
|
-
"배송이 필요 없는 주문(
|
|
378
|
+
"배송이 필요 없는 주문(배송 없는 상품만)은 보내지 않아도 된다. 보내면 형식을 검사한 뒤 버린다",
|
|
385
379
|
),
|
|
386
380
|
guest: guestInfoSchema.optional(),
|
|
387
|
-
withdrawalAgreement: z
|
|
388
|
-
.boolean()
|
|
389
|
-
.optional()
|
|
390
|
-
.describe(
|
|
391
|
-
"청약철회 제한 동의. 주문서의 `withdrawal.required`가 true면 true여야 하고 아니면 400 `WITHDRAWAL_AGREEMENT_REQUIRED`다. " +
|
|
392
|
-
"동의 시각이 주문에 남는다",
|
|
393
|
-
),
|
|
394
381
|
cashReceipt: cashReceiptField,
|
|
395
382
|
coupons: couponApplicationListSchema
|
|
396
383
|
.optional()
|
package/src/schemas/common.ts
CHANGED
|
@@ -44,33 +44,3 @@ export const claimStatusSchema = z.enum([
|
|
|
44
44
|
]);
|
|
45
45
|
|
|
46
46
|
export type ClaimStatus = z.infer<typeof claimStatusSchema>;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* 상품 유형 (이슈 #48). 응답에서는 문자열로 받는다(값이 추가될 수 있다). 현재 값은 `SHIPPING`(배송 상품)·
|
|
50
|
-
* `DOWNLOAD`(파일 다운로드)·`CODE`(코드 발급)·`SERVICE`(이용권·서비스)·`PICKUP`(방문 수령)이다.
|
|
51
|
-
* 이 필드 이전 서버의 응답에는 없어 `SHIPPING`으로 읽는다. 서버는 항상 싣는다.
|
|
52
|
-
*/
|
|
53
|
-
export const fulfillmentTypeField = () =>
|
|
54
|
-
z
|
|
55
|
-
.string()
|
|
56
|
-
.optional()
|
|
57
|
-
.default("SHIPPING")
|
|
58
|
-
.describe(
|
|
59
|
-
"상품 유형. 현재 값은 `SHIPPING`(배송 상품)·`DOWNLOAD`(파일 다운로드)·`CODE`(코드 발급)·`SERVICE`(이용권·서비스)·" +
|
|
60
|
-
"`PICKUP`(방문 수령)이고 값이 추가될 수 있어 문자열로 받는다. 서버는 항상 싣는다",
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* 배송 필요 여부 (이슈 #48). false면 배송지를 받지 않는다. 이 필드 이전 서버의 응답에는 없어 true로 읽는다.
|
|
65
|
-
*/
|
|
66
|
-
export const requiresShippingField = (description: string) =>
|
|
67
|
-
z.boolean().optional().default(true).describe(`${description} 서버는 항상 싣는다`);
|
|
68
|
-
|
|
69
|
-
/** 배송이 필요한 상품 유형인가 — 배송 상품(`SHIPPING`)만 택배 배송이 있다. 모르는 값은 배송 상품으로 본다 */
|
|
70
|
-
export function isShippingFulfillment(fulfillmentType: string | null | undefined): boolean {
|
|
71
|
-
return (
|
|
72
|
-
fulfillmentType === undefined ||
|
|
73
|
-
fulfillmentType === null ||
|
|
74
|
-
!["DOWNLOAD", "CODE", "SERVICE", "PICKUP"].includes(fulfillmentType)
|
|
75
|
-
);
|
|
76
|
-
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 구매자용 상품 이행 (이슈 #57) — 관리 API의 상품 이행에서 구매자에게 필요한 것만 싣는다. 유형, 배송 필요 여부, 배송 안내(배송비·
|
|
5
|
+
* 무료 기준·반품·교환 배송비)다. 셀러 내부 값(출고지·반품지 id)은 싣지 않는다.
|
|
6
|
+
*
|
|
7
|
+
* 유형은 `SHIPPING`(배송 상품)과 `MANUAL`(배송 없는 상품, 판매자가 제공 처리) 둘이다(이슈 #48 범위 축소).
|
|
8
|
+
* 유형 이름은 응답에서 문자열이고, 모르는 유형(서버가 나중에 더한 유형)은 `{ type: "OTHER", rawType,
|
|
9
|
+
* requiresShipping }`로 읽는다. `requiresShipping`은 판별 값에서 파생되지만 **모든 가지에 싣는다** — 모르는 유형에서도 주문서가
|
|
10
|
+
* 배송지를 받을지 정할 수 있어야 한다.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const KNOWN_TYPES: readonly string[] = ["SHIPPING", "MANUAL"];
|
|
14
|
+
|
|
15
|
+
/** 모르는 유형 — SDK가 아직 모르는 유형이다 */
|
|
16
|
+
export interface UnknownFulfillmentView {
|
|
17
|
+
type: "OTHER";
|
|
18
|
+
/** 서버가 보낸 유형 이름 */
|
|
19
|
+
rawType: string;
|
|
20
|
+
requiresShipping: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** 알려진 유형만 판별 유니온으로 검사하고 모르는 유형은 `OTHER`로 읽는다. 알려진 유형의 모양이 틀리면 파싱 오류다 */
|
|
24
|
+
function openUnion<T extends z.ZodType>(known: T) {
|
|
25
|
+
return z.union([
|
|
26
|
+
known,
|
|
27
|
+
z
|
|
28
|
+
.looseObject({
|
|
29
|
+
type: z.string().refine((type) => !KNOWN_TYPES.includes(type), {
|
|
30
|
+
message: "알려진 유형은 해당 유형의 모양이어야 합니다",
|
|
31
|
+
}),
|
|
32
|
+
requiresShipping: z.boolean(),
|
|
33
|
+
})
|
|
34
|
+
.transform(
|
|
35
|
+
(value): UnknownFulfillmentView => ({
|
|
36
|
+
type: "OTHER",
|
|
37
|
+
rawType: value.type,
|
|
38
|
+
requiresShipping: value.requiresShipping,
|
|
39
|
+
}),
|
|
40
|
+
),
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const requiresShippingDescription =
|
|
45
|
+
"택배 배송이 필요한가. false면 배송비가 없고 주문서가 배송지를 받지 않는다";
|
|
46
|
+
|
|
47
|
+
/** 상품 카드(목록·찜)의 이행 — 유형과 배송 필요 여부만. 배송비·환불 정책은 상세에서 본다 */
|
|
48
|
+
export const productCardFulfillmentSchema = z.object({
|
|
49
|
+
type: z.string().describe("상품 유형. 값이 추가될 수 있어 문자열로 받는다"),
|
|
50
|
+
requiresShipping: z.boolean().describe(requiresShippingDescription),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export type ProductCardFulfillment = z.infer<typeof productCardFulfillmentSchema>;
|
|
54
|
+
|
|
55
|
+
/** 상품 상세의 이행 */
|
|
56
|
+
export const productFulfillmentViewSchema = openUnion(
|
|
57
|
+
z.discriminatedUnion("type", [
|
|
58
|
+
z.object({
|
|
59
|
+
type: z.literal("SHIPPING"),
|
|
60
|
+
requiresShipping: z.literal(true),
|
|
61
|
+
shipping: z.object({
|
|
62
|
+
deliveryType: z
|
|
63
|
+
.string()
|
|
64
|
+
.describe("배송비 유형. 현재 값은 `FREE`·`PAID`·`CONDITIONAL_FREE`"),
|
|
65
|
+
deliveryFee: z
|
|
66
|
+
.number()
|
|
67
|
+
.int()
|
|
68
|
+
.describe("기본 배송비. 원 단위. 묶음·지역 추가 배송비는 장바구니·주문서 견적이 정한다"),
|
|
69
|
+
conditionalFreeAmount: z
|
|
70
|
+
.number()
|
|
71
|
+
.int()
|
|
72
|
+
.nullable()
|
|
73
|
+
.describe("조건부 무료 기준 금액. 조건부 무료가 아니면 null"),
|
|
74
|
+
estimatedDays: z.string().describe("예상 배송 기간 안내 문구"),
|
|
75
|
+
returnDeliveryFee: z
|
|
76
|
+
.number()
|
|
77
|
+
.int()
|
|
78
|
+
.describe("단순 변심 반품 배송비(유효 환불 정책). 원 단위"),
|
|
79
|
+
exchangeDeliveryFee: z
|
|
80
|
+
.number()
|
|
81
|
+
.int()
|
|
82
|
+
.describe("단순 변심 교환 배송비(유효 환불 정책). 원 단위"),
|
|
83
|
+
}),
|
|
84
|
+
}),
|
|
85
|
+
z.object({ type: z.literal("MANUAL"), requiresShipping: z.literal(false) }),
|
|
86
|
+
]),
|
|
87
|
+
).describe(
|
|
88
|
+
"상품 이행. `type`이 유형이고 같은 이름의 키가 유형별 안내다. 값이 추가될 수 있어 SDK는 모르는 유형을 `OTHER`로 읽는다",
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
export type ProductFulfillmentView = z.infer<typeof productFulfillmentViewSchema>;
|
|
92
|
+
|
|
93
|
+
/** 장바구니 줄·주문서 줄의 이행 — 주문서 줄은 주문서 시점 스냅샷이다 */
|
|
94
|
+
export const lineFulfillmentSchema = z.object({
|
|
95
|
+
type: z.string().describe("상품 유형. 값이 추가될 수 있어 문자열로 받는다"),
|
|
96
|
+
requiresShipping: z.boolean().describe(requiresShippingDescription),
|
|
97
|
+
withdrawalRestricted: z
|
|
98
|
+
.boolean()
|
|
99
|
+
.optional()
|
|
100
|
+
.describe(
|
|
101
|
+
"**Deprecated** — 항상 false다. 청약철회 제한 기능을 없앴고(이슈 #48) storefront-sdk 0.15 이하 호환으로만 싣는다. " +
|
|
102
|
+
"게시된 스토어프론트가 0.16 이상으로 넘어간 뒤 다음 릴리스에서 뺀다",
|
|
103
|
+
),
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export type LineFulfillment = z.infer<typeof lineFulfillmentSchema>;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* 내 주문 주문상품의 주문 시점 이행 스냅샷. 상품을 나중에 고쳐도 바뀌지 않는다. 제공 기록(제공 시각·판매자 안내)은
|
|
110
|
+
* 주문상품의 `fulfillment`다.
|
|
111
|
+
*/
|
|
112
|
+
export const myOrderItemFulfillmentSnapshotSchema = openUnion(
|
|
113
|
+
z.discriminatedUnion("type", [
|
|
114
|
+
z.object({ type: z.literal("SHIPPING"), requiresShipping: z.literal(true) }),
|
|
115
|
+
z.object({ type: z.literal("MANUAL"), requiresShipping: z.literal(false) }),
|
|
116
|
+
]),
|
|
117
|
+
).describe("주문 시점 이행 스냅샷. 값이 추가될 수 있어 SDK는 모르는 유형을 `OTHER`로 읽는다");
|
|
118
|
+
|
|
119
|
+
export type MyOrderItemFulfillmentSnapshot = z.infer<typeof myOrderItemFulfillmentSnapshotSchema>;
|