@sayren/storefront-sdk 0.16.0 → 0.17.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-DTfoCsMF.mjs → checkout-C25liqdW.mjs} +83 -6
- package/dist/{client-BrDY5HO3.mjs → client-CBAgQuTc.mjs} +10 -3
- package/dist/{index-BeQwCRc8.d.mts → index-BsHuMzBD.d.mts} +350 -74
- 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 +9 -0
- package/src/schemas/catalog.ts +15 -0
- package/src/schemas/checkout.ts +13 -1
- package/src/schemas/coupon.ts +19 -2
- package/src/schemas/order.ts +2 -0
- package/src/schemas/product-options.ts +128 -0
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, 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 };
|
|
2
|
+
import { $ as CreateReviewRequest, $n as cashReceiptAvailable, $r as productCardFulfillmentSchema, $t as myCouponSchema, A as ANALYTICS_MAX_BATCH_BYTES, An as CheckoutDelivery, Ar as ProductSearchParams, At as publicInquirySchema, B as analyticsBatchSchema, Bn as PAYMENT_STATUS_VALUES, Br as PageInfo, Bt as CouponApplication, C as PurchaseDecisionResult, Cn as createClaimResultSchema, Cr as shippingAddressInputSchema, Ct as updateProfileRequestSchema, D as orderShippingAddressSchema, Dn as CashReceiptIdentityType, Dr as ProductDetail, Dt as PublicInquiry, E as myOrderSchema, En as CASH_RECEIPT_METHODS, Er as ProductCard, Et as CreateInquiryResult, F as AnalyticsBatch, Fn as EasyPayProvider, Fr as productFacetsSchema, Ft as customerInquiryCategorySchema, G as StorefrontClient, Gn as PaymentStart, Gr as pageSchema, Gt as applicableCouponSchema, H as analyticsClientEventSchema, Hn as PaymentMessage, Hr as claimStatusSchema, Ht as MAX_COUPONS_PER_CHECKOUT, I as AnalyticsClientEvent, In as GuestInfo, Ir as productPageSchema, It as customerInquirySchema, J as STOREFRONT_SESSION_KEYS, Jn as RemoteArea, Jr as ProductCardFulfillment, Jt as couponApplicationListSchema, K as StorefrontClientOptions, Kn as PaymentStatus, Kr as LineFulfillment, Kt as checkoutPricingRequestSchema, L as AnalyticsClientEventName, Ln as KnownPaymentResult, Lr as productSortSchema, Lt as ApplicableCoupon, M as ANALYTICS_SESSION_HEADER, Mn as CreateCheckoutRequest, Mr as categoryNodeSchema, Mt as CustomerInquiry, N as ANALYTICS_VISITOR_COOKIE, Nn as DeliveryQuoteRequest, Nr as productCardSchema, Nt as CustomerInquiryCategory, O as purchaseDecisionResultSchema, On as CashReceiptRequest, Or as ProductFacets, Ot as createInquiryRequestSchema, P as ANALYTICS_VISITOR_HEADER, Pn as DeliveryQuoteResult, Pr as productDetailSchema, Pt as createCustomerInquiryRequestSchema, Q as createStorefrontSession, Qn as availablePaymentOptionSchema, Qr as myOrderItemFulfillmentSnapshotSchema, Qt as myCouponListQuerySchema, R as AnalyticsEventName, Rn as KnownPaymentStatus, Rr as ClaimStatus, Rt as CheckoutPricing, S as OrderShippingAddress, Sn as createClaimRequestSchema, Sr as retryPaymentRequestSchema, St as memberSchema, T as myOrderItemSchema, Tn as AvailablePaymentOption, Tr as CategoryNode, Tt as CreateInquiryRequest, U as analyticsIdSchema, Un as PaymentMethod, Ur as orderItemStatusSchema, Ut as MIN_PAYMENT_AMOUNT, V as analyticsClientEventNameSchema, Vn as PaymentFailureCategory, Vr as PageParams, Vt as CouponResult, W as analyticsServerEventNameSchema, Wn as PaymentOption, Wr as pageInfoSchema, Wt as MyCoupon, X as StorefrontSession, Xn as ShippingAddressInput, Xr as UnknownFulfillmentView, Xt as couponBenefitViewSchema, Y as SessionStorage, Yn as RetryPaymentRequest, Yr as ProductFulfillmentView, Yt as couponApplicationSchema, Z as StorefrontSessionOptions, Zn as StartPaymentRequest, Zr as lineFulfillmentSchema, Zt as couponResultSchema, _ as normalizeCustomInputValue, _n as CreateClaimResult, _r as paymentStartSchema, _t as MemberAddressRequest, a as CustomInputEntry, ai as addCartItemRequestSchema, an as ConsentUpdateRequest, ar as createCheckoutRequestSchema, at as UpdateReviewResult, b as MyOrder, bn as claimReturnAddressSchema, br as remoteAreaSchema, bt as memberAddressRequestSchema, c as OptionSelectionView, ci as updateCartItemRequestSchema, cn as consentKindSchema, cr as easyPayProviderResponseSchema, ct as createReviewResultSchema, d as customInputEntrySchema, dn as consentUpdateRequestSchema, dr as paymentFailureCategorySchema, dt as reviewSummarySchema, ei as productFulfillmentViewSchema, en as pricingAmountsSchema, er as cashReceiptIdentityTypeOf, et as CreateReviewResult, f as customInputLength, fn as memberConsentsSchema, fr as paymentMessageSchema, ft as updateReviewRequestSchema, g as lineSelectionResponseShape, gn as CreateClaimRequest, gr as paymentOptionSchema, gt as MemberAddress, h as lineSelectionRequestShape, hn as ClaimType, hr as paymentOptionListSchema, ht as Member, i as AddonSelection, ii as UpdateCartItemRequest, in as ConsentState, ir as checkoutSessionSchema, it as UpdateReviewRequest, j as ANALYTICS_SESSION_COOKIE, jn as CheckoutSession, jr as ProductSort, jt as CreateCustomerInquiryRequest, k as trackingStageResponseSchema, kn as CashReceiptType, kr as ProductPage, kt as createInquiryResultSchema, l as addonGroupViewSchema, li as analyticsIdsFromCookie, ln as consentSourceSchema, lr as easyPayProviderSchema, lt as publicReviewSchema, m as customInputViewSchema, mn as ClaimReturnAddress, mr as paymentOptionKey, mt as writableReviewSchema, n as storefrontStoreSchema, ni as Cart, nn as ConsentKind, nr as cashReceiptTypeSchema, nt as ReviewPage, o as CustomInputValueView, oi as cartItemSchema, on as MemberConsents, or as deliveryQuoteRequestSchema, ot as WritableReview, p as customInputValueViewSchema, pn as ClaimReason, pr as paymentMethodSchema, pt as updateReviewResultSchema, q as createStorefrontClient, qn as PgProvider, qr as MyOrderItemFulfillmentSnapshot, qt as checkoutPricingSchema, r as AddonGroupView, ri as CartItem, rn as ConsentSource, rr as checkoutDeliverySchema, rt as ReviewSummary, s as CustomInputView, si as cartSchema, sn as consentActionSchema, sr as deliveryQuoteSchema, st as createReviewRequestSchema, t as StorefrontStore, ti as AddCartItemRequest, tn as ConsentAction, tr as cashReceiptRequestSchema, tt as PublicReview, u as addonSelectionSchema, un as consentStateSchema, ur as guestInfoSchema, ut as reviewPageSchema, v as optionSelectionViewSchema, vn as MyClaim, vr as paymentStatusSchema, vt as UpdateProfileRequest, w as deliveryTrackingSchema, wn as myClaimSchema, wr as startPaymentRequestSchema, wt as wishlistAddResultSchema, x as MyOrderItem, xn as claimTypeSchema, xr as residentNumberLike, xt as memberAddressSchema, y as DeliveryTracking, yn as claimReasonSchema, yr as pgProviderSchema, yt as WishlistAddResult, z as AnalyticsServerEventName, zn as PAYMENT_RESULT_VALUES, zr as OrderItemStatus, zt as CheckoutPricingRequest } from "./index-BsHuMzBD.mjs";
|
|
3
|
+
export { ANALYTICS_MAX_BATCH_BYTES, ANALYTICS_SESSION_COOKIE, ANALYTICS_SESSION_HEADER, ANALYTICS_VISITOR_COOKIE, ANALYTICS_VISITOR_HEADER, AddCartItemRequest, AddonGroupView, AddonSelection, 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, CustomInputEntry, CustomInputValueView, CustomInputView, 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, OptionSelectionView, 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, addonGroupViewSchema, addonSelectionSchema, 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, customInputEntrySchema, customInputLength, customInputValueViewSchema, customInputViewSchema, customerInquiryCategorySchema, customerInquirySchema, deliveryQuoteRequestSchema, deliveryQuoteSchema, deliveryTrackingSchema, easyPayProviderResponseSchema, easyPayProviderSchema, guestInfoSchema, idpAgreementsSchema, idpAuthorizeRequestSchema, idpAuthorizeResponseSchema, idpTokenRequestSchema, lineFulfillmentSchema, lineSelectionRequestShape, lineSelectionResponseShape, linkIdentityRequestSchema, loginRequestSchema, memberAddressRequestSchema, memberAddressSchema, memberConsentsSchema, memberIdentitiesSchema, memberSchema, myClaimSchema, myCouponListQuerySchema, myCouponSchema, myOrderItemFulfillmentSnapshotSchema, myOrderItemSchema, myOrderSchema, normalizeCustomInputValue, optionSelectionViewSchema, 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 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-
|
|
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-CBAgQuTc.mjs";
|
|
4
|
+
import { $ as lineFulfillmentSchema, A as startPaymentRequestSchema, B as myCouponListQuerySchema, C as paymentStartSchema, D as residentNumberLike, E as remoteAreaSchema, F as checkoutPricingSchema, G as customInputEntrySchema, H as pricingAmountsSchema, I as couponApplicationListSchema, J as customInputViewSchema, K as customInputLength, L as couponApplicationSchema, M as MIN_PAYMENT_AMOUNT, N as applicableCouponSchema, O as retryPaymentRequestSchema, P as checkoutPricingRequestSchema, Q as optionSelectionViewSchema, R as couponBenefitViewSchema, S as paymentOptionSchema, T as pgProviderSchema, U as addonGroupViewSchema, V as myCouponSchema, W as addonSelectionSchema, X as lineSelectionResponseShape, Y as lineSelectionRequestShape, Z as normalizeCustomInputValue, _ as paymentFailureCategorySchema, a as cashReceiptAvailable, b as paymentOptionKey, c as cashReceiptTypeSchema, d as createCheckoutRequestSchema, et as myOrderItemFulfillmentSnapshotSchema, 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, nt as productFulfillmentViewSchema, o as cashReceiptIdentityTypeOf, p as deliveryQuoteSchema, q as customInputValueViewSchema, r as PAYMENT_STATUS_VALUES, s as cashReceiptRequestSchema, t as CASH_RECEIPT_METHODS, tt as productCardFulfillmentSchema, u as checkoutSessionSchema, v as paymentMessageSchema, w as paymentStatusSchema, x as paymentOptionListSchema, y as paymentMethodSchema, z as couponResultSchema } from "./checkout-C25liqdW.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, 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 };
|
|
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, addonGroupViewSchema, addonSelectionSchema, 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, customInputEntrySchema, customInputLength, customInputValueViewSchema, customInputViewSchema, customerInquiryCategorySchema, customerInquirySchema, deliveryQuoteRequestSchema, deliveryQuoteSchema, deliveryTrackingSchema, easyPayProviderResponseSchema, easyPayProviderSchema, guestInfoSchema, idpAgreementsSchema, idpAuthorizeRequestSchema, idpAuthorizeResponseSchema, idpTokenRequestSchema, lineFulfillmentSchema, lineSelectionRequestShape, lineSelectionResponseShape, linkIdentityRequestSchema, loginRequestSchema, memberAddressRequestSchema, memberAddressSchema, memberConsentsSchema, memberIdentitiesSchema, memberSchema, myClaimSchema, myCouponListQuerySchema, myCouponSchema, myOrderItemFulfillmentSnapshotSchema, myOrderItemSchema, myOrderSchema, normalizeCustomInputValue, optionSelectionViewSchema, 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 { Gn as PaymentStart, In as GuestInfo, Kn as PaymentStatus, On as CashReceiptRequest, Wn as PaymentOption, Xn as ShippingAddressInput, Zn as StartPaymentRequest, q as createStorefrontClient } from "../index-BsHuMzBD.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
|
@@ -17,6 +17,7 @@ export * from "./schemas/fulfillment";
|
|
|
17
17
|
export * from "./schemas/inquiry";
|
|
18
18
|
export * from "./schemas/member";
|
|
19
19
|
export * from "./schemas/order";
|
|
20
|
+
export * from "./schemas/product-options";
|
|
20
21
|
export * from "./schemas/review";
|
|
21
22
|
export * from "./schemas/store";
|
|
22
23
|
export {
|
package/src/schemas/cart.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { lineFulfillmentSchema } from "./fulfillment";
|
|
3
|
+
import { lineSelectionRequestShape, lineSelectionResponseShape } from "./product-options";
|
|
3
4
|
|
|
4
5
|
export const cartItemSchema = z.object({
|
|
5
6
|
cartItemId: z.string(),
|
|
@@ -8,6 +9,7 @@ export const cartItemSchema = z.object({
|
|
|
8
9
|
thumbnailUrl: z.url().nullable().describe("담은 상품의 대표 이미지. 없으면 null"),
|
|
9
10
|
optionId: z.string().nullable(),
|
|
10
11
|
optionName: z.string().nullable(),
|
|
12
|
+
...lineSelectionResponseShape,
|
|
11
13
|
quantity: z.number().int(),
|
|
12
14
|
unitPrice: z.number().int(),
|
|
13
15
|
totalPrice: z.number().int(),
|
|
@@ -38,6 +40,7 @@ export const addCartItemRequestSchema = z.object({
|
|
|
38
40
|
productId: z.string(),
|
|
39
41
|
optionId: z.string().optional(),
|
|
40
42
|
quantity: z.number().int().min(1).max(999),
|
|
43
|
+
...lineSelectionRequestShape,
|
|
41
44
|
});
|
|
42
45
|
|
|
43
46
|
export type AddCartItemRequest = z.infer<typeof addCartItemRequestSchema>;
|
|
@@ -46,6 +49,12 @@ export const updateCartItemRequestSchema = z
|
|
|
46
49
|
.object({
|
|
47
50
|
quantity: z.number().int().min(1).max(999).optional(),
|
|
48
51
|
optionId: z.string().optional(),
|
|
52
|
+
addons: lineSelectionRequestShape.addons.describe(
|
|
53
|
+
"추가 선택을 통째로 바꾼다. 생략하면 그대로 둔다",
|
|
54
|
+
),
|
|
55
|
+
customInputs: lineSelectionRequestShape.customInputs.describe(
|
|
56
|
+
"직접 입력값을 통째로 바꾼다. 생략하면 그대로 둔다",
|
|
57
|
+
),
|
|
49
58
|
})
|
|
50
59
|
.refine((value) => Object.values(value).some((v) => v !== undefined), {
|
|
51
60
|
message: "최소 1개 필드가 필요합니다",
|
package/src/schemas/catalog.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { type PageParams, pageSchema } from "./common";
|
|
3
3
|
import { productCardFulfillmentSchema, productFulfillmentViewSchema } from "./fulfillment";
|
|
4
|
+
import { addonGroupViewSchema, customInputViewSchema } from "./product-options";
|
|
4
5
|
|
|
5
6
|
export interface CategoryNode {
|
|
6
7
|
categoryId: string;
|
|
@@ -63,6 +64,20 @@ export const productDetailSchema = productCardSchema.extend({
|
|
|
63
64
|
soldOut: z.boolean(),
|
|
64
65
|
}),
|
|
65
66
|
),
|
|
67
|
+
addonGroups: z
|
|
68
|
+
.array(addonGroupViewSchema)
|
|
69
|
+
.optional()
|
|
70
|
+
.default([])
|
|
71
|
+
.describe(
|
|
72
|
+
"추가 선택 옵션명(이슈 #59). 배열 순서가 표시 순서다. 담기·바로 구매의 `addons`로 `{groupId, valueId}`를 보낸다. 없으면 빈 배열. 서버는 항상 싣는다",
|
|
73
|
+
),
|
|
74
|
+
customInputs: z
|
|
75
|
+
.array(customInputViewSchema)
|
|
76
|
+
.optional()
|
|
77
|
+
.default([])
|
|
78
|
+
.describe(
|
|
79
|
+
"직접 입력 항목(이슈 #59). 배열 순서가 표시 순서다. 담기·바로 구매의 `customInputs`로 값을 보낸다. 없으면 빈 배열. 서버는 항상 싣는다",
|
|
80
|
+
),
|
|
66
81
|
fulfillment: productFulfillmentViewSchema,
|
|
67
82
|
returnPeriodDays: z.number().int().describe("반품·교환을 받는 기간(수령·제공일부터 일수)"),
|
|
68
83
|
categoryPath: z.array(z.object({ categoryId: z.string(), name: z.string() })),
|
package/src/schemas/checkout.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { couponApplicationListSchema } from "./coupon";
|
|
3
3
|
import { lineFulfillmentSchema } from "./fulfillment";
|
|
4
|
+
import { lineSelectionRequestShape, lineSelectionResponseShape } from "./product-options";
|
|
4
5
|
|
|
5
6
|
export const createCheckoutRequestSchema = z
|
|
6
7
|
.object({
|
|
@@ -10,6 +11,7 @@ export const createCheckoutRequestSchema = z
|
|
|
10
11
|
productId: z.string(),
|
|
11
12
|
optionId: z.string().optional(),
|
|
12
13
|
quantity: z.number().int().min(1),
|
|
14
|
+
...lineSelectionRequestShape,
|
|
13
15
|
})
|
|
14
16
|
.optional(),
|
|
15
17
|
})
|
|
@@ -61,13 +63,23 @@ export const checkoutSessionSchema = z.object({
|
|
|
61
63
|
checkoutId: z.string(),
|
|
62
64
|
items: z.array(
|
|
63
65
|
z.object({
|
|
66
|
+
lineId: z
|
|
67
|
+
.string()
|
|
68
|
+
.optional()
|
|
69
|
+
.describe(
|
|
70
|
+
"주문서 줄 id(이슈 #59). 같은 `optionId`가 추가 선택·직접 입력이 달라 여러 줄에 나올 수 있어, 상품 쿠폰을 걸 줄은 이 값으로 지목한다. 서버는 항상 싣는다",
|
|
71
|
+
),
|
|
64
72
|
productId: z.string(),
|
|
65
73
|
productName: z.string(),
|
|
66
74
|
/** variantId. 옵션 없는 상품은 default variant id */
|
|
67
75
|
optionId: z.string().nullable(),
|
|
68
76
|
optionName: z.string().nullable(),
|
|
77
|
+
...lineSelectionResponseShape,
|
|
69
78
|
quantity: z.number().int(),
|
|
70
|
-
unitPrice: z
|
|
79
|
+
unitPrice: z
|
|
80
|
+
.number()
|
|
81
|
+
.int()
|
|
82
|
+
.describe("단가 — 할인 반영 판매가 + 조합 추가금 + 추가 선택 추가금"),
|
|
71
83
|
totalPrice: z.number().int(),
|
|
72
84
|
fulfillment: lineFulfillmentSchema.describe("주문서 시점 상품 이행"),
|
|
73
85
|
}),
|
package/src/schemas/coupon.ts
CHANGED
|
@@ -29,7 +29,14 @@ export const couponApplicationSchema = z
|
|
|
29
29
|
.string()
|
|
30
30
|
.optional()
|
|
31
31
|
.describe(
|
|
32
|
-
"상품 쿠폰을 걸 주문서 항목의 `optionId`. 생략하면 할인이 가장 큰 항목에 건다. 주문 쿠폰에는 쓰지
|
|
32
|
+
"상품 쿠폰을 걸 주문서 항목의 `optionId`. 생략하면 할인이 가장 큰 항목에 건다. 주문 쿠폰에는 쓰지 않는다. " +
|
|
33
|
+
"같은 `optionId`의 줄이 여럿이면 적용하지 못한다(`LINE_AMBIGUOUS`) — 그때는 `lineId`를 쓴다",
|
|
34
|
+
),
|
|
35
|
+
lineId: z
|
|
36
|
+
.string()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe(
|
|
39
|
+
"상품 쿠폰을 걸 주문서 줄의 `lineId`(이슈 #59). 주면 `optionId`보다 우선한다. 주문 쿠폰에는 쓰지 않는다",
|
|
33
40
|
),
|
|
34
41
|
})
|
|
35
42
|
.refine((value) => (value.issueId ? 1 : 0) + (value.code ? 1 : 0) === 1, {
|
|
@@ -68,12 +75,18 @@ export const couponResultSchema = z.object({
|
|
|
68
75
|
.describe(
|
|
69
76
|
"적용하지 못한 사유. `MIN_ORDER_AMOUNT`(최소 주문 금액 미달)·`NO_ELIGIBLE_ITEMS`(대상 상품 없음)·`NOT_STARTED`·`EXPIRED`·" +
|
|
70
77
|
"`MEMBER_ONLY`(회원 전용)·`STACK_LIMIT`(같은 종류 쿠폰이 이미 적용됨)·`DUPLICATE_COUPON`·`LINE_NOT_ELIGIBLE`·`NO_DISCOUNT`·" +
|
|
71
|
-
"`IN_USE`(다른 결제에서 쓰는 중)·`LIMIT_REACHED`(1인 사용 한도)·`EXHAUSTED`(총 사용 한도)·`INACTIVE`(중지된 쿠폰). 값이 늘 수 있다",
|
|
78
|
+
"`LINE_AMBIGUOUS`(같은 `optionId`의 줄이 여럿, `lineId`로 지목한다)·`IN_USE`(다른 결제에서 쓰는 중)·`LIMIT_REACHED`(1인 사용 한도)·`EXHAUSTED`(총 사용 한도)·`INACTIVE`(중지된 쿠폰). 값이 늘 수 있다",
|
|
72
79
|
),
|
|
73
80
|
optionId: z
|
|
74
81
|
.string()
|
|
75
82
|
.nullable()
|
|
76
83
|
.describe("상품 쿠폰이 걸린 주문서 항목의 `optionId`. 그 밖은 null"),
|
|
84
|
+
lineId: z
|
|
85
|
+
.string()
|
|
86
|
+
.nullable()
|
|
87
|
+
.optional()
|
|
88
|
+
.default(null)
|
|
89
|
+
.describe("상품 쿠폰이 걸린 주문서 줄의 `lineId`(이슈 #59). 그 밖은 null. 서버는 항상 싣는다"),
|
|
77
90
|
});
|
|
78
91
|
export type CouponResult = z.infer<typeof couponResultSchema>;
|
|
79
92
|
|
|
@@ -107,6 +120,10 @@ export const checkoutPricingSchema = z.object({
|
|
|
107
120
|
.array(
|
|
108
121
|
z.object({
|
|
109
122
|
optionId: z.string().nullable(),
|
|
123
|
+
lineId: z
|
|
124
|
+
.string()
|
|
125
|
+
.optional()
|
|
126
|
+
.describe("주문서 줄의 `lineId`(이슈 #59). 서버는 항상 싣는다"),
|
|
110
127
|
couponDiscountAmount: z.number().int().describe("이 항목에 들어간 쿠폰 할인"),
|
|
111
128
|
}),
|
|
112
129
|
)
|
package/src/schemas/order.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import { easyPayProviderResponseSchema, paymentMethodSchema } from "./checkout";
|
|
3
3
|
import { orderItemStatusSchema } from "./common";
|
|
4
4
|
import { myOrderItemFulfillmentSnapshotSchema } from "./fulfillment";
|
|
5
|
+
import { lineSelectionResponseShape } from "./product-options";
|
|
5
6
|
|
|
6
7
|
export const myOrderItemSchema = z.object({
|
|
7
8
|
orderItemId: z.string(),
|
|
@@ -9,6 +10,7 @@ export const myOrderItemSchema = z.object({
|
|
|
9
10
|
productName: z.string(),
|
|
10
11
|
thumbnailUrl: z.url().nullable().describe("주문 시점의 대표 이미지. 없었으면 null"),
|
|
11
12
|
optionName: z.string().nullable(),
|
|
13
|
+
...lineSelectionResponseShape,
|
|
12
14
|
quantity: z.number().int().describe("주문 수량"),
|
|
13
15
|
// 두 수량은 서버가 언제나 함께 싣는다. `store-sdk`의 `orderItemSchema`와 같은 규칙으로 **둘 다 필수**다 —
|
|
14
16
|
// 응답 스키마는 OpenAPI 계약이기도 해서 기본값을 두면 선택 필드로 문서화되고, 필드가 빠진 응답이
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 추가 선택·직접 입력 (이슈 #59) — 상품 상세의 옵션 표시, 장바구니 담기·바로 구매 요청, 줄 스냅샷의 공통 모양.
|
|
5
|
+
*
|
|
6
|
+
* 추가 선택은 재고가 없는 옵션이다. 구매자가 조합(옵션이 없으면 상품)을 고른 뒤 옵션명마다 값 하나를 더 고르고, 값의 추가금이
|
|
7
|
+
* 단가에 더해진다. 직접 입력은 구매자가 글자를 적는 항목(각인 문구 등)이다. 추가 선택 값이나 직접 입력값이 다르면 장바구니에서 다른 줄이다.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export const addonGroupViewSchema = z.object({
|
|
11
|
+
groupId: z.string(),
|
|
12
|
+
name: z.string(),
|
|
13
|
+
required: z.boolean().describe("꼭 골라야 하는가. false면 고르지 않아도 된다(「선택 안 함」)"),
|
|
14
|
+
values: z
|
|
15
|
+
.array(
|
|
16
|
+
z.object({
|
|
17
|
+
valueId: z.string(),
|
|
18
|
+
name: z.string(),
|
|
19
|
+
additionalPrice: z.number().int().describe("이 값을 고르면 단가에 더하는 금액(원, 0 이상)"),
|
|
20
|
+
}),
|
|
21
|
+
)
|
|
22
|
+
.describe("고를 수 있는 값(셀러가 끈 값은 빠진다)"),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export type AddonGroupView = z.infer<typeof addonGroupViewSchema>;
|
|
26
|
+
|
|
27
|
+
export const customInputViewSchema = z.object({
|
|
28
|
+
inputId: z.string(),
|
|
29
|
+
label: z.string().describe("항목명"),
|
|
30
|
+
placeholder: z.string().nullable().describe("입력 안내. 없으면 null"),
|
|
31
|
+
maxLength: z.number().int().describe("최대 글자 수"),
|
|
32
|
+
required: z.boolean(),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export type CustomInputView = z.infer<typeof customInputViewSchema>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 직접 입력값 정규화 — NFC로 모으고, 제어 문자(C0·C1·줄바꿈·줄·문단 구분자)는 공백으로, 제로폭·양방향 제어 문자는 지운 뒤
|
|
39
|
+
* 앞뒤 공백을 지운다. 서버가 저장하는 값이 이것이다. 빈 문자열이면 입력하지 않은 것으로 본다.
|
|
40
|
+
* (양방향 제어 문자를 두면 셀러 주문 화면의 각인 문구가 뒤집혀 보이게 할 수 있다.)
|
|
41
|
+
*/
|
|
42
|
+
export function normalizeCustomInputValue(value: string): string {
|
|
43
|
+
return (
|
|
44
|
+
value
|
|
45
|
+
.normalize("NFC")
|
|
46
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: 제어 문자를 지우려는 정규식이다
|
|
47
|
+
.replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g, " ")
|
|
48
|
+
.replace(/[\u200b-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u2069\ufeff]/g, "")
|
|
49
|
+
.trim()
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 직접 입력값의 글자 수 — 정규화한 값의 **코드 포인트 수**다(이모지 하나가 1자). 서버의 최대 글자 수 판정(`CUSTOM_INPUT_TOO_LONG`)과
|
|
55
|
+
* 스토어프론트·콘솔의 글자 수 표시가 이 함수 하나를 쓴다. `String.length`(UTF-16)로 세면 이모지가 2자로 세어 판정이 갈린다.
|
|
56
|
+
*/
|
|
57
|
+
export function customInputLength(value: string): number {
|
|
58
|
+
return [...normalizeCustomInputValue(value)].length;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** 담기·바로 구매 요청의 직접 입력값 한 칸. 앞뒤 공백을 지우고, 빈 값은 입력하지 않은 것으로 본다 */
|
|
62
|
+
export const customInputEntrySchema = z.object({
|
|
63
|
+
inputId: z.string(),
|
|
64
|
+
value: z.string().max(1000),
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export type CustomInputEntry = z.infer<typeof customInputEntrySchema>;
|
|
68
|
+
|
|
69
|
+
/** 고른 추가 선택 한 칸 — 옵션명(`groupId`)과 그 옵션명의 값(`valueId`) */
|
|
70
|
+
export const addonSelectionSchema = z.object({
|
|
71
|
+
groupId: z.string(),
|
|
72
|
+
valueId: z.string(),
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export type AddonSelection = z.infer<typeof addonSelectionSchema>;
|
|
76
|
+
|
|
77
|
+
/** 요청의 추가 선택·직접 입력 필드 — 담기·장바구니 수정·바로 구매가 같은 이름을 쓴다 */
|
|
78
|
+
export const lineSelectionRequestShape = {
|
|
79
|
+
addons: z
|
|
80
|
+
.array(addonSelectionSchema)
|
|
81
|
+
.max(20)
|
|
82
|
+
.optional()
|
|
83
|
+
.describe(
|
|
84
|
+
"고른 추가 선택(옵션명마다 하나, 고르지 않은 옵션명은 빼고 보낸다). 필수 옵션명을 빼면 400 `ADDON_OPTION_REQUIRED`, 없거나 꺼진 값이거나 한 옵션명에서 둘을 고르면 400 `ADDON_OPTION_NOT_FOUND`",
|
|
85
|
+
),
|
|
86
|
+
customInputs: z
|
|
87
|
+
.array(customInputEntrySchema)
|
|
88
|
+
.max(20)
|
|
89
|
+
.optional()
|
|
90
|
+
.describe(
|
|
91
|
+
"직접 입력값. 필수 항목을 비우면 400 `CUSTOM_INPUT_REQUIRED`, 최대 글자 수를 넘으면 400 `CUSTOM_INPUT_TOO_LONG`, 없는 항목이면 400 `CUSTOM_INPUT_NOT_FOUND`",
|
|
92
|
+
),
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/** 줄의 옵션 선택 스냅샷 한 칸 — 조합 옵션은 옵션명마다 한 칸이고 추가금이 0이다(조합 추가금은 단가에 들어 있다) */
|
|
96
|
+
export const optionSelectionViewSchema = z.object({
|
|
97
|
+
kind: z
|
|
98
|
+
.string()
|
|
99
|
+
.describe(
|
|
100
|
+
"옵션명 방식. 현재 값은 `combination`·`addon`이고 값이 추가될 수 있어 문자열로 받는다",
|
|
101
|
+
),
|
|
102
|
+
groupName: z.string(),
|
|
103
|
+
valueName: z.string(),
|
|
104
|
+
additionalPrice: z.number().int(),
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export type OptionSelectionView = z.infer<typeof optionSelectionViewSchema>;
|
|
108
|
+
|
|
109
|
+
export const customInputValueViewSchema = z.object({
|
|
110
|
+
label: z.string().describe("항목명"),
|
|
111
|
+
value: z.string().describe("구매자가 적은 값"),
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
export type CustomInputValueView = z.infer<typeof customInputValueViewSchema>;
|
|
115
|
+
|
|
116
|
+
/** 응답 줄의 표시 필드 — 장바구니·주문서·주문상품이 같은 이름을 쓴다 */
|
|
117
|
+
export const lineSelectionResponseShape = {
|
|
118
|
+
optionSelections: z
|
|
119
|
+
.array(optionSelectionViewSchema)
|
|
120
|
+
.optional()
|
|
121
|
+
.default([])
|
|
122
|
+
.describe("옵션 선택(조합 옵션 + 추가 선택). 옵션이 없으면 빈 배열. 서버는 항상 싣는다"),
|
|
123
|
+
customInputs: z
|
|
124
|
+
.array(customInputValueViewSchema)
|
|
125
|
+
.optional()
|
|
126
|
+
.default([])
|
|
127
|
+
.describe("직접 입력값(항목명과 값). 없으면 빈 배열. 서버는 항상 싣는다"),
|
|
128
|
+
};
|