@sayren/storefront-sdk 0.20.2 → 0.20.4

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.
@@ -1,4 +1,4 @@
1
- import { kt as ApiError, t as createStorefrontClient } from "../client-vMd6bgQs.mjs";
1
+ import { kt as ApiError, t as createStorefrontClient } from "../client-BTADfYXV.mjs";
2
2
  //#region src/auth/index.ts
3
3
  /** 소셜 로그인 실패 — 구매자가 취소했거나(`access_denied`) state가 맞지 않는다 */
4
4
  var IdpCallbackError = class extends Error {
@@ -204,7 +204,8 @@ const checkoutPricingSchema = z.object({
204
204
  adjustReason: z.string().nullable().describe("요청보다 적게 쓴 이유. `MIN_PAYMENT`: 결제 금액 100원을 남기려고 줄였다"),
205
205
  rejectReason: z.string().nullable().describe("요청했지만 쓰지 못한 이유 — `MIN_BALANCE`·`MIN_AMOUNT`·`NOT_PAYABLE`. 값이 추가될 수 있다")
206
206
  }).nullable().optional().default(null).describe("적립금(#93). 비회원이거나 적립금 사용이 꺼져 있으면 null"),
207
- payable: z.boolean().describe("이 금액으로 결제를 시작할 수 있는가 — 적용하지 못한 쿠폰이 있거나 결제 금액이 100원 미만이면 false")
207
+ payable: z.boolean().describe("이 금액으로 결제를 시작할 수 있는가 — 적용하지 못한 쿠폰이 있거나 결제 금액이 1~99원이면 false(0원은 적립금 전액 결제라 true)"),
208
+ paymentRequired: z.boolean().optional().default(true).describe("결제수단으로 낼 금액이 남는가(#93). false면 적립금이 결제 금액 전체를 덮어 결제창 없이 끝나므로 결제수단을 고르지 않고 결제 시작에 `option`을 보내지 않는다. 판단은 서버가 한다 — 스토어프론트가 금액을 계산해 정하지 않는다. 필드가 없는 이전 응답은 true로 읽는다")
208
209
  });
209
210
  /** `GET /checkout/{checkoutId}/coupons` 항목 — 이 주문서에 쓸 수 있는 내 쿠폰 */
210
211
  const applicableCouponSchema = z.object({
@@ -499,13 +500,13 @@ const cashReceiptField = cashReceiptRequestSchema.optional().describe("현금영
499
500
  * `returnUrl`의 도메인은 상점 결제 도메인(상점 플랫폼 설정 › 결제)에 등록돼 있어야 한다(테스트 결제는 localhost 허용).
500
501
  */
501
502
  const startPaymentRequestSchema = z.object({
502
- option: paymentOptionSchema,
503
+ option: paymentOptionSchema.optional().describe("결제 옵션. 결제 금액이 남으면 필수이고 없으면 400 `VALIDATION_FAILED`다. 적립금이 결제 금액 전체를 덮는 주문(0원 결제, #93)은 생략한다"),
503
504
  returnUrl: z.url().max(2048).describe("결제를 마치면 돌아올 스토어프론트 주소. 상점 결제 도메인에 등록된 도메인이어야 한다"),
504
505
  shippingAddress: shippingAddressInputSchema.optional().describe("배송지. 주문서의 `requiresShipping`이 true면 필수이고 없으면 400 `SHIPPING_ADDRESS_REQUIRED`다. 배송이 필요 없는 주문(배송 없는 상품만)은 보내지 않아도 된다. 보내면 형식을 검사한 뒤 버린다"),
505
506
  guest: guestInfoSchema.optional(),
506
507
  cashReceipt: cashReceiptField,
507
508
  coupons: couponApplicationListSchema.optional().describe("적용할 쿠폰(이슈 #47). 결제 시작이 쿠폰을 예약하고 할인한 금액으로 결제 금액을 정한다 — 응답의 `amounts`가 확정 금액이다. 적용하지 못하는 쿠폰이 하나라도 있으면 400 `COUPON_NOT_APPLICABLE`(`details`에 사유)이다. 결제가 실패하거나 만료되면 예약이 풀린다. 쿠폰을 바꾸려면 새로 결제를 시작한다(재시도는 같은 쿠폰을 쓴다)"),
508
- pointAmount: z.number().int().min(0).optional().describe("쓸 적립금(#93, 회원만). 결제 시작이 예약하고 쿠폰 뒤 금액에서 뺀다 — 응답 `amounts.pointAmount`가 실제 사용액이다(단위로 내리고 결제 금액 100원을 남긴다). 적립금 사용이 꺼져 있으면 409 `POINTS_UNAVAILABLE`, 쓸 수 없으면 400 `POINT_NOT_APPLICABLE`(`details.reason`), 그 사이 잔액이 줄었으면 409 `POINT_BALANCE_CHANGED`다. 결제가 실패하거나 만료되면 예약이 풀린다")
509
+ pointAmount: z.number().int().min(0).optional().describe("쓸 적립금(#93, 회원만). 결제 시작이 예약하고 쿠폰 뒤 금액에서 뺀다 — 응답 `amounts.pointAmount`가 실제 사용액이다(단위로 내리고, 남는 결제 금액이 1~99원이면 100원을 남긴다). 적립금이 결제 금액 전체를 덮으면 결제창 없이 이 요청에서 주문이 만들어진다(응답 `status: \"completed\"`·`orderId`, `payUrl`·`attemptId`·`option`은 null). 적립금 사용이 꺼져 있으면 409 `POINTS_UNAVAILABLE`, 쓸 수 없으면 400 `POINT_NOT_APPLICABLE`(`details.reason`), 그 사이 잔액이 줄었으면 409 `POINT_BALANCE_CHANGED`다. 결제가 실패하거나 만료되면 예약이 풀린다")
509
510
  });
510
511
  /**
511
512
  * 같은 결제에서 다른 결제 옵션으로 다시 시도. `returnUrl`을 생략하면 결제 시작 때의 복귀 주소를 쓴다.
@@ -1,5 +1,5 @@
1
1
  import { a as ANALYTICS_VISITOR_HEADER, r as ANALYTICS_SESSION_HEADER } from "./analytics-CgD70OqH.mjs";
2
- import { A as retryPaymentRequestSchema, F as applicableCouponSchema, G as addonGroupViewSchema, I as checkoutPricingRequestSchema, L as checkoutPricingSchema, M as startPaymentRequestSchema, Q as lineSelectionResponseShape, T as paymentStatusSchema, U as myCouponSchema, X as customInputViewSchema, Z as lineSelectionRequestShape, d as checkoutSessionSchema, f as createCheckoutRequestSchema, h as easyPayProviderResponseSchema, it as productFulfillmentViewSchema, k as responsePaymentMethodSchema, m as deliveryQuoteSchema, nt as myOrderItemFulfillmentSnapshotSchema, p as deliveryQuoteRequestSchema, rt as productCardFulfillmentSchema, tt as lineFulfillmentSchema, w as paymentStartSchema } from "./checkout-DSAf758s.mjs";
2
+ import { A as retryPaymentRequestSchema, F as applicableCouponSchema, G as addonGroupViewSchema, I as checkoutPricingRequestSchema, L as checkoutPricingSchema, M as startPaymentRequestSchema, Q as lineSelectionResponseShape, T as paymentStatusSchema, U as myCouponSchema, X as customInputViewSchema, Z as lineSelectionRequestShape, d as checkoutSessionSchema, f as createCheckoutRequestSchema, h as easyPayProviderResponseSchema, it as productFulfillmentViewSchema, k as responsePaymentMethodSchema, m as deliveryQuoteSchema, nt as myOrderItemFulfillmentSnapshotSchema, p as deliveryQuoteRequestSchema, rt as productCardFulfillmentSchema, tt as lineFulfillmentSchema, w as paymentStartSchema } from "./checkout-D-cg8lLE.mjs";
3
3
  import { z } from "zod";
4
4
  //#region src/http.ts
5
5
  /** 표준 엔벨로프의 $.error 상세 */
@@ -356,6 +356,7 @@ const productDetailSchema = productCardSchema.extend({
356
356
  customInputs: z.array(customInputViewSchema).optional().default([]).describe("직접 입력 항목(이슈 #59). 배열 순서가 표시 순서다. 담기·바로 구매의 `customInputs`로 값을 보낸다. 없으면 빈 배열. 서버는 항상 싣는다"),
357
357
  fulfillment: productFulfillmentViewSchema,
358
358
  returnPeriodDays: z.number().int().describe("반품·교환을 받는 기간(수령·제공일부터 일수)"),
359
+ purchasePoint: z.number().int().nullable().optional().default(null).describe("구매 적립 예정액(원, 이슈 #93). 상품 1개를 지금 가격(`discountedPrice ?? salePrice`, 옵션 추가금·쿠폰·배송비 제외)으로 샀을 때 구매확정 뒤 받는 적립금이다. 상점 구매 적립률과 상품별 적립률로 서버가 계산한다. 구매 적립이 꺼져 있거나 적립 안 함 상품, 계산값이 0원이면 null이다. 적립은 회원 주문만 받는다. 화면은 값이 있을 때 「구매 시 n원 적립」으로 그대로 보이면 된다"),
359
360
  categoryPath: z.array(z.object({
360
361
  categoryId: z.string(),
361
362
  name: z.string()
@@ -321,6 +321,7 @@ declare const productDetailSchema: z.ZodObject<{
321
321
  requiresShipping: boolean;
322
322
  }>>]>;
323
323
  returnPeriodDays: z.ZodNumber;
324
+ purchasePoint: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
324
325
  categoryPath: z.ZodArray<z.ZodObject<{
325
326
  categoryId: z.ZodString;
326
327
  name: z.ZodString;
@@ -925,7 +926,7 @@ type CashReceiptRequest = z.infer<typeof cashReceiptRequestSchema>;
925
926
  * `returnUrl`의 도메인은 상점 결제 도메인(상점 플랫폼 설정 › 결제)에 등록돼 있어야 한다(테스트 결제는 localhost 허용).
926
927
  */
927
928
  declare const startPaymentRequestSchema: z.ZodObject<{
928
- option: z.ZodDiscriminatedUnion<[z.ZodObject<{
929
+ option: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
929
930
  pg: z.ZodEnum<{
930
931
  tosspayments: "tosspayments";
931
932
  portone: "portone";
@@ -961,7 +962,7 @@ declare const startPaymentRequestSchema: z.ZodObject<{
961
962
  portone: "portone";
962
963
  }>;
963
964
  method: z.ZodLiteral<"MOBILE">;
964
- }, z.core.$strip>], "method">;
965
+ }, z.core.$strip>], "method">>;
965
966
  returnUrl: z.ZodURL;
966
967
  shippingAddress: z.ZodOptional<z.ZodObject<{
967
968
  addressId: z.ZodOptional<z.ZodString>;
@@ -1483,6 +1484,7 @@ declare const checkoutPricingSchema: z.ZodObject<{
1483
1484
  rejectReason: z.ZodNullable<z.ZodString>;
1484
1485
  }, z.core.$strip>>>>;
1485
1486
  payable: z.ZodBoolean;
1487
+ paymentRequired: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
1486
1488
  }, z.core.$strip>;
1487
1489
  type CheckoutPricing = z.infer<typeof checkoutPricingSchema>;
1488
1490
  /** `GET /checkout/{checkoutId}/coupons` 항목 — 이 주문서에 쓸 수 있는 내 쿠폰 */
@@ -2140,6 +2142,7 @@ declare function createStorefrontClient(options: StorefrontClientOptions): {
2140
2142
  requiresShipping: false;
2141
2143
  };
2142
2144
  returnPeriodDays: number;
2145
+ purchasePoint: number | null;
2143
2146
  categoryPath: {
2144
2147
  categoryId: string;
2145
2148
  name: string;
@@ -2569,6 +2572,7 @@ declare function createStorefrontClient(options: StorefrontClientOptions): {
2569
2572
  rejectReason: string | null;
2570
2573
  } | null;
2571
2574
  payable: boolean;
2575
+ paymentRequired: boolean;
2572
2576
  }>;
2573
2577
  /** `GET /checkout/{checkoutId}/coupons` — 이 주문서에 쓸 수 있는 내 쿠폰과 예상 할인(회원 전용) */
2574
2578
  applicableCoupons: (checkoutId: string) => Promise<{
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 StorefrontClientOptions, $n as DeliveryQuoteResult, $r as ProductDetail, $t as createCustomerInquiryRequestSchema, A as PurchaseDecisionResult, Ai as UnknownFulfillmentView, An as consentUpdateRequestSchema, Ar as easyPayProviderResponseSchema, At as uploadTicketSchema, B as ANALYTICS_VISITOR_COOKIE, Bi as cartItemSchema, Bn as claimTypeSchema, Br as paymentStatusSchema, Bt as updateProfileRequestSchema, C as memberPointEntrySchema, Ci as orderItemStatusSchema, Cn as ConsentState, Cr as cashReceiptRequestSchema, Ct as productReviewSortSchema, D as MyOrder, Di as MyOrderItemFulfillmentSnapshot, Dn as consentKindSchema, Dr as createCheckoutRequestSchema, Dt as reviewSummarySchema, E as DeliveryTracking, Ei as LineFulfillment, En as consentActionSchema, Er as checkoutSessionSchema, Et as reviewPageSchema, F as purchaseDecisionResultSchema, Fi as AddCartItemRequest, Fn as CreateClaimRequest, Fr as paymentMethodSchema, Ft as UpdateProfileRequest, G as AnalyticsEventName, Gn as CASH_RECEIPT_METHODS, Gr as retryPaymentRequestSchema, Gt as PublicInquiry, H as AnalyticsBatch, Hi as updateCartItemRequestSchema, Hn as createClaimResultSchema, Hr as remoteAreaSchema, Ht as CreateInquiryRequest, I as trackingStageResponseSchema, Ii as Cart, In as CreateClaimResult, Ir as paymentOptionKey, It as WishlistAddResult, J as analyticsClientEventNameSchema, Jn as CashReceiptType, Jr as CategoryNode, Jt as productInquiryCategorySchema, K as AnalyticsServerEventName, Kn as CashReceiptIdentityType, Kr as shippingAddressInputSchema, Kt as createInquiryRequestSchema, L as ANALYTICS_MAX_BATCH_BYTES, Li as CartItem, Ln as MyClaim, Lr as paymentOptionListSchema, Lt as memberAddressRequestSchema, M as myOrderItemSchema, Mi as myOrderItemFulfillmentSnapshotSchema, Mn as ClaimReason, Mr as guestInfoSchema, Mt as Member, N as myOrderSchema, Ni as productCardFulfillmentSchema, Nn as ClaimReturnAddress, Nr as paymentFailureCategorySchema, Nt as MemberAddress, O as MyOrderItem, Oi as ProductCardFulfillment, On as consentSourceSchema, Or as deliveryQuoteRequestSchema, Ot as updateReviewRequestSchema, P as orderShippingAddressSchema, Pi as productFulfillmentViewSchema, Pn as ClaimType, Pr as paymentMessageSchema, Pt as MemberAddressRequest, Q as StorefrontClient, Qn as DeliveryQuoteRequest, Qr as ProductCard, Qt as CustomerInquiryCategory, R as ANALYTICS_SESSION_COOKIE, Ri as UpdateCartItemRequest, Rn as claimReasonSchema, Rr as paymentOptionSchema, Rt as memberAddressSchema, S as memberPointEntryPageSchema, Si as claimStatusSchema, Sn as ConsentSource, Sr as cashReceiptIdentityTypeOf, St as productReviewQuerySchema, T as storefrontPointPolicySchema, Ti as pageSchema, Tn as MemberConsents, Tr as checkoutDeliverySchema, Tt as reviewImageUploadRequestSchema, U as AnalyticsClientEvent, Ui as analyticsIdsFromCookie, Un as myClaimSchema, Ur as residentNumberLike, Ut as CreateInquiryResult, V as ANALYTICS_VISITOR_HEADER, Vi as cartSchema, Vn as createClaimRequestSchema, Vr as pgProviderSchema, Vt as wishlistAddResultSchema, W as AnalyticsClientEventName, Wn as AvailablePaymentOption, Wr as responsePaymentMethodSchema, Wt as ProductInquiryCategory, X as analyticsIdSchema, Xn as CheckoutSession, Xr as CollectionProductParams, Xt as CreateCustomerInquiryRequest, Y as analyticsClientEventSchema, Yn as CheckoutDelivery, Yr as CollectionProductPage, Yt as publicInquirySchema, Z as analyticsServerEventNameSchema, Zn as CreateCheckoutRequest, Zr as CollectionProductSortParam, Zt as CustomerInquiry, _ as normalizeCustomInputValue, _i as storefrontCollectionSchema, _n as myCouponListQuerySchema, _r as RetryPaymentRequest, _t as UploadTicket, a as CustomInputEntry, ai as StorefrontCollectionDetail, an as CouponApplication, ar as PAYMENT_RESULT_VALUES, at as createStorefrontSession, b as MemberPoints, bi as PageInfo, bn as ConsentAction, br as availablePaymentOptionSchema, bt as createReviewResultSchema, c as OptionSelectionView, ci as collectionProductQuerySchema, cn as MIN_PAYMENT_AMOUNT, cr as PaymentFailureCategory, ct as MyReview, d as customInputEntrySchema, di as productDetailSchema, dn as checkoutPricingRequestSchema, dr as PaymentOption, dt as PublicReview, ei as ProductFacets, en as customerInquiryCategorySchema, er as EasyPayProvider, et as createStorefrontClient, f as customInputLength, fi as productFacetsSchema, fn as checkoutPricingSchema, fr as PaymentStart, ft as ReviewImageUploadRequest, g as lineSelectionResponseShape, gi as storefrontCollectionListQuerySchema, gn as couponResultSchema, gr as ResponsePaymentMethod, gt as UpdateReviewResult, h as lineSelectionRequestShape, hi as storefrontCollectionDetailSchema, hn as couponBenefitViewSchema, hr as RemoteArea, ht as UpdateReviewRequest, i as AddonSelection, ii as StorefrontCollection, in as CheckoutPricingRequest, ir as KnownPaymentStatus, it as StorefrontSessionOptions, j as deliveryTrackingSchema, ji as lineFulfillmentSchema, jn as memberConsentsSchema, jr as easyPayProviderSchema, jt as writableReviewSchema, k as OrderShippingAddress, ki as ProductFulfillmentView, kn as consentStateSchema, kr as deliveryQuoteSchema, kt as updateReviewResultSchema, l as addonGroupViewSchema, li as collectionProductSortSchema, ln as MyCoupon, lr as PaymentMessage, lt as ProductReviewParams, m as customInputViewSchema, mi as productSortSchema, mn as couponApplicationSchema, mr as PgProvider, mt as ReviewSummary, n as storefrontStoreSchema, ni as ProductSearchParams, nn as ApplicableCoupon, nr as KnownPaymentResult, nt as SessionStorage, o as CustomInputValueView, oi as categoryNodeSchema, on as CouponResult, or as PAYMENT_START_STATUS_VALUES, ot as CreateReviewRequest, p as customInputValueViewSchema, pi as productPageSchema, pn as couponApplicationListSchema, pr as PaymentStatus, pt as ReviewPage, q as analyticsBatchSchema, qn as CashReceiptRequest, qr as startPaymentRequestSchema, qt as createInquiryResultSchema, r as AddonGroupView, ri as ProductSort, rn as CheckoutPricing, rr as KnownPaymentStartStatus, rt as StorefrontSession, s as CustomInputView, si as collectionProductPageSchema, sn as MAX_COUPONS_PER_CHECKOUT, sr as PAYMENT_STATUS_VALUES, st as CreateReviewResult, t as StorefrontStore, ti as ProductPage, tn as customerInquirySchema, tr as GuestInfo, tt as STOREFRONT_SESSION_KEYS, u as addonSelectionSchema, ui as productCardSchema, un as applicableCouponSchema, ur as PaymentMethod, ut as ProductReviewSort, v as optionSelectionViewSchema, vi as ClaimStatus, vn as myCouponSchema, vr as ShippingAddressInput, vt as WritableReview, w as memberPointsSchema, wi as pageInfoSchema, wn as ConsentUpdateRequest, wr as cashReceiptTypeSchema, wt as publicReviewSchema, x as StorefrontPointPolicy, xi as PageParams, xn as ConsentKind, xr as cashReceiptAvailable, xt as myReviewSchema, y as MemberPointEntry, yi as OrderItemStatus, yn as pricingAmountsSchema, yr as StartPaymentRequest, yt as createReviewRequestSchema, z as ANALYTICS_SESSION_HEADER, zi as addCartItemRequestSchema, zn as claimReturnAddressSchema, zr as paymentStartSchema, zt as memberSchema } from "./index-C3kjGNxd.mjs";
2
+ import { $ as StorefrontClientOptions, $n as DeliveryQuoteResult, $r as ProductDetail, $t as createCustomerInquiryRequestSchema, A as PurchaseDecisionResult, Ai as UnknownFulfillmentView, An as consentUpdateRequestSchema, Ar as easyPayProviderResponseSchema, At as uploadTicketSchema, B as ANALYTICS_VISITOR_COOKIE, Bi as cartItemSchema, Bn as claimTypeSchema, Br as paymentStatusSchema, Bt as updateProfileRequestSchema, C as memberPointEntrySchema, Ci as orderItemStatusSchema, Cn as ConsentState, Cr as cashReceiptRequestSchema, Ct as productReviewSortSchema, D as MyOrder, Di as MyOrderItemFulfillmentSnapshot, Dn as consentKindSchema, Dr as createCheckoutRequestSchema, Dt as reviewSummarySchema, E as DeliveryTracking, Ei as LineFulfillment, En as consentActionSchema, Er as checkoutSessionSchema, Et as reviewPageSchema, F as purchaseDecisionResultSchema, Fi as AddCartItemRequest, Fn as CreateClaimRequest, Fr as paymentMethodSchema, Ft as UpdateProfileRequest, G as AnalyticsEventName, Gn as CASH_RECEIPT_METHODS, Gr as retryPaymentRequestSchema, Gt as PublicInquiry, H as AnalyticsBatch, Hi as updateCartItemRequestSchema, Hn as createClaimResultSchema, Hr as remoteAreaSchema, Ht as CreateInquiryRequest, I as trackingStageResponseSchema, Ii as Cart, In as CreateClaimResult, Ir as paymentOptionKey, It as WishlistAddResult, J as analyticsClientEventNameSchema, Jn as CashReceiptType, Jr as CategoryNode, Jt as productInquiryCategorySchema, K as AnalyticsServerEventName, Kn as CashReceiptIdentityType, Kr as shippingAddressInputSchema, Kt as createInquiryRequestSchema, L as ANALYTICS_MAX_BATCH_BYTES, Li as CartItem, Ln as MyClaim, Lr as paymentOptionListSchema, Lt as memberAddressRequestSchema, M as myOrderItemSchema, Mi as myOrderItemFulfillmentSnapshotSchema, Mn as ClaimReason, Mr as guestInfoSchema, Mt as Member, N as myOrderSchema, Ni as productCardFulfillmentSchema, Nn as ClaimReturnAddress, Nr as paymentFailureCategorySchema, Nt as MemberAddress, O as MyOrderItem, Oi as ProductCardFulfillment, On as consentSourceSchema, Or as deliveryQuoteRequestSchema, Ot as updateReviewRequestSchema, P as orderShippingAddressSchema, Pi as productFulfillmentViewSchema, Pn as ClaimType, Pr as paymentMessageSchema, Pt as MemberAddressRequest, Q as StorefrontClient, Qn as DeliveryQuoteRequest, Qr as ProductCard, Qt as CustomerInquiryCategory, R as ANALYTICS_SESSION_COOKIE, Ri as UpdateCartItemRequest, Rn as claimReasonSchema, Rr as paymentOptionSchema, Rt as memberAddressSchema, S as memberPointEntryPageSchema, Si as claimStatusSchema, Sn as ConsentSource, Sr as cashReceiptIdentityTypeOf, St as productReviewQuerySchema, T as storefrontPointPolicySchema, Ti as pageSchema, Tn as MemberConsents, Tr as checkoutDeliverySchema, Tt as reviewImageUploadRequestSchema, U as AnalyticsClientEvent, Ui as analyticsIdsFromCookie, Un as myClaimSchema, Ur as residentNumberLike, Ut as CreateInquiryResult, V as ANALYTICS_VISITOR_HEADER, Vi as cartSchema, Vn as createClaimRequestSchema, Vr as pgProviderSchema, Vt as wishlistAddResultSchema, W as AnalyticsClientEventName, Wn as AvailablePaymentOption, Wr as responsePaymentMethodSchema, Wt as ProductInquiryCategory, X as analyticsIdSchema, Xn as CheckoutSession, Xr as CollectionProductParams, Xt as CreateCustomerInquiryRequest, Y as analyticsClientEventSchema, Yn as CheckoutDelivery, Yr as CollectionProductPage, Yt as publicInquirySchema, Z as analyticsServerEventNameSchema, Zn as CreateCheckoutRequest, Zr as CollectionProductSortParam, Zt as CustomerInquiry, _ as normalizeCustomInputValue, _i as storefrontCollectionSchema, _n as myCouponListQuerySchema, _r as RetryPaymentRequest, _t as UploadTicket, a as CustomInputEntry, ai as StorefrontCollectionDetail, an as CouponApplication, ar as PAYMENT_RESULT_VALUES, at as createStorefrontSession, b as MemberPoints, bi as PageInfo, bn as ConsentAction, br as availablePaymentOptionSchema, bt as createReviewResultSchema, c as OptionSelectionView, ci as collectionProductQuerySchema, cn as MIN_PAYMENT_AMOUNT, cr as PaymentFailureCategory, ct as MyReview, d as customInputEntrySchema, di as productDetailSchema, dn as checkoutPricingRequestSchema, dr as PaymentOption, dt as PublicReview, ei as ProductFacets, en as customerInquiryCategorySchema, er as EasyPayProvider, et as createStorefrontClient, f as customInputLength, fi as productFacetsSchema, fn as checkoutPricingSchema, fr as PaymentStart, ft as ReviewImageUploadRequest, g as lineSelectionResponseShape, gi as storefrontCollectionListQuerySchema, gn as couponResultSchema, gr as ResponsePaymentMethod, gt as UpdateReviewResult, h as lineSelectionRequestShape, hi as storefrontCollectionDetailSchema, hn as couponBenefitViewSchema, hr as RemoteArea, ht as UpdateReviewRequest, i as AddonSelection, ii as StorefrontCollection, in as CheckoutPricingRequest, ir as KnownPaymentStatus, it as StorefrontSessionOptions, j as deliveryTrackingSchema, ji as lineFulfillmentSchema, jn as memberConsentsSchema, jr as easyPayProviderSchema, jt as writableReviewSchema, k as OrderShippingAddress, ki as ProductFulfillmentView, kn as consentStateSchema, kr as deliveryQuoteSchema, kt as updateReviewResultSchema, l as addonGroupViewSchema, li as collectionProductSortSchema, ln as MyCoupon, lr as PaymentMessage, lt as ProductReviewParams, m as customInputViewSchema, mi as productSortSchema, mn as couponApplicationSchema, mr as PgProvider, mt as ReviewSummary, n as storefrontStoreSchema, ni as ProductSearchParams, nn as ApplicableCoupon, nr as KnownPaymentResult, nt as SessionStorage, o as CustomInputValueView, oi as categoryNodeSchema, on as CouponResult, or as PAYMENT_START_STATUS_VALUES, ot as CreateReviewRequest, p as customInputValueViewSchema, pi as productPageSchema, pn as couponApplicationListSchema, pr as PaymentStatus, pt as ReviewPage, q as analyticsBatchSchema, qn as CashReceiptRequest, qr as startPaymentRequestSchema, qt as createInquiryResultSchema, r as AddonGroupView, ri as ProductSort, rn as CheckoutPricing, rr as KnownPaymentStartStatus, rt as StorefrontSession, s as CustomInputView, si as collectionProductPageSchema, sn as MAX_COUPONS_PER_CHECKOUT, sr as PAYMENT_STATUS_VALUES, st as CreateReviewResult, t as StorefrontStore, ti as ProductPage, tn as customerInquirySchema, tr as GuestInfo, tt as STOREFRONT_SESSION_KEYS, u as addonSelectionSchema, ui as productCardSchema, un as applicableCouponSchema, ur as PaymentMethod, ut as ProductReviewSort, v as optionSelectionViewSchema, vi as ClaimStatus, vn as myCouponSchema, vr as ShippingAddressInput, vt as WritableReview, w as memberPointsSchema, wi as pageInfoSchema, wn as ConsentUpdateRequest, wr as cashReceiptTypeSchema, wt as publicReviewSchema, x as StorefrontPointPolicy, xi as PageParams, xn as ConsentKind, xr as cashReceiptAvailable, xt as myReviewSchema, y as MemberPointEntry, yi as OrderItemStatus, yn as pricingAmountsSchema, yr as StartPaymentRequest, yt as createReviewRequestSchema, z as ANALYTICS_SESSION_HEADER, zi as addCartItemRequestSchema, zn as claimReturnAddressSchema, zr as paymentStartSchema, zt as memberSchema } from "./index-BC2ogdyl.mjs";
3
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, CollectionProductPage, CollectionProductParams, CollectionProductSortParam, 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, KnownPaymentStartStatus, KnownPaymentStatus, LineFulfillment, LinkIdentityRequest, LoginRequest, MAX_COUPONS_PER_CHECKOUT, MIN_PAYMENT_AMOUNT, Member, MemberAddress, MemberAddressRequest, MemberConsents, MemberIdentities, MemberPointEntry, MemberPoints, MyClaim, MyCoupon, MyOrder, MyOrderItem, MyOrderItemFulfillmentSnapshot, MyReview, OptionSelectionView, OrderItemStatus, OrderShippingAddress, PAYMENT_RESULT_VALUES, PAYMENT_START_STATUS_VALUES, PAYMENT_STATUS_VALUES, PageInfo, PageParams, PaymentFailureCategory, PaymentMessage, PaymentMethod, PaymentOption, PaymentStart, PaymentStatus, PgProvider, ProductCard, ProductCardFulfillment, ProductDetail, ProductFacets, ProductFulfillmentView, ProductInquiryCategory, ProductPage, ProductReviewParams, ProductReviewSort, ProductSearchParams, ProductSort, PublicInquiry, PublicReview, PurchaseDecisionResult, type Query, RemoteArea, ResponsePaymentMethod, RetryPaymentRequest, ReviewImageUploadRequest, ReviewPage, ReviewSummary, STOREFRONT_SESSION_KEYS, type SessionStorage, ShippingAddressInput, SignupRequest, SocialProvider, StartPaymentRequest, type StorefrontClient, type StorefrontClientOptions, StorefrontCollection, StorefrontCollectionDetail, StorefrontPointPolicy, type StorefrontSession, type StorefrontSessionOptions, StorefrontStore, TokenPair, type TokenSource, UnknownFulfillmentView, UpdateCartItemRequest, UpdateProfileRequest, UpdateReviewRequest, UpdateReviewResult, UploadTicket, 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, collectionProductPageSchema, collectionProductQuerySchema, collectionProductSortSchema, 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, memberPointEntryPageSchema, memberPointEntrySchema, memberPointsSchema, memberSchema, myClaimSchema, myCouponListQuerySchema, myCouponSchema, myOrderItemFulfillmentSnapshotSchema, myOrderItemSchema, myOrderSchema, myReviewSchema, normalizeCustomInputValue, optionSelectionViewSchema, orderItemStatusSchema, orderShippingAddressSchema, pageInfoSchema, pageSchema, paymentFailureCategorySchema, paymentMessageSchema, paymentMethodSchema, paymentOptionKey, paymentOptionListSchema, paymentOptionSchema, paymentStartSchema, paymentStatusSchema, pgProviderSchema, pricingAmountsSchema, productCardFulfillmentSchema, productCardSchema, productDetailSchema, productFacetsSchema, productFulfillmentViewSchema, productInquiryCategorySchema, productPageSchema, productReviewQuerySchema, productReviewSortSchema, productSortSchema, publicInquirySchema, publicReviewSchema, purchaseDecisionResultSchema, remoteAreaSchema, residentNumberLike, responsePaymentMethodSchema, retryPaymentRequestSchema, reviewImageUploadRequestSchema, reviewPageSchema, reviewSummarySchema, shippingAddressInputSchema, signupRequestSchema, socialProviderSchema, startPaymentRequestSchema, storefrontCollectionDetailSchema, storefrontCollectionListQuerySchema, storefrontCollectionSchema, storefrontPointPolicySchema, storefrontStoreSchema, tokenPairSchema, trackingStageResponseSchema, updateCartItemRequestSchema, updateProfileRequestSchema, updateReviewRequestSchema, updateReviewResultSchema, uploadTicketSchema, 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 collectionProductSortSchema, A as wishlistAddResultSchema, At as buildQuery, B as consentSourceSchema, C as orderShippingAddressSchema, Ct as memberIdentitiesSchema, D as memberAddressSchema, Dt as withdrawRequestSchema, E as memberAddressRequestSchema, Et as tokenPairSchema, F as createCustomerInquiryRequestSchema, G as claimReturnAddressSchema, H as consentUpdateRequestSchema, I as customerInquiryCategorySchema, J as createClaimResultSchema, K as claimTypeSchema, L as customerInquirySchema, M as createInquiryResultSchema, Mt as unwrapData, N as productInquiryCategorySchema, O as memberSchema, Ot as withdrawalBlockedDetailsSchema, P as publicInquirySchema, Q as collectionProductQuerySchema, R as consentActionSchema, S as myOrderSchema, St as loginRequestSchema, T as trackingStageResponseSchema, Tt as socialProviderSchema, U as memberConsentsSchema, V as consentStateSchema, W as claimReasonSchema, X as categoryNodeSchema, Y as myClaimSchema, Z as collectionProductPageSchema, _ as memberPointEntrySchema, _t as idpAgreementsSchema, a as myReviewSchema, at as storefrontCollectionDetailSchema, b as deliveryTrackingSchema, bt as idpTokenRequestSchema, c as publicReviewSchema, ct as claimStatusSchema, d as reviewSummarySchema, dt as pageSchema, et as productCardSchema, f as updateReviewRequestSchema, ft as addCartItemRequestSchema, g as memberPointEntryPageSchema, gt as anonymousSessionSchema, h as writableReviewSchema, ht as updateCartItemRequestSchema, i as createReviewResultSchema, it as productSortSchema, j as createInquiryRequestSchema, jt as toApiError, k as updateProfileRequestSchema, kt as ApiError, l as reviewImageUploadRequestSchema, lt as orderItemStatusSchema, m as uploadTicketSchema, mt as cartSchema, n as storefrontStoreSchema, nt as productFacetsSchema, o as productReviewQuerySchema, ot as storefrontCollectionListQuerySchema, p as updateReviewResultSchema, pt as cartItemSchema, q as createClaimRequestSchema, r as createReviewRequestSchema, rt as productPageSchema, s as productReviewSortSchema, st as storefrontCollectionSchema, t as createStorefrontClient, tt as productDetailSchema, u as reviewPageSchema, ut as pageInfoSchema, v as memberPointsSchema, vt as idpAuthorizeRequestSchema, w as purchaseDecisionResultSchema, wt as signupRequestSchema, x as myOrderItemSchema, xt as linkIdentityRequestSchema, y as storefrontPointPolicySchema, yt as idpAuthorizeResponseSchema, z as consentKindSchema } from "./client-vMd6bgQs.mjs";
4
- import { $ as normalizeCustomInputValue, A as retryPaymentRequestSchema, B as couponBenefitViewSchema, C as paymentOptionSchema, D as remoteAreaSchema, E as pgProviderSchema, F as applicableCouponSchema, G as addonGroupViewSchema, H as myCouponListQuerySchema, I as checkoutPricingRequestSchema, J as customInputLength, K as addonSelectionSchema, L as checkoutPricingSchema, M as startPaymentRequestSchema, N as MAX_COUPONS_PER_CHECKOUT, O as residentNumberLike, P as MIN_PAYMENT_AMOUNT, Q as lineSelectionResponseShape, R as couponApplicationListSchema, S as paymentOptionListSchema, T as paymentStatusSchema, U as myCouponSchema, V as couponResultSchema, W as pricingAmountsSchema, X as customInputViewSchema, Y as customInputValueViewSchema, Z as lineSelectionRequestShape, _ as guestInfoSchema, a as availablePaymentOptionSchema, b as paymentMethodSchema, c as cashReceiptRequestSchema, d as checkoutSessionSchema, et as optionSelectionViewSchema, f as createCheckoutRequestSchema, g as easyPayProviderSchema, h as easyPayProviderResponseSchema, i as PAYMENT_STATUS_VALUES, it as productFulfillmentViewSchema, j as shippingAddressInputSchema, k as responsePaymentMethodSchema, l as cashReceiptTypeSchema, m as deliveryQuoteSchema, n as PAYMENT_RESULT_VALUES, nt as myOrderItemFulfillmentSnapshotSchema, o as cashReceiptAvailable, p as deliveryQuoteRequestSchema, q as customInputEntrySchema, r as PAYMENT_START_STATUS_VALUES, rt as productCardFulfillmentSchema, s as cashReceiptIdentityTypeOf, t as CASH_RECEIPT_METHODS, tt as lineFulfillmentSchema, u as checkoutDeliverySchema, v as paymentFailureCategorySchema, w as paymentStartSchema, x as paymentOptionKey, y as paymentMessageSchema, z as couponApplicationSchema } from "./checkout-DSAf758s.mjs";
3
+ import { $ as collectionProductSortSchema, A as wishlistAddResultSchema, At as buildQuery, B as consentSourceSchema, C as orderShippingAddressSchema, Ct as memberIdentitiesSchema, D as memberAddressSchema, Dt as withdrawRequestSchema, E as memberAddressRequestSchema, Et as tokenPairSchema, F as createCustomerInquiryRequestSchema, G as claimReturnAddressSchema, H as consentUpdateRequestSchema, I as customerInquiryCategorySchema, J as createClaimResultSchema, K as claimTypeSchema, L as customerInquirySchema, M as createInquiryResultSchema, Mt as unwrapData, N as productInquiryCategorySchema, O as memberSchema, Ot as withdrawalBlockedDetailsSchema, P as publicInquirySchema, Q as collectionProductQuerySchema, R as consentActionSchema, S as myOrderSchema, St as loginRequestSchema, T as trackingStageResponseSchema, Tt as socialProviderSchema, U as memberConsentsSchema, V as consentStateSchema, W as claimReasonSchema, X as categoryNodeSchema, Y as myClaimSchema, Z as collectionProductPageSchema, _ as memberPointEntrySchema, _t as idpAgreementsSchema, a as myReviewSchema, at as storefrontCollectionDetailSchema, b as deliveryTrackingSchema, bt as idpTokenRequestSchema, c as publicReviewSchema, ct as claimStatusSchema, d as reviewSummarySchema, dt as pageSchema, et as productCardSchema, f as updateReviewRequestSchema, ft as addCartItemRequestSchema, g as memberPointEntryPageSchema, gt as anonymousSessionSchema, h as writableReviewSchema, ht as updateCartItemRequestSchema, i as createReviewResultSchema, it as productSortSchema, j as createInquiryRequestSchema, jt as toApiError, k as updateProfileRequestSchema, kt as ApiError, l as reviewImageUploadRequestSchema, lt as orderItemStatusSchema, m as uploadTicketSchema, mt as cartSchema, n as storefrontStoreSchema, nt as productFacetsSchema, o as productReviewQuerySchema, ot as storefrontCollectionListQuerySchema, p as updateReviewResultSchema, pt as cartItemSchema, q as createClaimRequestSchema, r as createReviewRequestSchema, rt as productPageSchema, s as productReviewSortSchema, st as storefrontCollectionSchema, t as createStorefrontClient, tt as productDetailSchema, u as reviewPageSchema, ut as pageInfoSchema, v as memberPointsSchema, vt as idpAuthorizeRequestSchema, w as purchaseDecisionResultSchema, wt as signupRequestSchema, x as myOrderItemSchema, xt as linkIdentityRequestSchema, y as storefrontPointPolicySchema, yt as idpAuthorizeResponseSchema, z as consentKindSchema } from "./client-BTADfYXV.mjs";
4
+ import { $ as normalizeCustomInputValue, A as retryPaymentRequestSchema, B as couponBenefitViewSchema, C as paymentOptionSchema, D as remoteAreaSchema, E as pgProviderSchema, F as applicableCouponSchema, G as addonGroupViewSchema, H as myCouponListQuerySchema, I as checkoutPricingRequestSchema, J as customInputLength, K as addonSelectionSchema, L as checkoutPricingSchema, M as startPaymentRequestSchema, N as MAX_COUPONS_PER_CHECKOUT, O as residentNumberLike, P as MIN_PAYMENT_AMOUNT, Q as lineSelectionResponseShape, R as couponApplicationListSchema, S as paymentOptionListSchema, T as paymentStatusSchema, U as myCouponSchema, V as couponResultSchema, W as pricingAmountsSchema, X as customInputViewSchema, Y as customInputValueViewSchema, Z as lineSelectionRequestShape, _ as guestInfoSchema, a as availablePaymentOptionSchema, b as paymentMethodSchema, c as cashReceiptRequestSchema, d as checkoutSessionSchema, et as optionSelectionViewSchema, f as createCheckoutRequestSchema, g as easyPayProviderSchema, h as easyPayProviderResponseSchema, i as PAYMENT_STATUS_VALUES, it as productFulfillmentViewSchema, j as shippingAddressInputSchema, k as responsePaymentMethodSchema, l as cashReceiptTypeSchema, m as deliveryQuoteSchema, n as PAYMENT_RESULT_VALUES, nt as myOrderItemFulfillmentSnapshotSchema, o as cashReceiptAvailable, p as deliveryQuoteRequestSchema, q as customInputEntrySchema, r as PAYMENT_START_STATUS_VALUES, rt as productCardFulfillmentSchema, s as cashReceiptIdentityTypeOf, t as CASH_RECEIPT_METHODS, tt as lineFulfillmentSchema, u as checkoutDeliverySchema, v as paymentFailureCategorySchema, w as paymentStartSchema, x as paymentOptionKey, y as paymentMessageSchema, z as couponApplicationSchema } from "./checkout-D-cg8lLE.mjs";
5
5
  //#region src/session.ts
6
6
  /** 세션 키 상수 — SDK가 소유한다. store-sdk와 겹치지 않는 별도 네임스페이스. */
7
7
  const STOREFRONT_SESSION_KEYS = {
@@ -1,16 +1,25 @@
1
- import { dr as PaymentOption, et as createStorefrontClient, fr as PaymentStart, pr as PaymentStatus, qn as CashReceiptRequest, tr as GuestInfo, vr as ShippingAddressInput, yr as StartPaymentRequest } from "../index-C3kjGNxd.mjs";
1
+ import { dr as PaymentOption, et as createStorefrontClient, fr as PaymentStart, pr as PaymentStatus, qn as CashReceiptRequest, tr as GuestInfo, vr as ShippingAddressInput, yr as StartPaymentRequest } from "../index-BC2ogdyl.mjs";
2
2
  //#region src/payments/index.d.ts
3
3
  /**
4
4
  * 스토어프론트 결제 — 브라우저 전용(`@sayren/storefront-sdk/payments`).
5
5
  *
6
6
  * ```ts
7
7
  * const payments = createPayments({ client: sdk, returnUrl: `${location.origin}/checkout/return` });
8
- * const result = await payments.start(checkoutId, { option, shippingAddress }); // 결제창(팝업)
8
+ * // 금액 미리보기 — 고른 쿠폰·적립금 금액만 보내고 결제 금액·결제 필요 여부는 서버가 정한다
9
+ * const pricing = await sdk.checkout.pricing(checkoutId, { coupons: [{ code }], pointAmount });
10
+ * const result = await payments.start(checkoutId, {
11
+ * option: pricing.paymentRequired ? option : undefined, // 결제가 필요 없으면(적립금 전액) 결제수단을 보내지 않는다
12
+ * shippingAddress,
13
+ * coupons: [{ code }],
14
+ * pointAmount,
15
+ * }); // 결제창(팝업). 결제가 필요 없으면 창 없이 바로 COMPLETED
9
16
  * if (result.status === "COMPLETED") location.assign(`/orders/${result.orderId}`);
10
17
  * ```
11
18
  *
12
- * 결제 금액 전체를 적립금으로 낸 주문은 결제창이 없다. 결제 시작 응답이 `status: "completed"`·`payUrl: null`이면
13
- * SDK는 창을 열지 않고(미리 연 팝업은 닫는다) 바로 `COMPLETED`를 돌려준다. 화면 분기는 그대로다.
19
+ * **스토어프론트는 정보만 넘긴다.** 상품·옵션·수량, 쿠폰, 사용할 적립금 금액을 보내고 결제 금액과 결제가 필요한지는 서버와 SDK가 판단한다.
20
+ * 금액 미리보기(`checkout.pricing`)의 `paymentRequired`가 false면(적립금이 결제 금액 전체를 덮음) 결제수단 영역을 숨기고 `option` 없이
21
+ * `start`를 부른다. 결제 시작 응답이 `status: "completed"`·`payUrl: null`이면 SDK는 창을 열지 않고(미리 연 팝업은 닫는다) 바로
22
+ * `COMPLETED`를 돌려준다. 화면 분기는 그대로다.
14
23
  *
15
24
  * 결제창은 결제 서비스(`payUrl`)가 그린다. SDK는 그 창을 팝업으로 열고 결과 메시지를 받아 결제 상태 조회로 확정한다.
16
25
  * 모바일(또는 `mode: "redirect"`)에서는 현재 탭을 `payUrl`로 보내고, 결제가 끝나면 구매자가 `returnUrl`로 돌아온다 —
@@ -114,7 +123,12 @@ export interface PaymentsOptions {
114
123
  env?: PaymentsEnv;
115
124
  }
116
125
  export interface StartOptions {
117
- option: PaymentOption;
126
+ /**
127
+ * 결제 옵션. 스토어프론트는 고른 상품·쿠폰·적립금 금액만 넘기고 **결제가 필요한지는 서버·SDK가 판단한다**. 금액 미리보기
128
+ * (`checkout.pricing`)의 `paymentRequired`가 false(적립금이 전액을 덮음)면 결제수단을 고르지 않고 생략한다 — 서버가 결제창 없이 주문을
129
+ * 만들고 `start`는 창을 열지 않고 `COMPLETED`를 돌려준다. 결제가 필요한데 생략하면 서버가 400 `VALIDATION_FAILED`로 거절한다
130
+ */
131
+ option?: PaymentOption;
118
132
  /** 배송지 — 주문서의 `requiresShipping`이 false(배송이 필요 없는 주문)면 생략한다 */
119
133
  shippingAddress?: ShippingAddressInput;
120
134
  guest?: GuestInfo;
@@ -122,6 +136,8 @@ export interface StartOptions {
122
136
  cashReceipt?: CashReceiptRequest;
123
137
  /** 적용할 쿠폰 — 결제 시작이 예약하고 할인한 금액으로 결제한다 */
124
138
  coupons?: StartPaymentRequest["coupons"];
139
+ /** 쓸 적립금(회원만) — 결제 금액 전체를 덮으면 결제창 없이 바로 완료된다 */
140
+ pointAmount?: number;
125
141
  returnUrl?: string;
126
142
  mode?: PaymentMode;
127
143
  /** 클릭 시점에 {@link Payments.prepareWindow}로 미리 연 창. 폼 검증이 비동기라 클릭 태스크를 넘길 때 쓴다 */
@@ -1,4 +1,4 @@
1
- import { y as paymentMessageSchema } from "../checkout-DSAf758s.mjs";
1
+ import { y as paymentMessageSchema } from "../checkout-D-cg8lLE.mjs";
2
2
  //#region src/payments/index.ts
3
3
  /** 복귀 주소에 결제 서비스가 붙이는 쿼리 */
4
4
  const RETURN_PAYMENT_ID = "sayrenPaymentId";
@@ -312,6 +312,7 @@ function createPayments(options) {
312
312
  guest: startOptions.guest,
313
313
  ...startOptions.cashReceipt ? { cashReceipt: startOptions.cashReceipt } : {},
314
314
  ...startOptions.coupons ? { coupons: startOptions.coupons } : {},
315
+ ...startOptions.pointAmount ? { pointAmount: startOptions.pointAmount } : {},
315
316
  returnUrl
316
317
  }));
317
318
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sayren/storefront-sdk",
3
- "version": "0.20.2",
3
+ "version": "0.20.4",
4
4
  "main": "./dist/index.mjs",
5
5
  "types": "./dist/index.d.mts",
6
6
  "exports": {
@@ -15,12 +15,21 @@ import {
15
15
  *
16
16
  * ```ts
17
17
  * const payments = createPayments({ client: sdk, returnUrl: `${location.origin}/checkout/return` });
18
- * const result = await payments.start(checkoutId, { option, shippingAddress }); // 결제창(팝업)
18
+ * // 금액 미리보기 — 고른 쿠폰·적립금 금액만 보내고 결제 금액·결제 필요 여부는 서버가 정한다
19
+ * const pricing = await sdk.checkout.pricing(checkoutId, { coupons: [{ code }], pointAmount });
20
+ * const result = await payments.start(checkoutId, {
21
+ * option: pricing.paymentRequired ? option : undefined, // 결제가 필요 없으면(적립금 전액) 결제수단을 보내지 않는다
22
+ * shippingAddress,
23
+ * coupons: [{ code }],
24
+ * pointAmount,
25
+ * }); // 결제창(팝업). 결제가 필요 없으면 창 없이 바로 COMPLETED
19
26
  * if (result.status === "COMPLETED") location.assign(`/orders/${result.orderId}`);
20
27
  * ```
21
28
  *
22
- * 결제 금액 전체를 적립금으로 낸 주문은 결제창이 없다. 결제 시작 응답이 `status: "completed"`·`payUrl: null`이면
23
- * SDK는 창을 열지 않고(미리 연 팝업은 닫는다) 바로 `COMPLETED`를 돌려준다. 화면 분기는 그대로다.
29
+ * **스토어프론트는 정보만 넘긴다.** 상품·옵션·수량, 쿠폰, 사용할 적립금 금액을 보내고 결제 금액과 결제가 필요한지는 서버와 SDK가 판단한다.
30
+ * 금액 미리보기(`checkout.pricing`)의 `paymentRequired`가 false면(적립금이 결제 금액 전체를 덮음) 결제수단 영역을 숨기고 `option` 없이
31
+ * `start`를 부른다. 결제 시작 응답이 `status: "completed"`·`payUrl: null`이면 SDK는 창을 열지 않고(미리 연 팝업은 닫는다) 바로
32
+ * `COMPLETED`를 돌려준다. 화면 분기는 그대로다.
24
33
  *
25
34
  * 결제창은 결제 서비스(`payUrl`)가 그린다. SDK는 그 창을 팝업으로 열고 결과 메시지를 받아 결제 상태 조회로 확정한다.
26
35
  * 모바일(또는 `mode: "redirect"`)에서는 현재 탭을 `payUrl`로 보내고, 결제가 끝나면 구매자가 `returnUrl`로 돌아온다 —
@@ -244,7 +253,12 @@ export interface PaymentsOptions {
244
253
  }
245
254
 
246
255
  export interface StartOptions {
247
- option: PaymentOption;
256
+ /**
257
+ * 결제 옵션. 스토어프론트는 고른 상품·쿠폰·적립금 금액만 넘기고 **결제가 필요한지는 서버·SDK가 판단한다**. 금액 미리보기
258
+ * (`checkout.pricing`)의 `paymentRequired`가 false(적립금이 전액을 덮음)면 결제수단을 고르지 않고 생략한다 — 서버가 결제창 없이 주문을
259
+ * 만들고 `start`는 창을 열지 않고 `COMPLETED`를 돌려준다. 결제가 필요한데 생략하면 서버가 400 `VALIDATION_FAILED`로 거절한다
260
+ */
261
+ option?: PaymentOption;
248
262
  /** 배송지 — 주문서의 `requiresShipping`이 false(배송이 필요 없는 주문)면 생략한다 */
249
263
  shippingAddress?: ShippingAddressInput;
250
264
  guest?: GuestInfo;
@@ -252,6 +266,8 @@ export interface StartOptions {
252
266
  cashReceipt?: CashReceiptRequest;
253
267
  /** 적용할 쿠폰 — 결제 시작이 예약하고 할인한 금액으로 결제한다 */
254
268
  coupons?: StartPaymentRequest["coupons"];
269
+ /** 쓸 적립금(회원만) — 결제 금액 전체를 덮으면 결제창 없이 바로 완료된다 */
270
+ pointAmount?: number;
255
271
  returnUrl?: string;
256
272
  mode?: PaymentMode;
257
273
  /** 클릭 시점에 {@link Payments.prepareWindow}로 미리 연 창. 폼 검증이 비동기라 클릭 태스크를 넘길 때 쓴다 */
@@ -562,6 +578,7 @@ export function createPayments(options: PaymentsOptions): Payments {
562
578
  guest: startOptions.guest,
563
579
  ...(startOptions.cashReceipt ? { cashReceipt: startOptions.cashReceipt } : {}),
564
580
  ...(startOptions.coupons ? { coupons: startOptions.coupons } : {}),
581
+ ...(startOptions.pointAmount ? { pointAmount: startOptions.pointAmount } : {}),
565
582
  returnUrl,
566
583
  }),
567
584
  );
@@ -105,6 +105,17 @@ export const productDetailSchema = productCardSchema.extend({
105
105
  ),
106
106
  fulfillment: productFulfillmentViewSchema,
107
107
  returnPeriodDays: z.number().int().describe("반품·교환을 받는 기간(수령·제공일부터 일수)"),
108
+ purchasePoint: z
109
+ .number()
110
+ .int()
111
+ .nullable()
112
+ .optional()
113
+ .default(null)
114
+ .describe(
115
+ "구매 적립 예정액(원, 이슈 #93). 상품 1개를 지금 가격(`discountedPrice ?? salePrice`, 옵션 추가금·쿠폰·배송비 제외)으로 샀을 때 " +
116
+ "구매확정 뒤 받는 적립금이다. 상점 구매 적립률과 상품별 적립률로 서버가 계산한다. 구매 적립이 꺼져 있거나 적립 안 함 상품, " +
117
+ "계산값이 0원이면 null이다. 적립은 회원 주문만 받는다. 화면은 값이 있을 때 「구매 시 n원 적립」으로 그대로 보이면 된다",
118
+ ),
108
119
  categoryPath: z.array(z.object({ categoryId: z.string(), name: z.string() })),
109
120
  });
110
121
 
@@ -418,7 +418,11 @@ const cashReceiptField = cashReceiptRequestSchema
418
418
  * `returnUrl`의 도메인은 상점 결제 도메인(상점 플랫폼 설정 › 결제)에 등록돼 있어야 한다(테스트 결제는 localhost 허용).
419
419
  */
420
420
  export const startPaymentRequestSchema = z.object({
421
- option: paymentOptionSchema,
421
+ option: paymentOptionSchema
422
+ .optional()
423
+ .describe(
424
+ "결제 옵션. 결제 금액이 남으면 필수이고 없으면 400 `VALIDATION_FAILED`다. 적립금이 결제 금액 전체를 덮는 주문(0원 결제, #93)은 생략한다",
425
+ ),
422
426
  returnUrl: z
423
427
  .url()
424
428
  .max(2048)
@@ -446,7 +450,8 @@ export const startPaymentRequestSchema = z.object({
446
450
  .min(0)
447
451
  .optional()
448
452
  .describe(
449
- "쓸 적립금(#93, 회원만). 결제 시작이 예약하고 쿠폰 뒤 금액에서 뺀다 — 응답 `amounts.pointAmount`가 실제 사용액이다(단위로 내리고 결제 금액 100원을 남긴다). " +
453
+ "쓸 적립금(#93, 회원만). 결제 시작이 예약하고 쿠폰 뒤 금액에서 뺀다 — 응답 `amounts.pointAmount`가 실제 사용액이다(단위로 내리고, 남는 결제 금액이 1~99원이면 100원을 남긴다). " +
454
+ '적립금이 결제 금액 전체를 덮으면 결제창 없이 이 요청에서 주문이 만들어진다(응답 `status: "completed"`·`orderId`, `payUrl`·`attemptId`·`option`은 null). ' +
450
455
  "적립금 사용이 꺼져 있으면 409 `POINTS_UNAVAILABLE`, 쓸 수 없으면 400 `POINT_NOT_APPLICABLE`(`details.reason`), 그 사이 잔액이 줄었으면 409 `POINT_BALANCE_CHANGED`다. " +
451
456
  "결제가 실패하거나 만료되면 예약이 풀린다",
452
457
  ),
@@ -170,7 +170,15 @@ export const checkoutPricingSchema = z.object({
170
170
  payable: z
171
171
  .boolean()
172
172
  .describe(
173
- "이 금액으로 결제를 시작할 수 있는가 — 적용하지 못한 쿠폰이 있거나 결제 금액이 100원 미만이면 false",
173
+ "이 금액으로 결제를 시작할 수 있는가 — 적용하지 못한 쿠폰이 있거나 결제 금액이 1~99원이면 false(0원은 적립금 전액 결제라 true)",
174
+ ),
175
+ paymentRequired: z
176
+ .boolean()
177
+ .optional()
178
+ .default(true)
179
+ .describe(
180
+ "결제수단으로 낼 금액이 남는가(#93). false면 적립금이 결제 금액 전체를 덮어 결제창 없이 끝나므로 결제수단을 고르지 않고 결제 시작에 " +
181
+ "`option`을 보내지 않는다. 판단은 서버가 한다 — 스토어프론트가 금액을 계산해 정하지 않는다. 필드가 없는 이전 응답은 true로 읽는다",
174
182
  ),
175
183
  });
176
184
  export type CheckoutPricing = z.infer<typeof checkoutPricingSchema>;