@sayren/storefront-sdk 0.4.0 → 0.5.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.
@@ -1,4 +1,4 @@
1
- import { rt as ApiError, t as createStorefrontClient } from "../client-DHISrvXq.mjs";
1
+ import { it as ApiError, t as createStorefrontClient } from "../client-D-w3LIU2.mjs";
2
2
  //#region src/auth/index.ts
3
3
  /**
4
4
  * 구매자 인증 — 화면은 스토어프런트가 그리고, 계정 저장과 인증 처리는 sayren이 한다.
@@ -642,6 +642,23 @@ const updateReviewRequestSchema = z.object({
642
642
  images: z.array(z.url()).max(5).optional()
643
643
  }).refine((value) => Object.values(value).some((v) => v !== void 0), { message: "최소 1개 필드가 필요합니다" });
644
644
  //#endregion
645
+ //#region src/schemas/store.ts
646
+ /**
647
+ * 스토어 공개 설정 — `GET /store`. 스토어프런트가 화면을 그릴 때 읽는 값만 담는다.
648
+ */
649
+ const storefrontStoreSchema = z.object({
650
+ storeCode: z.string(),
651
+ name: z.string(),
652
+ logoUrl: z.string().nullable(),
653
+ customerCenterPhone: z.string().nullable(),
654
+ businessHours: z.string().nullable(),
655
+ /**
656
+ * 비회원 주문 허용. false면 로그인하지 않은 구매자의 주문서 생성·결제 요청이 403 `GUEST_CHECKOUT_DISABLED`다.
657
+ * 장바구니 담기는 된다 — 주문 버튼을 로그인 안내로 바꾸면 된다
658
+ */
659
+ guestCheckout: z.boolean()
660
+ });
661
+ //#endregion
645
662
  //#region src/client.ts
646
663
  const productPageSchema = pageSchema(productCardSchema).extend({ facets: productFacetsSchema.optional() });
647
664
  const reviewPageSchema = pageSchema(publicReviewSchema).extend({ summary: reviewSummarySchema.optional() });
@@ -698,6 +715,9 @@ function createStorefrontClient(options) {
698
715
  /** 구매자 탈퇴 — 로그인 상태(accessToken)에서 비밀번호로 본인 확인. 성공하면 토큰은 모두 무효 */
699
716
  withdraw: (body) => http.requestVoid("POST", "/auth/withdraw", { body: withdrawRequestSchema.parse(body) })
700
717
  },
718
+ store: {
719
+ /** 스토어 공개 설정 — 이름·고객센터·비회원 주문 허용 여부 */
720
+ get: () => http.request("GET", "/store", storefrontStoreSchema) },
701
721
  catalog: {
702
722
  listCategories: () => http.request("GET", "/categories", z.array(categoryNodeSchema)),
703
723
  searchProducts: (params) => http.request("GET", "/products", productPageSchema, { query: params }),
@@ -790,4 +810,4 @@ getStatus: (paymentId) => http.request("GET", path`/payments/${paymentId}`, paym
790
810
  };
791
811
  }
792
812
  //#endregion
793
- export { signupRequestSchema as $, PAYMENT_STATUS_VALUES as A, requestPaymentRequestSchema as B, createClaimRequestSchema as C, orderItemStatusSchema as D, claimStatusSchema as E, guestInfoSchema as F, productFacetsSchema as G, categoryNodeSchema as H, paymentMethodSchema as I, cartItemSchema as J, productSortSchema as K, paymentParamsSchema as L, confirmPaymentRequestSchema as M, confirmPaymentResultSchema as N, pageInfoSchema as O, createCheckoutRequestSchema as P, loginRequestSchema as Q, paymentStatusSchema as R, claimTypeSchema as S, myClaimSchema as T, productCardSchema as U, shippingAddressInputSchema as V, productDetailSchema as W, updateCartItemRequestSchema as X, cartSchema as Y, anonymousSessionSchema as Z, publicInquirySchema as _, reviewSummarySchema as a, toApiError as at, customerInquirySchema as b, deliveryTrackingSchema as c, orderShippingAddressSchema as d, tokenPairSchema as et, memberAddressRequestSchema as f, createInquiryRequestSchema as g, updateProfileRequestSchema as h, publicReviewSchema as i, buildQuery as it, checkoutSessionSchema as j, pageSchema as k, myOrderItemSchema as l, memberSchema as m, createReviewRequestSchema as n, withdrawalBlockedDetailsSchema as nt, updateReviewRequestSchema as o, unwrapData as ot, memberAddressSchema as p, addCartItemRequestSchema as q, createReviewResultSchema as r, ApiError as rt, writableReviewSchema as s, createStorefrontClient as t, withdrawRequestSchema as tt, myOrderSchema as u, createCustomerInquiryRequestSchema as v, createClaimResultSchema as w, claimReasonSchema as x, customerInquiryCategorySchema as y, pgParamsSchema as z };
813
+ export { loginRequestSchema as $, pageSchema as A, pgParamsSchema as B, claimTypeSchema as C, claimStatusSchema as D, myClaimSchema as E, createCheckoutRequestSchema as F, productDetailSchema as G, shippingAddressInputSchema as H, guestInfoSchema as I, addCartItemRequestSchema as J, productFacetsSchema as K, paymentMethodSchema as L, checkoutSessionSchema as M, confirmPaymentRequestSchema as N, orderItemStatusSchema as O, confirmPaymentResultSchema as P, anonymousSessionSchema as Q, paymentParamsSchema as R, claimReasonSchema as S, createClaimResultSchema as T, categoryNodeSchema as U, requestPaymentRequestSchema as V, productCardSchema as W, cartSchema as X, cartItemSchema as Y, updateCartItemRequestSchema as Z, createInquiryRequestSchema as _, publicReviewSchema as a, buildQuery as at, customerInquiryCategorySchema as b, writableReviewSchema as c, myOrderSchema as d, signupRequestSchema as et, orderShippingAddressSchema as f, updateProfileRequestSchema as g, memberSchema as h, createReviewResultSchema as i, ApiError as it, PAYMENT_STATUS_VALUES as j, pageInfoSchema as k, deliveryTrackingSchema as l, memberAddressSchema as m, storefrontStoreSchema as n, withdrawRequestSchema as nt, reviewSummarySchema as o, toApiError as ot, memberAddressRequestSchema as p, productSortSchema as q, createReviewRequestSchema as r, withdrawalBlockedDetailsSchema as rt, updateReviewRequestSchema as s, unwrapData as st, createStorefrontClient as t, tokenPairSchema as tt, myOrderItemSchema as u, publicInquirySchema as v, createClaimRequestSchema as w, customerInquirySchema as x, createCustomerInquiryRequestSchema as y, paymentStatusSchema as z };
package/dist/index.d.mts CHANGED
@@ -704,6 +704,17 @@ export declare function createStorefrontClient(options: StorefrontClientOptions)
704
704
  /** 구매자 탈퇴 — 로그인 상태(accessToken)에서 비밀번호로 본인 확인. 성공하면 토큰은 모두 무효 */
705
705
  withdraw: (body: WithdrawRequest) => Promise<void>;
706
706
  };
707
+ store: {
708
+ /** 스토어 공개 설정 — 이름·고객센터·비회원 주문 허용 여부 */
709
+ get: () => Promise<{
710
+ storeCode: string;
711
+ name: string;
712
+ logoUrl: string | null;
713
+ customerCenterPhone: string | null;
714
+ businessHours: string | null;
715
+ guestCheckout: boolean;
716
+ }>;
717
+ };
707
718
  catalog: {
708
719
  listCategories: () => Promise<CategoryNode[]>;
709
720
  searchProducts: (params?: ProductSearchParams) => Promise<{
@@ -1485,4 +1496,18 @@ export declare const deliveryTrackingSchema: z.ZodObject<{
1485
1496
  }, z.core.$strip>;
1486
1497
  export type DeliveryTracking = z.infer<typeof deliveryTrackingSchema>;
1487
1498
  //#endregion
1499
+ //#region src/schemas/store.d.ts
1500
+ /**
1501
+ * 스토어 공개 설정 — `GET /store`. 스토어프런트가 화면을 그릴 때 읽는 값만 담는다.
1502
+ */
1503
+ export declare const storefrontStoreSchema: z.ZodObject<{
1504
+ storeCode: z.ZodString;
1505
+ name: z.ZodString;
1506
+ logoUrl: z.ZodNullable<z.ZodString>;
1507
+ customerCenterPhone: z.ZodNullable<z.ZodString>;
1508
+ businessHours: z.ZodNullable<z.ZodString>;
1509
+ guestCheckout: z.ZodBoolean;
1510
+ }, z.core.$strip>;
1511
+ export type StorefrontStore = z.infer<typeof storefrontStoreSchema>;
1512
+ //#endregion
1488
1513
  export { AnonymousSession, ApiError, LoginRequest, type Query, type SessionStorage, SignupRequest, type StorefrontClient, type StorefrontClientOptions, type StorefrontSession, type StorefrontSessionOptions, TokenPair, type TokenSource, WithdrawRequest, WithdrawalBlockedDetails, anonymousSessionSchema, buildQuery, loginRequestSchema, signupRequestSchema, tokenPairSchema, withdrawRequestSchema, withdrawalBlockedDetailsSchema };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
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 signupRequestSchema, A as PAYMENT_STATUS_VALUES, B as requestPaymentRequestSchema, C as createClaimRequestSchema, D as orderItemStatusSchema, E as claimStatusSchema, F as guestInfoSchema, G as productFacetsSchema, H as categoryNodeSchema, I as paymentMethodSchema, J as cartItemSchema, K as productSortSchema, L as paymentParamsSchema, M as confirmPaymentRequestSchema, N as confirmPaymentResultSchema, O as pageInfoSchema, P as createCheckoutRequestSchema, Q as loginRequestSchema, R as paymentStatusSchema, S as claimTypeSchema, T as myClaimSchema, U as productCardSchema, V as shippingAddressInputSchema, W as productDetailSchema, X as updateCartItemRequestSchema, Y as cartSchema, Z as anonymousSessionSchema, _ as publicInquirySchema, a as reviewSummarySchema, at as toApiError, b as customerInquirySchema, c as deliveryTrackingSchema, d as orderShippingAddressSchema, et as tokenPairSchema, f as memberAddressRequestSchema, g as createInquiryRequestSchema, h as updateProfileRequestSchema, i as publicReviewSchema, it as buildQuery, j as checkoutSessionSchema, k as pageSchema, l as myOrderItemSchema, m as memberSchema, n as createReviewRequestSchema, nt as withdrawalBlockedDetailsSchema, o as updateReviewRequestSchema, ot as unwrapData, p as memberAddressSchema, q as addCartItemRequestSchema, r as createReviewResultSchema, rt as ApiError, s as writableReviewSchema, t as createStorefrontClient, tt as withdrawRequestSchema, u as myOrderSchema, v as createCustomerInquiryRequestSchema, w as createClaimResultSchema, x as claimReasonSchema, y as customerInquiryCategorySchema, z as pgParamsSchema } from "./client-DHISrvXq.mjs";
3
+ import { $ as loginRequestSchema, A as pageSchema, B as pgParamsSchema, C as claimTypeSchema, D as claimStatusSchema, E as myClaimSchema, F as createCheckoutRequestSchema, G as productDetailSchema, H as shippingAddressInputSchema, I as guestInfoSchema, J as addCartItemRequestSchema, K as productFacetsSchema, L as paymentMethodSchema, M as checkoutSessionSchema, N as confirmPaymentRequestSchema, O as orderItemStatusSchema, P as confirmPaymentResultSchema, Q as anonymousSessionSchema, R as paymentParamsSchema, S as claimReasonSchema, T as createClaimResultSchema, U as categoryNodeSchema, V as requestPaymentRequestSchema, W as productCardSchema, X as cartSchema, Y as cartItemSchema, Z as updateCartItemRequestSchema, _ as createInquiryRequestSchema, a as publicReviewSchema, at as buildQuery, b as customerInquiryCategorySchema, c as writableReviewSchema, d as myOrderSchema, et as signupRequestSchema, f as orderShippingAddressSchema, g as updateProfileRequestSchema, h as memberSchema, i as createReviewResultSchema, it as ApiError, j as PAYMENT_STATUS_VALUES, k as pageInfoSchema, l as deliveryTrackingSchema, m as memberAddressSchema, n as storefrontStoreSchema, nt as withdrawRequestSchema, o as reviewSummarySchema, ot as toApiError, p as memberAddressRequestSchema, q as productSortSchema, r as createReviewRequestSchema, rt as withdrawalBlockedDetailsSchema, s as updateReviewRequestSchema, st as unwrapData, t as createStorefrontClient, tt as tokenPairSchema, u as myOrderItemSchema, v as publicInquirySchema, w as createClaimRequestSchema, x as customerInquirySchema, y as createCustomerInquiryRequestSchema, z as paymentStatusSchema } from "./client-D-w3LIU2.mjs";
4
4
  //#region src/session.ts
5
5
  /** 세션 키 상수 — SDK가 소유한다. store-sdk와 겹치지 않는 별도 네임스페이스. */
6
6
  const STOREFRONT_SESSION_KEYS = {
@@ -124,4 +124,4 @@ function createStorefrontSession(options) {
124
124
  };
125
125
  }
126
126
  //#endregion
127
- export { ANALYTICS_MAX_BATCH_BYTES, ANALYTICS_SESSION_COOKIE, ANALYTICS_SESSION_HEADER, ANALYTICS_VISITOR_COOKIE, ANALYTICS_VISITOR_HEADER, ApiError, PAYMENT_STATUS_VALUES, STOREFRONT_SESSION_KEYS, addCartItemRequestSchema, analyticsBatchSchema, analyticsClientEventNameSchema, analyticsClientEventSchema, analyticsIdSchema, analyticsIdsFromCookie, analyticsServerEventNameSchema, anonymousSessionSchema, buildQuery, cartItemSchema, cartSchema, categoryNodeSchema, checkoutSessionSchema, claimReasonSchema, claimStatusSchema, claimTypeSchema, confirmPaymentRequestSchema, confirmPaymentResultSchema, createCheckoutRequestSchema, createClaimRequestSchema, createClaimResultSchema, createCustomerInquiryRequestSchema, createInquiryRequestSchema, createReviewRequestSchema, createReviewResultSchema, createStorefrontClient, createStorefrontSession, customerInquiryCategorySchema, customerInquirySchema, deliveryTrackingSchema, guestInfoSchema, loginRequestSchema, memberAddressRequestSchema, memberAddressSchema, memberSchema, myClaimSchema, myOrderItemSchema, myOrderSchema, orderItemStatusSchema, orderShippingAddressSchema, pageInfoSchema, pageSchema, paymentMethodSchema, paymentParamsSchema, paymentStatusSchema, pgParamsSchema, productCardSchema, productDetailSchema, productFacetsSchema, productSortSchema, publicInquirySchema, publicReviewSchema, requestPaymentRequestSchema, reviewSummarySchema, shippingAddressInputSchema, signupRequestSchema, tokenPairSchema, updateCartItemRequestSchema, updateProfileRequestSchema, updateReviewRequestSchema, withdrawRequestSchema, withdrawalBlockedDetailsSchema, writableReviewSchema };
127
+ export { ANALYTICS_MAX_BATCH_BYTES, ANALYTICS_SESSION_COOKIE, ANALYTICS_SESSION_HEADER, ANALYTICS_VISITOR_COOKIE, ANALYTICS_VISITOR_HEADER, ApiError, PAYMENT_STATUS_VALUES, STOREFRONT_SESSION_KEYS, addCartItemRequestSchema, analyticsBatchSchema, analyticsClientEventNameSchema, analyticsClientEventSchema, analyticsIdSchema, analyticsIdsFromCookie, analyticsServerEventNameSchema, anonymousSessionSchema, buildQuery, cartItemSchema, cartSchema, categoryNodeSchema, checkoutSessionSchema, claimReasonSchema, claimStatusSchema, claimTypeSchema, confirmPaymentRequestSchema, confirmPaymentResultSchema, createCheckoutRequestSchema, createClaimRequestSchema, createClaimResultSchema, createCustomerInquiryRequestSchema, createInquiryRequestSchema, createReviewRequestSchema, createReviewResultSchema, createStorefrontClient, createStorefrontSession, customerInquiryCategorySchema, customerInquirySchema, deliveryTrackingSchema, guestInfoSchema, loginRequestSchema, memberAddressRequestSchema, memberAddressSchema, memberSchema, myClaimSchema, myOrderItemSchema, myOrderSchema, orderItemStatusSchema, orderShippingAddressSchema, pageInfoSchema, pageSchema, paymentMethodSchema, paymentParamsSchema, paymentStatusSchema, pgParamsSchema, productCardSchema, productDetailSchema, productFacetsSchema, productSortSchema, publicInquirySchema, publicReviewSchema, requestPaymentRequestSchema, reviewSummarySchema, shippingAddressInputSchema, signupRequestSchema, storefrontStoreSchema, tokenPairSchema, updateCartItemRequestSchema, updateProfileRequestSchema, updateReviewRequestSchema, withdrawRequestSchema, withdrawalBlockedDetailsSchema, writableReviewSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sayren/storefront-sdk",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "main": "./dist/index.mjs",
5
5
  "types": "./dist/index.d.mts",
6
6
  "exports": {
package/src/client.ts CHANGED
@@ -73,6 +73,7 @@ import {
73
73
  updateReviewRequestSchema,
74
74
  writableReviewSchema,
75
75
  } from "./schemas/review";
76
+ import { storefrontStoreSchema } from "./schemas/store";
76
77
  import type { StorefrontSession } from "./session";
77
78
 
78
79
  export interface StorefrontClientOptions {
@@ -188,6 +189,11 @@ export function createStorefrontClient(options: StorefrontClientOptions) {
188
189
  http.requestVoid("POST", "/auth/withdraw", { body: withdrawRequestSchema.parse(body) }),
189
190
  },
190
191
 
192
+ store: {
193
+ /** 스토어 공개 설정 — 이름·고객센터·비회원 주문 허용 여부 */
194
+ get: () => http.request("GET", "/store", storefrontStoreSchema),
195
+ },
196
+
191
197
  catalog: {
192
198
  listCategories: () => http.request("GET", "/categories", z.array(categoryNodeSchema)),
193
199
  searchProducts: (params?: ProductSearchParams) =>
package/src/index.ts CHANGED
@@ -15,6 +15,7 @@ export * from "./schemas/inquiry";
15
15
  export * from "./schemas/member";
16
16
  export * from "./schemas/order";
17
17
  export * from "./schemas/review";
18
+ export * from "./schemas/store";
18
19
  export {
19
20
  createStorefrontSession,
20
21
  type SessionStorage,
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+
3
+ /**
4
+ * 스토어 공개 설정 — `GET /store`. 스토어프런트가 화면을 그릴 때 읽는 값만 담는다.
5
+ */
6
+ export const storefrontStoreSchema = z.object({
7
+ storeCode: z.string(),
8
+ name: z.string(),
9
+ logoUrl: z.string().nullable(),
10
+ customerCenterPhone: z.string().nullable(),
11
+ businessHours: z.string().nullable(),
12
+ /**
13
+ * 비회원 주문 허용. false면 로그인하지 않은 구매자의 주문서 생성·결제 요청이 403 `GUEST_CHECKOUT_DISABLED`다.
14
+ * 장바구니 담기는 된다 — 주문 버튼을 로그인 안내로 바꾸면 된다
15
+ */
16
+ guestCheckout: z.boolean(),
17
+ });
18
+
19
+ export type StorefrontStore = z.infer<typeof storefrontStoreSchema>;