@sayren/storefront-sdk 0.12.0 → 0.14.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-BeZKjYJz.mjs → checkout-wrCpR-P1.mjs} +165 -5
- package/dist/{client-DkyvDLXK.mjs → client-CUF2xGu8.mjs} +130 -46
- package/dist/{index-SXEtj3N5.d.mts → index-dIZNg-hO.d.mts} +698 -127
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/payments/index.d.mts +7 -2
- package/dist/payments/index.mjs +3 -1
- package/package.json +1 -1
- package/src/client.ts +89 -1
- package/src/index.ts +1 -0
- package/src/payments/index.ts +11 -1
- package/src/schemas/cart.ts +5 -0
- package/src/schemas/catalog.ts +5 -1
- package/src/schemas/checkout.ts +59 -2
- package/src/schemas/claim.ts +21 -2
- package/src/schemas/common.ts +30 -0
- package/src/schemas/coupon.ts +169 -0
- package/src/schemas/order.ts +162 -3
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, AvailablePaymentOption, CASH_RECEIPT_METHODS, Cart, CartItem, CashReceiptIdentityType, CashReceiptRequest, CashReceiptType, CategoryNode, CheckoutDelivery, CheckoutSession, ClaimReason, ClaimReturnAddress, ClaimStatus, ClaimType, ConsentAction, ConsentKind, ConsentSource, ConsentState, ConsentUpdateRequest, CreateCheckoutRequest, CreateClaimRequest, CreateClaimResult, CreateCustomerInquiryRequest, CreateInquiryRequest, CreateInquiryResult, CreateReviewRequest, CreateReviewResult, CustomerInquiry, CustomerInquiryCategory, DeliveryQuoteRequest, DeliveryQuoteResult, DeliveryTracking, EasyPayProvider, GuestInfo, IdpAgreements, IdpAuthorizeRequest, IdpTokenRequest, KnownPaymentResult, KnownPaymentStatus, LinkIdentityRequest, LoginRequest, Member, MemberAddress, MemberAddressRequest, MemberConsents, MemberIdentities, MyClaim, 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, availablePaymentOptionSchema, buildQuery, cartItemSchema, cartSchema, cashReceiptAvailable, cashReceiptIdentityTypeOf, cashReceiptRequestSchema, cashReceiptTypeSchema, categoryNodeSchema, checkoutDeliverySchema, checkoutSessionSchema, claimReasonSchema, claimReturnAddressSchema, claimStatusSchema, claimTypeSchema, consentActionSchema, consentKindSchema, consentSourceSchema, consentStateSchema, consentUpdateRequestSchema, createCheckoutRequestSchema, createClaimRequestSchema, createClaimResultSchema, createCustomerInquiryRequestSchema, createInquiryRequestSchema, createInquiryResultSchema, createReviewRequestSchema, createReviewResultSchema, createStorefrontClient, createStorefrontSession, customerInquiryCategorySchema, customerInquirySchema, deliveryQuoteRequestSchema, deliveryQuoteSchema, deliveryTrackingSchema, easyPayProviderResponseSchema, easyPayProviderSchema, guestInfoSchema, idpAgreementsSchema, idpAuthorizeRequestSchema, idpAuthorizeResponseSchema, idpTokenRequestSchema, linkIdentityRequestSchema, loginRequestSchema, memberAddressRequestSchema, memberAddressSchema, memberConsentsSchema, memberIdentitiesSchema, memberSchema, myClaimSchema, myOrderItemSchema, myOrderSchema, orderItemStatusSchema, orderShippingAddressSchema, pageInfoSchema, pageSchema, paymentFailureCategorySchema, paymentMessageSchema, paymentMethodSchema, paymentOptionKey, paymentOptionListSchema, paymentOptionSchema, paymentStartSchema, paymentStatusSchema, pgProviderSchema, productCardSchema, productDetailSchema, productFacetsSchema, 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 };
|
|
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 Cart, 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 orderItemStatusSchema, Ft as applicableCouponSchema, G as FulfillmentReveal, Gn as cashReceiptRequestSchema, Gr as cartSchema, Gt as ConsentAction, H as DeliveryTracking, Hn as availablePaymentOptionSchema, Hr as UpdateCartItemRequest, Ht as myCouponListQuerySchema, I as publicReviewSchema, In as PaymentStatus, Ir as pageInfoSchema, It as checkoutPricingRequestSchema, J as OrderShippingAddress, Jn as checkoutSessionSchema, Jt as ConsentState, K as MyOrder, Kn as cashReceiptTypeSchema, Kr as updateCartItemRequestSchema, Kt as ConsentKind, L as reviewPageSchema, Ln as PgProvider, Lr as pageSchema, 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 fulfillmentTypeField, 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 isShippingFulfillment, Pt as MyCoupon, Q as downloadRequestSchema, Qn as easyPayProviderResponseSchema, Qt as consentKindSchema, R as reviewSummarySchema, Rn as RemoteArea, Rr as requiresShippingField, 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 addCartItemRequestSchema, Ut as myCouponSchema, V as writableReviewSchema, Vn as StartPaymentRequest, Vr as CartItem, Vt as couponResultSchema, W as DownloadRequest, Wn as cashReceiptIdentityTypeOf, Wr as cartItemSchema, Wt as pricingAmountsSchema, X as deliveryTrackingSchema, Xn as deliveryQuoteRequestSchema, Xt as MemberConsents, Y as PurchaseDecisionResult, Yn as createCheckoutRequestSchema, Yt as ConsentUpdateRequest, Z as downloadLinkSchema, Zn as deliveryQuoteSchema, 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, 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, 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 analyticsIdsFromCookie, 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, 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 AddCartItemRequest, zt as couponApplicationSchema } from "./index-dIZNg-hO.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, 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, fulfillmentTypeField, guestInfoSchema, idpAgreementsSchema, idpAuthorizeRequestSchema, idpAuthorizeResponseSchema, idpTokenRequestSchema, isShippingFulfillment, linkIdentityRequestSchema, loginRequestSchema, memberAddressRequestSchema, memberAddressSchema, memberConsentsSchema, memberIdentitiesSchema, memberSchema, myClaimSchema, myCouponListQuerySchema, myCouponSchema, myOrderItemSchema, myOrderSchema, orderItemStatusSchema, orderShippingAddressSchema, pageInfoSchema, pageSchema, paymentFailureCategorySchema, paymentMessageSchema, paymentMethodSchema, paymentOptionKey, paymentOptionListSchema, paymentOptionSchema, paymentStartSchema, paymentStatusSchema, pgProviderSchema, pricingAmountsSchema, productCardSchema, productDetailSchema, productFacetsSchema, productPageSchema, productSortSchema, publicInquirySchema, publicReviewSchema, purchaseDecisionResultSchema, remoteAreaSchema, requiresShippingField, 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, C as paymentStartSchema, D as residentNumberLike, E as remoteAreaSchema, O as retryPaymentRequestSchema, S as paymentOptionSchema, T as pgProviderSchema, _ 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, 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 } from "./checkout-
|
|
3
|
+
import { $ as anonymousSessionSchema, 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 updateCartItemRequestSchema, R as claimReturnAddressSchema, S as memberSchema, T as createInquiryRequestSchema, U as categoryNodeSchema, V as createClaimResultSchema, W as productCardSchema, X as cartItemSchema, Y as addCartItemRequestSchema, Z as cartSchema, _ as orderShippingAddressSchema, a as publicReviewSchema, at as loginRequestSchema, b as memberAddressRequestSchema, c as updateReviewRequestSchema, ct as socialProviderSchema, d as deliveryTrackingSchema, dt as withdrawalBlockedDetailsSchema, et as idpAgreementsSchema, f as downloadLinkSchema, ft as ApiError, g as myOrderSchema, h as myOrderItemSchema, ht as unwrapData, i as createReviewResultSchema, it as linkIdentityRequestSchema, j as consentActionSchema, k as customerInquiryCategorySchema, l as updateReviewResultSchema, lt as tokenPairSchema, m as fulfillmentRevealSchema, mt as toApiError, n as storefrontStoreSchema, nt as idpAuthorizeResponseSchema, o as reviewPageSchema, ot as memberIdentitiesSchema, p as downloadRequestSchema, pt as buildQuery, q as productPageSchema, r as createReviewRequestSchema, rt as idpTokenRequestSchema, s as reviewSummarySchema, st as signupRequestSchema, t as createStorefrontClient, tt as idpAuthorizeRequestSchema, u as writableReviewSchema, ut as withdrawRequestSchema, v as purchaseDecisionResultSchema, w as wishlistAddResultSchema, x as memberAddressSchema, y as trackingStageResponseSchema, z as claimTypeSchema } from "./client-CUF2xGu8.mjs";
|
|
4
|
+
import { A as startPaymentRequestSchema, B as myCouponListQuerySchema, C as paymentStartSchema, D as residentNumberLike, E as remoteAreaSchema, F as checkoutPricingSchema, G as isShippingFulfillment, H as pricingAmountsSchema, I as couponApplicationListSchema, J as pageSchema, K as orderItemStatusSchema, 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 claimStatusSchema, V as myCouponSchema, W as fulfillmentTypeField, Y as requiresShippingField, _ 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 pageInfoSchema, 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-wrCpR-P1.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, PAYMENT_RESULT_VALUES, PAYMENT_STATUS_VALUES, STOREFRONT_SESSION_KEYS, addCartItemRequestSchema, analyticsBatchSchema, analyticsClientEventNameSchema, analyticsClientEventSchema, analyticsIdSchema, analyticsIdsFromCookie, analyticsServerEventNameSchema, anonymousSessionSchema, availablePaymentOptionSchema, buildQuery, cartItemSchema, cartSchema, cashReceiptAvailable, cashReceiptIdentityTypeOf, cashReceiptRequestSchema, cashReceiptTypeSchema, categoryNodeSchema, checkoutDeliverySchema, checkoutSessionSchema, claimReasonSchema, claimReturnAddressSchema, claimStatusSchema, claimTypeSchema, consentActionSchema, consentKindSchema, consentSourceSchema, consentStateSchema, consentUpdateRequestSchema, createCheckoutRequestSchema, createClaimRequestSchema, createClaimResultSchema, createCustomerInquiryRequestSchema, createInquiryRequestSchema, createInquiryResultSchema, createReviewRequestSchema, createReviewResultSchema, createStorefrontClient, createStorefrontSession, customerInquiryCategorySchema, customerInquirySchema, deliveryQuoteRequestSchema, deliveryQuoteSchema, deliveryTrackingSchema, easyPayProviderResponseSchema, easyPayProviderSchema, guestInfoSchema, idpAgreementsSchema, idpAuthorizeRequestSchema, idpAuthorizeResponseSchema, idpTokenRequestSchema, linkIdentityRequestSchema, loginRequestSchema, memberAddressRequestSchema, memberAddressSchema, memberConsentsSchema, memberIdentitiesSchema, memberSchema, myClaimSchema, myOrderItemSchema, myOrderSchema, orderItemStatusSchema, orderShippingAddressSchema, pageInfoSchema, pageSchema, paymentFailureCategorySchema, paymentMessageSchema, paymentMethodSchema, paymentOptionKey, paymentOptionListSchema, paymentOptionSchema, paymentStartSchema, paymentStatusSchema, pgProviderSchema, productCardSchema, productDetailSchema, productFacetsSchema, 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 };
|
|
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, fulfillmentTypeField, guestInfoSchema, idpAgreementsSchema, idpAuthorizeRequestSchema, idpAuthorizeResponseSchema, idpTokenRequestSchema, isShippingFulfillment, linkIdentityRequestSchema, loginRequestSchema, memberAddressRequestSchema, memberAddressSchema, memberConsentsSchema, memberIdentitiesSchema, memberSchema, myClaimSchema, myCouponListQuerySchema, myCouponSchema, myOrderItemSchema, myOrderSchema, orderItemStatusSchema, orderShippingAddressSchema, pageInfoSchema, pageSchema, paymentFailureCategorySchema, paymentMessageSchema, paymentMethodSchema, paymentOptionKey, paymentOptionListSchema, paymentOptionSchema, paymentStartSchema, paymentStatusSchema, pgProviderSchema, pricingAmountsSchema, productCardSchema, productDetailSchema, productFacetsSchema, productPageSchema, productSortSchema, publicInquirySchema, publicReviewSchema, purchaseDecisionResultSchema, remoteAreaSchema, requiresShippingField, 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 { 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-dIZNg-hO.mjs";
|
|
2
2
|
//#region src/payments/index.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* 스토어프론트 결제 — 브라우저 전용(`@sayren/storefront-sdk/payments`).
|
|
@@ -107,10 +107,15 @@ export interface PaymentsOptions {
|
|
|
107
107
|
}
|
|
108
108
|
export interface StartOptions {
|
|
109
109
|
option: PaymentOption;
|
|
110
|
-
|
|
110
|
+
/** 배송지 — 주문서의 `requiresShipping`이 false(배송이 필요 없는 주문)면 생략한다 */
|
|
111
|
+
shippingAddress?: ShippingAddressInput;
|
|
111
112
|
guest?: GuestInfo;
|
|
112
113
|
/** 현금영수증 신청 — 계좌이체·가상계좌 옵션에서만 보낸다 */
|
|
113
114
|
cashReceipt?: CashReceiptRequest;
|
|
115
|
+
/** 적용할 쿠폰 — 결제 시작이 예약하고 할인한 금액으로 결제한다 */
|
|
116
|
+
coupons?: StartPaymentRequest["coupons"];
|
|
117
|
+
/** 청약철회 제한 동의 — 주문서의 `withdrawal.required`가 true면 true로 보낸다 */
|
|
118
|
+
withdrawalAgreement?: boolean;
|
|
114
119
|
returnUrl?: string;
|
|
115
120
|
mode?: PaymentMode;
|
|
116
121
|
/** 클릭 시점에 {@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-wrCpR-P1.mjs";
|
|
2
2
|
//#region src/payments/index.ts
|
|
3
3
|
/** 복귀 주소에 결제 서비스가 붙이는 쿼리 */
|
|
4
4
|
const RETURN_PAYMENT_ID = "sayrenPaymentId";
|
|
@@ -289,6 +289,8 @@ function createPayments(options) {
|
|
|
289
289
|
shippingAddress: startOptions.shippingAddress,
|
|
290
290
|
guest: startOptions.guest,
|
|
291
291
|
...startOptions.cashReceipt ? { cashReceipt: startOptions.cashReceipt } : {},
|
|
292
|
+
...startOptions.coupons ? { coupons: startOptions.coupons } : {},
|
|
293
|
+
...startOptions.withdrawalAgreement !== void 0 ? { withdrawalAgreement: startOptions.withdrawalAgreement } : {},
|
|
292
294
|
returnUrl
|
|
293
295
|
}));
|
|
294
296
|
},
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -64,6 +64,13 @@ import {
|
|
|
64
64
|
consentUpdateRequestSchema,
|
|
65
65
|
memberConsentsSchema,
|
|
66
66
|
} from "./schemas/consent";
|
|
67
|
+
import {
|
|
68
|
+
applicableCouponSchema,
|
|
69
|
+
type CheckoutPricingRequest,
|
|
70
|
+
checkoutPricingRequestSchema,
|
|
71
|
+
checkoutPricingSchema,
|
|
72
|
+
myCouponSchema,
|
|
73
|
+
} from "./schemas/coupon";
|
|
67
74
|
import {
|
|
68
75
|
type CreateCustomerInquiryRequest,
|
|
69
76
|
type CustomerInquiryCategory,
|
|
@@ -79,7 +86,14 @@ import {
|
|
|
79
86
|
type UpdateProfileRequest,
|
|
80
87
|
updateProfileRequestSchema,
|
|
81
88
|
} from "./schemas/member";
|
|
82
|
-
import {
|
|
89
|
+
import {
|
|
90
|
+
type DownloadRequest,
|
|
91
|
+
deliveryTrackingSchema,
|
|
92
|
+
downloadLinkSchema,
|
|
93
|
+
downloadRequestSchema,
|
|
94
|
+
fulfillmentRevealSchema,
|
|
95
|
+
myOrderSchema,
|
|
96
|
+
} from "./schemas/order";
|
|
83
97
|
import {
|
|
84
98
|
type CreateReviewRequest,
|
|
85
99
|
createReviewRequestSchema,
|
|
@@ -308,6 +322,19 @@ export function createStorefrontClient(options: StorefrontClientOptions) {
|
|
|
308
322
|
http.request("POST", path`/checkout/${checkoutId}/payment`, paymentStartSchema, {
|
|
309
323
|
body: startPaymentRequestSchema.parse(body),
|
|
310
324
|
}),
|
|
325
|
+
/**
|
|
326
|
+
* `POST /checkout/{checkoutId}/pricing` — 쿠폰 금액 미리보기(이슈 #47). 주문서를 바꾸지 않고 쿠폰을 예약하지 않는다.
|
|
327
|
+
* 확정은 결제 시작의 `coupons`다. 코드 입력은 구매자당 분당 10회까지다(429 `TOO_MANY_REQUESTS`).
|
|
328
|
+
*
|
|
329
|
+
* 에러: 404 `COUPON_NOT_FOUND`(없는 코드·남의 쿠폰) · 409 `COUPONS_UNAVAILABLE`(지금 쿠폰을 쓸 수 없음)
|
|
330
|
+
*/
|
|
331
|
+
pricing: (checkoutId: string, body: CheckoutPricingRequest) =>
|
|
332
|
+
http.request("POST", path`/checkout/${checkoutId}/pricing`, checkoutPricingSchema, {
|
|
333
|
+
body: checkoutPricingRequestSchema.parse(body),
|
|
334
|
+
}),
|
|
335
|
+
/** `GET /checkout/{checkoutId}/coupons` — 이 주문서에 쓸 수 있는 내 쿠폰과 예상 할인(회원 전용) */
|
|
336
|
+
applicableCoupons: (checkoutId: string) =>
|
|
337
|
+
http.request("GET", path`/checkout/${checkoutId}/coupons`, z.array(applicableCouponSchema)),
|
|
311
338
|
},
|
|
312
339
|
|
|
313
340
|
payments: {
|
|
@@ -334,10 +361,68 @@ export function createStorefrontClient(options: StorefrontClientOptions) {
|
|
|
334
361
|
list: (params?: PageParams & { status?: OrderItemStatus; from?: string }) =>
|
|
335
362
|
http.request("GET", "/me/orders", pageSchema(myOrderSchema), { query: params as Query }),
|
|
336
363
|
get: (orderId: string) => http.request("GET", path`/me/orders/${orderId}`, myOrderSchema),
|
|
364
|
+
/**
|
|
365
|
+
* 비회원 주문 조회 — 주문번호 + 주문할 때 적은 연락처·주문 조회 비밀번호.
|
|
366
|
+
*
|
|
367
|
+
* 에러: 404 `ORDER_NOT_FOUND`(주문이 없거나 연락처·비밀번호가 다름 — 둘을 구분하지 않는다) ·
|
|
368
|
+
* 429 `TOO_MANY_REQUESTS`(주문번호마다 10분에 5번까지 확인하고, 5번째가 틀리면 30분 잠금.
|
|
369
|
+
* 주문번호마다 하루 15번, 스토어 전체 분당 한도도 있다. 남은 시간은 `ApiError.details.retryAfterSeconds`).
|
|
370
|
+
* 맞게 조회하면 주문번호의 횟수가 초기화된다. 본문 형식은 `guestInfoSchema`의 `phone`·`orderPassword`와 같다.
|
|
371
|
+
* 429는 연락처·비밀번호가 맞아도 난다 — 「잠시 후 다시 시도」로 안내한다.
|
|
372
|
+
*/
|
|
337
373
|
getGuestOrder: (orderId: string, body: { phone: string; orderPassword: string }) =>
|
|
338
374
|
http.request("POST", path`/guest/orders/${orderId}`, myOrderSchema, { body }),
|
|
339
375
|
getDelivery: (orderItemId: string) =>
|
|
340
376
|
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
|
+
),
|
|
341
426
|
decidePurchase: (orderItemId: string) =>
|
|
342
427
|
http.requestVoid("POST", path`/me/order-items/${orderItemId}/purchase-decision`),
|
|
343
428
|
},
|
|
@@ -409,6 +494,9 @@ export function createStorefrontClient(options: StorefrontClientOptions) {
|
|
|
409
494
|
},
|
|
410
495
|
|
|
411
496
|
me: {
|
|
497
|
+
/** `GET /me/coupons` — 내 쿠폰(이슈 #47). `status`로 사용 가능·사용함·기간 지남을 거른다 */
|
|
498
|
+
coupons: (params?: { status?: "available" | "used" | "expired" }) =>
|
|
499
|
+
http.request("GET", "/me/coupons", z.array(myCouponSchema), { query: params as Query }),
|
|
412
500
|
customerInquiries: {
|
|
413
501
|
create: (body: CreateCustomerInquiryRequest) =>
|
|
414
502
|
http.request("POST", "/me/customer-inquiries", customerInquirySchema, {
|
package/src/index.ts
CHANGED
|
@@ -11,6 +11,7 @@ export * from "./schemas/checkout";
|
|
|
11
11
|
export * from "./schemas/claim";
|
|
12
12
|
export * from "./schemas/common";
|
|
13
13
|
export * from "./schemas/consent";
|
|
14
|
+
export * from "./schemas/coupon";
|
|
14
15
|
export * from "./schemas/customer-inquiry";
|
|
15
16
|
export * from "./schemas/inquiry";
|
|
16
17
|
export * from "./schemas/member";
|
package/src/payments/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
type PaymentStatus,
|
|
8
8
|
paymentMessageSchema,
|
|
9
9
|
type ShippingAddressInput,
|
|
10
|
+
type StartPaymentRequest,
|
|
10
11
|
} from "../schemas/checkout";
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -235,10 +236,15 @@ export interface PaymentsOptions {
|
|
|
235
236
|
|
|
236
237
|
export interface StartOptions {
|
|
237
238
|
option: PaymentOption;
|
|
238
|
-
|
|
239
|
+
/** 배송지 — 주문서의 `requiresShipping`이 false(배송이 필요 없는 주문)면 생략한다 */
|
|
240
|
+
shippingAddress?: ShippingAddressInput;
|
|
239
241
|
guest?: GuestInfo;
|
|
240
242
|
/** 현금영수증 신청 — 계좌이체·가상계좌 옵션에서만 보낸다 */
|
|
241
243
|
cashReceipt?: CashReceiptRequest;
|
|
244
|
+
/** 적용할 쿠폰 — 결제 시작이 예약하고 할인한 금액으로 결제한다 */
|
|
245
|
+
coupons?: StartPaymentRequest["coupons"];
|
|
246
|
+
/** 청약철회 제한 동의 — 주문서의 `withdrawal.required`가 true면 true로 보낸다 */
|
|
247
|
+
withdrawalAgreement?: boolean;
|
|
242
248
|
returnUrl?: string;
|
|
243
249
|
mode?: PaymentMode;
|
|
244
250
|
/** 클릭 시점에 {@link Payments.prepareWindow}로 미리 연 창. 폼 검증이 비동기라 클릭 태스크를 넘길 때 쓴다 */
|
|
@@ -527,6 +533,10 @@ export function createPayments(options: PaymentsOptions): Payments {
|
|
|
527
533
|
shippingAddress: startOptions.shippingAddress,
|
|
528
534
|
guest: startOptions.guest,
|
|
529
535
|
...(startOptions.cashReceipt ? { cashReceipt: startOptions.cashReceipt } : {}),
|
|
536
|
+
...(startOptions.coupons ? { coupons: startOptions.coupons } : {}),
|
|
537
|
+
...(startOptions.withdrawalAgreement !== undefined
|
|
538
|
+
? { withdrawalAgreement: startOptions.withdrawalAgreement }
|
|
539
|
+
: {}),
|
|
530
540
|
returnUrl,
|
|
531
541
|
}),
|
|
532
542
|
);
|
package/src/schemas/cart.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { fulfillmentTypeField, requiresShippingField } from "./common";
|
|
2
3
|
|
|
3
4
|
export const cartItemSchema = z.object({
|
|
4
5
|
cartItemId: z.string(),
|
|
@@ -10,6 +11,7 @@ export const cartItemSchema = z.object({
|
|
|
10
11
|
quantity: z.number().int(),
|
|
11
12
|
unitPrice: z.number().int(),
|
|
12
13
|
totalPrice: z.number().int(),
|
|
14
|
+
fulfillmentType: fulfillmentTypeField(),
|
|
13
15
|
purchasable: z.boolean(),
|
|
14
16
|
unpurchasableReason: z.enum(["SOLD_OUT", "SUSPENDED", "CLOSED"]).nullable(),
|
|
15
17
|
});
|
|
@@ -22,6 +24,9 @@ export const cartSchema = z.object({
|
|
|
22
24
|
productAmount: z.number().int(),
|
|
23
25
|
deliveryFee: z.number().int(),
|
|
24
26
|
totalAmount: z.number().int(),
|
|
27
|
+
requiresShipping: requiresShippingField(
|
|
28
|
+
"구매 가능한 항목 중 택배 배송이 필요한 상품이 있는가. false면 배송비가 0이고 주문서가 배송지를 받지 않는다.",
|
|
29
|
+
),
|
|
25
30
|
}),
|
|
26
31
|
});
|
|
27
32
|
|
package/src/schemas/catalog.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { type PageParams, pageSchema } from "./common";
|
|
2
|
+
import { fulfillmentTypeField, type PageParams, pageSchema, requiresShippingField } from "./common";
|
|
3
3
|
|
|
4
4
|
export interface CategoryNode {
|
|
5
5
|
categoryId: string;
|
|
@@ -29,6 +29,10 @@ export const productCardSchema = z.object({
|
|
|
29
29
|
.describe("즉시 할인 적용가. 원 단위. 할인이 없으면 null"),
|
|
30
30
|
discountRate: z.number().int().nullable().describe("할인율(%). 할인이 없으면 null"),
|
|
31
31
|
freeShipping: z.boolean(),
|
|
32
|
+
fulfillmentType: fulfillmentTypeField(),
|
|
33
|
+
requiresShipping: requiresShippingField(
|
|
34
|
+
"택배 배송이 필요한 상품인가. false면 배송비가 없고 주문서가 배송지를 받지 않는다.",
|
|
35
|
+
),
|
|
32
36
|
averageRating: z.number(),
|
|
33
37
|
reviewCount: z.number().int(),
|
|
34
38
|
soldOut: z.boolean(),
|
package/src/schemas/checkout.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { requiresShippingField } from "./common";
|
|
3
|
+
import { couponApplicationListSchema } from "./coupon";
|
|
2
4
|
|
|
3
5
|
export const createCheckoutRequestSchema = z
|
|
4
6
|
.object({
|
|
@@ -73,10 +75,43 @@ export const checkoutSessionSchema = z.object({
|
|
|
73
75
|
productAmount: z.number().int(),
|
|
74
76
|
deliveryFee: z.number().int(),
|
|
75
77
|
totalAmount: z.number().int(),
|
|
78
|
+
couponDiscountAmount: z
|
|
79
|
+
.number()
|
|
80
|
+
.int()
|
|
81
|
+
.optional()
|
|
82
|
+
.default(0)
|
|
83
|
+
.describe(
|
|
84
|
+
"쿠폰 할인(상품·주문 쿠폰). 주문서는 쿠폰 전이라 0이고, 결제 시작 응답은 적용한 쿠폰의 할인이다",
|
|
85
|
+
),
|
|
86
|
+
deliveryDiscountAmount: z
|
|
87
|
+
.number()
|
|
88
|
+
.int()
|
|
89
|
+
.optional()
|
|
90
|
+
.default(0)
|
|
91
|
+
.describe("배송비 쿠폰 할인. 쿠폰이 없으면 0"),
|
|
76
92
|
}),
|
|
77
93
|
delivery: checkoutDeliverySchema.describe(
|
|
78
94
|
"배송비 내역. 배송지를 입력하면 금액이 바뀔 수 있다 — 최종 금액은 결제 시작 응답의 `amounts`다",
|
|
79
95
|
),
|
|
96
|
+
requiresShipping: requiresShippingField(
|
|
97
|
+
"택배 배송이 필요한 상품이 있는가. false면 배송지를 받지 않는다 — 결제 시작에 `shippingAddress`를 보내지 않아도 된다.",
|
|
98
|
+
),
|
|
99
|
+
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
|
+
})
|
|
112
|
+
.optional()
|
|
113
|
+
.default({ required: false, notice: null })
|
|
114
|
+
.describe("청약철회 제한 고지(이슈 #48). 서버는 항상 싣는다"),
|
|
80
115
|
expiresAt: z.string(),
|
|
81
116
|
paymentOptions: z
|
|
82
117
|
.lazy(() => paymentOptionListSchema)
|
|
@@ -205,7 +240,10 @@ export const guestInfoSchema = z.object({
|
|
|
205
240
|
name: z.string().min(1),
|
|
206
241
|
phone: z.string().regex(/^01[0-9]{8,9}$/),
|
|
207
242
|
email: z.email(),
|
|
208
|
-
orderPassword: z
|
|
243
|
+
orderPassword: z
|
|
244
|
+
.string()
|
|
245
|
+
.min(6, "주문 조회 비밀번호는 6자 이상이어야 합니다")
|
|
246
|
+
.max(128, "주문 조회 비밀번호는 128자까지입니다"),
|
|
209
247
|
});
|
|
210
248
|
|
|
211
249
|
export type GuestInfo = z.infer<typeof guestInfoSchema>;
|
|
@@ -339,9 +377,28 @@ export const startPaymentRequestSchema = z.object({
|
|
|
339
377
|
.describe(
|
|
340
378
|
"결제를 마치면 돌아올 스토어프론트 주소. 스토어 결제 도메인에 등록된 도메인이어야 한다",
|
|
341
379
|
),
|
|
342
|
-
shippingAddress: shippingAddressInputSchema
|
|
380
|
+
shippingAddress: shippingAddressInputSchema
|
|
381
|
+
.optional()
|
|
382
|
+
.describe(
|
|
383
|
+
"배송지. 주문서의 `requiresShipping`이 true면 필수이고 없으면 400 `SHIPPING_ADDRESS_REQUIRED`다. " +
|
|
384
|
+
"배송이 필요 없는 주문(파일·코드·이용권·방문 수령만)은 보내지 않아도 된다. 보내면 형식을 검사한 뒤 버린다",
|
|
385
|
+
),
|
|
343
386
|
guest: guestInfoSchema.optional(),
|
|
387
|
+
withdrawalAgreement: z
|
|
388
|
+
.boolean()
|
|
389
|
+
.optional()
|
|
390
|
+
.describe(
|
|
391
|
+
"청약철회 제한 동의. 주문서의 `withdrawal.required`가 true면 true여야 하고 아니면 400 `WITHDRAWAL_AGREEMENT_REQUIRED`다. " +
|
|
392
|
+
"동의 시각이 주문에 남는다",
|
|
393
|
+
),
|
|
344
394
|
cashReceipt: cashReceiptField,
|
|
395
|
+
coupons: couponApplicationListSchema
|
|
396
|
+
.optional()
|
|
397
|
+
.describe(
|
|
398
|
+
"적용할 쿠폰(이슈 #47). 결제 시작이 쿠폰을 예약하고 할인한 금액으로 결제 금액을 정한다 — 응답의 `amounts`가 확정 금액이다. " +
|
|
399
|
+
"적용하지 못하는 쿠폰이 하나라도 있으면 400 `COUPON_NOT_APPLICABLE`(`details`에 사유)이다. 결제가 실패하거나 만료되면 예약이 풀린다. " +
|
|
400
|
+
"쿠폰을 바꾸려면 새로 결제를 시작한다(재시도는 같은 쿠폰을 쓴다)",
|
|
401
|
+
),
|
|
345
402
|
});
|
|
346
403
|
|
|
347
404
|
export type StartPaymentRequest = z.infer<typeof startPaymentRequestSchema>;
|
package/src/schemas/claim.ts
CHANGED
|
@@ -42,7 +42,8 @@ export const createClaimResultSchema = z.object({
|
|
|
42
42
|
.int()
|
|
43
43
|
.nullable()
|
|
44
44
|
.describe(
|
|
45
|
-
"예상 환불액 — 수량 비율 상품 금액 − 반품
|
|
45
|
+
"예상 환불액 — 수량 비율 상품 실결제 금액(쿠폰 할인을 뺀 금액) − 반품 배송비 − 조건부 무료배송 미달 차감 " +
|
|
46
|
+
"− 쿠폰 조건 미달 차감(`couponChargeAmount`) + 되돌릴 쿠폰 차감. **배송비 환불은 여기 포함되지 않고 " +
|
|
46
47
|
"`deliveryFeeRefundAmount`로 따로 온다**(승인 시점의 배송 묶음 상태로 확정되기 때문이다). " +
|
|
47
48
|
"교환은 환불이 없어 null이다",
|
|
48
49
|
),
|
|
@@ -52,6 +53,24 @@ export const createClaimResultSchema = z.object({
|
|
|
52
53
|
.number()
|
|
53
54
|
.int()
|
|
54
55
|
.describe("환불 예정 배송비. 배송 묶음이 모두 취소되거나 판매자 귀책일 때만 0보다 크다"),
|
|
56
|
+
couponChargeAmount: z
|
|
57
|
+
.number()
|
|
58
|
+
.int()
|
|
59
|
+
.optional()
|
|
60
|
+
.default(0)
|
|
61
|
+
.describe(
|
|
62
|
+
"쿠폰 조건 미달 차감 예상액. 이 취소·반품으로 남은 주문상품이 쿠폰 조건(최소 주문 금액 등)을 잃으면 " +
|
|
63
|
+
"남은 주문상품이 받던 쿠폰 할인을 환불액에서 뺀다. 예상 환불액에 이미 반영돼 있다. 서버는 항상 싣는다",
|
|
64
|
+
),
|
|
65
|
+
couponChargeRefundAmount: z
|
|
66
|
+
.number()
|
|
67
|
+
.int()
|
|
68
|
+
.optional()
|
|
69
|
+
.default(0)
|
|
70
|
+
.describe(
|
|
71
|
+
"되돌릴 쿠폰 차감 예상액 — 앞선 취소·반품에서 뺀 쿠폰 조건 미달 차감 중 이번에 돌려받을 몫이다. " +
|
|
72
|
+
"예상 환불액에 이미 반영돼 있다. 서버는 항상 싣는다",
|
|
73
|
+
),
|
|
55
74
|
});
|
|
56
75
|
|
|
57
76
|
export type CreateClaimResult = z.infer<typeof createClaimResultSchema>;
|
|
@@ -87,7 +106,7 @@ export const myClaimSchema = z.object({
|
|
|
87
106
|
.int()
|
|
88
107
|
.nullable()
|
|
89
108
|
.describe(
|
|
90
|
-
"예상 환불액 — 수량 비율 상품 금액 − 반품 배송비 − 조건부 무료배송 미달 차감. " +
|
|
109
|
+
"예상 환불액 — 수량 비율 상품 실결제 금액 − 반품 배송비 − 조건부 무료배송 미달 차감 − 쿠폰 조건 미달 차감 + 되돌릴 쿠폰 차감. " +
|
|
91
110
|
"**배송비 환불은 포함되지 않고 `expectedDeliveryFeeRefundAmount`로 따로 온다.** 교환은 null이다",
|
|
92
111
|
),
|
|
93
112
|
expectedDeliveryFeeRefundAmount: z
|
package/src/schemas/common.ts
CHANGED
|
@@ -44,3 +44,33 @@ 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
|
+
}
|