@sayren/storefront-sdk 0.14.0 → 0.15.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-Dsv9C9Zp.mjs} +122 -52
- package/dist/{client-CUF2xGu8.mjs → client-ZPNEEeRT.mjs} +42 -32
- package/dist/{index-dIZNg-hO.d.mts → index-D5uvtiOl.d.mts} +442 -105
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/payments/index.d.mts +1 -1
- package/dist/payments/index.mjs +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/schemas/cart.ts +7 -5
- package/src/schemas/catalog.ts +8 -17
- package/src/schemas/checkout.ts +8 -7
- package/src/schemas/common.ts +0 -30
- package/src/schemas/fulfillment.ts +181 -0
- package/src/schemas/order.ts +11 -27
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 fulfillmentRevealSchema, $n as easyPayProviderSchema, $t as consentSourceSchema, A as ReviewSummary, An as PAYMENT_STATUS_VALUES, Ar as PageInfo, At as CouponApplication, B as updateReviewResultSchema, Bn as ShippingAddressInput, Br 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, DownloadLink, DownloadRequest, EasyPayProvider, FulfillmentReveal, GuestInfo, IdpAgreements, IdpAuthorizeRequest, IdpTokenRequest, KnownPaymentResult, KnownPaymentStatus, LinkIdentityRequest, LoginRequest, MAX_COUPONS_PER_CHECKOUT, MIN_PAYMENT_AMOUNT, Member, MemberAddress, MemberAddressRequest, MemberConsents, MemberIdentities, MyClaim, MyCoupon, MyOrder, MyOrderItem, OrderItemStatus, OrderShippingAddress, PAYMENT_RESULT_VALUES, PAYMENT_STATUS_VALUES, PageInfo, PageParams, PaymentFailureCategory, PaymentMessage, PaymentMethod, PaymentOption, PaymentStart, PaymentStatus, PgProvider, ProductCard, ProductDetail, ProductFacets, 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, 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, downloadLinkSchema, downloadRequestSchema, easyPayProviderResponseSchema, easyPayProviderSchema, fulfillmentRevealSchema,
|
|
2
|
+
import { $ as fulfillmentRevealSchema, $n as easyPayProviderSchema, $r as cartItemSchema, $t as consentSourceSchema, A as ReviewSummary, An as PAYMENT_STATUS_VALUES, Ar as PageInfo, At as CouponApplication, B as updateReviewResultSchema, Bn as ShippingAddressInput, Br as ProductFulfillmentView, Bt as couponBenefitViewSchema, C as StorefrontSession, Cn as DeliveryQuoteRequest, Cr as productCardSchema, Ct as CustomerInquiryCategory, D as CreateReviewResult, Dn as KnownPaymentResult, Dr as productSortSchema, Dt as ApplicableCoupon, E as CreateReviewRequest, En as GuestInfo, Er as productPageSchema, Et as customerInquirySchema, F as createReviewResultSchema, Fn as PaymentStart, Fr as pageSchema, Ft as applicableCouponSchema, G as FulfillmentReveal, Gn as cashReceiptRequestSchema, Gr as productCardFulfillmentSchema, Gt as ConsentAction, H as DeliveryTracking, Hn as availablePaymentOptionSchema, Hr as lineFulfillmentSchema, Ht as myCouponListQuerySchema, I as publicReviewSchema, In as PaymentStatus, Ir as LineFulfillment, It as checkoutPricingRequestSchema, J as OrderShippingAddress, Jn as checkoutSessionSchema, Jr as AddCartItemRequest, Jt as ConsentState, K as MyOrder, Kn as cashReceiptTypeSchema, Kr as productFulfillmentViewSchema, Kt as ConsentKind, L as reviewPageSchema, Ln as PgProvider, Lr as MyOrderItemFulfillmentSnapshot, Lt as checkoutPricingSchema, M as UpdateReviewResult, Mn as PaymentMessage, Mr as claimStatusSchema, Mt as MAX_COUPONS_PER_CHECKOUT, N as WritableReview, Nn as PaymentMethod, Nr as orderItemStatusSchema, Nt as MIN_PAYMENT_AMOUNT, O as PublicReview, On as KnownPaymentStatus, Or as ClaimStatus, Ot as CheckoutPricing, P as createReviewRequestSchema, Pn as PaymentOption, Pr as pageInfoSchema, Pt as MyCoupon, Q as downloadRequestSchema, Qn as easyPayProviderResponseSchema, Qr as addCartItemRequestSchema, Qt as consentKindSchema, R as reviewSummarySchema, Rn as RemoteArea, Rr as PickupLocation, Rt as couponApplicationListSchema, S as SessionStorage, Sn as CreateCheckoutRequest, Sr as categoryNodeSchema, St as CustomerInquiry, T as createStorefrontSession, Tn as EasyPayProvider, Tr as productFacetsSchema, Tt as customerInquiryCategorySchema, U as DownloadLink, Un as cashReceiptAvailable, Ur as myOrderItemFulfillmentSnapshotSchema, Ut as myCouponSchema, V as writableReviewSchema, Vn as StartPaymentRequest, Vr as UnknownFulfillmentView, Vt as couponResultSchema, W as DownloadRequest, Wn as cashReceiptIdentityTypeOf, Wr as pickupLocationSchema, Wt as pricingAmountsSchema, X as deliveryTrackingSchema, Xn as deliveryQuoteRequestSchema, Xr as CartItem, Xt as MemberConsents, Y as PurchaseDecisionResult, Yn as createCheckoutRequestSchema, Yr as Cart, Yt as ConsentUpdateRequest, Z as downloadLinkSchema, Zn as deliveryQuoteSchema, Zr as UpdateCartItemRequest, Zt as consentActionSchema, _ as analyticsServerEventNameSchema, _n as CashReceiptIdentityType, _r as ProductDetail, _t as PublicInquiry, a as ANALYTICS_SESSION_HEADER, an as ClaimType, ar as paymentOptionListSchema, at as Member, b as createStorefrontClient, bn as CheckoutDelivery, br as ProductSearchParams, bt as publicInquirySchema, c as AnalyticsBatch, cn as MyClaim, cr as paymentStatusSchema, ct as UpdateProfileRequest, d as AnalyticsEventName, dn as claimTypeSchema, dr as residentNumberLike, dt as memberAddressSchema, ei as cartSchema, en as consentStateSchema, er as guestInfoSchema, et as myOrderItemSchema, f as AnalyticsServerEventName, fn as createClaimRequestSchema, fr as retryPaymentRequestSchema, ft as memberSchema, g as analyticsIdSchema, gn as CASH_RECEIPT_METHODS, gr as ProductCard, gt as CreateInquiryResult, h as analyticsClientEventSchema, hn as AvailablePaymentOption, hr as CategoryNode, ht as CreateInquiryRequest, i as ANALYTICS_SESSION_COOKIE, in as ClaimReturnAddress, ir as paymentOptionKey, it as trackingStageResponseSchema, j as UpdateReviewRequest, jn as PaymentFailureCategory, jr as PageParams, jt as CouponResult, k as ReviewPage, kn as PAYMENT_RESULT_VALUES, kr as OrderItemStatus, kt as CheckoutPricingRequest, l as AnalyticsClientEvent, ln as claimReasonSchema, lr as pgProviderSchema, lt as WishlistAddResult, m as analyticsClientEventNameSchema, mn as myClaimSchema, mr as startPaymentRequestSchema, mt as wishlistAddResultSchema, n as storefrontStoreSchema, ni as analyticsIdsFromCookie, nn as memberConsentsSchema, nr as paymentMessageSchema, nt as orderShippingAddressSchema, o as ANALYTICS_VISITOR_COOKIE, on as CreateClaimRequest, or as paymentOptionSchema, ot as MemberAddress, p as analyticsBatchSchema, pn as createClaimResultSchema, pr as shippingAddressInputSchema, pt as updateProfileRequestSchema, q as MyOrderItem, qn as checkoutDeliverySchema, qr as withdrawalRestrictedOfView, qt as ConsentSource, r as ANALYTICS_MAX_BATCH_BYTES, rn as ClaimReason, rr as paymentMethodSchema, rt as purchaseDecisionResultSchema, s as ANALYTICS_VISITOR_HEADER, sn as CreateClaimResult, sr as paymentStartSchema, st as MemberAddressRequest, t as StorefrontStore, ti as updateCartItemRequestSchema, tn as consentUpdateRequestSchema, tr as paymentFailureCategorySchema, tt as myOrderSchema, u as AnalyticsClientEventName, un as claimReturnAddressSchema, ur as remoteAreaSchema, ut as memberAddressRequestSchema, v as StorefrontClient, vn as CashReceiptRequest, vr as ProductFacets, vt as createInquiryRequestSchema, w as StorefrontSessionOptions, wn as DeliveryQuoteResult, wr as productDetailSchema, wt as createCustomerInquiryRequestSchema, x as STOREFRONT_SESSION_KEYS, xn as CheckoutSession, xr as ProductSort, xt as CreateCustomerInquiryRequest, y as StorefrontClientOptions, yn as CashReceiptType, yr as ProductPage, yt as createInquiryResultSchema, z as updateReviewRequestSchema, zn as RetryPaymentRequest, zr as ProductCardFulfillment, zt as couponApplicationSchema } from "./index-D5uvtiOl.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, DownloadLink, DownloadRequest, EasyPayProvider, FulfillmentReveal, 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, PickupLocation, 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, downloadLinkSchema, downloadRequestSchema, easyPayProviderResponseSchema, easyPayProviderSchema, fulfillmentRevealSchema, 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, pickupLocationSchema, 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, withdrawalRestrictedOfView, 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 addCartItemRequestSchema, A as customerInquirySchema, B as createClaimRequestSchema, C as updateProfileRequestSchema, D as publicInquirySchema, E as createInquiryResultSchema, F as consentUpdateRequestSchema, G as productDetailSchema, H as myClaimSchema, I as memberConsentsSchema, J as productSortSchema, K as productFacetsSchema, L as claimReasonSchema, M as consentKindSchema, N as consentSourceSchema, O as createCustomerInquiryRequestSchema, P as consentStateSchema, Q as pageSchema, R as claimReturnAddressSchema, S as memberSchema, T as createInquiryRequestSchema, U as categoryNodeSchema, V as createClaimResultSchema, W as productCardSchema, X as orderItemStatusSchema, Y as claimStatusSchema, Z as pageInfoSchema, _ as orderShippingAddressSchema, _t as buildQuery, a as publicReviewSchema, at as idpAuthorizeRequestSchema, b as memberAddressRequestSchema, c as updateReviewRequestSchema, ct as linkIdentityRequestSchema, d as deliveryTrackingSchema, dt as signupRequestSchema, et as cartItemSchema, f as downloadLinkSchema, ft as socialProviderSchema, g as myOrderSchema, gt as ApiError, h as myOrderItemSchema, ht as withdrawalBlockedDetailsSchema, i as createReviewResultSchema, it as idpAgreementsSchema, j as consentActionSchema, k as customerInquiryCategorySchema, l as updateReviewResultSchema, lt as loginRequestSchema, m as fulfillmentRevealSchema, mt as withdrawRequestSchema, n as storefrontStoreSchema, nt as updateCartItemRequestSchema, o as reviewPageSchema, ot as idpAuthorizeResponseSchema, p as downloadRequestSchema, pt as tokenPairSchema, q as productPageSchema, r as createReviewRequestSchema, rt as anonymousSessionSchema, s as reviewSummarySchema, st as idpTokenRequestSchema, t as createStorefrontClient, tt as cartSchema, u as writableReviewSchema, ut as memberIdentitiesSchema, v as purchaseDecisionResultSchema, vt as toApiError, w as wishlistAddResultSchema, x as memberAddressSchema, y as trackingStageResponseSchema, yt as unwrapData, z as claimTypeSchema } from "./client-ZPNEEeRT.mjs";
|
|
4
|
+
import { A as startPaymentRequestSchema, B as myCouponListQuerySchema, C as paymentStartSchema, D as residentNumberLike, E as remoteAreaSchema, F as checkoutPricingSchema, G as pickupLocationSchema, H as pricingAmountsSchema, I as couponApplicationListSchema, J as withdrawalRestrictedOfView, K as productCardFulfillmentSchema, 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, q as productFulfillmentViewSchema, 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-Dsv9C9Zp.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, downloadLinkSchema, downloadRequestSchema, easyPayProviderResponseSchema, easyPayProviderSchema, fulfillmentRevealSchema,
|
|
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, downloadLinkSchema, downloadRequestSchema, easyPayProviderResponseSchema, easyPayProviderSchema, fulfillmentRevealSchema, 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, pickupLocationSchema, 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, withdrawalRestrictedOfView, writableReviewSchema };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Bn as ShippingAddressInput, En as GuestInfo, Fn as PaymentStart, In as PaymentStatus, Pn as PaymentOption, Vn as StartPaymentRequest, b as createStorefrontClient, vn as CashReceiptRequest } from "../index-
|
|
1
|
+
import { Bn as ShippingAddressInput, En as GuestInfo, Fn as PaymentStart, In as PaymentStatus, Pn as PaymentOption, Vn as StartPaymentRequest, b as createStorefrontClient, vn as CashReceiptRequest } from "../index-D5uvtiOl.mjs";
|
|
2
2
|
//#region src/payments/index.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* 스토어프론트 결제 — 브라우저 전용(`@sayren/storefront-sdk/payments`).
|
package/dist/payments/index.mjs
CHANGED
package/package.json
CHANGED
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/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,9 +94,11 @@ 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
103
|
.object({
|
|
101
104
|
required: z
|
|
@@ -109,9 +112,7 @@ export const checkoutSessionSchema = z.object({
|
|
|
109
112
|
.nullable()
|
|
110
113
|
.describe("구매자에게 보여 줄 고지 문구. `required`가 false면 null"),
|
|
111
114
|
})
|
|
112
|
-
.
|
|
113
|
-
.default({ required: false, notice: null })
|
|
114
|
-
.describe("청약철회 제한 고지(이슈 #48). 서버는 항상 싣는다"),
|
|
115
|
+
.describe("청약철회 제한 고지(이슈 #48)"),
|
|
115
116
|
expiresAt: z.string(),
|
|
116
117
|
paymentOptions: z
|
|
117
118
|
.lazy(() => paymentOptionListSchema)
|
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,181 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 구매자용 상품 이행 (이슈 #57) — 관리 API의 상품 이행에서 구매자에게 필요한 것만 싣는다. 유형, 배송 필요 여부, 배송 안내(배송비·
|
|
5
|
+
* 무료 기준·반품·교환 배송비), 청약철회 제한 여부, 방문 수령지 표시값이다. 셀러 내부 값(출고지·반품지 id, 코드 풀 여부, 재고 추적 여부)은
|
|
6
|
+
* 싣지 않는다.
|
|
7
|
+
*
|
|
8
|
+
* 유형 이름은 응답에서 문자열이고, 모르는 유형(서버가 나중에 더한 유형, 예: #56 `RESERVATION`)은 `{ type: "OTHER", rawType,
|
|
9
|
+
* requiresShipping }`로 읽는다. `requiresShipping`은 판별 값에서 파생되지만 **모든 가지에 싣는다** — 모르는 유형에서도 주문서가
|
|
10
|
+
* 배송지를 받을지 정할 수 있어야 한다.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const KNOWN_TYPES: readonly string[] = ["SHIPPING", "DOWNLOAD", "CODE", "SERVICE", "PICKUP"];
|
|
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
|
+
const withdrawalRestrictedField = z
|
|
48
|
+
.boolean()
|
|
49
|
+
.describe(
|
|
50
|
+
"청약철회 제한 대상인가. true면 주문서가 제한 고지 동의를 받고, 첫 다운로드·열람 뒤 단순 변심 취소·반품을 받지 않는다",
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
/** 방문 수령 장소 표시값 — 주소 id는 싣지 않는다 */
|
|
54
|
+
export const pickupLocationSchema = z.object({
|
|
55
|
+
name: z.string().describe("수령 장소 이름"),
|
|
56
|
+
zipCode: z.string(),
|
|
57
|
+
address1: z.string(),
|
|
58
|
+
address2: z.string().nullable(),
|
|
59
|
+
phone: z.string().describe("수령 장소 연락처"),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export type PickupLocation = z.infer<typeof pickupLocationSchema>;
|
|
63
|
+
|
|
64
|
+
/** 상품 카드(목록·찜)의 이행 — 유형과 배송 필요 여부만. 배송비·환불 정책은 상세에서 본다 */
|
|
65
|
+
export const productCardFulfillmentSchema = z.object({
|
|
66
|
+
type: z.string().describe("상품 유형. 값이 추가될 수 있어 문자열로 받는다"),
|
|
67
|
+
requiresShipping: z.boolean().describe(requiresShippingDescription),
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export type ProductCardFulfillment = z.infer<typeof productCardFulfillmentSchema>;
|
|
71
|
+
|
|
72
|
+
/** 상품 상세의 이행 */
|
|
73
|
+
export const productFulfillmentViewSchema = openUnion(
|
|
74
|
+
z.discriminatedUnion("type", [
|
|
75
|
+
z.object({
|
|
76
|
+
type: z.literal("SHIPPING"),
|
|
77
|
+
requiresShipping: z.literal(true),
|
|
78
|
+
shipping: z.object({
|
|
79
|
+
deliveryType: z
|
|
80
|
+
.string()
|
|
81
|
+
.describe("배송비 유형. 현재 값은 `FREE`·`PAID`·`CONDITIONAL_FREE`"),
|
|
82
|
+
deliveryFee: z
|
|
83
|
+
.number()
|
|
84
|
+
.int()
|
|
85
|
+
.describe("기본 배송비. 원 단위. 묶음·지역 추가 배송비는 장바구니·주문서 견적이 정한다"),
|
|
86
|
+
conditionalFreeAmount: z
|
|
87
|
+
.number()
|
|
88
|
+
.int()
|
|
89
|
+
.nullable()
|
|
90
|
+
.describe("조건부 무료 기준 금액. 조건부 무료가 아니면 null"),
|
|
91
|
+
estimatedDays: z.string().describe("예상 배송 기간 안내 문구"),
|
|
92
|
+
returnDeliveryFee: z
|
|
93
|
+
.number()
|
|
94
|
+
.int()
|
|
95
|
+
.describe("단순 변심 반품 배송비(유효 환불 정책). 원 단위"),
|
|
96
|
+
exchangeDeliveryFee: z
|
|
97
|
+
.number()
|
|
98
|
+
.int()
|
|
99
|
+
.describe("단순 변심 교환 배송비(유효 환불 정책). 원 단위"),
|
|
100
|
+
}),
|
|
101
|
+
}),
|
|
102
|
+
z.object({
|
|
103
|
+
type: z.literal("DOWNLOAD"),
|
|
104
|
+
requiresShipping: z.literal(false),
|
|
105
|
+
download: z.object({
|
|
106
|
+
limit: z.number().int().describe("다운로드 횟수 한도(수량 1개당)"),
|
|
107
|
+
days: z.number().int().describe("다운로드 기간(제공일부터 일수)"),
|
|
108
|
+
withdrawalRestricted: withdrawalRestrictedField,
|
|
109
|
+
}),
|
|
110
|
+
}),
|
|
111
|
+
z.object({
|
|
112
|
+
type: z.literal("CODE"),
|
|
113
|
+
requiresShipping: z.literal(false),
|
|
114
|
+
code: z.object({ withdrawalRestricted: withdrawalRestrictedField }),
|
|
115
|
+
}),
|
|
116
|
+
z.object({ type: z.literal("SERVICE"), requiresShipping: z.literal(false) }),
|
|
117
|
+
z.object({
|
|
118
|
+
type: z.literal("PICKUP"),
|
|
119
|
+
requiresShipping: z.literal(false),
|
|
120
|
+
pickup: z.object({
|
|
121
|
+
location: pickupLocationSchema
|
|
122
|
+
.nullable()
|
|
123
|
+
.describe("방문 수령 장소. 수령지가 지워졌으면 null이다(판매자에게 문의)"),
|
|
124
|
+
}),
|
|
125
|
+
}),
|
|
126
|
+
]),
|
|
127
|
+
).describe(
|
|
128
|
+
"상품 이행. `type`이 유형이고 같은 이름의 키가 유형별 안내다. 값이 추가될 수 있어 SDK는 모르는 유형을 `OTHER`로 읽는다",
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
export type ProductFulfillmentView = z.infer<typeof productFulfillmentViewSchema>;
|
|
132
|
+
|
|
133
|
+
/** 장바구니 줄·주문서 줄의 이행 — 주문서 줄은 주문서 시점 스냅샷이다 */
|
|
134
|
+
export const lineFulfillmentSchema = z.object({
|
|
135
|
+
type: z.string().describe("상품 유형. 값이 추가될 수 있어 문자열로 받는다"),
|
|
136
|
+
requiresShipping: z.boolean().describe(requiresShippingDescription),
|
|
137
|
+
withdrawalRestricted: withdrawalRestrictedField,
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
export type LineFulfillment = z.infer<typeof lineFulfillmentSchema>;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* 내 주문 주문상품의 주문 시점 이행 스냅샷. 상품을 나중에 고쳐도 바뀌지 않는다. 실제 제공 기록(코드 가린 값·다운로드 남은 횟수)은
|
|
144
|
+
* 주문상품의 `fulfillment`다.
|
|
145
|
+
*/
|
|
146
|
+
export const myOrderItemFulfillmentSnapshotSchema = openUnion(
|
|
147
|
+
z.discriminatedUnion("type", [
|
|
148
|
+
z.object({ type: z.literal("SHIPPING"), requiresShipping: z.literal(true) }),
|
|
149
|
+
z.object({
|
|
150
|
+
type: z.literal("DOWNLOAD"),
|
|
151
|
+
requiresShipping: z.literal(false),
|
|
152
|
+
download: z.object({ withdrawalRestricted: withdrawalRestrictedField }),
|
|
153
|
+
}),
|
|
154
|
+
z.object({
|
|
155
|
+
type: z.literal("CODE"),
|
|
156
|
+
requiresShipping: z.literal(false),
|
|
157
|
+
code: z.object({ withdrawalRestricted: withdrawalRestrictedField }),
|
|
158
|
+
}),
|
|
159
|
+
z.object({ type: z.literal("SERVICE"), requiresShipping: z.literal(false) }),
|
|
160
|
+
z.object({
|
|
161
|
+
type: z.literal("PICKUP"),
|
|
162
|
+
requiresShipping: z.literal(false),
|
|
163
|
+
pickup: z.object({
|
|
164
|
+
location: pickupLocationSchema
|
|
165
|
+
.nullable()
|
|
166
|
+
.describe("주문 시점 방문 수령 장소. 수령지가 지워졌으면 null이다(판매자에게 문의)"),
|
|
167
|
+
}),
|
|
168
|
+
}),
|
|
169
|
+
]),
|
|
170
|
+
).describe("주문 시점 이행 스냅샷. 값이 추가될 수 있어 SDK는 모르는 유형을 `OTHER`로 읽는다");
|
|
171
|
+
|
|
172
|
+
export type MyOrderItemFulfillmentSnapshot = z.infer<typeof myOrderItemFulfillmentSnapshotSchema>;
|
|
173
|
+
|
|
174
|
+
/** 청약철회 제한 대상인가 — 파일 다운로드·코드 발급만 켤 수 있다 */
|
|
175
|
+
export function withdrawalRestrictedOfView(
|
|
176
|
+
fulfillment: ProductFulfillmentView | MyOrderItemFulfillmentSnapshot,
|
|
177
|
+
): boolean {
|
|
178
|
+
if (fulfillment.type === "DOWNLOAD") return fulfillment.download.withdrawalRestricted;
|
|
179
|
+
if (fulfillment.type === "CODE") return fulfillment.code.withdrawalRestricted;
|
|
180
|
+
return false;
|
|
181
|
+
}
|
package/src/schemas/order.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { easyPayProviderResponseSchema, paymentMethodSchema } from "./checkout";
|
|
3
|
-
import {
|
|
3
|
+
import { orderItemStatusSchema } from "./common";
|
|
4
|
+
import { myOrderItemFulfillmentSnapshotSchema } from "./fulfillment";
|
|
4
5
|
|
|
5
6
|
export const myOrderItemSchema = z.object({
|
|
6
7
|
orderItemId: z.string(),
|
|
@@ -30,14 +31,10 @@ export const myOrderItemSchema = z.object({
|
|
|
30
31
|
"이 주문상품에 배분된 쿠폰 할인. 실결제 금액은 `totalPrice − couponDiscountAmount`다. 쿠폰이 없으면 0. 서버는 항상 싣는다",
|
|
31
32
|
),
|
|
32
33
|
status: orderItemStatusSchema,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.default(false)
|
|
38
|
-
.describe(
|
|
39
|
-
"청약철회 제한 주문상품인가(이슈 #48). 구매자가 결제 전에 동의했고 제공이 시작되면(다운로드·열람·이용 시작) 구매자 취소·반품을 받지 않는다. 서버는 항상 싣는다",
|
|
40
|
-
),
|
|
34
|
+
fulfillmentSnapshot: myOrderItemFulfillmentSnapshotSchema.describe(
|
|
35
|
+
"주문 시점 이행 스냅샷(이슈 #57). `type`이 주문 시점 상품 유형이다. 배송 상품이 아니면 `DELIVERED`는 제공 완료(방문 수령은 수령 완료)다. " +
|
|
36
|
+
"청약철회 제한 주문상품(`download`·`code`의 `withdrawalRestricted`)은 제공이 시작되면(다운로드·열람) 구매자 취소·반품을 받지 않는다",
|
|
37
|
+
),
|
|
41
38
|
fulfillment: z
|
|
42
39
|
.object({
|
|
43
40
|
status: z
|
|
@@ -87,21 +84,6 @@ export const myOrderItemSchema = z.object({
|
|
|
87
84
|
"비실물 상품(이용권·방문 수령 등)의 제공 정보(이슈 #48). 제공 전이거나 배송 상품이면 null이다. " +
|
|
88
85
|
"비실물의 `DELIVERED`는 제공 완료(방문 수령은 수령 완료)로 표시한다. 서버는 항상 싣는다",
|
|
89
86
|
),
|
|
90
|
-
pickupLocation: z
|
|
91
|
-
.object({
|
|
92
|
-
name: z.string().describe("수령 장소 이름"),
|
|
93
|
-
zipCode: z.string(),
|
|
94
|
-
address1: z.string(),
|
|
95
|
-
address2: z.string().nullable(),
|
|
96
|
-
phone: z.string().describe("수령 장소 연락처"),
|
|
97
|
-
})
|
|
98
|
-
.nullable()
|
|
99
|
-
.optional()
|
|
100
|
-
.default(null)
|
|
101
|
-
.describe(
|
|
102
|
-
"방문 수령 장소(이슈 #48). 방문 수령 상품(`fulfillmentType` = `PICKUP`)이고 셀러가 수령지를 지정했을 때만 있다. " +
|
|
103
|
-
"상품의 현재 수령지다. 서버는 항상 싣는다",
|
|
104
|
-
),
|
|
105
87
|
claimStatus: z.string().nullable(),
|
|
106
88
|
reviewWritten: z.boolean(),
|
|
107
89
|
autoDecisionDate: z.string().nullable(),
|
|
@@ -132,9 +114,11 @@ export const myOrderSchema = z.object({
|
|
|
132
114
|
orderId: z.string(),
|
|
133
115
|
orderedAt: z.string(),
|
|
134
116
|
items: z.array(myOrderItemSchema),
|
|
135
|
-
requiresShipping:
|
|
136
|
-
|
|
137
|
-
|
|
117
|
+
requiresShipping: z
|
|
118
|
+
.boolean()
|
|
119
|
+
.describe(
|
|
120
|
+
"택배 배송이 필요한 주문상품이 있는가. false면 `shippingAddress`는 주문자 이름·연락처만 있고 주소는 빈 문자열이다",
|
|
121
|
+
),
|
|
138
122
|
shippingAddress: orderShippingAddressSchema,
|
|
139
123
|
payment: z.object({
|
|
140
124
|
method: paymentMethodSchema.describe(
|